Re: [RESEND PATCH v5 1/5] mfd: RK808: Add RK818 support
[...] > Lee, you have already applied this series. But I can't find the patches > in your kernel tree. > I would like to read the device ID from the register in the probe function. > Do you want me to base my changes on top of this series or send a new > version? Please rebase and resend the series. -- Lee Jones Linaro STMicroelectronics Landing Team Lead Linaro.org │ Open source software for ARM SoCs Follow Linaro: Facebook | Twitter | Blog
Re: [RESEND PATCH v5 1/5] mfd: RK808: Add RK818 support
[...] > Lee, you have already applied this series. But I can't find the patches > in your kernel tree. > I would like to read the device ID from the register in the probe function. > Do you want me to base my changes on top of this series or send a new > version? Please rebase and resend the series. -- Lee Jones Linaro STMicroelectronics Landing Team Lead Linaro.org │ Open source software for ARM SoCs Follow Linaro: Facebook | Twitter | Blog
Re: [RESEND PATCH v5 1/5] mfd: RK808: Add RK818 support
Hi Wadim: On 2016年07月06日 16:03, Wadim Egorov wrote: Hi Andy, On 06.07.2016 05:15, Andy Yan wrote: Hi Wadim: On 2016年06月09日 16:23, Wadim Egorov wrote: Hi, On 08.06.2016 16:17, Lee Jones wrote: On Thu, 02 Jun 2016, Wadim Egorov wrote: The RK818 chip is a power management IC for multimedia and handheld "Power Management IC (PMIC)" devices. It contains the following components: - Regulators - RTC - Clkout Clocking - battery support Battery support Both chips RK808 and RK818 are using a similar register map. "Both RK808 ad RK818 chips" So we can reuse the RTC and Clkout functionality. Swap '.' for ','. Signed-off-by: Wadim Egorov--- drivers/mfd/Kconfig | 4 +- drivers/mfd/rk808.c | 231 ++ include/linux/mfd/rk808.h | 162 ++-- 3 files changed, 350 insertions(+), 47 deletions(-) diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig index 1bcf601..7ba464b 100644 --- a/drivers/mfd/Kconfig +++ b/drivers/mfd/Kconfig @@ -839,13 +839,13 @@ config MFD_RC5T583 different functionality of the device. config MFD_RK808 -tristate "Rockchip RK808 Power Management chip" +tristate "Rockchip RK808/RK818 Power Management chip" "Chip" depends on I2C && OF select MFD_CORE select REGMAP_I2C select REGMAP_IRQ help - If you say yes here you get support for the RK808 + If you say yes here you get support for the RK808 and RK818 Power Management chips. This driver provides common support for accessing the device through I2C interface. The device supports multiple sub-devices diff --git a/drivers/mfd/rk808.c b/drivers/mfd/rk808.c index 49d7f62..3cf9724 100644 --- a/drivers/mfd/rk808.c +++ b/drivers/mfd/rk808.c @@ -1,11 +1,15 @@ /* - * MFD core driver for Rockchip RK808 + * MFD core driver for Rockchip RK808/RK818 * * Copyright (c) 2014, Fuzhou Rockchip Electronics Co., Ltd * * Author: Chris Zhong * Author: Zhang Qing * + * Copyright (C) 2016 PHYTEC Messtechnik GmbH + * + * Author: Wadim Egorov + * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, * version 2, as published by the Free Software Foundation. @@ -22,12 +26,7 @@ #include #include #include - -struct rk808_reg_data { -int addr; -int mask; -int value; -}; Why are you moving this to the header? It is now part of the rk808 struct. +#include static bool rk808_is_volatile_reg(struct device *dev, unsigned int reg) { @@ -57,6 +56,14 @@ static bool rk808_is_volatile_reg(struct device *dev, unsigned int reg) return false; } +static const struct regmap_config rk818_regmap_config = { +.reg_bits = 8, +.val_bits = 8, +.max_register = RK818_USB_CTRL_REG, +.cache_type = REGCACHE_RBTREE, +.volatile_reg = rk808_is_volatile_reg, +}; + static const struct regmap_config rk808_regmap_config = { .reg_bits = 8, .val_bits = 8, @@ -83,7 +90,17 @@ static const struct mfd_cell rk808s[] = { }, }; -static const struct rk808_reg_data pre_init_reg[] = { +static const struct mfd_cell rk818s[] = { +{ .name = "rk808-clkout", }, How does this differ to a normal -clock driver? I don't know. It is a normal clock driver. +{ .name = "rk808-regulator", }, +{ +.name = "rk808-rtc", +.num_resources = ARRAY_SIZE(rtc_resources), +.resources = _resources[0], .resources = rtc_resources, ? +}, +}; + +static const struct rk8xx_reg_data rk808_pre_init_reg[] = { { RK808_BUCK3_CONFIG_REG, BUCK_ILMIN_MASK, BUCK_ILMIN_150MA }, { RK808_BUCK4_CONFIG_REG, BUCK_ILMIN_MASK, BUCK_ILMIN_200MA }, { RK808_BOOST_CONFIG_REG, BOOST_ILMIN_MASK, BOOST_ILMIN_100MA }, @@ -94,6 +111,22 @@ static const struct rk808_reg_data pre_init_reg[] = { VB_LO_SEL_3500MV }, }; +static const struct rk8xx_reg_data rk818_pre_init_reg[] = { +{ RK818_USB_CTRL_REG,RK818_USB_ILIM_SEL_MASK, +RK818_USB_ILMIN_2000MA }, +/* close charger when usb lower then 3.4V */ +{ RK818_USB_CTRL_REG,RK818_USB_CHG_SD_VSEL_MASK, (0x7 << 4) }, +/* no action when vref */ +{ RK818_H5V_EN_REG,BIT(1),RK818_REF_RDY_CTRL }, +/* enable HDMI 5V */ +{ RK818_H5V_EN_REG,BIT(0),RK818_H5V_EN }, +/* improve efficiency */ +{ RK818_BUCK2_CONFIG_REG, BUCK2_RATE_MASK,BUCK_ILMIN_250MA }, +{ RK818_BUCK4_CONFIG_REG, BUCK_ILMIN_MASK,BUCK_ILMIN_250MA }, +{ RK818_BOOST_CONFIG_REG, BOOST_ILMIN_MASK, BOOST_ILMIN_100MA }, +{ RK808_VB_MON_REG,MASK_ALL,VB_LO_ACT | VB_LO_SEL_3500MV }, +}; The alignment here looks odd. I will fix it in the next version.
Re: [RESEND PATCH v5 1/5] mfd: RK808: Add RK818 support
Hi Wadim: On 2016年07月06日 16:03, Wadim Egorov wrote: Hi Andy, On 06.07.2016 05:15, Andy Yan wrote: Hi Wadim: On 2016年06月09日 16:23, Wadim Egorov wrote: Hi, On 08.06.2016 16:17, Lee Jones wrote: On Thu, 02 Jun 2016, Wadim Egorov wrote: The RK818 chip is a power management IC for multimedia and handheld "Power Management IC (PMIC)" devices. It contains the following components: - Regulators - RTC - Clkout Clocking - battery support Battery support Both chips RK808 and RK818 are using a similar register map. "Both RK808 ad RK818 chips" So we can reuse the RTC and Clkout functionality. Swap '.' for ','. Signed-off-by: Wadim Egorov --- drivers/mfd/Kconfig | 4 +- drivers/mfd/rk808.c | 231 ++ include/linux/mfd/rk808.h | 162 ++-- 3 files changed, 350 insertions(+), 47 deletions(-) diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig index 1bcf601..7ba464b 100644 --- a/drivers/mfd/Kconfig +++ b/drivers/mfd/Kconfig @@ -839,13 +839,13 @@ config MFD_RC5T583 different functionality of the device. config MFD_RK808 -tristate "Rockchip RK808 Power Management chip" +tristate "Rockchip RK808/RK818 Power Management chip" "Chip" depends on I2C && OF select MFD_CORE select REGMAP_I2C select REGMAP_IRQ help - If you say yes here you get support for the RK808 + If you say yes here you get support for the RK808 and RK818 Power Management chips. This driver provides common support for accessing the device through I2C interface. The device supports multiple sub-devices diff --git a/drivers/mfd/rk808.c b/drivers/mfd/rk808.c index 49d7f62..3cf9724 100644 --- a/drivers/mfd/rk808.c +++ b/drivers/mfd/rk808.c @@ -1,11 +1,15 @@ /* - * MFD core driver for Rockchip RK808 + * MFD core driver for Rockchip RK808/RK818 * * Copyright (c) 2014, Fuzhou Rockchip Electronics Co., Ltd * * Author: Chris Zhong * Author: Zhang Qing * + * Copyright (C) 2016 PHYTEC Messtechnik GmbH + * + * Author: Wadim Egorov + * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, * version 2, as published by the Free Software Foundation. @@ -22,12 +26,7 @@ #include #include #include - -struct rk808_reg_data { -int addr; -int mask; -int value; -}; Why are you moving this to the header? It is now part of the rk808 struct. +#include static bool rk808_is_volatile_reg(struct device *dev, unsigned int reg) { @@ -57,6 +56,14 @@ static bool rk808_is_volatile_reg(struct device *dev, unsigned int reg) return false; } +static const struct regmap_config rk818_regmap_config = { +.reg_bits = 8, +.val_bits = 8, +.max_register = RK818_USB_CTRL_REG, +.cache_type = REGCACHE_RBTREE, +.volatile_reg = rk808_is_volatile_reg, +}; + static const struct regmap_config rk808_regmap_config = { .reg_bits = 8, .val_bits = 8, @@ -83,7 +90,17 @@ static const struct mfd_cell rk808s[] = { }, }; -static const struct rk808_reg_data pre_init_reg[] = { +static const struct mfd_cell rk818s[] = { +{ .name = "rk808-clkout", }, How does this differ to a normal -clock driver? I don't know. It is a normal clock driver. +{ .name = "rk808-regulator", }, +{ +.name = "rk808-rtc", +.num_resources = ARRAY_SIZE(rtc_resources), +.resources = _resources[0], .resources = rtc_resources, ? +}, +}; + +static const struct rk8xx_reg_data rk808_pre_init_reg[] = { { RK808_BUCK3_CONFIG_REG, BUCK_ILMIN_MASK, BUCK_ILMIN_150MA }, { RK808_BUCK4_CONFIG_REG, BUCK_ILMIN_MASK, BUCK_ILMIN_200MA }, { RK808_BOOST_CONFIG_REG, BOOST_ILMIN_MASK, BOOST_ILMIN_100MA }, @@ -94,6 +111,22 @@ static const struct rk808_reg_data pre_init_reg[] = { VB_LO_SEL_3500MV }, }; +static const struct rk8xx_reg_data rk818_pre_init_reg[] = { +{ RK818_USB_CTRL_REG,RK818_USB_ILIM_SEL_MASK, +RK818_USB_ILMIN_2000MA }, +/* close charger when usb lower then 3.4V */ +{ RK818_USB_CTRL_REG,RK818_USB_CHG_SD_VSEL_MASK, (0x7 << 4) }, +/* no action when vref */ +{ RK818_H5V_EN_REG,BIT(1),RK818_REF_RDY_CTRL }, +/* enable HDMI 5V */ +{ RK818_H5V_EN_REG,BIT(0),RK818_H5V_EN }, +/* improve efficiency */ +{ RK818_BUCK2_CONFIG_REG, BUCK2_RATE_MASK,BUCK_ILMIN_250MA }, +{ RK818_BUCK4_CONFIG_REG, BUCK_ILMIN_MASK,BUCK_ILMIN_250MA }, +{ RK818_BOOST_CONFIG_REG, BOOST_ILMIN_MASK, BOOST_ILMIN_100MA }, +{ RK808_VB_MON_REG,MASK_ALL,VB_LO_ACT | VB_LO_SEL_3500MV }, +}; The alignment here looks odd. I will fix it in the next version. static const struct regmap_irq rk808_irqs[] = { /* INT_STS */
Re: [RESEND PATCH v5 1/5] mfd: RK808: Add RK818 support
Hi Andy, On 06.07.2016 05:15, Andy Yan wrote: > Hi Wadim: > > On 2016年06月09日 16:23, Wadim Egorov wrote: >> Hi, >> >> On 08.06.2016 16:17, Lee Jones wrote: >>> On Thu, 02 Jun 2016, Wadim Egorov wrote: >>> The RK818 chip is a power management IC for multimedia and handheld >>> "Power Management IC (PMIC)" >>> devices. It contains the following components: - Regulators - RTC - Clkout >>> Clocking >>> - battery support >>> Battery support >>> Both chips RK808 and RK818 are using a similar register map. >>> "Both RK808 ad RK818 chips" >>> So we can reuse the RTC and Clkout functionality. >>> Swap '.' for ','. >>> Signed-off-by: Wadim Egorov--- drivers/mfd/Kconfig | 4 +- drivers/mfd/rk808.c | 231 ++ include/linux/mfd/rk808.h | 162 ++-- 3 files changed, 350 insertions(+), 47 deletions(-) diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig index 1bcf601..7ba464b 100644 --- a/drivers/mfd/Kconfig +++ b/drivers/mfd/Kconfig @@ -839,13 +839,13 @@ config MFD_RC5T583 different functionality of the device. config MFD_RK808 -tristate "Rockchip RK808 Power Management chip" +tristate "Rockchip RK808/RK818 Power Management chip" >>> "Chip" >>> depends on I2C && OF select MFD_CORE select REGMAP_I2C select REGMAP_IRQ help - If you say yes here you get support for the RK808 + If you say yes here you get support for the RK808 and RK818 Power Management chips. This driver provides common support for accessing the device through I2C interface. The device supports multiple sub-devices diff --git a/drivers/mfd/rk808.c b/drivers/mfd/rk808.c index 49d7f62..3cf9724 100644 --- a/drivers/mfd/rk808.c +++ b/drivers/mfd/rk808.c @@ -1,11 +1,15 @@ /* - * MFD core driver for Rockchip RK808 + * MFD core driver for Rockchip RK808/RK818 * * Copyright (c) 2014, Fuzhou Rockchip Electronics Co., Ltd * * Author: Chris Zhong * Author: Zhang Qing * + * Copyright (C) 2016 PHYTEC Messtechnik GmbH + * + * Author: Wadim Egorov + * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, * version 2, as published by the Free Software Foundation. @@ -22,12 +26,7 @@ #include #include #include - -struct rk808_reg_data { -int addr; -int mask; -int value; -}; >>> Why are you moving this to the header? >> It is now part of the rk808 struct. >> +#include static bool rk808_is_volatile_reg(struct device *dev, unsigned int reg) { @@ -57,6 +56,14 @@ static bool rk808_is_volatile_reg(struct device *dev, unsigned int reg) return false; } +static const struct regmap_config rk818_regmap_config = { +.reg_bits = 8, +.val_bits = 8, +.max_register = RK818_USB_CTRL_REG, +.cache_type = REGCACHE_RBTREE, +.volatile_reg = rk808_is_volatile_reg, +}; + static const struct regmap_config rk808_regmap_config = { .reg_bits = 8, .val_bits = 8, @@ -83,7 +90,17 @@ static const struct mfd_cell rk808s[] = { }, }; -static const struct rk808_reg_data pre_init_reg[] = { +static const struct mfd_cell rk818s[] = { +{ .name = "rk808-clkout", }, >>> How does this differ to a normal -clock driver? >> I don't know. It is a normal clock driver. >> +{ .name = "rk808-regulator", }, +{ +.name = "rk808-rtc", +.num_resources = ARRAY_SIZE(rtc_resources), +.resources = _resources[0], >>> .resources = rtc_resources, ? >>> +}, +}; + +static const struct rk8xx_reg_data rk808_pre_init_reg[] = { { RK808_BUCK3_CONFIG_REG, BUCK_ILMIN_MASK, BUCK_ILMIN_150MA }, { RK808_BUCK4_CONFIG_REG, BUCK_ILMIN_MASK, BUCK_ILMIN_200MA }, { RK808_BOOST_CONFIG_REG, BOOST_ILMIN_MASK, BOOST_ILMIN_100MA }, @@ -94,6 +111,22 @@ static const struct rk808_reg_data pre_init_reg[] = { VB_LO_SEL_3500MV }, }; +static const struct rk8xx_reg_data rk818_pre_init_reg[] = { +{ RK818_USB_CTRL_REG,RK818_USB_ILIM_SEL_MASK, +RK818_USB_ILMIN_2000MA }, +/* close charger when usb lower then 3.4V */ +{ RK818_USB_CTRL_REG,RK818_USB_CHG_SD_VSEL_MASK, (0x7 << 4) }, +/* no action when
Re: [RESEND PATCH v5 1/5] mfd: RK808: Add RK818 support
Hi Andy, On 06.07.2016 05:15, Andy Yan wrote: > Hi Wadim: > > On 2016年06月09日 16:23, Wadim Egorov wrote: >> Hi, >> >> On 08.06.2016 16:17, Lee Jones wrote: >>> On Thu, 02 Jun 2016, Wadim Egorov wrote: >>> The RK818 chip is a power management IC for multimedia and handheld >>> "Power Management IC (PMIC)" >>> devices. It contains the following components: - Regulators - RTC - Clkout >>> Clocking >>> - battery support >>> Battery support >>> Both chips RK808 and RK818 are using a similar register map. >>> "Both RK808 ad RK818 chips" >>> So we can reuse the RTC and Clkout functionality. >>> Swap '.' for ','. >>> Signed-off-by: Wadim Egorov --- drivers/mfd/Kconfig | 4 +- drivers/mfd/rk808.c | 231 ++ include/linux/mfd/rk808.h | 162 ++-- 3 files changed, 350 insertions(+), 47 deletions(-) diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig index 1bcf601..7ba464b 100644 --- a/drivers/mfd/Kconfig +++ b/drivers/mfd/Kconfig @@ -839,13 +839,13 @@ config MFD_RC5T583 different functionality of the device. config MFD_RK808 -tristate "Rockchip RK808 Power Management chip" +tristate "Rockchip RK808/RK818 Power Management chip" >>> "Chip" >>> depends on I2C && OF select MFD_CORE select REGMAP_I2C select REGMAP_IRQ help - If you say yes here you get support for the RK808 + If you say yes here you get support for the RK808 and RK818 Power Management chips. This driver provides common support for accessing the device through I2C interface. The device supports multiple sub-devices diff --git a/drivers/mfd/rk808.c b/drivers/mfd/rk808.c index 49d7f62..3cf9724 100644 --- a/drivers/mfd/rk808.c +++ b/drivers/mfd/rk808.c @@ -1,11 +1,15 @@ /* - * MFD core driver for Rockchip RK808 + * MFD core driver for Rockchip RK808/RK818 * * Copyright (c) 2014, Fuzhou Rockchip Electronics Co., Ltd * * Author: Chris Zhong * Author: Zhang Qing * + * Copyright (C) 2016 PHYTEC Messtechnik GmbH + * + * Author: Wadim Egorov + * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, * version 2, as published by the Free Software Foundation. @@ -22,12 +26,7 @@ #include #include #include - -struct rk808_reg_data { -int addr; -int mask; -int value; -}; >>> Why are you moving this to the header? >> It is now part of the rk808 struct. >> +#include static bool rk808_is_volatile_reg(struct device *dev, unsigned int reg) { @@ -57,6 +56,14 @@ static bool rk808_is_volatile_reg(struct device *dev, unsigned int reg) return false; } +static const struct regmap_config rk818_regmap_config = { +.reg_bits = 8, +.val_bits = 8, +.max_register = RK818_USB_CTRL_REG, +.cache_type = REGCACHE_RBTREE, +.volatile_reg = rk808_is_volatile_reg, +}; + static const struct regmap_config rk808_regmap_config = { .reg_bits = 8, .val_bits = 8, @@ -83,7 +90,17 @@ static const struct mfd_cell rk808s[] = { }, }; -static const struct rk808_reg_data pre_init_reg[] = { +static const struct mfd_cell rk818s[] = { +{ .name = "rk808-clkout", }, >>> How does this differ to a normal -clock driver? >> I don't know. It is a normal clock driver. >> +{ .name = "rk808-regulator", }, +{ +.name = "rk808-rtc", +.num_resources = ARRAY_SIZE(rtc_resources), +.resources = _resources[0], >>> .resources = rtc_resources, ? >>> +}, +}; + +static const struct rk8xx_reg_data rk808_pre_init_reg[] = { { RK808_BUCK3_CONFIG_REG, BUCK_ILMIN_MASK, BUCK_ILMIN_150MA }, { RK808_BUCK4_CONFIG_REG, BUCK_ILMIN_MASK, BUCK_ILMIN_200MA }, { RK808_BOOST_CONFIG_REG, BOOST_ILMIN_MASK, BOOST_ILMIN_100MA }, @@ -94,6 +111,22 @@ static const struct rk808_reg_data pre_init_reg[] = { VB_LO_SEL_3500MV }, }; +static const struct rk8xx_reg_data rk818_pre_init_reg[] = { +{ RK818_USB_CTRL_REG,RK818_USB_ILIM_SEL_MASK, +RK818_USB_ILMIN_2000MA }, +/* close charger when usb lower then 3.4V */ +{ RK818_USB_CTRL_REG,RK818_USB_CHG_SD_VSEL_MASK, (0x7 << 4) }, +/* no action when vref */ +{ RK818_H5V_EN_REG,BIT(1),RK818_REF_RDY_CTRL }, +
Re: [RESEND PATCH v5 1/5] mfd: RK808: Add RK818 support
Hi Wadim: On 2016年06月09日 16:23, Wadim Egorov wrote: Hi, On 08.06.2016 16:17, Lee Jones wrote: On Thu, 02 Jun 2016, Wadim Egorov wrote: The RK818 chip is a power management IC for multimedia and handheld "Power Management IC (PMIC)" devices. It contains the following components: - Regulators - RTC - Clkout Clocking - battery support Battery support Both chips RK808 and RK818 are using a similar register map. "Both RK808 ad RK818 chips" So we can reuse the RTC and Clkout functionality. Swap '.' for ','. Signed-off-by: Wadim Egorov--- drivers/mfd/Kconfig | 4 +- drivers/mfd/rk808.c | 231 ++ include/linux/mfd/rk808.h | 162 ++-- 3 files changed, 350 insertions(+), 47 deletions(-) diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig index 1bcf601..7ba464b 100644 --- a/drivers/mfd/Kconfig +++ b/drivers/mfd/Kconfig @@ -839,13 +839,13 @@ config MFD_RC5T583 different functionality of the device. config MFD_RK808 - tristate "Rockchip RK808 Power Management chip" + tristate "Rockchip RK808/RK818 Power Management chip" "Chip" depends on I2C && OF select MFD_CORE select REGMAP_I2C select REGMAP_IRQ help - If you say yes here you get support for the RK808 + If you say yes here you get support for the RK808 and RK818 Power Management chips. This driver provides common support for accessing the device through I2C interface. The device supports multiple sub-devices diff --git a/drivers/mfd/rk808.c b/drivers/mfd/rk808.c index 49d7f62..3cf9724 100644 --- a/drivers/mfd/rk808.c +++ b/drivers/mfd/rk808.c @@ -1,11 +1,15 @@ /* - * MFD core driver for Rockchip RK808 + * MFD core driver for Rockchip RK808/RK818 * * Copyright (c) 2014, Fuzhou Rockchip Electronics Co., Ltd * * Author: Chris Zhong * Author: Zhang Qing * + * Copyright (C) 2016 PHYTEC Messtechnik GmbH + * + * Author: Wadim Egorov + * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, * version 2, as published by the Free Software Foundation. @@ -22,12 +26,7 @@ #include #include #include - -struct rk808_reg_data { - int addr; - int mask; - int value; -}; Why are you moving this to the header? It is now part of the rk808 struct. +#include static bool rk808_is_volatile_reg(struct device *dev, unsigned int reg) { @@ -57,6 +56,14 @@ static bool rk808_is_volatile_reg(struct device *dev, unsigned int reg) return false; } +static const struct regmap_config rk818_regmap_config = { + .reg_bits = 8, + .val_bits = 8, + .max_register = RK818_USB_CTRL_REG, + .cache_type = REGCACHE_RBTREE, + .volatile_reg = rk808_is_volatile_reg, +}; + static const struct regmap_config rk808_regmap_config = { .reg_bits = 8, .val_bits = 8, @@ -83,7 +90,17 @@ static const struct mfd_cell rk808s[] = { }, }; -static const struct rk808_reg_data pre_init_reg[] = { +static const struct mfd_cell rk818s[] = { + { .name = "rk808-clkout", }, How does this differ to a normal -clock driver? I don't know. It is a normal clock driver. + { .name = "rk808-regulator", }, + { + .name = "rk808-rtc", + .num_resources = ARRAY_SIZE(rtc_resources), + .resources = _resources[0], .resources = rtc_resources, ? + }, +}; + +static const struct rk8xx_reg_data rk808_pre_init_reg[] = { { RK808_BUCK3_CONFIG_REG, BUCK_ILMIN_MASK, BUCK_ILMIN_150MA }, { RK808_BUCK4_CONFIG_REG, BUCK_ILMIN_MASK, BUCK_ILMIN_200MA }, { RK808_BOOST_CONFIG_REG, BOOST_ILMIN_MASK, BOOST_ILMIN_100MA }, @@ -94,6 +111,22 @@ static const struct rk808_reg_data pre_init_reg[] = { VB_LO_SEL_3500MV }, }; +static const struct rk8xx_reg_data rk818_pre_init_reg[] = { + { RK818_USB_CTRL_REG, RK818_USB_ILIM_SEL_MASK, + RK818_USB_ILMIN_2000MA }, + /* close charger when usb lower then 3.4V */ + { RK818_USB_CTRL_REG, RK818_USB_CHG_SD_VSEL_MASK, (0x7 << 4) }, + /* no action when vref */ + { RK818_H5V_EN_REG, BIT(1), RK818_REF_RDY_CTRL }, + /* enable HDMI 5V */ + { RK818_H5V_EN_REG, BIT(0), RK818_H5V_EN }, + /* improve efficiency */ + { RK818_BUCK2_CONFIG_REG, BUCK2_RATE_MASK, BUCK_ILMIN_250MA }, + { RK818_BUCK4_CONFIG_REG, BUCK_ILMIN_MASK, BUCK_ILMIN_250MA }, + { RK818_BOOST_CONFIG_REG, BOOST_ILMIN_MASK, BOOST_ILMIN_100MA }, + { RK808_VB_MON_REG, MASK_ALL, VB_LO_ACT | VB_LO_SEL_3500MV }, +}; The
Re: [RESEND PATCH v5 1/5] mfd: RK808: Add RK818 support
Hi Wadim: On 2016年06月09日 16:23, Wadim Egorov wrote: Hi, On 08.06.2016 16:17, Lee Jones wrote: On Thu, 02 Jun 2016, Wadim Egorov wrote: The RK818 chip is a power management IC for multimedia and handheld "Power Management IC (PMIC)" devices. It contains the following components: - Regulators - RTC - Clkout Clocking - battery support Battery support Both chips RK808 and RK818 are using a similar register map. "Both RK808 ad RK818 chips" So we can reuse the RTC and Clkout functionality. Swap '.' for ','. Signed-off-by: Wadim Egorov --- drivers/mfd/Kconfig | 4 +- drivers/mfd/rk808.c | 231 ++ include/linux/mfd/rk808.h | 162 ++-- 3 files changed, 350 insertions(+), 47 deletions(-) diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig index 1bcf601..7ba464b 100644 --- a/drivers/mfd/Kconfig +++ b/drivers/mfd/Kconfig @@ -839,13 +839,13 @@ config MFD_RC5T583 different functionality of the device. config MFD_RK808 - tristate "Rockchip RK808 Power Management chip" + tristate "Rockchip RK808/RK818 Power Management chip" "Chip" depends on I2C && OF select MFD_CORE select REGMAP_I2C select REGMAP_IRQ help - If you say yes here you get support for the RK808 + If you say yes here you get support for the RK808 and RK818 Power Management chips. This driver provides common support for accessing the device through I2C interface. The device supports multiple sub-devices diff --git a/drivers/mfd/rk808.c b/drivers/mfd/rk808.c index 49d7f62..3cf9724 100644 --- a/drivers/mfd/rk808.c +++ b/drivers/mfd/rk808.c @@ -1,11 +1,15 @@ /* - * MFD core driver for Rockchip RK808 + * MFD core driver for Rockchip RK808/RK818 * * Copyright (c) 2014, Fuzhou Rockchip Electronics Co., Ltd * * Author: Chris Zhong * Author: Zhang Qing * + * Copyright (C) 2016 PHYTEC Messtechnik GmbH + * + * Author: Wadim Egorov + * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, * version 2, as published by the Free Software Foundation. @@ -22,12 +26,7 @@ #include #include #include - -struct rk808_reg_data { - int addr; - int mask; - int value; -}; Why are you moving this to the header? It is now part of the rk808 struct. +#include static bool rk808_is_volatile_reg(struct device *dev, unsigned int reg) { @@ -57,6 +56,14 @@ static bool rk808_is_volatile_reg(struct device *dev, unsigned int reg) return false; } +static const struct regmap_config rk818_regmap_config = { + .reg_bits = 8, + .val_bits = 8, + .max_register = RK818_USB_CTRL_REG, + .cache_type = REGCACHE_RBTREE, + .volatile_reg = rk808_is_volatile_reg, +}; + static const struct regmap_config rk808_regmap_config = { .reg_bits = 8, .val_bits = 8, @@ -83,7 +90,17 @@ static const struct mfd_cell rk808s[] = { }, }; -static const struct rk808_reg_data pre_init_reg[] = { +static const struct mfd_cell rk818s[] = { + { .name = "rk808-clkout", }, How does this differ to a normal -clock driver? I don't know. It is a normal clock driver. + { .name = "rk808-regulator", }, + { + .name = "rk808-rtc", + .num_resources = ARRAY_SIZE(rtc_resources), + .resources = _resources[0], .resources = rtc_resources, ? + }, +}; + +static const struct rk8xx_reg_data rk808_pre_init_reg[] = { { RK808_BUCK3_CONFIG_REG, BUCK_ILMIN_MASK, BUCK_ILMIN_150MA }, { RK808_BUCK4_CONFIG_REG, BUCK_ILMIN_MASK, BUCK_ILMIN_200MA }, { RK808_BOOST_CONFIG_REG, BOOST_ILMIN_MASK, BOOST_ILMIN_100MA }, @@ -94,6 +111,22 @@ static const struct rk808_reg_data pre_init_reg[] = { VB_LO_SEL_3500MV }, }; +static const struct rk8xx_reg_data rk818_pre_init_reg[] = { + { RK818_USB_CTRL_REG, RK818_USB_ILIM_SEL_MASK, + RK818_USB_ILMIN_2000MA }, + /* close charger when usb lower then 3.4V */ + { RK818_USB_CTRL_REG, RK818_USB_CHG_SD_VSEL_MASK, (0x7 << 4) }, + /* no action when vref */ + { RK818_H5V_EN_REG, BIT(1), RK818_REF_RDY_CTRL }, + /* enable HDMI 5V */ + { RK818_H5V_EN_REG, BIT(0), RK818_H5V_EN }, + /* improve efficiency */ + { RK818_BUCK2_CONFIG_REG, BUCK2_RATE_MASK, BUCK_ILMIN_250MA }, + { RK818_BUCK4_CONFIG_REG, BUCK_ILMIN_MASK, BUCK_ILMIN_250MA }, + { RK818_BOOST_CONFIG_REG, BOOST_ILMIN_MASK, BOOST_ILMIN_100MA }, + { RK808_VB_MON_REG, MASK_ALL, VB_LO_ACT | VB_LO_SEL_3500MV }, +}; The alignment here looks odd. I will fix it in the next version. static const struct
Re: [RESEND PATCH v5 1/5] mfd: RK808: Add RK818 support
On Thu, 09 Jun 2016, Wadim Egorov wrote: > > > On 09.06.2016 13:12, Lee Jones wrote: > > On Thu, 09 Jun 2016, Wadim Egorov wrote: > >> On 08.06.2016 16:17, Lee Jones wrote: > >>> On Thu, 02 Jun 2016, Wadim Egorov wrote: > >>> > The RK818 chip is a power management IC for multimedia and handheld > >>> "Power Management IC (PMIC)" > >>> > devices. It contains the following components: > > - Regulators > - RTC > - Clkout > >>> Clocking > >>> > - battery support > >>> Battery support > >>> > Both chips RK808 and RK818 are using a similar register map. > >>> "Both RK808 ad RK818 chips" > >>> > So we can reuse the RTC and Clkout functionality. > >>> Swap '.' for ','. > >>> > Signed-off-by: Wadim Egorov> --- > drivers/mfd/Kconfig | 4 +- > drivers/mfd/rk808.c | 231 > ++ > include/linux/mfd/rk808.h | 162 ++-- > 3 files changed, 350 insertions(+), 47 deletions(-) > > [...] > > > -struct rk808_reg_data { > -int addr; > -int mask; > -int value; > -}; > >>> Why are you moving this to the header? > >> It is now part of the rk808 struct. > > Why? > > > For me it seemed reasonable. My idea was to have only one chip variant > check. > > I can move the rk808_reg_data struct back to the c file, check for the > chip variant within the probe function and initialize the proper > reg_data variable. > This would also apply to the mfd_cell variables. 'struct rk808' should only contain information you wish to share with your subordinate/child devices. Any data only used in the parent/MFD driver should be declared, initialised and used only the latter. No need to export. -- Lee Jones Linaro STMicroelectronics Landing Team Lead Linaro.org │ Open source software for ARM SoCs Follow Linaro: Facebook | Twitter | Blog
Re: [RESEND PATCH v5 1/5] mfd: RK808: Add RK818 support
On Thu, 09 Jun 2016, Wadim Egorov wrote: > > > On 09.06.2016 13:12, Lee Jones wrote: > > On Thu, 09 Jun 2016, Wadim Egorov wrote: > >> On 08.06.2016 16:17, Lee Jones wrote: > >>> On Thu, 02 Jun 2016, Wadim Egorov wrote: > >>> > The RK818 chip is a power management IC for multimedia and handheld > >>> "Power Management IC (PMIC)" > >>> > devices. It contains the following components: > > - Regulators > - RTC > - Clkout > >>> Clocking > >>> > - battery support > >>> Battery support > >>> > Both chips RK808 and RK818 are using a similar register map. > >>> "Both RK808 ad RK818 chips" > >>> > So we can reuse the RTC and Clkout functionality. > >>> Swap '.' for ','. > >>> > Signed-off-by: Wadim Egorov > --- > drivers/mfd/Kconfig | 4 +- > drivers/mfd/rk808.c | 231 > ++ > include/linux/mfd/rk808.h | 162 ++-- > 3 files changed, 350 insertions(+), 47 deletions(-) > > [...] > > > -struct rk808_reg_data { > -int addr; > -int mask; > -int value; > -}; > >>> Why are you moving this to the header? > >> It is now part of the rk808 struct. > > Why? > > > For me it seemed reasonable. My idea was to have only one chip variant > check. > > I can move the rk808_reg_data struct back to the c file, check for the > chip variant within the probe function and initialize the proper > reg_data variable. > This would also apply to the mfd_cell variables. 'struct rk808' should only contain information you wish to share with your subordinate/child devices. Any data only used in the parent/MFD driver should be declared, initialised and used only the latter. No need to export. -- Lee Jones Linaro STMicroelectronics Landing Team Lead Linaro.org │ Open source software for ARM SoCs Follow Linaro: Facebook | Twitter | Blog
Re: [RESEND PATCH v5 1/5] mfd: RK808: Add RK818 support
On 09.06.2016 13:12, Lee Jones wrote: > On Thu, 09 Jun 2016, Wadim Egorov wrote: >> On 08.06.2016 16:17, Lee Jones wrote: >>> On Thu, 02 Jun 2016, Wadim Egorov wrote: >>> The RK818 chip is a power management IC for multimedia and handheld >>> "Power Management IC (PMIC)" >>> devices. It contains the following components: - Regulators - RTC - Clkout >>> Clocking >>> - battery support >>> Battery support >>> Both chips RK808 and RK818 are using a similar register map. >>> "Both RK808 ad RK818 chips" >>> So we can reuse the RTC and Clkout functionality. >>> Swap '.' for ','. >>> Signed-off-by: Wadim Egorov--- drivers/mfd/Kconfig | 4 +- drivers/mfd/rk808.c | 231 ++ include/linux/mfd/rk808.h | 162 ++-- 3 files changed, 350 insertions(+), 47 deletions(-) > [...] > -struct rk808_reg_data { - int addr; - int mask; - int value; -}; >>> Why are you moving this to the header? >> It is now part of the rk808 struct. > Why? > For me it seemed reasonable. My idea was to have only one chip variant check. I can move the rk808_reg_data struct back to the c file, check for the chip variant within the probe function and initialize the proper reg_data variable. This would also apply to the mfd_cell variables.
Re: [RESEND PATCH v5 1/5] mfd: RK808: Add RK818 support
On 09.06.2016 13:12, Lee Jones wrote: > On Thu, 09 Jun 2016, Wadim Egorov wrote: >> On 08.06.2016 16:17, Lee Jones wrote: >>> On Thu, 02 Jun 2016, Wadim Egorov wrote: >>> The RK818 chip is a power management IC for multimedia and handheld >>> "Power Management IC (PMIC)" >>> devices. It contains the following components: - Regulators - RTC - Clkout >>> Clocking >>> - battery support >>> Battery support >>> Both chips RK808 and RK818 are using a similar register map. >>> "Both RK808 ad RK818 chips" >>> So we can reuse the RTC and Clkout functionality. >>> Swap '.' for ','. >>> Signed-off-by: Wadim Egorov --- drivers/mfd/Kconfig | 4 +- drivers/mfd/rk808.c | 231 ++ include/linux/mfd/rk808.h | 162 ++-- 3 files changed, 350 insertions(+), 47 deletions(-) > [...] > -struct rk808_reg_data { - int addr; - int mask; - int value; -}; >>> Why are you moving this to the header? >> It is now part of the rk808 struct. > Why? > For me it seemed reasonable. My idea was to have only one chip variant check. I can move the rk808_reg_data struct back to the c file, check for the chip variant within the probe function and initialize the proper reg_data variable. This would also apply to the mfd_cell variables.
Re: [RESEND PATCH v5 1/5] mfd: RK808: Add RK818 support
On Thu, 09 Jun 2016, Wadim Egorov wrote: > On 08.06.2016 16:17, Lee Jones wrote: > > On Thu, 02 Jun 2016, Wadim Egorov wrote: > > > >> The RK818 chip is a power management IC for multimedia and handheld > > "Power Management IC (PMIC)" > > > >> devices. It contains the following components: > >> > >> - Regulators > >> - RTC > >> - Clkout > > Clocking > > > >> - battery support > > Battery support > > > >> Both chips RK808 and RK818 are using a similar register map. > > "Both RK808 ad RK818 chips" > > > >> So we can reuse the RTC and Clkout functionality. > > Swap '.' for ','. > > > >> Signed-off-by: Wadim Egorov> >> --- > >> drivers/mfd/Kconfig | 4 +- > >> drivers/mfd/rk808.c | 231 > >> ++ > >> include/linux/mfd/rk808.h | 162 ++-- > >> 3 files changed, 350 insertions(+), 47 deletions(-) [...] > >> -struct rk808_reg_data { > >> - int addr; > >> - int mask; > >> - int value; > >> -}; > > Why are you moving this to the header? > > It is now part of the rk808 struct. Why? -- Lee Jones Linaro STMicroelectronics Landing Team Lead Linaro.org │ Open source software for ARM SoCs Follow Linaro: Facebook | Twitter | Blog
Re: [RESEND PATCH v5 1/5] mfd: RK808: Add RK818 support
On Thu, 09 Jun 2016, Wadim Egorov wrote: > On 08.06.2016 16:17, Lee Jones wrote: > > On Thu, 02 Jun 2016, Wadim Egorov wrote: > > > >> The RK818 chip is a power management IC for multimedia and handheld > > "Power Management IC (PMIC)" > > > >> devices. It contains the following components: > >> > >> - Regulators > >> - RTC > >> - Clkout > > Clocking > > > >> - battery support > > Battery support > > > >> Both chips RK808 and RK818 are using a similar register map. > > "Both RK808 ad RK818 chips" > > > >> So we can reuse the RTC and Clkout functionality. > > Swap '.' for ','. > > > >> Signed-off-by: Wadim Egorov > >> --- > >> drivers/mfd/Kconfig | 4 +- > >> drivers/mfd/rk808.c | 231 > >> ++ > >> include/linux/mfd/rk808.h | 162 ++-- > >> 3 files changed, 350 insertions(+), 47 deletions(-) [...] > >> -struct rk808_reg_data { > >> - int addr; > >> - int mask; > >> - int value; > >> -}; > > Why are you moving this to the header? > > It is now part of the rk808 struct. Why? -- Lee Jones Linaro STMicroelectronics Landing Team Lead Linaro.org │ Open source software for ARM SoCs Follow Linaro: Facebook | Twitter | Blog
Re: [RESEND PATCH v5 1/5] mfd: RK808: Add RK818 support
Hi, On 08.06.2016 16:17, Lee Jones wrote: > On Thu, 02 Jun 2016, Wadim Egorov wrote: > >> The RK818 chip is a power management IC for multimedia and handheld > "Power Management IC (PMIC)" > >> devices. It contains the following components: >> >> - Regulators >> - RTC >> - Clkout > Clocking > >> - battery support > Battery support > >> Both chips RK808 and RK818 are using a similar register map. > "Both RK808 ad RK818 chips" > >> So we can reuse the RTC and Clkout functionality. > Swap '.' for ','. > >> Signed-off-by: Wadim Egorov>> --- >> drivers/mfd/Kconfig | 4 +- >> drivers/mfd/rk808.c | 231 >> ++ >> include/linux/mfd/rk808.h | 162 ++-- >> 3 files changed, 350 insertions(+), 47 deletions(-) >> >> diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig >> index 1bcf601..7ba464b 100644 >> --- a/drivers/mfd/Kconfig >> +++ b/drivers/mfd/Kconfig >> @@ -839,13 +839,13 @@ config MFD_RC5T583 >>different functionality of the device. >> >> config MFD_RK808 >> -tristate "Rockchip RK808 Power Management chip" >> +tristate "Rockchip RK808/RK818 Power Management chip" > "Chip" > >> depends on I2C && OF >> select MFD_CORE >> select REGMAP_I2C >> select REGMAP_IRQ >> help >> - If you say yes here you get support for the RK808 >> + If you say yes here you get support for the RK808 and RK818 >>Power Management chips. >>This driver provides common support for accessing the device >>through I2C interface. The device supports multiple sub-devices >> diff --git a/drivers/mfd/rk808.c b/drivers/mfd/rk808.c >> index 49d7f62..3cf9724 100644 >> --- a/drivers/mfd/rk808.c >> +++ b/drivers/mfd/rk808.c >> @@ -1,11 +1,15 @@ >> /* >> - * MFD core driver for Rockchip RK808 >> + * MFD core driver for Rockchip RK808/RK818 >> * >> * Copyright (c) 2014, Fuzhou Rockchip Electronics Co., Ltd >> * >> * Author: Chris Zhong >> * Author: Zhang Qing >> * >> + * Copyright (C) 2016 PHYTEC Messtechnik GmbH >> + * >> + * Author: Wadim Egorov >> + * >> * This program is free software; you can redistribute it and/or modify it >> * under the terms and conditions of the GNU General Public License, >> * version 2, as published by the Free Software Foundation. >> @@ -22,12 +26,7 @@ >> #include >> #include >> #include >> - >> -struct rk808_reg_data { >> -int addr; >> -int mask; >> -int value; >> -}; > Why are you moving this to the header? It is now part of the rk808 struct. > >> +#include >> >> static bool rk808_is_volatile_reg(struct device *dev, unsigned int reg) >> { >> @@ -57,6 +56,14 @@ static bool rk808_is_volatile_reg(struct device *dev, >> unsigned int reg) >> return false; >> } >> >> +static const struct regmap_config rk818_regmap_config = { >> +.reg_bits = 8, >> +.val_bits = 8, >> +.max_register = RK818_USB_CTRL_REG, >> +.cache_type = REGCACHE_RBTREE, >> +.volatile_reg = rk808_is_volatile_reg, >> +}; >> + >> static const struct regmap_config rk808_regmap_config = { >> .reg_bits = 8, >> .val_bits = 8, >> @@ -83,7 +90,17 @@ static const struct mfd_cell rk808s[] = { >> }, >> }; >> >> -static const struct rk808_reg_data pre_init_reg[] = { >> +static const struct mfd_cell rk818s[] = { >> +{ .name = "rk808-clkout", }, > How does this differ to a normal -clock driver? I don't know. It is a normal clock driver. > >> +{ .name = "rk808-regulator", }, >> +{ >> +.name = "rk808-rtc", >> +.num_resources = ARRAY_SIZE(rtc_resources), >> +.resources = _resources[0], > .resources = rtc_resources, ? > >> +}, >> +}; >> + >> +static const struct rk8xx_reg_data rk808_pre_init_reg[] = { >> { RK808_BUCK3_CONFIG_REG, BUCK_ILMIN_MASK, BUCK_ILMIN_150MA }, >> { RK808_BUCK4_CONFIG_REG, BUCK_ILMIN_MASK, BUCK_ILMIN_200MA }, >> { RK808_BOOST_CONFIG_REG, BOOST_ILMIN_MASK, BOOST_ILMIN_100MA }, >> @@ -94,6 +111,22 @@ static const struct rk808_reg_data pre_init_reg[] = { >> VB_LO_SEL_3500MV }, >> }; >> >> +static const struct rk8xx_reg_data rk818_pre_init_reg[] = { >> +{ RK818_USB_CTRL_REG, RK818_USB_ILIM_SEL_MASK, >> +RK818_USB_ILMIN_2000MA }, >> +/* close charger when usb lower then 3.4V */ >> +{ RK818_USB_CTRL_REG, RK818_USB_CHG_SD_VSEL_MASK, (0x7 << 4) }, >> +/* no action when vref */ >> +{ RK818_H5V_EN_REG, BIT(1), RK818_REF_RDY_CTRL }, >> +/* enable HDMI 5V */ >> +{ RK818_H5V_EN_REG, BIT(0), RK818_H5V_EN }, >> +/* improve efficiency */ >> +{ RK818_BUCK2_CONFIG_REG, BUCK2_RATE_MASK, BUCK_ILMIN_250MA }, >> +{ RK818_BUCK4_CONFIG_REG, BUCK_ILMIN_MASK, BUCK_ILMIN_250MA }, >> +{
Re: [RESEND PATCH v5 1/5] mfd: RK808: Add RK818 support
Hi, On 08.06.2016 16:17, Lee Jones wrote: > On Thu, 02 Jun 2016, Wadim Egorov wrote: > >> The RK818 chip is a power management IC for multimedia and handheld > "Power Management IC (PMIC)" > >> devices. It contains the following components: >> >> - Regulators >> - RTC >> - Clkout > Clocking > >> - battery support > Battery support > >> Both chips RK808 and RK818 are using a similar register map. > "Both RK808 ad RK818 chips" > >> So we can reuse the RTC and Clkout functionality. > Swap '.' for ','. > >> Signed-off-by: Wadim Egorov >> --- >> drivers/mfd/Kconfig | 4 +- >> drivers/mfd/rk808.c | 231 >> ++ >> include/linux/mfd/rk808.h | 162 ++-- >> 3 files changed, 350 insertions(+), 47 deletions(-) >> >> diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig >> index 1bcf601..7ba464b 100644 >> --- a/drivers/mfd/Kconfig >> +++ b/drivers/mfd/Kconfig >> @@ -839,13 +839,13 @@ config MFD_RC5T583 >>different functionality of the device. >> >> config MFD_RK808 >> -tristate "Rockchip RK808 Power Management chip" >> +tristate "Rockchip RK808/RK818 Power Management chip" > "Chip" > >> depends on I2C && OF >> select MFD_CORE >> select REGMAP_I2C >> select REGMAP_IRQ >> help >> - If you say yes here you get support for the RK808 >> + If you say yes here you get support for the RK808 and RK818 >>Power Management chips. >>This driver provides common support for accessing the device >>through I2C interface. The device supports multiple sub-devices >> diff --git a/drivers/mfd/rk808.c b/drivers/mfd/rk808.c >> index 49d7f62..3cf9724 100644 >> --- a/drivers/mfd/rk808.c >> +++ b/drivers/mfd/rk808.c >> @@ -1,11 +1,15 @@ >> /* >> - * MFD core driver for Rockchip RK808 >> + * MFD core driver for Rockchip RK808/RK818 >> * >> * Copyright (c) 2014, Fuzhou Rockchip Electronics Co., Ltd >> * >> * Author: Chris Zhong >> * Author: Zhang Qing >> * >> + * Copyright (C) 2016 PHYTEC Messtechnik GmbH >> + * >> + * Author: Wadim Egorov >> + * >> * This program is free software; you can redistribute it and/or modify it >> * under the terms and conditions of the GNU General Public License, >> * version 2, as published by the Free Software Foundation. >> @@ -22,12 +26,7 @@ >> #include >> #include >> #include >> - >> -struct rk808_reg_data { >> -int addr; >> -int mask; >> -int value; >> -}; > Why are you moving this to the header? It is now part of the rk808 struct. > >> +#include >> >> static bool rk808_is_volatile_reg(struct device *dev, unsigned int reg) >> { >> @@ -57,6 +56,14 @@ static bool rk808_is_volatile_reg(struct device *dev, >> unsigned int reg) >> return false; >> } >> >> +static const struct regmap_config rk818_regmap_config = { >> +.reg_bits = 8, >> +.val_bits = 8, >> +.max_register = RK818_USB_CTRL_REG, >> +.cache_type = REGCACHE_RBTREE, >> +.volatile_reg = rk808_is_volatile_reg, >> +}; >> + >> static const struct regmap_config rk808_regmap_config = { >> .reg_bits = 8, >> .val_bits = 8, >> @@ -83,7 +90,17 @@ static const struct mfd_cell rk808s[] = { >> }, >> }; >> >> -static const struct rk808_reg_data pre_init_reg[] = { >> +static const struct mfd_cell rk818s[] = { >> +{ .name = "rk808-clkout", }, > How does this differ to a normal -clock driver? I don't know. It is a normal clock driver. > >> +{ .name = "rk808-regulator", }, >> +{ >> +.name = "rk808-rtc", >> +.num_resources = ARRAY_SIZE(rtc_resources), >> +.resources = _resources[0], > .resources = rtc_resources, ? > >> +}, >> +}; >> + >> +static const struct rk8xx_reg_data rk808_pre_init_reg[] = { >> { RK808_BUCK3_CONFIG_REG, BUCK_ILMIN_MASK, BUCK_ILMIN_150MA }, >> { RK808_BUCK4_CONFIG_REG, BUCK_ILMIN_MASK, BUCK_ILMIN_200MA }, >> { RK808_BOOST_CONFIG_REG, BOOST_ILMIN_MASK, BOOST_ILMIN_100MA }, >> @@ -94,6 +111,22 @@ static const struct rk808_reg_data pre_init_reg[] = { >> VB_LO_SEL_3500MV }, >> }; >> >> +static const struct rk8xx_reg_data rk818_pre_init_reg[] = { >> +{ RK818_USB_CTRL_REG, RK818_USB_ILIM_SEL_MASK, >> +RK818_USB_ILMIN_2000MA }, >> +/* close charger when usb lower then 3.4V */ >> +{ RK818_USB_CTRL_REG, RK818_USB_CHG_SD_VSEL_MASK, (0x7 << 4) }, >> +/* no action when vref */ >> +{ RK818_H5V_EN_REG, BIT(1), RK818_REF_RDY_CTRL }, >> +/* enable HDMI 5V */ >> +{ RK818_H5V_EN_REG, BIT(0), RK818_H5V_EN }, >> +/* improve efficiency */ >> +{ RK818_BUCK2_CONFIG_REG, BUCK2_RATE_MASK, BUCK_ILMIN_250MA }, >> +{ RK818_BUCK4_CONFIG_REG, BUCK_ILMIN_MASK, BUCK_ILMIN_250MA }, >> +{ RK818_BOOST_CONFIG_REG, BOOST_ILMIN_MASK, BOOST_ILMIN_100MA }, >> +{ RK808_VB_MON_REG,
Re: [RESEND PATCH v5 1/5] mfd: RK808: Add RK818 support
On Thu, 02 Jun 2016, Wadim Egorov wrote: > The RK818 chip is a power management IC for multimedia and handheld "Power Management IC (PMIC)" > devices. It contains the following components: > > - Regulators > - RTC > - Clkout Clocking > - battery support Battery support > Both chips RK808 and RK818 are using a similar register map. "Both RK808 ad RK818 chips" > So we can reuse the RTC and Clkout functionality. Swap '.' for ','. > Signed-off-by: Wadim Egorov> --- > drivers/mfd/Kconfig | 4 +- > drivers/mfd/rk808.c | 231 > ++ > include/linux/mfd/rk808.h | 162 ++-- > 3 files changed, 350 insertions(+), 47 deletions(-) > > diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig > index 1bcf601..7ba464b 100644 > --- a/drivers/mfd/Kconfig > +++ b/drivers/mfd/Kconfig > @@ -839,13 +839,13 @@ config MFD_RC5T583 > different functionality of the device. > > config MFD_RK808 > - tristate "Rockchip RK808 Power Management chip" > + tristate "Rockchip RK808/RK818 Power Management chip" "Chip" > depends on I2C && OF > select MFD_CORE > select REGMAP_I2C > select REGMAP_IRQ > help > - If you say yes here you get support for the RK808 > + If you say yes here you get support for the RK808 and RK818 > Power Management chips. > This driver provides common support for accessing the device > through I2C interface. The device supports multiple sub-devices > diff --git a/drivers/mfd/rk808.c b/drivers/mfd/rk808.c > index 49d7f62..3cf9724 100644 > --- a/drivers/mfd/rk808.c > +++ b/drivers/mfd/rk808.c > @@ -1,11 +1,15 @@ > /* > - * MFD core driver for Rockchip RK808 > + * MFD core driver for Rockchip RK808/RK818 > * > * Copyright (c) 2014, Fuzhou Rockchip Electronics Co., Ltd > * > * Author: Chris Zhong > * Author: Zhang Qing > * > + * Copyright (C) 2016 PHYTEC Messtechnik GmbH > + * > + * Author: Wadim Egorov > + * > * This program is free software; you can redistribute it and/or modify it > * under the terms and conditions of the GNU General Public License, > * version 2, as published by the Free Software Foundation. > @@ -22,12 +26,7 @@ > #include > #include > #include > - > -struct rk808_reg_data { > - int addr; > - int mask; > - int value; > -}; Why are you moving this to the header? > +#include > > static bool rk808_is_volatile_reg(struct device *dev, unsigned int reg) > { > @@ -57,6 +56,14 @@ static bool rk808_is_volatile_reg(struct device *dev, > unsigned int reg) > return false; > } > > +static const struct regmap_config rk818_regmap_config = { > + .reg_bits = 8, > + .val_bits = 8, > + .max_register = RK818_USB_CTRL_REG, > + .cache_type = REGCACHE_RBTREE, > + .volatile_reg = rk808_is_volatile_reg, > +}; > + > static const struct regmap_config rk808_regmap_config = { > .reg_bits = 8, > .val_bits = 8, > @@ -83,7 +90,17 @@ static const struct mfd_cell rk808s[] = { > }, > }; > > -static const struct rk808_reg_data pre_init_reg[] = { > +static const struct mfd_cell rk818s[] = { > + { .name = "rk808-clkout", }, How does this differ to a normal -clock driver? > + { .name = "rk808-regulator", }, > + { > + .name = "rk808-rtc", > + .num_resources = ARRAY_SIZE(rtc_resources), > + .resources = _resources[0], .resources = rtc_resources, ? > + }, > +}; > + > +static const struct rk8xx_reg_data rk808_pre_init_reg[] = { > { RK808_BUCK3_CONFIG_REG, BUCK_ILMIN_MASK, BUCK_ILMIN_150MA }, > { RK808_BUCK4_CONFIG_REG, BUCK_ILMIN_MASK, BUCK_ILMIN_200MA }, > { RK808_BOOST_CONFIG_REG, BOOST_ILMIN_MASK, BOOST_ILMIN_100MA }, > @@ -94,6 +111,22 @@ static const struct rk808_reg_data pre_init_reg[] = { > VB_LO_SEL_3500MV }, > }; > > +static const struct rk8xx_reg_data rk818_pre_init_reg[] = { > + { RK818_USB_CTRL_REG, RK818_USB_ILIM_SEL_MASK, > + RK818_USB_ILMIN_2000MA }, > + /* close charger when usb lower then 3.4V */ > + { RK818_USB_CTRL_REG, RK818_USB_CHG_SD_VSEL_MASK, (0x7 << 4) }, > + /* no action when vref */ > + { RK818_H5V_EN_REG, BIT(1), RK818_REF_RDY_CTRL }, > + /* enable HDMI 5V */ > + { RK818_H5V_EN_REG, BIT(0), RK818_H5V_EN }, > + /* improve efficiency */ > + { RK818_BUCK2_CONFIG_REG, BUCK2_RATE_MASK, BUCK_ILMIN_250MA }, > + { RK818_BUCK4_CONFIG_REG, BUCK_ILMIN_MASK, BUCK_ILMIN_250MA }, > + { RK818_BOOST_CONFIG_REG, BOOST_ILMIN_MASK, BOOST_ILMIN_100MA }, > + { RK808_VB_MON_REG, MASK_ALL, VB_LO_ACT | VB_LO_SEL_3500MV }, > +}; The alignment here looks odd. > static const struct regmap_irq rk808_irqs[]
Re: [RESEND PATCH v5 1/5] mfd: RK808: Add RK818 support
On Thu, 02 Jun 2016, Wadim Egorov wrote: > The RK818 chip is a power management IC for multimedia and handheld "Power Management IC (PMIC)" > devices. It contains the following components: > > - Regulators > - RTC > - Clkout Clocking > - battery support Battery support > Both chips RK808 and RK818 are using a similar register map. "Both RK808 ad RK818 chips" > So we can reuse the RTC and Clkout functionality. Swap '.' for ','. > Signed-off-by: Wadim Egorov > --- > drivers/mfd/Kconfig | 4 +- > drivers/mfd/rk808.c | 231 > ++ > include/linux/mfd/rk808.h | 162 ++-- > 3 files changed, 350 insertions(+), 47 deletions(-) > > diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig > index 1bcf601..7ba464b 100644 > --- a/drivers/mfd/Kconfig > +++ b/drivers/mfd/Kconfig > @@ -839,13 +839,13 @@ config MFD_RC5T583 > different functionality of the device. > > config MFD_RK808 > - tristate "Rockchip RK808 Power Management chip" > + tristate "Rockchip RK808/RK818 Power Management chip" "Chip" > depends on I2C && OF > select MFD_CORE > select REGMAP_I2C > select REGMAP_IRQ > help > - If you say yes here you get support for the RK808 > + If you say yes here you get support for the RK808 and RK818 > Power Management chips. > This driver provides common support for accessing the device > through I2C interface. The device supports multiple sub-devices > diff --git a/drivers/mfd/rk808.c b/drivers/mfd/rk808.c > index 49d7f62..3cf9724 100644 > --- a/drivers/mfd/rk808.c > +++ b/drivers/mfd/rk808.c > @@ -1,11 +1,15 @@ > /* > - * MFD core driver for Rockchip RK808 > + * MFD core driver for Rockchip RK808/RK818 > * > * Copyright (c) 2014, Fuzhou Rockchip Electronics Co., Ltd > * > * Author: Chris Zhong > * Author: Zhang Qing > * > + * Copyright (C) 2016 PHYTEC Messtechnik GmbH > + * > + * Author: Wadim Egorov > + * > * This program is free software; you can redistribute it and/or modify it > * under the terms and conditions of the GNU General Public License, > * version 2, as published by the Free Software Foundation. > @@ -22,12 +26,7 @@ > #include > #include > #include > - > -struct rk808_reg_data { > - int addr; > - int mask; > - int value; > -}; Why are you moving this to the header? > +#include > > static bool rk808_is_volatile_reg(struct device *dev, unsigned int reg) > { > @@ -57,6 +56,14 @@ static bool rk808_is_volatile_reg(struct device *dev, > unsigned int reg) > return false; > } > > +static const struct regmap_config rk818_regmap_config = { > + .reg_bits = 8, > + .val_bits = 8, > + .max_register = RK818_USB_CTRL_REG, > + .cache_type = REGCACHE_RBTREE, > + .volatile_reg = rk808_is_volatile_reg, > +}; > + > static const struct regmap_config rk808_regmap_config = { > .reg_bits = 8, > .val_bits = 8, > @@ -83,7 +90,17 @@ static const struct mfd_cell rk808s[] = { > }, > }; > > -static const struct rk808_reg_data pre_init_reg[] = { > +static const struct mfd_cell rk818s[] = { > + { .name = "rk808-clkout", }, How does this differ to a normal -clock driver? > + { .name = "rk808-regulator", }, > + { > + .name = "rk808-rtc", > + .num_resources = ARRAY_SIZE(rtc_resources), > + .resources = _resources[0], .resources = rtc_resources, ? > + }, > +}; > + > +static const struct rk8xx_reg_data rk808_pre_init_reg[] = { > { RK808_BUCK3_CONFIG_REG, BUCK_ILMIN_MASK, BUCK_ILMIN_150MA }, > { RK808_BUCK4_CONFIG_REG, BUCK_ILMIN_MASK, BUCK_ILMIN_200MA }, > { RK808_BOOST_CONFIG_REG, BOOST_ILMIN_MASK, BOOST_ILMIN_100MA }, > @@ -94,6 +111,22 @@ static const struct rk808_reg_data pre_init_reg[] = { > VB_LO_SEL_3500MV }, > }; > > +static const struct rk8xx_reg_data rk818_pre_init_reg[] = { > + { RK818_USB_CTRL_REG, RK818_USB_ILIM_SEL_MASK, > + RK818_USB_ILMIN_2000MA }, > + /* close charger when usb lower then 3.4V */ > + { RK818_USB_CTRL_REG, RK818_USB_CHG_SD_VSEL_MASK, (0x7 << 4) }, > + /* no action when vref */ > + { RK818_H5V_EN_REG, BIT(1), RK818_REF_RDY_CTRL }, > + /* enable HDMI 5V */ > + { RK818_H5V_EN_REG, BIT(0), RK818_H5V_EN }, > + /* improve efficiency */ > + { RK818_BUCK2_CONFIG_REG, BUCK2_RATE_MASK, BUCK_ILMIN_250MA }, > + { RK818_BUCK4_CONFIG_REG, BUCK_ILMIN_MASK, BUCK_ILMIN_250MA }, > + { RK818_BOOST_CONFIG_REG, BOOST_ILMIN_MASK, BOOST_ILMIN_100MA }, > + { RK808_VB_MON_REG, MASK_ALL, VB_LO_ACT | VB_LO_SEL_3500MV }, > +}; The alignment here looks odd. > static const struct regmap_irq rk808_irqs[] = { > /* INT_STS */ > [RK808_IRQ_VOUT_LO] = { > @@ -136,6 +169,76 @@ static
[RESEND PATCH v5 1/5] mfd: RK808: Add RK818 support
The RK818 chip is a power management IC for multimedia and handheld devices. It contains the following components: - Regulators - RTC - Clkout - battery support Both chips RK808 and RK818 are using a similar register map. So we can reuse the RTC and Clkout functionality. Signed-off-by: Wadim Egorov--- drivers/mfd/Kconfig | 4 +- drivers/mfd/rk808.c | 231 ++ include/linux/mfd/rk808.h | 162 ++-- 3 files changed, 350 insertions(+), 47 deletions(-) diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig index 1bcf601..7ba464b 100644 --- a/drivers/mfd/Kconfig +++ b/drivers/mfd/Kconfig @@ -839,13 +839,13 @@ config MFD_RC5T583 different functionality of the device. config MFD_RK808 - tristate "Rockchip RK808 Power Management chip" + tristate "Rockchip RK808/RK818 Power Management chip" depends on I2C && OF select MFD_CORE select REGMAP_I2C select REGMAP_IRQ help - If you say yes here you get support for the RK808 + If you say yes here you get support for the RK808 and RK818 Power Management chips. This driver provides common support for accessing the device through I2C interface. The device supports multiple sub-devices diff --git a/drivers/mfd/rk808.c b/drivers/mfd/rk808.c index 49d7f62..3cf9724 100644 --- a/drivers/mfd/rk808.c +++ b/drivers/mfd/rk808.c @@ -1,11 +1,15 @@ /* - * MFD core driver for Rockchip RK808 + * MFD core driver for Rockchip RK808/RK818 * * Copyright (c) 2014, Fuzhou Rockchip Electronics Co., Ltd * * Author: Chris Zhong * Author: Zhang Qing * + * Copyright (C) 2016 PHYTEC Messtechnik GmbH + * + * Author: Wadim Egorov + * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, * version 2, as published by the Free Software Foundation. @@ -22,12 +26,7 @@ #include #include #include - -struct rk808_reg_data { - int addr; - int mask; - int value; -}; +#include static bool rk808_is_volatile_reg(struct device *dev, unsigned int reg) { @@ -57,6 +56,14 @@ static bool rk808_is_volatile_reg(struct device *dev, unsigned int reg) return false; } +static const struct regmap_config rk818_regmap_config = { + .reg_bits = 8, + .val_bits = 8, + .max_register = RK818_USB_CTRL_REG, + .cache_type = REGCACHE_RBTREE, + .volatile_reg = rk808_is_volatile_reg, +}; + static const struct regmap_config rk808_regmap_config = { .reg_bits = 8, .val_bits = 8, @@ -83,7 +90,17 @@ static const struct mfd_cell rk808s[] = { }, }; -static const struct rk808_reg_data pre_init_reg[] = { +static const struct mfd_cell rk818s[] = { + { .name = "rk808-clkout", }, + { .name = "rk808-regulator", }, + { + .name = "rk808-rtc", + .num_resources = ARRAY_SIZE(rtc_resources), + .resources = _resources[0], + }, +}; + +static const struct rk8xx_reg_data rk808_pre_init_reg[] = { { RK808_BUCK3_CONFIG_REG, BUCK_ILMIN_MASK, BUCK_ILMIN_150MA }, { RK808_BUCK4_CONFIG_REG, BUCK_ILMIN_MASK, BUCK_ILMIN_200MA }, { RK808_BOOST_CONFIG_REG, BOOST_ILMIN_MASK, BOOST_ILMIN_100MA }, @@ -94,6 +111,22 @@ static const struct rk808_reg_data pre_init_reg[] = { VB_LO_SEL_3500MV }, }; +static const struct rk8xx_reg_data rk818_pre_init_reg[] = { + { RK818_USB_CTRL_REG, RK818_USB_ILIM_SEL_MASK, + RK818_USB_ILMIN_2000MA }, + /* close charger when usb lower then 3.4V */ + { RK818_USB_CTRL_REG, RK818_USB_CHG_SD_VSEL_MASK, (0x7 << 4) }, + /* no action when vref */ + { RK818_H5V_EN_REG, BIT(1), RK818_REF_RDY_CTRL }, + /* enable HDMI 5V */ + { RK818_H5V_EN_REG, BIT(0), RK818_H5V_EN }, + /* improve efficiency */ + { RK818_BUCK2_CONFIG_REG, BUCK2_RATE_MASK, BUCK_ILMIN_250MA }, + { RK818_BUCK4_CONFIG_REG, BUCK_ILMIN_MASK, BUCK_ILMIN_250MA }, + { RK818_BOOST_CONFIG_REG, BOOST_ILMIN_MASK, BOOST_ILMIN_100MA }, + { RK808_VB_MON_REG, MASK_ALL, VB_LO_ACT | VB_LO_SEL_3500MV }, +}; + static const struct regmap_irq rk808_irqs[] = { /* INT_STS */ [RK808_IRQ_VOUT_LO] = { @@ -136,6 +169,76 @@ static const struct regmap_irq rk808_irqs[] = { }, }; +static const struct regmap_irq rk818_irqs[] = { + /* INT_STS */ + [RK818_IRQ_VOUT_LO] = { + .mask = RK818_IRQ_VOUT_LO_MSK, + .reg_offset = 0, + }, + [RK818_IRQ_VB_LO] = { + .mask = RK818_IRQ_VB_LO_MSK, + .reg_offset = 0, + }, +
[RESEND PATCH v5 1/5] mfd: RK808: Add RK818 support
The RK818 chip is a power management IC for multimedia and handheld devices. It contains the following components: - Regulators - RTC - Clkout - battery support Both chips RK808 and RK818 are using a similar register map. So we can reuse the RTC and Clkout functionality. Signed-off-by: Wadim Egorov --- drivers/mfd/Kconfig | 4 +- drivers/mfd/rk808.c | 231 ++ include/linux/mfd/rk808.h | 162 ++-- 3 files changed, 350 insertions(+), 47 deletions(-) diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig index 1bcf601..7ba464b 100644 --- a/drivers/mfd/Kconfig +++ b/drivers/mfd/Kconfig @@ -839,13 +839,13 @@ config MFD_RC5T583 different functionality of the device. config MFD_RK808 - tristate "Rockchip RK808 Power Management chip" + tristate "Rockchip RK808/RK818 Power Management chip" depends on I2C && OF select MFD_CORE select REGMAP_I2C select REGMAP_IRQ help - If you say yes here you get support for the RK808 + If you say yes here you get support for the RK808 and RK818 Power Management chips. This driver provides common support for accessing the device through I2C interface. The device supports multiple sub-devices diff --git a/drivers/mfd/rk808.c b/drivers/mfd/rk808.c index 49d7f62..3cf9724 100644 --- a/drivers/mfd/rk808.c +++ b/drivers/mfd/rk808.c @@ -1,11 +1,15 @@ /* - * MFD core driver for Rockchip RK808 + * MFD core driver for Rockchip RK808/RK818 * * Copyright (c) 2014, Fuzhou Rockchip Electronics Co., Ltd * * Author: Chris Zhong * Author: Zhang Qing * + * Copyright (C) 2016 PHYTEC Messtechnik GmbH + * + * Author: Wadim Egorov + * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, * version 2, as published by the Free Software Foundation. @@ -22,12 +26,7 @@ #include #include #include - -struct rk808_reg_data { - int addr; - int mask; - int value; -}; +#include static bool rk808_is_volatile_reg(struct device *dev, unsigned int reg) { @@ -57,6 +56,14 @@ static bool rk808_is_volatile_reg(struct device *dev, unsigned int reg) return false; } +static const struct regmap_config rk818_regmap_config = { + .reg_bits = 8, + .val_bits = 8, + .max_register = RK818_USB_CTRL_REG, + .cache_type = REGCACHE_RBTREE, + .volatile_reg = rk808_is_volatile_reg, +}; + static const struct regmap_config rk808_regmap_config = { .reg_bits = 8, .val_bits = 8, @@ -83,7 +90,17 @@ static const struct mfd_cell rk808s[] = { }, }; -static const struct rk808_reg_data pre_init_reg[] = { +static const struct mfd_cell rk818s[] = { + { .name = "rk808-clkout", }, + { .name = "rk808-regulator", }, + { + .name = "rk808-rtc", + .num_resources = ARRAY_SIZE(rtc_resources), + .resources = _resources[0], + }, +}; + +static const struct rk8xx_reg_data rk808_pre_init_reg[] = { { RK808_BUCK3_CONFIG_REG, BUCK_ILMIN_MASK, BUCK_ILMIN_150MA }, { RK808_BUCK4_CONFIG_REG, BUCK_ILMIN_MASK, BUCK_ILMIN_200MA }, { RK808_BOOST_CONFIG_REG, BOOST_ILMIN_MASK, BOOST_ILMIN_100MA }, @@ -94,6 +111,22 @@ static const struct rk808_reg_data pre_init_reg[] = { VB_LO_SEL_3500MV }, }; +static const struct rk8xx_reg_data rk818_pre_init_reg[] = { + { RK818_USB_CTRL_REG, RK818_USB_ILIM_SEL_MASK, + RK818_USB_ILMIN_2000MA }, + /* close charger when usb lower then 3.4V */ + { RK818_USB_CTRL_REG, RK818_USB_CHG_SD_VSEL_MASK, (0x7 << 4) }, + /* no action when vref */ + { RK818_H5V_EN_REG, BIT(1), RK818_REF_RDY_CTRL }, + /* enable HDMI 5V */ + { RK818_H5V_EN_REG, BIT(0), RK818_H5V_EN }, + /* improve efficiency */ + { RK818_BUCK2_CONFIG_REG, BUCK2_RATE_MASK, BUCK_ILMIN_250MA }, + { RK818_BUCK4_CONFIG_REG, BUCK_ILMIN_MASK, BUCK_ILMIN_250MA }, + { RK818_BOOST_CONFIG_REG, BOOST_ILMIN_MASK, BOOST_ILMIN_100MA }, + { RK808_VB_MON_REG, MASK_ALL, VB_LO_ACT | VB_LO_SEL_3500MV }, +}; + static const struct regmap_irq rk808_irqs[] = { /* INT_STS */ [RK808_IRQ_VOUT_LO] = { @@ -136,6 +169,76 @@ static const struct regmap_irq rk808_irqs[] = { }, }; +static const struct regmap_irq rk818_irqs[] = { + /* INT_STS */ + [RK818_IRQ_VOUT_LO] = { + .mask = RK818_IRQ_VOUT_LO_MSK, + .reg_offset = 0, + }, + [RK818_IRQ_VB_LO] = { + .mask = RK818_IRQ_VB_LO_MSK, + .reg_offset = 0, + }, + [RK818_IRQ_PWRON] = { + .mask = RK818_IRQ_PWRON_MSK, +