From: Yixun Lan <dlan@kernel.org>
To: "Uwe Kleine-König" <ukleinek@kernel.org>
Cc: "Rob Herring" <robh@kernel.org>,
"Krzysztof Kozlowski" <krzk+dt@kernel.org>,
"Conor Dooley" <conor+dt@kernel.org>,
"Duje Mihanović" <duje@dujemihanovic.xyz>,
linux-pwm@vger.kernel.org, devicetree@vger.kernel.org,
linux-kernel@vger.kernel.org, linux-riscv@lists.infradead.org,
spacemit@lists.linux.dev
Subject: Re: [PATCH 2/2] pwm: pxa: Add optional bus clock
Date: Tue, 14 Apr 2026 06:04:53 +0000 [thread overview]
Message-ID: <20260414060453-GKA203300@kernel.org> (raw)
In-Reply-To: <adyq-Uckwwe9uACA@monoceros>
Hi Uwe,
On 10:38 Mon 13 Apr , Uwe Kleine-König wrote:
> Hello,
>
> On Thu, Apr 09, 2026 at 12:45:12AM +0000, Yixun Lan wrote:
> > Add one secondary optional bus clock for the PWM PXA driver, also keep it
> > compatible with old single clock.
> >
> > The SpacemiT K3 SoC require one bus clock for PWM controller, acquire
>
> s/one/a/ ?
>
Ok
> > and enable it during probe phase.
> >
> > Signed-off-by: Yixun Lan <dlan@kernel.org>
> > ---
> > drivers/pwm/pwm-pxa.c | 8 +++++++-
> > 1 file changed, 7 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/pwm/pwm-pxa.c b/drivers/pwm/pwm-pxa.c
> > index 0f5bdb0e395e..2ace31405c2d 100644
> > --- a/drivers/pwm/pwm-pxa.c
> > +++ b/drivers/pwm/pwm-pxa.c
> > @@ -53,6 +53,7 @@ struct pxa_pwm_chip {
> > struct device *dev;
> >
> > struct clk *clk;
> > + struct clk *bus_clk;
> > void __iomem *mmio_base;
> > };
> >
> > @@ -177,7 +178,12 @@ static int pwm_probe(struct platform_device *pdev)
> > return PTR_ERR(chip);
> > pc = to_pxa_pwm_chip(chip);
> >
> > - pc->clk = devm_clk_get(dev, NULL);
> > + pc->bus_clk = devm_clk_get_optional_enabled(dev, "bus");
> > + if (IS_ERR(pc->bus_clk))
> > + return dev_err_probe(dev, PTR_ERR(pc->bus_clk), "Failed to get bus clock\n");
> > +
> > + /* Get named func clk if bus clock is valid */
> > + pc->clk = devm_clk_get(dev, pc->bus_clk ? "func" : NULL);
>
> A local variable for bus_clk would be sufficient.
>
Ok, will do
> I'm not sure, but I think passing "func" unconditionally to
> devm_clk_get() would also work fine.
Passing "func" unconditionally, will break old compatibles(not k3-pwm), as only
one clocks property is provided, but no clock-names property
--
Yixun Lan (dlan)
WARNING: multiple messages have this Message-ID (diff)
From: Yixun Lan <dlan@kernel.org>
To: "Uwe Kleine-König" <ukleinek@kernel.org>
Cc: "Rob Herring" <robh@kernel.org>,
"Krzysztof Kozlowski" <krzk+dt@kernel.org>,
"Conor Dooley" <conor+dt@kernel.org>,
"Duje Mihanović" <duje@dujemihanovic.xyz>,
linux-pwm@vger.kernel.org, devicetree@vger.kernel.org,
linux-kernel@vger.kernel.org, linux-riscv@lists.infradead.org,
spacemit@lists.linux.dev
Subject: Re: [PATCH 2/2] pwm: pxa: Add optional bus clock
Date: Tue, 14 Apr 2026 06:04:53 +0000 [thread overview]
Message-ID: <20260414060453-GKA203300@kernel.org> (raw)
In-Reply-To: <adyq-Uckwwe9uACA@monoceros>
Hi Uwe,
On 10:38 Mon 13 Apr , Uwe Kleine-König wrote:
> Hello,
>
> On Thu, Apr 09, 2026 at 12:45:12AM +0000, Yixun Lan wrote:
> > Add one secondary optional bus clock for the PWM PXA driver, also keep it
> > compatible with old single clock.
> >
> > The SpacemiT K3 SoC require one bus clock for PWM controller, acquire
>
> s/one/a/ ?
>
Ok
> > and enable it during probe phase.
> >
> > Signed-off-by: Yixun Lan <dlan@kernel.org>
> > ---
> > drivers/pwm/pwm-pxa.c | 8 +++++++-
> > 1 file changed, 7 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/pwm/pwm-pxa.c b/drivers/pwm/pwm-pxa.c
> > index 0f5bdb0e395e..2ace31405c2d 100644
> > --- a/drivers/pwm/pwm-pxa.c
> > +++ b/drivers/pwm/pwm-pxa.c
> > @@ -53,6 +53,7 @@ struct pxa_pwm_chip {
> > struct device *dev;
> >
> > struct clk *clk;
> > + struct clk *bus_clk;
> > void __iomem *mmio_base;
> > };
> >
> > @@ -177,7 +178,12 @@ static int pwm_probe(struct platform_device *pdev)
> > return PTR_ERR(chip);
> > pc = to_pxa_pwm_chip(chip);
> >
> > - pc->clk = devm_clk_get(dev, NULL);
> > + pc->bus_clk = devm_clk_get_optional_enabled(dev, "bus");
> > + if (IS_ERR(pc->bus_clk))
> > + return dev_err_probe(dev, PTR_ERR(pc->bus_clk), "Failed to get bus clock\n");
> > +
> > + /* Get named func clk if bus clock is valid */
> > + pc->clk = devm_clk_get(dev, pc->bus_clk ? "func" : NULL);
>
> A local variable for bus_clk would be sufficient.
>
Ok, will do
> I'm not sure, but I think passing "func" unconditionally to
> devm_clk_get() would also work fine.
Passing "func" unconditionally, will break old compatibles(not k3-pwm), as only
one clocks property is provided, but no clock-names property
--
Yixun Lan (dlan)
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv
next prev parent reply other threads:[~2026-04-14 6:04 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-09 0:45 [PATCH 0/2] pwm: spacemit: Add Support for K3 SoC Yixun Lan
2026-04-09 0:45 ` Yixun Lan
2026-04-09 0:45 ` [PATCH 1/2] dt-bindings: pwm: marvell,pxa-pwm: Add SpacemiT K3 PWM support Yixun Lan
2026-04-09 0:45 ` Yixun Lan
2026-04-09 15:41 ` Conor Dooley
2026-04-09 15:41 ` Conor Dooley
2026-04-09 23:43 ` Yixun Lan
2026-04-09 23:43 ` Yixun Lan
2026-04-09 0:45 ` [PATCH 2/2] pwm: pxa: Add optional bus clock Yixun Lan
2026-04-09 0:45 ` Yixun Lan
2026-04-13 8:38 ` Uwe Kleine-König
2026-04-13 8:38 ` Uwe Kleine-König
2026-04-14 6:04 ` Yixun Lan [this message]
2026-04-14 6:04 ` Yixun Lan
2026-04-14 8:51 ` Uwe Kleine-König
2026-04-14 8:51 ` Uwe Kleine-König
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=20260414060453-GKA203300@kernel.org \
--to=dlan@kernel.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=duje@dujemihanovic.xyz \
--cc=krzk+dt@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pwm@vger.kernel.org \
--cc=linux-riscv@lists.infradead.org \
--cc=robh@kernel.org \
--cc=spacemit@lists.linux.dev \
--cc=ukleinek@kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.