d8ab389c425c6fa3df6cc6999c0ff0a2e0f3fbbe
[linux-2.6.git] / include / linux / regulator / max77663-regulator.h
1 /*
2  * include/linux/regulator/max77663-regulator.h
3  * Maxim LDO and Buck regulators driver
4  *
5  * Copyright 2011-2012 Maxim Integrated Products, Inc.
6  * Copyright (C) 2011-2012 NVIDIA Corporation
7  *
8  * This program is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU General Public License as
10  * published by the Free Software Foundation; either version 2 of the
11  * License, or (at your option) any later version.
12  *
13  */
14
15 #ifndef __LINUX_REGULATOR_MAX77663_REGULATOR_H__
16 #define __LINUX_REGULATOR_MAX77663_REGULATOR_H__
17
18 #include <linux/regulator/machine.h>
19
20 #define max77663_rails(_name)   "max77663_"#_name
21
22 enum max77663_regulator_id {
23         MAX77663_REGULATOR_ID_SD0,
24         MAX77663_REGULATOR_ID_DVSSD0,
25         MAX77663_REGULATOR_ID_SD1,
26         MAX77663_REGULATOR_ID_DVSSD1,
27         MAX77663_REGULATOR_ID_SD2,
28         MAX77663_REGULATOR_ID_SD3,
29         MAX77663_REGULATOR_ID_SD4,
30         MAX77663_REGULATOR_ID_LDO0,
31         MAX77663_REGULATOR_ID_LDO1,
32         MAX77663_REGULATOR_ID_LDO2,
33         MAX77663_REGULATOR_ID_LDO3,
34         MAX77663_REGULATOR_ID_LDO4,
35         MAX77663_REGULATOR_ID_LDO5,
36         MAX77663_REGULATOR_ID_LDO6,
37         MAX77663_REGULATOR_ID_LDO7,
38         MAX77663_REGULATOR_ID_LDO8,
39         MAX77663_REGULATOR_ID_NR,
40 };
41
42 /* FPS Power Up/Down Period */
43 enum max77663_regulator_fps_power_period {
44         FPS_POWER_PERIOD_0,
45         FPS_POWER_PERIOD_1,
46         FPS_POWER_PERIOD_2,
47         FPS_POWER_PERIOD_3,
48         FPS_POWER_PERIOD_4,
49         FPS_POWER_PERIOD_5,
50         FPS_POWER_PERIOD_6,
51         FPS_POWER_PERIOD_7,
52         FPS_POWER_PERIOD_DEF = -1,
53 };
54
55 /* FPS Time Period */
56 enum max77663_regulator_fps_time_period {
57         FPS_TIME_PERIOD_20US,
58         FPS_TIME_PERIOD_40US,
59         FPS_TIME_PERIOD_80US,
60         FPS_TIME_PERIOD_160US,
61         FPS_TIME_PERIOD_320US,
62         FPS_TIME_PERIOD_640US,
63         FPS_TIME_PERIOD_1280US,
64         FPS_TIME_PERIOD_2560US,
65         FPS_TIME_PERIOD_DEF = -1,
66 };
67
68 /* FPS Enable Source */
69 enum max77663_regulator_fps_en_src {
70         FPS_EN_SRC_EN0,
71         FPS_EN_SRC_EN1,
72         FPS_EN_SRC_SW,
73         FPS_EN_SRC_RSVD,
74 };
75
76 /* FPS Source */
77 enum max77663_regulator_fps_src {
78         FPS_SRC_0,
79         FPS_SRC_1,
80         FPS_SRC_2,
81         FPS_SRC_NONE,
82         FPS_SRC_DEF = -1,
83 };
84
85 /*
86  * Flags
87  */
88 /* SD0 is controlled by EN2 */
89 #define EN2_CTRL_SD0            0x01
90
91 /* SD Slew Rate */
92 #define SD_SLEW_RATE_SLOWEST    0x02    /*  13.75mV/us */
93 #define SD_SLEW_RATE_SLOW       0x04    /*  27.50mV/us */
94 #define SD_SLEW_RATE_FAST       0x08    /*  55.00mV/us */
95 #define SD_SLEW_RATE_FASTEST    0x10    /* 100.00mV/us */
96 #define SD_SLEW_RATE_MASK       0x1E
97
98 /* SD Forced PWM Mode */
99 #define SD_FORCED_PWM_MODE      0x20
100
101 /* SD Failling Slew Rate Active-Discharge Mode */
102 #define SD_FSRADE_DISABLE       0x40
103
104 /* Group Low-Power Mode */
105 #define GLPM_ENABLE             0x80
106
107 /* Tracking for LDO4 */
108 #define LDO4_EN_TRACKING        0x100
109
110 struct max77663_regulator_fps_cfg {
111         enum max77663_regulator_fps_src src;
112         enum max77663_regulator_fps_en_src en_src;
113         enum max77663_regulator_fps_time_period time_period;
114 };
115
116 struct max77663_regulator_platform_data {
117         struct regulator_init_data init_data;
118         bool init_apply;
119         bool init_enable;
120         int init_uV;
121         enum max77663_regulator_fps_src fps_src;
122         enum max77663_regulator_fps_power_period fps_pu_period;
123         enum max77663_regulator_fps_power_period fps_pd_period;
124
125         int num_fps_cfgs;
126         struct max77663_regulator_fps_cfg *fps_cfgs;
127
128         unsigned int flags;
129 };
130
131 #endif /* __LINUX_REGULATOR_MAX77663_REGULATOR_H__ */