1 /* SPDX-License-Identifier: GPL-2.0-only */
3 * Copyright 2012 Texas Instruments
5 * Author: Milo(Woogyom) Kim <milo.kim@ti.com>
8 #ifndef __LP872X_REGULATOR_H__
9 #define __LP872X_REGULATOR_H__
11 #include <linux/regulator/machine.h>
12 #include <linux/platform_device.h>
13 #include <linux/gpio.h>
15 #define LP872X_MAX_REGULATORS 9
17 #define LP8720_ENABLE_DELAY 200
18 #define LP8725_ENABLE_DELAY 30000
20 enum lp872x_regulator_id
{
22 LP8720_ID_LDO1
= LP8720_ID_BASE
,
30 LP8725_ID_LDO1
= LP8725_ID_BASE
,
43 enum lp872x_dvs_state
{
44 DVS_LOW
= GPIOF_OUT_INIT_LOW
,
45 DVS_HIGH
= GPIOF_OUT_INIT_HIGH
,
55 * @gpio : gpio pin number for dvs control
56 * @vsel : dvs selector for buck v1 or buck v2 register
57 * @init_state : initial dvs pin state
61 enum lp872x_dvs_sel vsel
;
62 enum lp872x_dvs_state init_state
;
68 * @init_data : init data for each regulator
70 struct lp872x_regulator_data
{
71 enum lp872x_regulator_id id
;
72 struct regulator_init_data
*init_data
;
76 * lp872x_platform_data
77 * @general_config : the value of LP872X_GENERAL_CFG register
78 * @update_config : if LP872X_GENERAL_CFG register is updated, set true
79 * @regulator_data : platform regulator id and init data
80 * @dvs : dvs data for buck voltage control
81 * @enable_gpio : gpio pin number for enable control
83 struct lp872x_platform_data
{
86 struct lp872x_regulator_data regulator_data
[LP872X_MAX_REGULATORS
];
87 struct lp872x_dvs
*dvs
;