add pmic pca9451a support
v3 cover add pmic pca9451a support
The patchset supports pmic pca9451a.
For the details, please check the patch commit log.
---
Changes in v3:
- modify the dts voltags constraints.
- remove unnecessary changes in driver code.
- modify commit message.
- add tag for dt-bindings.
Changes in v2:
- drop old part support.
Joy Zou (3):
regulator: dt-bindings: pca9450: add pca9451a support
regulator: pca9450: add pca9451a support
arm64: dts: imx93-11x11-evk: add pca9451a support
.../regulator/nxp,pca9450-regulator.yaml | 1 + .../boot/dts/freescale/imx93-11x11-evk.dts | 112 ++++++++++ drivers/regulator/pca9450-regulator.c | 194 +++++++++++++++++- include/linux/regulator/pca9450.h | 1 + 4 files changed, 306 insertions(+), 2 deletions(-)
Signature · 1 line
2.37.1
PATCH v3 1/3 regulator: dt-bindings: pca9450: add pca9451a support
Update pca9450 bindings.
---
changes in v3:
1. add Acked-by tag.
changes in v2:
1. adjust the subject prefix sequence.
--- .../devicetree/bindings/regulator/nxp,pca9450-regulator.yaml | 1 + 1 file changed, 1 insertion(+)
Documentation/devicetree/bindings/regulator/nxp,pca9450-regulator.yaml +1 -0
@@ -28,6 +28,7 @@ properties: - nxp,pca9450a - nxp,pca9450b - nxp,pca9450c + - nxp,pca9451a reg: maxItems: 1
Signature · 1 line
2.37.1
PATCH v3 2/3 regulator: pca9450: add pca9451a support
In reply to Joy ZouAdding support for new pmic pca9451a.
---
Changes in v3:
1. remove not related change.
2. delete unnecessary empty line.
3. modify commit message.
Changes in v2:
1. remove the old part support because the old part only is used for sample and is diffcult to distinguish old and new part. so drop old part.
2. remove the unnecessary marco definition in the file pca9450.h.
--- drivers/regulator/pca9450-regulator.c | 194 +++++++++++++++++++++++++- include/linux/regulator/pca9450.h | 1 + 2 files changed, 193 insertions(+), 2 deletions(-)
drivers/regulator/pca9450-regulator.c +192 -2
@@ -106,6 +106,14 @@ static const struct linear_range pca9450_dvs_buck_volts[] = { REGULATOR_LINEAR_RANGE(600000, 0x00, 0x7F, 12500), }; +/* +* BUCK1/3 +* 0.65 to 2.2375V (12.5mV step) +*/ +static const struct linear_range pca9451a_dvs_buck_volts[] = { +REGULATOR_LINEAR_RANGE (650000 ,0x00 ,0x7F ,12500 ), +}; +/* * BUCK4/5/6 * 0.6V to 3.4V (25mV step)
@@ -662,6 +670,178 @@ static const struct pca9450_regulator_desc pca9450bc_regulators[] = { }, }; +static const struct pca9450_regulator_desc pca9451a_regulators[] = { + { + .desc = { + .name ="buck1" , + .of_match =of_match_ptr ("BUCK1" ), + .regulators_node =of_match_ptr ("regulators" ), + .id =PCA9450_BUCK1 , + .ops = &pca9450_dvs_buck_regulator_ops, + .type =REGULATOR_VOLTAGE , + .n_voltages =PCA9450_BUCK1_VOLTAGE_NUM , + .linear_ranges = pca9451a_dvs_buck_volts, + .n_linear_ranges =ARRAY_SIZE (pca9451a_dvs_buck_volts), + .vsel_reg =PCA9450_REG_BUCK1OUT_DVS0 , + .vsel_mask =BUCK1OUT_DVS0_MASK , + .enable_reg =PCA9450_REG_BUCK1CTRL , + .enable_mask =BUCK1_ENMODE_MASK , + .enable_val =BUCK_ENMODE_ONREQ , + .ramp_mask =BUCK1_RAMP_MASK , + .ramp_delay_table = pca9450_dvs_buck_ramp_table, + .n_ramp_values =ARRAY_SIZE (pca9450_dvs_buck_ramp_table), + .owner =THIS_MODULE , + .of_parse_cb = pca9450_set_dvs_levels, + }, + .dvs = { + .run_reg =PCA9450_REG_BUCK1OUT_DVS0 , + .run_mask =BUCK1OUT_DVS0_MASK , + .standby_reg =PCA9450_REG_BUCK1OUT_DVS1 , + .standby_mask =BUCK1OUT_DVS1_MASK , + }, + }, + { + .desc = { + .name ="buck2" , + .of_match =of_match_ptr ("BUCK2" ), + .regulators_node =of_match_ptr ("regulators" ), + .id =PCA9450_BUCK2 , + .ops = &pca9450_dvs_buck_regulator_ops, + .type =REGULATOR_VOLTAGE , + .n_voltages =PCA9450_BUCK2_VOLTAGE_NUM , + .linear_ranges = pca9450_dvs_buck_volts, + .n_linear_ranges =ARRAY_SIZE (pca9450_dvs_buck_volts), + .vsel_reg =PCA9450_REG_BUCK2OUT_DVS0 , + .vsel_mask =BUCK2OUT_DVS0_MASK , + .enable_reg =PCA9450_REG_BUCK2CTRL , + .enable_mask =BUCK2_ENMODE_MASK , + .enable_val =BUCK_ENMODE_ONREQ_STBYREQ , + .ramp_mask =BUCK2_RAMP_MASK , + .ramp_delay_table = pca9450_dvs_buck_ramp_table, + .n_ramp_values =ARRAY_SIZE (pca9450_dvs_buck_ramp_table), + .owner =THIS_MODULE , + .of_parse_cb = pca9450_set_dvs_levels, + }, + .dvs = { + .run_reg =PCA9450_REG_BUCK2OUT_DVS0 , + .run_mask =BUCK2OUT_DVS0_MASK , + .standby_reg =PCA9450_REG_BUCK2OUT_DVS1 , + .standby_mask =BUCK2OUT_DVS1_MASK , + }, + }, + { + .desc = { + .name ="buck4" , + .of_match =of_match_ptr ("BUCK4" ), + .regulators_node =of_match_ptr ("regulators" ), + .id =PCA9450_BUCK4 , + .ops = &pca9450_buck_regulator_ops, + .type =REGULATOR_VOLTAGE , + .n_voltages =PCA9450_BUCK4_VOLTAGE_NUM , + .linear_ranges = pca9450_buck_volts, + .n_linear_ranges =ARRAY_SIZE (pca9450_buck_volts), + .vsel_reg =PCA9450_REG_BUCK4OUT , + .vsel_mask =BUCK4OUT_MASK , + .enable_reg =PCA9450_REG_BUCK4CTRL , + .enable_mask =BUCK4_ENMODE_MASK , + .enable_val =BUCK_ENMODE_ONREQ , + .owner =THIS_MODULE , + }, + }, + { + .desc = { + .name ="buck5" , + .of_match =of_match_ptr ("BUCK5" ), + .regulators_node =of_match_ptr ("regulators" ), + .id =PCA9450_BUCK5 , + .ops = &pca9450_buck_regulator_ops, + .type =REGULATOR_VOLTAGE , + .n_voltages =PCA9450_BUCK5_VOLTAGE_NUM , + .linear_ranges = pca9450_buck_volts, + .n_linear_ranges =ARRAY_SIZE (pca9450_buck_volts), + .vsel_reg =PCA9450_REG_BUCK5OUT , + .vsel_mask =BUCK5OUT_MASK , + .enable_reg =PCA9450_REG_BUCK5CTRL , + .enable_mask =BUCK5_ENMODE_MASK , + .enable_val =BUCK_ENMODE_ONREQ , + .owner =THIS_MODULE , + }, + }, + { + .desc = { + .name ="buck6" , + .of_match =of_match_ptr ("BUCK6" ), + .regulators_node =of_match_ptr ("regulators" ), + .id =PCA9450_BUCK6 , + .ops = &pca9450_buck_regulator_ops, + .type =REGULATOR_VOLTAGE , + .n_voltages =PCA9450_BUCK6_VOLTAGE_NUM , + .linear_ranges = pca9450_buck_volts, + .n_linear_ranges =ARRAY_SIZE (pca9450_buck_volts), + .vsel_reg =PCA9450_REG_BUCK6OUT , + .vsel_mask =BUCK6OUT_MASK , + .enable_reg =PCA9450_REG_BUCK6CTRL , + .enable_mask =BUCK6_ENMODE_MASK , + .enable_val =BUCK_ENMODE_ONREQ , + .owner =THIS_MODULE , + }, + }, + { + .desc = { + .name ="ldo1" , + .of_match =of_match_ptr ("LDO1" ), + .regulators_node =of_match_ptr ("regulators" ), + .id =PCA9450_LDO1 , + .ops = &pca9450_ldo_regulator_ops, + .type =REGULATOR_VOLTAGE , + .n_voltages =PCA9450_LDO1_VOLTAGE_NUM , + .linear_ranges = pca9450_ldo1_volts, + .n_linear_ranges =ARRAY_SIZE (pca9450_ldo1_volts), + .vsel_reg =PCA9450_REG_LDO1CTRL , + .vsel_mask =LDO1OUT_MASK , + .enable_reg =PCA9450_REG_LDO1CTRL , + .enable_mask =LDO1_EN_MASK , + .owner =THIS_MODULE , + }, + }, + { + .desc = { + .name ="ldo4" , + .of_match =of_match_ptr ("LDO4" ), + .regulators_node =of_match_ptr ("regulators" ), + .id =PCA9450_LDO4 , + .ops = &pca9450_ldo_regulator_ops, + .type =REGULATOR_VOLTAGE , + .n_voltages =PCA9450_LDO4_VOLTAGE_NUM , + .linear_ranges = pca9450_ldo34_volts, + .n_linear_ranges =ARRAY_SIZE (pca9450_ldo34_volts), + .vsel_reg =PCA9450_REG_LDO4CTRL , + .vsel_mask =LDO4OUT_MASK , + .enable_reg =PCA9450_REG_LDO4CTRL , + .enable_mask =LDO4_EN_MASK , + .owner =THIS_MODULE , + }, + }, + { + .desc = { + .name ="ldo5" , + .of_match =of_match_ptr ("LDO5" ), + .regulators_node =of_match_ptr ("regulators" ), + .id =PCA9450_LDO5 , + .ops = &pca9450_ldo_regulator_ops, + .type =REGULATOR_VOLTAGE , + .n_voltages =PCA9450_LDO5_VOLTAGE_NUM , + .linear_ranges = pca9450_ldo5_volts, + .n_linear_ranges =ARRAY_SIZE (pca9450_ldo5_volts), + .vsel_reg =PCA9450_REG_LDO5CTRL_H , + .vsel_mask =LDO5HOUT_MASK , + .enable_reg =PCA9450_REG_LDO5CTRL_H , + .enable_mask =LDO5H_EN_MASK , + .owner =THIS_MODULE , + }, + }, +}; +static irqreturn_t pca9450_irq_handler (int irq,void *data) {struct pca9450 *pca9450 = data;
@@ -729,6 +909,10 @@ static int pca9450_i2c_probe(struct i2c_client *i2c) regulator_desc = pca9450bc_regulators; pca9450->rcnt =ARRAY_SIZE (pca9450bc_regulators);break ; +case PCA9450_TYPE_PCA9451A : + regulator_desc = pca9451a_regulators; + pca9450->rcnt =ARRAY_SIZE (pca9451a_regulators); +break ;default :dev_err (&i2c->dev,"Unknown device type" );return -EINVAL ;
@@ -755,7 +939,8 @@ static int pca9450_i2c_probe(struct i2c_client *i2c)/* Check your board and dts for match the right pmic */ if (((device_id >>4 ) !=0x1 && type ==PCA9450_TYPE_PCA9450A ) || - ((device_id >>4 ) !=0x3 && type ==PCA9450_TYPE_PCA9450BC )) { + ((device_id >>4 ) !=0x3 && type ==PCA9450_TYPE_PCA9450BC ) || + ((device_id >>4 ) !=0x9 && type ==PCA9450_TYPE_PCA9451A )) {dev_err (&i2c->dev,"Device id(%x) mismatched\n" , device_id >>4 );return -EINVAL ;
@@ -846,7 +1031,8 @@ static int pca9450_i2c_probe(struct i2c_client *i2c) }dev_info (&i2c->dev,"%s probed.\n" , - type ==PCA9450_TYPE_PCA9450A ?"pca9450a" :"pca9450bc" ); + type ==PCA9450_TYPE_PCA9450A ?"pca9450a" : + (type ==PCA9450_TYPE_PCA9451A ?"pca9451a" :"pca9450bc" ));return 0 ; }
@@ -864,6 +1050,10 @@ static const struct of_device_id pca9450_of_match[] = { .compatible = "nxp,pca9450c", .data = (void *)PCA9450_TYPE_PCA9450BC, }, + { + .compatible = "nxp,pca9451a", + .data = (void *)PCA9450_TYPE_PCA9451A, + }, { } };MODULE_DEVICE_TABLE (of, pca9450_of_match);
include/linux/regulator/pca9450.h +1 -0
@@ -9,6 +9,7 @@enum pca9450_chip_type {PCA9450_TYPE_PCA9450A =0 ,PCA9450_TYPE_PCA9450BC , +PCA9450_TYPE_PCA9451A ,PCA9450_TYPE_AMOUNT , };
Signature · 1 line
2.37.1
PATCH v3 3/3 arm64: dts: imx93-11x11-evk: add pca9451a support
In reply to Joy ZouSupport pca9451a on imx93-11x11-evk.
---
Changes in v3:
1. modify the voltages constraints according to the imx93 datasheet.
--- .../boot/dts/freescale/imx93-11x11-evk.dts | 112 ++++++++++++++++++ 1 file changed, 112 insertions(+)
arch/arm64/boot/dts/freescale/imx93-11x11-evk.dts +112 -0
@@ -183,6 +183,105 @@ &wdog3 { status = "okay"; }; +&lpi2c2 { + #address-cells = <1>; + #size-cells = <0>; + clock-frequency = <400000>; + pinctrl-names = "default", "sleep"; + pinctrl-0 = <&pinctrl_lpi2c2>; + pinctrl-1 = <&pinctrl_lpi2c2>; + status = "okay"; + + pmic@25 { + compatible = "nxp,pca9451a"; + reg = <0x25>; + interrupt-parent = <&pcal6524>; + interrupts = <11 IRQ_TYPE_EDGE_FALLING>; + + regulators { + buck1: BUCK1 { + regulator-name = "BUCK1"; + regulator-min-microvolt = <610000>; + regulator-max-microvolt = <950000>; + regulator-boot-on; + regulator-always-on; + regulator-ramp-delay = <3125>; + }; + + buck2: BUCK2 { + regulator-name = "BUCK2"; + regulator-min-microvolt = <600000>; + regulator-max-microvolt = <670000>; + regulator-boot-on; + regulator-always-on; + regulator-ramp-delay = <3125>; + }; + + buck4: BUCK4{ + regulator-name = "BUCK4"; + regulator-min-microvolt = <1620000>; + regulator-max-microvolt = <3400000>; + regulator-boot-on; + regulator-always-on; + }; + + buck5: BUCK5{ + regulator-name = "BUCK5"; + regulator-min-microvolt = <1620000>; + regulator-max-microvolt = <3400000>; + regulator-boot-on; + regulator-always-on; + }; + + buck6: BUCK6 { + regulator-name = "BUCK6"; + regulator-min-microvolt = <1060000>; + regulator-max-microvolt = <1140000>; + regulator-boot-on; + regulator-always-on; + }; + + ldo1: LDO1 { + regulator-name = "LDO1"; + regulator-min-microvolt = <1620000>; + regulator-max-microvolt = <1980000>; + regulator-boot-on; + regulator-always-on; + }; + + ldo4: LDO4 { + regulator-name = "LDO4"; + regulator-min-microvolt = <800000>; + regulator-max-microvolt = <840000>; + regulator-boot-on; + regulator-always-on; + }; + + ldo5: LDO5 { + regulator-name = "LDO5"; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <3300000>; + regulator-boot-on; + regulator-always-on; + }; + }; + }; + + pcal6524: gpio@22 { + compatible = "nxp,pcal6524"; + pinctrl-names = "default"; + pinctrl-0 = <&pinctrl_pcal6524>; + reg = <0x22>; + gpio-controller; + #gpio-cells = <2>; + interrupt-controller; + #interrupt-cells = <2>; + interrupt-parent = <&gpio3>; + interrupts = <27 IRQ_TYPE_LEVEL_LOW>; + }; + +}; + &iomuxc { pinctrl_eqos: eqosgrp { fsl,pins = <
@@ -239,6 +338,19 @@ MX93_PAD_DAP_TCLK_SWCLK__LPUART5_CTS_B 0x31e }; /* need to config the SION for data and cmd pad, refer to ERR052021 */ + pinctrl_lpi2c2: lpi2c2grp { + fsl,pins = < + MX93_PAD_I2C2_SCL__LPI2C2_SCL 0x40000b9e + MX93_PAD_I2C2_SDA__LPI2C2_SDA 0x40000b9e + >; + }; + + pinctrl_pcal6524: pcal6524grp { + fsl,pins = < + MX93_PAD_CCM_CLKO2__GPIO3_IO27 0x31e + >; + }; + pinctrl_usdhc1: usdhc1grp { fsl,pins = < MX93_PAD_SD1_CLK__USDHC1_CLK 0x15fe
Signature · 1 line
2.37.1
Fabio Estevam
reviewerRe: [PATCH v3 3/3] arm64: dts: imx93-11x11-evk: add pca9451a support
Quoted 1 line · Joy Zou
/* need to config the SION for data and cmd pad, refer to ERR052021 */
Please remove this comment. The SION bit is set for I2C pins.
Also, this erratum affects uSDHC according to:
https://www.spinics.net/lists/devicetree/msg641846.html
RE: [EXT] Re: [PATCH v3 3/3] arm64: dts: imx93-11x11-evk: add pca9451a support
Quoted 19 lines
-----Original Message-----
From: Fabio Estevam <[email protected]>
Sent: 2024年3月11日 20:44
To: Joy Zou <[email protected]>
Cc: Jacky Bai <[email protected]>; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; dl-linux-imx <[email protected]>; [email protected]; [email protected]; [email protected]; [email protected]
Subject: [EXT] Re: [PATCH v3 3/3] arm64: dts: imx93-11x11-evk: add pca9451a supportCaution: This is an external email. Please take care when clicking links or opening attachments. When in doubt, report the message using the 'Report this email' button
Quoted 6 lines
Quoted 1 line · Joy Zou
/* need to config the SION for data and cmd pad, refer toERR052021 */
Please remove this comment. The SION bit is set for I2C pins.
Thanks Fabio!
Yes, This comment is for uSDHC but not i2c. I will adjust my patch format. BR
Joy Zou
Quoted 9 lines
Also, this erratum affects uSDHC according to:
https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.
spinics.net%2Flists%2Fdevicetree%2Fmsg641846.html&data=05%7C02%7Cj oy.zou%40nxp.com%7C9fda5f9d8bfa44139c6908dc41c8e3f7%7C686ea1d3b c2b4c6fa92cd99c5c301635%7C0%7C0%7C638457578274178736%7CUnkn own%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik 1haWwiLCJXVCI6Mn0%3D%7C0%7C%7C%7C&sdata=Y%2FWH6%2FJO0T7lA GlNgszJ3GRON1hYvZIx1CIij5%2BjKjE%3D&reserved=0
Mark Brown
maintainerRe: (subset) [PATCH v3 0/3] add pmic pca9451a support
In reply to Joy ZouQuoted 3 lines · Joy Zou
The patchset supports pmic pca9451a.
For the details, please check the patch commit log.
Applied to
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator.git for-next
Thanks!
[1/3] regulator: dt-bindings: pca9450: add pca9451a support
commit: 0f3b73eb1440d18d2236ac660d4aa76fd726bec7
[2/3] regulator: pca9450: add pca9451a support
commit: 5edeb7d312628961046eec9b26a7e72f44baf846All 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