diff options
author | Jonathan Herman <hermanjl@cs.unc.edu> | 2013-01-22 10:38:37 -0500 |
---|---|---|
committer | Jonathan Herman <hermanjl@cs.unc.edu> | 2013-01-22 10:38:37 -0500 |
commit | fcc9d2e5a6c89d22b8b773a64fb4ad21ac318446 (patch) | |
tree | a57612d1888735a2ec7972891b68c1ac5ec8faea /include/linux/mfd/ricoh583.h | |
parent | 8dea78da5cee153b8af9c07a2745f6c55057fe12 (diff) |
Diffstat (limited to 'include/linux/mfd/ricoh583.h')
-rw-r--r-- | include/linux/mfd/ricoh583.h | 164 |
1 files changed, 164 insertions, 0 deletions
diff --git a/include/linux/mfd/ricoh583.h b/include/linux/mfd/ricoh583.h new file mode 100644 index 00000000000..4e38cded0fa --- /dev/null +++ b/include/linux/mfd/ricoh583.h | |||
@@ -0,0 +1,164 @@ | |||
1 | /* include/linux/mfd/ricoh583.h | ||
2 | * | ||
3 | * Core driver interface to access RICOH583 power management chip. | ||
4 | * | ||
5 | * Copyright (C) 2011 NVIDIA Corporation | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify | ||
8 | * it under the terms of the GNU General Public License as published by | ||
9 | * the Free Software Foundation; either version 2 of the License, or | ||
10 | * (at your option) any later version. | ||
11 | * | ||
12 | * This program is distributed in the hope that it will be useful, but WITHOUT | ||
13 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
14 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
15 | * more details. | ||
16 | * | ||
17 | * You should have received a copy of the GNU General Public License along | ||
18 | * with this program; if not, write to the Free Software Foundation, Inc., | ||
19 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | ||
20 | * | ||
21 | */ | ||
22 | |||
23 | #ifndef __LINUX_MFD_RICOH583_H | ||
24 | #define __LINUX_MFD_RICOH583_H | ||
25 | |||
26 | #include <linux/rtc.h> | ||
27 | /* RICOH583 IRQ definitions */ | ||
28 | enum { | ||
29 | RICOH583_IRQ_ONKEY, | ||
30 | RICOH583_IRQ_ACOK, | ||
31 | RICOH583_IRQ_LIDOPEN, | ||
32 | RICOH583_IRQ_PREOT, | ||
33 | RICOH583_IRQ_CLKSTP, | ||
34 | RICOH583_IRQ_ONKEY_OFF, | ||
35 | RICOH583_IRQ_WD, | ||
36 | RICOH583_IRQ_EN_PWRREQ1, | ||
37 | RICOH583_IRQ_EN_PWRREQ2, | ||
38 | RICOH583_IRQ_PRE_VINDET, | ||
39 | |||
40 | RICOH583_IRQ_DC0LIM, | ||
41 | RICOH583_IRQ_DC1LIM, | ||
42 | RICOH583_IRQ_DC2LIM, | ||
43 | RICOH583_IRQ_DC3LIM, | ||
44 | |||
45 | RICOH583_IRQ_CTC, | ||
46 | RICOH583_IRQ_YALE, | ||
47 | RICOH583_IRQ_DALE, | ||
48 | RICOH583_IRQ_WALE, | ||
49 | |||
50 | RICOH583_IRQ_AIN1L, | ||
51 | RICOH583_IRQ_AIN2L, | ||
52 | RICOH583_IRQ_AIN3L, | ||
53 | RICOH583_IRQ_VBATL, | ||
54 | RICOH583_IRQ_VIN3L, | ||
55 | RICOH583_IRQ_VIN8L, | ||
56 | RICOH583_IRQ_AIN1H, | ||
57 | RICOH583_IRQ_AIN2H, | ||
58 | RICOH583_IRQ_AIN3H, | ||
59 | RICOH583_IRQ_VBATH, | ||
60 | RICOH583_IRQ_VIN3H, | ||
61 | RICOH583_IRQ_VIN8H, | ||
62 | RICOH583_IRQ_ADCEND, | ||
63 | |||
64 | RICOH583_IRQ_GPIO0, | ||
65 | RICOH583_IRQ_GPIO1, | ||
66 | RICOH583_IRQ_GPIO2, | ||
67 | RICOH583_IRQ_GPIO3, | ||
68 | RICOH583_IRQ_GPIO4, | ||
69 | RICOH583_IRQ_GPIO5, | ||
70 | RICOH583_IRQ_GPIO6, | ||
71 | RICOH583_IRQ_GPIO7, | ||
72 | RICOH583_NR_IRQS, | ||
73 | }; | ||
74 | |||
75 | /* Ricoh583 gpio definitions */ | ||
76 | enum { | ||
77 | RICOH583_GPIO0, | ||
78 | RICOH583_GPIO1, | ||
79 | RICOH583_GPIO2, | ||
80 | RICOH583_GPIO3, | ||
81 | RICOH583_GPIO4, | ||
82 | RICOH583_GPIO5, | ||
83 | RICOH583_GPIO6, | ||
84 | RICOH583_GPIO7, | ||
85 | |||
86 | RICOH583_NR_GPIO, | ||
87 | }; | ||
88 | |||
89 | enum ricoh583_deepsleep_control_id { | ||
90 | RICOH583_DS_NONE, | ||
91 | RICOH583_DS_DC0, | ||
92 | RICOH583_DS_DC1, | ||
93 | RICOH583_DS_DC2, | ||
94 | RICOH583_DS_DC3, | ||
95 | RICOH583_DS_LDO0, | ||
96 | RICOH583_DS_LDO1, | ||
97 | RICOH583_DS_LDO2, | ||
98 | RICOH583_DS_LDO3, | ||
99 | RICOH583_DS_LDO4, | ||
100 | RICOH583_DS_LDO5, | ||
101 | RICOH583_DS_LDO6, | ||
102 | RICOH583_DS_LDO7, | ||
103 | RICOH583_DS_LDO8, | ||
104 | RICOH583_DS_LDO9, | ||
105 | RICOH583_DS_PSO0, | ||
106 | RICOH583_DS_PSO1, | ||
107 | RICOH583_DS_PSO2, | ||
108 | RICOH583_DS_PSO3, | ||
109 | RICOH583_DS_PSO4, | ||
110 | RICOH583_DS_PSO5, | ||
111 | RICOH583_DS_PSO6, | ||
112 | RICOH583_DS_PSO7, | ||
113 | }; | ||
114 | enum ricoh583_ext_pwrreq_control { | ||
115 | RICOH583_EXT_PWRREQ1_CONTROL = 0x1, | ||
116 | RICOH583_EXT_PWRREQ2_CONTROL = 0x2, | ||
117 | }; | ||
118 | |||
119 | struct ricoh583_subdev_info { | ||
120 | int id; | ||
121 | const char *name; | ||
122 | void *platform_data; | ||
123 | }; | ||
124 | |||
125 | struct ricoh583_rtc_platform_data { | ||
126 | int irq; | ||
127 | struct rtc_time time; | ||
128 | }; | ||
129 | |||
130 | struct ricoh583_gpio_init_data { | ||
131 | unsigned pulldn_en:1; /* Enable pull down */ | ||
132 | unsigned output_mode_en:1; /* Enable output mode during init */ | ||
133 | unsigned output_val:1; /* Output value if it is in output mode */ | ||
134 | unsigned init_apply:1; /* Apply init data on configuring gpios*/ | ||
135 | }; | ||
136 | |||
137 | struct ricoh583_platform_data { | ||
138 | int num_subdevs; | ||
139 | struct ricoh583_subdev_info *subdevs; | ||
140 | int gpio_base; | ||
141 | int irq_base; | ||
142 | |||
143 | struct ricoh583_gpio_init_data *gpio_init_data; | ||
144 | int num_gpioinit_data; | ||
145 | bool enable_shutdown_pin; | ||
146 | }; | ||
147 | |||
148 | extern int ricoh583_read(struct device *dev, uint8_t reg, uint8_t *val); | ||
149 | extern int ricoh583_bulk_reads(struct device *dev, u8 reg, u8 count, | ||
150 | uint8_t *val); | ||
151 | extern int ricoh583_write(struct device *dev, u8 reg, uint8_t val); | ||
152 | extern int ricoh583_bulk_writes(struct device *dev, u8 reg, u8 count, | ||
153 | uint8_t *val); | ||
154 | extern int ricoh583_set_bits(struct device *dev, u8 reg, uint8_t bit_mask); | ||
155 | extern int ricoh583_clr_bits(struct device *dev, u8 reg, uint8_t bit_mask); | ||
156 | extern int ricoh583_update(struct device *dev, u8 reg, uint8_t val, | ||
157 | uint8_t mask); | ||
158 | extern int ricoh583_ext_power_req_config(struct device *dev, | ||
159 | enum ricoh583_deepsleep_control_id control_id, | ||
160 | enum ricoh583_ext_pwrreq_control ext_pwr_req, | ||
161 | int deepsleep_slot_nr); | ||
162 | extern int ricoh583_power_off(void); | ||
163 | |||
164 | #endif | ||