[PATCH 2/2] pwm: pxa: Add optional bus clock

Yixun Lan
2026-04-09T00:45:31Z

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
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);
if (IS_ERR(pc->clk))
return dev_err_probe(dev, PTR_ERR(pc->clk), "Failed to get clock\n");

--
2.53.0