Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

mfd: rk808: Add RK818 support

The RK818 chip is a Power Management IC (PMIC) for multimedia and handheld
devices. It contains the following components:

- Regulators
- RTC
- Clocking
- Battery support

Both RK808 and RK818 chips are using a similar register map,
so we can reuse the RTC and Clocking functionality.

Signed-off-by: Wadim Egorov <w.egorov@phytec.de>
Tested-by: Andy Yan <andy.yan@rock-chips.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>

authored by

Wadim Egorov and committed by
Lee Jones
2eedcbfc 694d0d0b

+349 -49
+2 -2
drivers/mfd/Kconfig
··· 852 852 different functionality of the device. 853 853 854 854 config MFD_RK808 855 - tristate "Rockchip RK808 Power Management chip" 855 + tristate "Rockchip RK808/RK818 Power Management Chip" 856 856 depends on I2C && OF 857 857 select MFD_CORE 858 858 select REGMAP_I2C 859 859 select REGMAP_IRQ 860 860 help 861 - If you say yes here you get support for the RK808 861 + If you say yes here you get support for the RK808 and RK818 862 862 Power Management chips. 863 863 This driver provides common support for accessing the device 864 864 through I2C interface. The device supports multiple sub-devices
+201 -37
drivers/mfd/rk808.c
··· 1 1 /* 2 - * MFD core driver for Rockchip RK808 2 + * MFD core driver for Rockchip RK808/RK818 3 3 * 4 4 * Copyright (c) 2014, Fuzhou Rockchip Electronics Co., Ltd 5 5 * 6 6 * Author: Chris Zhong <zyw@rock-chips.com> 7 7 * Author: Zhang Qing <zhangqing@rock-chips.com> 8 + * 9 + * Copyright (C) 2016 PHYTEC Messtechnik GmbH 10 + * 11 + * Author: Wadim Egorov <w.egorov@phytec.de> 8 12 * 9 13 * This program is free software; you can redistribute it and/or modify it 10 14 * under the terms and conditions of the GNU General Public License, ··· 25 21 #include <linux/mfd/rk808.h> 26 22 #include <linux/mfd/core.h> 27 23 #include <linux/module.h> 24 + #include <linux/of_device.h> 28 25 #include <linux/regmap.h> 29 26 30 27 struct rk808_reg_data { ··· 62 57 return false; 63 58 } 64 59 60 + static const struct regmap_config rk818_regmap_config = { 61 + .reg_bits = 8, 62 + .val_bits = 8, 63 + .max_register = RK818_USB_CTRL_REG, 64 + .cache_type = REGCACHE_RBTREE, 65 + .volatile_reg = rk808_is_volatile_reg, 66 + }; 67 + 65 68 static const struct regmap_config rk808_regmap_config = { 66 69 .reg_bits = 8, 67 70 .val_bits = 8, ··· 92 79 { 93 80 .name = "rk808-rtc", 94 81 .num_resources = ARRAY_SIZE(rtc_resources), 95 - .resources = &rtc_resources[0], 82 + .resources = rtc_resources, 96 83 }, 97 84 }; 98 85 99 - static const struct rk808_reg_data pre_init_reg[] = { 86 + static const struct mfd_cell rk818s[] = { 87 + { .name = "rk808-clkout", }, 88 + { .name = "rk808-regulator", }, 89 + { 90 + .name = "rk808-rtc", 91 + .num_resources = ARRAY_SIZE(rtc_resources), 92 + .resources = rtc_resources, 93 + }, 94 + }; 95 + 96 + static const struct rk808_reg_data rk808_pre_init_reg[] = { 100 97 { RK808_BUCK3_CONFIG_REG, BUCK_ILMIN_MASK, BUCK_ILMIN_150MA }, 101 98 { RK808_BUCK4_CONFIG_REG, BUCK_ILMIN_MASK, BUCK_ILMIN_200MA }, 102 99 { RK808_BOOST_CONFIG_REG, BOOST_ILMIN_MASK, BOOST_ILMIN_100MA }, ··· 114 91 { RK808_BUCK2_CONFIG_REG, BUCK2_RATE_MASK, BUCK_ILMIN_200MA }, 115 92 { RK808_DCDC_UV_ACT_REG, BUCK_UV_ACT_MASK, BUCK_UV_ACT_DISABLE}, 116 93 { RK808_VB_MON_REG, MASK_ALL, VB_LO_ACT | 94 + VB_LO_SEL_3500MV }, 95 + }; 96 + 97 + static const struct rk808_reg_data rk818_pre_init_reg[] = { 98 + /* improve efficiency */ 99 + { RK818_BUCK2_CONFIG_REG, BUCK2_RATE_MASK, BUCK_ILMIN_250MA }, 100 + { RK818_BUCK4_CONFIG_REG, BUCK_ILMIN_MASK, BUCK_ILMIN_250MA }, 101 + { RK818_BOOST_CONFIG_REG, BOOST_ILMIN_MASK, BOOST_ILMIN_100MA }, 102 + { RK818_USB_CTRL_REG, RK818_USB_ILIM_SEL_MASK, 103 + RK818_USB_ILMIN_2000MA }, 104 + /* close charger when usb lower then 3.4V */ 105 + { RK818_USB_CTRL_REG, RK818_USB_CHG_SD_VSEL_MASK, 106 + (0x7 << 4) }, 107 + /* no action when vref */ 108 + { RK818_H5V_EN_REG, BIT(1), RK818_REF_RDY_CTRL }, 109 + /* enable HDMI 5V */ 110 + { RK818_H5V_EN_REG, BIT(0), RK818_H5V_EN }, 111 + { RK808_VB_MON_REG, MASK_ALL, VB_LO_ACT | 117 112 VB_LO_SEL_3500MV }, 118 113 }; 119 114 ··· 177 136 }, 178 137 }; 179 138 139 + static const struct regmap_irq rk818_irqs[] = { 140 + /* INT_STS */ 141 + [RK818_IRQ_VOUT_LO] = { 142 + .mask = RK818_IRQ_VOUT_LO_MSK, 143 + .reg_offset = 0, 144 + }, 145 + [RK818_IRQ_VB_LO] = { 146 + .mask = RK818_IRQ_VB_LO_MSK, 147 + .reg_offset = 0, 148 + }, 149 + [RK818_IRQ_PWRON] = { 150 + .mask = RK818_IRQ_PWRON_MSK, 151 + .reg_offset = 0, 152 + }, 153 + [RK818_IRQ_PWRON_LP] = { 154 + .mask = RK818_IRQ_PWRON_LP_MSK, 155 + .reg_offset = 0, 156 + }, 157 + [RK818_IRQ_HOTDIE] = { 158 + .mask = RK818_IRQ_HOTDIE_MSK, 159 + .reg_offset = 0, 160 + }, 161 + [RK818_IRQ_RTC_ALARM] = { 162 + .mask = RK818_IRQ_RTC_ALARM_MSK, 163 + .reg_offset = 0, 164 + }, 165 + [RK818_IRQ_RTC_PERIOD] = { 166 + .mask = RK818_IRQ_RTC_PERIOD_MSK, 167 + .reg_offset = 0, 168 + }, 169 + [RK818_IRQ_USB_OV] = { 170 + .mask = RK818_IRQ_USB_OV_MSK, 171 + .reg_offset = 0, 172 + }, 173 + 174 + /* INT_STS2 */ 175 + [RK818_IRQ_PLUG_IN] = { 176 + .mask = RK818_IRQ_PLUG_IN_MSK, 177 + .reg_offset = 1, 178 + }, 179 + [RK818_IRQ_PLUG_OUT] = { 180 + .mask = RK818_IRQ_PLUG_OUT_MSK, 181 + .reg_offset = 1, 182 + }, 183 + [RK818_IRQ_CHG_OK] = { 184 + .mask = RK818_IRQ_CHG_OK_MSK, 185 + .reg_offset = 1, 186 + }, 187 + [RK818_IRQ_CHG_TE] = { 188 + .mask = RK818_IRQ_CHG_TE_MSK, 189 + .reg_offset = 1, 190 + }, 191 + [RK818_IRQ_CHG_TS1] = { 192 + .mask = RK818_IRQ_CHG_TS1_MSK, 193 + .reg_offset = 1, 194 + }, 195 + [RK818_IRQ_TS2] = { 196 + .mask = RK818_IRQ_TS2_MSK, 197 + .reg_offset = 1, 198 + }, 199 + [RK818_IRQ_CHG_CVTLIM] = { 200 + .mask = RK818_IRQ_CHG_CVTLIM_MSK, 201 + .reg_offset = 1, 202 + }, 203 + [RK818_IRQ_DISCHG_ILIM] = { 204 + .mask = RK818_IRQ_DISCHG_ILIM_MSK, 205 + .reg_offset = 1, 206 + }, 207 + }; 208 + 180 209 static struct regmap_irq_chip rk808_irq_chip = { 181 210 .name = "rk808", 182 211 .irqs = rk808_irqs, ··· 256 145 .status_base = RK808_INT_STS_REG1, 257 146 .mask_base = RK808_INT_STS_MSK_REG1, 258 147 .ack_base = RK808_INT_STS_REG1, 148 + .init_ack_masked = true, 149 + }; 150 + 151 + static struct regmap_irq_chip rk818_irq_chip = { 152 + .name = "rk818", 153 + .irqs = rk818_irqs, 154 + .num_irqs = ARRAY_SIZE(rk818_irqs), 155 + .num_regs = 2, 156 + .irq_reg_stride = 2, 157 + .status_base = RK818_INT_STS_REG1, 158 + .mask_base = RK818_INT_STS_MSK_REG1, 159 + .ack_base = RK818_INT_STS_REG1, 259 160 .init_ack_masked = true, 260 161 }; 261 162 ··· 290 167 dev_err(&rk808_i2c_client->dev, "power off error!\n"); 291 168 } 292 169 170 + static const struct of_device_id rk808_of_match[] = { 171 + { .compatible = "rockchip,rk808" }, 172 + { .compatible = "rockchip,rk818" }, 173 + { }, 174 + }; 175 + MODULE_DEVICE_TABLE(of, rk808_of_match); 176 + 293 177 static int rk808_probe(struct i2c_client *client, 294 178 const struct i2c_device_id *id) 295 179 { 296 180 struct device_node *np = client->dev.of_node; 297 181 struct rk808 *rk808; 182 + const struct rk808_reg_data *pre_init_reg; 183 + const struct mfd_cell *cells; 184 + int nr_pre_init_regs; 185 + int nr_cells; 298 186 int pm_off = 0; 299 187 int ret; 300 188 int i; 189 + 190 + rk808 = devm_kzalloc(&client->dev, sizeof(*rk808), GFP_KERNEL); 191 + if (!rk808) 192 + return -ENOMEM; 193 + 194 + rk808->variant = i2c_smbus_read_word_data(client, RK808_ID_MSB); 195 + if (rk808->variant < 0) { 196 + dev_err(&client->dev, "Failed to read the chip id at 0x%02x\n", 197 + RK808_ID_MSB); 198 + return rk808->variant; 199 + } 200 + 201 + dev_dbg(&client->dev, "Chip id: 0x%x\n", (unsigned int)rk808->variant); 202 + 203 + switch (rk808->variant) { 204 + case RK808_ID: 205 + rk808->regmap_cfg = &rk808_regmap_config; 206 + rk808->regmap_irq_chip = &rk808_irq_chip; 207 + pre_init_reg = rk808_pre_init_reg; 208 + nr_pre_init_regs = ARRAY_SIZE(rk808_pre_init_reg); 209 + cells = rk808s; 210 + nr_cells = ARRAY_SIZE(rk808s); 211 + break; 212 + case RK818_ID: 213 + rk808->regmap_cfg = &rk818_regmap_config; 214 + rk808->regmap_irq_chip = &rk818_irq_chip; 215 + pre_init_reg = rk818_pre_init_reg; 216 + nr_pre_init_regs = ARRAY_SIZE(rk818_pre_init_reg); 217 + cells = rk818s; 218 + nr_cells = ARRAY_SIZE(rk818s); 219 + break; 220 + default: 221 + dev_err(&client->dev, "Unsupported RK8XX ID %lu\n", 222 + rk808->variant); 223 + return -EINVAL; 224 + } 225 + 226 + rk808->i2c = client; 227 + i2c_set_clientdata(client, rk808); 228 + 229 + rk808->regmap = devm_regmap_init_i2c(client, rk808->regmap_cfg); 230 + if (IS_ERR(rk808->regmap)) { 231 + dev_err(&client->dev, "regmap initialization failed\n"); 232 + return PTR_ERR(rk808->regmap); 233 + } 301 234 302 235 if (!client->irq) { 303 236 dev_err(&client->dev, "No interrupt support, no core IRQ\n"); 304 237 return -EINVAL; 305 238 } 306 239 307 - rk808 = devm_kzalloc(&client->dev, sizeof(*rk808), GFP_KERNEL); 308 - if (!rk808) 309 - return -ENOMEM; 310 - 311 - rk808->regmap = devm_regmap_init_i2c(client, &rk808_regmap_config); 312 - if (IS_ERR(rk808->regmap)) { 313 - dev_err(&client->dev, "regmap initialization failed\n"); 314 - return PTR_ERR(rk808->regmap); 315 - } 316 - 317 - for (i = 0; i < ARRAY_SIZE(pre_init_reg); i++) { 318 - ret = regmap_update_bits(rk808->regmap, pre_init_reg[i].addr, 319 - pre_init_reg[i].mask, 320 - pre_init_reg[i].value); 321 - if (ret) { 322 - dev_err(&client->dev, 323 - "0x%x write err\n", pre_init_reg[i].addr); 324 - return ret; 325 - } 326 - } 327 - 328 240 ret = regmap_add_irq_chip(rk808->regmap, client->irq, 329 241 IRQF_ONESHOT, -1, 330 - &rk808_irq_chip, &rk808->irq_data); 242 + rk808->regmap_irq_chip, &rk808->irq_data); 331 243 if (ret) { 332 244 dev_err(&client->dev, "Failed to add irq_chip %d\n", ret); 333 245 return ret; 334 246 } 335 247 336 - rk808->i2c = client; 337 - i2c_set_clientdata(client, rk808); 248 + for (i = 0; i < nr_pre_init_regs; i++) { 249 + ret = regmap_update_bits(rk808->regmap, 250 + pre_init_reg[i].addr, 251 + pre_init_reg[i].mask, 252 + pre_init_reg[i].value); 253 + if (ret) { 254 + dev_err(&client->dev, 255 + "0x%x write err\n", 256 + pre_init_reg[i].addr); 257 + return ret; 258 + } 259 + } 338 260 339 - ret = devm_mfd_add_devices(&client->dev, -1, 340 - rk808s, ARRAY_SIZE(rk808s), NULL, 0, 341 - regmap_irq_get_domain(rk808->irq_data)); 261 + ret = devm_mfd_add_devices(&client->dev, PLATFORM_DEVID_NONE, 262 + cells, nr_cells, NULL, 0, 263 + regmap_irq_get_domain(rk808->irq_data)); 342 264 if (ret) { 343 265 dev_err(&client->dev, "failed to add MFD devices %d\n", ret); 344 266 goto err_irq; ··· 413 245 return 0; 414 246 } 415 247 416 - static const struct of_device_id rk808_of_match[] = { 417 - { .compatible = "rockchip,rk808" }, 418 - { }, 419 - }; 420 - MODULE_DEVICE_TABLE(of, rk808_of_match); 421 - 422 248 static const struct i2c_device_id rk808_ids[] = { 423 249 { "rk808" }, 250 + { "rk818" }, 424 251 { }, 425 252 }; 426 253 MODULE_DEVICE_TABLE(i2c, rk808_ids); ··· 435 272 MODULE_LICENSE("GPL"); 436 273 MODULE_AUTHOR("Chris Zhong <zyw@rock-chips.com>"); 437 274 MODULE_AUTHOR("Zhang Qing <zhangqing@rock-chips.com>"); 438 - MODULE_DESCRIPTION("RK808 PMIC driver"); 275 + MODULE_AUTHOR("Wadim Egorov <w.egorov@phytec.de>"); 276 + MODULE_DESCRIPTION("RK808/RK818 PMIC driver");
+146 -10
include/linux/mfd/rk808.h
··· 1 1 /* 2 - * rk808.h for Rockchip RK808 2 + * Register definitions for Rockchip's RK808/RK818 PMIC 3 3 * 4 4 * Copyright (c) 2014, Fuzhou Rockchip Electronics Co., Ltd 5 5 * 6 6 * Author: Chris Zhong <zyw@rock-chips.com> 7 7 * Author: Zhang Qing <zhangqing@rock-chips.com> 8 + * 9 + * Copyright (C) 2016 PHYTEC Messtechnik GmbH 10 + * 11 + * Author: Wadim Egorov <w.egorov@phytec.de> 8 12 * 9 13 * This program is free software; you can redistribute it and/or modify it 10 14 * under the terms and conditions of the GNU General Public License, ··· 20 16 * more details. 21 17 */ 22 18 23 - #ifndef __LINUX_REGULATOR_rk808_H 24 - #define __LINUX_REGULATOR_rk808_H 19 + #ifndef __LINUX_REGULATOR_RK808_H 20 + #define __LINUX_REGULATOR_RK808_H 25 21 26 22 #include <linux/regulator/machine.h> 27 23 #include <linux/regmap.h> ··· 32 28 33 29 #define RK808_DCDC1 0 /* (0+RK808_START) */ 34 30 #define RK808_LDO1 4 /* (4+RK808_START) */ 35 - #define RK808_NUM_REGULATORS 14 31 + #define RK808_NUM_REGULATORS 14 36 32 37 33 enum rk808_reg { 38 34 RK808_ID_DCDC1, ··· 69 65 #define RK808_RTC_INT_REG 0x12 70 66 #define RK808_RTC_COMP_LSB_REG 0x13 71 67 #define RK808_RTC_COMP_MSB_REG 0x14 68 + #define RK808_ID_MSB 0x17 69 + #define RK808_ID_LSB 0x18 72 70 #define RK808_CLK32OUT_REG 0x20 73 71 #define RK808_VB_MON_REG 0x21 74 72 #define RK808_THERMAL_REG 0x22 ··· 121 115 #define RK808_INT_STS_MSK_REG2 0x4f 122 116 #define RK808_IO_POL_REG 0x50 123 117 124 - /* IRQ Definitions */ 118 + /* RK818 */ 119 + #define RK818_DCDC1 0 120 + #define RK818_LDO1 4 121 + #define RK818_NUM_REGULATORS 17 122 + 123 + enum rk818_reg { 124 + RK818_ID_DCDC1, 125 + RK818_ID_DCDC2, 126 + RK818_ID_DCDC3, 127 + RK818_ID_DCDC4, 128 + RK818_ID_BOOST, 129 + RK818_ID_LDO1, 130 + RK818_ID_LDO2, 131 + RK818_ID_LDO3, 132 + RK818_ID_LDO4, 133 + RK818_ID_LDO5, 134 + RK818_ID_LDO6, 135 + RK818_ID_LDO7, 136 + RK818_ID_LDO8, 137 + RK818_ID_LDO9, 138 + RK818_ID_SWITCH, 139 + RK818_ID_HDMI_SWITCH, 140 + RK818_ID_OTG_SWITCH, 141 + }; 142 + 143 + #define RK818_DCDC_EN_REG 0x23 144 + #define RK818_LDO_EN_REG 0x24 145 + #define RK818_SLEEP_SET_OFF_REG1 0x25 146 + #define RK818_SLEEP_SET_OFF_REG2 0x26 147 + #define RK818_DCDC_UV_STS_REG 0x27 148 + #define RK818_DCDC_UV_ACT_REG 0x28 149 + #define RK818_LDO_UV_STS_REG 0x29 150 + #define RK818_LDO_UV_ACT_REG 0x2a 151 + #define RK818_DCDC_PG_REG 0x2b 152 + #define RK818_LDO_PG_REG 0x2c 153 + #define RK818_VOUT_MON_TDB_REG 0x2d 154 + #define RK818_BUCK1_CONFIG_REG 0x2e 155 + #define RK818_BUCK1_ON_VSEL_REG 0x2f 156 + #define RK818_BUCK1_SLP_VSEL_REG 0x30 157 + #define RK818_BUCK2_CONFIG_REG 0x32 158 + #define RK818_BUCK2_ON_VSEL_REG 0x33 159 + #define RK818_BUCK2_SLP_VSEL_REG 0x34 160 + #define RK818_BUCK3_CONFIG_REG 0x36 161 + #define RK818_BUCK4_CONFIG_REG 0x37 162 + #define RK818_BUCK4_ON_VSEL_REG 0x38 163 + #define RK818_BUCK4_SLP_VSEL_REG 0x39 164 + #define RK818_BOOST_CONFIG_REG 0x3a 165 + #define RK818_LDO1_ON_VSEL_REG 0x3b 166 + #define RK818_LDO1_SLP_VSEL_REG 0x3c 167 + #define RK818_LDO2_ON_VSEL_REG 0x3d 168 + #define RK818_LDO2_SLP_VSEL_REG 0x3e 169 + #define RK818_LDO3_ON_VSEL_REG 0x3f 170 + #define RK818_LDO3_SLP_VSEL_REG 0x40 171 + #define RK818_LDO4_ON_VSEL_REG 0x41 172 + #define RK818_LDO4_SLP_VSEL_REG 0x42 173 + #define RK818_LDO5_ON_VSEL_REG 0x43 174 + #define RK818_LDO5_SLP_VSEL_REG 0x44 175 + #define RK818_LDO6_ON_VSEL_REG 0x45 176 + #define RK818_LDO6_SLP_VSEL_REG 0x46 177 + #define RK818_LDO7_ON_VSEL_REG 0x47 178 + #define RK818_LDO7_SLP_VSEL_REG 0x48 179 + #define RK818_LDO8_ON_VSEL_REG 0x49 180 + #define RK818_LDO8_SLP_VSEL_REG 0x4a 181 + #define RK818_BOOST_LDO9_ON_VSEL_REG 0x54 182 + #define RK818_BOOST_LDO9_SLP_VSEL_REG 0x55 183 + #define RK818_DEVCTRL_REG 0x4b 184 + #define RK818_INT_STS_REG1 0X4c 185 + #define RK818_INT_STS_MSK_REG1 0x4d 186 + #define RK818_INT_STS_REG2 0x4e 187 + #define RK818_INT_STS_MSK_REG2 0x4f 188 + #define RK818_IO_POL_REG 0x50 189 + #define RK818_H5V_EN_REG 0x52 190 + #define RK818_SLEEP_SET_OFF_REG3 0x53 191 + #define RK818_BOOST_LDO9_ON_VSEL_REG 0x54 192 + #define RK818_BOOST_LDO9_SLP_VSEL_REG 0x55 193 + #define RK818_BOOST_CTRL_REG 0x56 194 + #define RK818_DCDC_ILMAX 0x90 195 + #define RK818_USB_CTRL_REG 0xa1 196 + 197 + #define RK818_H5V_EN BIT(0) 198 + #define RK818_REF_RDY_CTRL BIT(1) 199 + #define RK818_USB_ILIM_SEL_MASK 0xf 200 + #define RK818_USB_ILMIN_2000MA 0x7 201 + #define RK818_USB_CHG_SD_VSEL_MASK 0x70 202 + 203 + /* RK808 IRQ Definitions */ 125 204 #define RK808_IRQ_VOUT_LO 0 126 205 #define RK808_IRQ_VB_LO 1 127 206 #define RK808_IRQ_PWRON 2 ··· 227 136 #define RK808_IRQ_RTC_PERIOD_MSK BIT(6) 228 137 #define RK808_IRQ_PLUG_IN_INT_MSK BIT(0) 229 138 #define RK808_IRQ_PLUG_OUT_INT_MSK BIT(1) 139 + 140 + /* RK818 IRQ Definitions */ 141 + #define RK818_IRQ_VOUT_LO 0 142 + #define RK818_IRQ_VB_LO 1 143 + #define RK818_IRQ_PWRON 2 144 + #define RK818_IRQ_PWRON_LP 3 145 + #define RK818_IRQ_HOTDIE 4 146 + #define RK818_IRQ_RTC_ALARM 5 147 + #define RK818_IRQ_RTC_PERIOD 6 148 + #define RK818_IRQ_USB_OV 7 149 + #define RK818_IRQ_PLUG_IN 8 150 + #define RK818_IRQ_PLUG_OUT 9 151 + #define RK818_IRQ_CHG_OK 10 152 + #define RK818_IRQ_CHG_TE 11 153 + #define RK818_IRQ_CHG_TS1 12 154 + #define RK818_IRQ_TS2 13 155 + #define RK818_IRQ_CHG_CVTLIM 14 156 + #define RK818_IRQ_DISCHG_ILIM 7 157 + 158 + #define RK818_IRQ_VOUT_LO_MSK BIT(0) 159 + #define RK818_IRQ_VB_LO_MSK BIT(1) 160 + #define RK818_IRQ_PWRON_MSK BIT(2) 161 + #define RK818_IRQ_PWRON_LP_MSK BIT(3) 162 + #define RK818_IRQ_HOTDIE_MSK BIT(4) 163 + #define RK818_IRQ_RTC_ALARM_MSK BIT(5) 164 + #define RK818_IRQ_RTC_PERIOD_MSK BIT(6) 165 + #define RK818_IRQ_USB_OV_MSK BIT(7) 166 + #define RK818_IRQ_PLUG_IN_MSK BIT(0) 167 + #define RK818_IRQ_PLUG_OUT_MSK BIT(1) 168 + #define RK818_IRQ_CHG_OK_MSK BIT(2) 169 + #define RK818_IRQ_CHG_TE_MSK BIT(3) 170 + #define RK818_IRQ_CHG_TS1_MSK BIT(4) 171 + #define RK818_IRQ_TS2_MSK BIT(5) 172 + #define RK818_IRQ_CHG_CVTLIM_MSK BIT(6) 173 + #define RK818_IRQ_DISCHG_ILIM_MSK BIT(7) 174 + 175 + #define RK818_NUM_IRQ 16 230 176 231 177 #define RK808_VBAT_LOW_2V8 0x00 232 178 #define RK808_VBAT_LOW_2V9 0x01 ··· 319 191 BOOST_ILMIN_250MA, 320 192 }; 321 193 322 - struct rk808 { 323 - struct i2c_client *i2c; 324 - struct regmap_irq_chip_data *irq_data; 325 - struct regmap *regmap; 194 + enum { 195 + RK808_ID = 0x0000, 196 + RK818_ID = 0x8181, 326 197 }; 327 - #endif /* __LINUX_REGULATOR_rk808_H */ 198 + 199 + struct rk808 { 200 + struct i2c_client *i2c; 201 + struct regmap_irq_chip_data *irq_data; 202 + struct regmap *regmap; 203 + long variant; 204 + const struct regmap_config *regmap_cfg; 205 + const struct regmap_irq_chip *regmap_irq_chip; 206 + }; 207 + #endif /* __LINUX_REGULATOR_RK808_H */