[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20240910-pwm-v3-3-fbb047896618@nxp.com>
Date: Tue, 10 Sep 2024 15:07:20 -0400
From: Frank Li <Frank.Li@....com>
To: Marek Vasut <marex@...x.de>,
Uwe Kleine-König <ukleinek@...nel.org>,
Rob Herring <robh@...nel.org>, Krzysztof Kozlowski <krzk+dt@...nel.org>,
Conor Dooley <conor+dt@...nel.org>, Shawn Guo <shawnguo@...nel.org>,
Sascha Hauer <s.hauer@...gutronix.de>,
Pengutronix Kernel Team <kernel@...gutronix.de>,
Fabio Estevam <festevam@...il.com>, Philipp Zabel <p.zabel@...gutronix.de>
Cc: linux-pwm@...r.kernel.org, devicetree@...r.kernel.org,
imx@...ts.linux.dev, linux-arm-kernel@...ts.infradead.org,
linux-kernel@...r.kernel.org, pratikmanvar09@...il.com,
francesco@...cini.it, Frank Li <Frank.Li@....com>,
Liu Ying <victor.liu@....com>
Subject: [PATCH v3 3/3] pwm: imx27: Add optional 32k clock for pwm in
i.MX8QXP MIPI subsystem
From: Liu Ying <victor.liu@....com>
PWM in i.MX8QXP MIPI subsystem needs the clock '32k'. Use it if the DTS
provides that.
Signed-off-by: Liu Ying <victor.liu@....com>
Signed-off-by: Frank Li <Frank.Li@....com>
---
Change from v2 to v3
- use buck clk API
Change from v1 to v2
- remove if check for clk
- use dev_err_probe
- remove int val
---
drivers/pwm/pwm-imx27.c | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)
diff --git a/drivers/pwm/pwm-imx27.c b/drivers/pwm/pwm-imx27.c
index ce9208540f1b8..2a9fba6f9d0a8 100644
--- a/drivers/pwm/pwm-imx27.c
+++ b/drivers/pwm/pwm-imx27.c
@@ -81,10 +81,11 @@
#define MX3_PWMPR_MAX 0xfffe
static const char * const pwm_imx27_clks[] = {"ipg", "per"};
+static const char * const pwm_imx27_opt_clks[] = {"32k"};
#define PWM_IMX27_PER 1
struct pwm_imx27_chip {
- struct clk_bulk_data clks[ARRAY_SIZE(pwm_imx27_clks)];
+ struct clk_bulk_data clks[ARRAY_SIZE(pwm_imx27_clks) + ARRAY_SIZE(pwm_imx27_opt_clks)];
int clks_cnt;
void __iomem *mmio_base;
@@ -371,6 +372,16 @@ static int pwm_imx27_probe(struct platform_device *pdev)
return dev_err_probe(&pdev->dev, ret,
"getting clocks failed\n");
+ for (i = 0; i < ARRAY_SIZE(pwm_imx27_opt_clks); i++)
+ imx->clks[i + imx->clks_cnt].id = pwm_imx27_opt_clks[i];
+
+ ret = devm_clk_bulk_get_optional(&pdev->dev, ARRAY_SIZE(pwm_imx27_opt_clks),
+ imx->clks + imx->clks_cnt);
+ if (ret)
+ return dev_err_probe(&pdev->dev, ret, "get optional clocks failed\n");
+
+ imx->clks_cnt += ARRAY_SIZE(pwm_imx27_opt_clks);
+
chip->ops = &pwm_imx27_ops;
imx->mmio_base = devm_platform_ioremap_resource(pdev, 0);
--
2.34.1
Powered by blists - more mailing lists