cachepc-linux

Fork of AMDESE/linux with modifications for CachePC side-channel attack
git clone https://git.sinitax.com/sinitax/cachepc-linux
Log | Files | Refs | README | LICENSE | sfeed.txt

rk808-regulator.c (44593B)


      1// SPDX-License-Identifier: GPL-2.0-only
      2/*
      3 * Regulator driver for Rockchip RK805/RK808/RK818
      4 *
      5 * Copyright (c) 2014, Fuzhou Rockchip Electronics Co., Ltd
      6 *
      7 * Author: Chris Zhong <zyw@rock-chips.com>
      8 * Author: Zhang Qing <zhangqing@rock-chips.com>
      9 *
     10 * Copyright (C) 2016 PHYTEC Messtechnik GmbH
     11 *
     12 * Author: Wadim Egorov <w.egorov@phytec.de>
     13 */
     14
     15#include <linux/delay.h>
     16#include <linux/gpio.h>
     17#include <linux/i2c.h>
     18#include <linux/module.h>
     19#include <linux/of_device.h>
     20#include <linux/of_gpio.h>
     21#include <linux/mfd/rk808.h>
     22#include <linux/regulator/driver.h>
     23#include <linux/regulator/of_regulator.h>
     24#include <linux/gpio/consumer.h>
     25
     26/* Field Definitions */
     27#define RK808_BUCK_VSEL_MASK	0x3f
     28#define RK808_BUCK4_VSEL_MASK	0xf
     29#define RK808_LDO_VSEL_MASK	0x1f
     30
     31#define RK809_BUCK5_VSEL_MASK		0x7
     32
     33#define RK817_LDO_VSEL_MASK		0x7f
     34#define RK817_BOOST_VSEL_MASK		0x7
     35#define RK817_BUCK_VSEL_MASK		0x7f
     36
     37#define RK818_BUCK_VSEL_MASK		0x3f
     38#define RK818_BUCK4_VSEL_MASK		0x1f
     39#define RK818_LDO_VSEL_MASK		0x1f
     40#define RK818_LDO3_ON_VSEL_MASK		0xf
     41#define RK818_BOOST_ON_VSEL_MASK	0xe0
     42
     43/* Ramp rate definitions for buck1 / buck2 only */
     44#define RK808_RAMP_RATE_OFFSET		3
     45#define RK808_RAMP_RATE_MASK		(3 << RK808_RAMP_RATE_OFFSET)
     46#define RK808_RAMP_RATE_2MV_PER_US	(0 << RK808_RAMP_RATE_OFFSET)
     47#define RK808_RAMP_RATE_4MV_PER_US	(1 << RK808_RAMP_RATE_OFFSET)
     48#define RK808_RAMP_RATE_6MV_PER_US	(2 << RK808_RAMP_RATE_OFFSET)
     49#define RK808_RAMP_RATE_10MV_PER_US	(3 << RK808_RAMP_RATE_OFFSET)
     50
     51#define RK808_DVS2_POL		BIT(2)
     52#define RK808_DVS1_POL		BIT(1)
     53
     54/* Offset from XXX_ON_VSEL to XXX_SLP_VSEL */
     55#define RK808_SLP_REG_OFFSET 1
     56
     57/* Offset from XXX_ON_VSEL to XXX_DVS_VSEL */
     58#define RK808_DVS_REG_OFFSET 2
     59
     60/* Offset from XXX_EN_REG to SLEEP_SET_OFF_XXX */
     61#define RK808_SLP_SET_OFF_REG_OFFSET 2
     62
     63/* max steps for increase voltage of Buck1/2, equal 100mv*/
     64#define MAX_STEPS_ONE_TIME 8
     65
     66#define ENABLE_MASK(id)			(BIT(id) | BIT(4 + (id)))
     67#define DISABLE_VAL(id)			(BIT(4 + (id)))
     68
     69#define RK817_BOOST_DESC(_id, _match, _supply, _min, _max, _step, _vreg,\
     70	_vmask, _ereg, _emask, _enval, _disval, _etime, m_drop)		\
     71	{							\
     72		.name		= (_match),				\
     73		.supply_name	= (_supply),				\
     74		.of_match	= of_match_ptr(_match),			\
     75		.regulators_node = of_match_ptr("regulators"),		\
     76		.type		= REGULATOR_VOLTAGE,			\
     77		.id		= (_id),				\
     78		.n_voltages	= (((_max) - (_min)) / (_step) + 1),	\
     79		.owner		= THIS_MODULE,				\
     80		.min_uV		= (_min) * 1000,			\
     81		.uV_step	= (_step) * 1000,			\
     82		.vsel_reg	= (_vreg),				\
     83		.vsel_mask	= (_vmask),				\
     84		.enable_reg	= (_ereg),				\
     85		.enable_mask	= (_emask),				\
     86		.enable_val     = (_enval),				\
     87		.disable_val     = (_disval),				\
     88		.enable_time	= (_etime),				\
     89		.min_dropout_uV = (m_drop) * 1000,			\
     90		.ops		= &rk817_boost_ops,			\
     91	}
     92
     93#define RK8XX_DESC_COM(_id, _match, _supply, _min, _max, _step, _vreg,	\
     94	_vmask, _ereg, _emask, _enval, _disval, _etime, _ops)		\
     95	{								\
     96		.name		= (_match),				\
     97		.supply_name	= (_supply),				\
     98		.of_match	= of_match_ptr(_match),			\
     99		.regulators_node = of_match_ptr("regulators"),		\
    100		.type		= REGULATOR_VOLTAGE,			\
    101		.id		= (_id),				\
    102		.n_voltages	= (((_max) - (_min)) / (_step) + 1),	\
    103		.owner		= THIS_MODULE,				\
    104		.min_uV		= (_min) * 1000,			\
    105		.uV_step	= (_step) * 1000,			\
    106		.vsel_reg	= (_vreg),				\
    107		.vsel_mask	= (_vmask),				\
    108		.enable_reg	= (_ereg),				\
    109		.enable_mask	= (_emask),				\
    110		.enable_val     = (_enval),				\
    111		.disable_val     = (_disval),				\
    112		.enable_time	= (_etime),				\
    113		.ops		= _ops,			\
    114	}
    115
    116#define RK805_DESC(_id, _match, _supply, _min, _max, _step, _vreg,	\
    117	_vmask, _ereg, _emask, _etime)					\
    118	RK8XX_DESC_COM(_id, _match, _supply, _min, _max, _step, _vreg,	\
    119	_vmask, _ereg, _emask, 0, 0, _etime, &rk805_reg_ops)
    120
    121#define RK8XX_DESC(_id, _match, _supply, _min, _max, _step, _vreg,	\
    122	_vmask, _ereg, _emask, _etime)					\
    123	RK8XX_DESC_COM(_id, _match, _supply, _min, _max, _step, _vreg,	\
    124	_vmask, _ereg, _emask, 0, 0, _etime, &rk808_reg_ops)
    125
    126#define RK817_DESC(_id, _match, _supply, _min, _max, _step, _vreg,	\
    127	_vmask, _ereg, _emask, _disval, _etime)				\
    128	RK8XX_DESC_COM(_id, _match, _supply, _min, _max, _step, _vreg,	\
    129	_vmask, _ereg, _emask, _emask, _disval, _etime, &rk817_reg_ops)
    130
    131#define RKXX_DESC_SWITCH_COM(_id, _match, _supply, _ereg, _emask,	\
    132	_enval, _disval, _ops)						\
    133	{								\
    134		.name		= (_match),				\
    135		.supply_name	= (_supply),				\
    136		.of_match	= of_match_ptr(_match),			\
    137		.regulators_node = of_match_ptr("regulators"),		\
    138		.type		= REGULATOR_VOLTAGE,			\
    139		.id		= (_id),				\
    140		.enable_reg	= (_ereg),				\
    141		.enable_mask	= (_emask),				\
    142		.enable_val     = (_enval),				\
    143		.disable_val     = (_disval),				\
    144		.owner		= THIS_MODULE,				\
    145		.ops		= _ops					\
    146	}
    147
    148#define RK817_DESC_SWITCH(_id, _match, _supply, _ereg, _emask,		\
    149	_disval)							\
    150	RKXX_DESC_SWITCH_COM(_id, _match, _supply, _ereg, _emask,	\
    151	_emask, _disval, &rk817_switch_ops)
    152
    153#define RK8XX_DESC_SWITCH(_id, _match, _supply, _ereg, _emask)		\
    154	RKXX_DESC_SWITCH_COM(_id, _match, _supply, _ereg, _emask,	\
    155	0, 0, &rk808_switch_ops)
    156
    157struct rk808_regulator_data {
    158	struct gpio_desc *dvs_gpio[2];
    159};
    160
    161static const struct linear_range rk808_ldo3_voltage_ranges[] = {
    162	REGULATOR_LINEAR_RANGE(800000, 0, 13, 100000),
    163	REGULATOR_LINEAR_RANGE(2500000, 15, 15, 0),
    164};
    165
    166#define RK809_BUCK5_SEL_CNT		(8)
    167
    168static const struct linear_range rk809_buck5_voltage_ranges[] = {
    169	REGULATOR_LINEAR_RANGE(1500000, 0, 0, 0),
    170	REGULATOR_LINEAR_RANGE(1800000, 1, 3, 200000),
    171	REGULATOR_LINEAR_RANGE(2800000, 4, 5, 200000),
    172	REGULATOR_LINEAR_RANGE(3300000, 6, 7, 300000),
    173};
    174
    175#define RK817_BUCK1_MIN0 500000
    176#define RK817_BUCK1_MAX0 1500000
    177
    178#define RK817_BUCK1_MIN1 1600000
    179#define RK817_BUCK1_MAX1 2400000
    180
    181#define RK817_BUCK3_MAX1 3400000
    182
    183#define RK817_BUCK1_STP0 12500
    184#define RK817_BUCK1_STP1 100000
    185
    186#define RK817_BUCK1_SEL0 ((RK817_BUCK1_MAX0 - RK817_BUCK1_MIN0) /\
    187						  RK817_BUCK1_STP0)
    188#define RK817_BUCK1_SEL1 ((RK817_BUCK1_MAX1 - RK817_BUCK1_MIN1) /\
    189						  RK817_BUCK1_STP1)
    190
    191#define RK817_BUCK3_SEL1 ((RK817_BUCK3_MAX1 - RK817_BUCK1_MIN1) /\
    192						  RK817_BUCK1_STP1)
    193
    194#define RK817_BUCK1_SEL_CNT (RK817_BUCK1_SEL0 + RK817_BUCK1_SEL1 + 1)
    195#define RK817_BUCK3_SEL_CNT (RK817_BUCK1_SEL0 + RK817_BUCK3_SEL1 + 1)
    196
    197static const struct linear_range rk817_buck1_voltage_ranges[] = {
    198	REGULATOR_LINEAR_RANGE(RK817_BUCK1_MIN0, 0,
    199			       RK817_BUCK1_SEL0, RK817_BUCK1_STP0),
    200	REGULATOR_LINEAR_RANGE(RK817_BUCK1_MIN1, RK817_BUCK1_SEL0 + 1,
    201			       RK817_BUCK1_SEL_CNT, RK817_BUCK1_STP1),
    202};
    203
    204static const struct linear_range rk817_buck3_voltage_ranges[] = {
    205	REGULATOR_LINEAR_RANGE(RK817_BUCK1_MIN0, 0,
    206			       RK817_BUCK1_SEL0, RK817_BUCK1_STP0),
    207	REGULATOR_LINEAR_RANGE(RK817_BUCK1_MIN1, RK817_BUCK1_SEL0 + 1,
    208			       RK817_BUCK3_SEL_CNT, RK817_BUCK1_STP1),
    209};
    210
    211static const unsigned int rk808_buck1_2_ramp_table[] = {
    212	2000, 4000, 6000, 10000
    213};
    214
    215/* RK817 RK809 */
    216static const unsigned int rk817_buck1_4_ramp_table[] = {
    217	3000, 6300, 12500, 25000
    218};
    219
    220static int rk808_buck1_2_get_voltage_sel_regmap(struct regulator_dev *rdev)
    221{
    222	struct rk808_regulator_data *pdata = rdev_get_drvdata(rdev);
    223	int id = rdev_get_id(rdev);
    224	struct gpio_desc *gpio = pdata->dvs_gpio[id];
    225	unsigned int val;
    226	int ret;
    227
    228	if (!gpio || gpiod_get_value(gpio) == 0)
    229		return regulator_get_voltage_sel_regmap(rdev);
    230
    231	ret = regmap_read(rdev->regmap,
    232			  rdev->desc->vsel_reg + RK808_DVS_REG_OFFSET,
    233			  &val);
    234	if (ret != 0)
    235		return ret;
    236
    237	val &= rdev->desc->vsel_mask;
    238	val >>= ffs(rdev->desc->vsel_mask) - 1;
    239
    240	return val;
    241}
    242
    243static int rk808_buck1_2_i2c_set_voltage_sel(struct regulator_dev *rdev,
    244					     unsigned sel)
    245{
    246	int ret, delta_sel;
    247	unsigned int old_sel, tmp, val, mask = rdev->desc->vsel_mask;
    248
    249	ret = regmap_read(rdev->regmap, rdev->desc->vsel_reg, &val);
    250	if (ret != 0)
    251		return ret;
    252
    253	tmp = val & ~mask;
    254	old_sel = val & mask;
    255	old_sel >>= ffs(mask) - 1;
    256	delta_sel = sel - old_sel;
    257
    258	/*
    259	 * If directly modify the register to change the voltage, we will face
    260	 * the risk of overshoot. Put it into a multi-step, can effectively
    261	 * avoid this problem, a step is 100mv here.
    262	 */
    263	while (delta_sel > MAX_STEPS_ONE_TIME) {
    264		old_sel += MAX_STEPS_ONE_TIME;
    265		val = old_sel << (ffs(mask) - 1);
    266		val |= tmp;
    267
    268		/*
    269		 * i2c is 400kHz (2.5us per bit) and we must transmit _at least_
    270		 * 3 bytes (24 bits) plus start and stop so 26 bits.  So we've
    271		 * got more than 65 us between each voltage change and thus
    272		 * won't ramp faster than ~1500 uV / us.
    273		 */
    274		ret = regmap_write(rdev->regmap, rdev->desc->vsel_reg, val);
    275		delta_sel = sel - old_sel;
    276	}
    277
    278	sel <<= ffs(mask) - 1;
    279	val = tmp | sel;
    280	ret = regmap_write(rdev->regmap, rdev->desc->vsel_reg, val);
    281
    282	/*
    283	 * When we change the voltage register directly, the ramp rate is about
    284	 * 100000uv/us, wait 1us to make sure the target voltage to be stable,
    285	 * so we needn't wait extra time after that.
    286	 */
    287	udelay(1);
    288
    289	return ret;
    290}
    291
    292static int rk808_buck1_2_set_voltage_sel(struct regulator_dev *rdev,
    293					 unsigned sel)
    294{
    295	struct rk808_regulator_data *pdata = rdev_get_drvdata(rdev);
    296	int id = rdev_get_id(rdev);
    297	struct gpio_desc *gpio = pdata->dvs_gpio[id];
    298	unsigned int reg = rdev->desc->vsel_reg;
    299	unsigned old_sel;
    300	int ret, gpio_level;
    301
    302	if (!gpio)
    303		return rk808_buck1_2_i2c_set_voltage_sel(rdev, sel);
    304
    305	gpio_level = gpiod_get_value(gpio);
    306	if (gpio_level == 0) {
    307		reg += RK808_DVS_REG_OFFSET;
    308		ret = regmap_read(rdev->regmap, rdev->desc->vsel_reg, &old_sel);
    309	} else {
    310		ret = regmap_read(rdev->regmap,
    311				  reg + RK808_DVS_REG_OFFSET,
    312				  &old_sel);
    313	}
    314
    315	if (ret != 0)
    316		return ret;
    317
    318	sel <<= ffs(rdev->desc->vsel_mask) - 1;
    319	sel |= old_sel & ~rdev->desc->vsel_mask;
    320
    321	ret = regmap_write(rdev->regmap, reg, sel);
    322	if (ret)
    323		return ret;
    324
    325	gpiod_set_value(gpio, !gpio_level);
    326
    327	return ret;
    328}
    329
    330static int rk808_buck1_2_set_voltage_time_sel(struct regulator_dev *rdev,
    331				       unsigned int old_selector,
    332				       unsigned int new_selector)
    333{
    334	struct rk808_regulator_data *pdata = rdev_get_drvdata(rdev);
    335	int id = rdev_get_id(rdev);
    336	struct gpio_desc *gpio = pdata->dvs_gpio[id];
    337
    338	/* if there is no dvs1/2 pin, we don't need wait extra time here. */
    339	if (!gpio)
    340		return 0;
    341
    342	return regulator_set_voltage_time_sel(rdev, old_selector, new_selector);
    343}
    344
    345static int rk808_set_suspend_voltage(struct regulator_dev *rdev, int uv)
    346{
    347	unsigned int reg;
    348	int sel = regulator_map_voltage_linear(rdev, uv, uv);
    349
    350	if (sel < 0)
    351		return -EINVAL;
    352
    353	reg = rdev->desc->vsel_reg + RK808_SLP_REG_OFFSET;
    354
    355	return regmap_update_bits(rdev->regmap, reg,
    356				  rdev->desc->vsel_mask,
    357				  sel);
    358}
    359
    360static int rk808_set_suspend_voltage_range(struct regulator_dev *rdev, int uv)
    361{
    362	unsigned int reg;
    363	int sel = regulator_map_voltage_linear_range(rdev, uv, uv);
    364
    365	if (sel < 0)
    366		return -EINVAL;
    367
    368	reg = rdev->desc->vsel_reg + RK808_SLP_REG_OFFSET;
    369
    370	return regmap_update_bits(rdev->regmap, reg,
    371				  rdev->desc->vsel_mask,
    372				  sel);
    373}
    374
    375static int rk805_set_suspend_enable(struct regulator_dev *rdev)
    376{
    377	unsigned int reg;
    378
    379	reg = rdev->desc->enable_reg + RK808_SLP_SET_OFF_REG_OFFSET;
    380
    381	return regmap_update_bits(rdev->regmap, reg,
    382				  rdev->desc->enable_mask,
    383				  rdev->desc->enable_mask);
    384}
    385
    386static int rk805_set_suspend_disable(struct regulator_dev *rdev)
    387{
    388	unsigned int reg;
    389
    390	reg = rdev->desc->enable_reg + RK808_SLP_SET_OFF_REG_OFFSET;
    391
    392	return regmap_update_bits(rdev->regmap, reg,
    393				  rdev->desc->enable_mask,
    394				  0);
    395}
    396
    397static int rk808_set_suspend_enable(struct regulator_dev *rdev)
    398{
    399	unsigned int reg;
    400
    401	reg = rdev->desc->enable_reg + RK808_SLP_SET_OFF_REG_OFFSET;
    402
    403	return regmap_update_bits(rdev->regmap, reg,
    404				  rdev->desc->enable_mask,
    405				  0);
    406}
    407
    408static int rk808_set_suspend_disable(struct regulator_dev *rdev)
    409{
    410	unsigned int reg;
    411
    412	reg = rdev->desc->enable_reg + RK808_SLP_SET_OFF_REG_OFFSET;
    413
    414	return regmap_update_bits(rdev->regmap, reg,
    415				  rdev->desc->enable_mask,
    416				  rdev->desc->enable_mask);
    417}
    418
    419static int rk817_set_suspend_enable_ctrl(struct regulator_dev *rdev,
    420					 unsigned int en)
    421{
    422	unsigned int reg;
    423	int id = rdev_get_id(rdev);
    424	unsigned int id_slp, msk, val;
    425
    426	if (id >= RK817_ID_DCDC1 && id <= RK817_ID_DCDC4)
    427		id_slp = id;
    428	else if (id >= RK817_ID_LDO1 && id <= RK817_ID_LDO8)
    429		id_slp = 8 + (id - RK817_ID_LDO1);
    430	else if (id >= RK817_ID_LDO9 && id <= RK809_ID_SW2)
    431		id_slp = 4 + (id - RK817_ID_LDO9);
    432	else
    433		return -EINVAL;
    434
    435	reg = RK817_POWER_SLP_EN_REG(id_slp / 8);
    436
    437	msk = BIT(id_slp % 8);
    438	if (en)
    439		val = msk;
    440	else
    441		val = 0;
    442
    443	return regmap_update_bits(rdev->regmap, reg, msk, val);
    444}
    445
    446static int rk817_set_suspend_enable(struct regulator_dev *rdev)
    447{
    448	return rk817_set_suspend_enable_ctrl(rdev, 1);
    449}
    450
    451static int rk817_set_suspend_disable(struct regulator_dev *rdev)
    452{
    453	return rk817_set_suspend_enable_ctrl(rdev, 0);
    454}
    455
    456static int rk8xx_set_suspend_mode(struct regulator_dev *rdev, unsigned int mode)
    457{
    458	unsigned int reg;
    459
    460	reg = rdev->desc->vsel_reg + RK808_SLP_REG_OFFSET;
    461
    462	switch (mode) {
    463	case REGULATOR_MODE_FAST:
    464		return regmap_update_bits(rdev->regmap, reg,
    465					  PWM_MODE_MSK, FPWM_MODE);
    466	case REGULATOR_MODE_NORMAL:
    467		return regmap_update_bits(rdev->regmap, reg,
    468					  PWM_MODE_MSK, AUTO_PWM_MODE);
    469	default:
    470		dev_err(&rdev->dev, "do not support this mode\n");
    471		return -EINVAL;
    472	}
    473
    474	return 0;
    475}
    476
    477static int rk8xx_set_mode(struct regulator_dev *rdev, unsigned int mode)
    478{
    479	switch (mode) {
    480	case REGULATOR_MODE_FAST:
    481		return regmap_update_bits(rdev->regmap, rdev->desc->vsel_reg,
    482					  PWM_MODE_MSK, FPWM_MODE);
    483	case REGULATOR_MODE_NORMAL:
    484		return regmap_update_bits(rdev->regmap, rdev->desc->vsel_reg,
    485					  PWM_MODE_MSK, AUTO_PWM_MODE);
    486	default:
    487		dev_err(&rdev->dev, "do not support this mode\n");
    488		return -EINVAL;
    489	}
    490
    491	return 0;
    492}
    493
    494static unsigned int rk8xx_get_mode(struct regulator_dev *rdev)
    495{
    496	unsigned int val;
    497	int err;
    498
    499	err = regmap_read(rdev->regmap, rdev->desc->vsel_reg, &val);
    500	if (err)
    501		return err;
    502
    503	if (val & FPWM_MODE)
    504		return REGULATOR_MODE_FAST;
    505	else
    506		return REGULATOR_MODE_NORMAL;
    507}
    508
    509static int rk8xx_is_enabled_wmsk_regmap(struct regulator_dev *rdev)
    510{
    511	unsigned int val;
    512	int ret;
    513
    514	ret = regmap_read(rdev->regmap, rdev->desc->enable_reg, &val);
    515	if (ret != 0)
    516		return ret;
    517
    518	/* add write mask bit */
    519	val |= (rdev->desc->enable_mask & 0xf0);
    520	val &= rdev->desc->enable_mask;
    521
    522	if (rdev->desc->enable_is_inverted) {
    523		if (rdev->desc->enable_val)
    524			return val != rdev->desc->enable_val;
    525		return (val == 0);
    526	}
    527	if (rdev->desc->enable_val)
    528		return val == rdev->desc->enable_val;
    529	return val != 0;
    530}
    531
    532static unsigned int rk8xx_regulator_of_map_mode(unsigned int mode)
    533{
    534	switch (mode) {
    535	case 1:
    536		return REGULATOR_MODE_FAST;
    537	case 2:
    538		return REGULATOR_MODE_NORMAL;
    539	default:
    540		return REGULATOR_MODE_INVALID;
    541	}
    542}
    543
    544static const struct regulator_ops rk805_reg_ops = {
    545	.list_voltage           = regulator_list_voltage_linear,
    546	.map_voltage            = regulator_map_voltage_linear,
    547	.get_voltage_sel        = regulator_get_voltage_sel_regmap,
    548	.set_voltage_sel        = regulator_set_voltage_sel_regmap,
    549	.enable                 = regulator_enable_regmap,
    550	.disable                = regulator_disable_regmap,
    551	.is_enabled             = regulator_is_enabled_regmap,
    552	.set_suspend_voltage    = rk808_set_suspend_voltage,
    553	.set_suspend_enable     = rk805_set_suspend_enable,
    554	.set_suspend_disable    = rk805_set_suspend_disable,
    555};
    556
    557static const struct regulator_ops rk805_switch_ops = {
    558	.enable                 = regulator_enable_regmap,
    559	.disable                = regulator_disable_regmap,
    560	.is_enabled             = regulator_is_enabled_regmap,
    561	.set_suspend_enable     = rk805_set_suspend_enable,
    562	.set_suspend_disable    = rk805_set_suspend_disable,
    563};
    564
    565static const struct regulator_ops rk808_buck1_2_ops = {
    566	.list_voltage		= regulator_list_voltage_linear,
    567	.map_voltage		= regulator_map_voltage_linear,
    568	.get_voltage_sel	= rk808_buck1_2_get_voltage_sel_regmap,
    569	.set_voltage_sel	= rk808_buck1_2_set_voltage_sel,
    570	.set_voltage_time_sel	= rk808_buck1_2_set_voltage_time_sel,
    571	.enable			= regulator_enable_regmap,
    572	.disable		= regulator_disable_regmap,
    573	.is_enabled		= regulator_is_enabled_regmap,
    574	.set_ramp_delay		= regulator_set_ramp_delay_regmap,
    575	.set_suspend_voltage	= rk808_set_suspend_voltage,
    576	.set_suspend_enable	= rk808_set_suspend_enable,
    577	.set_suspend_disable	= rk808_set_suspend_disable,
    578};
    579
    580static const struct regulator_ops rk808_reg_ops = {
    581	.list_voltage		= regulator_list_voltage_linear,
    582	.map_voltage		= regulator_map_voltage_linear,
    583	.get_voltage_sel	= regulator_get_voltage_sel_regmap,
    584	.set_voltage_sel	= regulator_set_voltage_sel_regmap,
    585	.enable			= regulator_enable_regmap,
    586	.disable		= regulator_disable_regmap,
    587	.is_enabled		= regulator_is_enabled_regmap,
    588	.set_suspend_voltage	= rk808_set_suspend_voltage,
    589	.set_suspend_enable	= rk808_set_suspend_enable,
    590	.set_suspend_disable	= rk808_set_suspend_disable,
    591};
    592
    593static const struct regulator_ops rk808_reg_ops_ranges = {
    594	.list_voltage		= regulator_list_voltage_linear_range,
    595	.map_voltage		= regulator_map_voltage_linear_range,
    596	.get_voltage_sel	= regulator_get_voltage_sel_regmap,
    597	.set_voltage_sel	= regulator_set_voltage_sel_regmap,
    598	.enable			= regulator_enable_regmap,
    599	.disable		= regulator_disable_regmap,
    600	.is_enabled		= regulator_is_enabled_regmap,
    601	.set_suspend_voltage	= rk808_set_suspend_voltage_range,
    602	.set_suspend_enable	= rk808_set_suspend_enable,
    603	.set_suspend_disable	= rk808_set_suspend_disable,
    604};
    605
    606static const struct regulator_ops rk808_switch_ops = {
    607	.enable			= regulator_enable_regmap,
    608	.disable		= regulator_disable_regmap,
    609	.is_enabled		= regulator_is_enabled_regmap,
    610	.set_suspend_enable	= rk808_set_suspend_enable,
    611	.set_suspend_disable	= rk808_set_suspend_disable,
    612};
    613
    614static const struct linear_range rk805_buck_1_2_voltage_ranges[] = {
    615	REGULATOR_LINEAR_RANGE(712500, 0, 59, 12500),
    616	REGULATOR_LINEAR_RANGE(1800000, 60, 62, 200000),
    617	REGULATOR_LINEAR_RANGE(2300000, 63, 63, 0),
    618};
    619
    620static const struct regulator_ops rk809_buck5_ops_range = {
    621	.list_voltage		= regulator_list_voltage_linear_range,
    622	.map_voltage		= regulator_map_voltage_linear_range,
    623	.get_voltage_sel	= regulator_get_voltage_sel_regmap,
    624	.set_voltage_sel	= regulator_set_voltage_sel_regmap,
    625	.set_voltage_time_sel	= regulator_set_voltage_time_sel,
    626	.enable			= regulator_enable_regmap,
    627	.disable		= regulator_disable_regmap,
    628	.is_enabled		= rk8xx_is_enabled_wmsk_regmap,
    629	.set_suspend_voltage	= rk808_set_suspend_voltage_range,
    630	.set_suspend_enable	= rk817_set_suspend_enable,
    631	.set_suspend_disable	= rk817_set_suspend_disable,
    632};
    633
    634static const struct regulator_ops rk817_reg_ops = {
    635	.list_voltage		= regulator_list_voltage_linear,
    636	.map_voltage		= regulator_map_voltage_linear,
    637	.get_voltage_sel	= regulator_get_voltage_sel_regmap,
    638	.set_voltage_sel	= regulator_set_voltage_sel_regmap,
    639	.enable			= regulator_enable_regmap,
    640	.disable		= regulator_disable_regmap,
    641	.is_enabled		= rk8xx_is_enabled_wmsk_regmap,
    642	.set_suspend_voltage	= rk808_set_suspend_voltage,
    643	.set_suspend_enable	= rk817_set_suspend_enable,
    644	.set_suspend_disable	= rk817_set_suspend_disable,
    645};
    646
    647static const struct regulator_ops rk817_boost_ops = {
    648	.list_voltage		= regulator_list_voltage_linear,
    649	.map_voltage		= regulator_map_voltage_linear,
    650	.get_voltage_sel	= regulator_get_voltage_sel_regmap,
    651	.set_voltage_sel	= regulator_set_voltage_sel_regmap,
    652	.enable			= regulator_enable_regmap,
    653	.disable		= regulator_disable_regmap,
    654	.is_enabled		= rk8xx_is_enabled_wmsk_regmap,
    655	.set_suspend_enable	= rk817_set_suspend_enable,
    656	.set_suspend_disable	= rk817_set_suspend_disable,
    657};
    658
    659static const struct regulator_ops rk817_buck_ops_range = {
    660	.list_voltage		= regulator_list_voltage_linear_range,
    661	.map_voltage		= regulator_map_voltage_linear_range,
    662	.get_voltage_sel	= regulator_get_voltage_sel_regmap,
    663	.set_voltage_sel	= regulator_set_voltage_sel_regmap,
    664	.set_voltage_time_sel	= regulator_set_voltage_time_sel,
    665	.enable			= regulator_enable_regmap,
    666	.disable		= regulator_disable_regmap,
    667	.is_enabled		= rk8xx_is_enabled_wmsk_regmap,
    668	.set_mode		= rk8xx_set_mode,
    669	.get_mode		= rk8xx_get_mode,
    670	.set_suspend_mode	= rk8xx_set_suspend_mode,
    671	.set_ramp_delay		= regulator_set_ramp_delay_regmap,
    672	.set_suspend_voltage	= rk808_set_suspend_voltage_range,
    673	.set_suspend_enable	= rk817_set_suspend_enable,
    674	.set_suspend_disable	= rk817_set_suspend_disable,
    675};
    676
    677static const struct regulator_ops rk817_switch_ops = {
    678	.enable			= regulator_enable_regmap,
    679	.disable		= regulator_disable_regmap,
    680	.is_enabled		= rk8xx_is_enabled_wmsk_regmap,
    681	.set_suspend_enable	= rk817_set_suspend_enable,
    682	.set_suspend_disable	= rk817_set_suspend_disable,
    683};
    684
    685static const struct regulator_desc rk805_reg[] = {
    686	{
    687		.name = "DCDC_REG1",
    688		.supply_name = "vcc1",
    689		.of_match = of_match_ptr("DCDC_REG1"),
    690		.regulators_node = of_match_ptr("regulators"),
    691		.id = RK805_ID_DCDC1,
    692		.ops = &rk808_reg_ops_ranges,
    693		.type = REGULATOR_VOLTAGE,
    694		.n_voltages = 64,
    695		.linear_ranges = rk805_buck_1_2_voltage_ranges,
    696		.n_linear_ranges = ARRAY_SIZE(rk805_buck_1_2_voltage_ranges),
    697		.vsel_reg = RK805_BUCK1_ON_VSEL_REG,
    698		.vsel_mask = RK818_BUCK_VSEL_MASK,
    699		.enable_reg = RK805_DCDC_EN_REG,
    700		.enable_mask = BIT(0),
    701		.owner = THIS_MODULE,
    702	}, {
    703		.name = "DCDC_REG2",
    704		.supply_name = "vcc2",
    705		.of_match = of_match_ptr("DCDC_REG2"),
    706		.regulators_node = of_match_ptr("regulators"),
    707		.id = RK805_ID_DCDC2,
    708		.ops = &rk808_reg_ops_ranges,
    709		.type = REGULATOR_VOLTAGE,
    710		.n_voltages = 64,
    711		.linear_ranges = rk805_buck_1_2_voltage_ranges,
    712		.n_linear_ranges = ARRAY_SIZE(rk805_buck_1_2_voltage_ranges),
    713		.vsel_reg = RK805_BUCK2_ON_VSEL_REG,
    714		.vsel_mask = RK818_BUCK_VSEL_MASK,
    715		.enable_reg = RK805_DCDC_EN_REG,
    716		.enable_mask = BIT(1),
    717		.owner = THIS_MODULE,
    718	}, {
    719		.name = "DCDC_REG3",
    720		.supply_name = "vcc3",
    721		.of_match = of_match_ptr("DCDC_REG3"),
    722		.regulators_node = of_match_ptr("regulators"),
    723		.id = RK805_ID_DCDC3,
    724		.ops = &rk805_switch_ops,
    725		.type = REGULATOR_VOLTAGE,
    726		.n_voltages = 1,
    727		.enable_reg = RK805_DCDC_EN_REG,
    728		.enable_mask = BIT(2),
    729		.owner = THIS_MODULE,
    730	},
    731
    732	RK805_DESC(RK805_ID_DCDC4, "DCDC_REG4", "vcc4", 800, 3400, 100,
    733		RK805_BUCK4_ON_VSEL_REG, RK818_BUCK4_VSEL_MASK,
    734		RK805_DCDC_EN_REG, BIT(3), 0),
    735
    736	RK805_DESC(RK805_ID_LDO1, "LDO_REG1", "vcc5", 800, 3400, 100,
    737		RK805_LDO1_ON_VSEL_REG, RK818_LDO_VSEL_MASK, RK805_LDO_EN_REG,
    738		BIT(0), 400),
    739	RK805_DESC(RK805_ID_LDO2, "LDO_REG2", "vcc5", 800, 3400, 100,
    740		RK805_LDO2_ON_VSEL_REG, RK818_LDO_VSEL_MASK, RK805_LDO_EN_REG,
    741		BIT(1), 400),
    742	RK805_DESC(RK805_ID_LDO3, "LDO_REG3", "vcc6", 800, 3400, 100,
    743		RK805_LDO3_ON_VSEL_REG, RK818_LDO_VSEL_MASK, RK805_LDO_EN_REG,
    744		BIT(2), 400),
    745};
    746
    747static const struct regulator_desc rk808_reg[] = {
    748	{
    749		.name = "DCDC_REG1",
    750		.supply_name = "vcc1",
    751		.of_match = of_match_ptr("DCDC_REG1"),
    752		.regulators_node = of_match_ptr("regulators"),
    753		.id = RK808_ID_DCDC1,
    754		.ops = &rk808_buck1_2_ops,
    755		.type = REGULATOR_VOLTAGE,
    756		.min_uV = 712500,
    757		.uV_step = 12500,
    758		.n_voltages = 64,
    759		.vsel_reg = RK808_BUCK1_ON_VSEL_REG,
    760		.vsel_mask = RK808_BUCK_VSEL_MASK,
    761		.enable_reg = RK808_DCDC_EN_REG,
    762		.enable_mask = BIT(0),
    763		.ramp_reg = RK808_BUCK1_CONFIG_REG,
    764		.ramp_mask = RK808_RAMP_RATE_MASK,
    765		.ramp_delay_table = rk808_buck1_2_ramp_table,
    766		.n_ramp_values = ARRAY_SIZE(rk808_buck1_2_ramp_table),
    767		.owner = THIS_MODULE,
    768	}, {
    769		.name = "DCDC_REG2",
    770		.supply_name = "vcc2",
    771		.of_match = of_match_ptr("DCDC_REG2"),
    772		.regulators_node = of_match_ptr("regulators"),
    773		.id = RK808_ID_DCDC2,
    774		.ops = &rk808_buck1_2_ops,
    775		.type = REGULATOR_VOLTAGE,
    776		.min_uV = 712500,
    777		.uV_step = 12500,
    778		.n_voltages = 64,
    779		.vsel_reg = RK808_BUCK2_ON_VSEL_REG,
    780		.vsel_mask = RK808_BUCK_VSEL_MASK,
    781		.enable_reg = RK808_DCDC_EN_REG,
    782		.enable_mask = BIT(1),
    783		.ramp_reg = RK808_BUCK2_CONFIG_REG,
    784		.ramp_mask = RK808_RAMP_RATE_MASK,
    785		.ramp_delay_table = rk808_buck1_2_ramp_table,
    786		.n_ramp_values = ARRAY_SIZE(rk808_buck1_2_ramp_table),
    787		.owner = THIS_MODULE,
    788	}, {
    789		.name = "DCDC_REG3",
    790		.supply_name = "vcc3",
    791		.of_match = of_match_ptr("DCDC_REG3"),
    792		.regulators_node = of_match_ptr("regulators"),
    793		.id = RK808_ID_DCDC3,
    794		.ops = &rk808_switch_ops,
    795		.type = REGULATOR_VOLTAGE,
    796		.n_voltages = 1,
    797		.enable_reg = RK808_DCDC_EN_REG,
    798		.enable_mask = BIT(2),
    799		.owner = THIS_MODULE,
    800	},
    801	RK8XX_DESC(RK808_ID_DCDC4, "DCDC_REG4", "vcc4", 1800, 3300, 100,
    802		RK808_BUCK4_ON_VSEL_REG, RK808_BUCK4_VSEL_MASK,
    803		RK808_DCDC_EN_REG, BIT(3), 0),
    804	RK8XX_DESC(RK808_ID_LDO1, "LDO_REG1", "vcc6", 1800, 3400, 100,
    805		RK808_LDO1_ON_VSEL_REG, RK808_LDO_VSEL_MASK, RK808_LDO_EN_REG,
    806		BIT(0), 400),
    807	RK8XX_DESC(RK808_ID_LDO2, "LDO_REG2", "vcc6", 1800, 3400, 100,
    808		RK808_LDO2_ON_VSEL_REG, RK808_LDO_VSEL_MASK, RK808_LDO_EN_REG,
    809		BIT(1), 400),
    810	{
    811		.name = "LDO_REG3",
    812		.supply_name = "vcc7",
    813		.of_match = of_match_ptr("LDO_REG3"),
    814		.regulators_node = of_match_ptr("regulators"),
    815		.id = RK808_ID_LDO3,
    816		.ops = &rk808_reg_ops_ranges,
    817		.type = REGULATOR_VOLTAGE,
    818		.n_voltages = 16,
    819		.linear_ranges = rk808_ldo3_voltage_ranges,
    820		.n_linear_ranges = ARRAY_SIZE(rk808_ldo3_voltage_ranges),
    821		.vsel_reg = RK808_LDO3_ON_VSEL_REG,
    822		.vsel_mask = RK808_BUCK4_VSEL_MASK,
    823		.enable_reg = RK808_LDO_EN_REG,
    824		.enable_mask = BIT(2),
    825		.enable_time = 400,
    826		.owner = THIS_MODULE,
    827	},
    828	RK8XX_DESC(RK808_ID_LDO4, "LDO_REG4", "vcc9", 1800, 3400, 100,
    829		RK808_LDO4_ON_VSEL_REG, RK808_LDO_VSEL_MASK, RK808_LDO_EN_REG,
    830		BIT(3), 400),
    831	RK8XX_DESC(RK808_ID_LDO5, "LDO_REG5", "vcc9", 1800, 3400, 100,
    832		RK808_LDO5_ON_VSEL_REG, RK808_LDO_VSEL_MASK, RK808_LDO_EN_REG,
    833		BIT(4), 400),
    834	RK8XX_DESC(RK808_ID_LDO6, "LDO_REG6", "vcc10", 800, 2500, 100,
    835		RK808_LDO6_ON_VSEL_REG, RK808_LDO_VSEL_MASK, RK808_LDO_EN_REG,
    836		BIT(5), 400),
    837	RK8XX_DESC(RK808_ID_LDO7, "LDO_REG7", "vcc7", 800, 2500, 100,
    838		RK808_LDO7_ON_VSEL_REG, RK808_LDO_VSEL_MASK, RK808_LDO_EN_REG,
    839		BIT(6), 400),
    840	RK8XX_DESC(RK808_ID_LDO8, "LDO_REG8", "vcc11", 1800, 3400, 100,
    841		RK808_LDO8_ON_VSEL_REG, RK808_LDO_VSEL_MASK, RK808_LDO_EN_REG,
    842		BIT(7), 400),
    843	RK8XX_DESC_SWITCH(RK808_ID_SWITCH1, "SWITCH_REG1", "vcc8",
    844		RK808_DCDC_EN_REG, BIT(5)),
    845	RK8XX_DESC_SWITCH(RK808_ID_SWITCH2, "SWITCH_REG2", "vcc12",
    846		RK808_DCDC_EN_REG, BIT(6)),
    847};
    848
    849static const struct regulator_desc rk809_reg[] = {
    850	{
    851		.name = "DCDC_REG1",
    852		.supply_name = "vcc1",
    853		.of_match = of_match_ptr("DCDC_REG1"),
    854		.regulators_node = of_match_ptr("regulators"),
    855		.id = RK817_ID_DCDC1,
    856		.ops = &rk817_buck_ops_range,
    857		.type = REGULATOR_VOLTAGE,
    858		.n_voltages = RK817_BUCK1_SEL_CNT + 1,
    859		.linear_ranges = rk817_buck1_voltage_ranges,
    860		.n_linear_ranges = ARRAY_SIZE(rk817_buck1_voltage_ranges),
    861		.vsel_reg = RK817_BUCK1_ON_VSEL_REG,
    862		.vsel_mask = RK817_BUCK_VSEL_MASK,
    863		.enable_reg = RK817_POWER_EN_REG(0),
    864		.enable_mask = ENABLE_MASK(RK817_ID_DCDC1),
    865		.enable_val = ENABLE_MASK(RK817_ID_DCDC1),
    866		.disable_val = DISABLE_VAL(RK817_ID_DCDC1),
    867		.ramp_reg = RK817_BUCK_CONFIG_REG(RK817_ID_DCDC1),
    868		.ramp_mask = RK817_RAMP_RATE_MASK,
    869		.ramp_delay_table = rk817_buck1_4_ramp_table,
    870		.n_ramp_values = ARRAY_SIZE(rk817_buck1_4_ramp_table),
    871		.of_map_mode = rk8xx_regulator_of_map_mode,
    872		.owner = THIS_MODULE,
    873	}, {
    874		.name = "DCDC_REG2",
    875		.supply_name = "vcc2",
    876		.of_match = of_match_ptr("DCDC_REG2"),
    877		.regulators_node = of_match_ptr("regulators"),
    878		.id = RK817_ID_DCDC2,
    879		.ops = &rk817_buck_ops_range,
    880		.type = REGULATOR_VOLTAGE,
    881		.n_voltages = RK817_BUCK1_SEL_CNT + 1,
    882		.linear_ranges = rk817_buck1_voltage_ranges,
    883		.n_linear_ranges = ARRAY_SIZE(rk817_buck1_voltage_ranges),
    884		.vsel_reg = RK817_BUCK2_ON_VSEL_REG,
    885		.vsel_mask = RK817_BUCK_VSEL_MASK,
    886		.enable_reg = RK817_POWER_EN_REG(0),
    887		.enable_mask = ENABLE_MASK(RK817_ID_DCDC2),
    888		.enable_val = ENABLE_MASK(RK817_ID_DCDC2),
    889		.disable_val = DISABLE_VAL(RK817_ID_DCDC2),
    890		.ramp_reg = RK817_BUCK_CONFIG_REG(RK817_ID_DCDC2),
    891		.ramp_mask = RK817_RAMP_RATE_MASK,
    892		.ramp_delay_table = rk817_buck1_4_ramp_table,
    893		.n_ramp_values = ARRAY_SIZE(rk817_buck1_4_ramp_table),
    894		.of_map_mode = rk8xx_regulator_of_map_mode,
    895		.owner = THIS_MODULE,
    896	}, {
    897		.name = "DCDC_REG3",
    898		.supply_name = "vcc3",
    899		.of_match = of_match_ptr("DCDC_REG3"),
    900		.regulators_node = of_match_ptr("regulators"),
    901		.id = RK817_ID_DCDC3,
    902		.ops = &rk817_buck_ops_range,
    903		.type = REGULATOR_VOLTAGE,
    904		.n_voltages = RK817_BUCK1_SEL_CNT + 1,
    905		.linear_ranges = rk817_buck1_voltage_ranges,
    906		.n_linear_ranges = ARRAY_SIZE(rk817_buck1_voltage_ranges),
    907		.vsel_reg = RK817_BUCK3_ON_VSEL_REG,
    908		.vsel_mask = RK817_BUCK_VSEL_MASK,
    909		.enable_reg = RK817_POWER_EN_REG(0),
    910		.enable_mask = ENABLE_MASK(RK817_ID_DCDC3),
    911		.enable_val = ENABLE_MASK(RK817_ID_DCDC3),
    912		.disable_val = DISABLE_VAL(RK817_ID_DCDC3),
    913		.ramp_reg = RK817_BUCK_CONFIG_REG(RK817_ID_DCDC3),
    914		.ramp_mask = RK817_RAMP_RATE_MASK,
    915		.ramp_delay_table = rk817_buck1_4_ramp_table,
    916		.n_ramp_values = ARRAY_SIZE(rk817_buck1_4_ramp_table),
    917		.of_map_mode = rk8xx_regulator_of_map_mode,
    918		.owner = THIS_MODULE,
    919	}, {
    920		.name = "DCDC_REG4",
    921		.supply_name = "vcc4",
    922		.of_match = of_match_ptr("DCDC_REG4"),
    923		.regulators_node = of_match_ptr("regulators"),
    924		.id = RK817_ID_DCDC4,
    925		.ops = &rk817_buck_ops_range,
    926		.type = REGULATOR_VOLTAGE,
    927		.n_voltages = RK817_BUCK3_SEL_CNT + 1,
    928		.linear_ranges = rk817_buck3_voltage_ranges,
    929		.n_linear_ranges = ARRAY_SIZE(rk817_buck3_voltage_ranges),
    930		.vsel_reg = RK817_BUCK4_ON_VSEL_REG,
    931		.vsel_mask = RK817_BUCK_VSEL_MASK,
    932		.enable_reg = RK817_POWER_EN_REG(0),
    933		.enable_mask = ENABLE_MASK(RK817_ID_DCDC4),
    934		.enable_val = ENABLE_MASK(RK817_ID_DCDC4),
    935		.disable_val = DISABLE_VAL(RK817_ID_DCDC4),
    936		.ramp_reg = RK817_BUCK_CONFIG_REG(RK817_ID_DCDC4),
    937		.ramp_mask = RK817_RAMP_RATE_MASK,
    938		.ramp_delay_table = rk817_buck1_4_ramp_table,
    939		.n_ramp_values = ARRAY_SIZE(rk817_buck1_4_ramp_table),
    940		.of_map_mode = rk8xx_regulator_of_map_mode,
    941		.owner = THIS_MODULE,
    942	},
    943	{
    944		.name = "DCDC_REG5",
    945		.supply_name = "vcc9",
    946		.of_match = of_match_ptr("DCDC_REG5"),
    947		.regulators_node = of_match_ptr("regulators"),
    948		.id = RK809_ID_DCDC5,
    949		.ops = &rk809_buck5_ops_range,
    950		.type = REGULATOR_VOLTAGE,
    951		.n_voltages = RK809_BUCK5_SEL_CNT,
    952		.linear_ranges = rk809_buck5_voltage_ranges,
    953		.n_linear_ranges = ARRAY_SIZE(rk809_buck5_voltage_ranges),
    954		.vsel_reg = RK809_BUCK5_CONFIG(0),
    955		.vsel_mask = RK809_BUCK5_VSEL_MASK,
    956		.enable_reg = RK817_POWER_EN_REG(3),
    957		.enable_mask = ENABLE_MASK(1),
    958		.enable_val = ENABLE_MASK(1),
    959		.disable_val = DISABLE_VAL(1),
    960		.of_map_mode = rk8xx_regulator_of_map_mode,
    961		.owner = THIS_MODULE,
    962	},
    963	RK817_DESC(RK817_ID_LDO1, "LDO_REG1", "vcc5", 600, 3400, 25,
    964		   RK817_LDO_ON_VSEL_REG(0), RK817_LDO_VSEL_MASK,
    965		   RK817_POWER_EN_REG(1), ENABLE_MASK(0),
    966		   DISABLE_VAL(0), 400),
    967	RK817_DESC(RK817_ID_LDO2, "LDO_REG2", "vcc5", 600, 3400, 25,
    968		   RK817_LDO_ON_VSEL_REG(1), RK817_LDO_VSEL_MASK,
    969		   RK817_POWER_EN_REG(1), ENABLE_MASK(1),
    970		   DISABLE_VAL(1), 400),
    971	RK817_DESC(RK817_ID_LDO3, "LDO_REG3", "vcc5", 600, 3400, 25,
    972		   RK817_LDO_ON_VSEL_REG(2), RK817_LDO_VSEL_MASK,
    973		   RK817_POWER_EN_REG(1), ENABLE_MASK(2),
    974		   DISABLE_VAL(2), 400),
    975	RK817_DESC(RK817_ID_LDO4, "LDO_REG4", "vcc6", 600, 3400, 25,
    976		   RK817_LDO_ON_VSEL_REG(3), RK817_LDO_VSEL_MASK,
    977		   RK817_POWER_EN_REG(1), ENABLE_MASK(3),
    978		   DISABLE_VAL(3), 400),
    979	RK817_DESC(RK817_ID_LDO5, "LDO_REG5", "vcc6", 600, 3400, 25,
    980		   RK817_LDO_ON_VSEL_REG(4), RK817_LDO_VSEL_MASK,
    981		   RK817_POWER_EN_REG(2), ENABLE_MASK(0),
    982		   DISABLE_VAL(0), 400),
    983	RK817_DESC(RK817_ID_LDO6, "LDO_REG6", "vcc6", 600, 3400, 25,
    984		   RK817_LDO_ON_VSEL_REG(5), RK817_LDO_VSEL_MASK,
    985		   RK817_POWER_EN_REG(2), ENABLE_MASK(1),
    986		   DISABLE_VAL(1), 400),
    987	RK817_DESC(RK817_ID_LDO7, "LDO_REG7", "vcc7", 600, 3400, 25,
    988		   RK817_LDO_ON_VSEL_REG(6), RK817_LDO_VSEL_MASK,
    989		   RK817_POWER_EN_REG(2), ENABLE_MASK(2),
    990		   DISABLE_VAL(2), 400),
    991	RK817_DESC(RK817_ID_LDO8, "LDO_REG8", "vcc7", 600, 3400, 25,
    992		   RK817_LDO_ON_VSEL_REG(7), RK817_LDO_VSEL_MASK,
    993		   RK817_POWER_EN_REG(2), ENABLE_MASK(3),
    994		   DISABLE_VAL(3), 400),
    995	RK817_DESC(RK817_ID_LDO9, "LDO_REG9", "vcc7", 600, 3400, 25,
    996		   RK817_LDO_ON_VSEL_REG(8), RK817_LDO_VSEL_MASK,
    997		   RK817_POWER_EN_REG(3), ENABLE_MASK(0),
    998		   DISABLE_VAL(0), 400),
    999	RK817_DESC_SWITCH(RK809_ID_SW1, "SWITCH_REG1", "vcc9",
   1000			  RK817_POWER_EN_REG(3), ENABLE_MASK(2),
   1001			  DISABLE_VAL(2)),
   1002	RK817_DESC_SWITCH(RK809_ID_SW2, "SWITCH_REG2", "vcc8",
   1003			  RK817_POWER_EN_REG(3), ENABLE_MASK(3),
   1004			  DISABLE_VAL(3)),
   1005};
   1006
   1007static const struct regulator_desc rk817_reg[] = {
   1008	{
   1009		.name = "DCDC_REG1",
   1010		.supply_name = "vcc1",
   1011		.of_match = of_match_ptr("DCDC_REG1"),
   1012		.regulators_node = of_match_ptr("regulators"),
   1013		.id = RK817_ID_DCDC1,
   1014		.ops = &rk817_buck_ops_range,
   1015		.type = REGULATOR_VOLTAGE,
   1016		.n_voltages = RK817_BUCK1_SEL_CNT + 1,
   1017		.linear_ranges = rk817_buck1_voltage_ranges,
   1018		.n_linear_ranges = ARRAY_SIZE(rk817_buck1_voltage_ranges),
   1019		.vsel_reg = RK817_BUCK1_ON_VSEL_REG,
   1020		.vsel_mask = RK817_BUCK_VSEL_MASK,
   1021		.enable_reg = RK817_POWER_EN_REG(0),
   1022		.enable_mask = ENABLE_MASK(RK817_ID_DCDC1),
   1023		.enable_val = ENABLE_MASK(RK817_ID_DCDC1),
   1024		.disable_val = DISABLE_VAL(RK817_ID_DCDC1),
   1025		.ramp_reg = RK817_BUCK_CONFIG_REG(RK817_ID_DCDC1),
   1026		.ramp_mask = RK817_RAMP_RATE_MASK,
   1027		.ramp_delay_table = rk817_buck1_4_ramp_table,
   1028		.n_ramp_values = ARRAY_SIZE(rk817_buck1_4_ramp_table),
   1029		.of_map_mode = rk8xx_regulator_of_map_mode,
   1030		.owner = THIS_MODULE,
   1031	}, {
   1032		.name = "DCDC_REG2",
   1033		.supply_name = "vcc2",
   1034		.of_match = of_match_ptr("DCDC_REG2"),
   1035		.regulators_node = of_match_ptr("regulators"),
   1036		.id = RK817_ID_DCDC2,
   1037		.ops = &rk817_buck_ops_range,
   1038		.type = REGULATOR_VOLTAGE,
   1039		.n_voltages = RK817_BUCK1_SEL_CNT + 1,
   1040		.linear_ranges = rk817_buck1_voltage_ranges,
   1041		.n_linear_ranges = ARRAY_SIZE(rk817_buck1_voltage_ranges),
   1042		.vsel_reg = RK817_BUCK2_ON_VSEL_REG,
   1043		.vsel_mask = RK817_BUCK_VSEL_MASK,
   1044		.enable_reg = RK817_POWER_EN_REG(0),
   1045		.enable_mask = ENABLE_MASK(RK817_ID_DCDC2),
   1046		.enable_val = ENABLE_MASK(RK817_ID_DCDC2),
   1047		.disable_val = DISABLE_VAL(RK817_ID_DCDC2),
   1048		.ramp_reg = RK817_BUCK_CONFIG_REG(RK817_ID_DCDC2),
   1049		.ramp_mask = RK817_RAMP_RATE_MASK,
   1050		.ramp_delay_table = rk817_buck1_4_ramp_table,
   1051		.n_ramp_values = ARRAY_SIZE(rk817_buck1_4_ramp_table),
   1052		.of_map_mode = rk8xx_regulator_of_map_mode,
   1053		.owner = THIS_MODULE,
   1054	}, {
   1055		.name = "DCDC_REG3",
   1056		.supply_name = "vcc3",
   1057		.of_match = of_match_ptr("DCDC_REG3"),
   1058		.regulators_node = of_match_ptr("regulators"),
   1059		.id = RK817_ID_DCDC3,
   1060		.ops = &rk817_buck_ops_range,
   1061		.type = REGULATOR_VOLTAGE,
   1062		.n_voltages = RK817_BUCK1_SEL_CNT + 1,
   1063		.linear_ranges = rk817_buck1_voltage_ranges,
   1064		.n_linear_ranges = ARRAY_SIZE(rk817_buck1_voltage_ranges),
   1065		.vsel_reg = RK817_BUCK3_ON_VSEL_REG,
   1066		.vsel_mask = RK817_BUCK_VSEL_MASK,
   1067		.enable_reg = RK817_POWER_EN_REG(0),
   1068		.enable_mask = ENABLE_MASK(RK817_ID_DCDC3),
   1069		.enable_val = ENABLE_MASK(RK817_ID_DCDC3),
   1070		.disable_val = DISABLE_VAL(RK817_ID_DCDC3),
   1071		.ramp_reg = RK817_BUCK_CONFIG_REG(RK817_ID_DCDC3),
   1072		.ramp_mask = RK817_RAMP_RATE_MASK,
   1073		.ramp_delay_table = rk817_buck1_4_ramp_table,
   1074		.n_ramp_values = ARRAY_SIZE(rk817_buck1_4_ramp_table),
   1075		.of_map_mode = rk8xx_regulator_of_map_mode,
   1076		.owner = THIS_MODULE,
   1077	}, {
   1078		.name = "DCDC_REG4",
   1079		.supply_name = "vcc4",
   1080		.of_match = of_match_ptr("DCDC_REG4"),
   1081		.regulators_node = of_match_ptr("regulators"),
   1082		.id = RK817_ID_DCDC4,
   1083		.ops = &rk817_buck_ops_range,
   1084		.type = REGULATOR_VOLTAGE,
   1085		.n_voltages = RK817_BUCK3_SEL_CNT + 1,
   1086		.linear_ranges = rk817_buck3_voltage_ranges,
   1087		.n_linear_ranges = ARRAY_SIZE(rk817_buck3_voltage_ranges),
   1088		.vsel_reg = RK817_BUCK4_ON_VSEL_REG,
   1089		.vsel_mask = RK817_BUCK_VSEL_MASK,
   1090		.enable_reg = RK817_POWER_EN_REG(0),
   1091		.enable_mask = ENABLE_MASK(RK817_ID_DCDC4),
   1092		.enable_val = ENABLE_MASK(RK817_ID_DCDC4),
   1093		.disable_val = DISABLE_VAL(RK817_ID_DCDC4),
   1094		.ramp_reg = RK817_BUCK_CONFIG_REG(RK817_ID_DCDC4),
   1095		.ramp_mask = RK817_RAMP_RATE_MASK,
   1096		.ramp_delay_table = rk817_buck1_4_ramp_table,
   1097		.n_ramp_values = ARRAY_SIZE(rk817_buck1_4_ramp_table),
   1098		.of_map_mode = rk8xx_regulator_of_map_mode,
   1099		.owner = THIS_MODULE,
   1100	},
   1101	RK817_DESC(RK817_ID_LDO1, "LDO_REG1", "vcc5", 600, 3400, 25,
   1102		   RK817_LDO_ON_VSEL_REG(0), RK817_LDO_VSEL_MASK,
   1103		   RK817_POWER_EN_REG(1), ENABLE_MASK(0),
   1104		   DISABLE_VAL(0), 400),
   1105	RK817_DESC(RK817_ID_LDO2, "LDO_REG2", "vcc5", 600, 3400, 25,
   1106		   RK817_LDO_ON_VSEL_REG(1), RK817_LDO_VSEL_MASK,
   1107		   RK817_POWER_EN_REG(1), ENABLE_MASK(1),
   1108		   DISABLE_VAL(1), 400),
   1109	RK817_DESC(RK817_ID_LDO3, "LDO_REG3", "vcc5", 600, 3400, 25,
   1110		   RK817_LDO_ON_VSEL_REG(2), RK817_LDO_VSEL_MASK,
   1111		   RK817_POWER_EN_REG(1), ENABLE_MASK(2),
   1112		   DISABLE_VAL(2), 400),
   1113	RK817_DESC(RK817_ID_LDO4, "LDO_REG4", "vcc6", 600, 3400, 25,
   1114		   RK817_LDO_ON_VSEL_REG(3), RK817_LDO_VSEL_MASK,
   1115		   RK817_POWER_EN_REG(1), ENABLE_MASK(3),
   1116		   DISABLE_VAL(3), 400),
   1117	RK817_DESC(RK817_ID_LDO5, "LDO_REG5", "vcc6", 600, 3400, 25,
   1118		   RK817_LDO_ON_VSEL_REG(4), RK817_LDO_VSEL_MASK,
   1119		   RK817_POWER_EN_REG(2), ENABLE_MASK(0),
   1120		   DISABLE_VAL(0), 400),
   1121	RK817_DESC(RK817_ID_LDO6, "LDO_REG6", "vcc6", 600, 3400, 25,
   1122		   RK817_LDO_ON_VSEL_REG(5), RK817_LDO_VSEL_MASK,
   1123		   RK817_POWER_EN_REG(2), ENABLE_MASK(1),
   1124		   DISABLE_VAL(1), 400),
   1125	RK817_DESC(RK817_ID_LDO7, "LDO_REG7", "vcc7", 600, 3400, 25,
   1126		   RK817_LDO_ON_VSEL_REG(6), RK817_LDO_VSEL_MASK,
   1127		   RK817_POWER_EN_REG(2), ENABLE_MASK(2),
   1128		   DISABLE_VAL(2), 400),
   1129	RK817_DESC(RK817_ID_LDO8, "LDO_REG8", "vcc7", 600, 3400, 25,
   1130		   RK817_LDO_ON_VSEL_REG(7), RK817_LDO_VSEL_MASK,
   1131		   RK817_POWER_EN_REG(2), ENABLE_MASK(3),
   1132		   DISABLE_VAL(3), 400),
   1133	RK817_DESC(RK817_ID_LDO9, "LDO_REG9", "vcc7", 600, 3400, 25,
   1134		   RK817_LDO_ON_VSEL_REG(8), RK817_LDO_VSEL_MASK,
   1135		   RK817_POWER_EN_REG(3), ENABLE_MASK(0),
   1136		   DISABLE_VAL(0), 400),
   1137	RK817_BOOST_DESC(RK817_ID_BOOST, "BOOST", "vcc8", 4700, 5400, 100,
   1138			 RK817_BOOST_OTG_CFG, RK817_BOOST_VSEL_MASK,
   1139			 RK817_POWER_EN_REG(3), ENABLE_MASK(1), ENABLE_MASK(1),
   1140		   DISABLE_VAL(1), 400, 3500 - 5400),
   1141	RK817_DESC_SWITCH(RK817_ID_BOOST_OTG_SW, "OTG_SWITCH", "vcc9",
   1142			  RK817_POWER_EN_REG(3), ENABLE_MASK(2),
   1143			  DISABLE_VAL(2)),
   1144};
   1145
   1146static const struct regulator_desc rk818_reg[] = {
   1147	{
   1148		.name = "DCDC_REG1",
   1149		.supply_name = "vcc1",
   1150		.of_match = of_match_ptr("DCDC_REG1"),
   1151		.regulators_node = of_match_ptr("regulators"),
   1152		.id = RK818_ID_DCDC1,
   1153		.ops = &rk808_reg_ops,
   1154		.type = REGULATOR_VOLTAGE,
   1155		.min_uV = 712500,
   1156		.uV_step = 12500,
   1157		.n_voltages = 64,
   1158		.vsel_reg = RK818_BUCK1_ON_VSEL_REG,
   1159		.vsel_mask = RK818_BUCK_VSEL_MASK,
   1160		.enable_reg = RK818_DCDC_EN_REG,
   1161		.enable_mask = BIT(0),
   1162		.owner = THIS_MODULE,
   1163	}, {
   1164		.name = "DCDC_REG2",
   1165		.supply_name = "vcc2",
   1166		.of_match = of_match_ptr("DCDC_REG2"),
   1167		.regulators_node = of_match_ptr("regulators"),
   1168		.id = RK818_ID_DCDC2,
   1169		.ops = &rk808_reg_ops,
   1170		.type = REGULATOR_VOLTAGE,
   1171		.min_uV = 712500,
   1172		.uV_step = 12500,
   1173		.n_voltages = 64,
   1174		.vsel_reg = RK818_BUCK2_ON_VSEL_REG,
   1175		.vsel_mask = RK818_BUCK_VSEL_MASK,
   1176		.enable_reg = RK818_DCDC_EN_REG,
   1177		.enable_mask = BIT(1),
   1178		.owner = THIS_MODULE,
   1179	}, {
   1180		.name = "DCDC_REG3",
   1181		.supply_name = "vcc3",
   1182		.of_match = of_match_ptr("DCDC_REG3"),
   1183		.regulators_node = of_match_ptr("regulators"),
   1184		.id = RK818_ID_DCDC3,
   1185		.ops = &rk808_switch_ops,
   1186		.type = REGULATOR_VOLTAGE,
   1187		.n_voltages = 1,
   1188		.enable_reg = RK818_DCDC_EN_REG,
   1189		.enable_mask = BIT(2),
   1190		.owner = THIS_MODULE,
   1191	},
   1192	RK8XX_DESC(RK818_ID_DCDC4, "DCDC_REG4", "vcc4", 1800, 3600, 100,
   1193		RK818_BUCK4_ON_VSEL_REG, RK818_BUCK4_VSEL_MASK,
   1194		RK818_DCDC_EN_REG, BIT(3), 0),
   1195	RK8XX_DESC(RK818_ID_BOOST, "DCDC_BOOST", "boost", 4700, 5400, 100,
   1196		RK818_BOOST_LDO9_ON_VSEL_REG, RK818_BOOST_ON_VSEL_MASK,
   1197		RK818_DCDC_EN_REG, BIT(4), 0),
   1198	RK8XX_DESC(RK818_ID_LDO1, "LDO_REG1", "vcc6", 1800, 3400, 100,
   1199		RK818_LDO1_ON_VSEL_REG, RK818_LDO_VSEL_MASK, RK818_LDO_EN_REG,
   1200		BIT(0), 400),
   1201	RK8XX_DESC(RK818_ID_LDO2, "LDO_REG2", "vcc6", 1800, 3400, 100,
   1202		RK818_LDO2_ON_VSEL_REG, RK818_LDO_VSEL_MASK, RK818_LDO_EN_REG,
   1203		BIT(1), 400),
   1204	{
   1205		.name = "LDO_REG3",
   1206		.supply_name = "vcc7",
   1207		.of_match = of_match_ptr("LDO_REG3"),
   1208		.regulators_node = of_match_ptr("regulators"),
   1209		.id = RK818_ID_LDO3,
   1210		.ops = &rk808_reg_ops_ranges,
   1211		.type = REGULATOR_VOLTAGE,
   1212		.n_voltages = 16,
   1213		.linear_ranges = rk808_ldo3_voltage_ranges,
   1214		.n_linear_ranges = ARRAY_SIZE(rk808_ldo3_voltage_ranges),
   1215		.vsel_reg = RK818_LDO3_ON_VSEL_REG,
   1216		.vsel_mask = RK818_LDO3_ON_VSEL_MASK,
   1217		.enable_reg = RK818_LDO_EN_REG,
   1218		.enable_mask = BIT(2),
   1219		.enable_time = 400,
   1220		.owner = THIS_MODULE,
   1221	},
   1222	RK8XX_DESC(RK818_ID_LDO4, "LDO_REG4", "vcc8", 1800, 3400, 100,
   1223		RK818_LDO4_ON_VSEL_REG, RK818_LDO_VSEL_MASK, RK818_LDO_EN_REG,
   1224		BIT(3), 400),
   1225	RK8XX_DESC(RK818_ID_LDO5, "LDO_REG5", "vcc7", 1800, 3400, 100,
   1226		RK818_LDO5_ON_VSEL_REG, RK818_LDO_VSEL_MASK, RK818_LDO_EN_REG,
   1227		BIT(4), 400),
   1228	RK8XX_DESC(RK818_ID_LDO6, "LDO_REG6", "vcc8", 800, 2500, 100,
   1229		RK818_LDO6_ON_VSEL_REG, RK818_LDO_VSEL_MASK, RK818_LDO_EN_REG,
   1230		BIT(5), 400),
   1231	RK8XX_DESC(RK818_ID_LDO7, "LDO_REG7", "vcc7", 800, 2500, 100,
   1232		RK818_LDO7_ON_VSEL_REG, RK818_LDO_VSEL_MASK, RK818_LDO_EN_REG,
   1233		BIT(6), 400),
   1234	RK8XX_DESC(RK818_ID_LDO8, "LDO_REG8", "vcc8", 1800, 3400, 100,
   1235		RK818_LDO8_ON_VSEL_REG, RK818_LDO_VSEL_MASK, RK818_LDO_EN_REG,
   1236		BIT(7), 400),
   1237	RK8XX_DESC(RK818_ID_LDO9, "LDO_REG9", "vcc9", 1800, 3400, 100,
   1238		RK818_BOOST_LDO9_ON_VSEL_REG, RK818_LDO_VSEL_MASK,
   1239		RK818_DCDC_EN_REG, BIT(5), 400),
   1240	RK8XX_DESC_SWITCH(RK818_ID_SWITCH, "SWITCH_REG", "vcc9",
   1241		RK818_DCDC_EN_REG, BIT(6)),
   1242	RK8XX_DESC_SWITCH(RK818_ID_HDMI_SWITCH, "HDMI_SWITCH", "h_5v",
   1243		RK818_H5V_EN_REG, BIT(0)),
   1244	RK8XX_DESC_SWITCH(RK818_ID_OTG_SWITCH, "OTG_SWITCH", "usb",
   1245		RK818_DCDC_EN_REG, BIT(7)),
   1246};
   1247
   1248static int rk808_regulator_dt_parse_pdata(struct device *dev,
   1249				   struct device *client_dev,
   1250				   struct regmap *map,
   1251				   struct rk808_regulator_data *pdata)
   1252{
   1253	struct device_node *np;
   1254	int tmp, ret = 0, i;
   1255
   1256	np = of_get_child_by_name(client_dev->of_node, "regulators");
   1257	if (!np)
   1258		return -ENXIO;
   1259
   1260	for (i = 0; i < ARRAY_SIZE(pdata->dvs_gpio); i++) {
   1261		pdata->dvs_gpio[i] =
   1262			devm_gpiod_get_index_optional(client_dev, "dvs", i,
   1263						      GPIOD_OUT_LOW);
   1264		if (IS_ERR(pdata->dvs_gpio[i])) {
   1265			ret = PTR_ERR(pdata->dvs_gpio[i]);
   1266			dev_err(dev, "failed to get dvs%d gpio (%d)\n", i, ret);
   1267			goto dt_parse_end;
   1268		}
   1269
   1270		if (!pdata->dvs_gpio[i]) {
   1271			dev_info(dev, "there is no dvs%d gpio\n", i);
   1272			continue;
   1273		}
   1274
   1275		tmp = i ? RK808_DVS2_POL : RK808_DVS1_POL;
   1276		ret = regmap_update_bits(map, RK808_IO_POL_REG, tmp,
   1277				gpiod_is_active_low(pdata->dvs_gpio[i]) ?
   1278				0 : tmp);
   1279	}
   1280
   1281dt_parse_end:
   1282	of_node_put(np);
   1283	return ret;
   1284}
   1285
   1286static int rk808_regulator_probe(struct platform_device *pdev)
   1287{
   1288	struct rk808 *rk808 = dev_get_drvdata(pdev->dev.parent);
   1289	struct i2c_client *client = rk808->i2c;
   1290	struct regulator_config config = {};
   1291	struct regulator_dev *rk808_rdev;
   1292	struct rk808_regulator_data *pdata;
   1293	const struct regulator_desc *regulators;
   1294	int ret, i, nregulators;
   1295
   1296	pdata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL);
   1297	if (!pdata)
   1298		return -ENOMEM;
   1299
   1300	ret = rk808_regulator_dt_parse_pdata(&pdev->dev, &client->dev,
   1301					     rk808->regmap, pdata);
   1302	if (ret < 0)
   1303		return ret;
   1304
   1305	platform_set_drvdata(pdev, pdata);
   1306
   1307	switch (rk808->variant) {
   1308	case RK805_ID:
   1309		regulators = rk805_reg;
   1310		nregulators = RK805_NUM_REGULATORS;
   1311		break;
   1312	case RK808_ID:
   1313		regulators = rk808_reg;
   1314		nregulators = RK808_NUM_REGULATORS;
   1315		break;
   1316	case RK809_ID:
   1317		regulators = rk809_reg;
   1318		nregulators = RK809_NUM_REGULATORS;
   1319		break;
   1320	case RK817_ID:
   1321		regulators = rk817_reg;
   1322		nregulators = RK817_NUM_REGULATORS;
   1323		break;
   1324	case RK818_ID:
   1325		regulators = rk818_reg;
   1326		nregulators = RK818_NUM_REGULATORS;
   1327		break;
   1328	default:
   1329		dev_err(&client->dev, "unsupported RK8XX ID %lu\n",
   1330			rk808->variant);
   1331		return -EINVAL;
   1332	}
   1333
   1334	config.dev = &client->dev;
   1335	config.driver_data = pdata;
   1336	config.regmap = rk808->regmap;
   1337
   1338	/* Instantiate the regulators */
   1339	for (i = 0; i < nregulators; i++) {
   1340		rk808_rdev = devm_regulator_register(&pdev->dev,
   1341						     &regulators[i], &config);
   1342		if (IS_ERR(rk808_rdev)) {
   1343			dev_err(&client->dev,
   1344				"failed to register %d regulator\n", i);
   1345			return PTR_ERR(rk808_rdev);
   1346		}
   1347	}
   1348
   1349	return 0;
   1350}
   1351
   1352static struct platform_driver rk808_regulator_driver = {
   1353	.probe = rk808_regulator_probe,
   1354	.driver = {
   1355		.name = "rk808-regulator"
   1356	},
   1357};
   1358
   1359module_platform_driver(rk808_regulator_driver);
   1360
   1361MODULE_DESCRIPTION("regulator driver for the RK805/RK808/RK818 series PMICs");
   1362MODULE_AUTHOR("Tony xie <tony.xie@rock-chips.com>");
   1363MODULE_AUTHOR("Chris Zhong <zyw@rock-chips.com>");
   1364MODULE_AUTHOR("Zhang Qing <zhangqing@rock-chips.com>");
   1365MODULE_AUTHOR("Wadim Egorov <w.egorov@phytec.de>");
   1366MODULE_LICENSE("GPL");
   1367MODULE_ALIAS("platform:rk808-regulator");