* [PATCH] drm/amdgpu: Add DC feature mask to disable fractional pwm
@ 2019-10-21 19:37 sunpeng.li-5C7GfCeVMHo
[not found] ` <20191021193743.24339-1-sunpeng.li-5C7GfCeVMHo@public.gmane.org>
0 siblings, 1 reply; 7+ messages in thread
From: sunpeng.li-5C7GfCeVMHo @ 2019-10-21 19:37 UTC (permalink / raw)
To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW,
dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW,
lskrejci-Re5JQEeQqe8AvxtiuMwx3w
Cc: Leo Li, harry.wentland-5C7GfCeVMHo, Anthony.Koo-5C7GfCeVMHo
From: Leo Li <sunpeng.li@amd.com>
[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
Signed-off-by: Leo Li <sunpeng.li@amd.com>
---
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(+)
diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
index 1cf4beb76835..73f917d4d1e1 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
@@ -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
diff --git a/drivers/gpu/drm/amd/display/dc/dce/dce_abm.c b/drivers/gpu/drm/amd/display/dc/dce/dce_abm.c
index d759fdca7fdb..b8a3fc505c9b 100644
--- a/drivers/gpu/drm/amd/display/dc/dce/dce_abm.c
+++ b/drivers/gpu/drm/amd/display/dc/dce/dce_abm.c
@@ -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);
diff --git a/drivers/gpu/drm/amd/include/amd_shared.h b/drivers/gpu/drm/amd/include/amd_shared.h
index 8889aaceec60..5450ed762b7a 100644
--- a/drivers/gpu/drm/amd/include/amd_shared.h
+++ b/drivers/gpu/drm/amd/include/amd_shared.h
@@ -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
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH v2] drm/amdgpu: Add DC feature mask to disable fractional pwm
[not found] ` <20191021193743.24339-1-sunpeng.li-5C7GfCeVMHo@public.gmane.org>
@ 2019-10-21 19:44 ` sunpeng.li-5C7GfCeVMHo
2019-10-22 14:15 ` Koo, Anthony
2019-10-23 14:19 ` Lukáš Krejčí
0 siblings, 2 replies; 7+ messages in thread
From: sunpeng.li-5C7GfCeVMHo @ 2019-10-21 19:44 UTC (permalink / raw)
To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW,
dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW,
lskrejci-Re5JQEeQqe8AvxtiuMwx3w
Cc: Leo Li, harry.wentland-5C7GfCeVMHo, Anthony.Koo-5C7GfCeVMHo
From: Leo Li <sunpeng.li@amd.com>
[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
Signed-off-by: Leo Li <sunpeng.li@amd.com>
---
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(+)
diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
index 1cf4beb76835..73f917d4d1e1 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
@@ -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
diff --git a/drivers/gpu/drm/amd/display/dc/dce/dce_abm.c b/drivers/gpu/drm/amd/display/dc/dce/dce_abm.c
index d759fdca7fdb..b8a3fc505c9b 100644
--- a/drivers/gpu/drm/amd/display/dc/dce/dce_abm.c
+++ b/drivers/gpu/drm/amd/display/dc/dce/dce_abm.c
@@ -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);
diff --git a/drivers/gpu/drm/amd/include/amd_shared.h b/drivers/gpu/drm/amd/include/amd_shared.h
index 8889aaceec60..5450ed762b7a 100644
--- a/drivers/gpu/drm/amd/include/amd_shared.h
+++ b/drivers/gpu/drm/amd/include/amd_shared.h
@@ -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
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
^ permalink raw reply related [flat|nested] 7+ messages in thread
* RE: [PATCH v2] drm/amdgpu: Add DC feature mask to disable fractional pwm
2019-10-21 19:44 ` [PATCH v2] " sunpeng.li-5C7GfCeVMHo
@ 2019-10-22 14:15 ` Koo, Anthony
2019-10-23 14:19 ` Lukáš Krejčí
1 sibling, 0 replies; 7+ messages in thread
From: Koo, Anthony @ 2019-10-22 14:15 UTC (permalink / raw)
To: amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org,
lskrejci@gmail.com
Cc: Li, Sun peng (Leo)
Reviewed-by: Anthony Koo <anthony.koo@amd.com>
-----Original Message-----
From: sunpeng.li@amd.com <sunpeng.li@amd.com>
Sent: Monday, October 21, 2019 3:44 PM
To: amd-gfx@lists.freedesktop.org; dri-devel@lists.freedesktop.org; lskrejci@gmail.com
Cc: Koo, Anthony <Anthony.Koo@amd.com>; Wentland, Harry <Harry.Wentland@amd.com>; Li, Sun peng (Leo) <Sunpeng.Li@amd.com>
Subject: [PATCH v2] drm/amdgpu: Add DC feature mask to disable fractional pwm
From: Leo Li <sunpeng.li@amd.com>
[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
Signed-off-by: Leo Li <sunpeng.li@amd.com>
---
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(+)
diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
index 1cf4beb76835..73f917d4d1e1 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
@@ -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
diff --git a/drivers/gpu/drm/amd/display/dc/dce/dce_abm.c b/drivers/gpu/drm/amd/display/dc/dce/dce_abm.c
index d759fdca7fdb..b8a3fc505c9b 100644
--- a/drivers/gpu/drm/amd/display/dc/dce/dce_abm.c
+++ b/drivers/gpu/drm/amd/display/dc/dce/dce_abm.c
@@ -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);
diff --git a/drivers/gpu/drm/amd/include/amd_shared.h b/drivers/gpu/drm/amd/include/amd_shared.h
index 8889aaceec60..5450ed762b7a 100644
--- a/drivers/gpu/drm/amd/include/amd_shared.h
+++ b/drivers/gpu/drm/amd/include/amd_shared.h
@@ -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
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH v2] drm/amdgpu: Add DC feature mask to disable fractional pwm
@ 2019-10-23 14:19 ` Lukáš Krejčí
0 siblings, 0 replies; 7+ messages in thread
From: Lukáš Krejčí @ 2019-10-23 14:19 UTC (permalink / raw)
To: sunpeng.li, amd-gfx, dri-devel; +Cc: Anthony.Koo
On Mon, 2019-10-21 at 15:44 -0400, sunpeng.li@amd.com wrote:
> From: Leo Li <sunpeng.li@amd.com>
>
> [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
> Signed-off-by: Leo Li <sunpeng.li@amd.com>
> ---
>
> 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.)
Tested-by: Lukáš Krejčí <lskrejci@gmail.com>
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v2] drm/amdgpu: Add DC feature mask to disable fractional pwm
@ 2019-10-23 14:19 ` Lukáš Krejčí
0 siblings, 0 replies; 7+ messages in thread
From: Lukáš Krejčí @ 2019-10-23 14:19 UTC (permalink / raw)
To: sunpeng.li, amd-gfx, dri-devel; +Cc: harry.wentland, Anthony.Koo
On Mon, 2019-10-21 at 15:44 -0400, sunpeng.li@amd.com wrote:
> From: Leo Li <sunpeng.li@amd.com>
>
> [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
> Signed-off-by: Leo Li <sunpeng.li@amd.com>
> ---
>
> 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.)
Tested-by: Lukáš Krejčí <lskrejci@gmail.com>
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v2] drm/amdgpu: Add DC feature mask to disable fractional pwm
@ 2019-10-23 15:53 ` Li, Sun peng (Leo)
0 siblings, 0 replies; 7+ messages in thread
From: Li, Sun peng (Leo) @ 2019-10-23 15:53 UTC (permalink / raw)
To: Lukáš Krejčí, amd-gfx@lists.freedesktop.org,
dri-devel@lists.freedesktop.org
Cc: Koo, Anthony
On 2019-10-23 10:19 a.m., Lukáš Krejčí wrote:
> On Mon, 2019-10-21 at 15:44 -0400, sunpeng.li@amd.com wrote:
>> From: Leo Li <sunpeng.li@amd.com>
>>
>> [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
>> Signed-off-by: Leo Li <sunpeng.li@amd.com>
>> ---
>>
>> 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.)
>
> Tested-by: Lukáš Krejčí <lskrejci@gmail.com>
Applied, thanks!
Leo
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v2] drm/amdgpu: Add DC feature mask to disable fractional pwm
@ 2019-10-23 15:53 ` Li, Sun peng (Leo)
0 siblings, 0 replies; 7+ messages in thread
From: Li, Sun peng (Leo) @ 2019-10-23 15:53 UTC (permalink / raw)
To: Lukáš Krejčí, amd-gfx@lists.freedesktop.org,
dri-devel@lists.freedesktop.org
Cc: Wentland, Harry, Koo, Anthony
On 2019-10-23 10:19 a.m., Lukáš Krejčí wrote:
> On Mon, 2019-10-21 at 15:44 -0400, sunpeng.li@amd.com wrote:
>> From: Leo Li <sunpeng.li@amd.com>
>>
>> [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
>> Signed-off-by: Leo Li <sunpeng.li@amd.com>
>> ---
>>
>> 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.)
>
> Tested-by: Lukáš Krejčí <lskrejci@gmail.com>
Applied, thanks!
Leo
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2019-10-23 15:53 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-10-21 19:37 [PATCH] drm/amdgpu: Add DC feature mask to disable fractional pwm sunpeng.li-5C7GfCeVMHo
[not found] ` <20191021193743.24339-1-sunpeng.li-5C7GfCeVMHo@public.gmane.org>
2019-10-21 19:44 ` [PATCH v2] " sunpeng.li-5C7GfCeVMHo
2019-10-22 14:15 ` Koo, Anthony
2019-10-23 14:19 ` Lukáš Krejčí
2019-10-23 14:19 ` Lukáš Krejčí
2019-10-23 15:53 ` Li, Sun peng (Leo)
2019-10-23 15:53 ` Li, Sun peng (Leo)
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.