30891d34872b5fbe1b2782c135cd3f118e785c21
[openwrt/staging/jow.git] / target / linux / mediatek / patches-5.15 / 830-v5.18-regulator-Add-bindings-for-Richtek-RT5190A-PMIC.patch
1 From b77e70f6b8f2cc62fba847f3008a430a09ef275d Mon Sep 17 00:00:00 2001
2 From: ChiYuan Huang <cy_huang@richtek.com>
3 Date: Wed, 9 Mar 2022 16:01:42 +0800
4 Subject: [PATCH 1/2] regulator: Add bindings for Richtek RT5190A PMIC
5
6 Add bindings for Richtek RT5190A PMIC.
7
8 Signed-off-by: ChiYuan Huang <cy_huang@richtek.com>
9 Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
10 Link: https://lore.kernel.org/r/1646812903-32496-2-git-send-email-u0084500@gmail.com
11 Signed-off-by: Mark Brown <broonie@kernel.org>
12 ---
13 .../regulator/richtek,rt5190a-regulator.yaml | 141 ++++++++++++++++++
14 .../regulator/richtek,rt5190a-regulator.h | 15 ++
15 2 files changed, 156 insertions(+)
16 create mode 100644 Documentation/devicetree/bindings/regulator/richtek,rt5190a-regulator.yaml
17 create mode 100644 include/dt-bindings/regulator/richtek,rt5190a-regulator.h
18
19 --- /dev/null
20 +++ b/Documentation/devicetree/bindings/regulator/richtek,rt5190a-regulator.yaml
21 @@ -0,0 +1,141 @@
22 +# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
23 +%YAML 1.2
24 +---
25 +$id: http://devicetree.org/schemas/regulator/richtek,rt5190a-regulator.yaml#
26 +$schema: http://devicetree.org/meta-schemas/core.yaml#
27 +
28 +title: Richtek RT5190A PMIC Regulator
29 +
30 +maintainers:
31 + - ChiYuan Huang <cy_huang@richtek.com>
32 +
33 +description: |
34 + The RT5190A integrates 1 channel buck controller, 3 channels high efficiency
35 + synchronous buck converters, 1 LDO, I2C control interface and peripherial
36 + logical control.
37 +
38 + It also supports mute AC OFF depop sound and quick setting storage while
39 + input power is removed.
40 +
41 +properties:
42 + compatible:
43 + enum:
44 + - richtek,rt5190a
45 +
46 + reg:
47 + maxItems: 1
48 +
49 + interrupts:
50 + maxItems: 1
51 +
52 + vin2-supply:
53 + description: phandle to buck2 input voltage.
54 +
55 + vin3-supply:
56 + description: phandle to buck3 input voltage.
57 +
58 + vin4-supply:
59 + description: phandle to buck4 input voltage.
60 +
61 + vinldo-supply:
62 + description: phandle to ldo input voltage
63 +
64 + richtek,mute-enable:
65 + description: |
66 + The mute function uses 'mutein', 'muteout', and 'vdet' pins as the control
67 + signal. When enabled, The normal behavior is to bypass the 'mutein' signal
68 + 'muteout'. But if the power source removal is detected from 'vdet',
69 + whatever the 'mutein' signal is, it will pull down the 'muteout' to force
70 + speakers mute. this function is commonly used to prevent the speaker pop
71 + noise during AC power turned off in the modern TV system design.
72 + type: boolean
73 +
74 + regulators:
75 + type: object
76 +
77 + patternProperties:
78 + "^buck[1-4]$|^ldo$":
79 + type: object
80 + $ref: regulator.yaml#
81 + description: |
82 + regulator description for buck1 and buck4.
83 +
84 + properties:
85 + regulator-allowed-modes:
86 + description: |
87 + buck operating mode, only buck1/4 support mode operating.
88 + 0: auto mode
89 + 1: force pwm mode
90 + items:
91 + enum: [0, 1]
92 +
93 + richtek,latchup-enable:
94 + type: boolean
95 + description: |
96 + If specified, undervolt protection mode changes from the default
97 + hiccup to latchup.
98 +
99 + unevaluatedProperties: false
100 +
101 + additionalProperties: false
102 +
103 +required:
104 + - compatible
105 + - reg
106 + - regulators
107 +
108 +additionalProperties: false
109 +
110 +examples:
111 + - |
112 + #include <dt-bindings/interrupt-controller/irq.h>
113 + #include <dt-bindings/regulator/richtek,rt5190a-regulator.h>
114 +
115 + i2c {
116 + #address-cells = <1>;
117 + #size-cells = <0>;
118 +
119 + pmic@64 {
120 + compatible = "richtek,rt5190a";
121 + reg = <0x64>;
122 + interrupts-extended = <&gpio26 0 IRQ_TYPE_LEVEL_LOW>;
123 + vin2-supply = <&rt5190_buck1>;
124 + vin3-supply = <&rt5190_buck1>;
125 + vin4-supply = <&rt5190_buck1>;
126 +
127 + regulators {
128 + rt5190_buck1: buck1 {
129 + regulator-name = "rt5190a-buck1";
130 + regulator-min-microvolt = <5090000>;
131 + regulator-max-microvolt = <5090000>;
132 + regulator-allowed-modes = <RT5190A_OPMODE_AUTO RT5190A_OPMODE_FPWM>;
133 + regulator-boot-on;
134 + };
135 + buck2 {
136 + regulator-name = "rt5190a-buck2";
137 + regulator-min-microvolt = <600000>;
138 + regulator-max-microvolt = <1400000>;
139 + regulator-boot-on;
140 + };
141 + buck3 {
142 + regulator-name = "rt5190a-buck3";
143 + regulator-min-microvolt = <600000>;
144 + regulator-max-microvolt = <1400000>;
145 + regulator-boot-on;
146 + };
147 + buck4 {
148 + regulator-name = "rt5190a-buck4";
149 + regulator-min-microvolt = <850000>;
150 + regulator-max-microvolt = <850000>;
151 + regulator-allowed-modes = <RT5190A_OPMODE_AUTO RT5190A_OPMODE_FPWM>;
152 + regulator-boot-on;
153 + };
154 + ldo {
155 + regulator-name = "rt5190a-ldo";
156 + regulator-min-microvolt = <1200000>;
157 + regulator-max-microvolt = <1200000>;
158 + regulator-boot-on;
159 + };
160 + };
161 + };
162 + };
163 --- /dev/null
164 +++ b/include/dt-bindings/regulator/richtek,rt5190a-regulator.h
165 @@ -0,0 +1,15 @@
166 +/* SPDX-License-Identifier: GPL-2.0 */
167 +
168 +#ifndef __DT_BINDINGS_RICHTEK_RT5190A_REGULATOR_H__
169 +#define __DT_BINDINGS_RICHTEK_RT5190A_REGULATOR_H__
170 +
171 +/*
172 + * BUCK/LDO mode constants which may be used in devicetree properties
173 + * (eg. regulator-allowed-modes).
174 + * See the manufacturer's datasheet for more information on these modes.
175 + */
176 +
177 +#define RT5190A_OPMODE_AUTO 0
178 +#define RT5190A_OPMODE_FPWM 1
179 +
180 +#endif