* [PATCH v3 0/2] clocks don't disable when pwm_mtk_disp suspend
@ 2019-12-17 3:04 Jitao Shi
2019-12-17 3:04 ` [PATCH v3 1/2] pwm: fix pwm clocks not poweroff when disable pwm Jitao Shi
` (2 more replies)
0 siblings, 3 replies; 5+ messages in thread
From: Jitao Shi @ 2019-12-17 3:04 UTC (permalink / raw)
To: Thierry Reding, Uwe Kleine-Koenig, Matthias Brugger, linux-pwm,
linux-arm-kernel, linux-kernel, CK Hu
Cc: Jitao Shi, sj.huang, linux-mediatek
Changes since to v2:
- Edit commit msg.
Changes since to v1:
- Edit commit msg.
- Remove the register trigger in probe.
- Rebase to v5.5-rc1.
Changes in patches:
- match pwm_mtk_disp clock when suspend/resume
- trigger pwm_mtk_disp reg working after config
Jitao Shi (2):
pwm: fix pwm clocks not poweroff when disable pwm
pwm: keep the trigger register after pwm setting.
drivers/pwm/pwm-mtk-disp.c | 63 ++++++++++++--------------------------
1 file changed, 19 insertions(+), 44 deletions(-)
--
2.21.0
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH v3 1/2] pwm: fix pwm clocks not poweroff when disable pwm
2019-12-17 3:04 [PATCH v3 0/2] clocks don't disable when pwm_mtk_disp suspend Jitao Shi
@ 2019-12-17 3:04 ` Jitao Shi
2019-12-17 3:04 ` [PATCH v3 2/2] pwm: keep the trigger register after pwm setting Jitao Shi
2019-12-17 3:26 ` [PATCH v3 0/2] clocks don't disable when pwm_mtk_disp suspend Chen-Yu Tsai
2 siblings, 0 replies; 5+ messages in thread
From: Jitao Shi @ 2019-12-17 3:04 UTC (permalink / raw)
To: Thierry Reding, Uwe Kleine-Koenig, Matthias Brugger, linux-pwm,
linux-arm-kernel, linux-kernel, CK Hu
Cc: Jitao Shi, sj.huang, linux-mediatek
The clocks of pwm are still in prepare state when disable pwm.
Because the clocks is prepared in mtk_disp_pwm_probe() and unprepared
in mtk_disp_pwm_remove().
clk_prepare and clk_unprepare aren't called by mtk_disp_pwm_enable()
and mtk_disp_pwm_disable().
Modified:
So clk_enable() is instread with clk_prepare_enable().
clk_disable() is instread with clk_disable_unprepare().
And remove the clk_prepare() from mtk_disp_pwm_probe(),
remove the clk_unprepare from mtk_disp_pwm_remove().
Signed-off-by: Jitao Shi <jitao.shi@mediatek.com>
---
drivers/pwm/pwm-mtk-disp.c | 43 +++++++++++---------------------------
1 file changed, 12 insertions(+), 31 deletions(-)
diff --git a/drivers/pwm/pwm-mtk-disp.c b/drivers/pwm/pwm-mtk-disp.c
index 83b8be0209b7..c7b14acc9316 100644
--- a/drivers/pwm/pwm-mtk-disp.c
+++ b/drivers/pwm/pwm-mtk-disp.c
@@ -98,13 +98,13 @@ static int mtk_disp_pwm_config(struct pwm_chip *chip, struct pwm_device *pwm,
high_width = div64_u64(rate * duty_ns, div);
value = period | (high_width << PWM_HIGH_WIDTH_SHIFT);
- err = clk_enable(mdp->clk_main);
+ err = clk_prepare_enable(mdp->clk_main);
if (err < 0)
return err;
- err = clk_enable(mdp->clk_mm);
+ err = clk_prepare_enable(mdp->clk_mm);
if (err < 0) {
- clk_disable(mdp->clk_main);
+ clk_disable_unprepare(mdp->clk_main);
return err;
}
@@ -124,8 +124,8 @@ static int mtk_disp_pwm_config(struct pwm_chip *chip, struct pwm_device *pwm,
0x0);
}
- clk_disable(mdp->clk_mm);
- clk_disable(mdp->clk_main);
+ clk_disable_unprepare(mdp->clk_mm);
+ clk_disable_unprepare(mdp->clk_main);
return 0;
}
@@ -135,13 +135,13 @@ static int mtk_disp_pwm_enable(struct pwm_chip *chip, struct pwm_device *pwm)
struct mtk_disp_pwm *mdp = to_mtk_disp_pwm(chip);
int err;
- err = clk_enable(mdp->clk_main);
+ err = clk_prepare_enable(mdp->clk_main);
if (err < 0)
return err;
- err = clk_enable(mdp->clk_mm);
+ err = clk_prepare_enable(mdp->clk_mm);
if (err < 0) {
- clk_disable(mdp->clk_main);
+ clk_disable_unprepare(mdp->clk_main);
return err;
}
@@ -158,8 +158,8 @@ static void mtk_disp_pwm_disable(struct pwm_chip *chip, struct pwm_device *pwm)
mtk_disp_pwm_update_bits(mdp, DISP_PWM_EN, mdp->data->enable_mask,
0x0);
- clk_disable(mdp->clk_mm);
- clk_disable(mdp->clk_main);
+ clk_disable_unprepare(mdp->clk_mm);
+ clk_disable_unprepare(mdp->clk_main);
}
static const struct pwm_ops mtk_disp_pwm_ops = {
@@ -194,14 +194,6 @@ static int mtk_disp_pwm_probe(struct platform_device *pdev)
if (IS_ERR(mdp->clk_mm))
return PTR_ERR(mdp->clk_mm);
- ret = clk_prepare(mdp->clk_main);
- if (ret < 0)
- return ret;
-
- ret = clk_prepare(mdp->clk_mm);
- if (ret < 0)
- goto disable_clk_main;
-
mdp->chip.dev = &pdev->dev;
mdp->chip.ops = &mtk_disp_pwm_ops;
mdp->chip.base = -1;
@@ -210,7 +202,7 @@ static int mtk_disp_pwm_probe(struct platform_device *pdev)
ret = pwmchip_add(&mdp->chip);
if (ret < 0) {
dev_err(&pdev->dev, "pwmchip_add() failed: %d\n", ret);
- goto disable_clk_mm;
+ return ret;
}
platform_set_drvdata(pdev, mdp);
@@ -229,24 +221,13 @@ static int mtk_disp_pwm_probe(struct platform_device *pdev)
}
return 0;
-
-disable_clk_mm:
- clk_unprepare(mdp->clk_mm);
-disable_clk_main:
- clk_unprepare(mdp->clk_main);
- return ret;
}
static int mtk_disp_pwm_remove(struct platform_device *pdev)
{
struct mtk_disp_pwm *mdp = platform_get_drvdata(pdev);
- int ret;
-
- ret = pwmchip_remove(&mdp->chip);
- clk_unprepare(mdp->clk_mm);
- clk_unprepare(mdp->clk_main);
- return ret;
+ return pwmchip_remove(&mdp->chip);
}
static const struct mtk_pwm_data mt2701_pwm_data = {
--
2.21.0
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH v3 2/2] pwm: keep the trigger register after pwm setting.
2019-12-17 3:04 [PATCH v3 0/2] clocks don't disable when pwm_mtk_disp suspend Jitao Shi
2019-12-17 3:04 ` [PATCH v3 1/2] pwm: fix pwm clocks not poweroff when disable pwm Jitao Shi
@ 2019-12-17 3:04 ` Jitao Shi
2019-12-17 3:26 ` [PATCH v3 0/2] clocks don't disable when pwm_mtk_disp suspend Chen-Yu Tsai
2 siblings, 0 replies; 5+ messages in thread
From: Jitao Shi @ 2019-12-17 3:04 UTC (permalink / raw)
To: Thierry Reding, Uwe Kleine-Koenig, Matthias Brugger, linux-pwm,
linux-arm-kernel, linux-kernel, CK Hu
Cc: Jitao Shi, sj.huang, linux-mediatek
Move the trigger after pwm setting to avoid the pwm wrong signal
output.
Remove the regist enable trigger setting in probe.
Move the trigger to end of mtk_disp_pwm_config().
Signed-off-by: Jitao Shi <jitao.shi@mediatek.com>
---
drivers/pwm/pwm-mtk-disp.c | 20 +++++++-------------
1 file changed, 7 insertions(+), 13 deletions(-)
diff --git a/drivers/pwm/pwm-mtk-disp.c b/drivers/pwm/pwm-mtk-disp.c
index c7b14acc9316..c1aae5b5693b 100644
--- a/drivers/pwm/pwm-mtk-disp.c
+++ b/drivers/pwm/pwm-mtk-disp.c
@@ -122,6 +122,13 @@ static int mtk_disp_pwm_config(struct pwm_chip *chip, struct pwm_device *pwm,
mtk_disp_pwm_update_bits(mdp, mdp->data->commit,
mdp->data->commit_mask,
0x0);
+ } else {
+ 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);
}
clk_disable_unprepare(mdp->clk_mm);
@@ -207,19 +214,6 @@ static int mtk_disp_pwm_probe(struct platform_device *pdev)
platform_set_drvdata(pdev, mdp);
- /*
- * For MT2701, disable double buffer before writing register
- * and select manual mode and use PWM_PERIOD/PWM_HIGH_WIDTH.
- */
- if (!mdp->data->has_commit) {
- 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);
- }
-
return 0;
}
--
2.21.0
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH v3 0/2] clocks don't disable when pwm_mtk_disp suspend
2019-12-17 3:04 [PATCH v3 0/2] clocks don't disable when pwm_mtk_disp suspend Jitao Shi
2019-12-17 3:04 ` [PATCH v3 1/2] pwm: fix pwm clocks not poweroff when disable pwm Jitao Shi
2019-12-17 3:04 ` [PATCH v3 2/2] pwm: keep the trigger register after pwm setting Jitao Shi
@ 2019-12-17 3:26 ` Chen-Yu Tsai
2019-12-17 3:56 ` Jitao Shi
2 siblings, 1 reply; 5+ messages in thread
From: Chen-Yu Tsai @ 2019-12-17 3:26 UTC (permalink / raw)
To: Jitao Shi
Cc: linux-pwm, linux-kernel, CK Hu, sj.huang, Thierry Reding,
moderated list:ARM/Mediatek SoC...,
Uwe Kleine-Koenig, Matthias Brugger, linux-arm-kernel
Hi,
On Tue, Dec 17, 2019 at 11:08 AM Jitao Shi <jitao.shi@mediatek.com> wrote:
>
> Changes since to v2:
> - Edit commit msg.
>
> Changes since to v1:
> - Edit commit msg.
> - Remove the register trigger in probe.
> - Rebase to v5.5-rc1.
>
> Changes in patches:
> - match pwm_mtk_disp clock when suspend/resume
> - trigger pwm_mtk_disp reg working after config
>
> Jitao Shi (2):
> pwm: fix pwm clocks not poweroff when disable pwm
> pwm: keep the trigger register after pwm setting.
Please add appropriate tags to your patches. These are not generic pwm
patches, but are specific to one driver.
Consider the prefix: "pwm: mtk-disp: " so others can filter out the
noise without looking at the content.
ChenYu
>
> drivers/pwm/pwm-mtk-disp.c | 63 ++++++++++++--------------------------
> 1 file changed, 19 insertions(+), 44 deletions(-)
>
> --
> 2.21.0
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v3 0/2] clocks don't disable when pwm_mtk_disp suspend
2019-12-17 3:26 ` [PATCH v3 0/2] clocks don't disable when pwm_mtk_disp suspend Chen-Yu Tsai
@ 2019-12-17 3:56 ` Jitao Shi
0 siblings, 0 replies; 5+ messages in thread
From: Jitao Shi @ 2019-12-17 3:56 UTC (permalink / raw)
To: Chen-Yu Tsai
Cc: linux-pwm, linux-kernel, CK Hu, sj.huang, Thierry Reding,
moderated list:ARM/Mediatek SoC...,
Uwe Kleine-Koenig, Matthias Brugger, linux-arm-kernel
On Tue, 2019-12-17 at 11:26 +0800, Chen-Yu Tsai wrote:
> Hi,
>
> On Tue, Dec 17, 2019 at 11:08 AM Jitao Shi <jitao.shi@mediatek.com> wrote:
> >
> > Changes since to v2:
> > - Edit commit msg.
> >
> > Changes since to v1:
> > - Edit commit msg.
> > - Remove the register trigger in probe.
> > - Rebase to v5.5-rc1.
> >
> > Changes in patches:
> > - match pwm_mtk_disp clock when suspend/resume
> > - trigger pwm_mtk_disp reg working after config
> >
> > Jitao Shi (2):
> > pwm: fix pwm clocks not poweroff when disable pwm
> > pwm: keep the trigger register after pwm setting.
>
> Please add appropriate tags to your patches. These are not generic pwm
> patches, but are specific to one driver.
>
> Consider the prefix: "pwm: mtk-disp: " so others can filter out the
> noise without looking at the content.
>
> ChenYu
OK. I'll fix this prefix.
Best Regards
Jitao
>
> >
> > drivers/pwm/pwm-mtk-disp.c | 63 ++++++++++++--------------------------
> > 1 file changed, 19 insertions(+), 44 deletions(-)
> >
> > --
> > 2.21.0
> > _______________________________________________
> > linux-arm-kernel mailing list
> > linux-arm-kernel@lists.infradead.org
> > http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2019-12-17 3:56 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-12-17 3:04 [PATCH v3 0/2] clocks don't disable when pwm_mtk_disp suspend Jitao Shi
2019-12-17 3:04 ` [PATCH v3 1/2] pwm: fix pwm clocks not poweroff when disable pwm Jitao Shi
2019-12-17 3:04 ` [PATCH v3 2/2] pwm: keep the trigger register after pwm setting Jitao Shi
2019-12-17 3:26 ` [PATCH v3 0/2] clocks don't disable when pwm_mtk_disp suspend Chen-Yu Tsai
2019-12-17 3:56 ` Jitao Shi
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).