Skip to contentSkip to conversation

drm/amdgpu: Add DC feature mask to disable fractional pwm

PATCH Superseded [email protected] 4 participants 5 messages Oct 21, 2019 – Oct 23, 2019 1 message not in the archive

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/amdgpu: Add DC feature mask to disable fractional pwm

From: Leo Li <[email protected]>

[Why]

Some LED panel drivers might not like fractional PWM. In such cases, backlight flickering may be observed.

[How]

Add a DC feature mask to disable fractional PWM, and associate it with the preexisting dc_config flag.

The flag is only plumbed through the dmcu firmware, so plumb it through the driver path as well.

To disable, add the following to the linux cmdline:
amdgpu.dcfeaturemask=0x4

---
 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 3 +++
 drivers/gpu/drm/amd/display/dc/dce/dce_abm.c      | 4 ++++
 drivers/gpu/drm/amd/include/amd_shared.h          | 1 +
 3 files changed, 8 insertions(+)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +3 -0
index 1cf4beb76835..73f917d4d1e1 100644
@@ -728,6 +728,9 @@ static int amdgpu_dm_init(struct amdgpu_device *adev)
 	if (amdgpu_dc_feature_mask & DC_MULTI_MON_PP_MCLK_SWITCH_MASK)
 		init_data.flags.multi_mon_pp_mclk_switch = true;
 
+	if (amdgpu_dc_feature_mask & DC_DISABLE_FRACTIONAL_PWM_MASK)
+		init_data.flags.disable_fractional_pwm = true;
+
 	init_data.flags.power_down_display_on_boot = true;
 
 #ifdef CONFIG_DRM_AMD_DC_DCN2_0
drivers/gpu/drm/amd/display/dc/dce/dce_abm.c +4 -0
index d759fdca7fdb..b8a3fc505c9b 100644
@@ -404,6 +404,10 @@ static bool dce_abm_init_backlight(struct abm *abm)
 	/* Enable the backlight output */
 	REG_UPDATE(BL_PWM_CNTL, BL_PWM_EN, 1);
 
+	/* Disable fractional pwm if configured */
+	REG_UPDATE(BL_PWM_CNTL, BL_PWM_FRACTIONAL_EN,
+		   abm->ctx->dc->config.disable_fractional_pwm ? 0 : 1);
+
 	/* Unlock group 2 backlight registers */
 	REG_UPDATE(BL_PWM_GRP1_REG_LOCK,
 			BL_PWM_GRP1_REG_LOCK, 0);
drivers/gpu/drm/amd/include/amd_shared.h +1 -0
index 8889aaceec60..5450ed762b7a 100644
@@ -143,6 +143,7 @@ enum PP_FEATURE_MASK {
 enum DC_FEATURE_MASK {
 	DC_FBC_MASK = 0x1,
 	DC_MULTI_MON_PP_MCLK_SWITCH_MASK = 0x2,
+	DC_DISABLE_FRACTIONAL_PWM_MASK = 0x4,
 };
 
 enum amd_dpm_forced_level;
Signature · 6 lines
2.23.0

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): [email protected]

#2 lore raw

PATCH v2 1/1 drm/amdgpu: Add DC feature mask to disable fractional pwm

From: Leo Li <[email protected]>

[Why]

Some LED panel drivers might not like fractional PWM. In such cases, backlight flickering may be observed.

[How]

Add a DC feature mask to disable fractional PWM, and associate it with the preexisting dc_config flag.

The flag is only plumbed through the dmcu firmware, so plumb it through the driver path as well.

To disable, add the following to the linux cmdline:
amdgpu.dcfeaturemask=0x4

Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=204957

---

v2: Add bugzilla link

 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 3 +++
 drivers/gpu/drm/amd/display/dc/dce/dce_abm.c      | 4 ++++
 drivers/gpu/drm/amd/include/amd_shared.h          | 1 +
 3 files changed, 8 insertions(+)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +3 -0
index 1cf4beb76835..73f917d4d1e1 100644
@@ -728,6 +728,9 @@ static int amdgpu_dm_init(struct amdgpu_device *adev)
 	if (amdgpu_dc_feature_mask & DC_MULTI_MON_PP_MCLK_SWITCH_MASK)
 		init_data.flags.multi_mon_pp_mclk_switch = true;
 
+	if (amdgpu_dc_feature_mask & DC_DISABLE_FRACTIONAL_PWM_MASK)
+		init_data.flags.disable_fractional_pwm = true;
+
 	init_data.flags.power_down_display_on_boot = true;
 
 #ifdef CONFIG_DRM_AMD_DC_DCN2_0
drivers/gpu/drm/amd/display/dc/dce/dce_abm.c +4 -0
index d759fdca7fdb..b8a3fc505c9b 100644
@@ -404,6 +404,10 @@ static bool dce_abm_init_backlight(struct abm *abm)
 	/* Enable the backlight output */
 	REG_UPDATE(BL_PWM_CNTL, BL_PWM_EN, 1);
 
+	/* Disable fractional pwm if configured */
+	REG_UPDATE(BL_PWM_CNTL, BL_PWM_FRACTIONAL_EN,
+		   abm->ctx->dc->config.disable_fractional_pwm ? 0 : 1);
+
 	/* Unlock group 2 backlight registers */
 	REG_UPDATE(BL_PWM_GRP1_REG_LOCK,
 			BL_PWM_GRP1_REG_LOCK, 0);
drivers/gpu/drm/amd/include/amd_shared.h +1 -0
index 8889aaceec60..5450ed762b7a 100644
@@ -143,6 +143,7 @@ enum PP_FEATURE_MASK {
 enum DC_FEATURE_MASK {
 	DC_FBC_MASK = 0x1,
 	DC_MULTI_MON_PP_MCLK_SWITCH_MASK = 0x2,
+	DC_DISABLE_FRACTIONAL_PWM_MASK = 0x4,
 };
 
 enum amd_dpm_forced_level;
Signature · 6 lines
2.23.0

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Reviewed-by on v2 1/1
#3 lore raw

-----Original Message-----
From: [email protected] <[email protected]>
Sent: Monday, October 21, 2019 3:44 PM
To: [email protected]; [email protected]; [email protected]
Cc: Koo, Anthony <[email protected]>; Wentland, Harry <[email protected]>; Li, Sun peng (Leo) <[email protected]>
Subject: [PATCH v2] drm/amdgpu: Add DC feature mask to disable fractional pwm

From: Leo Li <[email protected]>

[Why]

Some LED panel drivers might not like fractional PWM. In such cases, backlight flickering may be observed.

[How]

Add a DC feature mask to disable fractional PWM, and associate it with the preexisting dc_config flag.

The flag is only plumbed through the dmcu firmware, so plumb it through the driver path as well.

To disable, add the following to the linux cmdline:
amdgpu.dcfeaturemask=0x4

Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=204957

---

v2: Add bugzilla link

 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 3 +++
 drivers/gpu/drm/amd/display/dc/dce/dce_abm.c      | 4 ++++
 drivers/gpu/drm/amd/include/amd_shared.h          | 1 +
 3 files changed, 8 insertions(+)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +3 -0
index 1cf4beb76835..73f917d4d1e1 100644
@@ -728,6 +728,9 @@ static int amdgpu_dm_init(struct amdgpu_device *adev)
 	if (amdgpu_dc_feature_mask & DC_MULTI_MON_PP_MCLK_SWITCH_MASK)
 		init_data.flags.multi_mon_pp_mclk_switch = true;
 
+	if (amdgpu_dc_feature_mask & DC_DISABLE_FRACTIONAL_PWM_MASK)
+		init_data.flags.disable_fractional_pwm = true;
+
 	init_data.flags.power_down_display_on_boot = true;
 
 #ifdef CONFIG_DRM_AMD_DC_DCN2_0
drivers/gpu/drm/amd/display/dc/dce/dce_abm.c +4 -0
index d759fdca7fdb..b8a3fc505c9b 100644
@@ -404,6 +404,10 @@ static bool dce_abm_init_backlight(struct abm *abm)
 	/* Enable the backlight output */
 	REG_UPDATE(BL_PWM_CNTL, BL_PWM_EN, 1);
 
+	/* Disable fractional pwm if configured */
+	REG_UPDATE(BL_PWM_CNTL, BL_PWM_FRACTIONAL_EN,
+		   abm->ctx->dc->config.disable_fractional_pwm ? 0 : 1);
+
 	/* Unlock group 2 backlight registers */
 	REG_UPDATE(BL_PWM_GRP1_REG_LOCK,
 			BL_PWM_GRP1_REG_LOCK, 0);
drivers/gpu/drm/amd/include/amd_shared.h +1 -1
index 8889aaceec60..5450ed762b7a 100644
@@ -143,6 +143,7 @@ enum PP_FEATURE_MASK {  enum DC_FEATURE_MASK {
 	DC_FBC_MASK = 0x1,
 	DC_MULTI_MON_PP_MCLK_SWITCH_MASK = 0x2,
+	DC_DISABLE_FRACTIONAL_PWM_MASK = 0x4,
 };
 
 enum amd_dpm_forced_level;
--

2.23.0

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

Tested-by on v2 1/1
#4 lore raw
In reply to [email protected]
Quoted 20 lines · On Mon, 2019-10-21 at 15:44 -0400, [email protected] wrote:

From: Leo Li <[email protected]>

[Why]

Some LED panel drivers might not like fractional PWM. In such cases, backlight flickering may be observed.

[How]

Add a DC feature mask to disable fractional PWM, and associate it with the preexisting dc_config flag.

The flag is only plumbed through the dmcu firmware, so plumb it through the driver path as well.

To disable, add the following to the linux cmdline:
amdgpu.dcfeaturemask=0x4

Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=204957

Quoted 8 lines

---

v2: Add bugzilla link

 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 3 +++
 drivers/gpu/drm/amd/display/dc/dce/dce_abm.c      | 4 ++++
 drivers/gpu/drm/amd/include/amd_shared.h          | 1 +
 3 files changed, 8 insertions(+)

Tested on Ubuntu 19.04, vanilla v5.3.7 kernel with the patch applied and amdgpu.dcfeaturemask=0x4 added to the kernel command line, no issues after 8 reboots. (The issue could be reproduced without amdgpu.dcfeaturemask=0x4 on first boot.)

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#5 lore raw
Quoted 30 lines · Lukáš Krejčí
Quoted 20 lines · On Mon, 2019-10-21 at 15:44 -0400, [email protected] wrote:

From: Leo Li <[email protected]>

[Why]

Some LED panel drivers might not like fractional PWM. In such cases, backlight flickering may be observed.

[How]

Add a DC feature mask to disable fractional PWM, and associate it with the preexisting dc_config flag.

The flag is only plumbed through the dmcu firmware, so plumb it through the driver path as well.

To disable, add the following to the linux cmdline:
amdgpu.dcfeaturemask=0x4

Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=204957

Quoted 8 lines

---

v2: Add bugzilla link

 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 3 +++
 drivers/gpu/drm/amd/display/dc/dce/dce_abm.c      | 4 ++++
 drivers/gpu/drm/amd/include/amd_shared.h          | 1 +
 3 files changed, 8 insertions(+)
Quoted 6 lines

Tested on Ubuntu 19.04, vanilla v5.3.7 kernel with the patch applied and amdgpu.dcfeaturemask=0x4 added to the kernel command line, no issues after 8 reboots. (The issue could be reproduced without amdgpu.dcfeaturemask=0x4 on first boot.)

Applied, thanks!
Leo
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel