Linux PWM subsystem development
 help / color / mirror / Atom feed
From: "Uwe Kleine-König" <ukleinek@kernel.org>
To: Keguang Zhang <keguang.zhang@gmail.com>
Cc: Binbin Zhou <zhoubinbin@loongson.cn>,
	linux-pwm@vger.kernel.org,  linux-kernel@vger.kernel.org
Subject: Re: [PATCH v3 2/2] pwm: loongson: Reload PWM configuration through counter reset
Date: Thu, 10 Sep 2026 15:54:37 +0200	[thread overview]
Message-ID: <aqK2R9HodI399ehb@monoceros> (raw)
In-Reply-To: <CAJhJPsULo0S5c6GKQvRqLtVx3nixZLuqRrh7hi5yJ7C5BuwLUQ@mail.gmail.com>

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

Hello,

On Thu, Sep 10, 2026 at 07:58:12PM +0800, Keguang Zhang wrote:
> On Mon, Sep 7, 2026 at 5:33 PM Uwe Kleine-König <ukleinek@kernel.org> wrote:
> > [...] I wonder if the fix is incomplete. If at driver bind time
> > LOONGSON_PWM_CTRL_REG_RST isn't set and there are still wrong values in
> > the shadowed LOW and PERIOD registers the first period will be wrong.
> >
> > This would need:
> >
> >         val = pwm_loongson_readl(ddata, LOONGSON_PWM_REG_CTRL);
> > +
> > +       /*
> > +        * Ensure that the values of LOW and PERIOD are sampled into
> > +        * the shadow register when the hardware starts running.
> > +        */
> > +       if (!(val & LOONGSON_PWM_CTRL_REG_RST))
> > +               pwm_loongson_writel(ddata, val | LOONGSON_PWM_CTRL_REG_RST, LOONGSON_PWM_REG_CTRL);
> > +
> >         val &= ~LOONGSON_PWM_CTRL_REG_RST;
> >         val |= LOONGSON_PWM_CTRL_REG_EN;
> >         pwm_loongson_writel(ddata, val, LOONGSON_PWM_REG_CTRL);
> >
> > I think.
> 
> You are right that this patch doesn't handle the initial hardware
> state when the driver binds.
> Would you prefer that I submit a follow-up patch to address this, or
> are you planning to fix it yourself?

I don't have the hardware, so if you do that and test it, that's very
appreciated.

Best regards
Uwe

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

      reply	other threads:[~2026-09-10 13:54 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-15 11:05 [PATCH v3 0/2] pwm: loongson: Fix PWM configuration handling Keguang Zhang via B4 Relay
2026-07-15 11:05 ` [PATCH v3 1/2] pwm: loongson: Fix low pulse buffer register handling Keguang Zhang via B4 Relay
2026-09-07  9:18   ` Uwe Kleine-König
2026-07-15 11:05 ` [PATCH v3 2/2] pwm: loongson: Reload PWM configuration through counter reset Keguang Zhang via B4 Relay
2026-09-07  9:33   ` Uwe Kleine-König
2026-09-10 11:58     ` Keguang Zhang
2026-09-10 13:54       ` Uwe Kleine-König [this message]

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=aqK2R9HodI399ehb@monoceros \
    --to=ukleinek@kernel.org \
    --cc=keguang.zhang@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pwm@vger.kernel.org \
    --cc=zhoubinbin@loongson.cn \
    /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