Add Richtek RT5120 PMIC support
Subsystems (4)
v3 cover Add Richtek RT5120 PMIC support
From: ChiYuan Huang <[email protected]>
This patch series is to add Richtek RT5120 PMIC support.
In RT5120, it integrates four channels of buck converter, one channel of LDO, and one external enable channel to control the external power source.
rt5120-regulator can be referred in the below link
Since v3:
- Use a 'dev' variable and dev_err_probe to decrease the LOC in mfd.
- Simplify the power key irq handler key report
- Since press and release irq not needed to keep in private data, change 'press', 'release' irq as local variable only.
- Fix Kconfig typo for pwrkey.
Since v2:
- Add 'unevaluatedProperties: false' for regulator buck1~4/ldo/exten.
- Fix indention and remove status for powerkey.
- Refine powerkey description for more HW details.
- For the regulator property parsing, use of_property_read_u32 instead.
- Not to overwrite regulator constraint.
- Refine regulator desc coding.
ChiYuan Huang (3):
dt-binding: mfd: Add Richtek RT5120 PMIC support
mfd: rt5120: Add Richtek PMIC support
input: misc: rt5120: Add power key support
.../devicetree/bindings/mfd/richtek,rt5120.yaml | 178 +++++++++++++++++++++ drivers/input/misc/Kconfig | 9 ++ drivers/input/misc/Makefile | 1 + drivers/input/misc/rt5120-pwrkey.c | 105 ++++++++++++ drivers/mfd/Kconfig | 12 ++ drivers/mfd/Makefile | 1 + drivers/mfd/rt5120.c | 121 ++++++++++++++ 7 files changed, 427 insertions(+) create mode 100644 Documentation/devicetree/bindings/mfd/richtek,rt5120.yaml create mode 100644 drivers/input/misc/rt5120-pwrkey.c create mode 100644 drivers/mfd/rt5120.c
Signature · 1 line
2.7.4
PATCH v3 1/3 dt-binding: mfd: Add Richtek RT5120 PMIC support
From: ChiYuan Huang <[email protected]>
Add Richtek RT5120 PMIC devicetree document.
---
Since v2:
- Add 'unevaluatedProperties: false' for regulator buck1~4/ldo/exten.
- Fix indention and remove status for powerkey.
- Refine powerkey description for more HW details.
--- .../devicetree/bindings/mfd/richtek,rt5120.yaml | 178 +++++++++++++++++++++ 1 file changed, 178 insertions(+) create mode 100644 Documentation/devicetree/bindings/mfd/richtek,rt5120.yaml
Documentation/devicetree/bindings/mfd/richtek,rt5120.yaml new file +178 -0
@@ -0,0 +1,178 @@ +# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/mfd/richtek,rt5120.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Richtek RT5120 PMIC + +maintainers: + - ChiYuan Huang <[email protected]> + +description: | + The RT5120 provides four high-efficiency buck converters and one LDO voltage + regulator. The device is targeted at providingthe processor voltage, memory, + I/O, and peripheral rails in home entertainment devices. The I2C interface is + used for dynamic voltage scaling of the processor voltage, power rails on/off + sequence control, operation mode selection. + +properties: + compatible: + enum: + - richtek,rt5120 + + reg: + maxItems: 1 + + interrupts: + maxItems: 1 + + interrupt-controller: true + + "#interrupt-cells": + const: 1 + + wakeup-source: true + + richtek,enable-undervolt-hiccup: + type: boolean + description: | + If used, under voltage protection trigger hiccup behavior, else latchup as + default + + richtek,enable-overvolt-hiccup: + type: boolean + description: + Like as 'enable-uv-hiccup', it configures over voltage protection to + hiccup, else latchup as default + + vin1-supply: + description: phandle for buck1 input power source + + vin2-supply: + description: phandle for buck2 input power source + + vin3-supply: + description: phandle for buck3 input power source + + vin4-supply: + description: phandle for buck4 input power source + + vinldo-supply: + description: phandle for ldo input power source + + regulators: + type: object + + patternProperties: + "^buck[1-4]$": + type: object + $ref: /schemas/regulator/regulator.yaml# + unevaluatedProperties: false + + properties: + regulator-allowed-modes: + description: | + Used to specify the allowed buck converter operating mode + mode mapping: + 0: auto mode + 1: force pwm mode + items: + enum: [0, 1] + + "^(ldo|exten)$": + type: object + $ref: /schemas/regulator/regulator.yaml# + unevaluatedProperties: false + + additionalProperties: false + + powerkey: + type: object + description: + PON key that connected to RT5120 PMIC. + + properties: + compatible: + enum: + - richtek,rt5120-pwrkey + + required: + - compatible + + additionalProperties: false + +required: + - compatible + - reg + - interrupts + - '#interrupt-cells' + - interrupt-controller + - regulators + - powerkey + +additionalProperties: false + +examples: + - | + #include <dt-bindings/interrupt-controller/irq.h> + + i2c { + #address-cells = <1>; + #size-cells = <0>; + + pmic@62 { + compatible = "richtek,rt5120"; + reg = <0x62>; + interrupts-extended = <&gpio_intc 32 IRQ_TYPE_LEVEL_LOW>; + interrupt-controller; + #interrupt-cells = <1>; + wakeup-source; + + regulators { + buck1 { + regulator-name = "rt5120-buck1"; + regulator-min-microvolt = <600000>; + regulator-max-microvolt = <1393750>; + regulator-allowed-modes = <0 1>; + regulator-boot-on; + }; + buck2 { + regulator-name = "rt5120-buck2"; + regulator-min-microvolt = <1100000>; + regulator-max-microvolt = <1100000>; + regulator-allowed-modes = <0 1>; + regulator-always-on; + }; + buck3 { + regulator-name = "rt5120-buck3"; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <1800000>; + regulator-allowed-modes = <0 1>; + regulator-always-on; + }; + buck4 { + regulator-name = "rt5120-buck4"; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + regulator-allowed-modes = <0 1>; + regulator-always-on; + }; + ldo { + regulator-name = "rt5120-ldo"; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <1800000>; + regulator-always-on; + }; + exten { + regulator-name = "rt5120-exten"; + regulator-min-microvolt = <3000000>; + regulator-max-microvolt = <3000000>; + regulator-always-on; + }; + }; + powerkey { + compatible = "richtek,rt5120-pwrkey"; + }; + }; + };
Signature · 1 line
2.7.4
PATCH v3 2/3 mfd: rt5120: Add Richtek PMIC support
In reply to cy_huangFrom: ChiYuan Huang <[email protected]>
Add Richtek RT5120 PMIC I2C driver.
---
Since v3:
- Use a 'dev' variable and dev_err_probe to decrease the LOC in mfd.
--- drivers/mfd/Kconfig | 12 +++++ drivers/mfd/Makefile | 1 + drivers/mfd/rt5120.c | 121 +++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 134 insertions(+) create mode 100644 drivers/mfd/rt5120.c
drivers/mfd/Kconfig +12 -0
@@ -1127,6 +1127,18 @@ config MFD_RT5033 sub-devices like charger, fuel gauge, flash LED, current source, LDO and Buck. +config MFD_RT5120 + tristate "Richtek RT5120 Power Management IC" + depends on I2C + select MFD_CORE + select REGMAP_I2C + select REGMAP_IRQ + help + The enables support for Richtek RT5120 PMIC. It includes four high + efficiency buck converters and one LDO voltage regulator. The device + is targeted at providing the CPU voltage, memory, I/O and peripheral + power rails in home entertainment devices. + config MFD_RC5T583 bool "Ricoh RC5T583 Power Management system device" depends on I2C=y
drivers/mfd/Makefile +1 -0
@@ -234,6 +234,7 @@ obj-$(CONFIG_MFD_HI655X_PMIC) += hi655x-pmic.o obj-$(CONFIG_MFD_DLN2) += dln2.o obj-$(CONFIG_MFD_RT4831) += rt4831.o obj-$(CONFIG_MFD_RT5033) += rt5033.o +obj-$(CONFIG_MFD_RT5120) += rt5120.o obj-$(CONFIG_MFD_SKY81452) += sky81452.o intel-soc-pmic-objs := intel_soc_pmic_core.o intel_soc_pmic_crc.o
drivers/mfd/rt5120.c new file +121 -0
121 lines not on this page · raw message
Signature · 1 line
2.7.4
Re: [PATCH v3 2/3] mfd: rt5120: Add Richtek PMIC support
Quoted 9 lines · cy_huang
From: ChiYuan Huang <[email protected]>
Add Richtek RT5120 PMIC I2C driver.
Signed-off-by ChiYuan Huang <[email protected]>---
Since v3:
- Use a 'dev' variable anddev_err_probeto decrease the LOC in mfd.
Quoted 6 lines
--- drivers/mfd/Kconfig | 12 +++++ drivers/mfd/Makefile | 1 + drivers/mfd/rt5120.c | 121 +++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 134 insertions(+) create mode 100644 drivers/mfd/rt5120.c
Mostly good, couple of nits.
Quoted 41 lines
drivers/mfd/Kconfig +12
-0@@ -1127,6 +1127,18 @@ config MFD_RT5033 sub-devices like charger, fuel gauge, flash LED, current source, LDO and Buck. +config MFD_RT5120 + tristate "Richtek RT5120 Power Management IC" + depends on I2C + select MFD_CORE + select REGMAP_I2C + select REGMAP_IRQ + help + The enables support for Richtek RT5120 PMIC. It includes four high + efficiency buck converters and one LDO voltage regulator. The device + is targeted at providing the CPU voltage, memory, I/O and peripheral + power rails in home entertainment devices. + config MFD_RC5T583 bool "Ricoh RC5T583 Power Management system device" depends on I2C=ydrivers/mfd/Makefile +1
-0@@ -234,6 +234,7 @@ obj-$(CONFIG_MFD_HI655X_PMIC) += hi655x-pmic.o obj-$(CONFIG_MFD_DLN2) += dln2.o obj-$(CONFIG_MFD_RT4831) += rt4831.o obj-$(CONFIG_MFD_RT5033) += rt5033.o +obj-$(CONFIG_MFD_RT5120) += rt5120.o obj-$(CONFIG_MFD_SKY81452) += sky81452.o intel-soc-pmic-objs := intel_soc_pmic_core.o intel_soc_pmic_crc.odrivers/mfd/rt5120.c new file +0
-0
drivers/mfd/rt5120.c line 1
Quoted 1 line
drivers/mfd/rt5120.c new file +1
-0@@ -0,0 +1,121 @@ +// SPDX-License-Identifier: GPL-2.0+
No Copyright?
Quoted 67 lines
drivers/mfd/rt5120.c new file +67
-0+#include <linux/i2c.h> +#include <linux/kernel.h> +#include <linux/mfd/core.h> +#include <linux/module.h> +#include <linux/mod_devicetable.h> +#include <linux/regmap.h> + +#define RT5120_REG_INTENABLE 0x1D +#define RT5120_REG_INTSTAT 0x1E +#define RT5120_REG_FZCMODE 0x44 + +#define RT5120_INT_HOTDIE 0 +#define RT5120_INT_PWRKEY_REL 5 +#define RT5120_INT_PWRKEY_PRESS 6 + +static const struct regmap_range rt5120_rd_yes_ranges[] = { +regmap_reg_range (0x03 ,0x13 ), +regmap_reg_range (0x1c ,0x20 ), +regmap_reg_range (0x44 ,0x44 ) +}; + +static const struct regmap_range rt5120_wr_yes_ranges[] = { +regmap_reg_range (0x06 ,0x13 ), +regmap_reg_range (0x1c ,0x20 ), +regmap_reg_range (0x44 ,0x44 ) +}; + +static const struct regmap_access_table rt5120_rd_table = { + .yes_ranges = rt5120_rd_yes_ranges, + .n_yes_ranges =ARRAY_SIZE (rt5120_rd_yes_ranges), +}; + +static const struct regmap_access_table rt5120_wr_table = { + .yes_ranges = rt5120_wr_yes_ranges, + .n_yes_ranges =ARRAY_SIZE (rt5120_wr_yes_ranges), +}; + +static const struct regmap_config rt5120_regmap_config = { + .reg_bits =8 , + .val_bits =8 , + .max_register =RT5120_REG_FZCMODE , + + .wr_table = &rt5120_wr_table, + .rd_table = &rt5120_rd_table, +}; + +static const struct regmap_irq rt5120_irqs[] = { +REGMAP_IRQ_REG_LINE (RT5120_INT_HOTDIE ,8 ), +REGMAP_IRQ_REG_LINE (RT5120_INT_PWRKEY_REL ,8 ), +REGMAP_IRQ_REG_LINE (RT5120_INT_PWRKEY_PRESS ,8 ) +}; + +static const struct regmap_irq_chip rt5120_irq_chip = { + .name ="rt5120-pmic" , + .status_base =RT5120_REG_INTSTAT , + .mask_base =RT5120_REG_INTENABLE , + .ack_base =RT5120_REG_INTSTAT , + .mask_invert = true, + .use_ack = true, + .num_regs =1 , + .irqs = rt5120_irqs, + .num_irqs =ARRAY_SIZE (rt5120_irqs), +}; + +static const struct resource rt5120_regulator_resources[] = { +DEFINE_RES_IRQ (RT5120_INT_HOTDIE ) +};
drivers/mfd/rt5120.c line 79
Quoted 10 lines
drivers/mfd/rt5120.c new file +10
-0+ +static const struct resource rt5120_pwrkey_resources[] = { +DEFINE_RES_IRQ_NAMED (RT5120_INT_PWRKEY_PRESS ,"pwrkey-press" ), +DEFINE_RES_IRQ_NAMED (RT5120_INT_PWRKEY_REL ,"pwrkey-release" ) +}; + +static const struct mfd_cell rt5120_devs[] = { +MFD_CELL_RES ("rt5120-regulator" , rt5120_regulator_resources), +MFD_CELL_OF ("rt5120-pwrkey" , rt5120_pwrkey_resources,NULL ,0 ,0 , +"richtek,rt5120-pwrkey" )
This can be on one line if you want.
Quoted 8 lines
drivers/mfd/rt5120.c new file +8
-0+}; + +static int rt5120_probe (struct i2c_client *i2c) +{ +struct device *dev = &i2c->dev; +struct regmap *regmap; +struct regmap_irq_chip_data *irq_data; +int ret;
drivers/mfd/rt5120.c line 97
Quoted 10 lines
drivers/mfd/rt5120.c new file +10
-0+ + regmap =devm_regmap_init_i2c (i2c, &rt5120_regmap_config); +if (IS_ERR (regmap)) +return dev_err_probe (dev,PTR_ERR (regmap), +"Failed to init regmap\n" ); + + ret =devm_regmap_add_irq_chip (dev, regmap, i2c->irq,IRQF_ONESHOT ,0 , + &rt5120_irq_chip, &irq_data); +if (ret) +return dev_err_probe (dev, ret,"Failed to add irq chip\n" );
"IRQ"
Quoted 23 lines
drivers/mfd/rt5120.c new file +23
-0+return devm_mfd_add_devices (dev,PLATFORM_DEVID_AUTO , rt5120_devs, +ARRAY_SIZE (rt5120_devs),NULL ,0 , +regmap_irq_get_domain (irq_data)); +} + +static const struct of_device_id rt5120_device_match_table[] = { + { .compatible ="richtek,rt5120" }, + {} +}; +MODULE_DEVICE_TABLE (of, rt5120_device_match_table); + +static struct i2c_driver rt5120_driver = { + .driver = { + .name ="rt5120" , + .of_match_table = rt5120_device_match_table, + }, + .probe_new = rt5120_probe, +}; +module_i2c_driver (rt5120_driver); + +MODULE_AUTHOR ("ChiYuan Huang <[email protected]>" ); +MODULE_DESCRIPTION ("Richtek RT5120 I2C driver" ); +MODULE_LICENSE ("GPL v2" );
Signature · 1 line
DEPRECATED: Please use [email protected]
PATCH v3 3/3 input: misc: rt5120: Add power key support
In reply to cy_huangFrom: ChiYuan Huang <[email protected]>
Add RT5120 PMIC power key support.
---
Since v3:
- Simplify the power key irq handler key report
- Since press and release irq not needed to keep in private data, change 'press', 'release' irq as local variable only.
- Fix Kconfig typo for pwrkey.
--- drivers/input/misc/Kconfig | 9 ++++ drivers/input/misc/Makefile | 1 + drivers/input/misc/rt5120-pwrkey.c | 105 +++++++++++++++++++++++++++++++++++++ 3 files changed, 115 insertions(+) create mode 100644 drivers/input/misc/rt5120-pwrkey.c
drivers/input/misc/Kconfig +9 -0
@@ -891,6 +891,15 @@ config INPUT_SC27XX_VIBRA To compile this driver as a module, choose M here. The module will be called sc27xx_vibra. +config INPUT_RT5120_PWRKEY + tristate "RT5120 PMIC power key support" + depends on MFD_RT5120 + help + This enables support for RT5120 PMIC power key driver. + + To compile this driver as a module, choose M here. the module will + be called rt5120-pwrkey. + config INPUT_STPMIC1_ONKEY tristate "STPMIC1 PMIC Onkey support" depends on MFD_STPMIC1
drivers/input/misc/Makefile +1 -0
@@ -69,6 +69,7 @@ obj-$(CONFIG_INPUT_RAVE_SP_PWRBUTTON) += rave-sp-pwrbutton.o obj-$(CONFIG_INPUT_RB532_BUTTON) += rb532_button.o obj-$(CONFIG_INPUT_REGULATOR_HAPTIC) += regulator-haptic.o obj-$(CONFIG_INPUT_RETU_PWRBUTTON) += retu-pwrbutton.o +obj-$(CONFIG_INPUT_RT5120_PWRKEY) += rt5120-pwrkey.o obj-$(CONFIG_INPUT_AXP20X_PEK) += axp20x-pek.o obj-$(CONFIG_INPUT_GPIO_ROTARY_ENCODER) += rotary_encoder.o obj-$(CONFIG_INPUT_RK805_PWRKEY) += rk805-pwrkey.o
drivers/input/misc/rt5120-pwrkey.c new file +105 -0
105 lines not on this page · raw message
Signature · 1 line
2.7.4
cy_huang <[email protected]> 於 2022年7月14日 週四 下午2:42寫道:
Quoted 6 lines
From: ChiYuan Huang <[email protected]>
This patch series is to add Richtek RT5120 PMIC support.
In RT5120, it integrates four channels of buck converter, one channel of LDO, and one external enable channel to control the external power source.
ping ......
Quoted 39 lines
rt5120-regulator can be referred in the below link
Since v3:
- Use a 'dev' variable anddev_err_probeto decrease the LOC in mfd.
- Simplify the power key irq handler key report
- Since press and release irq not needed to keep in private data, change 'press', 'release' irq as local variable only.
- FixKconfigtypo for pwrkey.Since v2:
- Add 'unevaluatedProperties: false' for regulator buck1~4/ldo/exten.
- Fix indention and remove status for powerkey.
- Refine powerkey description for more HW details.
- For the regulator property parsing, useof_property_read_u32instead.
- Not to overwrite regulator constraint.
- Refine regulator desc coding.ChiYuan Huang (3):
dt-binding: mfd: Add Richtek RT5120 PMIC support
mfd: rt5120: Add Richtek PMIC support
input: misc: rt5120: Add power key support.../devicetree/bindings/mfd/richtek,rt5120.yaml | 178 +++++++++++++++++++++ drivers/input/misc/Kconfig | 9 ++ drivers/input/misc/Makefile | 1 + drivers/input/misc/rt5120-pwrkey.c | 105 ++++++++++++ drivers/mfd/Kconfig | 12 ++ drivers/mfd/Makefile | 1 + drivers/mfd/rt5120.c | 121 ++++++++++++++ 7 files changed, 427 insertions(+) create mode 100644 Documentation/devicetree/bindings/mfd/richtek,rt5120.yaml create mode 100644 drivers/input/misc/rt5120-pwrkey.c create mode 100644 drivers/mfd/rt5120.c--
2.7.4
Quoted 8 lines · ChiYuan Huang
cy_huang<[email protected]> 於 2022年7月14日 週四 下午2:42寫道:Quoted 6 lines
From: ChiYuan Huang <[email protected]>
This patch series is to add Richtek RT5120 PMIC support.
In RT5120, it integrates four channels of buck converter, one channel of LDO, and one external enable channel to control the external power source.ping ......
Whom are you pinging? Everyone in To list?
Best regards,
Krzysztof
Krzysztof Kozlowski <[email protected]> 於 2022年7月26日 週二 下午5:59寫道:
Quoted 13 lines · ChiYuan Huang
Quoted 8 lines
cy_huang<[email protected]> 於 2022年7月14日 週四 下午2:42寫道:Quoted 6 lines
From: ChiYuan Huang <[email protected]>
This patch series is to add Richtek RT5120 PMIC support.
In RT5120, it integrates four channels of buck converter, one channel of LDO, and one external enable channel to control the external power source.ping ......
Whom are you pinging? Everyone in To list?
Sorry, forget to specify the part.
I'm pining the 'mfd' patch and 'power key' patch.
Quoted 2 lines
Best regards,
Krzysztof
Quoted 10 lines · ChiYuan Huang
Krzysztof Kozlowski <[email protected]> 於 2022年7月26日 週二 下午5:59寫道:
Quoted 9 lines · ChiYuan Huang
Quoted 7 lines
cy_huang<[email protected]> 於 2022年7月14日 週四 下午2:42寫道:Quoted 6 lines
From: ChiYuan Huang <[email protected]>
This patch series is to add Richtek RT5120 PMIC support.
In RT5120, it integrates four channels of buck converter, one channel of LDO, and one external enable channel to control the external power source.
Quoted 6 lines
Quoted 4 lines
Quoted 1 line
ping ......
Whom are you pinging? Everyone in To list?
Sorry, forget to specify the part.
I'm pining the 'mfd' patch and 'power key' patch.
Don't ping any{thing,one}! If you think your patch has fallen through the gaps (it hasn't), then submit a [RESEND].
Your patch was submitted at the very end of the development cycle, which means that it is low priority and is unlikely to receive attention until after -rc1 is out.
Signature · 4 lines
Lee Jones [李琼斯] Principal Technical Lead - Developer Services Linaro.org │ Open source software for Arm SoCs Follow Linaro: Facebook | Twitter | Blog
Lee Jones <[email protected]> 於 2022年8月1日 週一 晚上10:42寫道:
Quoted 20 lines · ChiYuan Huang
Quoted 11 lines
Krzysztof Kozlowski <[email protected]> 於 2022年7月26日 週二 下午5:59寫道:
Quoted 9 lines · ChiYuan Huang
Quoted 7 lines
cy_huang<[email protected]> 於 2022年7月14日 週四 下午2:42寫道:Quoted 6 lines
From: ChiYuan Huang <[email protected]>
This patch series is to add Richtek RT5120 PMIC support.
In RT5120, it integrates four channels of buck converter, one channel of LDO, and one external enable channel to control the external power source.Quoted 6 lines
Quoted 4 lines
Quoted 1 line
ping ......
Whom are you pinging? Everyone in To list?
Sorry, forget to specify the part.
I'm pining the 'mfd' patch and 'power key' patch.
Quoted 7 lines
Don't ping any{thing,one}! If you think your patch has fallen through the gaps (it hasn't), then submit a [RESEND].
Your patch was submitted at the very end of the development cycle, which means that it is low priority and is unlikely to receive attention until after -rc1 is out.
Got it.
Because I'm not very clear about the linux development cycle. Now I know. I'll just keep waiting for the reviewing.
Very apologized to ping it.
Quoted 5 lines
--
Lee Jones [李琼斯]
Principal Technical Lead - Developer ServicesLinaro.org │ Open source software for Arm SoCs Follow Linaro: Facebook | Twitter | Blog