* [PATCH v4 1/5] dt-bindings: phy: qcom: Add common qcom,csi2-phy
2026-12-01 21:02 [PATCH v4 0/5] phy: qcom-mipi-csi2: Add D-PHY support for sa8775p, qcs8300 and sc7280 Anusha Arun Nandi
@ 2026-12-01 21:02 ` Anusha Arun Nandi
2026-12-02 4:49 ` Bryan O'Donoghue
2026-12-01 21:02 ` [PATCH v4 2/5] phy: qcom-mipi-csi2: Make OPP table optional Anusha Arun Nandi
` (3 subsequent siblings)
4 siblings, 1 reply; 9+ messages in thread
From: Anusha Arun Nandi @ 2026-12-01 21:02 UTC (permalink / raw)
To: Bryan O'Donoghue
Cc: Vinod Koul, Neil Armstrong, Manivannan Sadhasivam,
gjorgji.rosikopulos, hariram.purushothaman, akapatra,
jigarkumar.zala, linux-phy, linux-media, linux-arm-msm,
linux-kernel, devicetree
SA8775P, QCS8300 and SC7280 CSI2 PHYs are bit-for-bit identical in
devicetree shape (ports, bus-type, data-lanes, operating-points-v2,
clocks, single "top" power-domain, vdda-hs/vdda-lp supplies).
Describe all three with a single qcom,csi2-phy.yaml and a compatible
oneOf, rather than one standalone schema per SoC. QCS8300 is further
required to be paired with a qcom,sa8775p-csi2-phy fallback
compatible. This lets the driver bind QCS8300 nodes via its
qcom,sa8775p-csi2-phy match entry rather than carrying a duplicate.
qcom,x1e80100-csi2-phy.yaml is a separate PHY with a different shape
(3 clocks, 3 power-domains, different supply names, DPHY split-mode
support) and is left untouched, but port@0's DPHY split-mode
definition (two endpoints, lane-count constraint) is cloned into this
schema rather than dropped, since this PHY supports the same split
mode.
The supply names are vdda-hs/vdda-lp rather than the hardware's own
power-rail names, since those names aren't guaranteed to stay
consistent across future platforms using this binding.
Co-developed-by: Jigarkumar Zala <jigarkumar.zala@oss.qualcomm.com>
Signed-off-by: Jigarkumar Zala <jigarkumar.zala@oss.qualcomm.com>
Signed-off-by: Anusha Arun Nandi <anusha.nandi@oss.qualcomm.com>
---
.../bindings/phy/qcom,csi2-phy.yaml | 201 ++++++++++++++++++
1 file changed, 201 insertions(+)
create mode 100644 Documentation/devicetree/bindings/phy/qcom,csi2-phy.yaml
diff --git a/Documentation/devicetree/bindings/phy/qcom,csi2-phy.yaml b/Documentation/devicetree/bindings/phy/qcom,csi2-phy.yaml
new file mode 100644
index 000000000000..44791802a3ed
--- /dev/null
+++ b/Documentation/devicetree/bindings/phy/qcom,csi2-phy.yaml
@@ -0,0 +1,201 @@
+# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
+# Copyright (c) 2026 Qualcomm Innovation Center, Inc. All rights reserved.
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/phy/qcom,csi2-phy.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Qualcomm CSI2 PHY
+
+maintainers:
+ - Anusha Arun Nandi <anusha.nandi@oss.qualcomm.com>
+
+description:
+ Qualcomm MIPI CSI2 D-PHY. Connects MIPI CSI2 sensors to Qualcomm's Camera
+ CSI Decoder.
+
+properties:
+ compatible:
+ oneOf:
+ - enum:
+ - qcom,sa8775p-csi2-phy
+ - qcom,sc7280-csi2-phy
+ - items:
+ - enum:
+ - qcom,qcs8300-csi2-phy
+ - const: qcom,sa8775p-csi2-phy
+
+ reg:
+ maxItems: 1
+
+ clocks:
+ maxItems: 2
+
+ clock-names:
+ items:
+ - const: core
+ - const: timer
+
+ interrupts:
+ maxItems: 1
+
+ operating-points-v2: true
+
+ opp-table:
+ type: object
+
+ power-domains:
+ items:
+ - description: Titan Top GDSC - Titan ISP Block, Global Distributed Switch Controller.
+
+ power-domain-names:
+ items:
+ - const: top
+
+ vdda-hs-supply:
+ description: Phandle to PHY supply.
+
+ vdda-lp-supply:
+ description: Phandle to PLL supply.
+
+ ports:
+ $ref: /schemas/graph.yaml#/properties/ports
+
+ properties:
+ port@0:
+ $ref: /schemas/graph.yaml#/$defs/port-base
+ description:
+ Sensor input. Always present. A single sensor is described by a
+ single endpoint with one to four data lanes, numbered 1-4. The
+ clock lane is position 0.
+
+ DPHY split mode, where two independent sensors share the PHY, is
+ described by two endpoints. endpoint@0 uses data lanes 1 or 1-2,
+ clock lane position 0; endpoint@1 uses data lane 3, clock lane
+ position 4.
+
+ unevaluatedProperties: false
+
+ patternProperties:
+ "^endpoint(@[01])?$":
+ $ref: /schemas/media/video-interfaces.yaml#
+ unevaluatedProperties: false
+ properties:
+ bus-type:
+ enum:
+ - 1 # MEDIA_BUS_TYPE_CSI2_CPHY
+ - 4 # MEDIA_BUS_TYPE_CSI2_DPHY
+ default: 4
+
+ data-lanes:
+ minItems: 1
+ maxItems: 4
+ items:
+ minimum: 1
+ maximum: 4
+ description:
+ Data lane positions following this endpoint's clock
+ lane. Positions are a per-port logical numbering, not
+ package pad or ball positions.
+
+ required:
+ - data-lanes
+ - remote-endpoint
+
+ allOf:
+ - if:
+ required:
+ - endpoint@1
+ then:
+ properties:
+ endpoint@0:
+ properties:
+ data-lanes:
+ maxItems: 2
+ items:
+ maximum: 2
+ endpoint@1:
+ properties:
+ data-lanes:
+ items:
+ - const: 3
+ required:
+ - endpoint@0
+
+ port@1:
+ $ref: /schemas/graph.yaml#/properties/port
+ description: Output to the CAMSS CSID controller.
+
+ required:
+ - port@0
+ - port@1
+
+required:
+ - compatible
+ - reg
+ - clocks
+ - clock-names
+ - interrupts
+ - operating-points-v2
+ - power-domains
+ - power-domain-names
+ - vdda-hs-supply
+ - vdda-lp-supply
+ - ports
+
+additionalProperties: false
+
+examples:
+ - |
+ #include <dt-bindings/clock/qcom,sa8775p-camcc.h>
+ #include <dt-bindings/interrupt-controller/arm-gic.h>
+ #include <dt-bindings/media/video-interfaces.h>
+
+ phy@ac9c000 {
+ compatible = "qcom,sa8775p-csi2-phy";
+ reg = <0x0ac9c000 0x2000>;
+
+ clocks = <&camcc CAM_CC_CSIPHY0_CLK>,
+ <&camcc CAM_CC_CSI0PHYTIMER_CLK>;
+ clock-names = "core",
+ "timer";
+
+ interrupts = <GIC_SPI 477 IRQ_TYPE_EDGE_RISING>;
+
+ operating-points-v2 = <&csiphy_opp_table>;
+
+ power-domains = <&camcc CAM_CC_TITAN_TOP_GDSC>;
+ power-domain-names = "top";
+
+ vdda-hs-supply = <&vreg_l4a>;
+ vdda-lp-supply = <&vreg_l1c>;
+
+ ports {
+ #address-cells = <1>;
+ #size-cells = <0>;
+
+ port@0 {
+ reg = <0>;
+ csiphy0_in: endpoint {
+ bus-type = <MEDIA_BUS_TYPE_CSI2_DPHY>;
+ data-lanes = <1 2 3 4>;
+ remote-endpoint = <&sensor_out>;
+ };
+ };
+
+ port@1 {
+ reg = <1>;
+ csiphy0_out: endpoint {
+ remote-endpoint = <&csid_in>;
+ };
+ };
+ };
+
+ csiphy_opp_table: opp-table {
+ compatible = "operating-points-v2";
+
+ opp-300000000 {
+ opp-hz = /bits/ 64 <300000000>;
+ };
+ };
+ };
--
2.34.1
^ permalink raw reply [flat|nested] 9+ messages in thread* Re: [PATCH v4 1/5] dt-bindings: phy: qcom: Add common qcom,csi2-phy
2026-12-01 21:02 ` [PATCH v4 1/5] dt-bindings: phy: qcom: Add common qcom,csi2-phy Anusha Arun Nandi
@ 2026-12-02 4:49 ` Bryan O'Donoghue
0 siblings, 0 replies; 9+ messages in thread
From: Bryan O'Donoghue @ 2026-12-02 4:49 UTC (permalink / raw)
To: Anusha Arun Nandi
Cc: Vinod Koul, Neil Armstrong, Manivannan Sadhasivam,
gjorgji.rosikopulos, hariram.purushothaman, akapatra,
jigarkumar.zala, linux-phy, linux-media, linux-arm-msm,
linux-kernel, devicetree
On 01/12/2026 21:02, Anusha Arun Nandi wrote:
> SA8775P, QCS8300 and SC7280 CSI2 PHYs are bit-for-bit identical in
> devicetree shape (ports, bus-type, data-lanes, operating-points-v2,
> clocks, single "top" power-domain, vdda-hs/vdda-lp supplies).
>
> Describe all three with a single qcom,csi2-phy.yaml and a compatible
> oneOf, rather than one standalone schema per SoC. QCS8300 is further
> required to be paired with a qcom,sa8775p-csi2-phy fallback
> compatible. This lets the driver bind QCS8300 nodes via its
> qcom,sa8775p-csi2-phy match entry rather than carrying a duplicate.
>
> qcom,x1e80100-csi2-phy.yaml is a separate PHY with a different shape
> (3 clocks, 3 power-domains, different supply names, DPHY split-mode
> support) and is left untouched, but port@0's DPHY split-mode
> definition (two endpoints, lane-count constraint) is cloned into this
> schema rather than dropped, since this PHY supports the same split
> mode.
Which is alot of cloning.
> The supply names are vdda-hs/vdda-lp rather than the hardware's own
> power-rail names, since those names aren't guaranteed to stay
> consistent across future platforms using this binding.
Shape appears twice here, I suspect a bit of LLMese needs tidying up.
Leaving that aside you _could_ represent all of the different changes
you want in the existing PHY description.
> Co-developed-by: Jigarkumar Zala <jigarkumar.zala@oss.qualcomm.com>
> Signed-off-by: Jigarkumar Zala <jigarkumar.zala@oss.qualcomm.com>
> Signed-off-by: Anusha Arun Nandi <anusha.nandi@oss.qualcomm.com>
> ---
> .../bindings/phy/qcom,csi2-phy.yaml | 201 ++++++++++++++++++
> 1 file changed, 201 insertions(+)
> create mode 100644 Documentation/devicetree/bindings/phy/qcom,csi2-phy.yaml
Leading me to my second point why is this file now the core file with
the x1e/x2e file being the odd one out. You end up with _alot_ of copy/paste
By my count you're one clock, two power-domains and two different rail
names.
> diff --git a/Documentation/devicetree/bindings/phy/qcom,csi2-phy.yaml b/Documentation/devicetree/bindings/phy/qcom,csi2-phy.yaml
> new file mode 100644
> index 000000000000..44791802a3ed
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/phy/qcom,csi2-phy.yaml
> @@ -0,0 +1,201 @@
> +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
> +# Copyright (c) 2026 Qualcomm Innovation Center, Inc. All rights reserved.
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/phy/qcom,csi2-phy.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: Qualcomm CSI2 PHY
> +
> +maintainers:
> + - Anusha Arun Nandi <anusha.nandi@oss.qualcomm.com>
> +
> +description:
> + Qualcomm MIPI CSI2 D-PHY. Connects MIPI CSI2 sensors to Qualcomm's Camera
> + CSI Decoder.
> +
> +properties:
> + compatible:
> + oneOf:
> + - enum:
> + - qcom,sa8775p-csi2-phy
> + - qcom,sc7280-csi2-phy
> + - items:
> + - enum:
> + - qcom,qcs8300-csi2-phy
> + - const: qcom,sa8775p-csi2-phy
> +
> + reg:
> + maxItems: 1
> +
> + clocks:
> + maxItems: 2
> +
> + clock-names:
> + items:
> + - const: core
> + - const: timer
> +
> + interrupts:
> + maxItems: 1
> +
> + operating-points-v2: true
> +
> + opp-table:
> + type: object
> +
> + power-domains:
> + items:
> + - description: Titan Top GDSC - Titan ISP Block, Global Distributed Switch Controller.
> +
> + power-domain-names:
> + items:
> + - const: top
I'm finding this a bit suspect. Up to v3 my submission was one power
domain, then we added MX/MMCX because the camcc lists those rails,
you're saying here your PHYs don't have those rails ?
Odd, to be honest, doesn't sound right.
> +
> + vdda-hs-supply:
> + description: Phandle to PHY supply.
> +
> + vdda-lp-supply:
> + description: Phandle to PLL supply.
But what is the justification for giving these names instead of voltages
? If you name them by voltage what are those voltages.
Ok, checked the inline CAMSS for this - sa8755p and qcs8300 are
vreg_l4a_0p88 and vreg_l1c_1p2, sc7280 is vreg_l10c_0p88 and
vreg_l6b_1p2 so these are two new names.
Documentation/devicetree/bindings/media/qcom,qcs8300-camss.yaml:
vdda-phy-supply = <&vreg_l4a_0p88>;
Documentation/devicetree/bindings/media/qcom,sa8775p-camss.yaml:
vdda-phy-supply = <&vreg_l4a_0p88>;
Documentation/devicetree/bindings/media/qcom,sc7280-camss.yaml:
vdda-pll-supply = <&vreg_l6b_1p2>;
So these are two new names, why ? We've established the PHY binding
names by voltage.
> +
> + ports:
> + $ref: /schemas/graph.yaml#/properties/ports
> +
> + properties:
> + port@0:
> + $ref: /schemas/graph.yaml#/$defs/port-base
> + description:
> + Sensor input. Always present. A single sensor is described by a
> + single endpoint with one to four data lanes, numbered 1-4. The
> + clock lane is position 0.
> +
> + DPHY split mode, where two independent sensors share the PHY, is
> + described by two endpoints. endpoint@0 uses data lanes 1 or 1-2,
> + clock lane position 0; endpoint@1 uses data lane 3, clock lane
> + position 4.
> +
> + unevaluatedProperties: false
> +
> + patternProperties:
> + "^endpoint(@[01])?$":
> + $ref: /schemas/media/video-interfaces.yaml#
> + unevaluatedProperties: false
> + properties:
> + bus-type:
> + enum:
> + - 1 # MEDIA_BUS_TYPE_CSI2_CPHY
> + - 4 # MEDIA_BUS_TYPE_CSI2_DPHY
> + default: 4
> +
> + data-lanes:
> + minItems: 1
> + maxItems: 4
> + items:
> + minimum: 1
> + maximum: 4
> + description:
> + Data lane positions following this endpoint's clock
> + lane. Positions are a per-port logical numbering, not
> + package pad or ball positions.
> +
> + required:
> + - data-lanes
> + - remote-endpoint
> +
> + allOf:
> + - if:
> + required:
> + - endpoint@1
> + then:
> + properties:
> + endpoint@0:
> + properties:
> + data-lanes:
> + maxItems: 2
> + items:
> + maximum: 2
> + endpoint@1:
> + properties:
> + data-lanes:
> + items:
> + - const: 3
> + required:
> + - endpoint@0
> +
> + port@1:
> + $ref: /schemas/graph.yaml#/properties/port
> + description: Output to the CAMSS CSID controller.
> +
> + required:
> + - port@0
> + - port@1
> +
> +required:
> + - compatible
> + - reg
> + - clocks
> + - clock-names
> + - interrupts
> + - operating-points-v2
> + - power-domains
> + - power-domain-names
> + - vdda-hs-supply
> + - vdda-lp-supply
> + - ports
> +
> +additionalProperties: false
> +
> +examples:
> + - |
> + #include <dt-bindings/clock/qcom,sa8775p-camcc.h>
> + #include <dt-bindings/interrupt-controller/arm-gic.h>
> + #include <dt-bindings/media/video-interfaces.h>
> +
> + phy@ac9c000 {
> + compatible = "qcom,sa8775p-csi2-phy";
> + reg = <0x0ac9c000 0x2000>;
> +
> + clocks = <&camcc CAM_CC_CSIPHY0_CLK>,
> + <&camcc CAM_CC_CSI0PHYTIMER_CLK>;
> + clock-names = "core",
> + "timer";
> +
> + interrupts = <GIC_SPI 477 IRQ_TYPE_EDGE_RISING>;
> +
> + operating-points-v2 = <&csiphy_opp_table>;
> +
> + power-domains = <&camcc CAM_CC_TITAN_TOP_GDSC>;
> + power-domain-names = "top";
> +
> + vdda-hs-supply = <&vreg_l4a>;
> + vdda-lp-supply = <&vreg_l1c>;
> +
> + ports {
> + #address-cells = <1>;
> + #size-cells = <0>;
> +
> + port@0 {
> + reg = <0>;
> + csiphy0_in: endpoint {
> + bus-type = <MEDIA_BUS_TYPE_CSI2_DPHY>;
> + data-lanes = <1 2 3 4>;
> + remote-endpoint = <&sensor_out>;
> + };
> + };
> +
> + port@1 {
> + reg = <1>;
> + csiphy0_out: endpoint {
> + remote-endpoint = <&csid_in>;
> + };
> + };
> + };
> +
> + csiphy_opp_table: opp-table {
> + compatible = "operating-points-v2";
> +
> + opp-300000000 {
> + opp-hz = /bits/ 64 <300000000>;
> + };
> + };
> + };
> --
> 2.34.1
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH v4 2/5] phy: qcom-mipi-csi2: Make OPP table optional
2026-12-01 21:02 [PATCH v4 0/5] phy: qcom-mipi-csi2: Add D-PHY support for sa8775p, qcs8300 and sc7280 Anusha Arun Nandi
2026-12-01 21:02 ` [PATCH v4 1/5] dt-bindings: phy: qcom: Add common qcom,csi2-phy Anusha Arun Nandi
@ 2026-12-01 21:02 ` Anusha Arun Nandi
2026-12-02 4:55 ` Bryan O'Donoghue
2026-12-01 21:02 ` [PATCH v4 3/5] phy: qcom-mipi-csi2: restructure D-PHY into core.c and dphy-regs.h Anusha Arun Nandi
` (2 subsequent siblings)
4 siblings, 1 reply; 9+ messages in thread
From: Anusha Arun Nandi @ 2026-12-01 21:02 UTC (permalink / raw)
To: Bryan O'Donoghue
Cc: Vinod Koul, Neil Armstrong, Manivannan Sadhasivam,
gjorgji.rosikopulos, hariram.purushothaman, akapatra,
jigarkumar.zala, linux-phy, linux-media, linux-arm-msm,
linux-kernel, devicetree
Not every SoC the generic MIPI CSI2 PHY driver supports needs an OPP
table: a CSIPHY with only a single, unscaled power-domain has no
performance state to vote on, so running its "core" clock through
the OPP framework buys nothing over a plain clk_set_rate(). Add a
no_opp flag to struct mipi_csi2phy_soc_cfg and skip
devm_pm_opp_set_clkname()/devm_pm_opp_of_add_table() in probe() and
the OPP/performance-state handling in
phy_qcom_mipi_csi2_set_clock_rates() when it's set, falling back to
clk_round_rate()/clk_set_rate() on the timer clock only.
x1e80100 doesn't set no_opp, so this is a no-op for it. The "core"/
"timer" clock-name strings themselves stay hardcoded literals: every
SoC this driver supports uses the same two names, so there's nothing
to make configurable there.
Co-developed-by: Jigarkumar Zala <jigarkumar.zala@oss.qualcomm.com>
Signed-off-by: Jigarkumar Zala <jigarkumar.zala@oss.qualcomm.com>
Signed-off-by: Anusha Arun Nandi <anusha.nandi@oss.qualcomm.com>
---
.../phy/qualcomm/phy-qcom-mipi-csi2-core.c | 72 ++++++++++---------
drivers/phy/qualcomm/phy-qcom-mipi-csi2.h | 3 +
2 files changed, 42 insertions(+), 33 deletions(-)
diff --git a/drivers/phy/qualcomm/phy-qcom-mipi-csi2-core.c b/drivers/phy/qualcomm/phy-qcom-mipi-csi2-core.c
index 269232499fca..8bebc943a771 100644
--- a/drivers/phy/qualcomm/phy-qcom-mipi-csi2-core.c
+++ b/drivers/phy/qualcomm/phy-qcom-mipi-csi2-core.c
@@ -32,40 +32,43 @@ phy_qcom_mipi_csi2_set_clock_rates(struct mipi_csi2phy_device *csi2phy,
unsigned long opp_rate = link_freq / 4;
struct dev_pm_opp *opp;
long timer_rate;
- int i, pstate;
+ int i = 0, pstate;
int ret;
- opp = dev_pm_opp_find_freq_ceil(dev, &opp_rate);
- if (IS_ERR(opp)) {
- dev_err(csi2phy->dev, "Couldn't find ceiling for %lld Hz\n",
- link_freq);
- return PTR_ERR(opp);
- }
+ if (!csi2phy->soc_cfg->no_opp) {
+ opp = dev_pm_opp_find_freq_ceil(dev, &opp_rate);
+ if (IS_ERR(opp)) {
+ dev_err(csi2phy->dev, "Couldn't find ceiling for %lld Hz\n",
+ link_freq);
+ return PTR_ERR(opp);
+ }
- pstate = 0;
- for (i = 0; csi2phy->pd_list && i < csi2phy->pd_list->num_pds; i++) {
- unsigned int perf;
+ pstate = 0;
+ for (i = 0; csi2phy->pd_list && i < csi2phy->pd_list->num_pds; i++) {
+ unsigned int perf;
- if (!csi2phy->soc_cfg->genpds[i].scaled)
- continue;
+ if (!csi2phy->soc_cfg->genpds[i].scaled)
+ continue;
- perf = dev_pm_opp_get_required_pstate(opp, pstate);
- pstate += 1;
+ perf = dev_pm_opp_get_required_pstate(opp, pstate);
+ pstate += 1;
- ret = dev_pm_genpd_set_performance_state(csi2phy->pd_list->pd_devs[i], perf);
- if (ret) {
- dev_err(csi2phy->dev, "Couldn't set perf state %u\n",
- perf);
- dev_pm_opp_put(opp);
- goto unset_pstate;
+ ret = dev_pm_genpd_set_performance_state(csi2phy->pd_list->pd_devs[i],
+ perf);
+ if (ret) {
+ dev_err(csi2phy->dev, "Couldn't set perf state %u\n",
+ perf);
+ dev_pm_opp_put(opp);
+ goto unset_pstate;
+ }
}
- }
- dev_pm_opp_put(opp);
+ dev_pm_opp_put(opp);
- ret = dev_pm_opp_set_rate(dev, opp_rate);
- if (ret) {
- dev_err(csi2phy->dev, "dev_pm_opp_set_rate() fail\n");
- goto unset_opp_rate;
+ ret = dev_pm_opp_set_rate(dev, opp_rate);
+ if (ret) {
+ dev_err(csi2phy->dev, "dev_pm_opp_set_rate() fail\n");
+ goto unset_opp_rate;
+ }
}
timer_rate = clk_round_rate(csi2phy->timer_clk, link_freq / 4);
@@ -83,7 +86,8 @@ phy_qcom_mipi_csi2_set_clock_rates(struct mipi_csi2phy_device *csi2phy,
return 0;
unset_opp_rate:
- dev_pm_opp_set_rate(dev, 0);
+ if (!csi2phy->soc_cfg->no_opp)
+ dev_pm_opp_set_rate(dev, 0);
unset_pstate:
while (i--) {
@@ -405,13 +409,15 @@ static int phy_qcom_mipi_csi2_probe(struct platform_device *pdev)
if (!csi2phy->timer_clk)
return dev_err_probe(dev, -ENODEV, "no timer clock\n");
- ret = devm_pm_opp_set_clkname(dev, "core");
- if (ret)
- return dev_err_probe(dev, ret, "Failed to set opp clkname\n");
+ if (!csi2phy->soc_cfg->no_opp) {
+ ret = devm_pm_opp_set_clkname(dev, "core");
+ if (ret)
+ return dev_err_probe(dev, ret, "Failed to set opp clkname\n");
- ret = devm_pm_opp_of_add_table(dev);
- if (ret)
- return dev_err_probe(dev, ret, "invalid OPP table in device tree\n");
+ ret = devm_pm_opp_of_add_table(dev);
+ if (ret)
+ return dev_err_probe(dev, ret, "invalid OPP table in device tree\n");
+ }
num_supplies = csi2phy->soc_cfg->num_supplies;
csi2phy->supplies = devm_kzalloc(dev, sizeof(*csi2phy->supplies) * num_supplies,
diff --git a/drivers/phy/qualcomm/phy-qcom-mipi-csi2.h b/drivers/phy/qualcomm/phy-qcom-mipi-csi2.h
index 7e55ae007370..6cf9e5b956f7 100644
--- a/drivers/phy/qualcomm/phy-qcom-mipi-csi2.h
+++ b/drivers/phy/qualcomm/phy-qcom-mipi-csi2.h
@@ -68,6 +68,9 @@ struct mipi_csi2phy_soc_cfg {
const char ** const clk_names;
const unsigned int num_clk;
+ /* No OPP table for this SoC's CSIPHY: skip OPP-based clock/pstate scaling. */
+ const bool no_opp;
+
const struct mipi_csi2_genpd *genpds;
const unsigned int num_genpds;
};
--
2.34.1
^ permalink raw reply [flat|nested] 9+ messages in thread* Re: [PATCH v4 2/5] phy: qcom-mipi-csi2: Make OPP table optional
2026-12-01 21:02 ` [PATCH v4 2/5] phy: qcom-mipi-csi2: Make OPP table optional Anusha Arun Nandi
@ 2026-12-02 4:55 ` Bryan O'Donoghue
0 siblings, 0 replies; 9+ messages in thread
From: Bryan O'Donoghue @ 2026-12-02 4:55 UTC (permalink / raw)
To: Anusha Arun Nandi
Cc: Vinod Koul, Neil Armstrong, Manivannan Sadhasivam,
gjorgji.rosikopulos, hariram.purushothaman, akapatra,
jigarkumar.zala, linux-phy, linux-media, linux-arm-msm,
linux-kernel, devicetree
On 01/12/2026 21:02, Anusha Arun Nandi wrote:
> Not every SoC the generic MIPI CSI2 PHY driver supports needs an OPP
> table: a CSIPHY with only a single, unscaled power-domain has no
> performance state to vote on, so running its "core" clock through
> the OPP framework buys nothing over a plain clk_set_rate(). Add a
> no_opp flag to struct mipi_csi2phy_soc_cfg and skip
> devm_pm_opp_set_clkname()/devm_pm_opp_of_add_table() in probe() and
> the OPP/performance-state handling in
> phy_qcom_mipi_csi2_set_clock_rates() when it's set, falling back to
> clk_round_rate()/clk_set_rate() on the timer clock only.
There should definitely be a CX and MX rail for this hardware.
> x1e80100 doesn't set no_opp, so this is a no-op for it. The "core"/
> "timer" clock-name strings themselves stay hardcoded literals: every
> SoC this driver supports uses the same two names, so there's nothing
> to make configurable there.
>
> Co-developed-by: Jigarkumar Zala<jigarkumar.zala@oss.qualcomm.com>
> Signed-off-by: Jigarkumar Zala<jigarkumar.zala@oss.qualcomm.com>
> Signed-off-by: Anusha Arun Nandi<anusha.nandi@oss.qualcomm.com>
---
bod
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH v4 3/5] phy: qcom-mipi-csi2: restructure D-PHY into core.c and dphy-regs.h
2026-12-01 21:02 [PATCH v4 0/5] phy: qcom-mipi-csi2: Add D-PHY support for sa8775p, qcs8300 and sc7280 Anusha Arun Nandi
2026-12-01 21:02 ` [PATCH v4 1/5] dt-bindings: phy: qcom: Add common qcom,csi2-phy Anusha Arun Nandi
2026-12-01 21:02 ` [PATCH v4 2/5] phy: qcom-mipi-csi2: Make OPP table optional Anusha Arun Nandi
@ 2026-12-01 21:02 ` Anusha Arun Nandi
2026-12-02 5:20 ` Bryan O'Donoghue
2026-12-01 21:02 ` [PATCH v4 4/5] phy: qcom-mipi-csi2: Add sa8775p D-PHY support Anusha Arun Nandi
2026-12-01 21:02 ` [PATCH v4 5/5] phy: qcom-mipi-csi2: Add sc7280 D-PHY provider Anusha Arun Nandi
4 siblings, 1 reply; 9+ messages in thread
From: Anusha Arun Nandi @ 2026-12-01 21:02 UTC (permalink / raw)
To: Bryan O'Donoghue
Cc: Vinod Koul, Neil Armstrong, Manivannan Sadhasivam,
gjorgji.rosikopulos, hariram.purushothaman, akapatra,
jigarkumar.zala, linux-phy, linux-media, linux-arm-msm,
linux-kernel, devicetree
Restructure phy-qcom-mipi-csi2-3ph-dphy.c: its functions
(csi2phy_dev_to_regs(), hw_version_read()/reset()/settle_cnt_calc()/
gen2_config_lanes()/lanes_enable()/lanes_disable()) and the D-PHY
hw_ops table move into phy-qcom-mipi-csi2-core.c, while its register
data (lane_regs_x1e80100[] and the x1e80100 soc_cfg plus its clk/
supply/genpd name arrays) moves into a new
phy-qcom-mipi-csi2-dphy-regs.h. There is no longer a separate
code-bearing D-PHY source file: core.c now holds every PHY-framework
and D-PHY register-programming function plus the hw_ops table that
binds them, and the new header holds nothing but const data, #included
at the top of core.c. The per-SoC soc_cfg reaches the hw_ops table
through an extern in the shared phy-qcom-mipi-csi2.h.
This keeps the maintainability and readability.
The CSIPHY_3PH_CMN_* common-control register macros and the
CSIPHY_DEFAULT_PARAMS/_SETTLE_CNT_LOWER_BYTE/_SKEW_CAL param_type
values both move into that shared header too, since the new
dphy-regs.h's register tables need the param_type values and
core.c's register-write/read functions need the CTRL/STATUS offset
macros, the mipi_csi2_dphy_4nm_x1e extern drops out of the shared
header, since the soc_cfg object is now static and consumed only by
core.c.
No functional change: register addresses, values, and param_type
tags are unchanged.
Co-developed-by: Jigarkumar Zala <jigarkumar.zala@oss.qualcomm.com>
Signed-off-by: Jigarkumar Zala <jigarkumar.zala@oss.qualcomm.com>
Signed-off-by: Anusha Arun Nandi <anusha.nandi@oss.qualcomm.com>
---
drivers/phy/qualcomm/Makefile | 3 +-
.../phy/qualcomm/phy-qcom-mipi-csi2-core.c | 232 ++++++++++++++++-
...-dphy.c => phy-qcom-mipi-csi2-dphy-regs.h} | 238 +-----------------
drivers/phy/qualcomm/phy-qcom-mipi-csi2.h | 21 +-
4 files changed, 249 insertions(+), 245 deletions(-)
rename drivers/phy/qualcomm/{phy-qcom-mipi-csi2-3ph-dphy.c => phy-qcom-mipi-csi2-dphy-regs.h} (56%)
diff --git a/drivers/phy/qualcomm/Makefile b/drivers/phy/qualcomm/Makefile
index 4b5e6640a6fa..bae82e18c674 100644
--- a/drivers/phy/qualcomm/Makefile
+++ b/drivers/phy/qualcomm/Makefile
@@ -7,8 +7,7 @@ obj-$(CONFIG_PHY_QCOM_IPQ806X_SATA) += phy-qcom-ipq806x-sata.o
obj-$(CONFIG_PHY_QCOM_M31_USB) += phy-qcom-m31.o
obj-$(CONFIG_PHY_QCOM_M31_EUSB) += phy-qcom-m31-eusb2.o
-phy-qcom-mipi-csi2-objs += phy-qcom-mipi-csi2-core.o \
- phy-qcom-mipi-csi2-3ph-dphy.o
+phy-qcom-mipi-csi2-objs += phy-qcom-mipi-csi2-core.o
obj-$(CONFIG_PHY_QCOM_MIPI_CSI2) += phy-qcom-mipi-csi2.o
obj-$(CONFIG_PHY_QCOM_PCIE2) += phy-qcom-pcie2.o
diff --git a/drivers/phy/qualcomm/phy-qcom-mipi-csi2-core.c b/drivers/phy/qualcomm/phy-qcom-mipi-csi2-core.c
index 8bebc943a771..8a89ece01261 100644
--- a/drivers/phy/qualcomm/phy-qcom-mipi-csi2-core.c
+++ b/drivers/phy/qualcomm/phy-qcom-mipi-csi2-core.c
@@ -9,20 +9,233 @@
#include <linux/err.h>
#include <linux/io.h>
#include <linux/kernel.h>
+#include <linux/math64.h>
#include <linux/module.h>
#include <linux/of.h>
-#include <linux/pm_opp.h>
#include <linux/phy/phy.h>
#include <linux/phy/phy-mipi-dphy.h>
#include <linux/platform_device.h>
#include <linux/pm_domain.h>
+#include <linux/pm_opp.h>
#include <linux/pm_runtime.h>
-#include <linux/regmap.h>
#include <linux/regulator/consumer.h>
-#include <linux/reset.h>
#include <linux/slab.h>
+#include <linux/time64.h>
#include "phy-qcom-mipi-csi2.h"
+/* D-PHY register tables and per-SoC soc_cfg objects (pure data). */
+#include "phy-qcom-mipi-csi2-dphy-regs.h"
+
+#define CSIPHY_2PH_LN_CSI_2PHASE_CTRL9n(n) ((0x200 * (n)) + 0x24)
+
+/*
+ * 3 phase CSI has 19 common status regs with only 0-10 being used
+ * and 11-18 being reserved.
+ */
+#define CSI_COMMON_STATUS_NUM 11
+/*
+ * There are a number of common control registers
+ * The offset to clear the CSIPHY IRQ status starts @ 22
+ * So to clear CSI_COMMON_STATUS0 this is CSI_COMMON_CONTROL22, STATUS1 is
+ * CONTROL23 and so on
+ */
+#define CSI_CTRL_STATUS_INDEX 22
+
+/*
+ * There are 43 COMMON_CTRL registers with regs after # 33 being reserved
+ */
+#define CSI_CTRL_MAX 33
+
+static inline const struct mipi_csi2phy_device_regs *
+csi2phy_dev_to_regs(struct mipi_csi2phy_device *csi2phy)
+{
+ return &csi2phy->soc_cfg->reg_info;
+}
+
+static void phy_qcom_mipi_csi2_hw_version_read(struct mipi_csi2phy_device *csi2phy)
+{
+ const struct mipi_csi2phy_device_regs *regs = csi2phy_dev_to_regs(csi2phy);
+ u32 tmp;
+
+ writel(CSIPHY_3PH_CMN_CSI_COMMON_CTRL6_SHOW_REV_ID, csi2phy->base +
+ CSIPHY_3PH_CMN_CSI_COMMON_CTRLn(regs->common_regs_offset, 6));
+
+ tmp = readl_relaxed(csi2phy->base +
+ CSIPHY_3PH_CMN_CSI_COMMON_STATUSn(regs->common_regs_offset, 12));
+ csi2phy->hw_version = tmp;
+
+ tmp = readl_relaxed(csi2phy->base +
+ CSIPHY_3PH_CMN_CSI_COMMON_STATUSn(regs->common_regs_offset, 13));
+ csi2phy->hw_version |= (tmp << 8) & 0xFF00;
+
+ tmp = readl_relaxed(csi2phy->base +
+ CSIPHY_3PH_CMN_CSI_COMMON_STATUSn(regs->common_regs_offset, 14));
+ csi2phy->hw_version |= (tmp << 16) & 0xFF0000;
+
+ tmp = readl_relaxed(csi2phy->base +
+ CSIPHY_3PH_CMN_CSI_COMMON_STATUSn(regs->common_regs_offset, 15));
+ csi2phy->hw_version |= (tmp << 24) & 0xFF000000;
+
+ dev_dbg_once(csi2phy->dev, "CSIPHY 3PH HW Version = 0x%08x\n", csi2phy->hw_version);
+}
+
+/*
+ * phy_qcom_mipi_csi2_reset - Perform software reset on CSIPHY module
+ * @csi2phy: CSIPHY device
+ */
+static void phy_qcom_mipi_csi2_reset(struct mipi_csi2phy_device *csi2phy)
+{
+ const struct mipi_csi2phy_device_regs *regs = csi2phy_dev_to_regs(csi2phy);
+
+ writel(CSIPHY_3PH_CMN_CSI_COMMON_CTRL0_PHY_SW_RESET,
+ csi2phy->base + CSIPHY_3PH_CMN_CSI_COMMON_CTRLn(regs->common_regs_offset, 0));
+ usleep_range(5000, 8000);
+ writel(0x0, csi2phy->base +
+ CSIPHY_3PH_CMN_CSI_COMMON_CTRLn(regs->common_regs_offset, 0));
+}
+
+static void
+phy_qcom_mipi_csi2_lanes_disable(struct mipi_csi2phy_device *csi2phy,
+ struct mipi_csi2phy_stream_cfg *cfg)
+{
+ const struct mipi_csi2phy_device_regs *regs = csi2phy_dev_to_regs(csi2phy);
+
+ writel(0, csi2phy->base +
+ CSIPHY_3PH_CMN_CSI_COMMON_CTRLn(regs->common_regs_offset, 5));
+
+ writel(0, csi2phy->base +
+ CSIPHY_3PH_CMN_CSI_COMMON_CTRLn(regs->common_regs_offset, 6));
+}
+
+/*
+ * phy_qcom_mipi_csi2_settle_cnt_calc - Calculate settle count value
+ *
+ * Helper function to calculate settle count value. This is
+ * based on the CSI2 T_hs_settle parameter which in turn
+ * is calculated based on the CSI2 transmitter link frequency.
+ *
+ * Return settle count.
+ */
+static u8 phy_qcom_mipi_csi2_settle_cnt_calc(s64 link_freq, u32 timer_clk_rate)
+{
+ u32 t_hs_prepare_max_ps;
+ u32 timer_period_ps;
+ u32 t_hs_settle_ps;
+ u8 settle_cnt;
+ u32 ui_ps;
+
+ ui_ps = div64_u64(PSEC_PER_SEC, link_freq);
+ ui_ps /= 2;
+ t_hs_prepare_max_ps = 85000 + 6 * ui_ps;
+ t_hs_settle_ps = t_hs_prepare_max_ps;
+
+ timer_period_ps = div_u64(PSEC_PER_SEC, timer_clk_rate);
+
+ if ((t_hs_settle_ps / timer_period_ps) < 6)
+ return 0;
+
+ settle_cnt = t_hs_settle_ps / timer_period_ps - 6;
+
+ return settle_cnt;
+}
+
+static void
+phy_qcom_mipi_csi2_gen2_config_lanes(struct mipi_csi2phy_device *csi2phy,
+ u8 settle_cnt)
+{
+ const struct mipi_csi2phy_device_regs *regs = csi2phy_dev_to_regs(csi2phy);
+ const struct mipi_csi2phy_lane_regs *r = regs->init_seq;
+ int i, array_size = regs->lane_array_size;
+ u32 val;
+
+ for (i = 0; i < array_size; i++, r++) {
+ switch (r->param_type) {
+ case CSIPHY_SETTLE_CNT_LOWER_BYTE:
+ val = settle_cnt & 0xff;
+ break;
+ case CSIPHY_SKEW_CAL:
+ /* TODO: support application of skew from dt flag */
+ continue;
+ default:
+ val = r->reg_data;
+ break;
+ }
+ writel(val, csi2phy->base + r->reg_addr);
+ if (r->delay_us)
+ udelay(r->delay_us);
+ }
+}
+
+static int phy_qcom_mipi_csi2_lanes_enable(struct mipi_csi2phy_device *csi2phy,
+ struct mipi_csi2phy_stream_cfg *cfg)
+{
+ const struct mipi_csi2phy_device_regs *regs = csi2phy_dev_to_regs(csi2phy);
+ struct mipi_csi2phy_lanes_cfg *lane_cfg = &cfg->lane_cfg;
+ u8 settle_cnt;
+ u8 val;
+ int i;
+
+ if (cfg->link_freq <= 0)
+ return -EINVAL;
+
+ settle_cnt = phy_qcom_mipi_csi2_settle_cnt_calc(cfg->link_freq, csi2phy->timer_clk_rate);
+ if (!settle_cnt)
+ return -ENODEV;
+
+ /*
+ * CSI_COMMON_CTRL5 is a physical lane power-up bitmap:
+ * - Bits [0,2,4,6] → D-PHY data lanes(LN0, LN2, LN4, LN6)
+ * - Bits [1,3,5] → C-PHY trio lanes(LN1, LN3, LN5)
+ * - Bit [7] → D-PHY clock lane(LNCK) dedicated clock enable
+ */
+ val = BIT(lane_cfg->clk.pos);
+ for (i = 0; i < cfg->num_data_lanes; i++)
+ val |= BIT(lane_cfg->data[i].pos * 2);
+
+ writel(val, csi2phy->base +
+ CSIPHY_3PH_CMN_CSI_COMMON_CTRLn(regs->common_regs_offset, 5));
+
+ /* Lane configuration for polarity @ CSIPHY-base + CTRL9 */
+ for (i = 0; i < cfg->num_data_lanes; i++) {
+ if (lane_cfg->data[i].pol) {
+ u8 pos = lane_cfg->data[i].pos;
+
+ writel(BIT(2), csi2phy->base + CSIPHY_2PH_LN_CSI_2PHASE_CTRL9n(pos * 2));
+ }
+ }
+
+ if (lane_cfg->clk.pol)
+ writel(BIT(2), csi2phy->base + CSIPHY_2PH_LN_CSI_2PHASE_CTRL9n(lane_cfg->clk.pos));
+
+ val = CSIPHY_3PH_CMN_CSI_COMMON_CTRL6_COMMON_PWRDN_B;
+ writel(val, csi2phy->base +
+ CSIPHY_3PH_CMN_CSI_COMMON_CTRLn(regs->common_regs_offset, 6));
+
+ val = 0x02;
+ writel(val, csi2phy->base +
+ CSIPHY_3PH_CMN_CSI_COMMON_CTRLn(regs->common_regs_offset, 7));
+
+ val = 0x00;
+ writel(val, csi2phy->base +
+ CSIPHY_3PH_CMN_CSI_COMMON_CTRLn(regs->common_regs_offset, 0));
+
+ phy_qcom_mipi_csi2_gen2_config_lanes(csi2phy, settle_cnt);
+
+ /* IRQ_MASK registers - disable all interrupts */
+ for (i = CSI_COMMON_STATUS_NUM; i < CSI_CTRL_STATUS_INDEX; i++) {
+ writel(0, csi2phy->base +
+ CSIPHY_3PH_CMN_CSI_COMMON_CTRLn(regs->common_regs_offset, i));
+ }
+
+ return 0;
+}
+
+const struct mipi_csi2phy_hw_ops phy_qcom_mipi_csi2_ops_3ph_1_0 = {
+ .hw_version_read = phy_qcom_mipi_csi2_hw_version_read,
+ .reset = phy_qcom_mipi_csi2_reset,
+ .lanes_enable = phy_qcom_mipi_csi2_lanes_enable,
+ .lanes_disable = phy_qcom_mipi_csi2_lanes_disable,
+};
static int
phy_qcom_mipi_csi2_set_clock_rates(struct mipi_csi2phy_device *csi2phy,
@@ -239,11 +452,10 @@ static int phy_qcom_mipi_csi2_attach_pm_domains(struct mipi_csi2phy_device *csi2
/* Single power-domain devices are already attached by the bus core. */
if (csi2phy->soc_cfg->num_genpds == 1)
- return dev_pm_domain_attach(csi2phy->dev, 0);
+ return dev_pm_domain_attach(csi2phy->dev, false);
- pd_names = devm_kzalloc(csi2phy->dev,
- sizeof(char *) * csi2phy->soc_cfg->num_genpds,
- GFP_KERNEL);
+ pd_names = devm_kcalloc(csi2phy->dev, csi2phy->soc_cfg->num_genpds,
+ sizeof(*pd_names), GFP_KERNEL);
if (!pd_names)
return -ENOMEM;
@@ -370,7 +582,6 @@ static int phy_qcom_mipi_csi2_probe(struct platform_device *pdev)
dev_set_drvdata(dev, csi2phy);
csi2phy->soc_cfg = device_get_match_data(&pdev->dev);
-
if (!csi2phy->soc_cfg)
return -EINVAL;
@@ -392,10 +603,9 @@ static int phy_qcom_mipi_csi2_probe(struct platform_device *pdev)
if (ret < 0)
return dev_err_probe(dev, ret, "Failed to get clocks\n");
- if (num_clk != ret) {
+ if (num_clk != ret)
return dev_err_probe(dev, -ENODEV, "clock count %d expected %d\n",
ret, num_clk);
- }
for (i = 0; i < num_clk; i++) {
if (!csi2phy->clks[i].id)
@@ -420,7 +630,7 @@ static int phy_qcom_mipi_csi2_probe(struct platform_device *pdev)
}
num_supplies = csi2phy->soc_cfg->num_supplies;
- csi2phy->supplies = devm_kzalloc(dev, sizeof(*csi2phy->supplies) * num_supplies,
+ csi2phy->supplies = devm_kcalloc(dev, num_supplies, sizeof(*csi2phy->supplies),
GFP_KERNEL);
if (!csi2phy->supplies)
return -ENOMEM;
diff --git a/drivers/phy/qualcomm/phy-qcom-mipi-csi2-3ph-dphy.c b/drivers/phy/qualcomm/phy-qcom-mipi-csi2-dphy-regs.h
similarity index 56%
rename from drivers/phy/qualcomm/phy-qcom-mipi-csi2-3ph-dphy.c
rename to drivers/phy/qualcomm/phy-qcom-mipi-csi2-dphy-regs.h
index 966d79c98f9b..2f07cd487b8d 100644
--- a/drivers/phy/qualcomm/phy-qcom-mipi-csi2-3ph-dphy.c
+++ b/drivers/phy/qualcomm/phy-qcom-mipi-csi2-dphy-regs.h
@@ -1,50 +1,15 @@
-// SPDX-License-Identifier: GPL-2.0
+/* SPDX-License-Identifier: GPL-2.0 */
/*
- * Qualcomm MSM Camera Subsystem - CSIPHY Module 3phase v1.0
+ * Qualcomm MSM Camera Subsystem - CSIPHY Module 3phase v1.0, D-PHY register data
*
* Copyright (c) 2011-2015, The Linux Foundation. All rights reserved.
* Copyright (C) 2016-2026 Linaro Ltd.
*/
-
-#include <linux/delay.h>
-#include <linux/interrupt.h>
-#include <linux/io.h>
-#include <linux/time64.h>
+#ifndef __PHY_QCOM_MIPI_CSI2_DPHY_REGS_H__
+#define __PHY_QCOM_MIPI_CSI2_DPHY_REGS_H__
#include "phy-qcom-mipi-csi2.h"
-#define CSIPHY_3PH_CMN_CSI_COMMON_CTRLn(offset, n) ((offset) + 0x4 * (n))
-#define CSIPHY_3PH_CMN_CSI_COMMON_CTRL0_PHY_SW_RESET BIT(0)
-#define CSIPHY_3PH_CMN_CSI_COMMON_CTRL5_CLK_ENABLE BIT(7)
-#define CSIPHY_3PH_CMN_CSI_COMMON_CTRL6_COMMON_PWRDN_B BIT(0)
-#define CSIPHY_3PH_CMN_CSI_COMMON_CTRL6_SHOW_REV_ID BIT(1)
-#define CSIPHY_3PH_CMN_CSI_COMMON_CTRL10_IRQ_CLEAR_CMD BIT(0)
-#define CSIPHY_3PH_CMN_CSI_COMMON_STATUSn(offset, n) ((offset) + 0xb0 + 0x4 * (n))
-
-#define CSIPHY_2PH_LN_CSI_2PHASE_CTRL9n(n) ((0x200 * (n)) + 0x24)
-
-/*
- * 3 phase CSI has 19 common status regs with only 0-10 being used
- * and 11-18 being reserved.
- */
-#define CSI_COMMON_STATUS_NUM 11
-/*
- * There are a number of common control registers
- * The offset to clear the CSIPHY IRQ status starts @ 22
- * So to clear CSI_COMMON_STATUS0 this is CSI_COMMON_CONTROL22, STATUS1 is
- * CONTROL23 and so on
- */
-#define CSI_CTRL_STATUS_INDEX 22
-
-/*
- * There are 43 COMMON_CTRL registers with regs after # 33 being reserved
- */
-#define CSI_CTRL_MAX 33
-
-#define CSIPHY_DEFAULT_PARAMS 0
-#define CSIPHY_SETTLE_CNT_LOWER_BYTE 2
-#define CSIPHY_SKEW_CAL 7
-
/* 4nm 2PH v 2.1.2 2p5Gbps 4 lane DPHY mode */
static const struct
mipi_csi2phy_lane_regs lane_regs_x1e80100[] = {
@@ -161,197 +126,6 @@ mipi_csi2phy_lane_regs lane_regs_x1e80100[] = {
{.reg_addr = 0x0c64, .reg_data = 0x7f, .param_type = CSIPHY_SKEW_CAL},
};
-static inline const struct mipi_csi2phy_device_regs *
-csi2phy_dev_to_regs(struct mipi_csi2phy_device *csi2phy)
-{
- return &csi2phy->soc_cfg->reg_info;
-}
-
-static void phy_qcom_mipi_csi2_hw_version_read(struct mipi_csi2phy_device *csi2phy)
-{
- const struct mipi_csi2phy_device_regs *regs = csi2phy_dev_to_regs(csi2phy);
- u32 tmp;
-
- writel(CSIPHY_3PH_CMN_CSI_COMMON_CTRL6_SHOW_REV_ID, csi2phy->base +
- CSIPHY_3PH_CMN_CSI_COMMON_CTRLn(regs->common_regs_offset, 6));
-
- tmp = readl_relaxed(csi2phy->base +
- CSIPHY_3PH_CMN_CSI_COMMON_STATUSn(regs->common_regs_offset, 12));
- csi2phy->hw_version = tmp;
-
- tmp = readl_relaxed(csi2phy->base +
- CSIPHY_3PH_CMN_CSI_COMMON_STATUSn(regs->common_regs_offset, 13));
- csi2phy->hw_version |= (tmp << 8) & 0xFF00;
-
- tmp = readl_relaxed(csi2phy->base +
- CSIPHY_3PH_CMN_CSI_COMMON_STATUSn(regs->common_regs_offset, 14));
- csi2phy->hw_version |= (tmp << 16) & 0xFF0000;
-
- tmp = readl_relaxed(csi2phy->base +
- CSIPHY_3PH_CMN_CSI_COMMON_STATUSn(regs->common_regs_offset, 15));
- csi2phy->hw_version |= (tmp << 24) & 0xFF000000;
-
- dev_dbg_once(csi2phy->dev, "CSIPHY 3PH HW Version = 0x%08x\n", csi2phy->hw_version);
-}
-
-/*
- * phy_qcom_mipi_csi2_reset - Perform software reset on CSIPHY module
- * @phy_qcom_mipi_csi2: CSIPHY device
- */
-static void phy_qcom_mipi_csi2_reset(struct mipi_csi2phy_device *csi2phy)
-{
- const struct mipi_csi2phy_device_regs *regs = csi2phy_dev_to_regs(csi2phy);
-
- writel(CSIPHY_3PH_CMN_CSI_COMMON_CTRL0_PHY_SW_RESET,
- csi2phy->base + CSIPHY_3PH_CMN_CSI_COMMON_CTRLn(regs->common_regs_offset, 0));
- usleep_range(5000, 8000);
- writel(0x0, csi2phy->base +
- CSIPHY_3PH_CMN_CSI_COMMON_CTRLn(regs->common_regs_offset, 0));
-}
-
-/*
- * phy_qcom_mipi_csi2_settle_cnt_calc - Calculate settle count value
- *
- * Helper function to calculate settle count value. This is
- * based on the CSI2 T_hs_settle parameter which in turn
- * is calculated based on the CSI2 transmitter link frequency.
- *
- * Return settle count.
- */
-static u8 phy_qcom_mipi_csi2_settle_cnt_calc(s64 link_freq, u32 timer_clk_rate)
-{
- u32 t_hs_prepare_max_ps;
- u32 timer_period_ps;
- u32 t_hs_settle_ps;
- u8 settle_cnt;
- u32 ui_ps;
-
- ui_ps = div64_u64(PSEC_PER_SEC, link_freq);
- ui_ps /= 2;
- t_hs_prepare_max_ps = 85000 + 6 * ui_ps;
- t_hs_settle_ps = t_hs_prepare_max_ps;
-
- timer_period_ps = div_u64(PSEC_PER_SEC, timer_clk_rate);
-
- if ((t_hs_settle_ps / timer_period_ps) < 6)
- return 0;
-
- settle_cnt = t_hs_settle_ps / timer_period_ps - 6;
-
- return settle_cnt;
-}
-
-static void
-phy_qcom_mipi_csi2_gen2_config_lanes(struct mipi_csi2phy_device *csi2phy,
- u8 settle_cnt)
-{
- const struct mipi_csi2phy_device_regs *regs = csi2phy_dev_to_regs(csi2phy);
- const struct mipi_csi2phy_lane_regs *r = regs->init_seq;
- int i, array_size = regs->lane_array_size;
- u32 val;
-
- for (i = 0; i < array_size; i++, r++) {
- switch (r->param_type) {
- case CSIPHY_SETTLE_CNT_LOWER_BYTE:
- val = settle_cnt & 0xff;
- break;
- case CSIPHY_SKEW_CAL:
- /* TODO: support application of skew from dt flag */
- continue;
- default:
- val = r->reg_data;
- break;
- }
- writel(val, csi2phy->base + r->reg_addr);
- if (r->delay_us)
- udelay(r->delay_us);
- }
-}
-
-static int phy_qcom_mipi_csi2_lanes_enable(struct mipi_csi2phy_device *csi2phy,
- struct mipi_csi2phy_stream_cfg *cfg)
-{
- const struct mipi_csi2phy_device_regs *regs = csi2phy_dev_to_regs(csi2phy);
- struct mipi_csi2phy_lanes_cfg *lane_cfg = &cfg->lane_cfg;
- u8 settle_cnt;
- u8 val;
- int i;
-
- if (cfg->link_freq <= 0)
- return -EINVAL;
-
- settle_cnt = phy_qcom_mipi_csi2_settle_cnt_calc(cfg->link_freq, csi2phy->timer_clk_rate);
- if (!settle_cnt)
- return -ENODEV;
-
- /*
- * CSI_COMMON_CTRL5 is a physical lane power-up bitmap:
- * - Bits [0,2,4,6] → D-PHY data lanes(LN0, LN2, LN4, LN6)
- * - Bits [1,3,5] → C-PHY trio lanes(LN1, LN3, LN5)
- * - Bit [7] → D-PHY clock lane(LNCK) dedicated clock enable
- */
- val = BIT(lane_cfg->clk.pos);
- for (i = 0; i < cfg->num_data_lanes; i++)
- val |= BIT(lane_cfg->data[i].pos * 2);
-
- writel(val, csi2phy->base +
- CSIPHY_3PH_CMN_CSI_COMMON_CTRLn(regs->common_regs_offset, 5));
-
- /* Lane configuration for polarity @ CSIPHY-base + CTRL9 */
- for (i = 0; i < cfg->num_data_lanes; i++) {
- if (lane_cfg->data[i].pol) {
- u8 pos = lane_cfg->data[i].pos;
-
- writel(BIT(2), csi2phy->base + CSIPHY_2PH_LN_CSI_2PHASE_CTRL9n(pos * 2));
- }
- }
-
- if (lane_cfg->clk.pol)
- writel(BIT(2), csi2phy->base + CSIPHY_2PH_LN_CSI_2PHASE_CTRL9n(lane_cfg->clk.pos));
-
- val = CSIPHY_3PH_CMN_CSI_COMMON_CTRL6_COMMON_PWRDN_B;
- writel(val, csi2phy->base +
- CSIPHY_3PH_CMN_CSI_COMMON_CTRLn(regs->common_regs_offset, 6));
-
- val = 0x02;
- writel(val, csi2phy->base +
- CSIPHY_3PH_CMN_CSI_COMMON_CTRLn(regs->common_regs_offset, 7));
-
- val = 0x00;
- writel(val, csi2phy->base +
- CSIPHY_3PH_CMN_CSI_COMMON_CTRLn(regs->common_regs_offset, 0));
-
- phy_qcom_mipi_csi2_gen2_config_lanes(csi2phy, settle_cnt);
-
- /* IRQ_MASK registers - disable all interrupts */
- for (i = CSI_COMMON_STATUS_NUM; i < CSI_CTRL_STATUS_INDEX; i++) {
- writel(0, csi2phy->base +
- CSIPHY_3PH_CMN_CSI_COMMON_CTRLn(regs->common_regs_offset, i));
- }
-
- return 0;
-}
-
-static void
-phy_qcom_mipi_csi2_lanes_disable(struct mipi_csi2phy_device *csi2phy,
- struct mipi_csi2phy_stream_cfg *cfg)
-{
- const struct mipi_csi2phy_device_regs *regs = csi2phy_dev_to_regs(csi2phy);
-
- writel(0, csi2phy->base +
- CSIPHY_3PH_CMN_CSI_COMMON_CTRLn(regs->common_regs_offset, 5));
-
- writel(0, csi2phy->base +
- CSIPHY_3PH_CMN_CSI_COMMON_CTRLn(regs->common_regs_offset, 6));
-}
-
-static const struct mipi_csi2phy_hw_ops phy_qcom_mipi_csi2_ops_3ph_1_0 = {
- .hw_version_read = phy_qcom_mipi_csi2_hw_version_read,
- .reset = phy_qcom_mipi_csi2_reset,
- .lanes_enable = phy_qcom_mipi_csi2_lanes_enable,
- .lanes_disable = phy_qcom_mipi_csi2_lanes_disable,
-};
-
static const char * const x1e_clks[] = {
"core",
"timer",
@@ -369,7 +143,7 @@ static struct mipi_csi2_genpd x1e_genpds[] = {
{ .name = "mx", .scaled = true },
};
-const struct mipi_csi2phy_soc_cfg mipi_csi2_dphy_4nm_x1e = {
+static const struct mipi_csi2phy_soc_cfg mipi_csi2_dphy_4nm_x1e = {
.ops = &phy_qcom_mipi_csi2_ops_3ph_1_0,
.reg_info = {
.init_seq = lane_regs_x1e80100,
@@ -383,3 +157,5 @@ const struct mipi_csi2phy_soc_cfg mipi_csi2_dphy_4nm_x1e = {
.genpds = x1e_genpds,
.num_genpds = ARRAY_SIZE(x1e_genpds),
};
+
+#endif /* __PHY_QCOM_MIPI_CSI2_DPHY_REGS_H__ */
diff --git a/drivers/phy/qualcomm/phy-qcom-mipi-csi2.h b/drivers/phy/qualcomm/phy-qcom-mipi-csi2.h
index 6cf9e5b956f7..2040117123fd 100644
--- a/drivers/phy/qualcomm/phy-qcom-mipi-csi2.h
+++ b/drivers/phy/qualcomm/phy-qcom-mipi-csi2.h
@@ -13,6 +13,20 @@
#define CSI2_MAX_DATA_LANES 4
#define CSI2_DEFAULT_CLK_LANE 7
+/* 3-phase CSIPHY common-control register layout. */
+#define CSIPHY_3PH_CMN_CSI_COMMON_CTRLn(offset, n) ((offset) + 0x4 * (n))
+#define CSIPHY_3PH_CMN_CSI_COMMON_CTRL0_PHY_SW_RESET BIT(0)
+#define CSIPHY_3PH_CMN_CSI_COMMON_CTRL5_CLK_ENABLE BIT(7)
+#define CSIPHY_3PH_CMN_CSI_COMMON_CTRL6_COMMON_PWRDN_B BIT(0)
+#define CSIPHY_3PH_CMN_CSI_COMMON_CTRL6_SHOW_REV_ID BIT(1)
+#define CSIPHY_3PH_CMN_CSI_COMMON_CTRL10_IRQ_CLEAR_CMD BIT(0)
+#define CSIPHY_3PH_CMN_CSI_COMMON_STATUSn(offset, n) ((offset) + 0xb0 + 0x4 * (n))
+
+/* mipi_csi2phy_lane_regs.param_type values */
+#define CSIPHY_DEFAULT_PARAMS 0
+#define CSIPHY_SETTLE_CNT_LOWER_BYTE 2
+#define CSIPHY_SKEW_CAL 7
+
struct mipi_csi2phy_lane {
u8 pos;
u8 pol;
@@ -95,6 +109,11 @@ struct mipi_csi2phy_device {
u32 hw_version;
};
-extern const struct mipi_csi2phy_soc_cfg mipi_csi2_dphy_4nm_x1e;
+/*
+ * D-PHY hw_ops table: defined in core.c next to the programming functions it
+ * binds, and referenced from the per-SoC soc_cfg objects in
+ * phy-qcom-mipi-csi2-dphy-regs.h.
+ */
+extern const struct mipi_csi2phy_hw_ops phy_qcom_mipi_csi2_ops_3ph_1_0;
#endif /* __PHY_QCOM_MIPI_CSI2_H__ */
--
2.34.1
^ permalink raw reply [flat|nested] 9+ messages in thread* Re: [PATCH v4 3/5] phy: qcom-mipi-csi2: restructure D-PHY into core.c and dphy-regs.h
2026-12-01 21:02 ` [PATCH v4 3/5] phy: qcom-mipi-csi2: restructure D-PHY into core.c and dphy-regs.h Anusha Arun Nandi
@ 2026-12-02 5:20 ` Bryan O'Donoghue
0 siblings, 0 replies; 9+ messages in thread
From: Bryan O'Donoghue @ 2026-12-02 5:20 UTC (permalink / raw)
To: Anusha Arun Nandi
Cc: Vinod Koul, Neil Armstrong, Manivannan Sadhasivam,
gjorgji.rosikopulos, hariram.purushothaman, akapatra,
jigarkumar.zala, linux-phy, linux-media, linux-arm-msm,
linux-kernel, devicetree
On 01/12/2026 21:02, Anusha Arun Nandi wrote:
> Restructure phy-qcom-mipi-csi2-3ph-dphy.c: its functions
> (csi2phy_dev_to_regs(), hw_version_read()/reset()/settle_cnt_calc()/
> gen2_config_lanes()/lanes_enable()/lanes_disable()) and the D-PHY
> hw_ops table move into phy-qcom-mipi-csi2-core.c, while its register
> data (lane_regs_x1e80100[] and the x1e80100 soc_cfg plus its clk/
> supply/genpd name arrays) moves into a new
> phy-qcom-mipi-csi2-dphy-regs.h. There is no longer a separate
> code-bearing D-PHY source file: core.c now holds every PHY-framework
> and D-PHY register-programming function plus the hw_ops table that
> binds them, and the new header holds nothing but const data, #included
> at the top of core.c. The per-SoC soc_cfg reaches the hw_ops table
> through an extern in the shared phy-qcom-mipi-csi2.h.
> This keeps the maintainability and readability.
>
> The CSIPHY_3PH_CMN_* common-control register macros and the
> CSIPHY_DEFAULT_PARAMS/_SETTLE_CNT_LOWER_BYTE/_SKEW_CAL param_type
> values both move into that shared header too, since the new
> dphy-regs.h's register tables need the param_type values and
> core.c's register-write/read functions need the CTRL/STATUS offset
> macros, the mipi_csi2_dphy_4nm_x1e extern drops out of the shared
> header, since the soc_cfg object is now static and consumed only by
> core.c.
>
> No functional change: register addresses, values, and param_type
> tags are unchanged.
I don't see much justification for this move.
> Co-developed-by: Jigarkumar Zala <jigarkumar.zala@oss.qualcomm.com>
> Signed-off-by: Jigarkumar Zala <jigarkumar.zala@oss.qualcomm.com>
> Signed-off-by: Anusha Arun Nandi <anusha.nandi@oss.qualcomm.com>
> ---
> drivers/phy/qualcomm/Makefile | 3 +-
> .../phy/qualcomm/phy-qcom-mipi-csi2-core.c | 232 ++++++++++++++++-
> ...-dphy.c => phy-qcom-mipi-csi2-dphy-regs.h} | 238 +-----------------
> drivers/phy/qualcomm/phy-qcom-mipi-csi2.h | 21 +-
> 4 files changed, 249 insertions(+), 245 deletions(-)
> rename drivers/phy/qualcomm/{phy-qcom-mipi-csi2-3ph-dphy.c => phy-qcom-mipi-csi2-dphy-regs.h} (56%)
>
> diff --git a/drivers/phy/qualcomm/Makefile b/drivers/phy/qualcomm/Makefile
> index 4b5e6640a6fa..bae82e18c674 100644
> --- a/drivers/phy/qualcomm/Makefile
> +++ b/drivers/phy/qualcomm/Makefile
> @@ -7,8 +7,7 @@ obj-$(CONFIG_PHY_QCOM_IPQ806X_SATA) += phy-qcom-ipq806x-sata.o
> obj-$(CONFIG_PHY_QCOM_M31_USB) += phy-qcom-m31.o
> obj-$(CONFIG_PHY_QCOM_M31_EUSB) += phy-qcom-m31-eusb2.o
>
> -phy-qcom-mipi-csi2-objs += phy-qcom-mipi-csi2-core.o \
> - phy-qcom-mipi-csi2-3ph-dphy.o
> +phy-qcom-mipi-csi2-objs += phy-qcom-mipi-csi2-core.o
> obj-$(CONFIG_PHY_QCOM_MIPI_CSI2) += phy-qcom-mipi-csi2.o
>
> obj-$(CONFIG_PHY_QCOM_PCIE2) += phy-qcom-pcie2.o
> diff --git a/drivers/phy/qualcomm/phy-qcom-mipi-csi2-core.c b/drivers/phy/qualcomm/phy-qcom-mipi-csi2-core.c
> index 8bebc943a771..8a89ece01261 100644
> --- a/drivers/phy/qualcomm/phy-qcom-mipi-csi2-core.c
> +++ b/drivers/phy/qualcomm/phy-qcom-mipi-csi2-core.c
> @@ -9,20 +9,233 @@
> #include <linux/err.h>
> #include <linux/io.h>
> #include <linux/kernel.h>
> +#include <linux/math64.h>
> #include <linux/module.h>
> #include <linux/of.h>
> -#include <linux/pm_opp.h>
> #include <linux/phy/phy.h>
> #include <linux/phy/phy-mipi-dphy.h>
> #include <linux/platform_device.h>
> #include <linux/pm_domain.h>
> +#include <linux/pm_opp.h>
> #include <linux/pm_runtime.h>
> -#include <linux/regmap.h>
> #include <linux/regulator/consumer.h>
> -#include <linux/reset.h>
> #include <linux/slab.h>
> +#include <linux/time64.h>
>
> #include "phy-qcom-mipi-csi2.h"
> +/* D-PHY register tables and per-SoC soc_cfg objects (pure data). */
> +#include "phy-qcom-mipi-csi2-dphy-regs.h"
Data that was previously kept in a .c file now migrates to a .h file
with one user..
> +
> +#define CSIPHY_2PH_LN_CSI_2PHASE_CTRL9n(n) ((0x200 * (n)) + 0x24)
> +
> +/*
> + * 3 phase CSI has 19 common status regs with only 0-10 being used
> + * and 11-18 being reserved.
> + */
> +#define CSI_COMMON_STATUS_NUM 11
> +/*
> + * There are a number of common control registers
> + * The offset to clear the CSIPHY IRQ status starts @ 22
> + * So to clear CSI_COMMON_STATUS0 this is CSI_COMMON_CONTROL22, STATUS1 is
> + * CONTROL23 and so on
> + */
> +#define CSI_CTRL_STATUS_INDEX 22
> +
> +/*
> + * There are 43 COMMON_CTRL registers with regs after # 33 being reserved
> + */
> +#define CSI_CTRL_MAX 33
> +
> +static inline const struct mipi_csi2phy_device_regs *
> +csi2phy_dev_to_regs(struct mipi_csi2phy_device *csi2phy)
> +{
> + return &csi2phy->soc_cfg->reg_info;
> +}
> +
> +static void phy_qcom_mipi_csi2_hw_version_read(struct mipi_csi2phy_device *csi2phy)
> +{
> + const struct mipi_csi2phy_device_regs *regs = csi2phy_dev_to_regs(csi2phy);
> + u32 tmp;
> +
> + writel(CSIPHY_3PH_CMN_CSI_COMMON_CTRL6_SHOW_REV_ID, csi2phy->base +
> + CSIPHY_3PH_CMN_CSI_COMMON_CTRLn(regs->common_regs_offset, 6));
> +
> + tmp = readl_relaxed(csi2phy->base +
> + CSIPHY_3PH_CMN_CSI_COMMON_STATUSn(regs->common_regs_offset, 12));
> + csi2phy->hw_version = tmp;
> +
> + tmp = readl_relaxed(csi2phy->base +
> + CSIPHY_3PH_CMN_CSI_COMMON_STATUSn(regs->common_regs_offset, 13));
> + csi2phy->hw_version |= (tmp << 8) & 0xFF00;
> +
> + tmp = readl_relaxed(csi2phy->base +
> + CSIPHY_3PH_CMN_CSI_COMMON_STATUSn(regs->common_regs_offset, 14));
> + csi2phy->hw_version |= (tmp << 16) & 0xFF0000;
> +
> + tmp = readl_relaxed(csi2phy->base +
> + CSIPHY_3PH_CMN_CSI_COMMON_STATUSn(regs->common_regs_offset, 15));
> + csi2phy->hw_version |= (tmp << 24) & 0xFF000000;
> +
> + dev_dbg_once(csi2phy->dev, "CSIPHY 3PH HW Version = 0x%08x\n", csi2phy->hw_version);
> +}
> +
> +/*
> + * phy_qcom_mipi_csi2_reset - Perform software reset on CSIPHY module
> + * @csi2phy: CSIPHY device
> + */
> +static void phy_qcom_mipi_csi2_reset(struct mipi_csi2phy_device *csi2phy)
> +{
> + const struct mipi_csi2phy_device_regs *regs = csi2phy_dev_to_regs(csi2phy);
> +
> + writel(CSIPHY_3PH_CMN_CSI_COMMON_CTRL0_PHY_SW_RESET,
> + csi2phy->base + CSIPHY_3PH_CMN_CSI_COMMON_CTRLn(regs->common_regs_offset, 0));
> + usleep_range(5000, 8000);
> + writel(0x0, csi2phy->base +
> + CSIPHY_3PH_CMN_CSI_COMMON_CTRLn(regs->common_regs_offset, 0));
> +}
> +
> +static void
> +phy_qcom_mipi_csi2_lanes_disable(struct mipi_csi2phy_device *csi2phy,
> + struct mipi_csi2phy_stream_cfg *cfg)
> +{
> + const struct mipi_csi2phy_device_regs *regs = csi2phy_dev_to_regs(csi2phy);
> +
> + writel(0, csi2phy->base +
> + CSIPHY_3PH_CMN_CSI_COMMON_CTRLn(regs->common_regs_offset, 5));
> +
> + writel(0, csi2phy->base +
> + CSIPHY_3PH_CMN_CSI_COMMON_CTRLn(regs->common_regs_offset, 6));
> +}
> +
> +/*
> + * phy_qcom_mipi_csi2_settle_cnt_calc - Calculate settle count value
> + *
> + * Helper function to calculate settle count value. This is
> + * based on the CSI2 T_hs_settle parameter which in turn
> + * is calculated based on the CSI2 transmitter link frequency.
> + *
> + * Return settle count.
> + */
> +static u8 phy_qcom_mipi_csi2_settle_cnt_calc(s64 link_freq, u32 timer_clk_rate)
> +{
> + u32 t_hs_prepare_max_ps;
> + u32 timer_period_ps;
> + u32 t_hs_settle_ps;
> + u8 settle_cnt;
> + u32 ui_ps;
> +
> + ui_ps = div64_u64(PSEC_PER_SEC, link_freq);
> + ui_ps /= 2;
> + t_hs_prepare_max_ps = 85000 + 6 * ui_ps;
> + t_hs_settle_ps = t_hs_prepare_max_ps;
> +
> + timer_period_ps = div_u64(PSEC_PER_SEC, timer_clk_rate);
> +
> + if ((t_hs_settle_ps / timer_period_ps) < 6)
> + return 0;
> +
> + settle_cnt = t_hs_settle_ps / timer_period_ps - 6;
> +
> + return settle_cnt;
> +}
> +
> +static void
> +phy_qcom_mipi_csi2_gen2_config_lanes(struct mipi_csi2phy_device *csi2phy,
> + u8 settle_cnt)
> +{
> + const struct mipi_csi2phy_device_regs *regs = csi2phy_dev_to_regs(csi2phy);
> + const struct mipi_csi2phy_lane_regs *r = regs->init_seq;
> + int i, array_size = regs->lane_array_size;
> + u32 val;
> +
> + for (i = 0; i < array_size; i++, r++) {
> + switch (r->param_type) {
> + case CSIPHY_SETTLE_CNT_LOWER_BYTE:
> + val = settle_cnt & 0xff;
> + break;
> + case CSIPHY_SKEW_CAL:
> + /* TODO: support application of skew from dt flag */
> + continue;
> + default:
> + val = r->reg_data;
> + break;
> + }
> + writel(val, csi2phy->base + r->reg_addr);
> + if (r->delay_us)
> + udelay(r->delay_us);
> + }
> +}
> +
> +static int phy_qcom_mipi_csi2_lanes_enable(struct mipi_csi2phy_device *csi2phy,
> + struct mipi_csi2phy_stream_cfg *cfg)
> +{
> + const struct mipi_csi2phy_device_regs *regs = csi2phy_dev_to_regs(csi2phy);
> + struct mipi_csi2phy_lanes_cfg *lane_cfg = &cfg->lane_cfg;
> + u8 settle_cnt;
> + u8 val;
> + int i;
> +
> + if (cfg->link_freq <= 0)
> + return -EINVAL;
> +
> + settle_cnt = phy_qcom_mipi_csi2_settle_cnt_calc(cfg->link_freq, csi2phy->timer_clk_rate);
> + if (!settle_cnt)
> + return -ENODEV;
> +
> + /*
> + * CSI_COMMON_CTRL5 is a physical lane power-up bitmap:
> + * - Bits [0,2,4,6] → D-PHY data lanes(LN0, LN2, LN4, LN6)
> + * - Bits [1,3,5] → C-PHY trio lanes(LN1, LN3, LN5)
> + * - Bit [7] → D-PHY clock lane(LNCK) dedicated clock enable
> + */
> + val = BIT(lane_cfg->clk.pos);
> + for (i = 0; i < cfg->num_data_lanes; i++)
> + val |= BIT(lane_cfg->data[i].pos * 2);
> +
> + writel(val, csi2phy->base +
> + CSIPHY_3PH_CMN_CSI_COMMON_CTRLn(regs->common_regs_offset, 5));
> +
> + /* Lane configuration for polarity @ CSIPHY-base + CTRL9 */
> + for (i = 0; i < cfg->num_data_lanes; i++) {
> + if (lane_cfg->data[i].pol) {
> + u8 pos = lane_cfg->data[i].pos;
> +
> + writel(BIT(2), csi2phy->base + CSIPHY_2PH_LN_CSI_2PHASE_CTRL9n(pos * 2));
> + }
> + }
> +
> + if (lane_cfg->clk.pol)
> + writel(BIT(2), csi2phy->base + CSIPHY_2PH_LN_CSI_2PHASE_CTRL9n(lane_cfg->clk.pos));
> +
> + val = CSIPHY_3PH_CMN_CSI_COMMON_CTRL6_COMMON_PWRDN_B;
> + writel(val, csi2phy->base +
> + CSIPHY_3PH_CMN_CSI_COMMON_CTRLn(regs->common_regs_offset, 6));
> +
> + val = 0x02;
> + writel(val, csi2phy->base +
> + CSIPHY_3PH_CMN_CSI_COMMON_CTRLn(regs->common_regs_offset, 7));
> +
> + val = 0x00;
> + writel(val, csi2phy->base +
> + CSIPHY_3PH_CMN_CSI_COMMON_CTRLn(regs->common_regs_offset, 0));
> +
> + phy_qcom_mipi_csi2_gen2_config_lanes(csi2phy, settle_cnt);
> +
> + /* IRQ_MASK registers - disable all interrupts */
> + for (i = CSI_COMMON_STATUS_NUM; i < CSI_CTRL_STATUS_INDEX; i++) {
> + writel(0, csi2phy->base +
> + CSIPHY_3PH_CMN_CSI_COMMON_CTRLn(regs->common_regs_offset, i));
> + }
> +
> + return 0;
> +}
> +
> +const struct mipi_csi2phy_hw_ops phy_qcom_mipi_csi2_ops_3ph_1_0 = {
> + .hw_version_read = phy_qcom_mipi_csi2_hw_version_read,
> + .reset = phy_qcom_mipi_csi2_reset,
> + .lanes_enable = phy_qcom_mipi_csi2_lanes_enable,
> + .lanes_disable = phy_qcom_mipi_csi2_lanes_disable,
> +};
>
> static int
> phy_qcom_mipi_csi2_set_clock_rates(struct mipi_csi2phy_device *csi2phy,
> @@ -239,11 +452,10 @@ static int phy_qcom_mipi_csi2_attach_pm_domains(struct mipi_csi2phy_device *csi2
>
> /* Single power-domain devices are already attached by the bus core. */
> if (csi2phy->soc_cfg->num_genpds == 1)
> - return dev_pm_domain_attach(csi2phy->dev, 0);
> + return dev_pm_domain_attach(csi2phy->dev, false);
?
Your patch said "no functional change" but then you're changing this.
>
> - pd_names = devm_kzalloc(csi2phy->dev,
> - sizeof(char *) * csi2phy->soc_cfg->num_genpds,
> - GFP_KERNEL);
> + pd_names = devm_kcalloc(csi2phy->dev, csi2phy->soc_cfg->num_genpds,
> + sizeof(*pd_names), GFP_KERNEL);
And this.
You're sliding several changes into something that says "no functional
change"
If your overall objective is to move the tables out, you don't need the
churn here or the stealth changes to achieve it.
Sorry this is a NAK from me, I don't get why you can't just add the
tables beside where they are already defined for hamoa and glymur.
---
bod
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH v4 4/5] phy: qcom-mipi-csi2: Add sa8775p D-PHY support
2026-12-01 21:02 [PATCH v4 0/5] phy: qcom-mipi-csi2: Add D-PHY support for sa8775p, qcs8300 and sc7280 Anusha Arun Nandi
` (2 preceding siblings ...)
2026-12-01 21:02 ` [PATCH v4 3/5] phy: qcom-mipi-csi2: restructure D-PHY into core.c and dphy-regs.h Anusha Arun Nandi
@ 2026-12-01 21:02 ` Anusha Arun Nandi
2026-12-01 21:02 ` [PATCH v4 5/5] phy: qcom-mipi-csi2: Add sc7280 D-PHY provider Anusha Arun Nandi
4 siblings, 0 replies; 9+ messages in thread
From: Anusha Arun Nandi @ 2026-12-01 21:02 UTC (permalink / raw)
To: Bryan O'Donoghue
Cc: Vinod Koul, Neil Armstrong, Manivannan Sadhasivam,
gjorgji.rosikopulos, hariram.purushothaman, akapatra,
jigarkumar.zala, linux-phy, linux-media, linux-arm-msm,
linux-kernel, devicetree
Add the SA8775P CSIPHY to the generic MIPI CSI2 PHY driver,
bound to a new "qcom,sa8775p-csi2-phy" compatible
and reusing the existing D-PHY 2-phase hw ops
(phy_qcom_mipi_csi2_ops_3ph_1_0).
SA8775P reuses the same "timer"/"core" clock names as x1e80100 (both
are hardcoded literals in the driver, not per-SoC configurable - no
SoC this driver supports uses different names). Like x1e80100, its
CSIPHY core clock is OPP-scaled against the sensor's link frequency
via the shared csiphy_opp_table in lemans.dtsi, matching the legacy
in-tree CSIPHY driver's own sa8775p_resources OPP wiring.
SA8775P's CSIPHY has a single power-domain, the Titan Top GDSC,
matching the legacy in-tree CAMSS driver's sa8775p_resources.pd_name
= "top" and the existing lemans.dtsi camss node. Like x1e80100's own
"top" domain, it is not OPP-scaled, only kept enabled.
QCS8300 shares this same CSIPHY D-PHY hardware and does not need its
own of_device_id entry: the qcom,csi2-phy.yaml binding declares
"qcom,sa8775p-csi2-phy" as QCS8300's fallback compatible, so QCS8300
CSIPHY nodes bind through the "qcom,sa8775p-csi2-phy" match entry
added here.
Co-developed-by: Jigarkumar Zala <jigarkumar.zala@oss.qualcomm.com>
Signed-off-by: Jigarkumar Zala <jigarkumar.zala@oss.qualcomm.com>
Signed-off-by: Anusha Arun Nandi <anusha.nandi@oss.qualcomm.com>
---
.../phy/qualcomm/phy-qcom-mipi-csi2-core.c | 1 +
.../qualcomm/phy-qcom-mipi-csi2-dphy-regs.h | 107 ++++++++++++++++++
2 files changed, 108 insertions(+)
diff --git a/drivers/phy/qualcomm/phy-qcom-mipi-csi2-core.c b/drivers/phy/qualcomm/phy-qcom-mipi-csi2-core.c
index 8a89ece01261..54e68f61e25a 100644
--- a/drivers/phy/qualcomm/phy-qcom-mipi-csi2-core.c
+++ b/drivers/phy/qualcomm/phy-qcom-mipi-csi2-core.c
@@ -664,6 +664,7 @@ static int phy_qcom_mipi_csi2_probe(struct platform_device *pdev)
}
static const struct of_device_id phy_qcom_mipi_csi2_of_match_table[] = {
+ { .compatible = "qcom,sa8775p-csi2-phy", .data = &mipi_csi2_dphy_sa8775p },
{ .compatible = "qcom,x1e80100-csi2-phy", .data = &mipi_csi2_dphy_4nm_x1e },
{ }
};
diff --git a/drivers/phy/qualcomm/phy-qcom-mipi-csi2-dphy-regs.h b/drivers/phy/qualcomm/phy-qcom-mipi-csi2-dphy-regs.h
index 2f07cd487b8d..d4a52d014da4 100644
--- a/drivers/phy/qualcomm/phy-qcom-mipi-csi2-dphy-regs.h
+++ b/drivers/phy/qualcomm/phy-qcom-mipi-csi2-dphy-regs.h
@@ -158,4 +158,111 @@ static const struct mipi_csi2phy_soc_cfg mipi_csi2_dphy_4nm_x1e = {
.num_genpds = ARRAY_SIZE(x1e_genpds),
};
+/* 5nm 2PH v1.3.0 2p5Gbps 4 lane DPHY mode */
+static const struct mipi_csi2phy_lane_regs lane_regs_sa8775p[] = {
+ {.reg_addr = 0x0724, .reg_data = 0x00, .param_type = CSIPHY_DEFAULT_PARAMS},
+ {.reg_addr = 0x0728, .reg_data = 0x04, .param_type = CSIPHY_DEFAULT_PARAMS},
+ {.reg_addr = 0x0700, .reg_data = 0x80, .param_type = CSIPHY_DEFAULT_PARAMS},
+ {.reg_addr = 0x070c, .reg_data = 0xff, .param_type = CSIPHY_DEFAULT_PARAMS},
+ {.reg_addr = 0x0738, .reg_data = 0x1f, .param_type = CSIPHY_DEFAULT_PARAMS},
+ {.reg_addr = 0x072c, .reg_data = 0x01, .param_type = CSIPHY_DEFAULT_PARAMS},
+ {.reg_addr = 0x0734, .reg_data = 0x0f, .param_type = CSIPHY_DEFAULT_PARAMS},
+ {.reg_addr = 0x0710, .reg_data = 0x52, .param_type = CSIPHY_DEFAULT_PARAMS},
+ {.reg_addr = 0x071c, .reg_data = 0x0a, .param_type = CSIPHY_DEFAULT_PARAMS},
+ {.reg_addr = 0x0714, .reg_data = 0x60, .param_type = CSIPHY_DEFAULT_PARAMS},
+ {.reg_addr = 0x073c, .reg_data = 0xb8, .param_type = CSIPHY_DEFAULT_PARAMS},
+ {.reg_addr = 0x0704, .reg_data = 0x0c, .param_type = CSIPHY_DEFAULT_PARAMS},
+ {.reg_addr = 0x0720, .reg_data = 0x00, .param_type = CSIPHY_DEFAULT_PARAMS},
+ {.reg_addr = 0x0708, .reg_data = 0x10, .param_type = CSIPHY_SETTLE_CNT_LOWER_BYTE},
+ {.reg_addr = 0x0024, .reg_data = 0x00, .param_type = CSIPHY_DEFAULT_PARAMS},
+ {.reg_addr = 0x0000, .reg_data = 0x8d, .param_type = CSIPHY_DEFAULT_PARAMS},
+ {.reg_addr = 0x0038, .reg_data = 0xfe, .param_type = CSIPHY_DEFAULT_PARAMS},
+ {.reg_addr = 0x002c, .reg_data = 0x01, .param_type = CSIPHY_DEFAULT_PARAMS},
+ {.reg_addr = 0x0034, .reg_data = 0x0f, .param_type = CSIPHY_DEFAULT_PARAMS},
+ {.reg_addr = 0x0010, .reg_data = 0x52, .param_type = CSIPHY_DEFAULT_PARAMS},
+ {.reg_addr = 0x001c, .reg_data = 0x0a, .param_type = CSIPHY_DEFAULT_PARAMS},
+ {.reg_addr = 0x0014, .reg_data = 0x60, .param_type = CSIPHY_DEFAULT_PARAMS},
+ {.reg_addr = 0x003c, .reg_data = 0xb8, .param_type = CSIPHY_DEFAULT_PARAMS},
+ {.reg_addr = 0x0004, .reg_data = 0x0c, .param_type = CSIPHY_DEFAULT_PARAMS},
+ {.reg_addr = 0x0020, .reg_data = 0x00, .param_type = CSIPHY_DEFAULT_PARAMS},
+ {.reg_addr = 0x0008, .reg_data = 0x10, .param_type = CSIPHY_SETTLE_CNT_LOWER_BYTE},
+ {.reg_addr = 0x0224, .reg_data = 0x00, .param_type = CSIPHY_DEFAULT_PARAMS},
+ {.reg_addr = 0x0200, .reg_data = 0x8d, .param_type = CSIPHY_DEFAULT_PARAMS},
+ {.reg_addr = 0x0238, .reg_data = 0xfe, .param_type = CSIPHY_DEFAULT_PARAMS},
+ {.reg_addr = 0x022c, .reg_data = 0x01, .param_type = CSIPHY_DEFAULT_PARAMS},
+ {.reg_addr = 0x0234, .reg_data = 0x0f, .param_type = CSIPHY_DEFAULT_PARAMS},
+ {.reg_addr = 0x0210, .reg_data = 0x52, .param_type = CSIPHY_DEFAULT_PARAMS},
+ {.reg_addr = 0x021c, .reg_data = 0x0a, .param_type = CSIPHY_DEFAULT_PARAMS},
+ {.reg_addr = 0x0214, .reg_data = 0x60, .param_type = CSIPHY_DEFAULT_PARAMS},
+ {.reg_addr = 0x023c, .reg_data = 0xb8, .param_type = CSIPHY_DEFAULT_PARAMS},
+ {.reg_addr = 0x0204, .reg_data = 0x0c, .param_type = CSIPHY_DEFAULT_PARAMS},
+ {.reg_addr = 0x0220, .reg_data = 0x00, .param_type = CSIPHY_DEFAULT_PARAMS},
+ {.reg_addr = 0x0208, .reg_data = 0x10, .param_type = CSIPHY_SETTLE_CNT_LOWER_BYTE},
+ {.reg_addr = 0x0424, .reg_data = 0x00, .param_type = CSIPHY_DEFAULT_PARAMS},
+ {.reg_addr = 0x0400, .reg_data = 0x8d, .param_type = CSIPHY_DEFAULT_PARAMS},
+ {.reg_addr = 0x0438, .reg_data = 0xfe, .param_type = CSIPHY_DEFAULT_PARAMS},
+ {.reg_addr = 0x042c, .reg_data = 0x01, .param_type = CSIPHY_DEFAULT_PARAMS},
+ {.reg_addr = 0x0434, .reg_data = 0x0f, .param_type = CSIPHY_DEFAULT_PARAMS},
+ {.reg_addr = 0x0410, .reg_data = 0x52, .param_type = CSIPHY_DEFAULT_PARAMS},
+ {.reg_addr = 0x041c, .reg_data = 0x0a, .param_type = CSIPHY_DEFAULT_PARAMS},
+ {.reg_addr = 0x0414, .reg_data = 0x60, .param_type = CSIPHY_DEFAULT_PARAMS},
+ {.reg_addr = 0x043c, .reg_data = 0xb8, .param_type = CSIPHY_DEFAULT_PARAMS},
+ {.reg_addr = 0x0404, .reg_data = 0x0c, .param_type = CSIPHY_DEFAULT_PARAMS},
+ {.reg_addr = 0x0420, .reg_data = 0x00, .param_type = CSIPHY_DEFAULT_PARAMS},
+ {.reg_addr = 0x0408, .reg_data = 0x10, .param_type = CSIPHY_SETTLE_CNT_LOWER_BYTE},
+ {.reg_addr = 0x0624, .reg_data = 0x00, .param_type = CSIPHY_DEFAULT_PARAMS},
+ {.reg_addr = 0x0600, .reg_data = 0x8d, .param_type = CSIPHY_DEFAULT_PARAMS},
+ {.reg_addr = 0x0638, .reg_data = 0xfe, .param_type = CSIPHY_DEFAULT_PARAMS},
+ {.reg_addr = 0x062c, .reg_data = 0x01, .param_type = CSIPHY_DEFAULT_PARAMS},
+ {.reg_addr = 0x0634, .reg_data = 0x0f, .param_type = CSIPHY_DEFAULT_PARAMS},
+ {.reg_addr = 0x0610, .reg_data = 0x52, .param_type = CSIPHY_DEFAULT_PARAMS},
+ {.reg_addr = 0x061c, .reg_data = 0x0a, .param_type = CSIPHY_DEFAULT_PARAMS},
+ {.reg_addr = 0x0614, .reg_data = 0x60, .param_type = CSIPHY_DEFAULT_PARAMS},
+ {.reg_addr = 0x063c, .reg_data = 0xb8, .param_type = CSIPHY_DEFAULT_PARAMS},
+ {.reg_addr = 0x0604, .reg_data = 0x0c, .param_type = CSIPHY_DEFAULT_PARAMS},
+ {.reg_addr = 0x0620, .reg_data = 0x00, .param_type = CSIPHY_DEFAULT_PARAMS},
+ {.reg_addr = 0x0608, .reg_data = 0x10, .param_type = CSIPHY_SETTLE_CNT_LOWER_BYTE},
+ {.reg_addr = 0x005c, .reg_data = 0x00, .param_type = CSIPHY_SKEW_CAL},
+ {.reg_addr = 0x0060, .reg_data = 0xfd, .param_type = CSIPHY_SKEW_CAL},
+ {.reg_addr = 0x0064, .reg_data = 0x7f, .param_type = CSIPHY_SKEW_CAL},
+ {.reg_addr = 0x025c, .reg_data = 0x00, .param_type = CSIPHY_SKEW_CAL},
+ {.reg_addr = 0x0260, .reg_data = 0xfd, .param_type = CSIPHY_SKEW_CAL},
+ {.reg_addr = 0x0264, .reg_data = 0x7f, .param_type = CSIPHY_SKEW_CAL},
+ {.reg_addr = 0x045c, .reg_data = 0x00, .param_type = CSIPHY_SKEW_CAL},
+ {.reg_addr = 0x0460, .reg_data = 0xfd, .param_type = CSIPHY_SKEW_CAL},
+ {.reg_addr = 0x0464, .reg_data = 0x7f, .param_type = CSIPHY_SKEW_CAL},
+ {.reg_addr = 0x065c, .reg_data = 0x00, .param_type = CSIPHY_SKEW_CAL},
+ {.reg_addr = 0x0660, .reg_data = 0xfd, .param_type = CSIPHY_SKEW_CAL},
+ {.reg_addr = 0x0664, .reg_data = 0x7f, .param_type = CSIPHY_SKEW_CAL},
+};
+
+static const char * const sa8775p_clks[] = {
+ "core",
+ "timer",
+};
+
+static const char * const sa8775p_supplies[] = {
+ "vdda-hs",
+ "vdda-lp",
+};
+
+static const struct mipi_csi2_genpd sa8775p_genpds[] = {
+ { .name = "top", .scaled = false },
+};
+
+static const struct mipi_csi2phy_soc_cfg mipi_csi2_dphy_sa8775p = {
+ .ops = &phy_qcom_mipi_csi2_ops_3ph_1_0,
+ .reg_info = {
+ .init_seq = lane_regs_sa8775p,
+ .lane_array_size = ARRAY_SIZE(lane_regs_sa8775p),
+ .common_regs_offset = 0x800,
+ },
+ .supply_names = (const char **)sa8775p_supplies,
+ .num_supplies = ARRAY_SIZE(sa8775p_supplies),
+ .clk_names = (const char **)sa8775p_clks,
+ .num_clk = ARRAY_SIZE(sa8775p_clks),
+ .genpds = sa8775p_genpds,
+ .num_genpds = ARRAY_SIZE(sa8775p_genpds),
+};
+
#endif /* __PHY_QCOM_MIPI_CSI2_DPHY_REGS_H__ */
--
2.34.1
^ permalink raw reply [flat|nested] 9+ messages in thread* [PATCH v4 5/5] phy: qcom-mipi-csi2: Add sc7280 D-PHY provider
2026-12-01 21:02 [PATCH v4 0/5] phy: qcom-mipi-csi2: Add D-PHY support for sa8775p, qcs8300 and sc7280 Anusha Arun Nandi
` (3 preceding siblings ...)
2026-12-01 21:02 ` [PATCH v4 4/5] phy: qcom-mipi-csi2: Add sa8775p D-PHY support Anusha Arun Nandi
@ 2026-12-01 21:02 ` Anusha Arun Nandi
4 siblings, 0 replies; 9+ messages in thread
From: Anusha Arun Nandi @ 2026-12-01 21:02 UTC (permalink / raw)
To: Bryan O'Donoghue
Cc: Vinod Koul, Neil Armstrong, Manivannan Sadhasivam,
gjorgji.rosikopulos, hariram.purushothaman, akapatra,
jigarkumar.zala, linux-phy, linux-media, linux-arm-msm,
linux-kernel, devicetree
Add the SC7280 CSIPHY to the generic MIPI CSI2 PHY driver,
bound to a new "qcom,sc7280-csi2-phy" compatible
and reusing the existing D-PHY 2-phase hw ops
(phy_qcom_mipi_csi2_ops_3ph_1_0). The soc_cfg declares the core/timer
clocks (matching x1e80100's and sa8775p's clock-names convention for
this pair, both hardcoded literals in the driver) and the
vdda-hs/vdda-lp supplies.
Like x1e80100 and SA8775P, SC7280's CSIPHY core clock is OPP-scaled
against the sensor's link frequency via the shared csiphy_opp_table
in kodiak.dtsi, so no_opp is left unset here too. SC7280's CSIPHY
has a single power-domain, the Titan Top GDSC, matching
camss.c's sc7280_resources.pd_name = "top" and kodiak.dtsi's
existing camss node; it is not OPP-scaled, only kept enabled.
Co-developed-by: Jigarkumar Zala <jigarkumar.zala@oss.qualcomm.com>
Signed-off-by: Jigarkumar Zala <jigarkumar.zala@oss.qualcomm.com>
Signed-off-by: Anusha Arun Nandi <anusha.nandi@oss.qualcomm.com>
---
.../phy/qualcomm/phy-qcom-mipi-csi2-core.c | 1 +
.../qualcomm/phy-qcom-mipi-csi2-dphy-regs.h | 120 ++++++++++++++++++
2 files changed, 121 insertions(+)
diff --git a/drivers/phy/qualcomm/phy-qcom-mipi-csi2-core.c b/drivers/phy/qualcomm/phy-qcom-mipi-csi2-core.c
index 54e68f61e25a..091b8d7030d9 100644
--- a/drivers/phy/qualcomm/phy-qcom-mipi-csi2-core.c
+++ b/drivers/phy/qualcomm/phy-qcom-mipi-csi2-core.c
@@ -665,6 +665,7 @@ static int phy_qcom_mipi_csi2_probe(struct platform_device *pdev)
static const struct of_device_id phy_qcom_mipi_csi2_of_match_table[] = {
{ .compatible = "qcom,sa8775p-csi2-phy", .data = &mipi_csi2_dphy_sa8775p },
+ { .compatible = "qcom,sc7280-csi2-phy", .data = &mipi_csi2_dphy_sc7280 },
{ .compatible = "qcom,x1e80100-csi2-phy", .data = &mipi_csi2_dphy_4nm_x1e },
{ }
};
diff --git a/drivers/phy/qualcomm/phy-qcom-mipi-csi2-dphy-regs.h b/drivers/phy/qualcomm/phy-qcom-mipi-csi2-dphy-regs.h
index d4a52d014da4..9edfa1e4aeb8 100644
--- a/drivers/phy/qualcomm/phy-qcom-mipi-csi2-dphy-regs.h
+++ b/drivers/phy/qualcomm/phy-qcom-mipi-csi2-dphy-regs.h
@@ -265,4 +265,124 @@ static const struct mipi_csi2phy_soc_cfg mipi_csi2_dphy_sa8775p = {
.num_genpds = ARRAY_SIZE(sa8775p_genpds),
};
+/* sc7280 5nm 2PH 2p5Gbps 4 lane DPHY mode */
+static const struct mipi_csi2phy_lane_regs lane_regs_sc7280[] = {
+ {.reg_addr = 0x0030, .reg_data = 0x00, .param_type = CSIPHY_DEFAULT_PARAMS},
+ {.reg_addr = 0x0900, .reg_data = 0x05, .param_type = CSIPHY_DEFAULT_PARAMS},
+ {.reg_addr = 0x0908, .reg_data = 0x10, .param_type = CSIPHY_DEFAULT_PARAMS},
+ {.reg_addr = 0x0904, .reg_data = 0x00, .param_type = CSIPHY_DEFAULT_PARAMS},
+ {.reg_addr = 0x0904, .reg_data = 0x07, .param_type = CSIPHY_DEFAULT_PARAMS},
+ {.reg_addr = 0x0004, .reg_data = 0x0C, .param_type = CSIPHY_DEFAULT_PARAMS},
+ {.reg_addr = 0x002C, .reg_data = 0x01, .param_type = CSIPHY_DEFAULT_PARAMS},
+ {.reg_addr = 0x0034, .reg_data = 0x07, .param_type = CSIPHY_DEFAULT_PARAMS},
+ {.reg_addr = 0x0010, .reg_data = 0x02, .param_type = CSIPHY_DEFAULT_PARAMS},
+ {.reg_addr = 0x001C, .reg_data = 0x08, .param_type = CSIPHY_DEFAULT_PARAMS},
+ {.reg_addr = 0x003C, .reg_data = 0xB8, .param_type = CSIPHY_DEFAULT_PARAMS},
+ {.reg_addr = 0x0008, .reg_data = 0x10, .param_type = CSIPHY_SETTLE_CNT_LOWER_BYTE},
+ {.reg_addr = 0x0000, .reg_data = 0x8D, .param_type = CSIPHY_DEFAULT_PARAMS},
+ {.reg_addr = 0x0038, .reg_data = 0xFE, .param_type = CSIPHY_DEFAULT_PARAMS},
+ {.reg_addr = 0x0014, .reg_data = 0x60, .param_type = CSIPHY_DEFAULT_PARAMS},
+ {.reg_addr = 0x0800, .reg_data = 0x02, .param_type = CSIPHY_DEFAULT_PARAMS},
+ {.reg_addr = 0x0884, .reg_data = 0x01, .param_type = CSIPHY_DEFAULT_PARAMS},
+ {.reg_addr = 0x0730, .reg_data = 0x00, .param_type = CSIPHY_DEFAULT_PARAMS},
+ {.reg_addr = 0x0C80, .reg_data = 0x05, .param_type = CSIPHY_DEFAULT_PARAMS},
+ {.reg_addr = 0x0C88, .reg_data = 0x10, .param_type = CSIPHY_DEFAULT_PARAMS},
+ {.reg_addr = 0x0C84, .reg_data = 0x00, .param_type = CSIPHY_DEFAULT_PARAMS},
+ {.reg_addr = 0x0C84, .reg_data = 0x07, .param_type = CSIPHY_DEFAULT_PARAMS},
+ {.reg_addr = 0x0704, .reg_data = 0x0C, .param_type = CSIPHY_DEFAULT_PARAMS},
+ {.reg_addr = 0x072C, .reg_data = 0x01, .param_type = CSIPHY_DEFAULT_PARAMS},
+ {.reg_addr = 0x0734, .reg_data = 0x07, .param_type = CSIPHY_DEFAULT_PARAMS},
+ {.reg_addr = 0x0710, .reg_data = 0x02, .param_type = CSIPHY_DEFAULT_PARAMS},
+ {.reg_addr = 0x071C, .reg_data = 0x08, .param_type = CSIPHY_DEFAULT_PARAMS},
+ {.reg_addr = 0x073C, .reg_data = 0xB8, .param_type = CSIPHY_DEFAULT_PARAMS},
+ {.reg_addr = 0x0708, .reg_data = 0x10, .param_type = CSIPHY_SETTLE_CNT_LOWER_BYTE},
+ {.reg_addr = 0x0700, .reg_data = 0x80, .param_type = CSIPHY_DEFAULT_PARAMS},
+ {.reg_addr = 0x070c, .reg_data = 0xA5, .param_type = CSIPHY_DEFAULT_PARAMS},
+ {.reg_addr = 0x0738, .reg_data = 0x1F, .param_type = CSIPHY_DEFAULT_PARAMS},
+ {.reg_addr = 0x0714, .reg_data = 0x60, .param_type = CSIPHY_DEFAULT_PARAMS},
+ {.reg_addr = 0x0728, .reg_data = 0x04, .param_type = CSIPHY_DEFAULT_PARAMS},
+ {.reg_addr = 0x0800, .reg_data = 0x02, .param_type = CSIPHY_DEFAULT_PARAMS},
+ {.reg_addr = 0x0884, .reg_data = 0x01, .param_type = CSIPHY_DEFAULT_PARAMS},
+ {.reg_addr = 0x0230, .reg_data = 0x00, .param_type = CSIPHY_DEFAULT_PARAMS},
+ {.reg_addr = 0x0A00, .reg_data = 0x05, .param_type = CSIPHY_DEFAULT_PARAMS},
+ {.reg_addr = 0x0A08, .reg_data = 0x10, .param_type = CSIPHY_DEFAULT_PARAMS},
+ {.reg_addr = 0x0A04, .reg_data = 0x00, .param_type = CSIPHY_DEFAULT_PARAMS},
+ {.reg_addr = 0x0A04, .reg_data = 0x07, .param_type = CSIPHY_DEFAULT_PARAMS},
+ {.reg_addr = 0x0204, .reg_data = 0x0C, .param_type = CSIPHY_DEFAULT_PARAMS},
+ {.reg_addr = 0x022C, .reg_data = 0x01, .param_type = CSIPHY_DEFAULT_PARAMS},
+ {.reg_addr = 0x0234, .reg_data = 0x07, .param_type = CSIPHY_DEFAULT_PARAMS},
+ {.reg_addr = 0x0210, .reg_data = 0x02, .param_type = CSIPHY_DEFAULT_PARAMS},
+ {.reg_addr = 0x021C, .reg_data = 0x08, .param_type = CSIPHY_DEFAULT_PARAMS},
+ {.reg_addr = 0x023C, .reg_data = 0xB8, .param_type = CSIPHY_DEFAULT_PARAMS},
+ {.reg_addr = 0x0208, .reg_data = 0x10, .param_type = CSIPHY_SETTLE_CNT_LOWER_BYTE},
+ {.reg_addr = 0x0200, .reg_data = 0x8D, .param_type = CSIPHY_DEFAULT_PARAMS},
+ {.reg_addr = 0x0238, .reg_data = 0xFE, .param_type = CSIPHY_DEFAULT_PARAMS},
+ {.reg_addr = 0x0214, .reg_data = 0x60, .param_type = CSIPHY_DEFAULT_PARAMS},
+ {.reg_addr = 0x0800, .reg_data = 0x02, .param_type = CSIPHY_DEFAULT_PARAMS},
+ {.reg_addr = 0x0884, .reg_data = 0x01, .param_type = CSIPHY_DEFAULT_PARAMS},
+ {.reg_addr = 0x0430, .reg_data = 0x00, .param_type = CSIPHY_DEFAULT_PARAMS},
+ {.reg_addr = 0x0B00, .reg_data = 0x05, .param_type = CSIPHY_DEFAULT_PARAMS},
+ {.reg_addr = 0x0B08, .reg_data = 0x10, .param_type = CSIPHY_DEFAULT_PARAMS},
+ {.reg_addr = 0x0B04, .reg_data = 0x00, .param_type = CSIPHY_DEFAULT_PARAMS},
+ {.reg_addr = 0x0B04, .reg_data = 0x07, .param_type = CSIPHY_DEFAULT_PARAMS},
+ {.reg_addr = 0x0404, .reg_data = 0x0C, .param_type = CSIPHY_DEFAULT_PARAMS},
+ {.reg_addr = 0x042C, .reg_data = 0x01, .param_type = CSIPHY_DEFAULT_PARAMS},
+ {.reg_addr = 0x0434, .reg_data = 0x07, .param_type = CSIPHY_DEFAULT_PARAMS},
+ {.reg_addr = 0x0410, .reg_data = 0x02, .param_type = CSIPHY_DEFAULT_PARAMS},
+ {.reg_addr = 0x041C, .reg_data = 0x08, .param_type = CSIPHY_DEFAULT_PARAMS},
+ {.reg_addr = 0x043C, .reg_data = 0xB8, .param_type = CSIPHY_DEFAULT_PARAMS},
+ {.reg_addr = 0x0408, .reg_data = 0x10, .param_type = CSIPHY_SETTLE_CNT_LOWER_BYTE},
+ {.reg_addr = 0x0400, .reg_data = 0x8D, .param_type = CSIPHY_DEFAULT_PARAMS},
+ {.reg_addr = 0x0438, .reg_data = 0xFE, .param_type = CSIPHY_DEFAULT_PARAMS},
+ {.reg_addr = 0x0414, .reg_data = 0x60, .param_type = CSIPHY_DEFAULT_PARAMS},
+ {.reg_addr = 0x0800, .reg_data = 0x02, .param_type = CSIPHY_DEFAULT_PARAMS},
+ {.reg_addr = 0x0884, .reg_data = 0x01, .param_type = CSIPHY_DEFAULT_PARAMS},
+ {.reg_addr = 0x0630, .reg_data = 0x00, .param_type = CSIPHY_DEFAULT_PARAMS},
+ {.reg_addr = 0x0C00, .reg_data = 0x05, .param_type = CSIPHY_DEFAULT_PARAMS},
+ {.reg_addr = 0x0C08, .reg_data = 0x10, .param_type = CSIPHY_DEFAULT_PARAMS},
+ {.reg_addr = 0x0C04, .reg_data = 0x00, .param_type = CSIPHY_DEFAULT_PARAMS},
+ {.reg_addr = 0x0C04, .reg_data = 0x07, .param_type = CSIPHY_DEFAULT_PARAMS},
+ {.reg_addr = 0x0604, .reg_data = 0x0C, .param_type = CSIPHY_DEFAULT_PARAMS},
+ {.reg_addr = 0x062C, .reg_data = 0x01, .param_type = CSIPHY_DEFAULT_PARAMS},
+ {.reg_addr = 0x0634, .reg_data = 0x07, .param_type = CSIPHY_DEFAULT_PARAMS},
+ {.reg_addr = 0x0610, .reg_data = 0x02, .param_type = CSIPHY_DEFAULT_PARAMS},
+ {.reg_addr = 0x061C, .reg_data = 0x08, .param_type = CSIPHY_DEFAULT_PARAMS},
+ {.reg_addr = 0x063C, .reg_data = 0xB8, .param_type = CSIPHY_DEFAULT_PARAMS},
+ {.reg_addr = 0x0608, .reg_data = 0x10, .param_type = CSIPHY_SETTLE_CNT_LOWER_BYTE},
+ {.reg_addr = 0x0600, .reg_data = 0x8D, .param_type = CSIPHY_DEFAULT_PARAMS},
+ {.reg_addr = 0x0638, .reg_data = 0xFE, .param_type = CSIPHY_DEFAULT_PARAMS},
+ {.reg_addr = 0x0614, .reg_data = 0x60, .param_type = CSIPHY_DEFAULT_PARAMS},
+ {.reg_addr = 0x0800, .reg_data = 0x02, .param_type = CSIPHY_DEFAULT_PARAMS},
+ {.reg_addr = 0x0884, .reg_data = 0x01, .param_type = CSIPHY_DEFAULT_PARAMS},
+};
+
+static const char * const sc7280_clks[] = {
+ "core",
+ "timer",
+};
+
+static const char * const sc7280_supplies[] = {
+ "vdda-hs",
+ "vdda-lp",
+};
+
+static const struct mipi_csi2_genpd sc7280_genpds[] = {
+ { .name = "top", .scaled = false },
+};
+
+static const struct mipi_csi2phy_soc_cfg mipi_csi2_dphy_sc7280 = {
+ .ops = &phy_qcom_mipi_csi2_ops_3ph_1_0,
+ .reg_info = {
+ .init_seq = lane_regs_sc7280,
+ .lane_array_size = ARRAY_SIZE(lane_regs_sc7280),
+ .common_regs_offset = 0x800,
+ },
+ .supply_names = (const char **)sc7280_supplies,
+ .num_supplies = ARRAY_SIZE(sc7280_supplies),
+ .clk_names = (const char **)sc7280_clks,
+ .num_clk = ARRAY_SIZE(sc7280_clks),
+ .genpds = sc7280_genpds,
+ .num_genpds = ARRAY_SIZE(sc7280_genpds),
+};
+
#endif /* __PHY_QCOM_MIPI_CSI2_DPHY_REGS_H__ */
--
2.34.1
^ permalink raw reply [flat|nested] 9+ messages in thread