[PATCH] pwm: loongson: Fix LOONGSON_PWM_FREQ_DEFAULT

Xi Ruoyao posted 1 patch 1 month, 2 weeks ago
drivers/pwm/pwm-loongson.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[PATCH] pwm: loongson: Fix LOONGSON_PWM_FREQ_DEFAULT
Posted by Xi Ruoyao 1 month, 2 weeks ago
Per the 7A1000 and 7A2000 user manual, the clock frequency of their
PWM controllers is 50 MHz, not 50 kHz.

Fixes: 2b62c89448dd ("pwm: Add Loongson PWM controller support")
Signed-off-by: Xi Ruoyao <xry111@xry111.site>
---
 drivers/pwm/pwm-loongson.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/pwm/pwm-loongson.c b/drivers/pwm/pwm-loongson.c
index 1ba16168cbb4..31a57edecfd0 100644
--- a/drivers/pwm/pwm-loongson.c
+++ b/drivers/pwm/pwm-loongson.c
@@ -49,7 +49,7 @@
 #define LOONGSON_PWM_CTRL_REG_DZONE	BIT(10) /* Anti-dead Zone Enable Bit */
 
 /* default input clk frequency for the ACPI case */
-#define LOONGSON_PWM_FREQ_DEFAULT	50000 /* Hz */
+#define LOONGSON_PWM_FREQ_DEFAULT	50000000 /* Hz */
 
 struct pwm_loongson_ddata {
 	struct clk *clk;
-- 
2.50.1
Re: [PATCH] pwm: loongson: Fix LOONGSON_PWM_FREQ_DEFAULT
Posted by Uwe Kleine-König 1 month, 2 weeks ago
Hello,

[adding Juxin Gao to Cc:]

On Sat, Aug 16, 2025 at 06:49:05PM +0800, Xi Ruoyao wrote:
> Per the 7A1000 and 7A2000 user manual, the clock frequency of their
> PWM controllers is 50 MHz, not 50 kHz.
> 
> Fixes: 2b62c89448dd ("pwm: Add Loongson PWM controller support")

A quick glimpse into
https://loongson.github.io/LoongArch-Documentation/Loongson-7A1000-usermanual-EN.pdf
confirms this, so I tend to apply it. I'll wait a bit to give the people
involved in 2b62c89448dd a chance to comment.

Best regards
Uwe
Re: [PATCH] pwm: loongson: Fix LOONGSON_PWM_FREQ_DEFAULT
Posted by Binbin Zhou 1 month, 2 weeks ago
Hi Xi:

Thanks for your patch.

On Sun, Aug 17, 2025 at 6:59 PM Uwe Kleine-König <ukleinek@kernel.org> wrote:
>
> Hello,
>
> [adding Juxin Gao to Cc:]
>
> On Sat, Aug 16, 2025 at 06:49:05PM +0800, Xi Ruoyao wrote:
> > Per the 7A1000 and 7A2000 user manual, the clock frequency of their
> > PWM controllers is 50 MHz, not 50 kHz.
> >
> > Fixes: 2b62c89448dd ("pwm: Add Loongson PWM controller support")

I have confirmed once again that this was indeed my mistake. Thank you again!

Reviewed-by: Binbin Zhou <zhoubinbin@loongson.cn>
>
> A quick glimpse into
> https://loongson.github.io/LoongArch-Documentation/Loongson-7A1000-usermanual-EN.pdf
> confirms this, so I tend to apply it. I'll wait a bit to give the people
> involved in 2b62c89448dd a chance to comment.
>
> Best regards
> Uwe

-- 
Thanks.
Binbin
Re: [PATCH] pwm: loongson: Fix LOONGSON_PWM_FREQ_DEFAULT
Posted by Uwe Kleine-König 1 month, 2 weeks ago
Hi Binbin,

On Mon, Aug 18, 2025 at 05:38:34PM +0800, Binbin Zhou wrote:
> On Sun, Aug 17, 2025 at 6:59 PM Uwe Kleine-König <ukleinek@kernel.org> wrote:
> >
> > Hello,
> >
> > [adding Juxin Gao to Cc:]
> >
> > On Sat, Aug 16, 2025 at 06:49:05PM +0800, Xi Ruoyao wrote:
> > > Per the 7A1000 and 7A2000 user manual, the clock frequency of their
> > > PWM controllers is 50 MHz, not 50 kHz.
> > >
> > > Fixes: 2b62c89448dd ("pwm: Add Loongson PWM controller support")
> 
> I have confirmed once again that this was indeed my mistake. Thank you again!
> 
> Reviewed-by: Binbin Zhou <zhoubinbin@loongson.cn>

Thanks for your confirmation. 

My gut feeling is that this isn't very urgent and taking this as merge
window material for 6.18-rc1 is fine. I still applied it to
https://git.kernel.org/pub/scm/linux/kernel/git/ukleinek/linux.git pwm/fixes
and will send it along if something more urgent pops up. Please tell me
if you think I should bother Linus with it and get it into 6.17.

Best regards
Uwe
Re: [PATCH] pwm: loongson: Fix LOONGSON_PWM_FREQ_DEFAULT
Posted by Binbin Zhou 1 month, 2 weeks ago
Hi Uwe:

On Wed, Aug 20, 2025 at 2:36 PM Uwe Kleine-König <ukleinek@kernel.org> wrote:
>
> Hi Binbin,
>
> On Mon, Aug 18, 2025 at 05:38:34PM +0800, Binbin Zhou wrote:
> > On Sun, Aug 17, 2025 at 6:59 PM Uwe Kleine-König <ukleinek@kernel.org> wrote:
> > >
> > > Hello,
> > >
> > > [adding Juxin Gao to Cc:]
> > >
> > > On Sat, Aug 16, 2025 at 06:49:05PM +0800, Xi Ruoyao wrote:
> > > > Per the 7A1000 and 7A2000 user manual, the clock frequency of their
> > > > PWM controllers is 50 MHz, not 50 kHz.
> > > >
> > > > Fixes: 2b62c89448dd ("pwm: Add Loongson PWM controller support")
> >
> > I have confirmed once again that this was indeed my mistake. Thank you again!
> >
> > Reviewed-by: Binbin Zhou <zhoubinbin@loongson.cn>
>
> Thanks for your confirmation.
>
> My gut feeling is that this isn't very urgent and taking this as merge
> window material for 6.18-rc1 is fine. I still applied it to
> https://git.kernel.org/pub/scm/linux/kernel/git/ukleinek/linux.git pwm/fixes
> and will send it along if something more urgent pops up. Please tell me
> if you think I should bother Linus with it and get it into 6.17.

I don't think it's urgent either, so just take it as the merge window
material for 6.18-rc1.
>
> Best regards
> Uwe

-- 
Thanks.
Binbin
Re: [PATCH] pwm: loongson: Fix LOONGSON_PWM_FREQ_DEFAULT
Posted by Huacai Chen 1 month, 1 week ago
On Wed, Aug 20, 2025 at 3:34 PM Binbin Zhou <zhoubb.aaron@gmail.com> wrote:
>
> Hi Uwe:
>
> On Wed, Aug 20, 2025 at 2:36 PM Uwe Kleine-König <ukleinek@kernel.org> wrote:
> >
> > Hi Binbin,
> >
> > On Mon, Aug 18, 2025 at 05:38:34PM +0800, Binbin Zhou wrote:
> > > On Sun, Aug 17, 2025 at 6:59 PM Uwe Kleine-König <ukleinek@kernel.org> wrote:
> > > >
> > > > Hello,
> > > >
> > > > [adding Juxin Gao to Cc:]
> > > >
> > > > On Sat, Aug 16, 2025 at 06:49:05PM +0800, Xi Ruoyao wrote:
> > > > > Per the 7A1000 and 7A2000 user manual, the clock frequency of their
> > > > > PWM controllers is 50 MHz, not 50 kHz.
> > > > >
> > > > > Fixes: 2b62c89448dd ("pwm: Add Loongson PWM controller support")
> > >
> > > I have confirmed once again that this was indeed my mistake. Thank you again!
> > >
> > > Reviewed-by: Binbin Zhou <zhoubinbin@loongson.cn>
> >
> > Thanks for your confirmation.
> >
> > My gut feeling is that this isn't very urgent and taking this as merge
> > window material for 6.18-rc1 is fine. I still applied it to
> > https://git.kernel.org/pub/scm/linux/kernel/git/ukleinek/linux.git pwm/fixes
> > and will send it along if something more urgent pops up. Please tell me
> > if you think I should bother Linus with it and get it into 6.17.
>
> I don't think it's urgent either, so just take it as the merge window
> material for 6.18-rc1.
My opinion, if there are other pwm fix patches, this one can go into
6.17 together; otherwise just go into 6.18.

And if not too late, just add
Reviewed-by: Huacai Chen <chenhuacai@loongson.cn>

Huacai

> >
> > Best regards
> > Uwe
>
> --
> Thanks.
> Binbin
Re: [PATCH] pwm: loongson: Fix LOONGSON_PWM_FREQ_DEFAULT
Posted by Xi Ruoyao 1 month, 2 weeks ago
On Wed, 2025-08-20 at 08:36 +0200, Uwe Kleine-König wrote:
> Hi Binbin,
> 
> On Mon, Aug 18, 2025 at 05:38:34PM +0800, Binbin Zhou wrote:
> > On Sun, Aug 17, 2025 at 6:59 PM Uwe Kleine-König <ukleinek@kernel.org> wrote:
> > > 
> > > Hello,
> > > 
> > > [adding Juxin Gao to Cc:]
> > > 
> > > On Sat, Aug 16, 2025 at 06:49:05PM +0800, Xi Ruoyao wrote:
> > > > Per the 7A1000 and 7A2000 user manual, the clock frequency of their
> > > > PWM controllers is 50 MHz, not 50 kHz.
> > > > 
> > > > Fixes: 2b62c89448dd ("pwm: Add Loongson PWM controller support")
> > 
> > I have confirmed once again that this was indeed my mistake. Thank you again!
> > 
> > Reviewed-by: Binbin Zhou <zhoubinbin@loongson.cn>
> 
> Thanks for your confirmation. 
> 
> My gut feeling is that this isn't very urgent and taking this as merge
> window material for 6.18-rc1 is fine. I still applied it to
> https://git.kernel.org/pub/scm/linux/kernel/git/ukleinek/linux.git pwm/fixes
> and will send it along if something more urgent pops up. Please tell me
> if you think I should bother Linus with it and get it into 6.17.

Just FYI: the issue was detected when I debugged a screen flickering
with a downstream backlight control driver.  As this backlight control
driver is not upstream yet anyway I don't see an emergency myself.


-- 
Xi Ruoyao <xry111@xry111.site>