mirror of
https://github.com/torvalds/linux.git
synced 2026-07-27 17:47:41 +02:00
pwm: pxa: Add optional bus clock
Add one secondary optional bus clock for the PWM PXA driver, also keep it compatible with old single clock. The SpacemiT K3 SoC require a bus clock for PWM controller, acquire and enable it during probe phase. Signed-off-by: Yixun Lan <dlan@kernel.org> Link: https://patch.msgid.link/20260428-03-k3-pwm-drv-v2-2-a532bbe45556@kernel.org Signed-off-by: Uwe Kleine-König <ukleinek@kernel.org>
This commit is contained in:
parent
e7abbff5e8
commit
74bca0f2d3
|
|
@ -161,6 +161,7 @@ static int pwm_probe(struct platform_device *pdev)
|
|||
const struct platform_device_id *id = platform_get_device_id(pdev);
|
||||
struct pwm_chip *chip;
|
||||
struct pxa_pwm_chip *pc;
|
||||
struct clk *bus_clk;
|
||||
struct device *dev = &pdev->dev;
|
||||
struct reset_control *rst;
|
||||
int ret = 0;
|
||||
|
|
@ -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);
|
||||
bus_clk = devm_clk_get_optional_enabled(dev, "bus");
|
||||
if (IS_ERR(bus_clk))
|
||||
return dev_err_probe(dev, PTR_ERR(bus_clk), "Failed to get bus clock\n");
|
||||
|
||||
/* Get named func clk if bus clock is valid */
|
||||
pc->clk = devm_clk_get(dev, bus_clk ? "func" : NULL);
|
||||
if (IS_ERR(pc->clk))
|
||||
return dev_err_probe(dev, PTR_ERR(pc->clk), "Failed to get clock\n");
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user