blob: 6029279f4eed990a74ce8d8bdc8718dcf35ca606 [file] [log] [blame]
Kim, Miloaf8b5fc2012-06-19 07:08:22 +00001/*
2 * Copyright 2012 Texas Instruments
3 *
4 * Author: Milo(Woogyom) Kim <milo.kim@ti.com>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 *
10 */
11
12#ifndef __LP872X_REGULATOR_H__
13#define __LP872X_REGULATOR_H__
14
15#include <linux/regulator/machine.h>
16#include <linux/platform_device.h>
17#include <linux/gpio.h>
18
19#define LP872X_MAX_REGULATORS 9
20
Paul Kocialkowski7e6213f2016-02-05 19:42:19 +010021#define LP8720_ENABLE_DELAY 200
22#define LP8725_ENABLE_DELAY 30000
23
Kim, Miloaf8b5fc2012-06-19 07:08:22 +000024enum lp872x_regulator_id {
25 LP8720_ID_BASE,
26 LP8720_ID_LDO1 = LP8720_ID_BASE,
27 LP8720_ID_LDO2,
28 LP8720_ID_LDO3,
29 LP8720_ID_LDO4,
30 LP8720_ID_LDO5,
31 LP8720_ID_BUCK,
32
33 LP8725_ID_BASE,
34 LP8725_ID_LDO1 = LP8725_ID_BASE,
35 LP8725_ID_LDO2,
36 LP8725_ID_LDO3,
37 LP8725_ID_LDO4,
38 LP8725_ID_LDO5,
39 LP8725_ID_LILO1,
40 LP8725_ID_LILO2,
41 LP8725_ID_BUCK1,
42 LP8725_ID_BUCK2,
43
44 LP872X_ID_MAX,
45};
46
47enum lp872x_dvs_state {
48 DVS_LOW = GPIOF_OUT_INIT_LOW,
49 DVS_HIGH = GPIOF_OUT_INIT_HIGH,
50};
51
52enum lp872x_dvs_sel {
53 SEL_V1,
54 SEL_V2,
55};
56
57/**
58 * lp872x_dvs
59 * @gpio : gpio pin number for dvs control
60 * @vsel : dvs selector for buck v1 or buck v2 register
61 * @init_state : initial dvs pin state
62 */
63struct lp872x_dvs {
64 int gpio;
65 enum lp872x_dvs_sel vsel;
66 enum lp872x_dvs_state init_state;
67};
68
69/**
70 * lp872x_regdata
71 * @id : regulator id
72 * @init_data : init data for each regulator
73 */
74struct lp872x_regulator_data {
75 enum lp872x_regulator_id id;
76 struct regulator_init_data *init_data;
77};
78
79/**
80 * lp872x_platform_data
81 * @general_config : the value of LP872X_GENERAL_CFG register
82 * @update_config : if LP872X_GENERAL_CFG register is updated, set true
83 * @regulator_data : platform regulator id and init data
84 * @dvs : dvs data for buck voltage control
Paul Kocialkowski7e6213f2016-02-05 19:42:19 +010085 * @enable_gpio : gpio pin number for enable control
Kim, Miloaf8b5fc2012-06-19 07:08:22 +000086 */
87struct lp872x_platform_data {
88 u8 general_config;
89 bool update_config;
90 struct lp872x_regulator_data regulator_data[LP872X_MAX_REGULATORS];
91 struct lp872x_dvs *dvs;
Paul Kocialkowski7e6213f2016-02-05 19:42:19 +010092 int enable_gpio;
Kim, Miloaf8b5fc2012-06-19 07:08:22 +000093};
94
95#endif