Skip to contentSkip to conversation

Qualcomm REFGEN regulator

PATCH Applied Konrad Dybcio 3 participants 12 messages Jul 3, 2023 – Jul 12, 2023

Subsystems (6)
lore
Share & tools
lore
#0 lore raw

v3 cover Qualcomm REFGEN regulator

Recent Qualcomm SoCs have a REFGEN (reference voltage generator) regulator responsible for providing a reference voltage to some on-SoC IPs (like DSI or PHYs). It can be turned off when unused to save power.

This series introduces the driver for it and lets the DSI driver consume it.

---
Changes in v3:
- depend on HAS_IOMEM (s390 build failure, meh)
- constify regulator_ops
- Link to v2: https://lore.kernel.org/r/[email protected]

Changes in v2:
- Remove "|" from bindings description
- fix 'renegator' typo
- define number of 'reg'
- adjust reg= to size/address-cells = 1
- fix regmap usage
- use C++ comments for the header
- remove now-unused struct qcom_refgen
- use common helpers for sm8250 refgen (simple bit ops)
- add missing FIELD_PREPs (small brain forgot regmap_update_bits
doesn't do shifting)
- pick up tags
- Link to v1: https://lore.kernel.org/r/[email protected]

---
Konrad Dybcio (4):
dt-bindings: regulator: Describe Qualcomm REFGEN regulator
regulator: Introduce Qualcomm REFGEN regulator driver
dt-bindings: display/msm: dsi-controller-main: Allow refgen-supply drm/msm/dsi: Hook up refgen regulator

 .../bindings/display/msm/dsi-controller-main.yaml  |   4 +
 .../regulator/qcom,sdm845-refgen-regulator.yaml    |  57 ++++++++
 drivers/gpu/drm/msm/dsi/dsi_cfg.c                  |   2 +
 drivers/regulator/Kconfig                          |  11 ++
 drivers/regulator/Makefile                         |   1 +
 drivers/regulator/qcom-refgen-regulator.c          | 154 +++++++++++++++++++++
 6 files changed, 229 insertions(+)

---
base-commit: 296d53d8f84ce50ffaee7d575487058c8d437335
change-id: 20230628-topic-refgen-14fb0b762115

Best regards,

Signature · 1 line
Konrad Dybcio <[email protected]>
#1 lore raw

PATCH v3 1/4 dt-bindings: regulator: Describe Qualcomm REFGEN regulator

Modern Qualcomm SoCs have a REFGEN (reference voltage generator) regulator, providing reference voltage to on-chip IP, like PHYs. It's controlled through MMIO and we can toggle it or read its state back.

Describe it.

---
 .../regulator/qcom,sdm845-refgen-regulator.yaml    | 57 ++++++++++++++++++++++
 1 file changed, 57 insertions(+)
Documentation/devicetree/bindings/regulator/qcom,sdm845-refgen-regulator.yaml new file +57 -0
new file mode 100644
index 000000000000..f02f97d4fdd2
@@ -0,0 +1,57 @@
+# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/regulator/qcom,sdm845-refgen-regulator.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Qualcomm Technologies, Inc. REFGEN Regulator
+
+maintainers:
+  - Konrad Dybcio <[email protected]>
+
+description:
+  The REFGEN (reference voltage generator) regulator provides reference
+  voltage for on-chip IPs (like PHYs) on some Qualcomm SoCs.
+
+allOf:
+  - $ref: regulator.yaml#
+
+properties:
+  compatible:
+    oneOf:
+      - items:
+          - enum:
+              - qcom,sc7180-refgen-regulator
+              - qcom,sc8180x-refgen-regulator
+              - qcom,sm8150-refgen-regulator
+          - const: qcom,sdm845-refgen-regulator
+
+      - items:
+          - enum:
+              - qcom,sc7280-refgen-regulator
+              - qcom,sc8280xp-refgen-regulator
+              - qcom,sm6350-refgen-regulator
+              - qcom,sm6375-refgen-regulator
+              - qcom,sm8350-refgen-regulator
+          - const: qcom,sm8250-refgen-regulator
+
+      - enum:
+          - qcom,sdm845-refgen-regulator
+          - qcom,sm8250-refgen-regulator
+
+  reg:
+    maxItems: 1
+
+required:
+  - compatible
+  - reg
+
+unevaluatedProperties: false
+
+examples:
+  - |
+    regulator@162f000 {
+      compatible = "qcom,sm8250-refgen-regulator";
+      reg = <0x0162f000 0x84>;
+    };
+...
Signature · 1 line
2.41.0
author Reviewed-by Rob Herring on v3 1/4
#2 lore raw

Re: [PATCH v3 1/4] dt-bindings: regulator: Describe Qualcomm REFGEN regulator

Quoted 8 lines · Konrad Dybcio

Modern Qualcomm SoCs have a REFGEN (reference voltage generator) regulator, providing reference voltage to on-chip IP, like PHYs. It's controlled through MMIO and we can toggle it or read its state back.

Describe it.

---

I have a chronic issue where I realize I didn't run b4 trailers -u the milisecond I hit enter on b4 send.

This was:

at

https://lore.kernel.org/linux-arm-msm/[email protected]/

Sorry for the inconvenience.

Konrad

Quoted 67 lines
 .../regulator/qcom,sdm845-refgen-regulator.yaml    | 57 ++++++++++++++++++++++
 1 file changed, 57 insertions(+)
Documentation/devicetree/bindings/regulator/qcom,sdm845-refgen-regulator.yaml new file +57 -0
new file mode 100644
index 000000000000..f02f97d4fdd2
@@ -0,0 +1,57 @@
+# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/regulator/qcom,sdm845-refgen-regulator.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Qualcomm Technologies, Inc. REFGEN Regulator
+
+maintainers:
+  - Konrad Dybcio <[email protected]>
+
+description:
+  The REFGEN (reference voltage generator) regulator provides reference
+  voltage for on-chip IPs (like PHYs) on some Qualcomm SoCs.
+
+allOf:
+  - $ref: regulator.yaml#
+
+properties:
+  compatible:
+    oneOf:
+      - items:
+          - enum:
+              - qcom,sc7180-refgen-regulator
+              - qcom,sc8180x-refgen-regulator
+              - qcom,sm8150-refgen-regulator
+          - const: qcom,sdm845-refgen-regulator
+
+      - items:
+          - enum:
+              - qcom,sc7280-refgen-regulator
+              - qcom,sc8280xp-refgen-regulator
+              - qcom,sm6350-refgen-regulator
+              - qcom,sm6375-refgen-regulator
+              - qcom,sm8350-refgen-regulator
+          - const: qcom,sm8250-refgen-regulator
+
+      - enum:
+          - qcom,sdm845-refgen-regulator
+          - qcom,sm8250-refgen-regulator
+
+  reg:
+    maxItems: 1
+
+required:
+  - compatible
+  - reg
+
+unevaluatedProperties: false
+
+examples:
+  - |
+    regulator@162f000 {
+      compatible = "qcom,sm8250-refgen-regulator";
+      reg = <0x0162f000 0x84>;
+    };
+...
#3 lore raw

PATCH v3 2/4 regulator: Introduce Qualcomm REFGEN regulator driver

In reply to Konrad Dybcio

Modern Qualcomm SoCs have a REFGEN (reference voltage generator) regulator, providing reference voltage to on-chip IP, like PHYs.

Add a driver to support toggling that regulator.

---
 drivers/regulator/Kconfig                 |  11 +++
 drivers/regulator/Makefile                |   1 +
 drivers/regulator/qcom-refgen-regulator.c | 154 ++++++++++++++++++++++++++++++
 3 files changed, 166 insertions(+)
drivers/regulator/Kconfig +11 -0
index 823f8e6e4801..18a05b09406f 100644
@@ -989,6 +989,17 @@ config REGULATOR_PWM
 	  This driver supports PWM controlled voltage regulators. PWM
 	  duty cycle can increase or decrease the voltage.
 
+config REGULATOR_QCOM_REFGEN
+	tristate "Qualcomm REFGEN regulator driver"
+	depends on HAS_IOMEM
+	depends on REGMAP
+	help
+	  This driver supports the MMIO-mapped reference voltage regulator,
+	  used internally by some PHYs on many Qualcomm SoCs.
+
+	  Say M here if you want to include support for this regulator as
+	  a module. The module will be named "qcom-refgen-regulator".
+
 config REGULATOR_QCOM_RPM
 	tristate "Qualcomm RPM regulator driver"
 	depends on MFD_QCOM_RPM
drivers/regulator/Makefile +1 -0
index 15e0d614ff66..4f4589877e81 100644
@@ -108,6 +108,7 @@ obj-$(CONFIG_REGULATOR_MT6380)	+= mt6380-regulator.o
 obj-$(CONFIG_REGULATOR_MT6397)	+= mt6397-regulator.o
 obj-$(CONFIG_REGULATOR_MTK_DVFSRC) += mtk-dvfsrc-regulator.o
 obj-$(CONFIG_REGULATOR_QCOM_LABIBB) += qcom-labibb-regulator.o
+obj-$(CONFIG_REGULATOR_QCOM_REFGEN) += qcom-refgen-regulator.o
 obj-$(CONFIG_REGULATOR_QCOM_RPM) += qcom_rpm-regulator.o
 obj-$(CONFIG_REGULATOR_QCOM_RPMH) += qcom-rpmh-regulator.o
 obj-$(CONFIG_REGULATOR_QCOM_SMD_RPM) += qcom_smd-regulator.o
drivers/regulator/qcom-refgen-regulator.c new file +154 -0

154 lines not on this page · raw message

Signature · 1 line
2.41.0
#4 lore raw

PATCH v3 3/4 dt-bindings: display/msm: dsi-controller-main: Allow refgen-supply

In reply to Konrad Dybcio

DSI host needs REFGEN to be enabled (if it's present on a given platform). Allow consuming it.

---
 .../devicetree/bindings/display/msm/dsi-controller-main.yaml          | 4 ++++
 1 file changed, 4 insertions(+)
Documentation/devicetree/bindings/display/msm/dsi-controller-main.yaml +4 -0
index 01848bdd5873..76270992305a 100644
@@ -166,6 +166,10 @@ properties:
     description:
       Phandle to vdd regulator device node
 
+  refgen-supply:
+    description:
+      Phandle to REFGEN regulator device node
+
   vcca-supply:
     description:
       Phandle to vdd regulator device node
Signature · 1 line
2.41.0
#5 lore raw

PATCH v3 4/4 drm/msm/dsi: Hook up refgen regulator

In reply to Konrad Dybcio

Consume the refgen supply on configurations that may use it.

---
 drivers/gpu/drm/msm/dsi/dsi_cfg.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/gpu/drm/msm/dsi/dsi_cfg.c +2 -0
index 8a5fb6df7210..1f98ff74ceb0 100644
@@ -160,6 +160,7 @@ static const char * const dsi_v2_4_clk_names[] = {
 
 static const struct regulator_bulk_data dsi_v2_4_regulators[] = {
 	{ .supply = "vdda", .init_load_uA = 21800 },	/* 1.2 V */
+	{ .supply = "refgen" },
 };
 
 static const struct msm_dsi_config sdm845_dsi_cfg = {
@@ -191,6 +192,7 @@ static const struct msm_dsi_config sm8550_dsi_cfg = {
 
 static const struct regulator_bulk_data sc7280_dsi_regulators[] = {
 	{ .supply = "vdda", .init_load_uA = 8350 },	/* 1.2 V */
+	{ .supply = "refgen" },
 };
 
 static const struct msm_dsi_config sc7280_dsi_cfg = {
Signature · 1 line
2.41.0
maintainer
#7 lore raw
In reply to Konrad Dybcio
Quoted 6 lines · Konrad Dybcio

Recent Qualcomm SoCs have a REFGEN (reference voltage generator) regulator responsible for providing a reference voltage to some on-SoC IPs (like DSI or PHYs). It can be turned off when unused to save power.

This series introduces the driver for it and lets the DSI driver consume it.

What's the expected plan for merging this - should I be applying the DRM patch?

#8 lore raw
Quoted 11 lines · Mark Brown
Quoted 6 lines · Konrad Dybcio

Recent Qualcomm SoCs have a REFGEN (reference voltage generator) regulator responsible for providing a reference voltage to some on-SoC IPs (like DSI or PHYs). It can be turned off when unused to save power.

This series introduces the driver for it and lets the DSI driver consume it.

What's the expected plan for merging this - should I be applying the DRM patch?

Uh sorry for not clarifying.. please just take the first two.

Konrad

#9 lore raw
In reply to Mark Brown
Quoted 7 lines · Mark Brown
Quoted 4 lines · Konrad Dybcio

Recent Qualcomm SoCs have a REFGEN (reference voltage generator) regulator responsible for providing a reference voltage to some on-SoC IPs (like DSI or PHYs). It can be turned off when unused to save power.

Quoted 5 lines
Quoted 2 lines

This series introduces the driver for it and lets the DSI driver consume it.

What's the expected plan for merging this - should I be applying the DRM patch?

I'd pick the least two patches into msm-next after -rc1.

Signature · 2 lines
With best wishes
Dmitry
#10 lore raw
In reply to Konrad Dybcio
Quoted 8 lines · Konrad Dybcio

Recent Qualcomm SoCs have a REFGEN (reference voltage generator) regulator responsible for providing a reference voltage to some on-SoC IPs (like DSI or PHYs). It can be turned off when unused to save power.

This series introduces the driver for it and lets the DSI driver consume it.

[...]

Applied, thanks!

[3/4] dt-bindings: display/msm: dsi-controller-main: Allow refgen-supply
https://gitlab.freedesktop.org/lumag/msm/-/commit/f5cedc432fdf
[4/4] drm/msm/dsi: Hook up refgen regulator

      https://gitlab.freedesktop.org/lumag/msm/-/commit/4bc71795761b

Best regards,

Signature · 1 line
Dmitry Baryshkov <[email protected]>
maintainer
#11 lore raw

Re: (subset) [PATCH v3 0/4] Qualcomm REFGEN regulator

In reply to Konrad Dybcio
Quoted 8 lines · Konrad Dybcio

Recent Qualcomm SoCs have a REFGEN (reference voltage generator) regulator responsible for providing a reference voltage to some on-SoC IPs (like DSI or PHYs). It can be turned off when unused to save power.

This series introduces the driver for it and lets the DSI driver consume it.

[...]

Applied to

https://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator.git for-next

Thanks!

[1/4] dt-bindings: regulator: Describe Qualcomm REFGEN regulator

      commit: d16db38c2a66060ee25c6b86ee7b6d66d40fc8e0
[2/4] regulator: Introduce Qualcomm REFGEN regulator driver
      commit: 7cbfbe23796086fdb72b681e2c182b02acd36a04

All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying to this mail.

Thanks,
Mark