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