Add RK816 PMIC support
Subsystems (6)
cover Add RK816 PMIC support
This series aims to add support for Rockchip RK816 PMIC series. As per datasheet it's targeted for RK3126/RK3128 (RK816-1), RK1108 (RK816-2) and PX3-SE (RK816-3) but might be used for other SoCs as well. The mfd consists of an integrated RTC, a GPIO controller, two 32k clock outputs, a power key (output), 4 buck- and 5 ldo regulators, 3 regulator-switches, and charger with integrated fuel gauge. Charger and fuel gauge are not part of this series. Two of the switches (otg/boost) are part of the binding, but not of the driver. They must only ever by enabled if no battery charging is happening, but it will be enabled automatically if a battery is attached. Thus they need some incorporation of a yet to be added charger driver. Integration in the existing rk8xx-infrastructure was pretty straightforward and only needed very little tweaking. In order to not further bloat the driver(s) too much with additional definitions I tried to re-use existing ones wherever possible.
The patches are loosely based on the vendor's implementation, verified against the datasheet and tested/measured on RK3126 board. As they are touching several subsystems I'm sending them (very) early for the 6.10-cycle.
Alex Bee (5):
dt-bindings: mfd: Add rk816 binding
mfd: rk8xx: Add RK816 support
pinctrl: rk805: Add rk816 pinctrl support
regulator: rk808: Support apply_bit for
rk808_set_suspend_voltage_range
regulator: rk808: Add RK816 support
.../bindings/mfd/rockchip,rk816.yaml | 259 ++++++++++++++++++ drivers/mfd/Kconfig | 4 +- drivers/mfd/rk8xx-core.c | 103 +++++++ drivers/mfd/rk8xx-i2c.c | 45 ++- drivers/pinctrl/pinctrl-rk805.c | 68 +++++ drivers/regulator/rk808-regulator.c | 218 ++++++++++++++- include/linux/mfd/rk808.h | 141 ++++++++++ 7 files changed, 831 insertions(+), 7 deletions(-) create mode 100644 Documentation/devicetree/bindings/mfd/rockchip,rk816.yaml
Signature · 1 line
2.43.2
PATCH 1/5 dt-bindings: mfd: Add rk816 binding
Add DT binding document for Rockchip's RK816 PMIC
--- .../bindings/mfd/rockchip,rk816.yaml | 259 ++++++++++++++++++ 1 file changed, 259 insertions(+) create mode 100644 Documentation/devicetree/bindings/mfd/rockchip,rk816.yaml
Documentation/devicetree/bindings/mfd/rockchip,rk816.yaml new file +259 -0
@@ -0,0 +1,259 @@ +# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/mfd/rockchip,rk816.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: RK816 Power Management Integrated Circuit + +maintainers: + - Chris Zhong <[email protected]> + - Zhang Qing <[email protected]> + +description: | + Rockchip RK816 series PMIC. This device consists of an i2c controlled MFD + that includes regulators, a RTC, a gpio controller, and a power button. + +properties: + compatible: + enum: + - rockchip,rk816 + + reg: + maxItems: 1 + + interrupts: + maxItems: 1 + + '#clock-cells': + description: | + See <dt-bindings/clock/rockchip,rk808.h> for clock IDs. + const: 1 + + clock-output-names: + description: + From common clock binding to override the default output clock name. + maxItems: 2 + + gpio-controller: true + + '#gpio-cells': + const: 2 + + system-power-controller: + type: boolean + description: + Telling whether or not this PMIC is controlling the system power. + + wakeup-source: + type: boolean + description: + Device can be used as a wakeup source. + + vcc1-supply: + description: + The input supply for DCDC_REG1. + + vcc2-supply: + description: + The input supply for DCDC_REG2. + + vcc3-supply: + description: + The input supply for DCDC_REG3. + + vcc4-supply: + description: + The input supply for DCDC_REG4. + + vcc5-supply: + description: + The input supply for LDO_REG1, LDO_REG2, and LDO_REG3. + + vcc6-supply: + description: + The input supply for LDO_REG4, LDO_REG5, and LDO_REG6. + + vcc7-supply: + description: + The input supply for BOOST. + + vcc8-supply: + description: + The input supply for OTG_SWITCH. + + regulators: + type: object + patternProperties: + "^(DCDC_REG[1-4]|LDO_REG[1-6]|BOOST|OTG_SWITCH)$": + type: object + $ref: ../regulator/regulator.yaml# + unevaluatedProperties: false + unevaluatedProperties: false + +required: + - compatible + - reg + - interrupts + - "#clock-cells" + +additionalProperties: false + +examples: + - | + #include <dt-bindings/pinctrl/rockchip.h> + #include <dt-bindings/interrupt-controller/irq.h> + #include <dt-bindings/gpio/gpio.h> + + i2c { + #address-cells = <1>; + #size-cells = <0>; + + rk816: pmic@1a { + compatible = "rockchip,rk816"; + reg = <0x1a>; + interrupt-parent = <&gpio0>; + interrupts = <RK_PA2 IRQ_TYPE_LEVEL_LOW>; + + clock-output-names = "xin32k", "rk816-clkout2"; + pinctrl-names = "default"; + pinctrl-0 = <&pmic_int_l>; + gpio-controller; + system-power-controller; + wakeup-source; + #clock-cells = <1>; + #gpio-cells = <2>; + + vcc1-supply = <&vcc_sys>; + vcc2-supply = <&vcc_sys>; + vcc3-supply = <&vcc_sys>; + vcc4-supply = <&vcc_sys>; + vcc5-supply = <&vcc33_io>; + vcc6-supply = <&vcc_sys>; + + regulators { + vdd_cpu: DCDC_REG1 { + regulator-name = "vdd_cpu"; + regulator-min-microvolt = <750000>; + regulator-max-microvolt = <1450000>; + regulator-ramp-delay = <6001>; + regulator-initial-mode = <1>; + regulator-always-on; + regulator-boot-on; + + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + vdd_logic: DCDC_REG2 { + regulator-name = "vdd_logic"; + regulator-min-microvolt = <800000>; + regulator-max-microvolt = <1250000>; + regulator-ramp-delay = <6001>; + regulator-initial-mode = <1>; + regulator-always-on; + regulator-boot-on; + + regulator-state-mem { + regulator-on-in-suspend; + regulator-suspend-microvolt = <1000000>; + }; + }; + + vcc_ddr: DCDC_REG3 { + regulator-name = "vcc_ddr"; + regulator-initial-mode = <1>; + regulator-always-on; + regulator-boot-on; + + regulator-state-mem { + regulator-on-in-suspend; + }; + }; + + vcc33_io: DCDC_REG4 { + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + regulator-name = "vcc33_io"; + regulator-initial-mode = <1>; + regulator-always-on; + regulator-boot-on; + + regulator-state-mem { + regulator-on-in-suspend; + regulator-suspend-microvolt = <3300000>; + }; + }; + + vccio_pmu: LDO_REG1 { + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + regulator-name = "vccio_pmu"; + regulator-always-on; + regulator-boot-on; + + regulator-state-mem { + regulator-on-in-suspend; + regulator-suspend-microvolt = <3300000>; + }; + }; + + vcc_tp: LDO_REG2 { + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + regulator-name = "vcc_tp"; + + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + vdd_10: LDO_REG3 { + regulator-min-microvolt = <1000000>; + regulator-max-microvolt = <1000000>; + regulator-name = "vdd_10"; + regulator-always-on; + regulator-boot-on; + + regulator-state-mem { + regulator-on-in-suspend; + regulator-suspend-microvolt = <1000000>; + }; + }; + + vcc18_lcd: LDO_REG4 { + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <1800000>; + regulator-name = "vcc18_lcd"; + + regulator-state-mem { + regulator-on-in-suspend; + regulator-suspend-microvolt = <1800000>; + }; + }; + + vccio_sd: LDO_REG5 { + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <3300000>; + regulator-name = "vccio_sd"; + + regulator-state-mem { + regulator-on-in-suspend; + regulator-suspend-microvolt = <3300000>; + }; + }; + + vdd10_lcd: LDO_REG6 { + regulator-min-microvolt = <1000000>; + regulator-max-microvolt = <1000000>; + regulator-name = "vdd10_lcd"; + + regulator-state-mem { + regulator-on-in-suspend; + regulator-suspend-microvolt = <1000000>; + }; + }; + }; + }; + };
Signature · 1 line
2.43.2
Re: [PATCH 1/5] dt-bindings: mfd: Add rk816 binding
Quoted 13 lines · Alex Bee
Add DT binding document for Rockchip's RK816 PMIC
Signed-off-by Alex Bee <[email protected]>Documentation/devicetree/bindings/mfd/rockchip,rk816.yaml new file +3
-0@@ -0,0 +1,259 @@ +# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause +%YAML 1.2 +---
Documentation/devicetree/bindings/mfd/rockchip,rk816.yaml line 13
Quoted 10 lines
Documentation/devicetree/bindings/mfd/rockchip,rk816.yaml new file +10
-0+$id: http://devicetree.org/schemas/mfd/rockchip,rk816.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: RK816 Power Management Integrated Circuit + +maintainers: + - Chris Zhong <[email protected]> + - Zhang Qing <[email protected]> + +description: |
Do not need '|' unless you need to preserve formatting.
Quoted 6 lines
Documentation/devicetree/bindings/mfd/rockchip,rk816.yaml new file +6
-0+ Rockchip RK816 series PMIC. This device consists of an i2c controlled MFD + that includes regulators, a RTC, a gpio controller, and a power button. + +properties: + compatible: + enum:
Documentation/devicetree/bindings/mfd/rockchip,rk816.yaml line 29
Quoted 10 lines
Documentation/devicetree/bindings/mfd/rockchip,rk816.yaml new file +10
-0+ - rockchip,rk816 + + reg: + maxItems: 1 + + interrupts: + maxItems: 1 + + '#clock-cells': + description: |
Do not need '|' unless you need to preserve formatting.
Documentation/devicetree/bindings/mfd/rockchip,rk816.yaml line 35
Quoted 6 lines
Documentation/devicetree/bindings/mfd/rockchip,rk816.yaml new file +6
-0+ See <dt-bindings/clock/rockchip,rk808.h> for clock IDs. + const: 1 + + clock-output-names: + description: + From common clock binding to override the default output clock name.
Drop description, it's obvious.
Quoted 6 lines
Documentation/devicetree/bindings/mfd/rockchip,rk816.yaml new file +6
-0+ maxItems: 2 + + gpio-controller: true + + '#gpio-cells': + const: 2
Documentation/devicetree/bindings/mfd/rockchip,rk816.yaml line 51
Quoted 10 lines
Documentation/devicetree/bindings/mfd/rockchip,rk816.yaml new file +10
-0+ + system-power-controller: + type: boolean + description: + Telling whether or not this PMIC is controlling the system power. + + wakeup-source: + type: boolean + description: + Device can be used as a wakeup source.
Drop description, it's obvious. It's considered generic property, even if we did not document it in dtschema yet.
Quoted 27 lines
Documentation/devicetree/bindings/mfd/rockchip,rk816.yaml new file +27
-0+ + vcc1-supply: + description: + The input supply for DCDC_REG1. + + vcc2-supply: + description: + The input supply for DCDC_REG2. + + vcc3-supply: + description: + The input supply for DCDC_REG3. + + vcc4-supply: + description: + The input supply for DCDC_REG4. + + vcc5-supply: + description: + The input supply for LDO_REG1, LDO_REG2, and LDO_REG3. + + vcc6-supply: + description: + The input supply for LDO_REG4, LDO_REG5, and LDO_REG6. + + vcc7-supply: + description:
Documentation/devicetree/bindings/mfd/rockchip,rk816.yaml line 88
Quoted 10 lines
Documentation/devicetree/bindings/mfd/rockchip,rk816.yaml new file +10
-0+ The input supply for BOOST. + + vcc8-supply: + description: + The input supply for OTG_SWITCH. + + regulators: + type: object + patternProperties: + "^(DCDC_REG[1-4]|LDO_REG[1-6]|BOOST|OTG_SWITCH)$":
Lowercase. No underscores allowed, use hyphens.
Documentation/devicetree/bindings/mfd/rockchip,rk816.yaml line 90
Quoted 2 lines
Documentation/devicetree/bindings/mfd/rockchip,rk816.yaml new file +2
-0+ type: object + $ref: ../regulator/regulator.yaml#
Full path, so /schemas/regulator/
Documentation/devicetree/bindings/mfd/rockchip,rk816.yaml line 102
Quoted 12 lines
Documentation/devicetree/bindings/mfd/rockchip,rk816.yaml new file +12
-0+ unevaluatedProperties: false + unevaluatedProperties: false + +required: + - compatible + - reg + - interrupts + - "#clock-cells" + +additionalProperties: false + +examples:
Best regards,
Krzysztof
PATCH 2/5 mfd: rk8xx: Add RK816 support
In reply to Alex BeeThis integrates RK816 support in the this existing rk8xx mfd driver.
This version has unaligned interrupt registers, which requires to define a separate get_irq_reg callback for the regmap. Apart from that the integration is straightforward and the existing structures can be used as is. The initialisation sequence has been taken from vendor kernel.
--- drivers/mfd/Kconfig | 4 +- drivers/mfd/rk8xx-core.c | 103 ++++++++++++++++++++++++++++ drivers/mfd/rk8xx-i2c.c | 45 +++++++++++- include/linux/mfd/rk808.h | 141 ++++++++++++++++++++++++++++++++++++++ 4 files changed, 290 insertions(+), 3 deletions(-)
drivers/mfd/Kconfig +2 -2
@@ -1225,7 +1225,7 @@ config MFD_RK8XX select MFD_CORE config MFD_RK8XX_I2C - tristate "Rockchip RK805/RK808/RK809/RK817/RK818 Power Management Chip" + tristate "Rockchip RK805/RK808/RK809/RK816/RK817/RK818 Power Management Chip" depends on I2C && OF select MFD_CORE select REGMAP_I2C
@@ -1233,7 +1233,7 @@ config MFD_RK8XX_I2C select MFD_RK8XX help If you say yes here you get support for the RK805, RK808, RK809, - RK817 and RK818 Power Management chips. + RK816, RK817 and RK818 Power Management chips. This driver provides common support for accessing the device through I2C interface. The device supports multiple sub-devices including interrupts, RTC, LDO & DCDC regulators, and onkey.
drivers/mfd/rk8xx-core.c +103 -0
145 lines not on this page · raw message
drivers/mfd/rk8xx-i2c.c +44 -1
74 lines not on this page · raw message
include/linux/mfd/rk808.h +141 -0
159 lines not on this page · raw message
Signature · 1 line
2.43.2
kernel test robot
build botRe: [PATCH 2/5] mfd: rk8xx: Add RK816 support
kernel test robot noticed the following build warnings:
Hi Alex,
kernel test robot noticed the following build warnings:
[auto build test WARNING on lee-mfd/for-mfd-next]
[also build test WARNING on lee-mfd/for-mfd-fixes broonie-regulator/for-next robh/for-next linus/master v6.8 next-20240322] [If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Alex-Bee/dt-bindings-mfd-Add-rk816-binding/20240321-224318 base: https://git.kernel.org/pub/scm/linux/kernel/git/lee/mfd.git for-mfd-next patch link: https://lore.kernel.org/r/20240321143911.90210-5-knaerzche%40gmail.com patch subject: [PATCH 2/5] mfd: rk8xx: Add RK816 support config: i386-randconfig-062-20240322 (https://download.01.org/0day-ci/archive/20240323/[email protected]/config) compiler: gcc-12 (Debian 12.2.0-14) 12.2.0 reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240323/[email protected]/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/
sparse warnings: (new ones prefixed by >>)
>> drivers/mfd/rk8xx-core.c:573:24: sparse: sparse: incorrect type in initializer (different modifiers) @@ expected unsigned int ( *get_irq_reg )( ... ) @@ got unsigned int ( const * )( ... ) @@
drivers/mfd/rk8xx-core.c:573:24: sparse: expected unsigned int ( *get_irq_reg )( ... )
drivers/mfd/rk8xx-core.c:573:24: sparse: got unsigned int ( const * )( ... )
vim +573 drivers/mfd/rk8xx-core.c
567
568 static const struct regmap_irq_chip rk816_irq_chip = {
569 .name = "rk816",
570 .irqs = rk816_irqs,
571 .num_irqs = ARRAY_SIZE(rk816_irqs),
572 .num_regs = 3,
> 573 .get_irq_reg = rk816_get_irq_reg,
574 .status_base = RK816_INT_STS_REG1,
575 .mask_base = RK816_INT_STS_MSK_REG1,
576 .ack_base = RK816_INT_STS_REG1,
577 .init_ack_masked = true,
578 };
579
Signature · 2 lines
0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki
kernel test robot
build botRe: [PATCH 2/5] mfd: rk8xx: Add RK816 support
In reply to Alex Beekernel test robot noticed the following build errors:
Hi Alex,
kernel test robot noticed the following build errors:
[auto build test ERROR on lee-mfd/for-mfd-next]
[also build test ERROR on lee-mfd/for-mfd-fixes broonie-regulator/for-next robh/for-next linus/master v6.8 next-20240322] [If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Alex-Bee/dt-bindings-mfd-Add-rk816-binding/20240321-224318 base: https://git.kernel.org/pub/scm/linux/kernel/git/lee/mfd.git for-mfd-next patch link: https://lore.kernel.org/r/20240321143911.90210-5-knaerzche%40gmail.com patch subject: [PATCH 2/5] mfd: rk8xx: Add RK816 support config: arm-randconfig-002-20240322 (https://download.01.org/0day-ci/archive/20240323/[email protected]/config) compiler: clang version 19.0.0git (https://github.com/llvm/llvm-project 23de3862dce582ce91c1aa914467d982cb1a73b4) reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240323/[email protected]/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/
All error/warnings (new ones prefixed by >>):
In file included from drivers/mfd/rk8xx-core.c:14:
In file included from include/linux/mfd/rk808.h:18:
In file included from include/linux/regulator/machine.h:15:
In file included from include/linux/regulator/consumer.h:35:
In file included from include/linux/suspend.h:5:
In file included from include/linux/swap.h:9:
In file included from include/linux/memcontrol.h:20:
In file included from include/linux/mm.h:2188:
include/linux/vmstat.h:522:36: warning: arithmetic between different enumeration types ('enum node_stat_item' and 'enum lru_list') [-Wenum-enum-conversion]
522 | return node_stat_name(NR_LRU_BASE + lru) + 3; // skip "nr_"
| ~~~~~~~~~~~ ^ ~~~
>> drivers/mfd/rk8xx-core.c:395:8: warning: 'const' type qualifier on return type has no effect [-Wignored-qualifiers]
395 | static const unsigned int rk816_get_irq_reg(struct regmap_irq_chip_data *data,
| ^~~~~
>> drivers/mfd/rk8xx-core.c:573:17: error: incompatible function pointer types initializing 'unsigned int (*)(struct regmap_irq_chip_data *, unsigned int, int)' with an expression of type 'const unsigned int (struct regmap_irq_chip_data *, unsigned int, int)' [-Wincompatible-function-pointer-types]
573 | .get_irq_reg = rk816_get_irq_reg,
| ^~~~~~~~~~~~~~~~~2 warnings and 1 error generated.
vim +573 drivers/mfd/rk8xx-core.c
394
> 395 static const unsigned int rk816_get_irq_reg(struct regmap_irq_chip_data *data,
396 unsigned int base, int index)
397 {
398 unsigned int irq_reg = base;
399
400 switch (base) {
401 case RK816_INT_STS_REG1:
402 irq_reg += rk816_irq_status_offsets[index];
403 break;
404 case RK816_INT_STS_MSK_REG1:
405 irq_reg += rk816_irq_mask_offsets[index];
406 break;
407 }
408
409 return irq_reg;
410 };
411
412 static const struct regmap_irq rk816_irqs[] = {
413 /* INT_STS_REG1 IRQs */
414 REGMAP_IRQ_REG(RK816_IRQ_PWRON_FALL, 0, RK816_INT_STS_PWRON_FALL),
415 REGMAP_IRQ_REG(RK816_IRQ_PWRON_RISE, 0, RK816_INT_STS_PWRON_RISE),
416
417 /* INT_STS_REG2 IRQs */
418 REGMAP_IRQ_REG(RK816_IRQ_VB_LOW, 1, RK816_INT_STS_VB_LOW),
419 REGMAP_IRQ_REG(RK816_IRQ_PWRON, 1, RK816_INT_STS_PWRON),
420 REGMAP_IRQ_REG(RK816_IRQ_PWRON_LP, 1, RK816_INT_STS_PWRON_LP),
421 REGMAP_IRQ_REG(RK816_IRQ_HOTDIE, 1, RK816_INT_STS_HOTDIE),
422 REGMAP_IRQ_REG(RK816_IRQ_RTC_ALARM, 1, RK816_INT_STS_RTC_ALARM),
423 REGMAP_IRQ_REG(RK816_IRQ_RTC_PERIOD, 1, RK816_INT_STS_RTC_PERIOD),
424 REGMAP_IRQ_REG(RK816_IRQ_USB_OV, 1, RK816_INT_STS_USB_OV),
425
426 /* INT_STS3 IRQs */
427 REGMAP_IRQ_REG(RK816_IRQ_PLUG_IN, 2, RK816_INT_STS_PLUG_IN),
428 REGMAP_IRQ_REG(RK816_IRQ_PLUG_OUT, 2, RK816_INT_STS_PLUG_OUT),
429 REGMAP_IRQ_REG(RK816_IRQ_CHG_OK, 2, RK816_INT_STS_CHG_OK),
430 REGMAP_IRQ_REG(RK816_IRQ_CHG_TE, 2, RK816_INT_STS_CHG_TE),
431 REGMAP_IRQ_REG(RK816_IRQ_CHG_TS, 2, RK816_INT_STS_CHG_TS),
432 REGMAP_IRQ_REG(RK816_IRQ_CHG_CVTLIM, 2, RK816_INT_STS_CHG_CVTLIM),
433 REGMAP_IRQ_REG(RK816_IRQ_DISCHG_ILIM, 2, RK816_INT_STS_DISCHG_ILIM),
434 };
435
436 static const struct regmap_irq rk818_irqs[] = {
437 /* INT_STS */
438 [RK818_IRQ_VOUT_LO] = {
439 .mask = RK818_IRQ_VOUT_LO_MSK,
440 .reg_offset = 0,
441 },
442 [RK818_IRQ_VB_LO] = {
443 .mask = RK818_IRQ_VB_LO_MSK,
444 .reg_offset = 0,
445 },
446 [RK818_IRQ_PWRON] = {
447 .mask = RK818_IRQ_PWRON_MSK,
448 .reg_offset = 0,
449 },
450 [RK818_IRQ_PWRON_LP] = {
451 .mask = RK818_IRQ_PWRON_LP_MSK,
452 .reg_offset = 0,
453 },
454 [RK818_IRQ_HOTDIE] = {
455 .mask = RK818_IRQ_HOTDIE_MSK,
456 .reg_offset = 0,
457 },
458 [RK818_IRQ_RTC_ALARM] = {
459 .mask = RK818_IRQ_RTC_ALARM_MSK,
460 .reg_offset = 0,
461 },
462 [RK818_IRQ_RTC_PERIOD] = {
463 .mask = RK818_IRQ_RTC_PERIOD_MSK,
464 .reg_offset = 0,
465 },
466 [RK818_IRQ_USB_OV] = {
467 .mask = RK818_IRQ_USB_OV_MSK,
468 .reg_offset = 0,
469 },
470
471 /* INT_STS2 */
472 [RK818_IRQ_PLUG_IN] = {
473 .mask = RK818_IRQ_PLUG_IN_MSK,
474 .reg_offset = 1,
475 },
476 [RK818_IRQ_PLUG_OUT] = {
477 .mask = RK818_IRQ_PLUG_OUT_MSK,
478 .reg_offset = 1,
479 },
480 [RK818_IRQ_CHG_OK] = {
481 .mask = RK818_IRQ_CHG_OK_MSK,
482 .reg_offset = 1,
483 },
484 [RK818_IRQ_CHG_TE] = {
485 .mask = RK818_IRQ_CHG_TE_MSK,
486 .reg_offset = 1,
487 },
488 [RK818_IRQ_CHG_TS1] = {
489 .mask = RK818_IRQ_CHG_TS1_MSK,
490 .reg_offset = 1,
491 },
492 [RK818_IRQ_TS2] = {
493 .mask = RK818_IRQ_TS2_MSK,
494 .reg_offset = 1,
495 },
496 [RK818_IRQ_CHG_CVTLIM] = {
497 .mask = RK818_IRQ_CHG_CVTLIM_MSK,
498 .reg_offset = 1,
499 },
500 [RK818_IRQ_DISCHG_ILIM] = {
501 .mask = RK818_IRQ_DISCHG_ILIM_MSK,
502 .reg_offset = 1,
503 },
504 };
505
506 static const struct regmap_irq rk817_irqs[RK817_IRQ_END] = {
507 REGMAP_IRQ_REG_LINE(0, 8),
508 REGMAP_IRQ_REG_LINE(1, 8),
509 REGMAP_IRQ_REG_LINE(2, 8),
510 REGMAP_IRQ_REG_LINE(3, 8),
511 REGMAP_IRQ_REG_LINE(4, 8),
512 REGMAP_IRQ_REG_LINE(5, 8),
513 REGMAP_IRQ_REG_LINE(6, 8),
514 REGMAP_IRQ_REG_LINE(7, 8),
515 REGMAP_IRQ_REG_LINE(8, 8),
516 REGMAP_IRQ_REG_LINE(9, 8),
517 REGMAP_IRQ_REG_LINE(10, 8),
518 REGMAP_IRQ_REG_LINE(11, 8),
519 REGMAP_IRQ_REG_LINE(12, 8),
520 REGMAP_IRQ_REG_LINE(13, 8),
521 REGMAP_IRQ_REG_LINE(14, 8),
522 REGMAP_IRQ_REG_LINE(15, 8),
523 REGMAP_IRQ_REG_LINE(16, 8),
524 REGMAP_IRQ_REG_LINE(17, 8),
525 REGMAP_IRQ_REG_LINE(18, 8),
526 REGMAP_IRQ_REG_LINE(19, 8),
527 REGMAP_IRQ_REG_LINE(20, 8),
528 REGMAP_IRQ_REG_LINE(21, 8),
529 REGMAP_IRQ_REG_LINE(22, 8),
530 REGMAP_IRQ_REG_LINE(23, 8)
531 };
532
533 static struct regmap_irq_chip rk805_irq_chip = {
534 .name = "rk805",
535 .irqs = rk805_irqs,
536 .num_irqs = ARRAY_SIZE(rk805_irqs),
537 .num_regs = 1,
538 .status_base = RK805_INT_STS_REG,
539 .mask_base = RK805_INT_STS_MSK_REG,
540 .ack_base = RK805_INT_STS_REG,
541 .init_ack_masked = true,
542 };
543
544 static struct regmap_irq_chip rk806_irq_chip = {
545 .name = "rk806",
546 .irqs = rk806_irqs,
547 .num_irqs = ARRAY_SIZE(rk806_irqs),
548 .num_regs = 2,
549 .irq_reg_stride = 2,
550 .mask_base = RK806_INT_MSK0,
551 .status_base = RK806_INT_STS0,
552 .ack_base = RK806_INT_STS0,
553 .init_ack_masked = true,
554 };
555
556 static const struct regmap_irq_chip rk808_irq_chip = {
557 .name = "rk808",
558 .irqs = rk808_irqs,
559 .num_irqs = ARRAY_SIZE(rk808_irqs),
560 .num_regs = 2,
561 .irq_reg_stride = 2,
562 .status_base = RK808_INT_STS_REG1,
563 .mask_base = RK808_INT_STS_MSK_REG1,
564 .ack_base = RK808_INT_STS_REG1,
565 .init_ack_masked = true,
566 };
567
568 static const struct regmap_irq_chip rk816_irq_chip = {
569 .name = "rk816",
570 .irqs = rk816_irqs,
571 .num_irqs = ARRAY_SIZE(rk816_irqs),
572 .num_regs = 3,
> 573 .get_irq_reg = rk816_get_irq_reg, 574 .status_base = RK816_INT_STS_REG1,
575 .mask_base = RK816_INT_STS_MSK_REG1,
576 .ack_base = RK816_INT_STS_REG1,
577 .init_ack_masked = true,
578 };
579
Signature · 2 lines
0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki
kernel test robot
build botRe: [PATCH 2/5] mfd: rk8xx: Add RK816 support
In reply to Alex Beekernel test robot noticed the following build warnings:
Hi Alex,
kernel test robot noticed the following build warnings:
[auto build test WARNING on lee-mfd/for-mfd-next]
[also build test WARNING on lee-mfd/for-mfd-fixes broonie-regulator/for-next robh/for-next linus/master v6.8 next-20240322] [If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Alex-Bee/dt-bindings-mfd-Add-rk816-binding/20240321-224318 base: https://git.kernel.org/pub/scm/linux/kernel/git/lee/mfd.git for-mfd-next patch link: https://lore.kernel.org/r/20240321143911.90210-5-knaerzche%40gmail.com patch subject: [PATCH 2/5] mfd: rk8xx: Add RK816 support config: arc-randconfig-001-20240322 (https://download.01.org/0day-ci/archive/20240323/[email protected]/config) compiler: arc-elf-gcc (GCC) 13.2.0 reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240323/[email protected]/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/
All warnings (new ones prefixed by >>):
>> drivers/mfd/rk8xx-core.c:395:8: warning: type qualifiers ignored on function return type [-Wignored-qualifiers]
395 | static const unsigned int rk816_get_irq_reg(struct regmap_irq_chip_data *data,
| ^~~~~
vim +395 drivers/mfd/rk8xx-core.c
394
> 395 static const unsigned int rk816_get_irq_reg(struct regmap_irq_chip_data *data,
396 unsigned int base, int index)
397 {
398 unsigned int irq_reg = base;
399
400 switch (base) {
401 case RK816_INT_STS_REG1:
402 irq_reg += rk816_irq_status_offsets[index];
403 break;
404 case RK816_INT_STS_MSK_REG1:
405 irq_reg += rk816_irq_mask_offsets[index];
406 break;
407 }
408
409 return irq_reg;
410 };
411
Signature · 2 lines
0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki
PATCH 3/5 pinctrl: rk805: Add rk816 pinctrl support
In reply to Alex BeeThis adds support for RK816 to the exising rk805 pinctrl driver
It has a single pin which can be configured as input from a thermistor (for instance in an attached battery) or as a gpio.
--- drivers/pinctrl/pinctrl-rk805.c | 68 +++++++++++++++++++++++++++++++++ 1 file changed, 68 insertions(+)
drivers/pinctrl/pinctrl-rk805.c +68 -0
@@ -93,6 +93,11 @@ enum rk806_pinmux_option { RK806_PINMUX_FUN5, }; +enum rk816_pinmux_option { +RK816_PINMUX_GPIO , +RK816_PINMUX_TS , +}; +enum {RK805_GPIO0 ,RK805_GPIO1 ,
@@ -104,6 +109,10 @@ enum {RK806_GPIO_DVS3 }; +enum { +RK816_GPIO0 , +}; +static const char *const rk805_gpio_groups[] = {"gpio0" ,"gpio1" ,
@@ -115,6 +124,10 @@ static const char *const rk806_gpio_groups[] = { "gpio_pwrctrl3", }; +static const char *const rk816_gpio_groups[] = { +"gpio0" , +}; +/* RK805: 2 output only GPIOs */ static const struct pinctrl_pin_desc rk805_pins_desc[] = {PINCTRL_PIN (RK805_GPIO0 ,"gpio0" ),
@@ -128,6 +141,11 @@ static const struct pinctrl_pin_desc rk806_pins_desc[] = { PINCTRL_PIN(RK806_GPIO_DVS3, "gpio_pwrctrl3"), }; +/* RK816 */ +static const struct pinctrl_pin_desc rk816_pins_desc[] = { +PINCTRL_PIN (RK816_GPIO0 ,"gpio0" ), +}; +static const struct rk805_pin_function rk805_pin_functions[] = { { .name ="gpio" ,
@@ -176,6 +194,21 @@ static const struct rk805_pin_function rk806_pin_functions[] = { }, }; +static const struct rk805_pin_function rk816_pin_functions[] = { + { + .name ="gpio" , + .groups = rk816_gpio_groups, + .ngroups =ARRAY_SIZE (rk816_gpio_groups), + .mux_option =RK816_PINMUX_GPIO , + }, + { + .name ="ts" , + .groups = rk816_gpio_groups, + .ngroups =ARRAY_SIZE (rk816_gpio_groups), + .mux_option =RK816_PINMUX_TS , + }, +}; +static const struct rk805_pin_group rk805_pin_groups[] = { { .name ="gpio0" ,
@@ -207,6 +240,14 @@ static const struct rk805_pin_group rk806_pin_groups[] = { } }; +static const struct rk805_pin_group rk816_pin_groups[] = { + { + .name ="gpio0" , + .pins = {RK816_GPIO0 }, + .npins =1 , + }, +}; +#define RK805_GPIO0_VAL_MSK BIT(0)#define RK805_GPIO1_VAL_MSK BIT(1)
@@ -255,6 +296,19 @@ static struct rk805_pin_config rk806_gpio_cfgs[] = { } }; +#define RK816_FUN_MASK BIT(2) +#define RK816_VAL_MASK BIT(3) +#define RK816_DIR_MASK BIT(4) + +static struct rk805_pin_config rk816_gpio_cfgs[] = { + { + .reg =RK818_IO_POL_REG , + .val_msk =RK816_VAL_MASK , + .fun_msk =RK816_FUN_MASK , + .dir_msk =RK816_DIR_MASK , + }, +}; +/* generic gpio chip */ static int rk805_gpio_get (struct gpio_chip *chip,unsigned int offset) {
@@ -439,6 +493,8 @@ static int rk805_pinctrl_gpio_request_enable(struct pinctrl_dev *pctldev,return _rk805_pinctrl_set_mux (pctldev, offset,RK805_PINMUX_GPIO );case RK806_ID :return _rk805_pinctrl_set_mux (pctldev, offset,RK806_PINMUX_FUN5 ); +case RK816_ID : +return _rk805_pinctrl_set_mux (pctldev, offset,RK816_PINMUX_GPIO ); }return -ENOTSUPP ;
@@ -588,6 +644,18 @@ static int rk805_pinctrl_probe(struct platform_device *pdev) pci->pin_cfg = rk806_gpio_cfgs; pci->gpio_chip.ngpio =ARRAY_SIZE (rk806_gpio_cfgs);break ; +case RK816_ID : + pci->pins = rk816_pins_desc; + pci->num_pins =ARRAY_SIZE (rk816_pins_desc); + pci->functions = rk816_pin_functions; + pci->num_functions =ARRAY_SIZE (rk816_pin_functions); + pci->groups = rk816_pin_groups; + pci->num_pin_groups =ARRAY_SIZE (rk816_pin_groups); + pci->pinctrl_desc.pins = rk816_pins_desc; + pci->pinctrl_desc.npins =ARRAY_SIZE (rk816_pins_desc); + pci->pin_cfg = rk816_gpio_cfgs; + pci->gpio_chip.ngpio =ARRAY_SIZE (rk816_gpio_cfgs); +break ;default :dev_err (&pdev->dev,"unsupported RK805 ID %lu\n" , pci->rk808->variant);
Signature · 1 line
2.43.2
PATCH 4/5 regulator: rk808: Support apply_bit for rk808_set_suspend_voltage_range
In reply to Alex Beerk808_set_suspend_voltage_range currently does not account the existence of apply_bit/apply_reg.
This adds support for those in same way it is done in regulator_set_voltage_sel_regmap and is required for the upcoming RK816 support
--- drivers/regulator/rk808-regulator.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-)
drivers/regulator/rk808-regulator.c +13 -3
@@ -534,15 +534,25 @@ static int rk808_set_suspend_voltage_range(struct regulator_dev *rdev, int uv) {unsigned int reg;int sel =regulator_map_voltage_linear_range (rdev, uv, uv); +int ret;if (sel <0 )return -EINVAL ; reg = rdev->desc->vsel_reg +RK808_SLP_REG_OFFSET ; -return regmap_update_bits (rdev->regmap, reg, - rdev->desc->vsel_mask, - sel); + ret =regmap_update_bits (rdev->regmap, reg, + rdev->desc->vsel_mask, + sel); +if (ret) +return ret; + +if (rdev->desc->apply_bit) + ret =regmap_update_bits (rdev->regmap, rdev->desc->apply_reg, + rdev->desc->apply_bit, + rdev->desc->apply_bit); + +return ret; }static int rk805_set_suspend_enable (struct regulator_dev *rdev)
Signature · 1 line
2.43.2
PATCH 5/5 regulator: rk808: Add RK816 support
In reply to Alex BeeAdd support for rk816 to the exisiting rk808 regulator driver.
The infrastructure of the driver can be re-used as is. A peculiarity for this version is, that BUCK1/BUCK2 have a (common) bit which needs to toggled after a voltage change to "confirm" the change. Regulator regmap takes care of that by defining a apply_bit and apply_reg for those regulators.
--- drivers/regulator/rk808-regulator.c | 202 +++++++++++++++++++++++++++- 1 file changed, 201 insertions(+), 1 deletion(-)
drivers/regulator/rk808-regulator.c +201 -1
@@ -158,6 +158,11 @@RK8XX_DESC_COM (_id, _match, _supply, _min, _max, _step, _vreg, \ _vmask, _ereg, _emask, 0, 0, _etime, &rk808_reg_ops) +#define RK816_DESC (_id, _match, _supply, _min, _max, _step, _vreg, \ + _vmask, _ereg, _emask, _disval, _etime) \ + RK8XX_DESC_COM(_id, _match, _supply, _min, _max, _step, _vreg, \ + _vmask, _ereg, _emask, _emask, _disval, _etime, &rk816_reg_ops) +#define RK817_DESC (_id, _match, _supply, _min, _max, _step, _vreg, \ _vmask, _ereg, _emask, _disval, _etime) \ RK8XX_DESC_COM(_id, _match, _supply, _min, _max, _step, _vreg, \
@@ -258,7 +263,7 @@ static const unsigned int rk808_buck1_2_ramp_table[] = { 2000, 4000, 6000, 10000 }; -/* RK817 RK809 */ +/* RK817/RK809/RK816 (buck 1/2 only) */ static const unsigned int rk817_buck1_4_ramp_table[] = {3000 ,6300 ,12500 ,25000 };
@@ -640,6 +645,38 @@ static int rk808_set_suspend_disable(struct regulator_dev *rdev) rdev->desc->enable_mask); } +static const struct rk8xx_register_bit rk816_suspend_bits[] = { +RK8XX_REG_BIT (RK818_SLEEP_SET_OFF_REG1 ,0 ), +RK8XX_REG_BIT (RK818_SLEEP_SET_OFF_REG1 ,1 ), +RK8XX_REG_BIT (RK818_SLEEP_SET_OFF_REG1 ,2 ), +RK8XX_REG_BIT (RK818_SLEEP_SET_OFF_REG1 ,3 ), +RK8XX_REG_BIT (RK818_SLEEP_SET_OFF_REG2 ,0 ), +RK8XX_REG_BIT (RK818_SLEEP_SET_OFF_REG2 ,1 ), +RK8XX_REG_BIT (RK818_SLEEP_SET_OFF_REG2 ,2 ), +RK8XX_REG_BIT (RK818_SLEEP_SET_OFF_REG2 ,3 ), +RK8XX_REG_BIT (RK818_SLEEP_SET_OFF_REG2 ,4 ), +RK8XX_REG_BIT (RK818_SLEEP_SET_OFF_REG2 ,5 ), +RK8XX_REG_BIT (RK818_SLEEP_SET_OFF_REG1 ,5 ), +RK8XX_REG_BIT (RK818_SLEEP_SET_OFF_REG1 ,6 ), +}; + +static int rk816_set_suspend_enable (struct regulator_dev *rdev) +{ +int rid =rdev_get_id (rdev); + +return regmap_update_bits (rdev->regmap, rk816_suspend_bits[rid].reg, + rk816_suspend_bits[rid].bit, + rk816_suspend_bits[rid].bit); +} + +static int rk816_set_suspend_disable (struct regulator_dev *rdev) +{ +int rid =rdev_get_id (rdev); + +return regmap_update_bits (rdev->regmap, rk816_suspend_bits[rid].reg, + rk816_suspend_bits[rid].bit,0 ); +} +static int rk817_set_suspend_enable_ctrl (struct regulator_dev *rdev,unsigned int en) {
@@ -913,6 +950,54 @@ static const struct regulator_ops rk809_buck5_ops_range = { .set_suspend_disable = rk817_set_suspend_disable, }; +static const struct regulator_ops rk816_buck1_2_ops_ranges = { + .list_voltage = regulator_list_voltage_linear_range, + .map_voltage = regulator_map_voltage_linear_range, + .get_voltage_sel = regulator_get_voltage_sel_regmap, + .set_voltage_sel = regulator_set_voltage_sel_regmap, + .set_voltage_time_sel = regulator_set_voltage_time_sel, + .enable = regulator_enable_regmap, + .disable = regulator_disable_regmap, + .is_enabled = regulator_is_enabled_regmap, + .set_mode = rk8xx_set_mode, + .get_mode = rk8xx_get_mode, + .set_suspend_mode = rk8xx_set_suspend_mode, + .set_ramp_delay = regulator_set_ramp_delay_regmap, + .set_suspend_voltage = rk808_set_suspend_voltage_range, + .set_suspend_enable = rk816_set_suspend_enable, + .set_suspend_disable = rk816_set_suspend_disable, +}; + +static const struct regulator_ops rk816_buck4_ops_ranges = { + .list_voltage = regulator_list_voltage_linear_range, + .map_voltage = regulator_map_voltage_linear_range, + .get_voltage_sel = regulator_get_voltage_sel_regmap, + .set_voltage_sel = regulator_set_voltage_sel_regmap, + .set_voltage_time_sel = regulator_set_voltage_time_sel, + .enable = regulator_enable_regmap, + .disable = regulator_disable_regmap, + .is_enabled = regulator_is_enabled_regmap, + .set_mode = rk8xx_set_mode, + .get_mode = rk8xx_get_mode, + .set_suspend_mode = rk8xx_set_suspend_mode, + .set_suspend_voltage = rk808_set_suspend_voltage_range, + .set_suspend_enable = rk816_set_suspend_enable, + .set_suspend_disable = rk816_set_suspend_disable, +}; + +static const struct regulator_ops rk816_reg_ops = { + .list_voltage = regulator_list_voltage_linear, + .map_voltage = regulator_map_voltage_linear, + .get_voltage_sel = regulator_get_voltage_sel_regmap, + .set_voltage_sel = regulator_set_voltage_sel_regmap, + .enable = regulator_enable_regmap, + .disable = regulator_disable_regmap, + .is_enabled = rk8xx_is_enabled_wmsk_regmap, + .set_suspend_voltage = rk808_set_suspend_voltage, + .set_suspend_enable = rk816_set_suspend_enable, + .set_suspend_disable = rk816_set_suspend_disable, +}; +static const struct regulator_ops rk817_reg_ops = { .list_voltage = regulator_list_voltage_linear, .map_voltage = regulator_map_voltage_linear,
@@ -1392,6 +1477,117 @@ static const struct regulator_desc rk809_reg[] = { DISABLE_VAL(3)), }; +static const struct linear_range rk816_buck_4_voltage_ranges[] = { +REGULATOR_LINEAR_RANGE (800000 ,0 ,26 ,100000 ), +REGULATOR_LINEAR_RANGE (3500000 ,27 ,31 ,0 ), +}; + +static const struct regulator_desc rk816_reg[] = { + { + .name ="DCDC_REG1" , + .supply_name ="vcc1" , + .of_match =of_match_ptr ("DCDC_REG1" ), + .regulators_node =of_match_ptr ("regulators" ), + .id =RK816_ID_DCDC1 , + .ops = &rk816_buck1_2_ops_ranges, + .type =REGULATOR_VOLTAGE , + .n_voltages =64 , + .linear_ranges = rk805_buck_1_2_voltage_ranges, + .n_linear_ranges =ARRAY_SIZE (rk805_buck_1_2_voltage_ranges), + .vsel_reg =RK818_BUCK1_ON_VSEL_REG , + .vsel_mask =RK818_BUCK_VSEL_MASK , + .apply_reg =RK816_DCDC_EN_REG2 , + .apply_bit =RK816_BUCK_DVS_CONFIRM , + .enable_reg =RK816_DCDC_EN_REG1 , + .enable_mask =BIT (4 ) |BIT (0 ), + .enable_val =BIT (4 ) |BIT (0 ), + .disable_val =BIT (4 ), + .ramp_reg =RK818_BUCK1_CONFIG_REG , + .ramp_mask =RK808_RAMP_RATE_MASK , + .ramp_delay_table = rk817_buck1_4_ramp_table, + .n_ramp_values =ARRAY_SIZE (rk817_buck1_4_ramp_table), + .of_map_mode = rk8xx_regulator_of_map_mode, + .owner =THIS_MODULE , + }, { + .name ="DCDC_REG2" , + .supply_name ="vcc2" , + .of_match =of_match_ptr ("DCDC_REG2" ), + .regulators_node =of_match_ptr ("regulators" ), + .id =RK816_ID_DCDC2 , + .ops = &rk816_buck1_2_ops_ranges, + .type =REGULATOR_VOLTAGE , + .n_voltages =64 , + .linear_ranges = rk805_buck_1_2_voltage_ranges, + .n_linear_ranges =ARRAY_SIZE (rk805_buck_1_2_voltage_ranges), + .vsel_reg =RK818_BUCK2_ON_VSEL_REG , + .vsel_mask =RK818_BUCK_VSEL_MASK , + .apply_reg =RK816_DCDC_EN_REG2 , + .apply_bit =RK816_BUCK_DVS_CONFIRM , + .enable_reg =RK816_DCDC_EN_REG1 , + .enable_mask =BIT (5 ) |BIT (1 ), + .enable_val =BIT (5 ) |BIT (1 ), + .disable_val =BIT (5 ), + .ramp_reg =RK818_BUCK2_CONFIG_REG , + .ramp_mask =RK808_RAMP_RATE_MASK , + .ramp_delay_table = rk817_buck1_4_ramp_table, + .n_ramp_values =ARRAY_SIZE (rk817_buck1_4_ramp_table), + .of_map_mode = rk8xx_regulator_of_map_mode, + .owner =THIS_MODULE , + }, { + .name ="DCDC_REG3" , + .supply_name ="vcc3" , + .of_match =of_match_ptr ("DCDC_REG3" ), + .regulators_node =of_match_ptr ("regulators" ), + .id =RK816_ID_DCDC3 , + .ops = &rk808_switch_ops, + .type =REGULATOR_VOLTAGE , + .n_voltages =1 , + .enable_reg =RK816_DCDC_EN_REG1 , + .enable_mask =BIT (6 ) |BIT (2 ), + .enable_val =BIT (6 ) |BIT (2 ), + .disable_val =BIT (6 ), + .of_map_mode = rk8xx_regulator_of_map_mode, + .owner =THIS_MODULE , + }, { + .name ="DCDC_REG4" , + .supply_name ="vcc4" , + .of_match =of_match_ptr ("DCDC_REG4" ), + .regulators_node =of_match_ptr ("regulators" ), + .id =RK816_ID_DCDC4 , + .ops = &rk816_buck4_ops_ranges, + .type =REGULATOR_VOLTAGE , + .n_voltages =32 , + .linear_ranges = rk816_buck_4_voltage_ranges, + .n_linear_ranges =ARRAY_SIZE (rk816_buck_4_voltage_ranges), + .vsel_reg =RK818_BUCK4_ON_VSEL_REG , + .vsel_mask =RK818_BUCK4_VSEL_MASK , + .enable_reg =RK816_DCDC_EN_REG1 , + .enable_mask =BIT (7 ) |BIT (3 ), + .enable_val =BIT (7 ) |BIT (3 ), + .disable_val =BIT (7 ), + .of_map_mode = rk8xx_regulator_of_map_mode, + .owner =THIS_MODULE , + }, +RK816_DESC (RK816_ID_LDO1 ,"LDO_REG1" ,"vcc5" ,800 ,3400 ,100 , +RK818_LDO1_ON_VSEL_REG ,RK818_LDO_VSEL_MASK , +RK816_LDO_EN_REG1 ,ENABLE_MASK (0 ),DISABLE_VAL (0 ),400 ), +RK816_DESC (RK816_ID_LDO2 ,"LDO_REG2" ,"vcc5" ,800 ,3400 ,100 , +RK818_LDO2_ON_VSEL_REG ,RK818_LDO_VSEL_MASK , +RK816_LDO_EN_REG1 ,ENABLE_MASK (1 ),DISABLE_VAL (1 ),400 ), +RK816_DESC (RK816_ID_LDO3 ,"LDO_REG3" ,"vcc5" ,800 ,3400 ,100 , +RK818_LDO3_ON_VSEL_REG ,RK818_LDO_VSEL_MASK , +RK816_LDO_EN_REG1 ,ENABLE_MASK (2 ),DISABLE_VAL (2 ),400 ), +RK816_DESC (RK816_ID_LDO4 ,"LDO_REG4" ,"vcc6" ,800 ,3400 ,100 , +RK818_LDO4_ON_VSEL_REG ,RK818_LDO_VSEL_MASK , +RK816_LDO_EN_REG1 ,ENABLE_MASK (3 ),DISABLE_VAL (3 ),400 ), +RK816_DESC (RK816_ID_LDO5 ,"LDO_REG5" ,"vcc6" ,800 ,3400 ,100 , +RK818_LDO5_ON_VSEL_REG ,RK818_LDO_VSEL_MASK , +RK816_LDO_EN_REG2 ,ENABLE_MASK (0 ),DISABLE_VAL (0 ),400 ), +RK816_DESC (RK816_ID_LDO6 ,"LDO_REG6" ,"vcc6" ,800 ,3400 ,100 , +RK818_LDO6_ON_VSEL_REG ,RK818_LDO_VSEL_MASK , +RK816_LDO_EN_REG2 ,ENABLE_MASK (1 ),DISABLE_VAL (1 ),400 ), +}; +static const struct regulator_desc rk817_reg[] = { { .name ="DCDC_REG1" ,
@@ -1714,6 +1910,10 @@ static int rk808_regulator_probe(struct platform_device *pdev) regulators = rk809_reg; nregulators =RK809_NUM_REGULATORS ;break ; +case RK816_ID : + regulators = rk816_reg; + nregulators =ARRAY_SIZE (rk816_reg); +break ;case RK817_ID : regulators = rk817_reg; nregulators =RK817_NUM_REGULATORS ;
Signature · 1 line
2.43.2
Hello Alex,
Quoted 15 lines · Alex Bee
This series aims to add support for Rockchip RK816 PMIC series. As per datasheet it's targeted for RK3126/RK3128 (RK816-1), RK1108 (RK816-2) and PX3-SE (RK816-3) but might be used for other SoCs as well. The mfd consists of an integrated RTC, a GPIO controller, two 32k clock outputs, a power key (output), 4 buck- and 5 ldo regulators, 3 regulator-switches, and charger with integrated fuel gauge. Charger and fuel gauge are not part of this series. Two of the switches (otg/boost) are part of the binding, but not of the driver. They must only ever by enabled if no battery charging is happening, but it will be enabled automatically if a battery is attached. Thus they need some incorporation of a yet to be added charger driver. Integration in the existing rk8xx-infrastructure was pretty straightforward and only needed very little tweaking. In order to not further bloat the driver(s) too much with additional definitions I tried to re-use existing ones wherever possible.
Quoted 4 lines
The patches are loosely based on the vendor's implementation, verified against the datasheet and tested/measured on RK3126 board. As they are touching several subsystems I'm sending them (very) early for the 6.10-cycle.
I went quickly through all patches in the series except the one that adds the bindings, and I've spotted no glaring issues. My main focus was on ensuring there should be no regressions.
Thus, not worth a Reviewed-by tag, but still counting as a review.
Quoted 18 lines
Alex Bee (5):
dt-bindings: mfd: Add rk816 binding
mfd: rk8xx: Add RK816 support
pinctrl: rk805: Add rk816 pinctrl support
regulator: rk808: Supportapply_bitfor
rk808_set_suspend_voltage_range
regulator: rk808: Add RK816 support.../bindings/mfd/rockchip,rk816.yaml | 259 ++++++++++++++++++ drivers/mfd/Kconfig | 4 +- drivers/mfd/rk8xx-core.c | 103 +++++++ drivers/mfd/rk8xx-i2c.c | 45 ++- drivers/pinctrl/pinctrl-rk805.c | 68 +++++ drivers/regulator/rk808-regulator.c | 218 ++++++++++++++- include/linux/mfd/rk808.h | 141 ++++++++++ 7 files changed, 831 insertions(+), 7 deletions(-) create mode 100644
Documentation/devicetree/bindings/mfd/rockchip,rk816.yaml