From: Alexandre Mergnat <amergnat@baylibre.com>
To: AngeloGioacchino Del Regno
<angelogioacchino.delregno@collabora.com>,
thierry.reding@gmail.com
Cc: u.kleine-koenig@pengutronix.de, matthias.bgg@gmail.com,
weiqing.kong@mediatek.com, jitao.shi@mediatek.com,
linux-pwm@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
linux-mediatek@lists.infradead.org, linux-kernel@vger.kernel.org,
kernel@collabora.com, wenst@chromium.org,
"Nícolas F . R . A . Prado" <nfraprado@collabora.com>
Subject: Re: [PATCH RESEND 1/2] pwm: mtk-disp: Disable shadow registers before setting backlight values
Date: Wed, 5 Apr 2023 11:26:30 +0200 [thread overview]
Message-ID: <b9c35799-7abf-116a-d0f4-531d1d3cd7b2@baylibre.com> (raw)
In-Reply-To: <20230403133054.319070-2-angelogioacchino.delregno@collabora.com>
On 03/04/2023 15:30, 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>
> Reviewed-by: Nícolas F. R. A. Prado <nfraprado@collabora.com>
> Tested-by: Nícolas F. R. A. Prado <nfraprado@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,
Hi,
I've made a non-regression test for the mt8365-evk (i350-evk) board.
It's fine for me.
Reviewed-by: Alexandre Mergnat <amergnat@baylibre.com>
Tested-by: Alexandre Mergnat <amergnat@baylibre.com>
Regards,
Alex
next prev parent reply other threads:[~2023-04-05 9:26 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-04-03 13:30 [PATCH RESEND 0/2] pwm: mtk-disp: Fix backlight configuration at boot AngeloGioacchino Del Regno
2023-04-03 13:30 ` [PATCH RESEND 1/2] pwm: mtk-disp: Disable shadow registers before setting backlight values AngeloGioacchino Del Regno
2023-04-05 9:26 ` Alexandre Mergnat [this message]
2023-04-03 13:30 ` [PATCH RESEND 2/2] pwm: mtk-disp: Configure double buffering before reading in .get_state() AngeloGioacchino Del Regno
2023-04-05 9:28 ` Alexandre Mergnat
2023-04-06 14:24 ` [PATCH RESEND 0/2] pwm: mtk-disp: Fix backlight configuration at boot Thierry Reding
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=b9c35799-7abf-116a-d0f4-531d1d3cd7b2@baylibre.com \
--to=amergnat@baylibre.com \
--cc=angelogioacchino.delregno@collabora.com \
--cc=jitao.shi@mediatek.com \
--cc=kernel@collabora.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mediatek@lists.infradead.org \
--cc=linux-pwm@vger.kernel.org \
--cc=matthias.bgg@gmail.com \
--cc=nfraprado@collabora.com \
--cc=thierry.reding@gmail.com \
--cc=u.kleine-koenig@pengutronix.de \
--cc=weiqing.kong@mediatek.com \
--cc=wenst@chromium.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox