Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0-only */
0002 /*
0003  * Copyright 2012 Texas Instruments
0004  *
0005  * Author: Milo(Woogyom) Kim <milo.kim@ti.com>
0006  */
0007 
0008 #ifndef __LP872X_REGULATOR_H__
0009 #define __LP872X_REGULATOR_H__
0010 
0011 #include <linux/regulator/machine.h>
0012 #include <linux/platform_device.h>
0013 #include <linux/gpio/consumer.h>
0014 
0015 #define LP872X_MAX_REGULATORS       9
0016 
0017 #define LP8720_ENABLE_DELAY     200
0018 #define LP8725_ENABLE_DELAY     30000
0019 
0020 enum lp872x_regulator_id {
0021     LP8720_ID_BASE,
0022     LP8720_ID_LDO1 = LP8720_ID_BASE,
0023     LP8720_ID_LDO2,
0024     LP8720_ID_LDO3,
0025     LP8720_ID_LDO4,
0026     LP8720_ID_LDO5,
0027     LP8720_ID_BUCK,
0028 
0029     LP8725_ID_BASE,
0030     LP8725_ID_LDO1 = LP8725_ID_BASE,
0031     LP8725_ID_LDO2,
0032     LP8725_ID_LDO3,
0033     LP8725_ID_LDO4,
0034     LP8725_ID_LDO5,
0035     LP8725_ID_LILO1,
0036     LP8725_ID_LILO2,
0037     LP8725_ID_BUCK1,
0038     LP8725_ID_BUCK2,
0039 
0040     LP872X_ID_MAX,
0041 };
0042 
0043 enum lp872x_dvs_sel {
0044     SEL_V1,
0045     SEL_V2,
0046 };
0047 
0048 /**
0049  * lp872x_dvs
0050  * @gpio       : gpio descriptor for dvs control
0051  * @vsel       : dvs selector for buck v1 or buck v2 register
0052  * @init_state : initial dvs pin state
0053  */
0054 struct lp872x_dvs {
0055     struct gpio_desc *gpio;
0056     enum lp872x_dvs_sel vsel;
0057     enum gpiod_flags init_state;
0058 };
0059 
0060 /**
0061  * lp872x_regdata
0062  * @id        : regulator id
0063  * @init_data : init data for each regulator
0064  */
0065 struct lp872x_regulator_data {
0066     enum lp872x_regulator_id id;
0067     struct regulator_init_data *init_data;
0068 };
0069 
0070 /**
0071  * lp872x_platform_data
0072  * @general_config    : the value of LP872X_GENERAL_CFG register
0073  * @update_config     : if LP872X_GENERAL_CFG register is updated, set true
0074  * @regulator_data    : platform regulator id and init data
0075  * @dvs               : dvs data for buck voltage control
0076  * @enable_gpio       : gpio descriptor for enable control
0077  */
0078 struct lp872x_platform_data {
0079     u8 general_config;
0080     bool update_config;
0081     struct lp872x_regulator_data regulator_data[LP872X_MAX_REGULATORS];
0082     struct lp872x_dvs *dvs;
0083     struct gpio_desc *enable_gpio;
0084 };
0085 
0086 #endif