mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 0/3] pwm: qcom: add Shikra PWM controller
@ 2026-11-16  6:59 Taniya Das
  2026-11-16  6:59 ` [PATCH 1/3] dt-bindings: " Taniya Das
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Taniya Das @ 2026-11-16  6:59 UTC (permalink / raw)
  To: Uwe Kleine-König, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, Taniya Das, Bjorn Andersson, Konrad Dybcio,
	Abel Vesa
  Cc: Ajit Pandey, Imran Shaik, Jagadeesh Kona, linux-arm-msm,
	linux-pwm, devicetree, linux-kernel

Add support for the Pulse Width Modulation (PWM) controller found on
Qualcomm Shikra SoCs.

The controller exposes a shared output-enable register and up to ten
independently addressed PWM frame blocks, each modelled from its own
device-tree child node. The driver retains the shared AHB and PWM core
clocks while any output is active.

The series contains the device-tree binding, the driver, and the Shikra
SoC DTSI node describing the controller and its ten PWM frames.

This series depends on the GCC PWM XO512 source clock, which provides the
GCC_PWM0_XO512_CLK_SRC divider feeding the PWM core clock referenced by
the controller node:

https://lore.kernel.org/r/20261116-pwm_clocks_shikra-v1-0-55fc11501821@oss.qualcomm.com

---
Taniya Das (3):
      dt-bindings: pwm: qcom: add Shikra PWM controller
      pwm: qcom: add Shikra PWM controller support
      arm64: dts: qcom: add Shikra PWM controller

 .../devicetree/bindings/pwm/qcom,shikra-pwm.yaml   | 127 ++++
 arch/arm64/boot/dts/qcom/shikra.dtsi               |  63 ++
 drivers/pwm/Kconfig                                |  13 +
 drivers/pwm/Makefile                               |   1 +
 drivers/pwm/pwm-qcom.c                             | 685 +++++++++++++++++++++
 5 files changed, 889 insertions(+)
---
base-commit: 84abb955b1015477aa11a96e2f3ac1b938b77f48
change-id: 20261116-pwm_qcom_shikra-a63526bfad29
prerequisite-message-id: <20261116-pwm_clocks_shikra-v1-0-55fc11501821@oss.qualcomm.com>
prerequisite-patch-id: 25c90a2ea712aecae7404104dcc83e1c79227b6c
prerequisite-patch-id: e4b3500eec0cf6bc98edc43780b2828c28445b5c

Best regards,
-- 
Taniya Das <taniya.das@oss.qualcomm.com>


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 1/3] dt-bindings: pwm: qcom: add Shikra PWM controller
  2026-11-16  6:59 [PATCH 0/3] pwm: qcom: add Shikra PWM controller Taniya Das
@ 2026-11-16  6:59 ` Taniya Das
  2026-11-16 10:05   ` Krzysztof Kozlowski
  2026-11-16  6:59 ` [PATCH 2/3] pwm: qcom: add Shikra PWM controller support Taniya Das
  2026-11-16  6:59 ` [PATCH 3/3] arm64: dts: qcom: add Shikra PWM controller Taniya Das
  2 siblings, 1 reply; 6+ messages in thread
From: Taniya Das @ 2026-11-16  6:59 UTC (permalink / raw)
  To: Uwe Kleine-König, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, Taniya Das, Bjorn Andersson, Konrad Dybcio,
	Abel Vesa
  Cc: Ajit Pandey, Imran Shaik, Jagadeesh Kona, linux-arm-msm,
	linux-pwm, devicetree, linux-kernel

Document the Pulse Width Modulation (PWM) controller on Qualcomm Shikra
SoCs. The controller has a shared enable register, ten independently
addressed frame blocks, and shared AHB and PWM core clocks.

Describe the frame child-node address mapping and the consumer PWM
specifier needed to select each hardware frame.

Signed-off-by: Taniya Das <taniya.das@oss.qualcomm.com>
---
 .../devicetree/bindings/pwm/qcom,shikra-pwm.yaml   | 127 +++++++++++++++++++++
 1 file changed, 127 insertions(+)

diff --git a/Documentation/devicetree/bindings/pwm/qcom,shikra-pwm.yaml b/Documentation/devicetree/bindings/pwm/qcom,shikra-pwm.yaml
new file mode 100644
index 0000000000000000000000000000000000000000..d7f2bdab68f68b822fc93ecabd628ab53d408249
--- /dev/null
+++ b/Documentation/devicetree/bindings/pwm/qcom,shikra-pwm.yaml
@@ -0,0 +1,127 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/pwm/qcom,shikra-pwm.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Qualcomm Shikra PWM controller
+
+maintainers:
+  - Taniya Das <taniya.das@oss.qualcomm.com>
+
+description: |
+  The Qualcomm PWM (Pulse Width Modulation) block on Shikra contains
+  up to 10 independent PWM frame channels. Each frame is a child node of
+  the PWM controller node and owns its own register range. All frames
+  share a single PWM core clock owned by the parent node. Child frame reg
+  properties use the parent SoC address space through an empty identity
+  ranges mapping.
+
+  The PWM source input clock, pwm_core, is given by:
+
+    F_PWM_CLK = 19.2 MHz / N
+
+  where N is an integer from 1 through 512. The output frequency range
+  for a given PWM source clock is:
+
+    f_out(max) = F_PWM_CLK / 2
+    f_out(min) = F_PWM_CLK / 65536
+
+allOf:
+  - $ref: pwm.yaml#
+
+properties:
+  compatible:
+    const: qcom,shikra-pwm
+
+  reg:
+    maxItems: 1
+
+  clocks:
+    items:
+      - description: AHB bus clock for the PWM block.
+      - description: Gate clock shared by every frame (pwm_core).
+
+  clock-names:
+    items:
+      - const: ahb
+      - const: core
+
+  "#pwm-cells":
+    const: 3
+
+  "#address-cells":
+    const: 2
+
+  "#size-cells":
+    const: 2
+
+  ranges: true
+
+patternProperties:
+  "^pwm@[0-9a-f]+$":
+    type: object
+    description: Per-frame PWM channel sub-node.
+
+    properties:
+      reg:
+        maxItems: 1
+        description: This frame's own absolute register range.
+
+      qcom,frame-index:
+        $ref: /schemas/types.yaml#/definitions/uint32
+        description:
+          Hardware frame index within the PWM block. It is the PWM index
+          used in the first cell of a consumer PWM specifier and selects
+          the corresponding enable bit in PWM_TOPCTL0.
+        maximum: 9
+
+    required:
+      - reg
+      - qcom,frame-index
+
+    additionalProperties: false
+
+required:
+  - compatible
+  - reg
+  - clocks
+  - clock-names
+  - "#pwm-cells"
+  - "#address-cells"
+  - "#size-cells"
+  - ranges
+
+unevaluatedProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/clock/qcom,shikra-gcc.h>
+
+    / {
+        #address-cells = <2>;
+        #size-cells = <2>;
+
+        pwm: pwm@4700000 {
+            compatible = "qcom,shikra-pwm";
+            reg = <0x0 0x04700000 0x0 0x10>;
+            clocks = <&gcc GCC_PDM_AHB_CLK>, <&gcc GCC_PWM0_XO512_CLK>;
+            clock-names = "ahb", "core";
+            assigned-clocks = <&gcc GCC_PWM0_XO512_CLK>;
+            assigned-clock-rates = <9600000>;
+            #pwm-cells = <3>;
+            #address-cells = <2>;
+            #size-cells = <2>;
+            ranges;
+
+            pwm@4701000 {
+                reg = <0x0 0x04701000 0x0 0x1c>;
+                qcom,frame-index = <0>;
+            };
+
+            pwm@4702000 {
+                reg = <0x0 0x04702000 0x0 0x1c>;
+                qcom,frame-index = <1>;
+            };
+        };
+    };

-- 
2.34.1


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 2/3] pwm: qcom: add Shikra PWM controller support
  2026-11-16  6:59 [PATCH 0/3] pwm: qcom: add Shikra PWM controller Taniya Das
  2026-11-16  6:59 ` [PATCH 1/3] dt-bindings: " Taniya Das
@ 2026-11-16  6:59 ` Taniya Das
  2026-11-17 14:44   ` Uwe Kleine-König
  2026-11-16  6:59 ` [PATCH 3/3] arm64: dts: qcom: add Shikra PWM controller Taniya Das
  2 siblings, 1 reply; 6+ messages in thread
From: Taniya Das @ 2026-11-16  6:59 UTC (permalink / raw)
  To: Uwe Kleine-König, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, Taniya Das, Bjorn Andersson, Konrad Dybcio,
	Abel Vesa
  Cc: Ajit Pandey, Imran Shaik, Jagadeesh Kona, linux-arm-msm,
	linux-pwm, devicetree, linux-kernel

Add support for the Pulse Width Modulation (PWM) controller on Qualcomm
Shikra SoCs.

The controller has a shared output-enable register and up to ten frame
blocks with independent configuration registers. Model each available
frame from its DT child node, and retain the shared AHB and PWM core
clocks while an output is active.

Signed-off-by: Taniya Das <taniya.das@oss.qualcomm.com>
---
 drivers/pwm/Kconfig    |  13 +
 drivers/pwm/Makefile   |   1 +
 drivers/pwm/pwm-qcom.c | 685 +++++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 699 insertions(+)

diff --git a/drivers/pwm/Kconfig b/drivers/pwm/Kconfig
index aacd800687e7c98b2272ddb01447356349425032..ae229e922521e97d88610887da5ccb0f7433fbd3 100644
--- a/drivers/pwm/Kconfig
+++ b/drivers/pwm/Kconfig
@@ -566,6 +566,19 @@ config PWM_PXA
 	  To compile this driver as a module, choose M here: the module
 	  will be called pwm-pxa.
 
+config PWM_QCOM
+	tristate "Qualcomm PWM support"
+	depends on ARCH_QCOM || COMPILE_TEST
+	depends on COMMON_CLK && HAS_IOMEM && OF
+	select REGMAP_MMIO
+	help
+	  PWM framework driver for the PWM block found on Qualcomm SoCs,
+	  which supports multiple PWM frames. Each frame can be
+	  configured independently of the others.
+
+	  To compile this driver as a module, choose M here: the module will
+	  be called pwm-qcom.
+
 config PWM_RASPBERRYPI_POE
 	tristate "Raspberry Pi Firmware PoE Hat PWM support"
 	# Make sure not 'y' when RASPBERRYPI_FIRMWARE is 'm'. This can only
diff --git a/drivers/pwm/Makefile b/drivers/pwm/Makefile
index 7e2c34cc4f6a955b04edcdd08721264d0d477f2e..a7e0095b573448cb643b19f4da2e6f02ada4bc39 100644
--- a/drivers/pwm/Makefile
+++ b/drivers/pwm/Makefile
@@ -50,6 +50,7 @@ obj-$(CONFIG_PWM_NTXEC)		+= pwm-ntxec.o
 obj-$(CONFIG_PWM_OMAP_DMTIMER)	+= pwm-omap-dmtimer.o
 obj-$(CONFIG_PWM_PCA9685)	+= pwm-pca9685.o
 obj-$(CONFIG_PWM_PXA)		+= pwm-pxa.o
+obj-$(CONFIG_PWM_QCOM)		+= pwm-qcom.o
 obj-$(CONFIG_PWM_RASPBERRYPI_POE)	+= pwm-raspberrypi-poe.o
 obj-$(CONFIG_PWM_RENESAS_RCAR)	+= pwm-rcar.o
 obj-$(CONFIG_PWM_RENESAS_RZG2L_GPT)	+= pwm-rzg2l-gpt.o
diff --git a/drivers/pwm/pwm-qcom.c b/drivers/pwm/pwm-qcom.c
new file mode 100644
index 0000000000000000000000000000000000000000..9b15cdcaa5c76a3f2a9d7871b4e12d52cf89610a
--- /dev/null
+++ b/drivers/pwm/pwm-qcom.c
@@ -0,0 +1,685 @@
+// SPDX-License-Identifier: GPL-2.0-only
+/*
+ * Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.
+ *
+ */
+
+#include <linux/bitops.h>
+#include <linux/clk.h>
+#include <linux/math64.h>
+#include <linux/mod_devicetable.h>
+#include <linux/module.h>
+#include <linux/mutex.h>
+#include <linux/of.h>
+#include <linux/of_address.h>
+#include <linux/platform_device.h>
+#include <linux/pwm.h>
+#include <linux/regmap.h>
+
+/* Offsets */
+#define PWM_TOPCTL0			0x0
+
+/* offsets per frame */
+#define PWM_CTL0			0x0
+#define PWM_CTL1			0x4
+#define PWM_CTL2			0x8
+#define PWM_CYC_CFG			0xc
+#define PWM_UPDATE			0x10
+#define PWM_RESET			0x18
+
+#define PWM_FRAME_POLARITY_BIT		BIT(0)
+#define PWM_FRAME_ROLLOVER_CNT_BIT	BIT(4)
+#define PWM_FRAME_RESET_BIT		BIT(0)
+
+/* All per-frame 16-bit value fields (CYC_CFG, CTL1, CTL2). */
+#define PWM_FRAME_VAL_MASK		GENMASK(15, 0)
+
+/*
+ * struct qcom_pwm_priv_data - per-compatible hardware description
+ * @max_channels: number of frames supported by this hardware variant.
+ * @pwm_reset_support: whether PWM_RESET is implemented, allowing the period
+ *	to be changed after it has already been set once.
+ * @pwm_cnt_rollover: whether PWM_FRAME_ROLLOVER_CNT_BIT is implemented,
+ *	needed so period changes don't get stuck waiting on the counter.
+ */
+struct qcom_pwm_priv_data {
+	unsigned int max_channels;
+	bool pwm_reset_support;
+	bool pwm_cnt_rollover;
+};
+
+/*
+ * struct qcom_pwm_frames - Information regarding per PWM frame
+ * @frame_id: Id number associated with each frame.
+ * @polarity: Current polarity of the particular frame.
+ * @regmap: regmap covering this frame's own register block. Each frame now
+ *	owns its own "reg" range in DT, so registers are accessed at their
+ *	plain offsets within this regmap instead of as an offset into a
+ *	shared parent regmap.
+ * @current_period_ns: Current period of the particular frame.
+ * @current_duty_ns: Current duty cycle of the particular frame.
+ * @current_freq: Current frequency of frame.
+ * @freq_set: This bool flag is responsible for setting period once per frame.
+ * @frame_lock: mutex lock per frame.
+ * @cnt_rollover_en: This bool flag is used to set rollover bit per frame.
+ */
+struct qcom_pwm_frames {
+	u32	frame_id;
+	u32	polarity;
+	struct regmap *regmap;
+	u64	current_period_ns;
+	u64	current_duty_ns;
+	unsigned long current_freq;
+	bool	is_enabled;
+	bool	freq_set;
+	struct mutex frame_lock; /* PWM per frame lock */
+	bool cnt_rollover_en;
+};
+
+/*
+ * struct qcom_pwm_chip - Information regarding per PWM block
+ * @regmap: regmap of the shared PWM_TOPCTL0 enable register.
+ * @frames: structure for all frames of each PWM block.
+ * @priv_data: per-compatible hardware description.
+ * @ahb: AHB clock providing access to the PWM block.
+ * @core: shared clock providing the PWM frame rate.
+ * @lock: mutex lock per chip (enable/disable path).
+ * @num_frames: number of frames in each PWM block.
+ */
+struct qcom_pwm_chip {
+	struct regmap		*regmap;
+	struct qcom_pwm_frames	*frames;
+	const struct qcom_pwm_priv_data	*priv_data;
+	struct clk		*ahb;
+	struct clk		*core;
+	/* This lock to be used for Enable/Disable as it is per PWM channel */
+	struct mutex		lock;
+	u32			num_frames;
+};
+
+static inline struct qcom_pwm_chip *to_qcom_pwm_chip(struct pwm_chip *chip)
+{
+	return pwmchip_get_drvdata(chip);
+}
+
+static int qcom_pwm_clks_enable(struct qcom_pwm_chip *chip)
+{
+	int ret;
+
+	ret = clk_prepare_enable(chip->ahb);
+	if (ret)
+		return ret;
+
+	ret = clk_prepare_enable(chip->core);
+	if (ret)
+		clk_disable_unprepare(chip->ahb);
+
+	return ret;
+}
+
+static void qcom_pwm_clks_disable(struct qcom_pwm_chip *chip)
+{
+	clk_disable_unprepare(chip->core);
+	clk_disable_unprepare(chip->ahb);
+}
+
+static int qcom_pwm_calc_frequency(struct qcom_pwm_chip *chip,
+				   u64 period_ns, unsigned long rate, u32 hw_idx)
+{
+	struct regmap *frame_regmap = chip->frames[hw_idx].regmap;
+	u64 cycles;
+	int ret;
+
+	/*
+	 * PWM client can set the period only once if the HW version does
+	 * not support reset functionality.
+	 */
+	if (chip->frames[hw_idx].freq_set && !chip->priv_data->pwm_reset_support)
+		return 0;
+
+	/*
+	 * Number of core-clock cycles in one PWM period. Round down so the
+	 * implemented period never exceeds the requested one, as the PWM API
+	 * requires. PWM_CYC_CFG holds (cycles - 1) in its low 16 bits, so
+	 * cycles is bounded to [2, 65536], i.e. an output frequency from
+	 * rate / 2 down to rate / 65536.
+	 */
+	cycles = mul_u64_u64_div_u64(period_ns, rate, NSEC_PER_SEC);
+	if (cycles < 2 || cycles > 65536) {
+		dev_dbg(regmap_get_device(frame_regmap),
+			"period %llu ns out of range for rate %lu Hz\n",
+			period_ns, rate);
+		return -ERANGE;
+	}
+
+	ret = regmap_update_bits(frame_regmap, PWM_CYC_CFG,
+				 PWM_FRAME_VAL_MASK, cycles - 1);
+	if (ret)
+		return ret;
+
+	chip->frames[hw_idx].current_freq = div64_ul(rate, cycles);
+	chip->frames[hw_idx].freq_set = true;
+	chip->frames[hw_idx].current_period_ns = period_ns;
+
+	return 0;
+}
+
+static int qcom_pwm_get_state(struct pwm_chip *pwm_chip, struct pwm_device *pwm,
+			      struct pwm_state *state)
+{
+	struct qcom_pwm_chip *chip = to_qcom_pwm_chip(pwm_chip);
+	struct qcom_pwm_frames *frame = &chip->frames[pwm->hwpwm];
+	unsigned long rate;
+	u32 topctl, ctl0, ctl1, cyc_cfg, cycles;
+	int ret;
+
+	if (!frame->regmap)
+		return -ENODEV;
+
+	/* Both clocks are needed for register access. */
+	ret = qcom_pwm_clks_enable(chip);
+	if (ret)
+		return ret;
+
+	rate = clk_get_rate(chip->core);
+	if (!rate) {
+		ret = -EINVAL;
+		goto err_clks;
+	}
+
+	mutex_lock(&frame->frame_lock);
+
+	ret = regmap_read(chip->regmap, PWM_TOPCTL0, &topctl);
+	if (ret)
+		goto out;
+
+	ret = regmap_read(frame->regmap, PWM_CTL0, &ctl0);
+	if (ret)
+		goto out;
+
+	ret = regmap_read(frame->regmap, PWM_CTL1, &ctl1);
+	if (ret)
+		goto out;
+
+	ret = regmap_read(frame->regmap, PWM_CYC_CFG, &cyc_cfg);
+	if (ret)
+		goto out;
+
+	cycles = (cyc_cfg & PWM_FRAME_VAL_MASK) + 1;
+	state->enabled = !!(topctl & BIT(frame->frame_id));
+	state->polarity = (ctl0 & PWM_FRAME_POLARITY_BIT) ?
+			  PWM_POLARITY_INVERSED : PWM_POLARITY_NORMAL;
+	/*
+	 * Round up so re-applying the returned state reproduces the same
+	 * register values, since qcom_pwm_config() rounds the period and duty
+	 * cycle down.
+	 */
+	state->period = DIV_ROUND_UP_ULL((u64)cycles * NSEC_PER_SEC, rate);
+	state->duty_cycle = DIV_ROUND_UP_ULL((u64)(ctl1 & PWM_FRAME_VAL_MASK) *
+					     NSEC_PER_SEC, rate);
+out:
+	mutex_unlock(&frame->frame_lock);
+err_clks:
+	qcom_pwm_clks_disable(chip);
+
+	return ret;
+}
+
+static int qcom_pwm_config(struct qcom_pwm_chip *chip,
+			   u32 hw_idx, u64 duty_ns, u64 period_ns, int polarity)
+{
+	struct regmap *frame_regmap = chip->frames[hw_idx].regmap;
+	u64 ctl1, duty_percent;
+	unsigned long rate;
+	u64 current_period = period_ns;
+	bool clks_enabled = false;
+	int ret;
+	u32 cyc_cfg;
+
+	mutex_lock(&chip->frames[hw_idx].frame_lock);
+
+	if (!chip->frames[hw_idx].is_enabled) {
+		ret = qcom_pwm_clks_enable(chip);
+		if (ret)
+			goto err_unlock;
+		clks_enabled = true;
+	}
+
+	rate = clk_get_rate(chip->core);
+	if (!rate) {
+		ret = -EINVAL;
+		goto out;
+	}
+
+	/*
+	 * Set the counter rollover enable bit, so that counter doesn't get stuck
+	 * in period change configuration.
+	 */
+	if (chip->priv_data->pwm_cnt_rollover && !chip->frames[hw_idx].cnt_rollover_en) {
+		ret = regmap_update_bits(frame_regmap, PWM_CTL0,
+					 PWM_FRAME_ROLLOVER_CNT_BIT,
+					 PWM_FRAME_ROLLOVER_CNT_BIT);
+		if (ret)
+			goto out;
+
+		chip->frames[hw_idx].cnt_rollover_en = true;
+	}
+
+	if (chip->frames[hw_idx].freq_set &&
+	    chip->frames[hw_idx].current_period_ns != period_ns) {
+		if (chip->priv_data->pwm_reset_support) {
+			ret = regmap_update_bits(frame_regmap, PWM_RESET,
+						 PWM_FRAME_RESET_BIT,
+						 PWM_FRAME_RESET_BIT);
+			if (ret)
+				goto out;
+		} else {
+			ret = -EINVAL;
+			goto out;
+		}
+	}
+
+	ret = qcom_pwm_calc_frequency(chip, current_period, rate, hw_idx);
+	if (ret)
+		goto out;
+
+	if (chip->frames[hw_idx].polarity != polarity) {
+		ret = regmap_update_bits(frame_regmap, PWM_CTL0,
+					 PWM_FRAME_POLARITY_BIT, polarity);
+		if (ret)
+			goto out;
+
+		chip->frames[hw_idx].polarity = polarity;
+	}
+
+	ctl1 = DIV_ROUND_CLOSEST(rate, chip->frames[hw_idx].current_freq);
+	duty_percent = mul_u64_add_u64_div_u64(duty_ns, 100, current_period / 2, current_period);
+	ctl1 = mul_u64_add_u64_div_u64(ctl1, duty_percent, 50, 100);
+
+	ret = regmap_read(frame_regmap, PWM_CYC_CFG, &cyc_cfg);
+	if (ret)
+		goto out;
+
+	if ((ctl1 > cyc_cfg || ctl1 == 0) && duty_ns != 0) {
+		dev_err(regmap_get_device(frame_regmap),
+			"duty cycle out of valid range\n");
+		ret = -ERANGE;
+		goto out;
+	}
+
+	ret = regmap_update_bits(frame_regmap, PWM_CTL2, PWM_FRAME_VAL_MASK, 0);
+	if (ret)
+		goto out;
+
+	ret = regmap_update_bits(frame_regmap, PWM_CTL1, PWM_FRAME_VAL_MASK, ctl1);
+	if (ret)
+		goto out;
+
+	ret = regmap_update_bits(frame_regmap, PWM_UPDATE, BIT(0), 1);
+	if (ret)
+		goto out;
+
+	chip->frames[hw_idx].current_duty_ns = duty_ns;
+out:
+	if (clks_enabled)
+		qcom_pwm_clks_disable(chip);
+err_unlock:
+	mutex_unlock(&chip->frames[hw_idx].frame_lock);
+
+	return ret;
+}
+
+static int qcom_pwm_enable(struct qcom_pwm_chip *chip,
+			   struct pwm_device *pwm)
+{
+	struct device *dev = regmap_get_device(chip->regmap);
+	int ret;
+	u32 val, hw_idx = pwm->hwpwm;
+
+	ret = qcom_pwm_clks_enable(chip);
+	if (ret)
+		return ret;
+
+	mutex_lock(&chip->lock);
+
+	dev_dbg(dev, "enable: hw_idx=%u frame_id=%u\n",
+		hw_idx, chip->frames[hw_idx].frame_id);
+
+	val = BIT(chip->frames[hw_idx].frame_id);
+	ret = regmap_update_bits(chip->regmap, PWM_TOPCTL0, val, val);
+	if (!ret)
+		chip->frames[hw_idx].is_enabled = true;
+
+	mutex_unlock(&chip->lock);
+
+	if (ret)
+		goto err_clks;
+
+	return 0;
+
+err_clks:
+	qcom_pwm_clks_disable(chip);
+	return ret;
+}
+
+static int qcom_pwm_disable(struct qcom_pwm_chip *chip,
+			    struct pwm_device *pwm)
+{
+	struct device *dev = regmap_get_device(chip->regmap);
+	u32 val, hw_idx = pwm->hwpwm;
+	int ret;
+
+	mutex_lock(&chip->lock);
+
+	dev_dbg(dev, "disable: hw_idx=%u\n", hw_idx);
+
+	val = BIT(chip->frames[hw_idx].frame_id);
+	ret = regmap_update_bits(chip->regmap, PWM_TOPCTL0, val, 0);
+	if (!ret)
+		chip->frames[hw_idx].is_enabled = false;
+
+	mutex_unlock(&chip->lock);
+
+	if (ret)
+		return ret;
+
+	qcom_pwm_clks_disable(chip);
+
+	return 0;
+}
+
+static int qcom_pwm_apply(struct pwm_chip *pwm_chip, struct pwm_device *pwm,
+			  const struct pwm_state *state)
+{
+	struct qcom_pwm_chip *chip = to_qcom_pwm_chip(pwm_chip);
+	struct pwm_state curr_state;
+	u32 hw_idx = pwm->hwpwm;
+	int ret;
+
+	pwm_get_state(pwm, &curr_state);
+
+	if (state->period &&
+	    (state->period != curr_state.period ||
+	     state->duty_cycle != curr_state.duty_cycle ||
+	     state->polarity != curr_state.polarity)) {
+		ret = qcom_pwm_config(chip, hw_idx, state->duty_cycle,
+				      state->period, state->polarity);
+		if (ret) {
+			dev_err(pwmchip_parent(pwm_chip),
+				"failed to update PWM configuration\n");
+			return ret;
+		}
+	}
+
+	if (state->enabled != curr_state.enabled) {
+		if (state->enabled)
+			return qcom_pwm_enable(chip, pwm);
+
+		ret = qcom_pwm_disable(chip, pwm);
+		if (ret)
+			return ret;
+	}
+
+	return 0;
+}
+
+static int qcom_pwm_request(struct pwm_chip *pwm_chip, struct pwm_device *pwm)
+{
+	struct qcom_pwm_chip *chip = to_qcom_pwm_chip(pwm_chip);
+
+	if (!chip->frames[pwm->hwpwm].regmap)
+		return -ENODEV;
+
+	return 0;
+}
+
+/*
+ * Reset the software state and the frame's own registers (the same
+ * PWM_CTL0/PWM_CTL1/PWM_CYC_CFG registers qcom_pwm_get_state() reads back)
+ * to their power-on defaults, and disable an active PWM frame.
+ */
+static void qcom_pwm_free(struct pwm_chip *pwm_chip, struct pwm_device *pwm)
+{
+	struct qcom_pwm_chip *chip = to_qcom_pwm_chip(pwm_chip);
+	struct qcom_pwm_frames *frame = &chip->frames[pwm->hwpwm];
+	bool enabled;
+	int ret;
+
+	mutex_lock(&chip->lock);
+	enabled = frame->is_enabled;
+	mutex_unlock(&chip->lock);
+
+	if (enabled) {
+		ret = qcom_pwm_disable(chip, pwm);
+		if (ret) {
+			dev_err(pwmchip_parent(pwm_chip),
+				"failed to disable PWM on free\n");
+			return;
+		}
+	}
+
+	ret = qcom_pwm_clks_enable(chip);
+	if (ret) {
+		dev_err(pwmchip_parent(pwm_chip),
+			"failed to enable clocks on free\n");
+		return;
+	}
+
+	mutex_lock(&frame->frame_lock);
+
+	ret = regmap_update_bits(frame->regmap, PWM_CTL0,
+				 PWM_FRAME_POLARITY_BIT | PWM_FRAME_ROLLOVER_CNT_BIT, 0);
+	if (ret)
+		goto out;
+
+	ret = regmap_update_bits(frame->regmap, PWM_CTL1, PWM_FRAME_VAL_MASK, 0);
+	if (ret)
+		goto out;
+
+	ret = regmap_update_bits(frame->regmap, PWM_CTL2, PWM_FRAME_VAL_MASK, 0);
+	if (ret)
+		goto out;
+
+	ret = regmap_update_bits(frame->regmap, PWM_CYC_CFG, PWM_FRAME_VAL_MASK, 0);
+	if (ret)
+		goto out;
+
+	ret = regmap_update_bits(frame->regmap, PWM_UPDATE, BIT(0), 1);
+	if (ret)
+		goto out;
+
+	if (chip->priv_data->pwm_reset_support) {
+		ret = regmap_update_bits(frame->regmap, PWM_RESET,
+					 PWM_FRAME_RESET_BIT, PWM_FRAME_RESET_BIT);
+		if (ret)
+			goto out;
+	}
+
+	frame->freq_set = false;
+	frame->current_period_ns = 0;
+	frame->current_duty_ns = 0;
+	frame->current_freq = 0;
+	frame->polarity = 0;
+	frame->cnt_rollover_en = false;
+out:
+	mutex_unlock(&frame->frame_lock);
+	qcom_pwm_clks_disable(chip);
+
+	if (ret)
+		dev_err(pwmchip_parent(pwm_chip),
+			"failed to reset PWM registers on free\n");
+}
+
+static const struct pwm_ops qcom_pwm_ops = {
+	.request = qcom_pwm_request,
+	.apply = qcom_pwm_apply,
+	.free = qcom_pwm_free,
+	.get_state = qcom_pwm_get_state,
+};
+
+static const struct regmap_config pwm_regmap_config = {
+	.reg_bits   = 32,
+	.reg_stride = 4,
+	.val_bits   = 32,
+	.fast_io    = true,
+};
+
+static int qcom_pwm_parse_dt(struct platform_device *pdev,
+			     struct pwm_chip *pwm_chip,
+			     struct qcom_pwm_chip *chip)
+{
+	struct device *dev = pwmchip_parent(pwm_chip);
+	struct device_node *np = pdev->dev.of_node;
+	struct device_node *frame_node;
+	void __iomem *base;
+	unsigned long frame_ids = 0;
+	int ret;
+
+	base = devm_platform_ioremap_resource(pdev, 0);
+	if (IS_ERR(base))
+		return PTR_ERR(base);
+
+	chip->regmap = devm_regmap_init_mmio(dev, base, &pwm_regmap_config);
+	if (IS_ERR(chip->regmap))
+		return dev_err_probe(dev, PTR_ERR(chip->regmap),
+				"failed to initialise regmap\n");
+
+	chip->ahb = devm_clk_get(dev, "ahb");
+	if (IS_ERR(chip->ahb))
+		return dev_err_probe(dev, PTR_ERR(chip->ahb),
+				"failed to get ahb clock\n");
+
+	chip->core = devm_clk_get(dev, "core");
+	if (IS_ERR(chip->core))
+		return dev_err_probe(dev, PTR_ERR(chip->core),
+				"failed to get core clock\n");
+
+	chip->frames = devm_kcalloc(dev, chip->num_frames,
+				    sizeof(*chip->frames), GFP_KERNEL);
+	if (!chip->frames)
+		return -ENOMEM;
+
+	for_each_available_child_of_node(np, frame_node) {
+		u32 n;
+		struct resource res;
+
+		if (of_property_read_u32(frame_node, "qcom,frame-index", &n)) {
+			of_node_put(frame_node);
+			return dev_err_probe(dev, -EINVAL,
+					"missing qcom,frame-index property in DT node\n");
+		}
+
+		if (n >= chip->priv_data->max_channels) {
+			of_node_put(frame_node);
+			return dev_err_probe(dev, -EINVAL,
+					"invalid qcom,frame-index %u\n", n);
+		}
+
+		if (test_and_set_bit(n, &frame_ids)) {
+			of_node_put(frame_node);
+			return dev_err_probe(dev, -EINVAL,
+					"duplicate qcom,frame-index %u\n", n);
+		}
+
+		chip->frames[n].frame_id = n;
+
+		ret = of_address_to_resource(frame_node, 0, &res);
+		if (ret) {
+			of_node_put(frame_node);
+			return dev_err_probe(dev, ret,
+					"failed to get frame-%u resource\n", n);
+		}
+
+		base = devm_ioremap_resource(dev, &res);
+		if (IS_ERR(base)) {
+			of_node_put(frame_node);
+			return PTR_ERR(base);
+		}
+
+		chip->frames[n].regmap =
+			devm_regmap_init_mmio(dev, base, &pwm_regmap_config);
+		if (IS_ERR(chip->frames[n].regmap)) {
+			of_node_put(frame_node);
+			return dev_err_probe(dev, PTR_ERR(chip->frames[n].regmap),
+						 "failed to initialise frame regmap\n");
+		}
+
+		mutex_init(&chip->frames[n].frame_lock);
+	}
+
+	/* The hardware requires all PWM outputs to be disabled at probe. */
+	ret = qcom_pwm_clks_enable(chip);
+	if (ret)
+		return ret;
+
+	ret = regmap_update_bits(chip->regmap, PWM_TOPCTL0,
+				 GENMASK(chip->priv_data->max_channels - 1, 0), 0);
+
+	qcom_pwm_clks_disable(chip);
+
+	return ret;
+}
+
+static const struct qcom_pwm_priv_data shikra_pwm_data = {
+	.max_channels = 10,
+};
+
+static const struct of_device_id qcom_pwm_of_match[] = {
+	{ .compatible = "qcom,shikra-pwm", .data = &shikra_pwm_data },
+	{ },
+};
+MODULE_DEVICE_TABLE(of, qcom_pwm_of_match);
+
+static int qcom_pwm_probe(struct platform_device *pdev)
+{
+	struct pwm_chip *pwm_chip;
+	struct qcom_pwm_chip *chip;
+	const struct qcom_pwm_priv_data *priv;
+	struct device_node *np = pdev->dev.of_node;
+	u32 child_count;
+	int rc;
+
+	priv = of_device_get_match_data(&pdev->dev);
+	if (!priv)
+		return -EINVAL;
+
+	/* At least one available frame resource must be described. */
+	child_count = of_get_available_child_count(np);
+	if (!child_count)
+		return dev_err_probe(&pdev->dev, -EINVAL,
+				"at least one PWM frame must be described\n");
+
+	pwm_chip = devm_pwmchip_alloc(&pdev->dev, priv->max_channels, sizeof(*chip));
+	if (IS_ERR(pwm_chip))
+		return PTR_ERR(pwm_chip);
+
+	chip = to_qcom_pwm_chip(pwm_chip);
+	chip->priv_data  = priv;
+	chip->num_frames = priv->max_channels;
+	mutex_init(&chip->lock);
+
+	pwm_chip->ops = &qcom_pwm_ops;
+
+	rc = qcom_pwm_parse_dt(pdev, pwm_chip, chip);
+	if (rc)
+		return rc;
+
+	rc = devm_pwmchip_add(&pdev->dev, pwm_chip);
+	if (rc)
+		return rc;
+
+	return 0;
+}
+
+static struct platform_driver qcom_pwm_driver = {
+	.driver		= {
+		.name		= "qcom-pwm",
+		.of_match_table	= qcom_pwm_of_match,
+	},
+	.probe		= qcom_pwm_probe,
+};
+
+module_platform_driver(qcom_pwm_driver);
+
+MODULE_DESCRIPTION("Qualcomm PWM driver");
+MODULE_LICENSE("GPL");

-- 
2.34.1


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 3/3] arm64: dts: qcom: add Shikra PWM controller
  2026-11-16  6:59 [PATCH 0/3] pwm: qcom: add Shikra PWM controller Taniya Das
  2026-11-16  6:59 ` [PATCH 1/3] dt-bindings: " Taniya Das
  2026-11-16  6:59 ` [PATCH 2/3] pwm: qcom: add Shikra PWM controller support Taniya Das
@ 2026-11-16  6:59 ` Taniya Das
  2 siblings, 0 replies; 6+ messages in thread
From: Taniya Das @ 2026-11-16  6:59 UTC (permalink / raw)
  To: Uwe Kleine-König, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, Taniya Das, Bjorn Andersson, Konrad Dybcio,
	Abel Vesa
  Cc: Ajit Pandey, Imran Shaik, Jagadeesh Kona, linux-arm-msm,
	linux-pwm, devicetree, linux-kernel

Add the PWM controller node with its AHB and core clocks and the ten
PWM frame child nodes to the Shikra SoC DTSI. Assign the shared PWM
core clock a rate of 9.6MHz.

Signed-off-by: Taniya Das <taniya.das@oss.qualcomm.com>
---
 arch/arm64/boot/dts/qcom/shikra.dtsi | 63 ++++++++++++++++++++++++++++++++++++
 1 file changed, 63 insertions(+)

diff --git a/arch/arm64/boot/dts/qcom/shikra.dtsi b/arch/arm64/boot/dts/qcom/shikra.dtsi
index 0a95ad5a5582c643f97e2b0725eb88a9f262d83c..d8a3de38382bdb00684acd709f4d34136792771c 100644
--- a/arch/arm64/boot/dts/qcom/shikra.dtsi
+++ b/arch/arm64/boot/dts/qcom/shikra.dtsi
@@ -1303,6 +1303,69 @@ sram@4690000 {
 			reg = <0x0 0x04690000 0x0 0x14000>;
 		};
 
+		pwm: pwm@4700000 {
+			compatible = "qcom,shikra-pwm";
+			reg = <0x0 0x04700000 0x0 0x10>;
+			clocks = <&gcc GCC_PDM_AHB_CLK>, <&gcc GCC_PWM0_XO512_CLK>;
+			clock-names = "ahb", "core";
+			assigned-clocks = <&gcc GCC_PWM0_XO512_CLK>;
+			assigned-clock-rates = <9600000>;
+			#pwm-cells = <3>;
+			#address-cells = <2>;
+			#size-cells = <2>;
+			ranges;
+
+			pwm@4701000 {
+				reg = <0x0 0x04701000 0x0 0x1c>;
+				qcom,frame-index = <0>;
+			};
+
+			pwm@4702000 {
+				reg = <0x0 0x04702000 0x0 0x1c>;
+				qcom,frame-index = <1>;
+			};
+
+			pwm@4703000 {
+				reg = <0x0 0x04703000 0x0 0x1c>;
+				qcom,frame-index = <2>;
+			};
+
+			pwm@4704000 {
+				reg = <0x0 0x04704000 0x0 0x1c>;
+				qcom,frame-index = <3>;
+			};
+
+			pwm@4705000 {
+				reg = <0x0 0x04705000 0x0 0x1c>;
+				qcom,frame-index = <4>;
+			};
+
+			pwm@4706000 {
+				reg = <0x0 0x04706000 0x0 0x1c>;
+				qcom,frame-index = <5>;
+			};
+
+			pwm@4707000 {
+				reg = <0x0 0x04707000 0x0 0x1c>;
+				qcom,frame-index = <6>;
+			};
+
+			pwm@4708000 {
+				reg = <0x0 0x04708000 0x0 0x1c>;
+				qcom,frame-index = <7>;
+			};
+
+			pwm@4709000 {
+				reg = <0x0 0x04709000 0x0 0x1c>;
+				qcom,frame-index = <8>;
+			};
+
+			pwm@470a000 {
+				reg = <0x0 0x0470a000 0x0 0x1c>;
+				qcom,frame-index = <9>;
+			};
+		};
+
 		sdhc_1: mmc@4744000 {
 			compatible = "qcom,shikra-sdhci", "qcom,sdhci-msm-v5";
 

-- 
2.34.1


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 1/3] dt-bindings: pwm: qcom: add Shikra PWM controller
  2026-11-16  6:59 ` [PATCH 1/3] dt-bindings: " Taniya Das
@ 2026-11-16 10:05   ` Krzysztof Kozlowski
  0 siblings, 0 replies; 6+ messages in thread
From: Krzysztof Kozlowski @ 2026-11-16 10:05 UTC (permalink / raw)
  To: Taniya Das
  Cc: Uwe Kleine-König, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, Bjorn Andersson, Konrad Dybcio, Abel Vesa,
	Ajit Pandey, Imran Shaik, Jagadeesh Kona, linux-arm-msm,
	linux-pwm, devicetree, linux-kernel

On Mon, Nov 16, 2026 at 12:29:48PM +0530, Taniya Das wrote:
> +patternProperties:
> +  "^pwm@[0-9a-f]+$":
> +    type: object
> +    description: Per-frame PWM channel sub-node.

I don't get the need for the children. The the parent has pwm-cells, so
it should be enough.

> +
> +    properties:
> +      reg:
> +        maxItems: 1
> +        description: This frame's own absolute register range.
> +
> +      qcom,frame-index:
> +        $ref: /schemas/types.yaml#/definitions/uint32
> +        description:
> +          Hardware frame index within the PWM block. It is the PWM index
> +          used in the first cell of a consumer PWM specifier and selects
> +          the corresponding enable bit in PWM_TOPCTL0.

And this seems to be duplicating the value passed through phandle/pwm-cells.

> +        maximum: 9

Best regards,
Krzysztof


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 2/3] pwm: qcom: add Shikra PWM controller support
  2026-11-16  6:59 ` [PATCH 2/3] pwm: qcom: add Shikra PWM controller support Taniya Das
@ 2026-11-17 14:44   ` Uwe Kleine-König
  0 siblings, 0 replies; 6+ messages in thread
From: Uwe Kleine-König @ 2026-11-17 14:44 UTC (permalink / raw)
  To: Taniya Das
  Cc: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Bjorn Andersson,
	Konrad Dybcio, Abel Vesa, Ajit Pandey, Imran Shaik,
	Jagadeesh Kona, linux-arm-msm, linux-pwm, devicetree,
	linux-kernel

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

On Mon, Nov 16, 2026 at 12:29:49PM +0530, Taniya Das wrote:
> Add support for the Pulse Width Modulation (PWM) controller on Qualcomm
> Shikra SoCs.
> 
> The controller has a shared output-enable register and up to ten frame
> blocks with independent configuration registers. Model each available
> frame from its DT child node, and retain the shared AHB and PWM core
> clocks while an output is active.
> 
> Signed-off-by: Taniya Das <taniya.das@oss.qualcomm.com>
> ---
>  drivers/pwm/Kconfig    |  13 +
>  drivers/pwm/Makefile   |   1 +
>  drivers/pwm/pwm-qcom.c | 685 +++++++++++++++++++++++++++++++++++++++++++++++++
>  3 files changed, 699 insertions(+)
> 
> diff --git a/drivers/pwm/Kconfig b/drivers/pwm/Kconfig
> index aacd800687e7c98b2272ddb01447356349425032..ae229e922521e97d88610887da5ccb0f7433fbd3 100644
> --- a/drivers/pwm/Kconfig
> +++ b/drivers/pwm/Kconfig
> @@ -566,6 +566,19 @@ config PWM_PXA
>  	  To compile this driver as a module, choose M here: the module
>  	  will be called pwm-pxa.
>  
> +config PWM_QCOM
> +	tristate "Qualcomm PWM support"
> +	depends on ARCH_QCOM || COMPILE_TEST
> +	depends on COMMON_CLK && HAS_IOMEM && OF
> +	select REGMAP_MMIO
> +	help
> +	  PWM framework driver for the PWM block found on Qualcomm SoCs,
> +	  which supports multiple PWM frames. Each frame can be
> +	  configured independently of the others.
> +
> +	  To compile this driver as a module, choose M here: the module will
> +	  be called pwm-qcom.
> +
>  config PWM_RASPBERRYPI_POE
>  	tristate "Raspberry Pi Firmware PoE Hat PWM support"
>  	# Make sure not 'y' when RASPBERRYPI_FIRMWARE is 'm'. This can only
> diff --git a/drivers/pwm/Makefile b/drivers/pwm/Makefile
> index 7e2c34cc4f6a955b04edcdd08721264d0d477f2e..a7e0095b573448cb643b19f4da2e6f02ada4bc39 100644
> --- a/drivers/pwm/Makefile
> +++ b/drivers/pwm/Makefile
> @@ -50,6 +50,7 @@ obj-$(CONFIG_PWM_NTXEC)		+= pwm-ntxec.o
>  obj-$(CONFIG_PWM_OMAP_DMTIMER)	+= pwm-omap-dmtimer.o
>  obj-$(CONFIG_PWM_PCA9685)	+= pwm-pca9685.o
>  obj-$(CONFIG_PWM_PXA)		+= pwm-pxa.o
> +obj-$(CONFIG_PWM_QCOM)		+= pwm-qcom.o
>  obj-$(CONFIG_PWM_RASPBERRYPI_POE)	+= pwm-raspberrypi-poe.o
>  obj-$(CONFIG_PWM_RENESAS_RCAR)	+= pwm-rcar.o
>  obj-$(CONFIG_PWM_RENESAS_RZG2L_GPT)	+= pwm-rzg2l-gpt.o
> diff --git a/drivers/pwm/pwm-qcom.c b/drivers/pwm/pwm-qcom.c
> new file mode 100644
> index 0000000000000000000000000000000000000000..9b15cdcaa5c76a3f2a9d7871b4e12d52cf89610a
> --- /dev/null
> +++ b/drivers/pwm/pwm-qcom.c
> @@ -0,0 +1,685 @@
> +// SPDX-License-Identifier: GPL-2.0-only
> +/*
> + * Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.
> + *
> + */

Please describe the general hardware properties in a "Limitations"
paragraph. Look at other drivers for the format and what to mention
there.

> +
> +#include <linux/bitops.h>
> +#include <linux/clk.h>
> +#include <linux/math64.h>
> +#include <linux/mod_devicetable.h>

Don't include <linux/mod_devicetable.h>. <linux/platform_device.h>
already gives you of_device_id, so just drop it.

> +#include <linux/module.h>
> +#include <linux/mutex.h>
> +#include <linux/of.h>
> +#include <linux/of_address.h>
> +#include <linux/platform_device.h>
> +#include <linux/pwm.h>
> +#include <linux/regmap.h>
> +
> +/* Offsets */
> +#define PWM_TOPCTL0			0x0
> +
> +/* offsets per frame */
> +#define PWM_CTL0			0x0
> +#define PWM_CTL1			0x4
> +#define PWM_CTL2			0x8
> +#define PWM_CYC_CFG			0xc
> +#define PWM_UPDATE			0x10
> +#define PWM_RESET			0x18
> +
> +#define PWM_FRAME_POLARITY_BIT		BIT(0)
> +#define PWM_FRAME_ROLLOVER_CNT_BIT	BIT(4)
> +#define PWM_FRAME_RESET_BIT		BIT(0)

Please add a proper prefix to these defintions. "PWM_UPDATE" sounds much
more generic than it is.

Also ideally the bit defintions start with the register name.

> +/* All per-frame 16-bit value fields (CYC_CFG, CTL1, CTL2). */
> +#define PWM_FRAME_VAL_MASK		GENMASK(15, 0)
> +
> +/*
> + * struct qcom_pwm_priv_data - per-compatible hardware description
> + * @max_channels: number of frames supported by this hardware variant.
> + * @pwm_reset_support: whether PWM_RESET is implemented, allowing the period
> + *	to be changed after it has already been set once.
> + * @pwm_cnt_rollover: whether PWM_FRAME_ROLLOVER_CNT_BIT is implemented,
> + *	needed so period changes don't get stuck waiting on the counter.
> + */
> +struct qcom_pwm_priv_data {
> +	unsigned int max_channels;
> +	bool pwm_reset_support;
> +	bool pwm_cnt_rollover;
> +};
> +
> +/*
> + * struct qcom_pwm_frames - Information regarding per PWM frame
> + * @frame_id: Id number associated with each frame.
> + * @polarity: Current polarity of the particular frame.
> + * @regmap: regmap covering this frame's own register block. Each frame now
> + *	owns its own "reg" range in DT, so registers are accessed at their
> + *	plain offsets within this regmap instead of as an offset into a
> + *	shared parent regmap.
> + * @current_period_ns: Current period of the particular frame.
> + * @current_duty_ns: Current duty cycle of the particular frame.
> + * @current_freq: Current frequency of frame.
> + * @freq_set: This bool flag is responsible for setting period once per frame.
> + * @frame_lock: mutex lock per frame.
> + * @cnt_rollover_en: This bool flag is used to set rollover bit per frame.
> + */
> +struct qcom_pwm_frames {
> +	u32	frame_id;
> +	u32	polarity;
> +	struct regmap *regmap;
> +	u64	current_period_ns;
> +	u64	current_duty_ns;
> +	unsigned long current_freq;
> +	bool	is_enabled;
> +	bool	freq_set;
> +	struct mutex frame_lock; /* PWM per frame lock */
> +	bool cnt_rollover_en;

Only a single space between type name and member name.

> +};
> +
> +/*
> + * struct qcom_pwm_chip - Information regarding per PWM block
> + * @regmap: regmap of the shared PWM_TOPCTL0 enable register.
> + * @frames: structure for all frames of each PWM block.
> + * @priv_data: per-compatible hardware description.
> + * @ahb: AHB clock providing access to the PWM block.
> + * @core: shared clock providing the PWM frame rate.
> + * @lock: mutex lock per chip (enable/disable path).
> + * @num_frames: number of frames in each PWM block.
> + */
> +struct qcom_pwm_chip {
> +	struct regmap		*regmap;
> +	struct qcom_pwm_frames	*frames;
> +	const struct qcom_pwm_priv_data	*priv_data;
> +	struct clk		*ahb;
> +	struct clk		*core;
> +	/* This lock to be used for Enable/Disable as it is per PWM channel */
> +	struct mutex		lock;
> +	u32			num_frames;
> +};
> +
> +static inline struct qcom_pwm_chip *to_qcom_pwm_chip(struct pwm_chip *chip)

If you rename that to qcome_pwm_from_chip it also has the common
function prefix.

> +{
> +	return pwmchip_get_drvdata(chip);
> +}
> +
> +static int qcom_pwm_clks_enable(struct qcom_pwm_chip *chip)
> +{
> +	int ret;
> +
> +	ret = clk_prepare_enable(chip->ahb);
> +	if (ret)
> +		return ret;
> +
> +	ret = clk_prepare_enable(chip->core);
> +	if (ret)
> +		clk_disable_unprepare(chip->ahb);
> +
> +	return ret;
> +}
> +
> +static void qcom_pwm_clks_disable(struct qcom_pwm_chip *chip)
> +{
> +	clk_disable_unprepare(chip->core);
> +	clk_disable_unprepare(chip->ahb);
> +}
> +
> +static int qcom_pwm_calc_frequency(struct qcom_pwm_chip *chip,
> +				   u64 period_ns, unsigned long rate, u32 hw_idx)
> +{
> +	struct regmap *frame_regmap = chip->frames[hw_idx].regmap;
> +	u64 cycles;
> +	int ret;
> +
> +	/*
> +	 * PWM client can set the period only once if the HW version does
> +	 * not support reset functionality.
> +	 */
> +	if (chip->frames[hw_idx].freq_set && !chip->priv_data->pwm_reset_support)
> +		return 0;
> +
> +	/*
> +	 * Number of core-clock cycles in one PWM period. Round down so the
> +	 * implemented period never exceeds the requested one, as the PWM API
> +	 * requires. PWM_CYC_CFG holds (cycles - 1) in its low 16 bits, so
> +	 * cycles is bounded to [2, 65536], i.e. an output frequency from
> +	 * rate / 2 down to rate / 65536.
> +	 */
> +	cycles = mul_u64_u64_div_u64(period_ns, rate, NSEC_PER_SEC);
> +	if (cycles < 2 || cycles > 65536) {
> +		dev_dbg(regmap_get_device(frame_regmap),
> +			"period %llu ns out of range for rate %lu Hz\n",
> +			period_ns, rate);
> +		return -ERANGE;
> +	}
> +
> +	ret = regmap_update_bits(frame_regmap, PWM_CYC_CFG,
> +				 PWM_FRAME_VAL_MASK, cycles - 1);
> +	if (ret)
> +		return ret;
> +
> +	chip->frames[hw_idx].current_freq = div64_ul(rate, cycles);
> +	chip->frames[hw_idx].freq_set = true;
> +	chip->frames[hw_idx].current_period_ns = period_ns;
> +
> +	return 0;
> +}
> +
> +static int qcom_pwm_get_state(struct pwm_chip *pwm_chip, struct pwm_device *pwm,
> +			      struct pwm_state *state)
> +{
> +	struct qcom_pwm_chip *chip = to_qcom_pwm_chip(pwm_chip);
> +	struct qcom_pwm_frames *frame = &chip->frames[pwm->hwpwm];
> +	unsigned long rate;
> +	u32 topctl, ctl0, ctl1, cyc_cfg, cycles;
> +	int ret;
> +
> +	if (!frame->regmap)
> +		return -ENODEV;
> +
> +	/* Both clocks are needed for register access. */
> +	ret = qcom_pwm_clks_enable(chip);
> +	if (ret)
> +		return ret;
> +
> +	rate = clk_get_rate(chip->core);
> +	if (!rate) {
> +		ret = -EINVAL;
> +		goto err_clks;
> +	}
> +
> +	mutex_lock(&frame->frame_lock);
> +
> +	ret = regmap_read(chip->regmap, PWM_TOPCTL0, &topctl);
> +	if (ret)
> +		goto out;
> +
> +	ret = regmap_read(frame->regmap, PWM_CTL0, &ctl0);
> +	if (ret)
> +		goto out;
> +
> +	ret = regmap_read(frame->regmap, PWM_CTL1, &ctl1);
> +	if (ret)
> +		goto out;
> +
> +	ret = regmap_read(frame->regmap, PWM_CYC_CFG, &cyc_cfg);
> +	if (ret)
> +		goto out;
> +
> +	cycles = (cyc_cfg & PWM_FRAME_VAL_MASK) + 1;
> +	state->enabled = !!(topctl & BIT(frame->frame_id));
> +	state->polarity = (ctl0 & PWM_FRAME_POLARITY_BIT) ?
> +			  PWM_POLARITY_INVERSED : PWM_POLARITY_NORMAL;
> +	/*
> +	 * Round up so re-applying the returned state reproduces the same
> +	 * register values, since qcom_pwm_config() rounds the period and duty
> +	 * cycle down.
> +	 */
> +	state->period = DIV_ROUND_UP_ULL((u64)cycles * NSEC_PER_SEC, rate);
> +	state->duty_cycle = DIV_ROUND_UP_ULL((u64)(ctl1 & PWM_FRAME_VAL_MASK) *
> +					     NSEC_PER_SEC, rate);
> +out:
> +	mutex_unlock(&frame->frame_lock);
> +err_clks:
> +	qcom_pwm_clks_disable(chip);
> +
> +	return ret;
> +}
> +
> +static int qcom_pwm_config(struct qcom_pwm_chip *chip,
> +			   u32 hw_idx, u64 duty_ns, u64 period_ns, int polarity)
> +{
> +	struct regmap *frame_regmap = chip->frames[hw_idx].regmap;
> +	u64 ctl1, duty_percent;
> +	unsigned long rate;
> +	u64 current_period = period_ns;
> +	bool clks_enabled = false;
> +	int ret;
> +	u32 cyc_cfg;
> +
> +	mutex_lock(&chip->frames[hw_idx].frame_lock);
> +
> +	if (!chip->frames[hw_idx].is_enabled) {
> +		ret = qcom_pwm_clks_enable(chip);
> +		if (ret)
> +			goto err_unlock;
> +		clks_enabled = true;
> +	}
> +
> +	rate = clk_get_rate(chip->core);
> +	if (!rate) {
> +		ret = -EINVAL;
> +		goto out;
> +	}
> +
> +	/*
> +	 * Set the counter rollover enable bit, so that counter doesn't get stuck
> +	 * in period change configuration.
> +	 */
> +	if (chip->priv_data->pwm_cnt_rollover && !chip->frames[hw_idx].cnt_rollover_en) {
> +		ret = regmap_update_bits(frame_regmap, PWM_CTL0,
> +					 PWM_FRAME_ROLLOVER_CNT_BIT,
> +					 PWM_FRAME_ROLLOVER_CNT_BIT);
> +		if (ret)
> +			goto out;
> +
> +		chip->frames[hw_idx].cnt_rollover_en = true;
> +	}
> +
> +	if (chip->frames[hw_idx].freq_set &&
> +	    chip->frames[hw_idx].current_period_ns != period_ns) {
> +		if (chip->priv_data->pwm_reset_support) {
> +			ret = regmap_update_bits(frame_regmap, PWM_RESET,
> +						 PWM_FRAME_RESET_BIT,
> +						 PWM_FRAME_RESET_BIT);
> +			if (ret)
> +				goto out;
> +		} else {
> +			ret = -EINVAL;
> +			goto out;
> +		}
> +	}
> +
> +	ret = qcom_pwm_calc_frequency(chip, current_period, rate, hw_idx);
> +	if (ret)
> +		goto out;
> +
> +	if (chip->frames[hw_idx].polarity != polarity) {
> +		ret = regmap_update_bits(frame_regmap, PWM_CTL0,
> +					 PWM_FRAME_POLARITY_BIT, polarity);
> +		if (ret)
> +			goto out;
> +
> +		chip->frames[hw_idx].polarity = polarity;
> +	}
> +
> +	ctl1 = DIV_ROUND_CLOSEST(rate, chip->frames[hw_idx].current_freq);
> +	duty_percent = mul_u64_add_u64_div_u64(duty_ns, 100, current_period / 2, current_period);
> +	ctl1 = mul_u64_add_u64_div_u64(ctl1, duty_percent, 50, 100);
> +
> +	ret = regmap_read(frame_regmap, PWM_CYC_CFG, &cyc_cfg);
> +	if (ret)
> +		goto out;
> +
> +	if ((ctl1 > cyc_cfg || ctl1 == 0) && duty_ns != 0) {
> +		dev_err(regmap_get_device(frame_regmap),
> +			"duty cycle out of valid range\n");
> +		ret = -ERANGE;
> +		goto out;
> +	}
> +
> +	ret = regmap_update_bits(frame_regmap, PWM_CTL2, PWM_FRAME_VAL_MASK, 0);
> +	if (ret)
> +		goto out;
> +
> +	ret = regmap_update_bits(frame_regmap, PWM_CTL1, PWM_FRAME_VAL_MASK, ctl1);
> +	if (ret)
> +		goto out;
> +
> +	ret = regmap_update_bits(frame_regmap, PWM_UPDATE, BIT(0), 1);
> +	if (ret)
> +		goto out;
> +
> +	chip->frames[hw_idx].current_duty_ns = duty_ns;
> +out:
> +	if (clks_enabled)
> +		qcom_pwm_clks_disable(chip);
> +err_unlock:
> +	mutex_unlock(&chip->frames[hw_idx].frame_lock);
> +
> +	return ret;
> +}
> +
> +static int qcom_pwm_enable(struct qcom_pwm_chip *chip,
> +			   struct pwm_device *pwm)
> +{
> +	struct device *dev = regmap_get_device(chip->regmap);
> +	int ret;
> +	u32 val, hw_idx = pwm->hwpwm;
> +
> +	ret = qcom_pwm_clks_enable(chip);
> +	if (ret)
> +		return ret;
> +
> +	mutex_lock(&chip->lock);
> +
> +	dev_dbg(dev, "enable: hw_idx=%u frame_id=%u\n",
> +		hw_idx, chip->frames[hw_idx].frame_id);
> +
> +	val = BIT(chip->frames[hw_idx].frame_id);
> +	ret = regmap_update_bits(chip->regmap, PWM_TOPCTL0, val, val);
> +	if (!ret)
> +		chip->frames[hw_idx].is_enabled = true;
> +
> +	mutex_unlock(&chip->lock);
> +
> +	if (ret)
> +		goto err_clks;
> +
> +	return 0;
> +
> +err_clks:
> +	qcom_pwm_clks_disable(chip);
> +	return ret;
> +}
> +
> +static int qcom_pwm_disable(struct qcom_pwm_chip *chip,
> +			    struct pwm_device *pwm)
> +{
> +	struct device *dev = regmap_get_device(chip->regmap);
> +	u32 val, hw_idx = pwm->hwpwm;
> +	int ret;
> +
> +	mutex_lock(&chip->lock);
> +
> +	dev_dbg(dev, "disable: hw_idx=%u\n", hw_idx);
> +
> +	val = BIT(chip->frames[hw_idx].frame_id);
> +	ret = regmap_update_bits(chip->regmap, PWM_TOPCTL0, val, 0);
> +	if (!ret)
> +		chip->frames[hw_idx].is_enabled = false;
> +
> +	mutex_unlock(&chip->lock);
> +
> +	if (ret)
> +		return ret;
> +
> +	qcom_pwm_clks_disable(chip);
> +
> +	return 0;
> +}
> +
> +static int qcom_pwm_apply(struct pwm_chip *pwm_chip, struct pwm_device *pwm,
> +			  const struct pwm_state *state)
> +{
> +	struct qcom_pwm_chip *chip = to_qcom_pwm_chip(pwm_chip);
> +	struct pwm_state curr_state;
> +	u32 hw_idx = pwm->hwpwm;
> +	int ret;
> +
> +	pwm_get_state(pwm, &curr_state);

Don't call PWM functions from callbacks. pwm_get_state() doesn't take
the chip lock, but that's an implementation detail that you shouldn't
rely on.

> +
> +	if (state->period &&
> +	    (state->period != curr_state.period ||
> +	     state->duty_cycle != curr_state.duty_cycle ||
> +	     state->polarity != curr_state.polarity)) {

Don't do these checks, the PWM core already handles stuff like that.

> +		ret = qcom_pwm_config(chip, hw_idx, state->duty_cycle,
> +				      state->period, state->polarity);
> +		if (ret) {
> +			dev_err(pwmchip_parent(pwm_chip),
> +				"failed to update PWM configuration\n");
> +			return ret;
> +		}
> +	}
> +
> +	if (state->enabled != curr_state.enabled) {
> +		if (state->enabled)
> +			return qcom_pwm_enable(chip, pwm);
> +
> +		ret = qcom_pwm_disable(chip, pwm);
> +		if (ret)
> +			return ret;
> +	}
> +
> +	return 0;
> +}
> +
> +static int qcom_pwm_request(struct pwm_chip *pwm_chip, struct pwm_device *pwm)
> +{
> +	struct qcom_pwm_chip *chip = to_qcom_pwm_chip(pwm_chip);
> +
> +	if (!chip->frames[pwm->hwpwm].regmap)
> +		return -ENODEV;
> +
> +	return 0;
> +}
> +
> +/*
> + * Reset the software state and the frame's own registers (the same
> + * PWM_CTL0/PWM_CTL1/PWM_CYC_CFG registers qcom_pwm_get_state() reads back)
> + * to their power-on defaults, and disable an active PWM frame.
> + */
> +static void qcom_pwm_free(struct pwm_chip *pwm_chip, struct pwm_device *pwm)
> +{
> +	struct qcom_pwm_chip *chip = to_qcom_pwm_chip(pwm_chip);

The variable name "chip" is reserved for variables of type pwm_chip. So
please use "chip" instead of "pwm_chip" and something else for the
struct qcom_pwm_chip variables.

> +	struct qcom_pwm_frames *frame = &chip->frames[pwm->hwpwm];
> +	bool enabled;
> +	int ret;
> +
> +	mutex_lock(&chip->lock);
> +	enabled = frame->is_enabled;
> +	mutex_unlock(&chip->lock);
> +
> +	if (enabled) {
> +		ret = qcom_pwm_disable(chip, pwm);
> +		if (ret) {
> +			dev_err(pwmchip_parent(pwm_chip),
> +				"failed to disable PWM on free\n");
> +			return;
> +		}
> +	}
> +
> +	ret = qcom_pwm_clks_enable(chip);
> +	if (ret) {
> +		dev_err(pwmchip_parent(pwm_chip),
> +			"failed to enable clocks on free\n");
> +		return;
> +	}
> +
> +	mutex_lock(&frame->frame_lock);
> +
> +	ret = regmap_update_bits(frame->regmap, PWM_CTL0,
> +				 PWM_FRAME_POLARITY_BIT | PWM_FRAME_ROLLOVER_CNT_BIT, 0);
> +	if (ret)
> +		goto out;
> +
> +	ret = regmap_update_bits(frame->regmap, PWM_CTL1, PWM_FRAME_VAL_MASK, 0);
> +	if (ret)
> +		goto out;
> +
> +	ret = regmap_update_bits(frame->regmap, PWM_CTL2, PWM_FRAME_VAL_MASK, 0);
> +	if (ret)
> +		goto out;
> +
> +	ret = regmap_update_bits(frame->regmap, PWM_CYC_CFG, PWM_FRAME_VAL_MASK, 0);
> +	if (ret)
> +		goto out;
> +
> +	ret = regmap_update_bits(frame->regmap, PWM_UPDATE, BIT(0), 1);
> +	if (ret)
> +		goto out;
> +
> +	if (chip->priv_data->pwm_reset_support) {
> +		ret = regmap_update_bits(frame->regmap, PWM_RESET,
> +					 PWM_FRAME_RESET_BIT, PWM_FRAME_RESET_BIT);
> +		if (ret)
> +			goto out;
> +	}
> +
> +	frame->freq_set = false;
> +	frame->current_period_ns = 0;
> +	frame->current_duty_ns = 0;
> +	frame->current_freq = 0;
> +	frame->polarity = 0;
> +	frame->cnt_rollover_en = false;
> +out:
> +	mutex_unlock(&frame->frame_lock);
> +	qcom_pwm_clks_disable(chip);
> +
> +	if (ret)
> +		dev_err(pwmchip_parent(pwm_chip),
> +			"failed to reset PWM registers on free\n");
> +}
> +
> +static const struct pwm_ops qcom_pwm_ops = {
> +	.request = qcom_pwm_request,
> +	.apply = qcom_pwm_apply,
> +	.free = qcom_pwm_free,
> +	.get_state = qcom_pwm_get_state,

I don't accept new drivers with .apply() and .get_state(). Please use
the waveform callbacks instead.
> +};
> +
> +static const struct regmap_config pwm_regmap_config = {
> +	.reg_bits   = 32,
> +	.reg_stride = 4,
> +	.val_bits   = 32,
> +	.fast_io    = true,
> +};
> +
> +static int qcom_pwm_parse_dt(struct platform_device *pdev,
> +			     struct pwm_chip *pwm_chip,
> +			     struct qcom_pwm_chip *chip)
> +{
> +	struct device *dev = pwmchip_parent(pwm_chip);
> +	struct device_node *np = pdev->dev.of_node;
> +	struct device_node *frame_node;
> +	void __iomem *base;
> +	unsigned long frame_ids = 0;
> +	int ret;
> +
> +	base = devm_platform_ioremap_resource(pdev, 0);
> +	if (IS_ERR(base))
> +		return PTR_ERR(base);
> +
> +	chip->regmap = devm_regmap_init_mmio(dev, base, &pwm_regmap_config);
> +	if (IS_ERR(chip->regmap))
> +		return dev_err_probe(dev, PTR_ERR(chip->regmap),
> +				"failed to initialise regmap\n");
> +
> +	chip->ahb = devm_clk_get(dev, "ahb");
> +	if (IS_ERR(chip->ahb))
> +		return dev_err_probe(dev, PTR_ERR(chip->ahb),
> +				"failed to get ahb clock\n");
> +
> +	chip->core = devm_clk_get(dev, "core");
> +	if (IS_ERR(chip->core))
> +		return dev_err_probe(dev, PTR_ERR(chip->core),
> +				"failed to get core clock\n");
> +
> +	chip->frames = devm_kcalloc(dev, chip->num_frames,
> +				    sizeof(*chip->frames), GFP_KERNEL);

I think devm_kzalloc_objs is the right function to use here.

> +	if (!chip->frames)
> +		return -ENOMEM;
> +
> +	for_each_available_child_of_node(np, frame_node) {
> +		u32 n;
> +		struct resource res;
> +
> +		if (of_property_read_u32(frame_node, "qcom,frame-index", &n)) {
> +			of_node_put(frame_node);

If you use for_each_available_child_of_node_scoped you don't need to
care about the of_node_put() calls for earch error path.

> +			return dev_err_probe(dev, -EINVAL,
> +					"missing qcom,frame-index property in DT node\n");
> +		}
> +
> +		if (n >= chip->priv_data->max_channels) {
> +			of_node_put(frame_node);
> +			return dev_err_probe(dev, -EINVAL,
> +					"invalid qcom,frame-index %u\n", n);
> +		}
> +
> +		if (test_and_set_bit(n, &frame_ids)) {
> +			of_node_put(frame_node);
> +			return dev_err_probe(dev, -EINVAL,
> +					"duplicate qcom,frame-index %u\n", n);
> +		}
> +
> +		chip->frames[n].frame_id = n;
> +
> +		ret = of_address_to_resource(frame_node, 0, &res);
> +		if (ret) {
> +			of_node_put(frame_node);
> +			return dev_err_probe(dev, ret,
> +					"failed to get frame-%u resource\n", n);
> +		}
> +
> +		base = devm_ioremap_resource(dev, &res);
> +		if (IS_ERR(base)) {
> +			of_node_put(frame_node);
> +			return PTR_ERR(base);
> +		}
> +
> +		chip->frames[n].regmap =
> +			devm_regmap_init_mmio(dev, base, &pwm_regmap_config);
> +		if (IS_ERR(chip->frames[n].regmap)) {
> +			of_node_put(frame_node);
> +			return dev_err_probe(dev, PTR_ERR(chip->frames[n].regmap),
> +						 "failed to initialise frame regmap\n");
> +		}
> +
> +		mutex_init(&chip->frames[n].frame_lock);
> +	}
> +
> +	/* The hardware requires all PWM outputs to be disabled at probe. */
> +	ret = qcom_pwm_clks_enable(chip);
> +	if (ret)
> +		return ret;
> +
> +	ret = regmap_update_bits(chip->regmap, PWM_TOPCTL0,
> +				 GENMASK(chip->priv_data->max_channels - 1, 0), 0);
> +
> +	qcom_pwm_clks_disable(chip);
> +
> +	return ret;
> +}
> +
> +static const struct qcom_pwm_priv_data shikra_pwm_data = {
> +	.max_channels = 10,
> +};

As long as there is only a single variant, just hardcode the info here.

> +static const struct of_device_id qcom_pwm_of_match[] = {
> +	{ .compatible = "qcom,shikra-pwm", .data = &shikra_pwm_data },
> +	{ },

Drop the trailing comma after the list terminator.

> +};
> +MODULE_DEVICE_TABLE(of, qcom_pwm_of_match);
> +
> +static int qcom_pwm_probe(struct platform_device *pdev)
> +{
> +	struct pwm_chip *pwm_chip;
> +	struct qcom_pwm_chip *chip;
> +	const struct qcom_pwm_priv_data *priv;
> +	struct device_node *np = pdev->dev.of_node;
> +	u32 child_count;
> +	int rc;
> +
> +	priv = of_device_get_match_data(&pdev->dev);
> +	if (!priv)
> +		return -EINVAL;
> +
> +	/* At least one available frame resource must be described. */
> +	child_count = of_get_available_child_count(np);
> +	if (!child_count)
> +		return dev_err_probe(&pdev->dev, -EINVAL,
> +				"at least one PWM frame must be described\n");

Error messages start with a capital letter.

> +	pwm_chip = devm_pwmchip_alloc(&pdev->dev, priv->max_channels, sizeof(*chip));
> +	if (IS_ERR(pwm_chip))
> +		return PTR_ERR(pwm_chip);
> +
> +	chip = to_qcom_pwm_chip(pwm_chip);
> +	chip->priv_data  = priv;

Single space before = please

> +	chip->num_frames = priv->max_channels;
> +	mutex_init(&chip->lock);
> +
> +	pwm_chip->ops = &qcom_pwm_ops;
> +
> +	rc = qcom_pwm_parse_dt(pdev, pwm_chip, chip);
> +	if (rc)
> +		return rc;
> +
> +	rc = devm_pwmchip_add(&pdev->dev, pwm_chip);
> +	if (rc)
> +		return rc;
> +
> +	return 0;
> +}
> +
> +static struct platform_driver qcom_pwm_driver = {
> +	.driver		= {
> +		.name		= "qcom-pwm",
> +		.of_match_table	= qcom_pwm_of_match,
> +	},
> +	.probe		= qcom_pwm_probe,

Please use a single space before =.

> +};
> +
> +module_platform_driver(qcom_pwm_driver);
> +
> +MODULE_DESCRIPTION("Qualcomm PWM driver");
> +MODULE_LICENSE("GPL");

Best regards
Uwe

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2026-11-17 14:44 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-16  6:59 [PATCH 0/3] pwm: qcom: add Shikra PWM controller Taniya Das
2026-11-16  6:59 ` [PATCH 1/3] dt-bindings: " Taniya Das
2026-11-16 10:05   ` Krzysztof Kozlowski
2026-11-16  6:59 ` [PATCH 2/3] pwm: qcom: add Shikra PWM controller support Taniya Das
2026-11-17 14:44   ` Uwe Kleine-König
2026-11-16  6:59 ` [PATCH 3/3] arm64: dts: qcom: add Shikra PWM controller Taniya Das

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®