2 * arch/arm/mach-u300/i2c.c
4 * Copyright (C) 2009 ST-Ericsson AB
5 * License terms: GNU General Public License (GPL) version 2
7 * Register board i2c devices
8 * Author: Linus Walleij <linus.walleij@stericsson.com>
10 #include <linux/kernel.h>
11 #include <linux/i2c.h>
12 #include <linux/mfd/ab3100.h>
13 #include <linux/regulator/machine.h>
14 #include <linux/amba/bus.h>
15 #include <mach/irqs.h>
18 * Initial settings of ab3100 registers.
19 * Common for below LDO regulator settings are that
20 * bit 7-5 controls voltage. Bit 4 turns regulator ON(1) or OFF(0).
21 * Bit 3-2 controls sleep enable and bit 1-0 controls sleep mode.
24 /* LDO_A 0x16: 2.75V, ON, SLEEP_A, SLEEP OFF GND */
25 #define LDO_A_SETTING 0x16
26 /* LDO_C 0x10: 2.65V, ON, SLEEP_A or B, SLEEP full power */
27 #define LDO_C_SETTING 0x10
28 /* LDO_D 0x10: 2.65V, ON, sleep mode not used */
29 #define LDO_D_SETTING 0x10
30 /* LDO_E 0x10: 1.8V, ON, SLEEP_A or B, SLEEP full power */
31 #define LDO_E_SETTING 0x10
32 /* LDO_E SLEEP 0x00: 1.8V, not used, SLEEP_A or B, not used */
33 #define LDO_E_SLEEP_SETTING 0x00
34 /* LDO_F 0xD0: 2.5V, ON, SLEEP_A or B, SLEEP full power */
35 #define LDO_F_SETTING 0xD0
36 /* LDO_G 0x00: 2.85V, OFF, SLEEP_A or B, SLEEP full power */
37 #define LDO_G_SETTING 0x00
38 /* LDO_H 0x18: 2.75V, ON, SLEEP_B, SLEEP full power */
39 #define LDO_H_SETTING 0x18
40 /* LDO_K 0x00: 2.75V, OFF, SLEEP_A or B, SLEEP full power */
41 #define LDO_K_SETTING 0x00
42 /* LDO_EXT 0x00: Voltage not set, OFF, not used, not used */
43 #define LDO_EXT_SETTING 0x00
44 /* BUCK 0x7D: 1.2V, ON, SLEEP_A and B, SLEEP low power */
45 #define BUCK_SETTING 0x7D
46 /* BUCK SLEEP 0xAC: 1.05V, Not used, SLEEP_A and B, Not used */
47 #define BUCK_SLEEP_SETTING 0xAC
49 static struct regulator_consumer_supply supply_ldo_c
[] = {
51 .dev_name
= "ab3100-codec",
52 .supply
= "vaudio", /* Powers the codec */
57 * This one needs to be a supply so we can turn it off
58 * in order to shut down the system.
60 static struct regulator_consumer_supply supply_ldo_d
[] = {
63 .supply
= "vana15", /* Powers the SoC (CPU etc) */
67 static struct regulator_consumer_supply supply_ldo_g
[] = {
70 .supply
= "vmmc", /* Powers MMC/SD card */
74 static struct regulator_consumer_supply supply_ldo_h
[] = {
76 .dev_name
= "xgam_pdi",
77 .supply
= "vdisp", /* Powers camera, display etc */
81 static struct regulator_consumer_supply supply_ldo_k
[] = {
84 .supply
= "vir", /* Power IrDA */
89 * This is a placeholder for whoever wish to use the
92 static struct regulator_consumer_supply supply_ldo_ext
[] = {
95 .supply
= "vext", /* External power */
99 /* Preset (hardware defined) voltages for these regulators */
100 #define LDO_A_VOLTAGE 2750000
101 #define LDO_C_VOLTAGE 2650000
102 #define LDO_D_VOLTAGE 2650000
104 static struct ab3100_platform_data ab3100_plf_data
= {
106 /* LDO A routing and constraints */
110 .min_uV
= LDO_A_VOLTAGE
,
111 .max_uV
= LDO_A_VOLTAGE
,
112 .valid_modes_mask
= REGULATOR_MODE_NORMAL
,
117 /* LDO C routing and constraints */
120 .min_uV
= LDO_C_VOLTAGE
,
121 .max_uV
= LDO_C_VOLTAGE
,
122 .valid_modes_mask
= REGULATOR_MODE_NORMAL
,
124 .num_consumer_supplies
= ARRAY_SIZE(supply_ldo_c
),
125 .consumer_supplies
= supply_ldo_c
,
127 /* LDO D routing and constraints */
130 .min_uV
= LDO_D_VOLTAGE
,
131 .max_uV
= LDO_D_VOLTAGE
,
132 .valid_modes_mask
= REGULATOR_MODE_NORMAL
,
133 .valid_ops_mask
= REGULATOR_CHANGE_STATUS
,
135 * Actually this is boot_on but we need
136 * to reference count it externally to
137 * be able to shut down the system.
140 .num_consumer_supplies
= ARRAY_SIZE(supply_ldo_d
),
141 .consumer_supplies
= supply_ldo_d
,
143 /* LDO E routing and constraints */
149 .valid_modes_mask
= REGULATOR_MODE_NORMAL
,
151 REGULATOR_CHANGE_VOLTAGE
|
152 REGULATOR_CHANGE_STATUS
,
157 /* LDO F routing and constraints */
163 .valid_modes_mask
= REGULATOR_MODE_NORMAL
,
165 REGULATOR_CHANGE_VOLTAGE
|
166 REGULATOR_CHANGE_STATUS
,
171 /* LDO G routing and constraints */
176 .valid_modes_mask
= REGULATOR_MODE_NORMAL
,
178 REGULATOR_CHANGE_VOLTAGE
|
179 REGULATOR_CHANGE_STATUS
,
181 .num_consumer_supplies
= ARRAY_SIZE(supply_ldo_g
),
182 .consumer_supplies
= supply_ldo_g
,
184 /* LDO H routing and constraints */
189 .valid_modes_mask
= REGULATOR_MODE_NORMAL
,
191 REGULATOR_CHANGE_VOLTAGE
|
192 REGULATOR_CHANGE_STATUS
,
194 .num_consumer_supplies
= ARRAY_SIZE(supply_ldo_h
),
195 .consumer_supplies
= supply_ldo_h
,
197 /* LDO K routing and constraints */
202 .valid_modes_mask
= REGULATOR_MODE_NORMAL
,
204 REGULATOR_CHANGE_VOLTAGE
|
205 REGULATOR_CHANGE_STATUS
,
207 .num_consumer_supplies
= ARRAY_SIZE(supply_ldo_k
),
208 .consumer_supplies
= supply_ldo_k
,
210 /* External regulator interface. No fixed voltage specified.
211 * If we knew the voltage of the external regulator and it
212 * was connected on the board, we could add the (fixed)
213 * voltage for it here.
219 .valid_modes_mask
= REGULATOR_MODE_NORMAL
,
221 REGULATOR_CHANGE_STATUS
,
223 .num_consumer_supplies
= ARRAY_SIZE(supply_ldo_ext
),
224 .consumer_supplies
= supply_ldo_ext
,
226 /* Buck converter routing and constraints */
232 .valid_modes_mask
= REGULATOR_MODE_NORMAL
,
234 REGULATOR_CHANGE_VOLTAGE
|
235 REGULATOR_CHANGE_STATUS
,
257 static struct i2c_board_info __initdata bus0_i2c_board_info
[] = {
261 .irq
= IRQ_U300_IRQ0_EXT
,
262 .platform_data
= &ab3100_plf_data
,
266 static struct i2c_board_info __initdata bus1_i2c_board_info
[] = {
267 #ifdef CONFIG_MACH_U300_BS335
281 void __init
u300_i2c_register_board_devices(void)
283 i2c_register_board_info(0, bus0_i2c_board_info
,
284 ARRAY_SIZE(bus0_i2c_board_info
));
286 * This makes the core shut down all unused regulators
287 * after all the initcalls have completed.
289 regulator_has_full_constraints();
290 i2c_register_board_info(1, bus1_i2c_board_info
,
291 ARRAY_SIZE(bus1_i2c_board_info
));