blob: 132e05c466617b9336d7e0db49ef8455f48f171b [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
21enum lp872x_regulator_id {
22 LP8720_ID_BASE,
23 LP8720_ID_LDO1 = LP8720_ID_BASE,
24 LP8720_ID_LDO2,
25 LP8720_ID_LDO3,
26 LP8720_ID_LDO4,
27 LP8720_ID_LDO5,
28 LP8720_ID_BUCK,
29
30 LP8725_ID_BASE,
31 LP8725_ID_LDO1 = LP8725_ID_BASE,
32 LP8725_ID_LDO2,
33 LP8725_ID_LDO3,
34 LP8725_ID_LDO4,
35 LP8725_ID_LDO5,
36 LP8725_ID_LILO1,
37 LP8725_ID_LILO2,
38 LP8725_ID_BUCK1,
39 LP8725_ID_BUCK2,
40
41 LP872X_ID_MAX,
42};
43
44enum lp872x_dvs_state {
45 DVS_LOW = GPIOF_OUT_INIT_LOW,
46 DVS_HIGH = GPIOF_OUT_INIT_HIGH,
47};
48
49enum lp872x_dvs_sel {
50 SEL_V1,
51 SEL_V2,
52};
53
54/**
55 * lp872x_dvs
56 * @gpio : gpio pin number for dvs control
57 * @vsel : dvs selector for buck v1 or buck v2 register
58 * @init_state : initial dvs pin state
59 */
60struct lp872x_dvs {
61 int gpio;
62 enum lp872x_dvs_sel vsel;
63 enum lp872x_dvs_state init_state;
64};
65
66/**
67 * lp872x_regdata
68 * @id : regulator id
69 * @init_data : init data for each regulator
70 */
71struct lp872x_regulator_data {
72 enum lp872x_regulator_id id;
73 struct regulator_init_data *init_data;
74};
75
76/**
77 * lp872x_platform_data
78 * @general_config : the value of LP872X_GENERAL_CFG register
79 * @update_config : if LP872X_GENERAL_CFG register is updated, set true
80 * @regulator_data : platform regulator id and init data
81 * @dvs : dvs data for buck voltage control
82 */
83struct lp872x_platform_data {
84 u8 general_config;
85 bool update_config;
86 struct lp872x_regulator_data regulator_data[LP872X_MAX_REGULATORS];
87 struct lp872x_dvs *dvs;
88};
89
90#endif