linux-pwm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] pwm: mtk-disp: Fix backlight configuration at boot
@ 2023-01-23 16:06 AngeloGioacchino Del Regno
  2023-01-23 16:06 ` [PATCH 1/2] pwm: mtk-disp: Disable shadow registers before setting backlight values AngeloGioacchino Del Regno
                   ` (3 more replies)
  0 siblings, 4 replies; 17+ messages in thread
From: AngeloGioacchino Del Regno @ 2023-01-23 16:06 UTC (permalink / raw)
  To: thierry.reding
  Cc: u.kleine-koenig, matthias.bgg, weiqing.kong, jitao.shi,
	linux-pwm, linux-arm-kernel, linux-mediatek, linux-kernel,
	kernel, AngeloGioacchino Del Regno

Since the pwm-mtk-disp driver was fixed to get PWM_EN state from the
right register, an old two-wrongs-make-one-right issue emerged: as a
result, MT8192 Asurada Spherion got no backlight at boot unless a
suspend/resume cycle was performed.
Also, the backlight would sometimes not get updated with the requested
value, requiring the user to change it back and forth until it worked.

This series fixes both of the aforementioned issues found on MT8192.

AngeloGioacchino Del Regno (2):
  pwm: mtk-disp: Disable shadow registers before setting backlight
    values
  pwm: mtk-disp: Configure double buffering before reading in
    .get_state()

 drivers/pwm/pwm-mtk-disp.c | 34 +++++++++++++++++++++++-----------
 1 file changed, 23 insertions(+), 11 deletions(-)

-- 
2.39.0


^ permalink raw reply	[flat|nested] 17+ messages in thread

* [PATCH 1/2] pwm: mtk-disp: Disable shadow registers before setting backlight values
  2023-01-23 16:06 [PATCH 0/2] pwm: mtk-disp: Fix backlight configuration at boot AngeloGioacchino Del Regno
@ 2023-01-23 16:06 ` AngeloGioacchino Del Regno
  2023-01-26 15:06   ` Nícolas F. R. A. Prado
  2023-01-23 16:06 ` [PATCH 2/2] pwm: mtk-disp: Configure double buffering before reading in .get_state() AngeloGioacchino Del Regno
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 17+ messages in thread
From: AngeloGioacchino Del Regno @ 2023-01-23 16:06 UTC (permalink / raw)
  To: thierry.reding
  Cc: u.kleine-koenig, matthias.bgg, weiqing.kong, jitao.shi,
	linux-pwm, linux-arm-kernel, linux-mediatek, linux-kernel,
	kernel, AngeloGioacchino Del Regno

If shadow registers usage is not desired, disable that before performing
any write to CON0/1 registers in the .apply() callback, otherwise we may
lose clkdiv or period/width updates.

Fixes: cd4b45ac449a ("pwm: Add MediaTek MT2701 display PWM driver support")
Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
---
 drivers/pwm/pwm-mtk-disp.c | 24 +++++++++++++-----------
 1 file changed, 13 insertions(+), 11 deletions(-)

diff --git a/drivers/pwm/pwm-mtk-disp.c b/drivers/pwm/pwm-mtk-disp.c
index 692a06121b28..82b430d881a2 100644
--- a/drivers/pwm/pwm-mtk-disp.c
+++ b/drivers/pwm/pwm-mtk-disp.c
@@ -138,6 +138,19 @@ static int mtk_disp_pwm_apply(struct pwm_chip *chip, struct pwm_device *pwm,
 	high_width = mul_u64_u64_div_u64(state->duty_cycle, rate, div);
 	value = period | (high_width << PWM_HIGH_WIDTH_SHIFT);
 
+	if (mdp->data->bls_debug && !mdp->data->has_commit) {
+		/*
+		 * For MT2701, disable double buffer before writing register
+		 * and select manual mode and use PWM_PERIOD/PWM_HIGH_WIDTH.
+		 */
+		mtk_disp_pwm_update_bits(mdp, mdp->data->bls_debug,
+					 mdp->data->bls_debug_mask,
+					 mdp->data->bls_debug_mask);
+		mtk_disp_pwm_update_bits(mdp, mdp->data->con0,
+					 mdp->data->con0_sel,
+					 mdp->data->con0_sel);
+	}
+
 	mtk_disp_pwm_update_bits(mdp, mdp->data->con0,
 				 PWM_CLKDIV_MASK,
 				 clk_div << PWM_CLKDIV_SHIFT);
@@ -152,17 +165,6 @@ static int mtk_disp_pwm_apply(struct pwm_chip *chip, struct pwm_device *pwm,
 		mtk_disp_pwm_update_bits(mdp, mdp->data->commit,
 					 mdp->data->commit_mask,
 					 0x0);
-	} else {
-		/*
-		 * For MT2701, disable double buffer before writing register
-		 * and select manual mode and use PWM_PERIOD/PWM_HIGH_WIDTH.
-		 */
-		mtk_disp_pwm_update_bits(mdp, mdp->data->bls_debug,
-					 mdp->data->bls_debug_mask,
-					 mdp->data->bls_debug_mask);
-		mtk_disp_pwm_update_bits(mdp, mdp->data->con0,
-					 mdp->data->con0_sel,
-					 mdp->data->con0_sel);
 	}
 
 	mtk_disp_pwm_update_bits(mdp, DISP_PWM_EN, mdp->data->enable_mask,
-- 
2.39.0


^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH 2/2] pwm: mtk-disp: Configure double buffering before reading in .get_state()
  2023-01-23 16:06 [PATCH 0/2] pwm: mtk-disp: Fix backlight configuration at boot AngeloGioacchino Del Regno
  2023-01-23 16:06 ` [PATCH 1/2] pwm: mtk-disp: Disable shadow registers before setting backlight values AngeloGioacchino Del Regno
@ 2023-01-23 16:06 ` AngeloGioacchino Del Regno
  2023-01-26 15:19   ` Nícolas F. R. A. Prado
  2023-01-26 15:31 ` [PATCH 0/2] pwm: mtk-disp: Fix backlight configuration at boot Adrian Ratiu
  2023-02-23 14:16 ` AngeloGioacchino Del Regno
  3 siblings, 1 reply; 17+ messages in thread
From: AngeloGioacchino Del Regno @ 2023-01-23 16:06 UTC (permalink / raw)
  To: thierry.reding
  Cc: u.kleine-koenig, matthias.bgg, weiqing.kong, jitao.shi,
	linux-pwm, linux-arm-kernel, linux-mediatek, linux-kernel,
	kernel, AngeloGioacchino Del Regno

The DISP_PWM controller's default behavior is to always use register
double buffering: all reads/writes are then performed on shadow
registers instead of working registers and this becomes an issue
in case our chosen configuration in Linux is different from the
default (or from the one that was pre-applied by the bootloader).

An example of broken behavior is when the controller is configured
to use shadow registers, but this driver wants to configure it
otherwise: what happens is that the .get_state() callback is called
right after registering the pwmchip and checks whether the PWM is
enabled by reading the DISP_PWM_EN register;
At this point, if shadow registers are enabled but their content
was not committed before booting Linux, we are *not* reading the
current PWM enablement status, leading to the kernel knowing that
the hardware is actually enabled when, in reality, it's not.

The aforementioned issue emerged since this driver was fixed with
commit 0b5ef3429d8f ("pwm: mtk-disp: Fix the parameters calculated
by the enabled flag of disp_pwm") making it to read the enablement
status from the right register.

Configure the controller in the .get_state() callback to avoid
this desync issue and get the backlight properly working again.

Fixes: 3f2b16734914 ("pwm: mtk-disp: Implement atomic API .get_state()")
Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
---
 drivers/pwm/pwm-mtk-disp.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/drivers/pwm/pwm-mtk-disp.c b/drivers/pwm/pwm-mtk-disp.c
index 82b430d881a2..fe9593f968ee 100644
--- a/drivers/pwm/pwm-mtk-disp.c
+++ b/drivers/pwm/pwm-mtk-disp.c
@@ -196,6 +196,16 @@ static int mtk_disp_pwm_get_state(struct pwm_chip *chip,
 		return err;
 	}
 
+	/*
+	 * Apply DISP_PWM_DEBUG settings to choose whether to enable or disable
+	 * registers double buffer and manual commit to working register before
+	 * performing any read/write operation
+	 */
+	if (mdp->data->bls_debug)
+		mtk_disp_pwm_update_bits(mdp, mdp->data->bls_debug,
+					 mdp->data->bls_debug_mask,
+					 mdp->data->bls_debug_mask);
+
 	rate = clk_get_rate(mdp->clk_main);
 	con0 = readl(mdp->base + mdp->data->con0);
 	con1 = readl(mdp->base + mdp->data->con1);
-- 
2.39.0


^ permalink raw reply related	[flat|nested] 17+ messages in thread

* Re: [PATCH 1/2] pwm: mtk-disp: Disable shadow registers before setting backlight values
  2023-01-23 16:06 ` [PATCH 1/2] pwm: mtk-disp: Disable shadow registers before setting backlight values AngeloGioacchino Del Regno
@ 2023-01-26 15:06   ` Nícolas F. R. A. Prado
  2023-01-26 15:20     ` AngeloGioacchino Del Regno
  0 siblings, 1 reply; 17+ messages in thread
From: Nícolas F. R. A. Prado @ 2023-01-26 15:06 UTC (permalink / raw)
  To: AngeloGioacchino Del Regno
  Cc: thierry.reding, u.kleine-koenig, matthias.bgg, weiqing.kong,
	jitao.shi, linux-pwm, linux-arm-kernel, linux-mediatek,
	linux-kernel, kernel

On Mon, Jan 23, 2023 at 05:06:14PM +0100, AngeloGioacchino Del Regno wrote:
> If shadow registers usage is not desired, disable that before performing
> any write to CON0/1 registers in the .apply() callback, otherwise we may
> lose clkdiv or period/width updates.
> 
> Fixes: cd4b45ac449a ("pwm: Add MediaTek MT2701 display PWM driver support")
> Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
> ---
>  drivers/pwm/pwm-mtk-disp.c | 24 +++++++++++++-----------
>  1 file changed, 13 insertions(+), 11 deletions(-)
> 
> diff --git a/drivers/pwm/pwm-mtk-disp.c b/drivers/pwm/pwm-mtk-disp.c
> index 692a06121b28..82b430d881a2 100644
> --- a/drivers/pwm/pwm-mtk-disp.c
> +++ b/drivers/pwm/pwm-mtk-disp.c
> @@ -138,6 +138,19 @@ static int mtk_disp_pwm_apply(struct pwm_chip *chip, struct pwm_device *pwm,
>  	high_width = mul_u64_u64_div_u64(state->duty_cycle, rate, div);
>  	value = period | (high_width << PWM_HIGH_WIDTH_SHIFT);
>  
> +	if (mdp->data->bls_debug && !mdp->data->has_commit) {
> +		/*
> +		 * For MT2701, disable double buffer before writing register

Not necessarily part of this series, but I guess it would make sense to remove
the "For MT2701". It's no longer exclusive to that SoC and the condition in the
if above makes it clear when this happens.

Reviewed-by: Nícolas F. R. A. Prado <nfraprado@collabora.com>
Tested-by: Nícolas F. R. A. Prado <nfraprado@collabora.com>

On MT8192 Asurada Spherion.

Thanks,
Nícolas

> +		 * and select manual mode and use PWM_PERIOD/PWM_HIGH_WIDTH.
> +		 */
> +		mtk_disp_pwm_update_bits(mdp, mdp->data->bls_debug,
> +					 mdp->data->bls_debug_mask,
> +					 mdp->data->bls_debug_mask);
> +		mtk_disp_pwm_update_bits(mdp, mdp->data->con0,
> +					 mdp->data->con0_sel,
> +					 mdp->data->con0_sel);
> +	}
> +
>  	mtk_disp_pwm_update_bits(mdp, mdp->data->con0,
>  				 PWM_CLKDIV_MASK,
>  				 clk_div << PWM_CLKDIV_SHIFT);
> @@ -152,17 +165,6 @@ static int mtk_disp_pwm_apply(struct pwm_chip *chip, struct pwm_device *pwm,
>  		mtk_disp_pwm_update_bits(mdp, mdp->data->commit,
>  					 mdp->data->commit_mask,
>  					 0x0);
> -	} else {
> -		/*
> -		 * For MT2701, disable double buffer before writing register
> -		 * and select manual mode and use PWM_PERIOD/PWM_HIGH_WIDTH.
> -		 */
> -		mtk_disp_pwm_update_bits(mdp, mdp->data->bls_debug,
> -					 mdp->data->bls_debug_mask,
> -					 mdp->data->bls_debug_mask);
> -		mtk_disp_pwm_update_bits(mdp, mdp->data->con0,
> -					 mdp->data->con0_sel,
> -					 mdp->data->con0_sel);
>  	}
>  
>  	mtk_disp_pwm_update_bits(mdp, DISP_PWM_EN, mdp->data->enable_mask,
> -- 
> 2.39.0
> 
> 

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH 2/2] pwm: mtk-disp: Configure double buffering before reading in .get_state()
  2023-01-23 16:06 ` [PATCH 2/2] pwm: mtk-disp: Configure double buffering before reading in .get_state() AngeloGioacchino Del Regno
@ 2023-01-26 15:19   ` Nícolas F. R. A. Prado
  2023-01-26 15:24     ` AngeloGioacchino Del Regno
  0 siblings, 1 reply; 17+ messages in thread
From: Nícolas F. R. A. Prado @ 2023-01-26 15:19 UTC (permalink / raw)
  To: AngeloGioacchino Del Regno
  Cc: thierry.reding, u.kleine-koenig, matthias.bgg, weiqing.kong,
	jitao.shi, linux-pwm, linux-arm-kernel, linux-mediatek,
	linux-kernel, kernel

On Mon, Jan 23, 2023 at 05:06:15PM +0100, AngeloGioacchino Del Regno wrote:
> The DISP_PWM controller's default behavior is to always use register
> double buffering: all reads/writes are then performed on shadow
> registers instead of working registers and this becomes an issue
> in case our chosen configuration in Linux is different from the
> default (or from the one that was pre-applied by the bootloader).
> 
> An example of broken behavior is when the controller is configured
> to use shadow registers, but this driver wants to configure it
> otherwise: what happens is that the .get_state() callback is called
> right after registering the pwmchip and checks whether the PWM is
> enabled by reading the DISP_PWM_EN register;
> At this point, if shadow registers are enabled but their content
> was not committed before booting Linux, we are *not* reading the
> current PWM enablement status, leading to the kernel knowing that
> the hardware is actually enabled when, in reality, it's not.
> 
> The aforementioned issue emerged since this driver was fixed with
> commit 0b5ef3429d8f ("pwm: mtk-disp: Fix the parameters calculated
> by the enabled flag of disp_pwm") making it to read the enablement
> status from the right register.
> 
> Configure the controller in the .get_state() callback to avoid
> this desync issue and get the backlight properly working again.
> 
> Fixes: 3f2b16734914 ("pwm: mtk-disp: Implement atomic API .get_state()")
> Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
> ---
>  drivers/pwm/pwm-mtk-disp.c | 10 ++++++++++
>  1 file changed, 10 insertions(+)
> 
> diff --git a/drivers/pwm/pwm-mtk-disp.c b/drivers/pwm/pwm-mtk-disp.c
> index 82b430d881a2..fe9593f968ee 100644
> --- a/drivers/pwm/pwm-mtk-disp.c
> +++ b/drivers/pwm/pwm-mtk-disp.c
> @@ -196,6 +196,16 @@ static int mtk_disp_pwm_get_state(struct pwm_chip *chip,
>  		return err;
>  	}
>  
> +	/*
> +	 * Apply DISP_PWM_DEBUG settings to choose whether to enable or disable
> +	 * registers double buffer and manual commit to working register before
> +	 * performing any read/write operation
> +	 */
> +	if (mdp->data->bls_debug)

I feel like this condition should be the same as in the apply() callback, since
they're doing the same write operation, so also have '&& !has_commit'.

Reviewed-by: Nícolas F. R. A. Prado <nfraprado@collabora.com>
Tested-by: Nícolas F. R. A. Prado <nfraprado@collabora.com>

On MT8192 Asurada Spherion.

Thanks,
Nícolas

> +		mtk_disp_pwm_update_bits(mdp, mdp->data->bls_debug,
> +					 mdp->data->bls_debug_mask,
> +					 mdp->data->bls_debug_mask);
> +
>  	rate = clk_get_rate(mdp->clk_main);
>  	con0 = readl(mdp->base + mdp->data->con0);
>  	con1 = readl(mdp->base + mdp->data->con1);
> -- 
> 2.39.0
> 
> 

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH 1/2] pwm: mtk-disp: Disable shadow registers before setting backlight values
  2023-01-26 15:06   ` Nícolas F. R. A. Prado
@ 2023-01-26 15:20     ` AngeloGioacchino Del Regno
  0 siblings, 0 replies; 17+ messages in thread
From: AngeloGioacchino Del Regno @ 2023-01-26 15:20 UTC (permalink / raw)
  To: Nícolas F. R. A. Prado
  Cc: thierry.reding, u.kleine-koenig, matthias.bgg, weiqing.kong,
	jitao.shi, linux-pwm, linux-arm-kernel, linux-mediatek,
	linux-kernel, kernel

Il 26/01/23 16:06, Nícolas F. R. A. Prado ha scritto:
> On Mon, Jan 23, 2023 at 05:06:14PM +0100, AngeloGioacchino Del Regno wrote:
>> If shadow registers usage is not desired, disable that before performing
>> any write to CON0/1 registers in the .apply() callback, otherwise we may
>> lose clkdiv or period/width updates.
>>
>> Fixes: cd4b45ac449a ("pwm: Add MediaTek MT2701 display PWM driver support")
>> Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
>> ---
>>   drivers/pwm/pwm-mtk-disp.c | 24 +++++++++++++-----------
>>   1 file changed, 13 insertions(+), 11 deletions(-)
>>
>> diff --git a/drivers/pwm/pwm-mtk-disp.c b/drivers/pwm/pwm-mtk-disp.c
>> index 692a06121b28..82b430d881a2 100644
>> --- a/drivers/pwm/pwm-mtk-disp.c
>> +++ b/drivers/pwm/pwm-mtk-disp.c
>> @@ -138,6 +138,19 @@ static int mtk_disp_pwm_apply(struct pwm_chip *chip, struct pwm_device *pwm,
>>   	high_width = mul_u64_u64_div_u64(state->duty_cycle, rate, div);
>>   	value = period | (high_width << PWM_HIGH_WIDTH_SHIFT);
>>   
>> +	if (mdp->data->bls_debug && !mdp->data->has_commit) {
>> +		/*
>> +		 * For MT2701, disable double buffer before writing register
> 
> Not necessarily part of this series, but I guess it would make sense to remove
> the "For MT2701". It's no longer exclusive to that SoC and the condition in the
> if above makes it clear when this happens.

Thanks for the review and test!

Anyway, for that "For MT2701", well, it ... should actually be exclusive to that
SoC (and some others) because, in reality, MT8183, MT8186, MT8192, MT8195 and
also almost all MediaTek smartphone SoCs do have shadow registers which we should
use for the backlight.

The bls_debug writes that we do are to disable writing to shadow registers and
performing commits because this driver does not (yet) support mtk_mutex handling.

The right thing to do here would be to grab a mtk_mutex, lock it, write shadow
registers, perform "backlighting adjustment magic" in mediatek_drm, commit, unlock.

Now, the "backlighting adjustment magic" is something that we do not support (yet?)
in mediatek_drm, and it's also not really easy to implement: part of that magic
needs RGB ALS readings and implementation of some more IP, which serves the purpose
of, for example, adjusting the backlight PWM while taking account of some GAMMA
adjustments to enhance readability of the screen in direct sunlight, or to decrease
(slightly) power consumption of a display lit at night.

So... the current way that we're using right now (which is disabling the shadow
registers and performing direct writes to working registers to atomically set the
backlight) is something that *should* disappear in *a* future in which that "magic"
gets somehow properly implemented.

This 9k lines mail, just to say that "For MT2701" is technically exclusive to that
SoC, between the number of supported SoCs of this driver :-P

Cheers!
Andlo

> 
> Reviewed-by: Nícolas F. R. A. Prado <nfraprado@collabora.com>
> Tested-by: Nícolas F. R. A. Prado <nfraprado@collabora.com>
> 
> On MT8192 Asurada Spherion.
> 
> Thanks,
> Nícolas
> 


^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH 2/2] pwm: mtk-disp: Configure double buffering before reading in .get_state()
  2023-01-26 15:19   ` Nícolas F. R. A. Prado
@ 2023-01-26 15:24     ` AngeloGioacchino Del Regno
  2023-01-26 16:09       ` Nícolas F. R. A. Prado
  0 siblings, 1 reply; 17+ messages in thread
From: AngeloGioacchino Del Regno @ 2023-01-26 15:24 UTC (permalink / raw)
  To: Nícolas F. R. A. Prado
  Cc: thierry.reding, u.kleine-koenig, matthias.bgg, weiqing.kong,
	jitao.shi, linux-pwm, linux-arm-kernel, linux-mediatek,
	linux-kernel, kernel

Il 26/01/23 16:19, Nícolas F. R. A. Prado ha scritto:
> On Mon, Jan 23, 2023 at 05:06:15PM +0100, AngeloGioacchino Del Regno wrote:
>> The DISP_PWM controller's default behavior is to always use register
>> double buffering: all reads/writes are then performed on shadow
>> registers instead of working registers and this becomes an issue
>> in case our chosen configuration in Linux is different from the
>> default (or from the one that was pre-applied by the bootloader).
>>
>> An example of broken behavior is when the controller is configured
>> to use shadow registers, but this driver wants to configure it
>> otherwise: what happens is that the .get_state() callback is called
>> right after registering the pwmchip and checks whether the PWM is
>> enabled by reading the DISP_PWM_EN register;
>> At this point, if shadow registers are enabled but their content
>> was not committed before booting Linux, we are *not* reading the
>> current PWM enablement status, leading to the kernel knowing that
>> the hardware is actually enabled when, in reality, it's not.
>>
>> The aforementioned issue emerged since this driver was fixed with
>> commit 0b5ef3429d8f ("pwm: mtk-disp: Fix the parameters calculated
>> by the enabled flag of disp_pwm") making it to read the enablement
>> status from the right register.
>>
>> Configure the controller in the .get_state() callback to avoid
>> this desync issue and get the backlight properly working again.
>>
>> Fixes: 3f2b16734914 ("pwm: mtk-disp: Implement atomic API .get_state()")
>> Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
>> ---
>>   drivers/pwm/pwm-mtk-disp.c | 10 ++++++++++
>>   1 file changed, 10 insertions(+)
>>
>> diff --git a/drivers/pwm/pwm-mtk-disp.c b/drivers/pwm/pwm-mtk-disp.c
>> index 82b430d881a2..fe9593f968ee 100644
>> --- a/drivers/pwm/pwm-mtk-disp.c
>> +++ b/drivers/pwm/pwm-mtk-disp.c
>> @@ -196,6 +196,16 @@ static int mtk_disp_pwm_get_state(struct pwm_chip *chip,
>>   		return err;
>>   	}
>>   
>> +	/*
>> +	 * Apply DISP_PWM_DEBUG settings to choose whether to enable or disable
>> +	 * registers double buffer and manual commit to working register before
>> +	 * performing any read/write operation
>> +	 */
>> +	if (mdp->data->bls_debug)
> 
> I feel like this condition should be the same as in the apply() callback, since
> they're doing the same write operation, so also have '&& !has_commit'.
> 

The bls_debug register is used to both enable and/or disable various features,
including the one that I'm targeting in this commit, which is disabling shadow
registers.

As I explained in the commit message, we don't want to - and cannot - assume that
the bootloader doesn't *reset* the backlight controller before booting Linux: a
reset would re-enable the shadow registers, and this function being called as
first to check the backlight EN status may fail to do so.

This is as well true in the opposite situation where, in the future, we may want
to set shadow registers ON, while the bootloader sets them OFF before booting:
adding a (x && !has_commit) check in this branch would defeat that purpose and
make this commit... well.. partially broken! :-)

Cheers!
Angelo

> Reviewed-by: Nícolas F. R. A. Prado <nfraprado@collabora.com>
> Tested-by: Nícolas F. R. A. Prado <nfraprado@collabora.com>
> 
> On MT8192 Asurada Spherion.
> 
> Thanks,
> Nícolas
> 
>> +		mtk_disp_pwm_update_bits(mdp, mdp->data->bls_debug,
>> +					 mdp->data->bls_debug_mask,
>> +					 mdp->data->bls_debug_mask);
>> +
>>   	rate = clk_get_rate(mdp->clk_main);
>>   	con0 = readl(mdp->base + mdp->data->con0);
>>   	con1 = readl(mdp->base + mdp->data->con1);
>> -- 
>> 2.39.0
>>
>>



^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH 0/2] pwm: mtk-disp: Fix backlight configuration at boot
  2023-01-23 16:06 [PATCH 0/2] pwm: mtk-disp: Fix backlight configuration at boot AngeloGioacchino Del Regno
  2023-01-23 16:06 ` [PATCH 1/2] pwm: mtk-disp: Disable shadow registers before setting backlight values AngeloGioacchino Del Regno
  2023-01-23 16:06 ` [PATCH 2/2] pwm: mtk-disp: Configure double buffering before reading in .get_state() AngeloGioacchino Del Regno
@ 2023-01-26 15:31 ` Adrian Ratiu
  2023-02-23 14:16 ` AngeloGioacchino Del Regno
  3 siblings, 0 replies; 17+ messages in thread
From: Adrian Ratiu @ 2023-01-26 15:31 UTC (permalink / raw)
  To: AngeloGioacchino Del Regno
  Cc: u.kleine-koenig, matthias.bgg, weiqing.kong, jitao.shi,
	linux-pwm, linux-arm-kernel, linux-mediatek, linux-kernel,
	kernel, thierry.reding

On Mon, 23 Jan 2023, AngeloGioacchino Del Regno 
<angelogioacchino.delregno@collabora.com> wrote:
> Since the pwm-mtk-disp driver was fixed to get PWM_EN state from 
> the right register, an old two-wrongs-make-one-right issue 
> emerged: as a result, MT8192 Asurada Spherion got no backlight 
> at boot unless a suspend/resume cycle was performed.  Also, the 
> backlight would sometimes not get updated with the requested 
> value, requiring the user to change it back and forth until it 
> worked. 
> 
> This series fixes both of the aforementioned issues found on 
> MT8192. 

Thanks for the series. This also improves backlight on MT8183.

I've been testing using the panfrost driver on a ChromiumOS 
userspace on a jacuzzi board and I've had issues like the screen 
going blank then not coming back, which these patches appear to 
solve. Many thanks!

Tested-by: Adrian Ratiu <adrian.ratiu@collabora.com>

>
> AngeloGioacchino Del Regno (2):
>   pwm: mtk-disp: Disable shadow registers before setting backlight
>     values
>   pwm: mtk-disp: Configure double buffering before reading in
>     .get_state()
>
>  drivers/pwm/pwm-mtk-disp.c | 34 +++++++++++++++++++++++-----------
>  1 file changed, 23 insertions(+), 11 deletions(-)
>
> -- 
> 2.39.0

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH 2/2] pwm: mtk-disp: Configure double buffering before reading in .get_state()
  2023-01-26 15:24     ` AngeloGioacchino Del Regno
@ 2023-01-26 16:09       ` Nícolas F. R. A. Prado
  2023-01-26 16:16         ` AngeloGioacchino Del Regno
  0 siblings, 1 reply; 17+ messages in thread
From: Nícolas F. R. A. Prado @ 2023-01-26 16:09 UTC (permalink / raw)
  To: AngeloGioacchino Del Regno
  Cc: thierry.reding, u.kleine-koenig, matthias.bgg, weiqing.kong,
	jitao.shi, linux-pwm, linux-arm-kernel, linux-mediatek,
	linux-kernel, kernel

On Thu, Jan 26, 2023 at 04:24:29PM +0100, AngeloGioacchino Del Regno wrote:
> Il 26/01/23 16:19, Nícolas F. R. A. Prado ha scritto:
> > On Mon, Jan 23, 2023 at 05:06:15PM +0100, AngeloGioacchino Del Regno wrote:
> > > The DISP_PWM controller's default behavior is to always use register
> > > double buffering: all reads/writes are then performed on shadow
> > > registers instead of working registers and this becomes an issue
> > > in case our chosen configuration in Linux is different from the
> > > default (or from the one that was pre-applied by the bootloader).
> > > 
> > > An example of broken behavior is when the controller is configured
> > > to use shadow registers, but this driver wants to configure it
> > > otherwise: what happens is that the .get_state() callback is called
> > > right after registering the pwmchip and checks whether the PWM is
> > > enabled by reading the DISP_PWM_EN register;
> > > At this point, if shadow registers are enabled but their content
> > > was not committed before booting Linux, we are *not* reading the
> > > current PWM enablement status, leading to the kernel knowing that
> > > the hardware is actually enabled when, in reality, it's not.
> > > 
> > > The aforementioned issue emerged since this driver was fixed with
> > > commit 0b5ef3429d8f ("pwm: mtk-disp: Fix the parameters calculated
> > > by the enabled flag of disp_pwm") making it to read the enablement
> > > status from the right register.
> > > 
> > > Configure the controller in the .get_state() callback to avoid
> > > this desync issue and get the backlight properly working again.
> > > 
> > > Fixes: 3f2b16734914 ("pwm: mtk-disp: Implement atomic API .get_state()")
> > > Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
> > > ---
> > >   drivers/pwm/pwm-mtk-disp.c | 10 ++++++++++
> > >   1 file changed, 10 insertions(+)
> > > 
> > > diff --git a/drivers/pwm/pwm-mtk-disp.c b/drivers/pwm/pwm-mtk-disp.c
> > > index 82b430d881a2..fe9593f968ee 100644
> > > --- a/drivers/pwm/pwm-mtk-disp.c
> > > +++ b/drivers/pwm/pwm-mtk-disp.c
> > > @@ -196,6 +196,16 @@ static int mtk_disp_pwm_get_state(struct pwm_chip *chip,
> > >   		return err;
> > >   	}
> > > +	/*
> > > +	 * Apply DISP_PWM_DEBUG settings to choose whether to enable or disable
> > > +	 * registers double buffer and manual commit to working register before
> > > +	 * performing any read/write operation
> > > +	 */
> > > +	if (mdp->data->bls_debug)
> > 
> > I feel like this condition should be the same as in the apply() callback, since
> > they're doing the same write operation, so also have '&& !has_commit'.
> > 
> 
> The bls_debug register is used to both enable and/or disable various features,
> including the one that I'm targeting in this commit, which is disabling shadow
> registers.
> 
> As I explained in the commit message, we don't want to - and cannot - assume that
> the bootloader doesn't *reset* the backlight controller before booting Linux: a
> reset would re-enable the shadow registers, and this function being called as
> first to check the backlight EN status may fail to do so.
> 
> This is as well true in the opposite situation where, in the future, we may want
> to set shadow registers ON, while the bootloader sets them OFF before booting:
> adding a (x && !has_commit) check in this branch would defeat that purpose and
> make this commit... well.. partially broken! :-)

Makes sense, but in that case shouldn't we drop the (&& !has_commit) in the
check of the previous commit too? I get that in the pwm's core current logic,
get_state() is run before apply(), but given that we also write the debug
register in apply(), we're not relying on that. So as it currently stands, if in
the future the bootloader sets shadow registers OFF, and we want to set them ON,
and we call apply() before having called get_state(), we'd be back to the broken
behavior.

Thanks,
Nícolas

> 
> Cheers!
> Angelo
> 
> > Reviewed-by: Nícolas F. R. A. Prado <nfraprado@collabora.com>
> > Tested-by: Nícolas F. R. A. Prado <nfraprado@collabora.com>
> > 
> > On MT8192 Asurada Spherion.
> > 
> > Thanks,
> > Nícolas
> > 
> > > +		mtk_disp_pwm_update_bits(mdp, mdp->data->bls_debug,
> > > +					 mdp->data->bls_debug_mask,
> > > +					 mdp->data->bls_debug_mask);
> > > +
> > >   	rate = clk_get_rate(mdp->clk_main);
> > >   	con0 = readl(mdp->base + mdp->data->con0);
> > >   	con1 = readl(mdp->base + mdp->data->con1);
> > > -- 
> > > 2.39.0
> > > 
> > > 
> 
> 

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH 2/2] pwm: mtk-disp: Configure double buffering before reading in .get_state()
  2023-01-26 16:09       ` Nícolas F. R. A. Prado
@ 2023-01-26 16:16         ` AngeloGioacchino Del Regno
  0 siblings, 0 replies; 17+ messages in thread
From: AngeloGioacchino Del Regno @ 2023-01-26 16:16 UTC (permalink / raw)
  To: Nícolas F. R. A. Prado
  Cc: thierry.reding, u.kleine-koenig, matthias.bgg, weiqing.kong,
	jitao.shi, linux-pwm, linux-arm-kernel, linux-mediatek,
	linux-kernel, kernel

Il 26/01/23 17:09, Nícolas F. R. A. Prado ha scritto:
> On Thu, Jan 26, 2023 at 04:24:29PM +0100, AngeloGioacchino Del Regno wrote:
>> Il 26/01/23 16:19, Nícolas F. R. A. Prado ha scritto:
>>> On Mon, Jan 23, 2023 at 05:06:15PM +0100, AngeloGioacchino Del Regno wrote:
>>>> The DISP_PWM controller's default behavior is to always use register
>>>> double buffering: all reads/writes are then performed on shadow
>>>> registers instead of working registers and this becomes an issue
>>>> in case our chosen configuration in Linux is different from the
>>>> default (or from the one that was pre-applied by the bootloader).
>>>>
>>>> An example of broken behavior is when the controller is configured
>>>> to use shadow registers, but this driver wants to configure it
>>>> otherwise: what happens is that the .get_state() callback is called
>>>> right after registering the pwmchip and checks whether the PWM is
>>>> enabled by reading the DISP_PWM_EN register;
>>>> At this point, if shadow registers are enabled but their content
>>>> was not committed before booting Linux, we are *not* reading the
>>>> current PWM enablement status, leading to the kernel knowing that
>>>> the hardware is actually enabled when, in reality, it's not.
>>>>
>>>> The aforementioned issue emerged since this driver was fixed with
>>>> commit 0b5ef3429d8f ("pwm: mtk-disp: Fix the parameters calculated
>>>> by the enabled flag of disp_pwm") making it to read the enablement
>>>> status from the right register.
>>>>
>>>> Configure the controller in the .get_state() callback to avoid
>>>> this desync issue and get the backlight properly working again.
>>>>
>>>> Fixes: 3f2b16734914 ("pwm: mtk-disp: Implement atomic API .get_state()")
>>>> Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
>>>> ---
>>>>    drivers/pwm/pwm-mtk-disp.c | 10 ++++++++++
>>>>    1 file changed, 10 insertions(+)
>>>>
>>>> diff --git a/drivers/pwm/pwm-mtk-disp.c b/drivers/pwm/pwm-mtk-disp.c
>>>> index 82b430d881a2..fe9593f968ee 100644
>>>> --- a/drivers/pwm/pwm-mtk-disp.c
>>>> +++ b/drivers/pwm/pwm-mtk-disp.c
>>>> @@ -196,6 +196,16 @@ static int mtk_disp_pwm_get_state(struct pwm_chip *chip,
>>>>    		return err;
>>>>    	}
>>>> +	/*
>>>> +	 * Apply DISP_PWM_DEBUG settings to choose whether to enable or disable
>>>> +	 * registers double buffer and manual commit to working register before
>>>> +	 * performing any read/write operation
>>>> +	 */
>>>> +	if (mdp->data->bls_debug)
>>>
>>> I feel like this condition should be the same as in the apply() callback, since
>>> they're doing the same write operation, so also have '&& !has_commit'.
>>>
>>
>> The bls_debug register is used to both enable and/or disable various features,
>> including the one that I'm targeting in this commit, which is disabling shadow
>> registers.
>>
>> As I explained in the commit message, we don't want to - and cannot - assume that
>> the bootloader doesn't *reset* the backlight controller before booting Linux: a
>> reset would re-enable the shadow registers, and this function being called as
>> first to check the backlight EN status may fail to do so.
>>
>> This is as well true in the opposite situation where, in the future, we may want
>> to set shadow registers ON, while the bootloader sets them OFF before booting:
>> adding a (x && !has_commit) check in this branch would defeat that purpose and
>> make this commit... well.. partially broken! :-)
> 
> Makes sense, but in that case shouldn't we drop the (&& !has_commit) in the
> check of the previous commit too? I get that in the pwm's core current logic,

No. The previous commit checks !has_commit to select a register write strategy
between "shadow -> commit" and "working registers - no commit necessary".

If you drop that check from the previous commit, how can you choose the write
strategy to use?! :-)

You can't rely on reading the bls_debug register, either, because it may be
holding different values compared to what we want due to, for example, a reset
and you can't rely on checking bls_debug_mask because in the future this kind
of selector may be residing in an entirely different register.

> get_state() is run before apply(), but given that we also write the debug
> register in apply(), we're not relying on that. So as it currently stands, if in
> the future the bootloader sets shadow registers OFF, and we want to set them ON,
> and we call apply() before having called get_state(), we'd be back to the broken
> behavior.

No, because the default BLS_DEBUG register value at IP reset is 0 - where 0 means
"do not disable commit, do not disable shadow register read, do not disable shadow
register write" :-)

Cheers,
Angelo

> 
> Thanks,
> Nícolas
> 
>>
>> Cheers!
>> Angelo
>>
>>> Reviewed-by: Nícolas F. R. A. Prado <nfraprado@collabora.com>
>>> Tested-by: Nícolas F. R. A. Prado <nfraprado@collabora.com>
>>>
>>> On MT8192 Asurada Spherion.
>>>
>>> Thanks,
>>> Nícolas
>>>
>>>> +		mtk_disp_pwm_update_bits(mdp, mdp->data->bls_debug,
>>>> +					 mdp->data->bls_debug_mask,
>>>> +					 mdp->data->bls_debug_mask);
>>>> +
>>>>    	rate = clk_get_rate(mdp->clk_main);
>>>>    	con0 = readl(mdp->base + mdp->data->con0);
>>>>    	con1 = readl(mdp->base + mdp->data->con1);
>>>> -- 
>>>> 2.39.0
>>>>
>>>>
>>
>>



^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH 0/2] pwm: mtk-disp: Fix backlight configuration at boot
  2023-01-23 16:06 [PATCH 0/2] pwm: mtk-disp: Fix backlight configuration at boot AngeloGioacchino Del Regno
                   ` (2 preceding siblings ...)
  2023-01-26 15:31 ` [PATCH 0/2] pwm: mtk-disp: Fix backlight configuration at boot Adrian Ratiu
@ 2023-02-23 14:16 ` AngeloGioacchino Del Regno
  2023-03-08 11:46   ` AngeloGioacchino Del Regno
  3 siblings, 1 reply; 17+ messages in thread
From: AngeloGioacchino Del Regno @ 2023-02-23 14:16 UTC (permalink / raw)
  To: thierry.reding
  Cc: u.kleine-koenig, matthias.bgg, weiqing.kong, jitao.shi,
	linux-pwm, linux-arm-kernel, linux-mediatek, linux-kernel,
	kernel

Il 23/01/23 17:06, AngeloGioacchino Del Regno ha scritto:
> Since the pwm-mtk-disp driver was fixed to get PWM_EN state from the
> right register, an old two-wrongs-make-one-right issue emerged: as a
> result, MT8192 Asurada Spherion got no backlight at boot unless a
> suspend/resume cycle was performed.
> Also, the backlight would sometimes not get updated with the requested
> value, requiring the user to change it back and forth until it worked.
> 
> This series fixes both of the aforementioned issues found on MT8192.
> 
> AngeloGioacchino Del Regno (2):
>    pwm: mtk-disp: Disable shadow registers before setting backlight
>      values
>    pwm: mtk-disp: Configure double buffering before reading in
>      .get_state()
> 
>   drivers/pwm/pwm-mtk-disp.c | 34 +++++++++++++++++++++++-----------
>   1 file changed, 23 insertions(+), 11 deletions(-)
> 

Gentle ping for this one: this is fixing backlight issues on multiple MediaTek
SoCs and was well tested.

Thanks,
Angelo

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH 0/2] pwm: mtk-disp: Fix backlight configuration at boot
  2023-02-23 14:16 ` AngeloGioacchino Del Regno
@ 2023-03-08 11:46   ` AngeloGioacchino Del Regno
  2023-03-08 14:50     ` Greg Kroah-Hartman
  0 siblings, 1 reply; 17+ messages in thread
From: AngeloGioacchino Del Regno @ 2023-03-08 11:46 UTC (permalink / raw)
  To: thierry.reding
  Cc: u.kleine-koenig, matthias.bgg, weiqing.kong, jitao.shi,
	linux-pwm, linux-arm-kernel, linux-mediatek, linux-kernel,
	kernel, Greg Kroah-Hartman

Il 23/02/23 15:16, AngeloGioacchino Del Regno ha scritto:
> Il 23/01/23 17:06, AngeloGioacchino Del Regno ha scritto:
>> Since the pwm-mtk-disp driver was fixed to get PWM_EN state from the
>> right register, an old two-wrongs-make-one-right issue emerged: as a
>> result, MT8192 Asurada Spherion got no backlight at boot unless a
>> suspend/resume cycle was performed.
>> Also, the backlight would sometimes not get updated with the requested
>> value, requiring the user to change it back and forth until it worked.
>>
>> This series fixes both of the aforementioned issues found on MT8192.
>>
>> AngeloGioacchino Del Regno (2):
>>    pwm: mtk-disp: Disable shadow registers before setting backlight
>>      values
>>    pwm: mtk-disp: Configure double buffering before reading in
>>      .get_state()
>>
>>   drivers/pwm/pwm-mtk-disp.c | 34 +++++++++++++++++++++++-----------
>>   1 file changed, 23 insertions(+), 11 deletions(-)
>>
> 
> Gentle ping for this one: this is fixing backlight issues on multiple MediaTek
> SoCs and was well tested.
> 
> Thanks,
> Angelo

Since this series was sent more than one month ago, and since this fixes broken
backlight on a number of Chromebooks with MT8183 and MT8192 SoCs, and seen the
urgency of getting these fixes in, I'm adding Greg to the loop.

Regards,
Angelo

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH 0/2] pwm: mtk-disp: Fix backlight configuration at boot
  2023-03-08 11:46   ` AngeloGioacchino Del Regno
@ 2023-03-08 14:50     ` Greg Kroah-Hartman
  2023-03-08 14:55       ` AngeloGioacchino Del Regno
  0 siblings, 1 reply; 17+ messages in thread
From: Greg Kroah-Hartman @ 2023-03-08 14:50 UTC (permalink / raw)
  To: AngeloGioacchino Del Regno
  Cc: thierry.reding, u.kleine-koenig, matthias.bgg, weiqing.kong,
	jitao.shi, linux-pwm, linux-arm-kernel, linux-mediatek,
	linux-kernel, kernel

On Wed, Mar 08, 2023 at 12:46:07PM +0100, AngeloGioacchino Del Regno wrote:
> Il 23/02/23 15:16, AngeloGioacchino Del Regno ha scritto:
> > Il 23/01/23 17:06, AngeloGioacchino Del Regno ha scritto:
> > > Since the pwm-mtk-disp driver was fixed to get PWM_EN state from the
> > > right register, an old two-wrongs-make-one-right issue emerged: as a
> > > result, MT8192 Asurada Spherion got no backlight at boot unless a
> > > suspend/resume cycle was performed.
> > > Also, the backlight would sometimes not get updated with the requested
> > > value, requiring the user to change it back and forth until it worked.
> > > 
> > > This series fixes both of the aforementioned issues found on MT8192.
> > > 
> > > AngeloGioacchino Del Regno (2):
> > >    pwm: mtk-disp: Disable shadow registers before setting backlight
> > >      values
> > >    pwm: mtk-disp: Configure double buffering before reading in
> > >      .get_state()
> > > 
> > >   drivers/pwm/pwm-mtk-disp.c | 34 +++++++++++++++++++++++-----------
> > >   1 file changed, 23 insertions(+), 11 deletions(-)
> > > 
> > 
> > Gentle ping for this one: this is fixing backlight issues on multiple MediaTek
> > SoCs and was well tested.
> > 
> > Thanks,
> > Angelo
> 
> Since this series was sent more than one month ago, and since this fixes broken
> backlight on a number of Chromebooks with MT8183 and MT8192 SoCs, and seen the
> urgency of getting these fixes in, I'm adding Greg to the loop.

$ ./scripts/get_maintainer.pl drivers/pwm/pwm-mtk-disp.c
Thierry Reding <thierry.reding@gmail.com> (maintainer:PWM SUBSYSTEM)
"Uwe Kleine-König" <u.kleine-koenig@pengutronix.de> (reviewer:PWM SUBSYSTEM)
Matthias Brugger <matthias.bgg@gmail.com> (maintainer:ARM/Mediatek SoC support)
AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com> (reviewer:ARM/Mediatek SoC support)
linux-pwm@vger.kernel.org (open list:PWM SUBSYSTEM)
linux-kernel@vger.kernel.org (open list:ARM/Mediatek SoC support)
linux-arm-kernel@lists.infradead.org (moderated list:ARM/Mediatek SoC support)
linux-mediatek@lists.infradead.org (moderated list:ARM/Mediatek SoC support)

I don't see my name in there, did I become the PWM maintainer somehow?

What's wrong with Thierry taking this like normal?

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH 0/2] pwm: mtk-disp: Fix backlight configuration at boot
  2023-03-08 14:50     ` Greg Kroah-Hartman
@ 2023-03-08 14:55       ` AngeloGioacchino Del Regno
  2023-03-08 15:43         ` Greg Kroah-Hartman
  0 siblings, 1 reply; 17+ messages in thread
From: AngeloGioacchino Del Regno @ 2023-03-08 14:55 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: thierry.reding, u.kleine-koenig, matthias.bgg, weiqing.kong,
	jitao.shi, linux-pwm, linux-arm-kernel, linux-mediatek,
	linux-kernel, kernel

Il 08/03/23 15:50, Greg Kroah-Hartman ha scritto:
> On Wed, Mar 08, 2023 at 12:46:07PM +0100, AngeloGioacchino Del Regno wrote:
>> Il 23/02/23 15:16, AngeloGioacchino Del Regno ha scritto:
>>> Il 23/01/23 17:06, AngeloGioacchino Del Regno ha scritto:
>>>> Since the pwm-mtk-disp driver was fixed to get PWM_EN state from the
>>>> right register, an old two-wrongs-make-one-right issue emerged: as a
>>>> result, MT8192 Asurada Spherion got no backlight at boot unless a
>>>> suspend/resume cycle was performed.
>>>> Also, the backlight would sometimes not get updated with the requested
>>>> value, requiring the user to change it back and forth until it worked.
>>>>
>>>> This series fixes both of the aforementioned issues found on MT8192.
>>>>
>>>> AngeloGioacchino Del Regno (2):
>>>>     pwm: mtk-disp: Disable shadow registers before setting backlight
>>>>       values
>>>>     pwm: mtk-disp: Configure double buffering before reading in
>>>>       .get_state()
>>>>
>>>>    drivers/pwm/pwm-mtk-disp.c | 34 +++++++++++++++++++++++-----------
>>>>    1 file changed, 23 insertions(+), 11 deletions(-)
>>>>
>>>
>>> Gentle ping for this one: this is fixing backlight issues on multiple MediaTek
>>> SoCs and was well tested.
>>>
>>> Thanks,
>>> Angelo
>>
>> Since this series was sent more than one month ago, and since this fixes broken
>> backlight on a number of Chromebooks with MT8183 and MT8192 SoCs, and seen the
>> urgency of getting these fixes in, I'm adding Greg to the loop.
> 
> $ ./scripts/get_maintainer.pl drivers/pwm/pwm-mtk-disp.c
> Thierry Reding <thierry.reding@gmail.com> (maintainer:PWM SUBSYSTEM)
> "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de> (reviewer:PWM SUBSYSTEM)
> Matthias Brugger <matthias.bgg@gmail.com> (maintainer:ARM/Mediatek SoC support)
> AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com> (reviewer:ARM/Mediatek SoC support)
> linux-pwm@vger.kernel.org (open list:PWM SUBSYSTEM)
> linux-kernel@vger.kernel.org (open list:ARM/Mediatek SoC support)
> linux-arm-kernel@lists.infradead.org (moderated list:ARM/Mediatek SoC support)
> linux-mediatek@lists.infradead.org (moderated list:ARM/Mediatek SoC support)
> 
> I don't see my name in there, did I become the PWM maintainer somehow?
> 
> What's wrong with Thierry taking this like normal?
> 

Nothing wrong with that. I felt like this series got ignored as I've never
received any reply from Thierry, even though it's a Fixes series that I deem
to be moderately urgent; that's why I added you to the loop.

If that created unnecessary noise, I'm extremely sorry and won't happen again.

Regards,
Angelo


^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH 0/2] pwm: mtk-disp: Fix backlight configuration at boot
  2023-03-08 14:55       ` AngeloGioacchino Del Regno
@ 2023-03-08 15:43         ` Greg Kroah-Hartman
  2023-03-08 16:04           ` AngeloGioacchino Del Regno
  2023-03-08 16:07           ` Uwe Kleine-König
  0 siblings, 2 replies; 17+ messages in thread
From: Greg Kroah-Hartman @ 2023-03-08 15:43 UTC (permalink / raw)
  To: AngeloGioacchino Del Regno
  Cc: thierry.reding, u.kleine-koenig, matthias.bgg, weiqing.kong,
	jitao.shi, linux-pwm, linux-arm-kernel, linux-mediatek,
	linux-kernel, kernel

On Wed, Mar 08, 2023 at 03:55:59PM +0100, AngeloGioacchino Del Regno wrote:
> Il 08/03/23 15:50, Greg Kroah-Hartman ha scritto:
> > On Wed, Mar 08, 2023 at 12:46:07PM +0100, AngeloGioacchino Del Regno wrote:
> > > Il 23/02/23 15:16, AngeloGioacchino Del Regno ha scritto:
> > > > Il 23/01/23 17:06, AngeloGioacchino Del Regno ha scritto:
> > > > > Since the pwm-mtk-disp driver was fixed to get PWM_EN state from the
> > > > > right register, an old two-wrongs-make-one-right issue emerged: as a
> > > > > result, MT8192 Asurada Spherion got no backlight at boot unless a
> > > > > suspend/resume cycle was performed.
> > > > > Also, the backlight would sometimes not get updated with the requested
> > > > > value, requiring the user to change it back and forth until it worked.
> > > > > 
> > > > > This series fixes both of the aforementioned issues found on MT8192.
> > > > > 
> > > > > AngeloGioacchino Del Regno (2):
> > > > >     pwm: mtk-disp: Disable shadow registers before setting backlight
> > > > >       values
> > > > >     pwm: mtk-disp: Configure double buffering before reading in
> > > > >       .get_state()
> > > > > 
> > > > >    drivers/pwm/pwm-mtk-disp.c | 34 +++++++++++++++++++++++-----------
> > > > >    1 file changed, 23 insertions(+), 11 deletions(-)
> > > > > 
> > > > 
> > > > Gentle ping for this one: this is fixing backlight issues on multiple MediaTek
> > > > SoCs and was well tested.
> > > > 
> > > > Thanks,
> > > > Angelo
> > > 
> > > Since this series was sent more than one month ago, and since this fixes broken
> > > backlight on a number of Chromebooks with MT8183 and MT8192 SoCs, and seen the
> > > urgency of getting these fixes in, I'm adding Greg to the loop.
> > 
> > $ ./scripts/get_maintainer.pl drivers/pwm/pwm-mtk-disp.c
> > Thierry Reding <thierry.reding@gmail.com> (maintainer:PWM SUBSYSTEM)
> > "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de> (reviewer:PWM SUBSYSTEM)
> > Matthias Brugger <matthias.bgg@gmail.com> (maintainer:ARM/Mediatek SoC support)
> > AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com> (reviewer:ARM/Mediatek SoC support)
> > linux-pwm@vger.kernel.org (open list:PWM SUBSYSTEM)
> > linux-kernel@vger.kernel.org (open list:ARM/Mediatek SoC support)
> > linux-arm-kernel@lists.infradead.org (moderated list:ARM/Mediatek SoC support)
> > linux-mediatek@lists.infradead.org (moderated list:ARM/Mediatek SoC support)
> > 
> > I don't see my name in there, did I become the PWM maintainer somehow?
> > 
> > What's wrong with Thierry taking this like normal?
> > 
> 
> Nothing wrong with that. I felt like this series got ignored as I've never
> received any reply from Thierry, even though it's a Fixes series that I deem
> to be moderately urgent; that's why I added you to the loop.

Then ask Thierry and Uwe, what would you want to have happen if you were
the maintainer of a subsystem?

> If that created unnecessary noise, I'm extremely sorry and won't happen again.

Not noise, just confusion on my part.  I'm glad to take patches that
have no obvious maintainers, or maintainers that have disappeared, but
that doesn't seem to be the case here.

Also remember that we had the merge window, which is 2 weeks of us not
being able to take any new code at all, even for fixes.

And finally, to make it easier for your code to be accepted, please take
the time to review other's code for the subsystems you care about to
make the maintainer's load easier.  If you do that, you will often find
your patches getting faster response just by virtue of there being less
work to do on the subsystem overall.  Why not do that right now to help
out with other PWM patches?

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH 0/2] pwm: mtk-disp: Fix backlight configuration at boot
  2023-03-08 15:43         ` Greg Kroah-Hartman
@ 2023-03-08 16:04           ` AngeloGioacchino Del Regno
  2023-03-08 16:07           ` Uwe Kleine-König
  1 sibling, 0 replies; 17+ messages in thread
From: AngeloGioacchino Del Regno @ 2023-03-08 16:04 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: thierry.reding, u.kleine-koenig, matthias.bgg, weiqing.kong,
	jitao.shi, linux-pwm, linux-arm-kernel, linux-mediatek,
	linux-kernel, kernel

Il 08/03/23 16:43, Greg Kroah-Hartman ha scritto:
> On Wed, Mar 08, 2023 at 03:55:59PM +0100, AngeloGioacchino Del Regno wrote:
>> Il 08/03/23 15:50, Greg Kroah-Hartman ha scritto:
>>> On Wed, Mar 08, 2023 at 12:46:07PM +0100, AngeloGioacchino Del Regno wrote:
>>>> Il 23/02/23 15:16, AngeloGioacchino Del Regno ha scritto:
>>>>> Il 23/01/23 17:06, AngeloGioacchino Del Regno ha scritto:
>>>>>> Since the pwm-mtk-disp driver was fixed to get PWM_EN state from the
>>>>>> right register, an old two-wrongs-make-one-right issue emerged: as a
>>>>>> result, MT8192 Asurada Spherion got no backlight at boot unless a
>>>>>> suspend/resume cycle was performed.
>>>>>> Also, the backlight would sometimes not get updated with the requested
>>>>>> value, requiring the user to change it back and forth until it worked.
>>>>>>
>>>>>> This series fixes both of the aforementioned issues found on MT8192.
>>>>>>
>>>>>> AngeloGioacchino Del Regno (2):
>>>>>>      pwm: mtk-disp: Disable shadow registers before setting backlight
>>>>>>        values
>>>>>>      pwm: mtk-disp: Configure double buffering before reading in
>>>>>>        .get_state()
>>>>>>
>>>>>>     drivers/pwm/pwm-mtk-disp.c | 34 +++++++++++++++++++++++-----------
>>>>>>     1 file changed, 23 insertions(+), 11 deletions(-)
>>>>>>
>>>>>
>>>>> Gentle ping for this one: this is fixing backlight issues on multiple MediaTek
>>>>> SoCs and was well tested.
>>>>>
>>>>> Thanks,
>>>>> Angelo
>>>>
>>>> Since this series was sent more than one month ago, and since this fixes broken
>>>> backlight on a number of Chromebooks with MT8183 and MT8192 SoCs, and seen the
>>>> urgency of getting these fixes in, I'm adding Greg to the loop.
>>>
>>> $ ./scripts/get_maintainer.pl drivers/pwm/pwm-mtk-disp.c
>>> Thierry Reding <thierry.reding@gmail.com> (maintainer:PWM SUBSYSTEM)
>>> "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de> (reviewer:PWM SUBSYSTEM)
>>> Matthias Brugger <matthias.bgg@gmail.com> (maintainer:ARM/Mediatek SoC support)
>>> AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com> (reviewer:ARM/Mediatek SoC support)
>>> linux-pwm@vger.kernel.org (open list:PWM SUBSYSTEM)
>>> linux-kernel@vger.kernel.org (open list:ARM/Mediatek SoC support)
>>> linux-arm-kernel@lists.infradead.org (moderated list:ARM/Mediatek SoC support)
>>> linux-mediatek@lists.infradead.org (moderated list:ARM/Mediatek SoC support)
>>>
>>> I don't see my name in there, did I become the PWM maintainer somehow?
>>>
>>> What's wrong with Thierry taking this like normal?
>>>
>>
>> Nothing wrong with that. I felt like this series got ignored as I've never
>> received any reply from Thierry, even though it's a Fixes series that I deem
>> to be moderately urgent; that's why I added you to the loop.
> 
> Then ask Thierry and Uwe, what would you want to have happen if you were
> the maintainer of a subsystem?
> 
>> If that created unnecessary noise, I'm extremely sorry and won't happen again.
> 
> Not noise, just confusion on my part.  I'm glad to take patches that
> have no obvious maintainers, or maintainers that have disappeared, but
> that doesn't seem to be the case here.
> 
> Also remember that we had the merge window, which is 2 weeks of us not
> being able to take any new code at all, even for fixes.
> 
> And finally, to make it easier for your code to be accepted, please take
> the time to review other's code for the subsystems you care about to
> make the maintainer's load easier.  If you do that, you will often find
> your patches getting faster response just by virtue of there being less
> work to do on the subsystem overall.  Why not do that right now to help
> out with other PWM patches?
> 
> thanks,
> 
> greg k-h
> 

That's right, I see the point. Will try to help as soon as I can find BW.

Thanks and sorry again,
Angelo


^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH 0/2] pwm: mtk-disp: Fix backlight configuration at boot
  2023-03-08 15:43         ` Greg Kroah-Hartman
  2023-03-08 16:04           ` AngeloGioacchino Del Regno
@ 2023-03-08 16:07           ` Uwe Kleine-König
  1 sibling, 0 replies; 17+ messages in thread
From: Uwe Kleine-König @ 2023-03-08 16:07 UTC (permalink / raw)
  To: AngeloGioacchino Del Regno
  Cc: Greg Kroah-Hartman, thierry.reding, matthias.bgg, weiqing.kong,
	jitao.shi, linux-pwm, linux-arm-kernel, linux-mediatek,
	linux-kernel, kernel

[-- Attachment #1: Type: text/plain, Size: 3787 bytes --]

On Wed, Mar 08, 2023 at 04:43:25PM +0100, Greg Kroah-Hartman wrote:
> On Wed, Mar 08, 2023 at 03:55:59PM +0100, AngeloGioacchino Del Regno wrote:
> > Il 08/03/23 15:50, Greg Kroah-Hartman ha scritto:
> > > On Wed, Mar 08, 2023 at 12:46:07PM +0100, AngeloGioacchino Del Regno wrote:
> > > > Il 23/02/23 15:16, AngeloGioacchino Del Regno ha scritto:
> > > > > Il 23/01/23 17:06, AngeloGioacchino Del Regno ha scritto:
> > > > > > Since the pwm-mtk-disp driver was fixed to get PWM_EN state from the
> > > > > > right register, an old two-wrongs-make-one-right issue emerged: as a
> > > > > > result, MT8192 Asurada Spherion got no backlight at boot unless a
> > > > > > suspend/resume cycle was performed.
> > > > > > Also, the backlight would sometimes not get updated with the requested
> > > > > > value, requiring the user to change it back and forth until it worked.
> > > > > > 
> > > > > > This series fixes both of the aforementioned issues found on MT8192.
> > > > > > 
> > > > > > AngeloGioacchino Del Regno (2):
> > > > > >     pwm: mtk-disp: Disable shadow registers before setting backlight
> > > > > >       values
> > > > > >     pwm: mtk-disp: Configure double buffering before reading in
> > > > > >       .get_state()
> > > > > > 
> > > > > >    drivers/pwm/pwm-mtk-disp.c | 34 +++++++++++++++++++++++-----------
> > > > > >    1 file changed, 23 insertions(+), 11 deletions(-)
> > > > > > 
> > > > > 
> > > > > Gentle ping for this one: this is fixing backlight issues on multiple MediaTek
> > > > > SoCs and was well tested.
> > > > > 
> > > > > Thanks,
> > > > > Angelo
> > > > 
> > > > Since this series was sent more than one month ago, and since this fixes broken
> > > > backlight on a number of Chromebooks with MT8183 and MT8192 SoCs, and seen the
> > > > urgency of getting these fixes in, I'm adding Greg to the loop.
> > > 
> > > $ ./scripts/get_maintainer.pl drivers/pwm/pwm-mtk-disp.c
> > > Thierry Reding <thierry.reding@gmail.com> (maintainer:PWM SUBSYSTEM)
> > > "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de> (reviewer:PWM SUBSYSTEM)
> > > Matthias Brugger <matthias.bgg@gmail.com> (maintainer:ARM/Mediatek SoC support)
> > > AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com> (reviewer:ARM/Mediatek SoC support)
> > > linux-pwm@vger.kernel.org (open list:PWM SUBSYSTEM)
> > > linux-kernel@vger.kernel.org (open list:ARM/Mediatek SoC support)
> > > linux-arm-kernel@lists.infradead.org (moderated list:ARM/Mediatek SoC support)
> > > linux-mediatek@lists.infradead.org (moderated list:ARM/Mediatek SoC support)
> > > 
> > > I don't see my name in there, did I become the PWM maintainer somehow?
> > > 
> > > What's wrong with Thierry taking this like normal?
> > > 
> > 
> > Nothing wrong with that. I felt like this series got ignored as I've never
> > received any reply from Thierry, even though it's a Fixes series that I deem
> > to be moderately urgent; that's why I added you to the loop.
> 
> Then ask Thierry and Uwe, what would you want to have happen if you were
> the maintainer of a subsystem?
> 
> > If that created unnecessary noise, I'm extremely sorry and won't happen again.
> 
> Not noise, just confusion on my part.  I'm glad to take patches that
> have no obvious maintainers, or maintainers that have disappeared, but
> that doesn't seem to be the case here.

I'm aware that there is a big backlog on PWM patches. I'm trying to
catch up but there is only so much time. Sorry this results in delays
for you (and others), I'm not happy with this situation either.

Best regards
Uwe

-- 
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | https://www.pengutronix.de/ |

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2023-03-08 16:08 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-23 16:06 [PATCH 0/2] pwm: mtk-disp: Fix backlight configuration at boot AngeloGioacchino Del Regno
2023-01-23 16:06 ` [PATCH 1/2] pwm: mtk-disp: Disable shadow registers before setting backlight values AngeloGioacchino Del Regno
2023-01-26 15:06   ` Nícolas F. R. A. Prado
2023-01-26 15:20     ` AngeloGioacchino Del Regno
2023-01-23 16:06 ` [PATCH 2/2] pwm: mtk-disp: Configure double buffering before reading in .get_state() AngeloGioacchino Del Regno
2023-01-26 15:19   ` Nícolas F. R. A. Prado
2023-01-26 15:24     ` AngeloGioacchino Del Regno
2023-01-26 16:09       ` Nícolas F. R. A. Prado
2023-01-26 16:16         ` AngeloGioacchino Del Regno
2023-01-26 15:31 ` [PATCH 0/2] pwm: mtk-disp: Fix backlight configuration at boot Adrian Ratiu
2023-02-23 14:16 ` AngeloGioacchino Del Regno
2023-03-08 11:46   ` AngeloGioacchino Del Regno
2023-03-08 14:50     ` Greg Kroah-Hartman
2023-03-08 14:55       ` AngeloGioacchino Del Regno
2023-03-08 15:43         ` Greg Kroah-Hartman
2023-03-08 16:04           ` AngeloGioacchino Del Regno
2023-03-08 16:07           ` Uwe Kleine-König

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).