* [PATCH v3 01/10] dt-bindings: clock: qcom: Add bindings for PDM GP_MN clock divider
2026-11-23 19:51 [PATCH v3 00/10] clk: qcom: Add PDM GP_MN fractional clock divider driver and DT support Taniya Das
@ 2026-11-23 19:51 ` Taniya Das
2026-11-24 19:53 ` sashiko-bot
2026-11-23 19:51 ` [PATCH v3 02/10] dt-bindings: clock: qcom: Add PDM XO4 divider clock IDs Taniya Das
` (8 subsequent siblings)
9 siblings, 1 reply; 19+ messages in thread
From: Taniya Das @ 2026-11-23 19:51 UTC (permalink / raw)
To: Bjorn Andersson, Abel Vesa, Stephen Boyd, Brian Masney,
Jerome Brunet, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
Bartosz Golaszewski, Linus Walleij, Richard Cochran,
Konrad Dybcio
Cc: Ajit Pandey, Imran Shaik, Jagadeesh Kona, linux-arm-msm,
linux-clk, devicetree, linux-kernel, linux-gpio, netdev,
Taniya Das
Add device tree bindings for the Qualcomm Peripheral Web's PDM GP_MN
clock divider. The hardware generates a fractional output frequency
from a fixed input clock (typically TCXO4) using the relation
Fout = Fin * (M / N), with duty cycle controlled by a separate D
register. The clock output is routed over a gpio controlled pin.
Signed-off-by: Taniya Das <taniya.das@oss.qualcomm.com>
---
.../bindings/clock/qcom,sc7280-gp-mnd.yaml | 92 ++++++++++++++++++++++
1 file changed, 92 insertions(+)
diff --git a/Documentation/devicetree/bindings/clock/qcom,sc7280-gp-mnd.yaml b/Documentation/devicetree/bindings/clock/qcom,sc7280-gp-mnd.yaml
new file mode 100644
index 0000000000000000000000000000000000000000..76fecc6f7cb376770bfec06f3e1fcafcd480286a
--- /dev/null
+++ b/Documentation/devicetree/bindings/clock/qcom,sc7280-gp-mnd.yaml
@@ -0,0 +1,92 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/clock/qcom,sc7280-gp-mnd.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Qualcomm Peripheral Web's PDM GP_MN Clock Divider
+
+maintainers:
+ - Taniya Das <taniya.das@oss.qualcomm.com>
+
+description: |
+ The Peripheral Web's PDM GP_MN clock divider receives an input clock
+ (TCXO4) with frequency Fin and generates an output clock with
+ frequency Fout = Fin * (M / N) and a duty cycle controlled by D
+ and routed over a gpio pin.
+
+ The divider is configured using three registers:
+
+ - GP_MN_CLK_MDIV: holds the M value.
+ - GP_MN_CLK_NDIV: holds the ones complement of (N - M).
+ - GP_MN_CLK_DUTY: holds the D value.
+
+ For every N input clock cycles the GP_MN produces M output clock
+ cycles. D is the number of native clock cycles in which the GP_MN
+ output is low, counted over 2^13 native clock cycles.
+
+ Hardware constraints:
+
+ M <= 511
+ N <= 8191
+ N > 2 * M
+ M < D < (N - M)
+ M and N must be coprime (no common divisor)
+
+properties:
+ compatible:
+ oneOf:
+ - const: qcom,sc7280-gp-mnd
+ - items:
+ - enum:
+ - qcom,qcs615-gp-mnd
+ - qcom,qcs8300-gp-mnd
+ - qcom,sa8775p-gp-mnd
+ - qcom,shikra-gp-mnd
+ - qcom,sm8750-gp-mnd
+ - const: qcom,sc7280-gp-mnd
+
+ reg:
+ maxItems: 1
+
+ clocks:
+ items:
+ - description: |
+ PDM XO4 source clock. It is derived from the 19.2 MHz TCXO by an
+ integer divider of 1 to 16 programmed on the parent clock (for
+ example via assigned-clock-rates), giving supported input rates
+ from 19200000 Hz (divide by 1) down to 1200000 Hz (divide by 16).
+ - description: PDM AHB bus clock for register access
+
+ clock-names:
+ items:
+ - const: pdm
+ - const: ahb
+
+ '#clock-cells':
+ const: 0
+
+required:
+ - compatible
+ - reg
+ - clocks
+ - clock-names
+ - '#clock-cells'
+
+additionalProperties: false
+
+examples:
+ - |
+ #include <dt-bindings/clock/qcom,gcc-sc7280.h>
+ clock-controller@88d3000 {
+ compatible = "qcom,sc7280-gp-mnd";
+ reg = <0x88d3000 0x1000>;
+ clocks = <&gcc GCC_PDM_XO4_CLK>,
+ <&gcc GCC_PDM_AHB_CLK>;
+ clock-names = "pdm", "ahb";
+ pinctrl-0 = <&gp_mn_pin_active>;
+ pinctrl-names = "default";
+ assigned-clocks = <&gcc GCC_PDM_XO4_CLK>;
+ assigned-clock-rates = <4800000>;
+ #clock-cells = <0>;
+ };
--
2.34.1
^ permalink raw reply related [flat|nested] 19+ messages in thread* [PATCH v3 02/10] dt-bindings: clock: qcom: Add PDM XO4 divider clock IDs
2026-11-23 19:51 [PATCH v3 00/10] clk: qcom: Add PDM GP_MN fractional clock divider driver and DT support Taniya Das
2026-11-23 19:51 ` [PATCH v3 01/10] dt-bindings: clock: qcom: Add bindings for PDM GP_MN clock divider Taniya Das
@ 2026-11-23 19:51 ` Taniya Das
2026-11-23 19:51 ` [PATCH v3 03/10] clk: qcom: Add a driver for PDM GP_MN fractional clock divider Taniya Das
` (7 subsequent siblings)
9 siblings, 0 replies; 19+ messages in thread
From: Taniya Das @ 2026-11-23 19:51 UTC (permalink / raw)
To: Bjorn Andersson, Abel Vesa, Stephen Boyd, Brian Masney,
Jerome Brunet, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
Bartosz Golaszewski, Linus Walleij, Richard Cochran,
Konrad Dybcio
Cc: Ajit Pandey, Imran Shaik, Jagadeesh Kona, linux-arm-msm,
linux-clk, devicetree, linux-kernel, linux-gpio, netdev,
Taniya Das, Krzysztof Kozlowski
Add clock IDs for the PDM XO4 divider sources on QCS615, QCS8300,
SA8775P, SC7280, SM8750, and Shikra. The corresponding GCC drivers use
these IDs to register the divider clocks.
Acked-by: Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com>
Signed-off-by: Taniya Das <taniya.das@oss.qualcomm.com>
---
include/dt-bindings/clock/qcom,gcc-sc7280.h | 1 +
include/dt-bindings/clock/qcom,qcs615-gcc.h | 2 ++
include/dt-bindings/clock/qcom,qcs8300-gcc.h | 1 +
include/dt-bindings/clock/qcom,sa8775p-gcc.h | 1 +
include/dt-bindings/clock/qcom,shikra-gcc.h | 1 +
include/dt-bindings/clock/qcom,sm8750-gcc.h | 1 +
6 files changed, 7 insertions(+)
diff --git a/include/dt-bindings/clock/qcom,gcc-sc7280.h b/include/dt-bindings/clock/qcom,gcc-sc7280.h
index 3d5724b79bff18a858bdbb5c1654c5174e8cb23b..68dfd6616ce4b1c1e41f11603be639685301129f 100644
--- a/include/dt-bindings/clock/qcom,gcc-sc7280.h
+++ b/include/dt-bindings/clock/qcom,gcc-sc7280.h
@@ -192,6 +192,7 @@
#define GCC_WPSS_RSCP_CLK 182
#define GCC_EDP_CLKREF_EN 183
#define GCC_SEC_CTRL_CLK_SRC 184
+#define GCC_PDM_XO4_DIV_CLK_SRC 185
/* GCC power domains */
#define GCC_PCIE_0_GDSC 0
diff --git a/include/dt-bindings/clock/qcom,qcs615-gcc.h b/include/dt-bindings/clock/qcom,qcs615-gcc.h
index 9704091636b87108a2a8c5ccc4a6b293829d8272..cddf21466a96a2990f1aaaf7c655fa6a4369ccbd 100644
--- a/include/dt-bindings/clock/qcom,qcs615-gcc.h
+++ b/include/dt-bindings/clock/qcom,qcs615-gcc.h
@@ -175,6 +175,8 @@
#define GCC_UFS_PHY_PHY_AUX_HW_CTL_CLK 165
#define GCC_UFS_PHY_UNIPRO_CORE_HW_CTL_CLK 166
+#define GCC_PDM_XO4_DIV_CLK_SRC 167
+
/* GCC Resets */
#define GCC_EMAC_BCR 0
#define GCC_QUSB2PHY_PRIM_BCR 1
diff --git a/include/dt-bindings/clock/qcom,qcs8300-gcc.h b/include/dt-bindings/clock/qcom,qcs8300-gcc.h
index 3c674c7baaba91815b13450e647b41053bd7330d..cee26f50092044f4a0b4cead6f669f0ccf7343c0 100644
--- a/include/dt-bindings/clock/qcom,qcs8300-gcc.h
+++ b/include/dt-bindings/clock/qcom,qcs8300-gcc.h
@@ -196,6 +196,7 @@
#define GCC_TSCSS_CNTR_CLK_SRC 186
#define GCC_TSCSS_ETU_CLK 187
#define GCC_TSCSS_GLOBAL_CNTR_CLK 188
+#define GCC_PDM_XO4_DIV_CLK_SRC 189
/* GCC power domains */
#define GCC_EMAC0_GDSC 0
diff --git a/include/dt-bindings/clock/qcom,sa8775p-gcc.h b/include/dt-bindings/clock/qcom,sa8775p-gcc.h
index 01f54234963d6a531926103f8658307d4e0662f2..e101c9b565d650495e63f5f97b3458375d0e85ec 100644
--- a/include/dt-bindings/clock/qcom,sa8775p-gcc.h
+++ b/include/dt-bindings/clock/qcom,sa8775p-gcc.h
@@ -257,6 +257,7 @@
#define GCC_UFS_PHY_ICE_CORE_HW_CTL_CLK 246
#define GCC_UFS_PHY_PHY_AUX_HW_CTL_CLK 247
#define GCC_UFS_PHY_UNIPRO_CORE_HW_CTL_CLK 248
+#define GCC_PDM_XO4_DIV_CLK_SRC 249
/* GCC resets */
#define GCC_CAMERA_BCR 0
diff --git a/include/dt-bindings/clock/qcom,shikra-gcc.h b/include/dt-bindings/clock/qcom,shikra-gcc.h
index 656c959c7e1251ed9af8fd04285fe616dfe9ecdc..31d381ee5c2298127b060935de60a425a0572b67 100644
--- a/include/dt-bindings/clock/qcom,shikra-gcc.h
+++ b/include/dt-bindings/clock/qcom,shikra-gcc.h
@@ -222,6 +222,7 @@
#define GCC_VIDEO_VENUS_CLK_SRC 212
#define GCC_VIDEO_VENUS_CTL_CLK 213
#define GCC_VIDEO_XO_CLK 214
+#define GCC_PDM_XO4_DIV_CLK_SRC 215
/* GCC power domains */
#define GCC_CAMSS_TOP_GDSC 0
diff --git a/include/dt-bindings/clock/qcom,sm8750-gcc.h b/include/dt-bindings/clock/qcom,sm8750-gcc.h
index e234595d7f42d60291d60d7dcae6c6c8cb9b9925..cb2f40a704cf82d668577836b2a8d5756c1e7642 100644
--- a/include/dt-bindings/clock/qcom,sm8750-gcc.h
+++ b/include/dt-bindings/clock/qcom,sm8750-gcc.h
@@ -178,6 +178,7 @@
#define GCC_VIDEO_AXI0_CLK 168
#define GCC_VIDEO_AXI1_CLK 169
#define GCC_VIDEO_XO_CLK 170
+#define GCC_PDM_XO4_DIV_CLK_SRC 171
/* GCC power domains */
#define GCC_PCIE_0_GDSC 0
--
2.34.1
^ permalink raw reply related [flat|nested] 19+ messages in thread* [PATCH v3 03/10] clk: qcom: Add a driver for PDM GP_MN fractional clock divider
2026-11-23 19:51 [PATCH v3 00/10] clk: qcom: Add PDM GP_MN fractional clock divider driver and DT support Taniya Das
2026-11-23 19:51 ` [PATCH v3 01/10] dt-bindings: clock: qcom: Add bindings for PDM GP_MN clock divider Taniya Das
2026-11-23 19:51 ` [PATCH v3 02/10] dt-bindings: clock: qcom: Add PDM XO4 divider clock IDs Taniya Das
@ 2026-11-23 19:51 ` Taniya Das
2026-11-24 5:54 ` Abel Vesa
2026-11-23 19:51 ` [PATCH v3 04/10] clk: qcom: gcc: Add configurable PDM XO4 div clocks across targets Taniya Das
` (6 subsequent siblings)
9 siblings, 1 reply; 19+ messages in thread
From: Taniya Das @ 2026-11-23 19:51 UTC (permalink / raw)
To: Bjorn Andersson, Abel Vesa, Stephen Boyd, Brian Masney,
Jerome Brunet, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
Bartosz Golaszewski, Linus Walleij, Richard Cochran,
Konrad Dybcio
Cc: Ajit Pandey, Imran Shaik, Jagadeesh Kona, linux-arm-msm,
linux-clk, devicetree, linux-kernel, linux-gpio, netdev,
Taniya Das
The PDM (Pulse Density Modulation) hardware block on Qualcomm SoCs
contains a GP_MN clock divider that produces a fractional output
frequency from a fixed input clock (typically TCXO4):
Fout = Fin * (M / N)
The hardware encodes the period in the NDIV register as the 1's
complement of (N - M), and controls the duty cycle via a separate
DUTY register that counts the number of low-phase native clock
cycles over the period N.
Add a standalone platform driver for this block that uses
rational_best_approximation() to find the closest M/N pair within
the 9-bit M and 13-bit N hardware limits. Reject ratios which cannot
support a valid duty cycle, and program the MDIV, NDIV, and DUTY
registers via regmap. Implement determine_rate, set_rate,
recalc_rate, get_duty_cycle, and set_duty_cycle operations. The PDM
AHB bus clock is gated around every register access.
Signed-off-by: Taniya Das <taniya.das@oss.qualcomm.com>
---
drivers/clk/qcom/Kconfig | 15 ++
drivers/clk/qcom/Makefile | 1 +
drivers/clk/qcom/clk-gp-mnd.c | 342 ++++++++++++++++++++++++++++++++++++++++++
3 files changed, 358 insertions(+)
diff --git a/drivers/clk/qcom/Kconfig b/drivers/clk/qcom/Kconfig
index e6c58e8b184963fa3d885a7661ad982aaa5bcbc0..ccab70a11cfcaa3ea2217101ade50ab255631837 100644
--- a/drivers/clk/qcom/Kconfig
+++ b/drivers/clk/qcom/Kconfig
@@ -2170,4 +2170,19 @@ config SM_VIDEOCC_8450
SM8450 or SM8475 devices.
Say Y if you want to support video devices and functionality such as
video encode/decode.
+
+config QCOM_CLK_GP_MND
+ tristate "Qualcomm PDM GP_MN clock divider"
+ depends on ARM64 || COMPILE_TEST
+ help
+ Support for the Qualcomm PDM GP_MN clock divider found in PDM
+ (Pulse Density Modulation) hardware blocks.
+ Given an input clock of frequency Fin (TCXO4), the output
+ frequency is Fout = Fin * (M / N). For every N input cycles
+ the divider produces M output cycles. D controls the duty
+ cycle: it is the number of native clock cycles in which the
+ GP_MN output is low, counted over 8192 native clock cycles.
+
+ Say Y or M if you want to support GP_MN-based frequency and
+ duty-cycle configuration on Qualcomm SoCs.
endif
diff --git a/drivers/clk/qcom/Makefile b/drivers/clk/qcom/Makefile
index f84d7343a3a475dd9ef1fa77bf0de25fab0d9e75..bc487b25ef5d9a235162fad95a3e0ef2984564f3 100644
--- a/drivers/clk/qcom/Makefile
+++ b/drivers/clk/qcom/Makefile
@@ -229,6 +229,7 @@ obj-$(CONFIG_SM_VIDEOCC_8550) += videocc-sm8550.o
obj-$(CONFIG_SM_VIDEOCC_8750) += videocc-sm8750.o
obj-$(CONFIG_SM_VIDEOCC_MILOS) += videocc-milos.o
obj-$(CONFIG_SPMI_PMIC_CLKDIV) += clk-spmi-pmic-div.o
+obj-$(CONFIG_QCOM_CLK_GP_MND) += clk-gp-mnd.o
obj-$(CONFIG_KPSS_XCC) += kpss-xcc.o
obj-$(CONFIG_QCOM_HFPLL) += hfpll.o
obj-$(CONFIG_KRAITCC) += krait-cc.o
diff --git a/drivers/clk/qcom/clk-gp-mnd.c b/drivers/clk/qcom/clk-gp-mnd.c
new file mode 100644
index 0000000000000000000000000000000000000000..75d620166e8dc044afb08d014f9707e9b53e8e31
--- /dev/null
+++ b/drivers/clk/qcom/clk-gp-mnd.c
@@ -0,0 +1,342 @@
+// SPDX-License-Identifier: GPL-2.0-only
+/*
+ * Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.
+ */
+
+#include <linux/clk.h>
+#include <linux/clk-provider.h>
+#include <linux/module.h>
+#include <linux/platform_device.h>
+#include <linux/pm_clock.h>
+#include <linux/pm_runtime.h>
+#include <linux/rational.h>
+#include <linux/regmap.h>
+
+/*
+ * PDM GP_MND clock divider register offsets.
+ *
+ * The hardware computes:
+ * Fout = Fin * (M / N)
+ *
+ * with duty cycle controlled by D, where M < D < (N - M).
+ *
+ * Register encoding:
+ * MDIV = M
+ * NDIV = ~(N - M) [1's complement of (N - M), masked to N_REG_WIDTH bits]
+ * DUTY = D
+ */
+#define GP_MND_MDIV_REG 0x0
+#define GP_MND_NDIV_REG 0x4
+#define GP_MND_DUTY_REG 0x8
+
+#define GP_MND_M_WIDTH 9
+#define GP_MND_N_WIDTH 13
+
+#define GP_MND_MAX_M GENMASK(GP_MND_M_WIDTH - 1, 0)
+#define GP_MND_MAX_N GENMASK(GP_MND_N_WIDTH - 1, 0)
+
+/**
+ * struct clk_gp_mnd - GP_MND fractional clock divider
+ * @dev: device for runtime PM
+ * @regmap: register map for the PDM block
+ * @hw: handle between common and hardware-specific interfaces
+ * @m_val: M value (numerator)
+ * @n_val: N value (period)
+ */
+struct clk_gp_mnd {
+ struct device *dev;
+ struct regmap *regmap;
+ struct clk_hw hw;
+ unsigned int m_val;
+ unsigned int n_val;
+};
+
+#define to_clk_gp_mnd(_hw) container_of(_hw, struct clk_gp_mnd, hw)
+
+static int gp_mnd_clk_runtime_resume(struct clk_gp_mnd *gp)
+{
+ return pm_runtime_resume_and_get(gp->dev);
+}
+
+static void gp_mnd_clk_runtime_put(struct clk_gp_mnd *gp)
+{
+ pm_runtime_put(gp->dev);
+}
+
+static int gp_mnd_clk_determine_rate(struct clk_hw *hw,
+ struct clk_rate_request *req)
+{
+ unsigned long m = 0, n = 0;
+
+ rational_best_approximation(req->rate, req->best_parent_rate,
+ (unsigned long)GP_MND_MAX_M,
+ (unsigned long)GP_MND_MAX_N,
+ &m, &n);
+ if (!m || !n)
+ return -EINVAL;
+
+ if (n <= 2 * m + 1)
+ return -EINVAL;
+
+ req->rate = DIV_ROUND_CLOSEST_ULL((u64)req->best_parent_rate * m, n);
+
+ return 0;
+}
+
+static int gp_mnd_clk_set_rate(struct clk_hw *hw, unsigned long rate,
+ unsigned long parent_rate)
+{
+ struct clk_gp_mnd *gp = to_clk_gp_mnd(hw);
+ unsigned long m = 0, n = 0;
+ unsigned int d_val, n_val;
+ int ret;
+
+ rational_best_approximation(rate, parent_rate,
+ (unsigned long)GP_MND_MAX_M,
+ (unsigned long)GP_MND_MAX_N,
+ &m, &n);
+ if (!m || !n)
+ return -EINVAL;
+
+ if (n <= 2 * m + 1)
+ return -EINVAL;
+
+ ret = gp_mnd_clk_runtime_resume(gp);
+ if (ret)
+ return ret;
+
+ ret = regmap_write(gp->regmap, GP_MND_MDIV_REG, m);
+ if (ret)
+ goto err_runtime_put;
+
+ /* N divider holds the 1's complement of (N - M), N_WIDTH bits wide */
+ n_val = ~(n - m) & GP_MND_MAX_N;
+ ret = regmap_write(gp->regmap, GP_MND_NDIV_REG, n_val);
+ if (ret)
+ goto err_runtime_put;
+
+ /* Program the closest-to-50% duty cycle. */
+ d_val = n / 2;
+ ret = regmap_write(gp->regmap, GP_MND_DUTY_REG, d_val);
+ if (ret)
+ goto err_runtime_put;
+
+ gp->m_val = m;
+ gp->n_val = n;
+
+err_runtime_put:
+ gp_mnd_clk_runtime_put(gp);
+
+ return ret;
+}
+
+static unsigned long gp_mnd_clk_recalc_rate(struct clk_hw *hw,
+ unsigned long parent_rate)
+{
+ struct clk_gp_mnd *gp = to_clk_gp_mnd(hw);
+ unsigned int m_val, n_val;
+ int ret;
+
+ ret = gp_mnd_clk_runtime_resume(gp);
+ if (ret)
+ return 0;
+
+ ret = regmap_read(gp->regmap, GP_MND_MDIV_REG, &m_val);
+ if (ret)
+ goto out_runtime_put;
+
+ m_val &= GP_MND_MAX_M;
+
+ ret = regmap_read(gp->regmap, GP_MND_NDIV_REG, &n_val);
+ if (ret)
+ goto out_runtime_put;
+
+ /* Reverse the 1's complement encoding: N = ~NDIV_REG + M */
+ n_val = (~n_val & GP_MND_MAX_N) + m_val;
+
+out_runtime_put:
+ gp_mnd_clk_runtime_put(gp);
+
+ if (ret)
+ return 0;
+
+ /*
+ * At power-on the divider registers read back as zero (M = 0), which
+ * the 1's complement encoding would turn into a bogus N = 8191. Treat
+ * an unconfigured divider as rate 0 and leave the cached M/N cleared so
+ * the 50% duty-cycle default path in get_duty_cycle() stays valid.
+ */
+ if (!m_val || !n_val) {
+ gp->m_val = 0;
+ gp->n_val = 0;
+ return 0;
+ }
+
+ gp->m_val = m_val;
+ gp->n_val = n_val;
+
+ return DIV_ROUND_CLOSEST_ULL((u64)parent_rate * m_val, n_val);
+}
+
+static int gp_mnd_clk_get_duty_cycle(struct clk_hw *hw, struct clk_duty *duty)
+{
+ struct clk_gp_mnd *gp = to_clk_gp_mnd(hw);
+ unsigned int d_val;
+ int ret;
+
+ if (!gp->n_val) {
+ duty->num = 1;
+ duty->den = 2;
+ return 0;
+ }
+
+ ret = gp_mnd_clk_runtime_resume(gp);
+ if (ret)
+ return ret;
+
+ ret = regmap_read(gp->regmap, GP_MND_DUTY_REG, &d_val);
+
+ gp_mnd_clk_runtime_put(gp);
+
+ if (ret)
+ return ret;
+
+ if (d_val >= gp->n_val)
+ return -EINVAL;
+
+ /* DUTY stores the low-phase count; report the high-phase duty cycle. */
+ duty->num = gp->n_val - d_val;
+ duty->den = gp->n_val;
+
+ return 0;
+}
+
+static int gp_mnd_clk_set_duty_cycle(struct clk_hw *hw, struct clk_duty *duty)
+{
+ struct clk_gp_mnd *gp = to_clk_gp_mnd(hw);
+ unsigned int d_val;
+ int ret;
+
+ if (!gp->n_val || !gp->m_val || !duty->den || duty->num > duty->den)
+ return -EINVAL;
+
+ /* D = (1 - duty) * N, giving the low-phase count */
+ d_val = DIV_ROUND_UP_ULL((u64)(duty->den - duty->num) * gp->n_val, duty->den);
+
+ /* Hardware constraint: M < D < (N - M) */
+ if (d_val <= gp->m_val || d_val >= (gp->n_val - gp->m_val))
+ return -EINVAL;
+
+ ret = gp_mnd_clk_runtime_resume(gp);
+ if (ret)
+ return ret;
+
+ ret = regmap_write(gp->regmap, GP_MND_DUTY_REG, d_val);
+
+ gp_mnd_clk_runtime_put(gp);
+
+ return ret;
+}
+
+static const struct clk_ops clk_gp_mnd_ops = {
+ .determine_rate = gp_mnd_clk_determine_rate,
+ .set_rate = gp_mnd_clk_set_rate,
+ .recalc_rate = gp_mnd_clk_recalc_rate,
+ .get_duty_cycle = gp_mnd_clk_get_duty_cycle,
+ .set_duty_cycle = gp_mnd_clk_set_duty_cycle,
+};
+
+static const struct regmap_config gp_mnd_regmap_config = {
+ .reg_bits = 32,
+ .reg_stride = 4,
+ .val_bits = 32,
+ .fast_io = true,
+};
+
+static int clk_gp_mnd_probe(struct platform_device *pdev)
+{
+ struct clk_parent_data parent_data = { .index = 0 };
+ struct clk_init_data init = {
+ .name = "gp_mn_clk",
+ .ops = &clk_gp_mnd_ops,
+ .parent_data = &parent_data,
+ .num_parents = 1,
+ .flags = CLK_GET_RATE_NOCACHE,
+ };
+ struct device *dev = &pdev->dev;
+ struct clk_gp_mnd *gp;
+ struct clk *clk;
+ void __iomem *base;
+ int ret;
+
+ gp = devm_kzalloc(dev, sizeof(*gp), GFP_KERNEL);
+ if (!gp)
+ return -ENOMEM;
+
+ gp->dev = dev;
+
+ ret = devm_pm_runtime_enable(dev);
+ if (ret)
+ return ret;
+
+ ret = devm_pm_clk_create(dev);
+ if (ret)
+ return ret;
+
+ ret = pm_clk_add(dev, "ahb");
+ if (ret)
+ return dev_err_probe(dev, ret, "failed to get ahb clock\n");
+
+ clk = devm_clk_get(dev, "pdm");
+ if (IS_ERR(clk))
+ return PTR_ERR(clk);
+
+ /* Set default rate if not already configured */
+ if (!clk_get_rate(clk)) {
+ ret = clk_set_rate(clk, 19200000);
+ if (ret)
+ dev_warn(dev, "failed to set default pdm clock rate\n");
+ }
+
+ base = devm_platform_ioremap_resource(pdev, 0);
+ if (IS_ERR(base))
+ return dev_err_probe(dev, PTR_ERR(base),
+ "failed to map PDM registers\n");
+
+ gp->regmap = devm_regmap_init_mmio(dev, base, &gp_mnd_regmap_config);
+ if (IS_ERR(gp->regmap))
+ return dev_err_probe(dev, PTR_ERR(gp->regmap),
+ "failed to init regmap\n");
+
+ gp->hw.init = &init;
+
+ ret = devm_clk_hw_register(dev, &gp->hw);
+ if (ret)
+ return dev_err_probe(dev, ret,
+ "failed to register gp_mnd clock\n");
+
+ return devm_of_clk_add_hw_provider(dev, of_clk_hw_simple_get, &gp->hw);
+}
+
+static const struct of_device_id clk_gp_mnd_match_table[] = {
+ { .compatible = "qcom,sc7280-gp-mnd" },
+ { }
+};
+MODULE_DEVICE_TABLE(of, clk_gp_mnd_match_table);
+
+static const struct dev_pm_ops clk_gp_mnd_pm_ops = {
+ SET_RUNTIME_PM_OPS(pm_clk_suspend, pm_clk_resume, NULL)
+};
+
+static struct platform_driver clk_gp_mnd_driver = {
+ .probe = clk_gp_mnd_probe,
+ .driver = {
+ .name = "qcom-clk-gp-mnd",
+ .of_match_table = clk_gp_mnd_match_table,
+ .pm = pm_ptr(&clk_gp_mnd_pm_ops),
+ },
+};
+module_platform_driver(clk_gp_mnd_driver);
+
+MODULE_DESCRIPTION("Qualcomm PDM GP_MND clock divider driver");
+MODULE_LICENSE("GPL");
--
2.34.1
^ permalink raw reply related [flat|nested] 19+ messages in thread* Re: [PATCH v3 03/10] clk: qcom: Add a driver for PDM GP_MN fractional clock divider
2026-11-23 19:51 ` [PATCH v3 03/10] clk: qcom: Add a driver for PDM GP_MN fractional clock divider Taniya Das
@ 2026-11-24 5:54 ` Abel Vesa
0 siblings, 0 replies; 19+ messages in thread
From: Abel Vesa @ 2026-11-24 5:54 UTC (permalink / raw)
To: Taniya Das
Cc: Bjorn Andersson, Abel Vesa, Stephen Boyd, Brian Masney,
Jerome Brunet, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
Bartosz Golaszewski, Linus Walleij, Richard Cochran,
Konrad Dybcio, Ajit Pandey, Imran Shaik, Jagadeesh Kona,
linux-arm-msm, linux-clk, devicetree, linux-kernel, linux-gpio,
netdev
On 26-11-24 01:21:34, Taniya Das wrote:
> The PDM (Pulse Density Modulation) hardware block on Qualcomm SoCs
> contains a GP_MN clock divider that produces a fractional output
> frequency from a fixed input clock (typically TCXO4):
>
> Fout = Fin * (M / N)
>
> The hardware encodes the period in the NDIV register as the 1's
> complement of (N - M), and controls the duty cycle via a separate
> DUTY register that counts the number of low-phase native clock
> cycles over the period N.
>
> Add a standalone platform driver for this block that uses
> rational_best_approximation() to find the closest M/N pair within
> the 9-bit M and 13-bit N hardware limits. Reject ratios which cannot
> support a valid duty cycle, and program the MDIV, NDIV, and DUTY
> registers via regmap. Implement determine_rate, set_rate,
> recalc_rate, get_duty_cycle, and set_duty_cycle operations. The PDM
> AHB bus clock is gated around every register access.
>
> Signed-off-by: Taniya Das <taniya.das@oss.qualcomm.com>
> ---
> drivers/clk/qcom/Kconfig | 15 ++
> drivers/clk/qcom/Makefile | 1 +
> drivers/clk/qcom/clk-gp-mnd.c | 342 ++++++++++++++++++++++++++++++++++++++++++
> 3 files changed, 358 insertions(+)
>
> diff --git a/drivers/clk/qcom/Kconfig b/drivers/clk/qcom/Kconfig
> index e6c58e8b184963fa3d885a7661ad982aaa5bcbc0..ccab70a11cfcaa3ea2217101ade50ab255631837 100644
> --- a/drivers/clk/qcom/Kconfig
> +++ b/drivers/clk/qcom/Kconfig
> @@ -2170,4 +2170,19 @@ config SM_VIDEOCC_8450
> SM8450 or SM8475 devices.
> Say Y if you want to support video devices and functionality such as
> video encode/decode.
> +
> +config QCOM_CLK_GP_MND
> + tristate "Qualcomm PDM GP_MN clock divider"
> + depends on ARM64 || COMPILE_TEST
> + help
> + Support for the Qualcomm PDM GP_MN clock divider found in PDM
> + (Pulse Density Modulation) hardware blocks.
> + Given an input clock of frequency Fin (TCXO4), the output
> + frequency is Fout = Fin * (M / N). For every N input cycles
> + the divider produces M output cycles. D controls the duty
> + cycle: it is the number of native clock cycles in which the
> + GP_MN output is low, counted over 8192 native clock cycles.
> +
> + Say Y or M if you want to support GP_MN-based frequency and
> + duty-cycle configuration on Qualcomm SoCs.
> endif
> diff --git a/drivers/clk/qcom/Makefile b/drivers/clk/qcom/Makefile
> index f84d7343a3a475dd9ef1fa77bf0de25fab0d9e75..bc487b25ef5d9a235162fad95a3e0ef2984564f3 100644
> --- a/drivers/clk/qcom/Makefile
> +++ b/drivers/clk/qcom/Makefile
> @@ -229,6 +229,7 @@ obj-$(CONFIG_SM_VIDEOCC_8550) += videocc-sm8550.o
> obj-$(CONFIG_SM_VIDEOCC_8750) += videocc-sm8750.o
> obj-$(CONFIG_SM_VIDEOCC_MILOS) += videocc-milos.o
> obj-$(CONFIG_SPMI_PMIC_CLKDIV) += clk-spmi-pmic-div.o
> +obj-$(CONFIG_QCOM_CLK_GP_MND) += clk-gp-mnd.o
> obj-$(CONFIG_KPSS_XCC) += kpss-xcc.o
> obj-$(CONFIG_QCOM_HFPLL) += hfpll.o
> obj-$(CONFIG_KRAITCC) += krait-cc.o
> diff --git a/drivers/clk/qcom/clk-gp-mnd.c b/drivers/clk/qcom/clk-gp-mnd.c
> new file mode 100644
> index 0000000000000000000000000000000000000000..75d620166e8dc044afb08d014f9707e9b53e8e31
> --- /dev/null
> +++ b/drivers/clk/qcom/clk-gp-mnd.c
> @@ -0,0 +1,342 @@
> +// SPDX-License-Identifier: GPL-2.0-only
> +/*
> + * Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.
> + */
> +
> +#include <linux/clk.h>
> +#include <linux/clk-provider.h>
> +#include <linux/module.h>
> +#include <linux/platform_device.h>
> +#include <linux/pm_clock.h>
> +#include <linux/pm_runtime.h>
> +#include <linux/rational.h>
> +#include <linux/regmap.h>
> +
[...]
> + ret = pm_clk_add(dev, "ahb");
> + if (ret)
> + return dev_err_probe(dev, ret, "failed to get ahb clock\n");
> +
> + clk = devm_clk_get(dev, "pdm");
> + if (IS_ERR(clk))
> + return PTR_ERR(clk);
> +
> + /* Set default rate if not already configured */
> + if (!clk_get_rate(clk)) {
> + ret = clk_set_rate(clk, 19200000);
> + if (ret)
> + dev_warn(dev, "failed to set default pdm clock rate\n");
> + }
Why are we setting the parent clock rate from here ?
And then we just don't do anything with it.
I think this bypasses CCF clock tree and that's not good.
> +
> + base = devm_platform_ioremap_resource(pdev, 0);
> + if (IS_ERR(base))
> + return dev_err_probe(dev, PTR_ERR(base),
> + "failed to map PDM registers\n");
> +
> + gp->regmap = devm_regmap_init_mmio(dev, base, &gp_mnd_regmap_config);
> + if (IS_ERR(gp->regmap))
> + return dev_err_probe(dev, PTR_ERR(gp->regmap),
> + "failed to init regmap\n");
> +
> + gp->hw.init = &init;
> +
> + ret = devm_clk_hw_register(dev, &gp->hw);
> + if (ret)
> + return dev_err_probe(dev, ret,
> + "failed to register gp_mnd clock\n");
> +
> + return devm_of_clk_add_hw_provider(dev, of_clk_hw_simple_get, &gp->hw);
> +}
> +
[...]
^ permalink raw reply [flat|nested] 19+ messages in thread
* [PATCH v3 04/10] clk: qcom: gcc: Add configurable PDM XO4 div clocks across targets
2026-11-23 19:51 [PATCH v3 00/10] clk: qcom: Add PDM GP_MN fractional clock divider driver and DT support Taniya Das
` (2 preceding siblings ...)
2026-11-23 19:51 ` [PATCH v3 03/10] clk: qcom: Add a driver for PDM GP_MN fractional clock divider Taniya Das
@ 2026-11-23 19:51 ` Taniya Das
2026-11-23 19:51 ` [PATCH v3 05/10] arm64: dts: qcom: qcs8300: Add GP M/N clock controller Taniya Das
` (5 subsequent siblings)
9 siblings, 0 replies; 19+ messages in thread
From: Taniya Das @ 2026-11-23 19:51 UTC (permalink / raw)
To: Bjorn Andersson, Abel Vesa, Stephen Boyd, Brian Masney,
Jerome Brunet, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
Bartosz Golaszewski, Linus Walleij, Richard Cochran,
Konrad Dybcio
Cc: Ajit Pandey, Imran Shaik, Jagadeesh Kona, linux-arm-msm,
linux-clk, devicetree, linux-kernel, linux-gpio, netdev,
Taniya Das, Abel Vesa
Add PDM XO4 divider clocks and make the PDM XO4 branches propagate rate
requests to them on QCS615, QCS8300, SA8775P, SC7280, SM8750, and
Shikra. This lets GP_MND select the supported PDM source clock rates.
Reviewed-by: Abel Vesa <abel.vesa@oss.qualcomm.com>
Signed-off-by: Taniya Das <taniya.das@oss.qualcomm.com>
---
drivers/clk/qcom/gcc-qcs615.c | 20 ++++++++++++++++++++
drivers/clk/qcom/gcc-qcs8300.c | 20 ++++++++++++++++++++
drivers/clk/qcom/gcc-sa8775p.c | 20 ++++++++++++++++++++
drivers/clk/qcom/gcc-sc7280.c | 20 ++++++++++++++++++++
drivers/clk/qcom/gcc-shikra.c | 20 ++++++++++++++++++++
drivers/clk/qcom/gcc-sm8750.c | 20 ++++++++++++++++++++
6 files changed, 120 insertions(+)
diff --git a/drivers/clk/qcom/gcc-qcs615.c b/drivers/clk/qcom/gcc-qcs615.c
index f205de3a936170413b21173c7af9668c14495369..f70d6bc25b0432aebb1c33f3f7ea3b7b2062ff8b 100644
--- a/drivers/clk/qcom/gcc-qcs615.c
+++ b/drivers/clk/qcom/gcc-qcs615.c
@@ -1656,6 +1656,20 @@ static struct clk_branch gcc_pdm_ahb_clk = {
},
};
+static struct clk_regmap_div gcc_pdm_xo4_div_clk_src = {
+ .reg = 0x33028,
+ .shift = 0,
+ .width = 4,
+ .clkr.hw.init = &(const struct clk_init_data) {
+ .name = "gcc_pdm_xo4_div_clk_src",
+ .parent_data = &(const struct clk_parent_data){
+ .index = DT_BI_TCXO,
+ },
+ .num_parents = 1,
+ .ops = &clk_regmap_div_ops,
+ },
+};
+
static struct clk_branch gcc_pdm_xo4_clk = {
.halt_reg = 0x33008,
.halt_check = BRANCH_HALT,
@@ -1664,6 +1678,11 @@ static struct clk_branch gcc_pdm_xo4_clk = {
.enable_mask = BIT(0),
.hw.init = &(const struct clk_init_data) {
.name = "gcc_pdm_xo4_clk",
+ .parent_hws = (const struct clk_hw*[]) {
+ &gcc_pdm_xo4_div_clk_src.clkr.hw,
+ },
+ .num_parents = 1,
+ .flags = CLK_SET_RATE_PARENT,
.ops = &clk_branch2_ops,
},
},
@@ -2804,6 +2823,7 @@ static struct clk_regmap *gcc_qcs615_clocks[] = {
[GCC_PDM2_CLK_SRC] = &gcc_pdm2_clk_src.clkr,
[GCC_PDM_AHB_CLK] = &gcc_pdm_ahb_clk.clkr,
[GCC_PDM_XO4_CLK] = &gcc_pdm_xo4_clk.clkr,
+ [GCC_PDM_XO4_DIV_CLK_SRC] = &gcc_pdm_xo4_div_clk_src.clkr,
[GCC_PRNG_AHB_CLK] = &gcc_prng_ahb_clk.clkr,
[GCC_QMIP_CAMERA_NRT_AHB_CLK] = &gcc_qmip_camera_nrt_ahb_clk.clkr,
[GCC_QMIP_DISP_AHB_CLK] = &gcc_qmip_disp_ahb_clk.clkr,
diff --git a/drivers/clk/qcom/gcc-qcs8300.c b/drivers/clk/qcom/gcc-qcs8300.c
index 916617a001c854c1a0349c1793a427a2822acfab..4a152e95aa997bdcc7ec56a6ae96c61b3575cd88 100644
--- a/drivers/clk/qcom/gcc-qcs8300.c
+++ b/drivers/clk/qcom/gcc-qcs8300.c
@@ -2280,6 +2280,20 @@ static struct clk_branch gcc_pdm_ahb_clk = {
},
};
+static struct clk_regmap_div gcc_pdm_xo4_div_clk_src = {
+ .reg = 0x3f028,
+ .shift = 0,
+ .width = 4,
+ .clkr.hw.init = &(const struct clk_init_data) {
+ .name = "gcc_pdm_xo4_div_clk_src",
+ .parent_data = &(const struct clk_parent_data){
+ .index = DT_BI_TCXO,
+ },
+ .num_parents = 1,
+ .ops = &clk_regmap_div_ops,
+ },
+};
+
static struct clk_branch gcc_pdm_xo4_clk = {
.halt_reg = 0x3f008,
.halt_check = BRANCH_HALT,
@@ -2288,6 +2302,11 @@ static struct clk_branch gcc_pdm_xo4_clk = {
.enable_mask = BIT(0),
.hw.init = &(const struct clk_init_data) {
.name = "gcc_pdm_xo4_clk",
+ .parent_hws = (const struct clk_hw*[]) {
+ &gcc_pdm_xo4_div_clk_src.clkr.hw,
+ },
+ .num_parents = 1,
+ .flags = CLK_SET_RATE_PARENT,
.ops = &clk_branch2_ops,
},
},
@@ -3501,6 +3520,7 @@ static struct clk_regmap *gcc_qcs8300_clocks[] = {
[GCC_PDM2_CLK_SRC] = &gcc_pdm2_clk_src.clkr,
[GCC_PDM_AHB_CLK] = &gcc_pdm_ahb_clk.clkr,
[GCC_PDM_XO4_CLK] = &gcc_pdm_xo4_clk.clkr,
+ [GCC_PDM_XO4_DIV_CLK_SRC] = &gcc_pdm_xo4_div_clk_src.clkr,
[GCC_QMIP_CAMERA_NRT_AHB_CLK] = &gcc_qmip_camera_nrt_ahb_clk.clkr,
[GCC_QMIP_CAMERA_RT_AHB_CLK] = &gcc_qmip_camera_rt_ahb_clk.clkr,
[GCC_QMIP_DISP_AHB_CLK] = &gcc_qmip_disp_ahb_clk.clkr,
diff --git a/drivers/clk/qcom/gcc-sa8775p.c b/drivers/clk/qcom/gcc-sa8775p.c
index 47acd1b58f13037576888a860c58b6b777aac689..7ed7953e9beb41396f3ba65706edc7ca66180059 100644
--- a/drivers/clk/qcom/gcc-sa8775p.c
+++ b/drivers/clk/qcom/gcc-sa8775p.c
@@ -2712,6 +2712,20 @@ static struct clk_branch gcc_pdm_ahb_clk = {
},
};
+static struct clk_regmap_div gcc_pdm_xo4_div_clk_src = {
+ .reg = 0x3f028,
+ .shift = 0,
+ .width = 4,
+ .clkr.hw.init = &(const struct clk_init_data) {
+ .name = "gcc_pdm_xo4_div_clk_src",
+ .parent_data = &(const struct clk_parent_data){
+ .index = DT_BI_TCXO,
+ },
+ .num_parents = 1,
+ .ops = &clk_regmap_div_ops,
+ },
+};
+
static struct clk_branch gcc_pdm_xo4_clk = {
.halt_reg = 0x3f008,
.halt_check = BRANCH_HALT,
@@ -2720,6 +2734,11 @@ static struct clk_branch gcc_pdm_xo4_clk = {
.enable_mask = BIT(0),
.hw.init = &(const struct clk_init_data){
.name = "gcc_pdm_xo4_clk",
+ .parent_hws = (const struct clk_hw*[]) {
+ &gcc_pdm_xo4_div_clk_src.clkr.hw,
+ },
+ .num_parents = 1,
+ .flags = CLK_SET_RATE_PARENT,
.ops = &clk_branch2_ops,
},
},
@@ -4406,6 +4425,7 @@ static struct clk_regmap *gcc_sa8775p_clocks[] = {
[GCC_PDM2_CLK_SRC] = &gcc_pdm2_clk_src.clkr,
[GCC_PDM_AHB_CLK] = &gcc_pdm_ahb_clk.clkr,
[GCC_PDM_XO4_CLK] = &gcc_pdm_xo4_clk.clkr,
+ [GCC_PDM_XO4_DIV_CLK_SRC] = &gcc_pdm_xo4_div_clk_src.clkr,
[GCC_QMIP_CAMERA_NRT_AHB_CLK] = &gcc_qmip_camera_nrt_ahb_clk.clkr,
[GCC_QMIP_CAMERA_RT_AHB_CLK] = &gcc_qmip_camera_rt_ahb_clk.clkr,
[GCC_QMIP_DISP1_AHB_CLK] = &gcc_qmip_disp1_ahb_clk.clkr,
diff --git a/drivers/clk/qcom/gcc-sc7280.c b/drivers/clk/qcom/gcc-sc7280.c
index 9e141a7ac424ad53f6bcf2869e456633f5612082..0708a1a5560985cae5f3eff5491da7c3de1c0bdc 100644
--- a/drivers/clk/qcom/gcc-sc7280.c
+++ b/drivers/clk/qcom/gcc-sc7280.c
@@ -1913,6 +1913,20 @@ static struct clk_branch gcc_pdm_ahb_clk = {
},
};
+static struct clk_regmap_div gcc_pdm_xo4_div_clk_src = {
+ .reg = 0x33028,
+ .shift = 0,
+ .width = 4,
+ .clkr.hw.init = &(const struct clk_init_data) {
+ .name = "gcc_pdm_xo4_div_clk_src",
+ .parent_data = &(const struct clk_parent_data){
+ .fw_name = "bi_tcxo",
+ },
+ .num_parents = 1,
+ .ops = &clk_regmap_div_ops,
+ },
+};
+
static struct clk_branch gcc_pdm_xo4_clk = {
.halt_reg = 0x33008,
.halt_check = BRANCH_HALT,
@@ -1921,6 +1935,11 @@ static struct clk_branch gcc_pdm_xo4_clk = {
.enable_mask = BIT(0),
.hw.init = &(struct clk_init_data){
.name = "gcc_pdm_xo4_clk",
+ .parent_hws = (const struct clk_hw*[]) {
+ &gcc_pdm_xo4_div_clk_src.clkr.hw,
+ },
+ .num_parents = 1,
+ .flags = CLK_SET_RATE_PARENT,
.ops = &clk_branch2_ops,
},
},
@@ -3250,6 +3269,7 @@ static struct clk_regmap *gcc_sc7280_clocks[] = {
[GCC_PDM2_CLK_SRC] = &gcc_pdm2_clk_src.clkr,
[GCC_PDM_AHB_CLK] = &gcc_pdm_ahb_clk.clkr,
[GCC_PDM_XO4_CLK] = &gcc_pdm_xo4_clk.clkr,
+ [GCC_PDM_XO4_DIV_CLK_SRC] = &gcc_pdm_xo4_div_clk_src.clkr,
[GCC_QMIP_CAMERA_NRT_AHB_CLK] = &gcc_qmip_camera_nrt_ahb_clk.clkr,
[GCC_QMIP_CAMERA_RT_AHB_CLK] = &gcc_qmip_camera_rt_ahb_clk.clkr,
[GCC_QMIP_DISP_AHB_CLK] = &gcc_qmip_disp_ahb_clk.clkr,
diff --git a/drivers/clk/qcom/gcc-shikra.c b/drivers/clk/qcom/gcc-shikra.c
index 13c99a883e29877d9a929f26ca0b3b04b1ea0b11..fbb4ea209345120fb3e178a648509737a0825795 100644
--- a/drivers/clk/qcom/gcc-shikra.c
+++ b/drivers/clk/qcom/gcc-shikra.c
@@ -3191,6 +3191,20 @@ static struct clk_branch gcc_pdm_ahb_clk = {
},
};
+static struct clk_regmap_div gcc_pdm_xo4_div_clk_src = {
+ .reg = 0x20028,
+ .shift = 0,
+ .width = 4,
+ .clkr.hw.init = &(const struct clk_init_data) {
+ .name = "gcc_pdm_xo4_div_clk_src",
+ .parent_data = &(const struct clk_parent_data){
+ .index = DT_BI_TCXO,
+ },
+ .num_parents = 1,
+ .ops = &clk_regmap_div_ops,
+ },
+};
+
static struct clk_branch gcc_pdm_xo4_clk = {
.halt_reg = 0x20008,
.halt_check = BRANCH_HALT,
@@ -3199,6 +3213,11 @@ static struct clk_branch gcc_pdm_xo4_clk = {
.enable_mask = BIT(0),
.hw.init = &(const struct clk_init_data) {
.name = "gcc_pdm_xo4_clk",
+ .parent_hws = (const struct clk_hw*[]) {
+ &gcc_pdm_xo4_div_clk_src.clkr.hw,
+ },
+ .num_parents = 1,
+ .flags = CLK_SET_RATE_PARENT,
.ops = &clk_branch2_ops,
},
},
@@ -4206,6 +4225,7 @@ static struct clk_regmap *gcc_shikra_clocks[] = {
[GCC_PDM2_CLK_SRC] = &gcc_pdm2_clk_src.clkr,
[GCC_PDM_AHB_CLK] = &gcc_pdm_ahb_clk.clkr,
[GCC_PDM_XO4_CLK] = &gcc_pdm_xo4_clk.clkr,
+ [GCC_PDM_XO4_DIV_CLK_SRC] = &gcc_pdm_xo4_div_clk_src.clkr,
[GCC_PWM0_XO512_CLK] = &gcc_pwm0_xo512_clk.clkr,
[GCC_QMIP_CAMERA_NRT_AHB_CLK] = &gcc_qmip_camera_nrt_ahb_clk.clkr,
[GCC_QMIP_CAMERA_RT_AHB_CLK] = &gcc_qmip_camera_rt_ahb_clk.clkr,
diff --git a/drivers/clk/qcom/gcc-sm8750.c b/drivers/clk/qcom/gcc-sm8750.c
index 80b8ec119c553d06e192d793730a0176e74e7b49..5449462c25ecc8893a5fd44004989b45d51d53d1 100644
--- a/drivers/clk/qcom/gcc-sm8750.c
+++ b/drivers/clk/qcom/gcc-sm8750.c
@@ -1690,6 +1690,20 @@ static struct clk_branch gcc_pdm_ahb_clk = {
},
};
+static struct clk_regmap_div gcc_pdm_xo4_div_clk_src = {
+ .reg = 0x33028,
+ .shift = 0,
+ .width = 4,
+ .clkr.hw.init = &(const struct clk_init_data) {
+ .name = "gcc_pdm_xo4_div_clk_src",
+ .parent_data = &(const struct clk_parent_data){
+ .index = DT_BI_TCXO,
+ },
+ .num_parents = 1,
+ .ops = &clk_regmap_div_ops,
+ },
+};
+
static struct clk_branch gcc_pdm_xo4_clk = {
.halt_reg = 0x33008,
.halt_check = BRANCH_HALT,
@@ -1698,6 +1712,11 @@ static struct clk_branch gcc_pdm_xo4_clk = {
.enable_mask = BIT(0),
.hw.init = &(const struct clk_init_data) {
.name = "gcc_pdm_xo4_clk",
+ .parent_hws = (const struct clk_hw*[]) {
+ &gcc_pdm_xo4_div_clk_src.clkr.hw,
+ },
+ .num_parents = 1,
+ .flags = CLK_SET_RATE_PARENT,
.ops = &clk_branch2_ops,
},
},
@@ -3000,6 +3019,7 @@ static struct clk_regmap *gcc_sm8750_clocks[] = {
[GCC_PDM2_CLK_SRC] = &gcc_pdm2_clk_src.clkr,
[GCC_PDM_AHB_CLK] = &gcc_pdm_ahb_clk.clkr,
[GCC_PDM_XO4_CLK] = &gcc_pdm_xo4_clk.clkr,
+ [GCC_PDM_XO4_DIV_CLK_SRC] = &gcc_pdm_xo4_div_clk_src.clkr,
[GCC_QMIP_CAMERA_CMD_AHB_CLK] = &gcc_qmip_camera_cmd_ahb_clk.clkr,
[GCC_QMIP_CAMERA_NRT_AHB_CLK] = &gcc_qmip_camera_nrt_ahb_clk.clkr,
[GCC_QMIP_CAMERA_RT_AHB_CLK] = &gcc_qmip_camera_rt_ahb_clk.clkr,
--
2.34.1
^ permalink raw reply related [flat|nested] 19+ messages in thread* [PATCH v3 05/10] arm64: dts: qcom: qcs8300: Add GP M/N clock controller
2026-11-23 19:51 [PATCH v3 00/10] clk: qcom: Add PDM GP_MN fractional clock divider driver and DT support Taniya Das
` (3 preceding siblings ...)
2026-11-23 19:51 ` [PATCH v3 04/10] clk: qcom: gcc: Add configurable PDM XO4 div clocks across targets Taniya Das
@ 2026-11-23 19:51 ` Taniya Das
2026-11-24 19:53 ` sashiko-bot
2026-11-23 19:51 ` [PATCH v3 06/10] arm64: dts: qcom: sa8775p: " Taniya Das
` (4 subsequent siblings)
9 siblings, 1 reply; 19+ messages in thread
From: Taniya Das @ 2026-11-23 19:51 UTC (permalink / raw)
To: Bjorn Andersson, Abel Vesa, Stephen Boyd, Brian Masney,
Jerome Brunet, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
Bartosz Golaszewski, Linus Walleij, Richard Cochran,
Konrad Dybcio
Cc: Ajit Pandey, Imran Shaik, Jagadeesh Kona, linux-arm-msm,
linux-clk, devicetree, linux-kernel, linux-gpio, netdev,
Taniya Das
Add the GP M/N clock controller and its pin configuration for QCS8300.
The controller uses the PDM XO4 and AHB clocks from GCC and routes its
output to gpio32.
Signed-off-by: Taniya Das <taniya.das@oss.qualcomm.com>
---
arch/arm64/boot/dts/qcom/monaco.dtsi | 21 +++++++++++++++++++++
1 file changed, 21 insertions(+)
diff --git a/arch/arm64/boot/dts/qcom/monaco.dtsi b/arch/arm64/boot/dts/qcom/monaco.dtsi
index 3541313a79bf47fe27499f6dc370cb778d780a08..3508869ed92b439b35182e94a5b9a24078efbf70 100644
--- a/arch/arm64/boot/dts/qcom/monaco.dtsi
+++ b/arch/arm64/boot/dts/qcom/monaco.dtsi
@@ -4892,6 +4892,20 @@ sdhc_ice: crypto@87c8000 {
power-domains = <&rpmhpd RPMHPD_CX>;
};
+ gp_mn: clock-controller@88d3000 {
+ compatible = "qcom,qcs8300-gp-mnd", "qcom,sc7280-gp-mnd";
+ reg = <0x0 0x088d3000 0x0 0x1000>;
+ clocks = <&gcc GCC_PDM_XO4_CLK>,
+ <&gcc GCC_PDM_AHB_CLK>;
+ clock-names = "pdm", "ahb";
+ #clock-cells = <0>;
+ pinctrl-0 = <&gp_mn_active>;
+ pinctrl-names = "default";
+ assigned-clocks = <&gcc GCC_PDM_XO4_CLK>;
+ assigned-clock-rates = <4800000>;
+ status = "disabled";
+ };
+
usb_1_hsphy: phy@8904000 {
compatible = "qcom,qcs8300-usb-hs-phy",
"qcom,usb-snps-hs-7nm-phy";
@@ -6458,6 +6472,13 @@ dp_hot_plug_det: dp-hot-plug-det-state {
bias-disable;
};
+ gp_mn_active: gp-mn-active-state {
+ pins = "gpio32";
+ function = "gp_mn";
+ drive-strength = <2>;
+ bias-disable;
+ };
+
hs0_mi2s_active: hs0-mi2s-active-state {
pins = "gpio106", "gpio107", "gpio108", "gpio109";
function = "hs0_mi2s";
--
2.34.1
^ permalink raw reply related [flat|nested] 19+ messages in thread* Re: [PATCH v3 05/10] arm64: dts: qcom: qcs8300: Add GP M/N clock controller
2026-11-23 19:51 ` [PATCH v3 05/10] arm64: dts: qcom: qcs8300: Add GP M/N clock controller Taniya Das
@ 2026-11-24 19:53 ` sashiko-bot
0 siblings, 0 replies; 19+ messages in thread
From: sashiko-bot @ 2026-11-24 19:53 UTC (permalink / raw)
To: Taniya Das; +Cc: linux-clk, devicetree, linux-gpio, robh, conor+dt
Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [High] arm64: dts: qcom: qcs8300: undefined gp_mn pinctrl function in
monaco.dtsi
--
commit d516231f8cb52de8b0fc3f5d25658a1e90470e4e
Author: Taniya Das <taniya.das@oss.qualcomm.com>
arm64: dts: qcom: qcs8300: Add GP M/N clock controller
This commit adds the GP M/N clock controller node and its gp_mn_active pin
configuration on gpio32 to monaco.dtsi for QCS8300.
> diff --git a/arch/arm64/boot/dts/qcom/monaco.dtsi b/arch/arm64/boot/dts/qcom/monaco.dtsi
> index 3541313a79bf4..3508869ed92b4 100644
> --- a/arch/arm64/boot/dts/qcom/monaco.dtsi
> +++ b/arch/arm64/boot/dts/qcom/monaco.dtsi
> @@ -4892,6 +4892,20 @@ sdhc_ice: crypto@87c8000 {
> power-domains = <&rpmhpd RPMHPD_CX>;
> };
>
> + gp_mn: clock-controller@88d3000 {
> + compatible = "qcom,qcs8300-gp-mnd", "qcom,sc7280-gp-mnd";
> + reg = <0x0 0x088d3000 0x0 0x1000>;
> + clocks = <&gcc GCC_PDM_XO4_CLK>,
> + <&gcc GCC_PDM_AHB_CLK>;
> + clock-names = "pdm", "ahb";
> + #clock-cells = <0>;
> + pinctrl-0 = <&gp_mn_active>;
> + pinctrl-names = "default";
> + assigned-clocks = <&gcc GCC_PDM_XO4_CLK>;
> + assigned-clock-rates = <4800000>;
> + status = "disabled";
> + };
> +
> usb_1_hsphy: phy@8904000 {
> compatible = "qcom,qcs8300-usb-hs-phy",
> "qcom,usb-snps-hs-7nm-phy";
> @@ -6458,6 +6472,13 @@ dp_hot_plug_det: dp-hot-plug-det-state {
> bias-disable;
> };
>
> + gp_mn_active: gp-mn-active-state {
> + pins = "gpio32";
> + function = "gp_mn";
> + drive-strength = <2>;
> + bias-disable;
> + };
[Severity: High]
Does the QCS8300 TLMM driver define the "gp_mn" function for gpio32?
In drivers/pinctrl/qcom/pinctrl-qcs8300.c, qcs8300_functions[] does not
define gp_mn, and qcs8300_groups[32] does not map it:
drivers/pinctrl/qcom/pinctrl-qcs8300.c:qcs8300_groups[] {
...
[32] = PINGROUP(32, qup0_se4, cci_i2c_scl, emac0_ptp_aux, mdp_vsync, _, _, _, _, _, _, _),
...
}
When gp_mn is enabled, pinctrl_bind_pins() -> pinmux_map_to_setting() ->
pinmux_func_name_to_selector() fails with -EINVAL before the clock
controller can probe. "gp_mn" is also missing from the function enum in
Documentation/devicetree/bindings/pinctrl/qcom,qcs8300-tlmm.yaml, causing
dtbs_check validation to fail for boards including monaco.dtsi.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261124-b4-pdm_clk_gp_mnd_v2-v3-0-98db26a87500@oss.qualcomm.com?part=5
^ permalink raw reply [flat|nested] 19+ messages in thread
* [PATCH v3 06/10] arm64: dts: qcom: sa8775p: Add GP M/N clock controller
2026-11-23 19:51 [PATCH v3 00/10] clk: qcom: Add PDM GP_MN fractional clock divider driver and DT support Taniya Das
` (4 preceding siblings ...)
2026-11-23 19:51 ` [PATCH v3 05/10] arm64: dts: qcom: qcs8300: Add GP M/N clock controller Taniya Das
@ 2026-11-23 19:51 ` Taniya Das
2026-11-24 19:53 ` sashiko-bot
2026-11-23 19:51 ` [PATCH v3 07/10] arm64: dts: qcom: sc7280: " Taniya Das
` (3 subsequent siblings)
9 siblings, 1 reply; 19+ messages in thread
From: Taniya Das @ 2026-11-23 19:51 UTC (permalink / raw)
To: Bjorn Andersson, Abel Vesa, Stephen Boyd, Brian Masney,
Jerome Brunet, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
Bartosz Golaszewski, Linus Walleij, Richard Cochran,
Konrad Dybcio
Cc: Ajit Pandey, Imran Shaik, Jagadeesh Kona, linux-arm-msm,
linux-clk, devicetree, linux-kernel, linux-gpio, netdev,
Taniya Das
Add the GP M/N clock controller and its pin configuration for SA8775P.
The controller uses the PDM XO4 and AHB clocks from GCC and routes its
output to gpio35.
Signed-off-by: Taniya Das <taniya.das@oss.qualcomm.com>
---
arch/arm64/boot/dts/qcom/lemans-embedded.dtsi | 21 +++++++++++++++++++++
1 file changed, 21 insertions(+)
diff --git a/arch/arm64/boot/dts/qcom/lemans-embedded.dtsi b/arch/arm64/boot/dts/qcom/lemans-embedded.dtsi
index 0be39bb9de1e1cdbb7d67a992172861a5a10a05a..4bba23df8a95d306867e22c49981dd8c22d4a6e4 100644
--- a/arch/arm64/boot/dts/qcom/lemans-embedded.dtsi
+++ b/arch/arm64/boot/dts/qcom/lemans-embedded.dtsi
@@ -1849,6 +1849,20 @@ lpass_ag_noc: interconnect@3c40000 {
qcom,bcm-voters = <&apps_bcm_voter>;
};
+ gp_mn: clock-controller@88d3000 {
+ compatible = "qcom,sa8775p-gp-mnd", "qcom,sc7280-gp-mnd";
+ reg = <0x0 0x088d3000 0x0 0x1000>;
+ clocks = <&gcc GCC_PDM_XO4_CLK>,
+ <&gcc GCC_PDM_AHB_CLK>;
+ clock-names = "pdm", "ahb";
+ #clock-cells = <0>;
+ pinctrl-0 = <&gp_mn_active>;
+ pinctrl-names = "default";
+ assigned-clocks = <&gcc GCC_PDM_XO4_CLK>;
+ assigned-clock-rates = <4800000>;
+ status = "disabled";
+ };
+
usb_0_hsphy: phy@88e4000 {
compatible = "qcom,sa8775p-usb-hs-phy",
"qcom,usb-snps-hs-5nm-phy";
@@ -2515,6 +2529,13 @@ dp1_hot_plug_det: dp1-hot-plug-det-state {
bias-disable;
};
+ gp_mn_active: gp-mn-active-state {
+ pins = "gpio35";
+ function = "gp_mn";
+ drive-strength = <2>;
+ bias-disable;
+ };
+
hs0_mi2s_active: hs0-mi2s-active-state {
pins = "gpio114", "gpio115", "gpio116", "gpio117";
function = "hs0_mi2s";
--
2.34.1
^ permalink raw reply related [flat|nested] 19+ messages in thread* Re: [PATCH v3 06/10] arm64: dts: qcom: sa8775p: Add GP M/N clock controller
2026-11-23 19:51 ` [PATCH v3 06/10] arm64: dts: qcom: sa8775p: " Taniya Das
@ 2026-11-24 19:53 ` sashiko-bot
0 siblings, 0 replies; 19+ messages in thread
From: sashiko-bot @ 2026-11-24 19:53 UTC (permalink / raw)
To: Taniya Das; +Cc: linux-clk, devicetree, linux-gpio, robh, conor+dt
Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] arm64: dts: qcom: sa8775p: undefined gp_mn pinmux function on
gpio35
--
commit 2bb0f9c69aa222be884a221ac0040d31c8953968
Author: Taniya Das <taniya.das@oss.qualcomm.com>
arm64: dts: qcom: sa8775p: Add GP M/N clock controller
This commit adds the GP M/N clock controller node and its gp_mn_active
pinctrl configuration on gpio35 for SA8775P.
> diff --git a/arch/arm64/boot/dts/qcom/lemans-embedded.dtsi b/arch/arm64/boot/dts/qcom/lemans-embedded.dtsi
> index 0be39bb9de1e1..4bba23df8a95d 100644
> --- a/arch/arm64/boot/dts/qcom/lemans-embedded.dtsi
> +++ b/arch/arm64/boot/dts/qcom/lemans-embedded.dtsi
> @@ -1849,6 +1849,20 @@ lpass_ag_noc: interconnect@3c40000 {
> qcom,bcm-voters = <&apps_bcm_voter>;
> };
>
> + gp_mn: clock-controller@88d3000 {
> + compatible = "qcom,sa8775p-gp-mnd", "qcom,sc7280-gp-mnd";
> + reg = <0x0 0x088d3000 0x0 0x1000>;
> + clocks = <&gcc GCC_PDM_XO4_CLK>,
> + <&gcc GCC_PDM_AHB_CLK>;
> + clock-names = "pdm", "ahb";
> + #clock-cells = <0>;
> + pinctrl-0 = <&gp_mn_active>;
> + pinctrl-names = "default";
> + assigned-clocks = <&gcc GCC_PDM_XO4_CLK>;
> + assigned-clock-rates = <4800000>;
> + status = "disabled";
> + };
> +
> usb_0_hsphy: phy@88e4000 {
> compatible = "qcom,sa8775p-usb-hs-phy",
> "qcom,usb-snps-hs-5nm-phy";
> @@ -2515,6 +2529,13 @@ dp1_hot_plug_det: dp1-hot-plug-det-state {
> bias-disable;
> };
>
> + gp_mn_active: gp-mn-active-state {
> + pins = "gpio35";
> + function = "gp_mn";
> + drive-strength = <2>;
> + bias-disable;
> + };
[Severity: Medium]
Is the "gp_mn" pinmux function missing from the SA8775P TLMM driver and
binding?
In drivers/pinctrl/qcom/pinctrl-sa8775p.c, sa8775p_functions[] does not
define a gp_mn function and sa8775p_groups[35] has no gp_mn mux entry:
drivers/pinctrl/qcom/pinctrl-sa8775p.c:sa8775p_groups[] {
...
[35] = PINGROUP(35, qup0_se4, phase_flag, _, _, _, _, _, _, _),
...
}
When gp_mn is enabled, pinctrl_bind_pins() -> pinmux_func_name_to_selector()
rejects "gp_mn" with -EINVAL and aborts probing before clk_gp_mnd_probe()
runs. "gp_mn" is also absent from the function enum in
Documentation/devicetree/bindings/pinctrl/qcom,sa8775p-tlmm.yaml, which
causes dtbs_check validation to fail on boards including
lemans-embedded.dtsi.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261124-b4-pdm_clk_gp_mnd_v2-v3-0-98db26a87500@oss.qualcomm.com?part=6
^ permalink raw reply [flat|nested] 19+ messages in thread
* [PATCH v3 07/10] arm64: dts: qcom: sc7280: Add GP M/N clock controller
2026-11-23 19:51 [PATCH v3 00/10] clk: qcom: Add PDM GP_MN fractional clock divider driver and DT support Taniya Das
` (5 preceding siblings ...)
2026-11-23 19:51 ` [PATCH v3 06/10] arm64: dts: qcom: sa8775p: " Taniya Das
@ 2026-11-23 19:51 ` Taniya Das
2026-11-24 19:53 ` sashiko-bot
2026-11-23 19:51 ` [PATCH v3 08/10] arm64: dts: qcom: qcs615: " Taniya Das
` (2 subsequent siblings)
9 siblings, 1 reply; 19+ messages in thread
From: Taniya Das @ 2026-11-23 19:51 UTC (permalink / raw)
To: Bjorn Andersson, Abel Vesa, Stephen Boyd, Brian Masney,
Jerome Brunet, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
Bartosz Golaszewski, Linus Walleij, Richard Cochran,
Konrad Dybcio
Cc: Ajit Pandey, Imran Shaik, Jagadeesh Kona, linux-arm-msm,
linux-clk, devicetree, linux-kernel, linux-gpio, netdev,
Taniya Das
Add the GP M/N clock controller and its pin configuration for SC7280.
The controller uses the PDM XO4 and AHB clocks from GCC and routes its
output to gpio60.
Signed-off-by: Taniya Das <taniya.das@oss.qualcomm.com>
---
arch/arm64/boot/dts/qcom/kodiak.dtsi | 21 +++++++++++++++++++++
1 file changed, 21 insertions(+)
diff --git a/arch/arm64/boot/dts/qcom/kodiak.dtsi b/arch/arm64/boot/dts/qcom/kodiak.dtsi
index 10e9a5279ed60cea1514097354b8f0f59ffca2fc..773f4487d78301a18d5c27e9e97462e60adefd0b 100644
--- a/arch/arm64/boot/dts/qcom/kodiak.dtsi
+++ b/arch/arm64/boot/dts/qcom/kodiak.dtsi
@@ -4454,6 +4454,20 @@ usb2_role_switch: endpoint {
};
};
+ gp_mn: clock-controller@88d3000 {
+ compatible = "qcom,sc7280-gp-mnd";
+ reg = <0x0 0x088d3000 0x0 0x1000>;
+ clocks = <&gcc GCC_PDM_XO4_CLK>,
+ <&gcc GCC_PDM_AHB_CLK>;
+ clock-names = "pdm", "ahb";
+ #clock-cells = <0>;
+ pinctrl-0 = <&gp_mn_active>;
+ pinctrl-names = "default";
+ assigned-clocks = <&gcc GCC_PDM_XO4_CLK>;
+ assigned-clock-rates = <4800000>;
+ status = "disabled";
+ };
+
qspi: spi@88dc000 {
compatible = "qcom,sc7280-qspi", "qcom,qspi-v1";
reg = <0 0x088dc000 0 0x1000>;
@@ -6683,6 +6697,13 @@ mi2s0_ws: mi2s0-ws-state {
function = "mi2s0_ws";
};
+ gp_mn_active: gp-mn-active-state {
+ pins = "gpio60";
+ function = "gp_mn";
+ drive-strength = <2>;
+ bias-disable;
+ };
+
mi2s1_sclk: mi2s1-sclk-state {
pins = "gpio106";
function = "mi2s1_sck";
--
2.34.1
^ permalink raw reply related [flat|nested] 19+ messages in thread* Re: [PATCH v3 07/10] arm64: dts: qcom: sc7280: Add GP M/N clock controller
2026-11-23 19:51 ` [PATCH v3 07/10] arm64: dts: qcom: sc7280: " Taniya Das
@ 2026-11-24 19:53 ` sashiko-bot
0 siblings, 0 replies; 19+ messages in thread
From: sashiko-bot @ 2026-11-24 19:53 UTC (permalink / raw)
To: Taniya Das; +Cc: linux-clk, devicetree, linux-gpio, robh, conor+dt
Thank you for your contribution! Sashiko AI review found 2 potential
issues to consider:
- [Medium] arm64: dts: qcom: sc7280: undefined gp_mn pinmux function in
kodiak.dtsi
- [Low] arm64: dts: qcom: sc7280: unsorted gp_mn_active pinctrl subnode
in kodiak.dtsi
--
commit b17b6968e213c74fa5ead791ea18018b1292f1e0
Author: Taniya Das <taniya.das@oss.qualcomm.com>
arm64: dts: qcom: sc7280: Add GP M/N clock controller
This commit adds the GP M/N clock controller node and its default TLMM pin
configuration on gpio60 for SC7280.
> diff --git a/arch/arm64/boot/dts/qcom/kodiak.dtsi b/arch/arm64/boot/dts/qcom/kodiak.dtsi
> index 10e9a5279ed60..773f4487d7830 100644
> --- a/arch/arm64/boot/dts/qcom/kodiak.dtsi
> +++ b/arch/arm64/boot/dts/qcom/kodiak.dtsi
[ ... ]
> @@ -6683,6 +6697,13 @@ mi2s0_ws: mi2s0-ws-state {
> function = "mi2s0_ws";
> };
>
> + gp_mn_active: gp-mn-active-state {
> + pins = "gpio60";
> + function = "gp_mn";
[Severity: Medium]
Is a patch adding the "gp_mn" function to the SC7280 pinctrl driver and
binding missing?
Neither Documentation/devicetree/bindings/pinctrl/qcom,sc7280-pinctrl.yaml
nor drivers/pinctrl/qcom/pinctrl-sc7280.c defines "gp_mn" (and
sc7280_groups[60] only lists qup17, edp_hot and phase_flag):
drivers/pinctrl/qcom/pinctrl-sc7280.c:sc7280_groups[] {
...
[60] = PINGROUP(60, qup17, edp_hot, _, phase_flag, _, _, _, _, _),
...
}
Because tlmm is enabled in kodiak.dtsi, this causes dtbs_check schema
validation failures on SC7280 boards, and enabling gp_mn will fail to
probe at runtime with -EINVAL when pinctrl_bind_pins() looks up "gp_mn".
> + drive-strength = <2>;
> + bias-disable;
> + };
> +
> mi2s1_sclk: mi2s1-sclk-state {
> pins = "gpio106";
> function = "mi2s1_sck";
[Severity: Low]
This isn't a bug, but the tlmm subnodes in kodiak.dtsi were sorted by pin
number in commit a732b12f1fcc ("arm64: dts: qcom: kodiak: Sort pinctrl
subnodes by pins"). Should gp_mn_active (gpio60) be placed alongside the
existing gpio60 states (such as edp_hot_plug_det) rather than between
gpio100 and gpio106?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261124-b4-pdm_clk_gp_mnd_v2-v3-0-98db26a87500@oss.qualcomm.com?part=7
^ permalink raw reply [flat|nested] 19+ messages in thread
* [PATCH v3 08/10] arm64: dts: qcom: qcs615: Add GP M/N clock controller
2026-11-23 19:51 [PATCH v3 00/10] clk: qcom: Add PDM GP_MN fractional clock divider driver and DT support Taniya Das
` (6 preceding siblings ...)
2026-11-23 19:51 ` [PATCH v3 07/10] arm64: dts: qcom: sc7280: " Taniya Das
@ 2026-11-23 19:51 ` Taniya Das
2026-11-24 19:53 ` sashiko-bot
2026-11-23 19:51 ` [PATCH v3 09/10] arm64: dts: qcom: sm8750: " Taniya Das
2026-11-23 19:51 ` [PATCH v3 10/10] arm64: dts: qcom: shikra: " Taniya Das
9 siblings, 1 reply; 19+ messages in thread
From: Taniya Das @ 2026-11-23 19:51 UTC (permalink / raw)
To: Bjorn Andersson, Abel Vesa, Stephen Boyd, Brian Masney,
Jerome Brunet, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
Bartosz Golaszewski, Linus Walleij, Richard Cochran,
Konrad Dybcio
Cc: Ajit Pandey, Imran Shaik, Jagadeesh Kona, linux-arm-msm,
linux-clk, devicetree, linux-kernel, linux-gpio, netdev,
Taniya Das
Add the GP M/N clock controller and its pin configuration for QCS615.
The controller uses the PDM XO4 and AHB clocks from GCC and routes its
output to gpio29.
Signed-off-by: Taniya Das <taniya.das@oss.qualcomm.com>
---
arch/arm64/boot/dts/qcom/talos.dtsi | 21 +++++++++++++++++++++
1 file changed, 21 insertions(+)
diff --git a/arch/arm64/boot/dts/qcom/talos.dtsi b/arch/arm64/boot/dts/qcom/talos.dtsi
index 1d74e459f892e7aa65296850816dc9ebaddbe3af..a6f195509ac2e27a4862e49e82cd9a0fda67d153 100644
--- a/arch/arm64/boot/dts/qcom/talos.dtsi
+++ b/arch/arm64/boot/dts/qcom/talos.dtsi
@@ -1626,6 +1626,13 @@ cam_mclk3_default: cam-mclk3-default-state {
bias-disable;
};
+ gp_mn_active: gp-mn-active-state {
+ pins = "gpio29";
+ function = "gp_mn";
+ drive-strength = <2>;
+ bias-disable;
+ };
+
cci_i2c0_default: cci-i2c0-default-state {
/* SDA, SCL */
pins = "gpio32", "gpio33";
@@ -4031,6 +4038,20 @@ opp-202000000 {
};
};
+ gp_mn: clock-controller@88d3000 {
+ compatible = "qcom,qcs615-gp-mnd", "qcom,sc7280-gp-mnd";
+ reg = <0x0 0x088d3000 0x0 0x1000>;
+ clocks = <&gcc GCC_PDM_XO4_CLK>,
+ <&gcc GCC_PDM_AHB_CLK>;
+ clock-names = "pdm", "ahb";
+ #clock-cells = <0>;
+ pinctrl-0 = <&gp_mn_active>;
+ pinctrl-names = "default";
+ assigned-clocks = <&gcc GCC_PDM_XO4_CLK>;
+ assigned-clock-rates = <4800000>;
+ status = "disabled";
+ };
+
qspi: spi@88df000 {
compatible = "qcom,qcs615-qspi",
"qcom,qspi-v1";
--
2.34.1
^ permalink raw reply related [flat|nested] 19+ messages in thread* Re: [PATCH v3 08/10] arm64: dts: qcom: qcs615: Add GP M/N clock controller
2026-11-23 19:51 ` [PATCH v3 08/10] arm64: dts: qcom: qcs615: " Taniya Das
@ 2026-11-24 19:53 ` sashiko-bot
0 siblings, 0 replies; 19+ messages in thread
From: sashiko-bot @ 2026-11-24 19:53 UTC (permalink / raw)
To: Taniya Das; +Cc: linux-clk, devicetree, linux-gpio, robh, conor+dt
Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [High] arm64: dts: qcom: talos: Undefined gp_mn pinmux function on
gpio29
--
commit 7cbf99e3ead65681675a71473e402d0963a6bc63
Author: Taniya Das <taniya.das@oss.qualcomm.com>
arm64: dts: qcom: qcs615: Add GP M/N clock controller
This commit adds the GP M/N clock controller node and its gpio29 pinctrl
state to the QCS615 (Talos) devicetree.
> diff --git a/arch/arm64/boot/dts/qcom/talos.dtsi b/arch/arm64/boot/dts/qcom/talos.dtsi
> index 1d74e459f892e..a6f195509ac2e 100644
> --- a/arch/arm64/boot/dts/qcom/talos.dtsi
> +++ b/arch/arm64/boot/dts/qcom/talos.dtsi
> @@ -1626,6 +1626,13 @@ cam_mclk3_default: cam-mclk3-default-state {
> bias-disable;
> };
>
> + gp_mn_active: gp-mn-active-state {
> + pins = "gpio29";
> + function = "gp_mn";
> + drive-strength = <2>;
> + bias-disable;
> + };
> +
> cci_i2c0_default: cci-i2c0-default-state {
> /* SDA, SCL */
> pins = "gpio32", "gpio33";
[Severity: High]
Is the "gp_mn" pinmux function defined in the QCS615 TLMM driver and
binding schema?
In drivers/pinctrl/qcom/pinctrl-qcs615.c, qcs615_functions[] does not
define a gp_mn function and qcs615_groups[29] leaves mux slot 2
unpopulated:
drivers/pinctrl/qcom/pinctrl-qcs615.c:qcs615_groups[] {
...
[29] = PINGROUP(29, EAST, cam_mclk, _, qdss_gpio, atest_tsens, _, _, _, _, _),
...
}
Because gp_mn binds gp_mn_active as its default pinctrl state, enabling
clock-controller@88d3000 causes pinctrl_bind_pins() to fail with -EINVAL
before clk_gp_mnd_probe() runs. The function enum in
Documentation/devicetree/bindings/pinctrl/qcom,qcs615-tlmm.yaml also omits
"gp_mn", causing dtbs_check validation to fail.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261124-b4-pdm_clk_gp_mnd_v2-v3-0-98db26a87500@oss.qualcomm.com?part=8
^ permalink raw reply [flat|nested] 19+ messages in thread
* [PATCH v3 09/10] arm64: dts: qcom: sm8750: Add GP M/N clock controller
2026-11-23 19:51 [PATCH v3 00/10] clk: qcom: Add PDM GP_MN fractional clock divider driver and DT support Taniya Das
` (7 preceding siblings ...)
2026-11-23 19:51 ` [PATCH v3 08/10] arm64: dts: qcom: qcs615: " Taniya Das
@ 2026-11-23 19:51 ` Taniya Das
2026-11-24 19:53 ` sashiko-bot
2026-11-23 19:51 ` [PATCH v3 10/10] arm64: dts: qcom: shikra: " Taniya Das
9 siblings, 1 reply; 19+ messages in thread
From: Taniya Das @ 2026-11-23 19:51 UTC (permalink / raw)
To: Bjorn Andersson, Abel Vesa, Stephen Boyd, Brian Masney,
Jerome Brunet, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
Bartosz Golaszewski, Linus Walleij, Richard Cochran,
Konrad Dybcio
Cc: Ajit Pandey, Imran Shaik, Jagadeesh Kona, linux-arm-msm,
linux-clk, devicetree, linux-kernel, linux-gpio, netdev,
Taniya Das
Add the GP M/N clock controller and its pin configuration for SM8750.
The controller uses the PDM XO4 and AHB clocks from GCC and routes its
output to gpio53. The node is kept disabled by default so boards opt in
explicitly before the output pin is muxed.
Signed-off-by: Taniya Das <taniya.das@oss.qualcomm.com>
---
arch/arm64/boot/dts/qcom/sm8750.dtsi | 21 +++++++++++++++++++++
1 file changed, 21 insertions(+)
diff --git a/arch/arm64/boot/dts/qcom/sm8750.dtsi b/arch/arm64/boot/dts/qcom/sm8750.dtsi
index d8a853c31eeb15fb1d0023fb8b5a5a59a9ed763b..fcc78bb3c8334b20561af6be87818af8f5ad461e 100644
--- a/arch/arm64/boot/dts/qcom/sm8750.dtsi
+++ b/arch/arm64/boot/dts/qcom/sm8750.dtsi
@@ -3067,6 +3067,20 @@ opp-202000000 {
};
};
+ gp_mn: clock-controller@88d3000 {
+ compatible = "qcom,sm8750-gp-mnd", "qcom,sc7280-gp-mnd";
+ reg = <0x0 0x088d3000 0x0 0x1000>;
+ clocks = <&gcc GCC_PDM_XO4_CLK>,
+ <&gcc GCC_PDM_AHB_CLK>;
+ clock-names = "pdm", "ahb";
+ #clock-cells = <0>;
+ pinctrl-0 = <&gp_mn_active>;
+ pinctrl-names = "default";
+ assigned-clocks = <&gcc GCC_PDM_XO4_CLK>;
+ assigned-clock-rates = <4800000>;
+ status = "disabled";
+ };
+
usb_hsphy: phy@88e3000 {
compatible = "qcom,sm8750-m31-eusb2-phy";
reg = <0x0 0x88e3000 0x0 0x29c>;
@@ -3921,6 +3935,13 @@ tlmm: pinctrl@f100000 {
gpio-ranges = <&tlmm 0 0 216>;
wakeup-parent = <&pdc>;
+ gp_mn_active: gp-mn-active-state {
+ pins = "gpio53";
+ function = "gp_mn";
+ drive-strength = <2>;
+ bias-disable;
+ };
+
hub_i2c0_data_clk: hub-i2c0-data-clk-state {
/* SDA, SCL */
pins = "gpio64", "gpio65";
--
2.34.1
^ permalink raw reply related [flat|nested] 19+ messages in thread* Re: [PATCH v3 09/10] arm64: dts: qcom: sm8750: Add GP M/N clock controller
2026-11-23 19:51 ` [PATCH v3 09/10] arm64: dts: qcom: sm8750: " Taniya Das
@ 2026-11-24 19:53 ` sashiko-bot
0 siblings, 0 replies; 19+ messages in thread
From: sashiko-bot @ 2026-11-24 19:53 UTC (permalink / raw)
To: Taniya Das; +Cc: linux-clk, devicetree, linux-gpio, robh, conor+dt
Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [High] arm64: dts: qcom: sm8750: undefined gp_mn pinctrl function
breaks gp_mn probe
--
commit 1a48f00d1e707622e8662f63536985b47631218d
Author: Taniya Das <taniya.das@oss.qualcomm.com>
arm64: dts: qcom: sm8750: Add GP M/N clock controller
This commit adds the GP M/N clock controller node and its gpio53 pin
configuration to the SM8750 Devicetree.
> diff --git a/arch/arm64/boot/dts/qcom/sm8750.dtsi b/arch/arm64/boot/dts/qcom/sm8750.dtsi
> index d8a853c31eeb1..fcc78bb3c8334 100644
> --- a/arch/arm64/boot/dts/qcom/sm8750.dtsi
> +++ b/arch/arm64/boot/dts/qcom/sm8750.dtsi
> @@ -3067,6 +3067,20 @@ opp-202000000 {
> };
> };
>
> + gp_mn: clock-controller@88d3000 {
> + compatible = "qcom,sm8750-gp-mnd", "qcom,sc7280-gp-mnd";
> + reg = <0x0 0x088d3000 0x0 0x1000>;
> + clocks = <&gcc GCC_PDM_XO4_CLK>,
> + <&gcc GCC_PDM_AHB_CLK>;
> + clock-names = "pdm", "ahb";
> + #clock-cells = <0>;
> + pinctrl-0 = <&gp_mn_active>;
> + pinctrl-names = "default";
> + assigned-clocks = <&gcc GCC_PDM_XO4_CLK>;
> + assigned-clock-rates = <4800000>;
> + status = "disabled";
> + };
> +
> usb_hsphy: phy@88e3000 {
> compatible = "qcom,sm8750-m31-eusb2-phy";
> reg = <0x0 0x88e3000 0x0 0x29c>;
> @@ -3921,6 +3935,13 @@ tlmm: pinctrl@f100000 {
> gpio-ranges = <&tlmm 0 0 216>;
> wakeup-parent = <&pdc>;
>
> + gp_mn_active: gp-mn-active-state {
> + pins = "gpio53";
> + function = "gp_mn";
> + drive-strength = <2>;
> + bias-disable;
> + };
[Severity: High]
Is "gp_mn" supported by the SM8750 pinctrl driver and binding?
drivers/pinctrl/qcom/pinctrl-sm8750.c does not define a gp_mn function in
sm8750_functions[], and pin 53 leaves mux slot 3 unmapped:
drivers/pinctrl/qcom/pinctrl-sm8750.c:sm8750_groups[] {
...
[53] = PINGROUP(53, qup1_se5, qspi1, _, ddr_pxi3, _, _, _, _, _, _, _),
...
}
When a board enables gp_mn, pinctrl_bind_pins() ->
pinmux_func_name_to_selector() fails with -EINVAL and prevents gp_mn from
probing. Documentation/devicetree/bindings/pinctrl/qcom,sm8750-tlmm.yaml
also omits gp_mn from the function enum, so gp_mn_active under tlmm causes
dtbs_check validation errors.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261124-b4-pdm_clk_gp_mnd_v2-v3-0-98db26a87500@oss.qualcomm.com?part=9
^ permalink raw reply [flat|nested] 19+ messages in thread
* [PATCH v3 10/10] arm64: dts: qcom: shikra: Add GP M/N clock controller
2026-11-23 19:51 [PATCH v3 00/10] clk: qcom: Add PDM GP_MN fractional clock divider driver and DT support Taniya Das
` (8 preceding siblings ...)
2026-11-23 19:51 ` [PATCH v3 09/10] arm64: dts: qcom: sm8750: " Taniya Das
@ 2026-11-23 19:51 ` Taniya Das
2026-11-24 19:53 ` sashiko-bot
9 siblings, 1 reply; 19+ messages in thread
From: Taniya Das @ 2026-11-23 19:51 UTC (permalink / raw)
To: Bjorn Andersson, Abel Vesa, Stephen Boyd, Brian Masney,
Jerome Brunet, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
Bartosz Golaszewski, Linus Walleij, Richard Cochran,
Konrad Dybcio
Cc: Ajit Pandey, Imran Shaik, Jagadeesh Kona, linux-arm-msm,
linux-clk, devicetree, linux-kernel, linux-gpio, netdev,
Taniya Das
Add the GP M/N clock controller and its pin configuration for Shikra.
The controller uses the PDM XO4 and AHB clocks from GCC and routes its
output to gpio87. The node is kept disabled by default so boards opt in
explicitly before the output pin is muxed.
Signed-off-by: Taniya Das <taniya.das@oss.qualcomm.com>
---
arch/arm64/boot/dts/qcom/shikra.dtsi | 21 +++++++++++++++++++++
1 file changed, 21 insertions(+)
diff --git a/arch/arm64/boot/dts/qcom/shikra.dtsi b/arch/arm64/boot/dts/qcom/shikra.dtsi
index 0a95ad5a5582c643f97e2b0725eb88a9f262d83c..a5079b82f22f518fd9e858303292bb7ab874e1b9 100644
--- a/arch/arm64/boot/dts/qcom/shikra.dtsi
+++ b/arch/arm64/boot/dts/qcom/shikra.dtsi
@@ -992,6 +992,13 @@ sdc2_card_det_n: sd-card-det-n-state {
drive-strength = <2>;
bias-pull-up;
};
+
+ gp_mn_active: gp-mn-active-state {
+ pins = "gpio87";
+ function = "gp_mn";
+ drive-strength = <2>;
+ bias-disable;
+ };
};
pmu@c91000 {
@@ -1303,6 +1310,20 @@ sram@4690000 {
reg = <0x0 0x04690000 0x0 0x14000>;
};
+ gp_mn: clock-controller@4713000 {
+ compatible = "qcom,shikra-gp-mnd", "qcom,sc7280-gp-mnd";
+ reg = <0x0 0x04713000 0x0 0x1000>;
+ clocks = <&gcc GCC_PDM_XO4_CLK>,
+ <&gcc GCC_PDM_AHB_CLK>;
+ clock-names = "pdm", "ahb";
+ #clock-cells = <0>;
+ pinctrl-0 = <&gp_mn_active>;
+ pinctrl-names = "default";
+ assigned-clocks = <&gcc GCC_PDM_XO4_CLK>;
+ assigned-clock-rates = <4800000>;
+ status = "disabled";
+ };
+
sdhc_1: mmc@4744000 {
compatible = "qcom,shikra-sdhci", "qcom,sdhci-msm-v5";
--
2.34.1
^ permalink raw reply related [flat|nested] 19+ messages in thread* Re: [PATCH v3 10/10] arm64: dts: qcom: shikra: Add GP M/N clock controller
2026-11-23 19:51 ` [PATCH v3 10/10] arm64: dts: qcom: shikra: " Taniya Das
@ 2026-11-24 19:53 ` sashiko-bot
0 siblings, 0 replies; 19+ messages in thread
From: sashiko-bot @ 2026-11-24 19:53 UTC (permalink / raw)
To: Taniya Das; +Cc: linux-clk, devicetree, linux-gpio, robh, conor+dt
Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [High] arm64: dts: qcom: shikra: undefined gp_mn pinmux function on
gpio87
--
commit 21f238a4776648cda5ae0104384fa487d48ca02b
Author: Taniya Das <taniya.das@oss.qualcomm.com>
arm64: dts: qcom: shikra: Add GP M/N clock controller
This commit adds the GP M/N clock controller node and its gpio87 pin
configuration to the Shikra SoC devicetree.
> diff --git a/arch/arm64/boot/dts/qcom/shikra.dtsi b/arch/arm64/boot/dts/qcom/shikra.dtsi
> index 0a95ad5a5582c..a5079b82f22f5 100644
> --- a/arch/arm64/boot/dts/qcom/shikra.dtsi
> +++ b/arch/arm64/boot/dts/qcom/shikra.dtsi
> @@ -992,6 +992,13 @@ sdc2_card_det_n: sd-card-det-n-state {
> drive-strength = <2>;
> bias-pull-up;
> };
> +
> + gp_mn_active: gp-mn-active-state {
> + pins = "gpio87";
> + function = "gp_mn";
> + drive-strength = <2>;
> + bias-disable;
> + };
> };
[Severity: High]
Is "gp_mn" a valid function for gpio87 on Shikra?
Neither Documentation/devicetree/bindings/pinctrl/qcom,shikra-tlmm.yaml
nor drivers/pinctrl/qcom/pinctrl-shikra.c defines a "gp_mn" function, and
pin 87 only defines "pwm":
drivers/pinctrl/qcom/pinctrl-shikra.c:shikra_groups[] {
...
[87] = PINGROUP(87, _, pwm, _, _, _, _, _, _, _, _, _),
...
}
When a board enables gp_mn, pinctrl_bind_pins() fails to resolve "gp_mn"
with -EINVAL and prevents clock-controller@4713000 from probing, and
dtbs_check fails schema validation on gp-mn-active-state.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261124-b4-pdm_clk_gp_mnd_v2-v3-0-98db26a87500@oss.qualcomm.com?part=10
^ permalink raw reply [flat|nested] 19+ messages in thread