forked from nikkuss/x1e-nixos
Compare commits
7 Commits
95f3f072da
..
main
| Author | SHA1 | Date | |
|---|---|---|---|
| c8afdbf71a | |||
| 30c7f18e47 | |||
| 931cf9966b | |||
| 0569ea2dd4 | |||
| 1fb1fe06fa | |||
| 2e28a8f948 | |||
|
f4bc76c1dc
|
@@ -62,6 +62,11 @@
|
|||||||
"clk_ignore_unused"
|
"clk_ignore_unused"
|
||||||
"pd_ignore_unused"
|
"pd_ignore_unused"
|
||||||
"iomem=relaxed"
|
"iomem=relaxed"
|
||||||
|
"mem_sleep_default=s2idle"
|
||||||
|
];
|
||||||
|
|
||||||
|
blacklistedKernelModules = [
|
||||||
|
"qcrypto"
|
||||||
];
|
];
|
||||||
|
|
||||||
supportedFilesystems = {
|
supportedFilesystems = {
|
||||||
|
|||||||
@@ -1,11 +1,15 @@
|
|||||||
{
|
{
|
||||||
description = "Surface Laptop 7 (x1e80100 / Snapdragon X Elite) kernel and hardware support";
|
description = "Surface Laptop 7 (x1e80100 / Snapdragon X Elite) kernel and hardware support";
|
||||||
|
|
||||||
outputs = { self }: {
|
outputs =
|
||||||
|
{ self }:
|
||||||
|
{
|
||||||
nixosModules = {
|
nixosModules = {
|
||||||
default = self.nixosModules.all;
|
default = self.nixosModules.all;
|
||||||
|
|
||||||
all = { ... }: {
|
all =
|
||||||
|
{ ... }:
|
||||||
|
{
|
||||||
imports = [
|
imports = [
|
||||||
self.nixosModules.kernel
|
self.nixosModules.kernel
|
||||||
self.nixosModules.kernel-modules
|
self.nixosModules.kernel-modules
|
||||||
|
|||||||
+19
-4
@@ -1,13 +1,23 @@
|
|||||||
{ config, lib, pkgs, ... }:
|
{
|
||||||
|
config,
|
||||||
|
lib,
|
||||||
|
pkgs,
|
||||||
|
...
|
||||||
|
}:
|
||||||
let
|
let
|
||||||
dtbName = {
|
dtbName =
|
||||||
|
{
|
||||||
"13" = "qcom/x1e80100-microsoft-romulus13.dtb";
|
"13" = "qcom/x1e80100-microsoft-romulus13.dtb";
|
||||||
"15" = "qcom/x1e80100-microsoft-romulus15.dtb";
|
"15" = "qcom/x1e80100-microsoft-romulus15.dtb";
|
||||||
}.${config.x1e.model};
|
}
|
||||||
|
.${config.x1e.model};
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
options.x1e.model = lib.mkOption {
|
options.x1e.model = lib.mkOption {
|
||||||
type = lib.types.enum [ "13" "15" ];
|
type = lib.types.enum [
|
||||||
|
"13"
|
||||||
|
"15"
|
||||||
|
];
|
||||||
default = "13";
|
default = "13";
|
||||||
description = "Surface Laptop 7 display size (13.8\" or 15\").";
|
description = "Surface Laptop 7 display size (13.8\" or 15\").";
|
||||||
};
|
};
|
||||||
@@ -15,6 +25,11 @@ in
|
|||||||
config = {
|
config = {
|
||||||
nixpkgs.hostPlatform = "aarch64-linux";
|
nixpkgs.hostPlatform = "aarch64-linux";
|
||||||
|
|
||||||
|
services.udev.extraRules = ''
|
||||||
|
ACTION=="add", SUBSYSTEM=="platform", DRIVER=="dwc3-qcom-legacy", ATTR{power/control}="auto"
|
||||||
|
ACTION=="add", SUBSYSTEM=="usb", ATTR{power/control}="auto"
|
||||||
|
'';
|
||||||
|
|
||||||
hardware = {
|
hardware = {
|
||||||
enableRedistributableFirmware = lib.mkForce true;
|
enableRedistributableFirmware = lib.mkForce true;
|
||||||
enableAllFirmware = lib.mkForce true;
|
enableAllFirmware = lib.mkForce true;
|
||||||
|
|||||||
+41
-5
@@ -1,4 +1,9 @@
|
|||||||
{ config, lib, pkgs, ... }:
|
{
|
||||||
|
config,
|
||||||
|
lib,
|
||||||
|
pkgs,
|
||||||
|
...
|
||||||
|
}:
|
||||||
let
|
let
|
||||||
kernel = config.boot.kernelPackages.kernel;
|
kernel = config.boot.kernelPackages.kernel;
|
||||||
|
|
||||||
@@ -37,7 +42,6 @@ let
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
ath12k-norfkill = pkgs.stdenv.mkDerivation {
|
ath12k-norfkill = pkgs.stdenv.mkDerivation {
|
||||||
pname = "ath12k-norfkill";
|
pname = "ath12k-norfkill";
|
||||||
inherit (kernel)
|
inherit (kernel)
|
||||||
@@ -246,7 +250,39 @@ let
|
|||||||
platforms = platforms.linux;
|
platforms = platforms.linux;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
in
|
|
||||||
|
msm-vrr = pkgs.stdenv.mkDerivation {
|
||||||
|
pname = "msm-vrr";
|
||||||
|
inherit (kernel)
|
||||||
|
src
|
||||||
|
version
|
||||||
|
postPatch
|
||||||
|
nativeBuildInputs
|
||||||
|
;
|
||||||
|
kernel_dev = kernel.dev;
|
||||||
|
kernelVersion = kernel.modDirVersion;
|
||||||
|
patches = [
|
||||||
|
./kernel/modules/msm-vrr/msm-vrr-avr.patch
|
||||||
|
];
|
||||||
|
buildPhase = ''
|
||||||
|
BUILT_KERNEL=$kernel_dev/lib/modules/$kernelVersion/build
|
||||||
|
cp $BUILT_KERNEL/Module.symvers .
|
||||||
|
cp $BUILT_KERNEL/.config .
|
||||||
|
cp $kernel_dev/vmlinux .
|
||||||
|
make "-j$NIX_BUILD_CORES" modules_prepare
|
||||||
|
make "-j$NIX_BUILD_CORES" M=drivers/gpu/drm/msm modules
|
||||||
|
'';
|
||||||
|
installPhase = ''
|
||||||
|
install -D -m 644 drivers/gpu/drm/msm/msm.ko \
|
||||||
|
$out/lib/modules/${kernel.modDirVersion}/extra/msm.ko
|
||||||
|
'';
|
||||||
|
meta = with lib; {
|
||||||
|
description = "MSM DRM with VRR (24-120Hz) for the eDP panel";
|
||||||
|
license = licenses.gpl2Only;
|
||||||
|
platforms = platforms.linux;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
in
|
||||||
{
|
{
|
||||||
options.x1e = {
|
options.x1e = {
|
||||||
cpuParking = lib.mkEnableOption "CPU core parking for Snapdragon X Elite";
|
cpuParking = lib.mkEnableOption "CPU core parking for Snapdragon X Elite";
|
||||||
@@ -260,12 +296,12 @@ let
|
|||||||
spi-geni-qcom-qspi
|
spi-geni-qcom-qspi
|
||||||
ath12k-norfkill
|
ath12k-norfkill
|
||||||
platform-profile
|
platform-profile
|
||||||
|
msm-vrr
|
||||||
]
|
]
|
||||||
++ lib.optional config.x1e.ecReboot ec-reboot
|
++ lib.optional config.x1e.ecReboot ec-reboot
|
||||||
++ lib.optional config.x1e.cpuParking cpu-parking;
|
++ lib.optional config.x1e.cpuParking cpu-parking;
|
||||||
|
|
||||||
boot.kernelModules =
|
boot.kernelModules =
|
||||||
lib.optional config.x1e.ecReboot "ec_reboot"
|
lib.optional config.x1e.ecReboot "ec_reboot" ++ lib.optional config.x1e.cpuParking "cpu_parking";
|
||||||
++ lib.optional config.x1e.cpuParking "cpu_parking";
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
+4
-4
@@ -4,13 +4,13 @@
|
|||||||
kernelPackages =
|
kernelPackages =
|
||||||
let
|
let
|
||||||
linux_x1e = pkgs.buildLinux rec {
|
linux_x1e = pkgs.buildLinux rec {
|
||||||
version = "7.0.0-rc5";
|
version = "7.1.0";
|
||||||
modDirVersion = "7.0.0-rc5";
|
modDirVersion = "7.1.0";
|
||||||
src = pkgs.fetchFromGitHub {
|
src = pkgs.fetchFromGitHub {
|
||||||
owner = "torvalds";
|
owner = "torvalds";
|
||||||
repo = "linux";
|
repo = "linux";
|
||||||
rev = "d1d81e9d1a4dd846aee9ae77ff9ecc2800d72148"; # v7.0-rc5
|
rev = "8cd9520d35a6c38db6567e97dd93b1f11f185dc6"; # v7.1
|
||||||
hash = "sha256-UN1xOwSyn5YzdxQzEF6vTKev6vtN3iE2aiv7OT7TBAM=";
|
hash = "sha256-bKQiHEhaxinMh2ykjR/thBzkH1ts08IHLSg19BbvdaU=";
|
||||||
};
|
};
|
||||||
ignoreConfigErrors = true;
|
ignoreConfigErrors = true;
|
||||||
structuredExtraConfig = with lib.kernel; {
|
structuredExtraConfig = with lib.kernel; {
|
||||||
|
|||||||
@@ -0,0 +1,288 @@
|
|||||||
|
diff -ruN a/drivers/gpu/drm/msm/disp/dpu1/catalog/dpu_9_2_x1e80100.h b/drivers/gpu/drm/msm/disp/dpu1/catalog/dpu_9_2_x1e80100.h
|
||||||
|
--- a/drivers/gpu/drm/msm/disp/dpu1/catalog/dpu_9_2_x1e80100.h 2026-05-29 11:03:42.924716071 +0400
|
||||||
|
+++ b/drivers/gpu/drm/msm/disp/dpu1/catalog/dpu_9_2_x1e80100.h 2026-05-29 21:59:52.331868636 +0400
|
||||||
|
@@ -314,6 +314,7 @@
|
||||||
|
.prog_fetch_lines_worst_case = 24,
|
||||||
|
.intr_underrun = DPU_IRQ_IDX(MDP_SSPP_TOP0_INTR, 24),
|
||||||
|
.intr_vsync = DPU_IRQ_IDX(MDP_SSPP_TOP0_INTR, 25),
|
||||||
|
+ .features = BIT(DPU_INTF_AVR),
|
||||||
|
}, {
|
||||||
|
.name = "intf_1", .id = INTF_1,
|
||||||
|
.base = 0x35000, .len = 0x300,
|
||||||
|
@@ -348,6 +349,7 @@
|
||||||
|
.prog_fetch_lines_worst_case = 24,
|
||||||
|
.intr_underrun = DPU_IRQ_IDX(MDP_SSPP_TOP0_INTR, 20),
|
||||||
|
.intr_vsync = DPU_IRQ_IDX(MDP_SSPP_TOP0_INTR, 21),
|
||||||
|
+ .features = BIT(DPU_INTF_AVR),
|
||||||
|
}, {
|
||||||
|
.name = "intf_5", .id = INTF_5,
|
||||||
|
.base = 0x39000, .len = 0x280,
|
||||||
|
@@ -356,6 +358,7 @@
|
||||||
|
.prog_fetch_lines_worst_case = 24,
|
||||||
|
.intr_underrun = DPU_IRQ_IDX(MDP_SSPP_TOP0_INTR, 22),
|
||||||
|
.intr_vsync = DPU_IRQ_IDX(MDP_SSPP_TOP0_INTR, 23),
|
||||||
|
+ .features = BIT(DPU_INTF_AVR),
|
||||||
|
}, {
|
||||||
|
.name = "intf_6", .id = INTF_6,
|
||||||
|
.base = 0x3A000, .len = 0x280,
|
||||||
|
@@ -364,6 +367,7 @@
|
||||||
|
.prog_fetch_lines_worst_case = 24,
|
||||||
|
.intr_underrun = DPU_IRQ_IDX(MDP_SSPP_TOP0_INTR, 16),
|
||||||
|
.intr_vsync = DPU_IRQ_IDX(MDP_SSPP_TOP0_INTR, 17),
|
||||||
|
+ .features = BIT(DPU_INTF_AVR),
|
||||||
|
}, {
|
||||||
|
.name = "intf_7", .id = INTF_7,
|
||||||
|
.base = 0x3b000, .len = 0x280,
|
||||||
|
diff -ruN a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c
|
||||||
|
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c 2026-05-29 11:03:40.286201235 +0400
|
||||||
|
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c 2026-05-29 21:59:52.333730506 +0400
|
||||||
|
@@ -1508,6 +1508,9 @@
|
||||||
|
(!clone_mode_requested && clone_mode_enabled))
|
||||||
|
new_crtc_state->mode_changed = true;
|
||||||
|
|
||||||
|
+ if (new_crtc_state->vrr_enabled != old_crtc_state->vrr_enabled)
|
||||||
|
+ new_crtc_state->mode_changed = true;
|
||||||
|
+
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
diff -ruN a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c
|
||||||
|
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c 2026-05-29 11:03:39.718213467 +0400
|
||||||
|
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c 2026-05-29 21:59:52.334011092 +0400
|
||||||
|
@@ -1268,6 +1268,20 @@
|
||||||
|
}
|
||||||
|
|
||||||
|
phys->cached_mode = crtc_state->adjusted_mode;
|
||||||
|
+
|
||||||
|
+ phys->vrr_enabled = false;
|
||||||
|
+ phys->vrr_min_fps = 0;
|
||||||
|
+ if (crtc_state->vrr_enabled && conn_state->connector) {
|
||||||
|
+ const struct drm_monitor_range_info *range =
|
||||||
|
+ &conn_state->connector->display_info.monitor_range;
|
||||||
|
+ u32 mode_fps = drm_mode_vrefresh(&crtc_state->adjusted_mode);
|
||||||
|
+
|
||||||
|
+ if (range->min_vfreq && range->min_vfreq < mode_fps) {
|
||||||
|
+ phys->vrr_enabled = true;
|
||||||
|
+ phys->vrr_min_fps = range->min_vfreq;
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
if (phys->ops.atomic_mode_set)
|
||||||
|
phys->ops.atomic_mode_set(phys, crtc_state, conn_state);
|
||||||
|
}
|
||||||
|
diff -ruN a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys.h b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys.h
|
||||||
|
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys.h 2026-05-29 11:11:43.623735790 +0400
|
||||||
|
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys.h 2026-05-29 21:59:52.334868630 +0400
|
||||||
|
@@ -198,6 +198,8 @@
|
||||||
|
wait_queue_head_t pending_kickoff_wq;
|
||||||
|
unsigned int irq[INTR_IDX_MAX];
|
||||||
|
bool has_intf_te;
|
||||||
|
+ bool vrr_enabled;
|
||||||
|
+ u32 vrr_min_fps;
|
||||||
|
};
|
||||||
|
|
||||||
|
static inline int dpu_encoder_phys_inc_pending(struct dpu_encoder_phys *phys)
|
||||||
|
diff -ruN a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_vid.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_vid.c
|
||||||
|
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_vid.c 2026-05-29 11:03:42.399672045 +0400
|
||||||
|
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_vid.c 2026-05-29 21:59:52.336293281 +0400
|
||||||
|
@@ -314,6 +314,18 @@
|
||||||
|
spin_lock_irqsave(phys_enc->enc_spinlock, lock_flags);
|
||||||
|
phys_enc->hw_intf->ops.setup_timing_gen(phys_enc->hw_intf,
|
||||||
|
&timing_params, fmt);
|
||||||
|
+
|
||||||
|
+ if (phys_enc->vrr_enabled && phys_enc->hw_intf->ops.setup_avr) {
|
||||||
|
+ struct dpu_hw_intf_avr_params avr = {
|
||||||
|
+ .default_fps = drm_mode_vrefresh(&mode),
|
||||||
|
+ .min_fps = phys_enc->vrr_min_fps,
|
||||||
|
+ };
|
||||||
|
+
|
||||||
|
+ phys_enc->hw_intf->ops.setup_avr(phys_enc->hw_intf,
|
||||||
|
+ &timing_params, &avr);
|
||||||
|
+ phys_enc->hw_intf->ops.avr_ctrl(phys_enc->hw_intf, true, false);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
phys_enc->hw_ctl->ops.setup_intf_cfg(phys_enc->hw_ctl, &intf_cfg);
|
||||||
|
|
||||||
|
/* setup which pp blk will connect to this intf */
|
||||||
|
@@ -664,6 +676,9 @@
|
||||||
|
spin_unlock_irqrestore(phys_enc->enc_spinlock, lock_flags);
|
||||||
|
phys_enc->enable_state = DPU_ENC_ENABLED;
|
||||||
|
}
|
||||||
|
+
|
||||||
|
+ if (phys_enc->vrr_enabled && phys_enc->hw_intf->ops.avr_trigger)
|
||||||
|
+ phys_enc->hw_intf->ops.avr_trigger(phys_enc->hw_intf);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void dpu_encoder_phys_vid_irq_enable(struct dpu_encoder_phys *phys_enc)
|
||||||
|
diff -ruN a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.h b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.h
|
||||||
|
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.h 2026-05-29 11:03:41.855674728 +0400
|
||||||
|
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.h 2026-05-29 21:59:52.336489789 +0400
|
||||||
|
@@ -150,6 +150,11 @@
|
||||||
|
DPU_DSC_MAX
|
||||||
|
};
|
||||||
|
|
||||||
|
+enum {
|
||||||
|
+ DPU_INTF_AVR = 0x1,
|
||||||
|
+ DPU_INTF_MAX
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
/**
|
||||||
|
* MACRO DPU_HW_BLK_INFO - information of HW blocks inside DPU
|
||||||
|
* @name: string name for debug purposes
|
||||||
|
@@ -519,6 +524,7 @@
|
||||||
|
unsigned int intr_underrun;
|
||||||
|
unsigned int intr_vsync;
|
||||||
|
unsigned int intr_tear_rd_ptr;
|
||||||
|
+ unsigned long features;
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
diff -ruN a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_intf.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_intf.c
|
||||||
|
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_intf.c 2026-05-29 11:03:40.787734617 +0400
|
||||||
|
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_intf.c 2026-05-29 21:59:52.336679956 +0400
|
||||||
|
@@ -77,6 +77,9 @@
|
||||||
|
#define INTF_AVR_MODE 0x274
|
||||||
|
#define INTF_AVR_TRIGGER 0x278
|
||||||
|
#define INTF_AVR_VTOTAL 0x27C
|
||||||
|
+
|
||||||
|
+#define INTF_AVR_CONTROL_ENABLE BIT(0)
|
||||||
|
+#define INTF_AVR_MODE_ONESHOT (BIT(0) | BIT(8))
|
||||||
|
#define INTF_TEAR_MDP_VSYNC_SEL 0x280
|
||||||
|
#define INTF_TEAR_TEAR_CHECK_EN 0x284
|
||||||
|
#define INTF_TEAR_SYNC_CONFIG_VSYNC 0x288
|
||||||
|
@@ -585,6 +588,47 @@
|
||||||
|
DPU_REG_WRITE(&intf->hw, INTF_CONFIG2, intf_cfg2);
|
||||||
|
}
|
||||||
|
|
||||||
|
+static void dpu_hw_intf_setup_avr(struct dpu_hw_intf *intf,
|
||||||
|
+ const struct dpu_hw_intf_timing_params *p,
|
||||||
|
+ const struct dpu_hw_intf_avr_params *avr)
|
||||||
|
+{
|
||||||
|
+ struct dpu_hw_blk_reg_map *c = &intf->hw;
|
||||||
|
+ u32 hsync_period, vsync_period, add_porches = 0, avr_vtotal;
|
||||||
|
+ u32 diff_fps;
|
||||||
|
+
|
||||||
|
+ if (!avr->min_fps || !avr->default_fps || avr->min_fps > avr->default_fps)
|
||||||
|
+ return;
|
||||||
|
+
|
||||||
|
+ diff_fps = avr->default_fps - avr->min_fps;
|
||||||
|
+
|
||||||
|
+ hsync_period = p->hsync_pulse_width + p->h_back_porch +
|
||||||
|
+ p->width + p->h_front_porch;
|
||||||
|
+ vsync_period = p->vsync_pulse_width + p->v_back_porch +
|
||||||
|
+ p->height + p->v_front_porch;
|
||||||
|
+
|
||||||
|
+ if (diff_fps)
|
||||||
|
+ add_porches = mult_frac(vsync_period, diff_fps, avr->min_fps);
|
||||||
|
+
|
||||||
|
+ avr_vtotal = (vsync_period + add_porches) * hsync_period;
|
||||||
|
+
|
||||||
|
+ DPU_REG_WRITE(c, INTF_AVR_VTOTAL, avr_vtotal);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+static void dpu_hw_intf_avr_ctrl(struct dpu_hw_intf *intf, bool enable, bool oneshot)
|
||||||
|
+{
|
||||||
|
+ struct dpu_hw_blk_reg_map *c = &intf->hw;
|
||||||
|
+ u32 avr_ctrl = enable ? INTF_AVR_CONTROL_ENABLE : 0;
|
||||||
|
+ u32 avr_mode = (enable && oneshot) ? INTF_AVR_MODE_ONESHOT : 0;
|
||||||
|
+
|
||||||
|
+ DPU_REG_WRITE(c, INTF_AVR_CONTROL, avr_ctrl);
|
||||||
|
+ DPU_REG_WRITE(c, INTF_AVR_MODE, avr_mode);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+static void dpu_hw_intf_avr_trigger(struct dpu_hw_intf *intf)
|
||||||
|
+{
|
||||||
|
+ DPU_REG_WRITE(&intf->hw, INTF_AVR_TRIGGER, 0x1);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
/**
|
||||||
|
* dpu_hw_intf_init() - Initializes the INTF driver for the passed
|
||||||
|
* interface catalog entry.
|
||||||
|
@@ -652,5 +696,11 @@
|
||||||
|
if (mdss_rev->core_major_ver >= 7)
|
||||||
|
c->ops.program_intf_cmd_cfg = dpu_hw_intf_program_intf_cmd_cfg;
|
||||||
|
|
||||||
|
+ if (cfg->features & BIT(DPU_INTF_AVR)) {
|
||||||
|
+ c->ops.setup_avr = dpu_hw_intf_setup_avr;
|
||||||
|
+ c->ops.avr_ctrl = dpu_hw_intf_avr_ctrl;
|
||||||
|
+ c->ops.avr_trigger = dpu_hw_intf_avr_trigger;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
return c;
|
||||||
|
}
|
||||||
|
diff -ruN a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_intf.h b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_intf.h
|
||||||
|
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_intf.h 2026-05-29 11:03:41.261180349 +0400
|
||||||
|
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_intf.h 2026-05-29 21:59:52.337013151 +0400
|
||||||
|
@@ -37,6 +37,11 @@
|
||||||
|
bool compression_en;
|
||||||
|
};
|
||||||
|
|
||||||
|
+struct dpu_hw_intf_avr_params {
|
||||||
|
+ u32 default_fps;
|
||||||
|
+ u32 min_fps;
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
struct dpu_hw_intf_prog_fetch {
|
||||||
|
u8 enable;
|
||||||
|
/* vsync counter for the front porch pixel line */
|
||||||
|
@@ -111,6 +116,14 @@
|
||||||
|
|
||||||
|
void (*program_intf_cmd_cfg)(struct dpu_hw_intf *intf,
|
||||||
|
struct dpu_hw_intf_cmd_mode_cfg *cmd_mode_cfg);
|
||||||
|
+
|
||||||
|
+ void (*setup_avr)(struct dpu_hw_intf *intf,
|
||||||
|
+ const struct dpu_hw_intf_timing_params *p,
|
||||||
|
+ const struct dpu_hw_intf_avr_params *avr);
|
||||||
|
+
|
||||||
|
+ void (*avr_ctrl)(struct dpu_hw_intf *intf, bool enable, bool oneshot);
|
||||||
|
+
|
||||||
|
+ void (*avr_trigger)(struct dpu_hw_intf *intf);
|
||||||
|
};
|
||||||
|
|
||||||
|
struct dpu_hw_intf {
|
||||||
|
diff -ruN a/drivers/gpu/drm/msm/dp/dp_ctrl.c b/drivers/gpu/drm/msm/dp/dp_ctrl.c
|
||||||
|
--- a/drivers/gpu/drm/msm/dp/dp_ctrl.c 2026-05-29 11:03:37.530261047 +0400
|
||||||
|
+++ b/drivers/gpu/drm/msm/dp/dp_ctrl.c 2026-05-29 21:59:52.337233654 +0400
|
||||||
|
@@ -1639,6 +1639,9 @@
|
||||||
|
if (drm_dp_max_downspread(dpcd))
|
||||||
|
encoding[0] |= DP_SPREAD_AMP_0_5;
|
||||||
|
|
||||||
|
+ if (dpcd[DP_DOWN_STREAM_PORT_COUNT] & DP_MSA_TIMING_PAR_IGNORED)
|
||||||
|
+ encoding[0] |= DP_MSA_TIMING_PAR_IGNORE_EN;
|
||||||
|
+
|
||||||
|
/* config DOWNSPREAD_CTRL and MAIN_LINK_CHANNEL_CODING_SET */
|
||||||
|
drm_dp_dpcd_write(ctrl->aux, DP_DOWNSPREAD_CTRL, encoding, 2);
|
||||||
|
|
||||||
|
diff -ruN a/drivers/gpu/drm/msm/dp/dp_drm.c b/drivers/gpu/drm/msm/dp/dp_drm.c
|
||||||
|
--- a/drivers/gpu/drm/msm/dp/dp_drm.c 2026-05-29 11:03:38.667667124 +0400
|
||||||
|
+++ b/drivers/gpu/drm/msm/dp/dp_drm.c 2026-05-29 21:59:52.337393023 +0400
|
||||||
|
@@ -376,6 +376,8 @@
|
||||||
|
if (!msm_dp_display->is_edp)
|
||||||
|
drm_connector_attach_dp_subconnector_property(connector);
|
||||||
|
|
||||||
|
+ drm_connector_attach_vrr_capable_property(connector);
|
||||||
|
+
|
||||||
|
drm_connector_attach_encoder(connector, encoder);
|
||||||
|
|
||||||
|
return connector;
|
||||||
|
diff -ruN a/drivers/gpu/drm/msm/dp/dp_panel.c b/drivers/gpu/drm/msm/dp/dp_panel.c
|
||||||
|
--- a/drivers/gpu/drm/msm/dp/dp_panel.c 2026-05-29 11:03:39.173225245 +0400
|
||||||
|
+++ b/drivers/gpu/drm/msm/dp/dp_panel.c 2026-05-29 21:59:52.337516414 +0400
|
||||||
|
@@ -289,6 +289,17 @@
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
+ if (connector->vrr_capable_property) {
|
||||||
|
+ const struct drm_monitor_range_info *range =
|
||||||
|
+ &connector->display_info.monitor_range;
|
||||||
|
+ bool capable = range->min_vfreq && range->max_vfreq &&
|
||||||
|
+ range->min_vfreq < range->max_vfreq &&
|
||||||
|
+ (msm_dp_panel->dpcd[DP_DOWN_STREAM_PORT_COUNT] &
|
||||||
|
+ DP_MSA_TIMING_PAR_IGNORED);
|
||||||
|
+
|
||||||
|
+ drm_connector_set_vrr_capable_property(connector, capable);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
end:
|
||||||
|
return rc;
|
||||||
|
}
|
||||||
@@ -1,99 +1,124 @@
|
|||||||
--- a/drivers/acpi/platform_profile.c
|
diff -ruN a/drivers/acpi/platform_profile.c b/drivers/acpi/platform_profile.c
|
||||||
+++ b/drivers/acpi/platform_profile.c
|
--- a/drivers/acpi/platform_profile.c 2026-04-22 13:09:37.943936485 +0400
|
||||||
@@ -176,7 +176,8 @@ static ssize_t profile_store(struct device *dev,
|
+++ b/drivers/acpi/platform_profile.c 2026-04-22 13:12:09.080175395 +0400
|
||||||
|
@@ -16,6 +16,9 @@
|
||||||
|
|
||||||
|
static DEFINE_MUTEX(profile_lock);
|
||||||
|
|
||||||
|
+static struct kobject *legacy_kobj;
|
||||||
|
+static struct kobject *legacy_kobj_created;
|
||||||
|
+
|
||||||
|
struct platform_profile_handler {
|
||||||
|
const char *name;
|
||||||
|
struct device dev;
|
||||||
|
@@ -215,7 +218,7 @@
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
- sysfs_notify(acpi_kobj, NULL, "platform_profile");
|
- sysfs_notify(acpi_kobj, NULL, "platform_profile");
|
||||||
+ if (acpi_kobj)
|
+ sysfs_notify(legacy_kobj, NULL, "platform_profile");
|
||||||
+ sysfs_notify(acpi_kobj, NULL, "platform_profile");
|
|
||||||
|
|
||||||
return count;
|
return count;
|
||||||
}
|
}
|
||||||
@@ -341,7 +342,8 @@ static ssize_t platform_profile_store(struct kobject *kobj,
|
@@ -435,7 +438,7 @@
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
- sysfs_notify(acpi_kobj, NULL, "platform_profile");
|
- sysfs_notify(acpi_kobj, NULL, "platform_profile");
|
||||||
+ if (acpi_kobj)
|
+ sysfs_notify(legacy_kobj, NULL, "platform_profile");
|
||||||
+ sysfs_notify(acpi_kobj, NULL, "platform_profile");
|
|
||||||
|
|
||||||
return count;
|
return count;
|
||||||
}
|
}
|
||||||
@@ -377,7 +379,8 @@ void platform_profile_notify(struct device *dev)
|
@@ -481,7 +484,7 @@
|
||||||
scoped_cond_guard(mutex_intr, return, &profile_lock) {
|
scoped_cond_guard(mutex_intr, return, &profile_lock) {
|
||||||
_notify_class_profile(dev, NULL);
|
_notify_class_profile(dev, NULL);
|
||||||
}
|
}
|
||||||
- sysfs_notify(acpi_kobj, NULL, "platform_profile");
|
- sysfs_notify(acpi_kobj, NULL, "platform_profile");
|
||||||
+ if (acpi_kobj)
|
+ sysfs_notify(legacy_kobj, NULL, "platform_profile");
|
||||||
+ sysfs_notify(acpi_kobj, NULL, "platform_profile");
|
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL_GPL(platform_profile_notify);
|
EXPORT_SYMBOL_GPL(platform_profile_notify);
|
||||||
|
|
||||||
@@ -425,7 +428,8 @@ int platform_profile_cycle(void)
|
@@ -529,7 +532,7 @@
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
- sysfs_notify(acpi_kobj, NULL, "platform_profile");
|
- sysfs_notify(acpi_kobj, NULL, "platform_profile");
|
||||||
+ if (acpi_kobj)
|
+ sysfs_notify(legacy_kobj, NULL, "platform_profile");
|
||||||
+ sysfs_notify(acpi_kobj, NULL, "platform_profile");
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -487,9 +491,11 @@ struct device *platform_profile_register(struct device *dev, const char *name,
|
@@ -603,9 +606,9 @@
|
||||||
goto cleanup_ida;
|
goto cleanup_ida;
|
||||||
}
|
}
|
||||||
|
|
||||||
- sysfs_notify(acpi_kobj, NULL, "platform_profile");
|
- sysfs_notify(acpi_kobj, NULL, "platform_profile");
|
||||||
+ if (acpi_kobj)
|
+ sysfs_notify(legacy_kobj, NULL, "platform_profile");
|
||||||
+ sysfs_notify(acpi_kobj, NULL, "platform_profile");
|
|
||||||
|
|
||||||
- err = sysfs_update_group(acpi_kobj, &platform_profile_group);
|
- err = sysfs_update_group(acpi_kobj, &platform_profile_group);
|
||||||
+ err = acpi_kobj ? sysfs_update_group(acpi_kobj, &platform_profile_group)
|
+ err = sysfs_update_group(legacy_kobj, &platform_profile_group);
|
||||||
+ : 0;
|
|
||||||
if (err)
|
if (err)
|
||||||
goto cleanup_cur;
|
goto cleanup_cur;
|
||||||
|
|
||||||
@@ -519,8 +525,10 @@ void platform_profile_remove(struct device *dev)
|
@@ -639,8 +642,8 @@
|
||||||
ida_free(&platform_profile_ida, pprof->minor);
|
ida_free(&platform_profile_ida, pprof->minor);
|
||||||
device_unregister(&pprof->dev);
|
device_unregister(&pprof->dev);
|
||||||
|
|
||||||
- sysfs_notify(acpi_kobj, NULL, "platform_profile");
|
- sysfs_notify(acpi_kobj, NULL, "platform_profile");
|
||||||
- sysfs_update_group(acpi_kobj, &platform_profile_group);
|
- sysfs_update_group(acpi_kobj, &platform_profile_group);
|
||||||
+ if (acpi_kobj) {
|
+ sysfs_notify(legacy_kobj, NULL, "platform_profile");
|
||||||
+ sysfs_notify(acpi_kobj, NULL, "platform_profile");
|
+ sysfs_update_group(legacy_kobj, &platform_profile_group);
|
||||||
+ sysfs_update_group(acpi_kobj, &platform_profile_group);
|
|
||||||
+ }
|
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL_GPL(platform_profile_remove);
|
EXPORT_SYMBOL_GPL(platform_profile_remove);
|
||||||
|
|
||||||
@@ -567,14 +575,16 @@ static int __init platform_profile_init(void)
|
@@ -688,24 +691,45 @@
|
||||||
{
|
{
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
- if (acpi_disabled)
|
- if (acpi_disabled)
|
||||||
- return -EOPNOTSUPP;
|
- return -EOPNOTSUPP;
|
||||||
-
|
+ if (acpi_kobj) {
|
||||||
|
+ legacy_kobj = acpi_kobj;
|
||||||
|
+ } else {
|
||||||
|
+ legacy_kobj_created = kobject_create_and_add("acpi", firmware_kobj);
|
||||||
|
+ if (!legacy_kobj_created)
|
||||||
|
+ return -ENOMEM;
|
||||||
|
+ legacy_kobj = legacy_kobj_created;
|
||||||
|
+ }
|
||||||
|
|
||||||
err = class_register(&platform_profile_class);
|
err = class_register(&platform_profile_class);
|
||||||
if (err)
|
if (err)
|
||||||
return err;
|
- return err;
|
||||||
|
+ goto put_kobj;
|
||||||
|
|
||||||
- err = sysfs_create_group(acpi_kobj, &platform_profile_group);
|
- err = sysfs_create_group(acpi_kobj, &platform_profile_group);
|
||||||
+ /*
|
- if (err)
|
||||||
+ * Legacy sysfs interface under /sys/firmware/acpi/ is only available
|
+ err = sysfs_create_group(legacy_kobj, &platform_profile_group);
|
||||||
+ * when ACPI is enabled. The class-based interface works regardless.
|
+ if (err) {
|
||||||
+ */
|
|
||||||
+ err = acpi_kobj ? sysfs_create_group(acpi_kobj, &platform_profile_group)
|
|
||||||
+ : 0;
|
|
||||||
if (err)
|
|
||||||
class_unregister(&platform_profile_class);
|
class_unregister(&platform_profile_class);
|
||||||
|
+ goto put_kobj;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ return 0;
|
||||||
|
|
||||||
|
+put_kobj:
|
||||||
|
+ if (legacy_kobj_created) {
|
||||||
|
+ kobject_put(legacy_kobj_created);
|
||||||
|
+ legacy_kobj_created = NULL;
|
||||||
|
+ legacy_kobj = NULL;
|
||||||
|
+ }
|
||||||
|
return err;
|
||||||
|
}
|
||||||
|
|
||||||
@@ -584,7 +594,8 @@ static int __init platform_profile_init(void)
|
|
||||||
static void __exit platform_profile_exit(void)
|
static void __exit platform_profile_exit(void)
|
||||||
{
|
{
|
||||||
- sysfs_remove_group(acpi_kobj, &platform_profile_group);
|
- sysfs_remove_group(acpi_kobj, &platform_profile_group);
|
||||||
+ if (acpi_kobj)
|
+ sysfs_remove_group(legacy_kobj, &platform_profile_group);
|
||||||
+ sysfs_remove_group(acpi_kobj, &platform_profile_group);
|
|
||||||
class_unregister(&platform_profile_class);
|
class_unregister(&platform_profile_class);
|
||||||
|
+ if (legacy_kobj_created) {
|
||||||
|
+ kobject_put(legacy_kobj_created);
|
||||||
|
+ legacy_kobj_created = NULL;
|
||||||
|
+ legacy_kobj = NULL;
|
||||||
|
+ }
|
||||||
}
|
}
|
||||||
module_init(platform_profile_init);
|
module_init(platform_profile_init);
|
||||||
|
module_exit(platform_profile_exit);
|
||||||
|
|||||||
Reference in New Issue
Block a user