54b6e05ed9a063c1303a0f92e42313ab7d0c35d6
[glsdk/meta-ti-glsdk.git] / recipes-kernel / linux / linux-3.0 / pm-wip / voltdm / 0022-OMAP-New-twl-common-for-common-TWL-configuration.patch
1 From c9641280760e72a387d56410c49f3f2586910aa9 Mon Sep 17 00:00:00 2001
2 From: Peter Ujfalusi <peter.ujfalusi@ti.com>
3 Date: Sat, 4 Jun 2011 08:16:41 +0300
4 Subject: [PATCH 022/149] OMAP: New twl-common for common TWL configuration
6 Introduce a new file, which will be used to configure
7 common pmic (TWL) devices, regulators, and TWL audio.
9 Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
10 Acked-by: Tony Lindgren <tony@atomide.com>
11 ---
12 arch/arm/mach-omap2/Makefile | 2 +-
13 arch/arm/mach-omap2/common-board-devices.c | 21 -------------
14 arch/arm/mach-omap2/common-board-devices.h | 26 +--------------
15 arch/arm/mach-omap2/twl-common.c | 46 ++++++++++++++++++++++++++++
16 arch/arm/mach-omap2/twl-common.h | 28 +++++++++++++++++
17 5 files changed, 77 insertions(+), 46 deletions(-)
18 create mode 100644 arch/arm/mach-omap2/twl-common.c
19 create mode 100644 arch/arm/mach-omap2/twl-common.h
21 diff --git a/arch/arm/mach-omap2/Makefile b/arch/arm/mach-omap2/Makefile
22 index adbe82d..ff1466f 100644
23 --- a/arch/arm/mach-omap2/Makefile
24 +++ b/arch/arm/mach-omap2/Makefile
25 @@ -269,4 +269,4 @@ obj-$(CONFIG_ARCH_OMAP4) += hwspinlock.o
26 disp-$(CONFIG_OMAP2_DSS) := display.o
27 obj-y += $(disp-m) $(disp-y)
29 -obj-y += common-board-devices.o
30 +obj-y += common-board-devices.o twl-common.o
31 diff --git a/arch/arm/mach-omap2/common-board-devices.c b/arch/arm/mach-omap2/common-board-devices.c
32 index 0043fa8..bcb0c58 100644
33 --- a/arch/arm/mach-omap2/common-board-devices.c
34 +++ b/arch/arm/mach-omap2/common-board-devices.c
35 @@ -20,36 +20,15 @@
36 *
37 */
39 -#include <linux/i2c.h>
40 -#include <linux/i2c/twl.h>
41 -
42 #include <linux/gpio.h>
43 #include <linux/spi/spi.h>
44 #include <linux/spi/ads7846.h>
46 -#include <plat/i2c.h>
47 #include <plat/mcspi.h>
48 #include <plat/nand.h>
50 #include "common-board-devices.h"
52 -static struct i2c_board_info __initdata pmic_i2c_board_info = {
53 - .addr = 0x48,
54 - .flags = I2C_CLIENT_WAKE,
55 -};
56 -
57 -void __init omap_pmic_init(int bus, u32 clkrate,
58 - const char *pmic_type, int pmic_irq,
59 - struct twl4030_platform_data *pmic_data)
60 -{
61 - strncpy(pmic_i2c_board_info.type, pmic_type,
62 - sizeof(pmic_i2c_board_info.type));
63 - pmic_i2c_board_info.irq = pmic_irq;
64 - pmic_i2c_board_info.platform_data = pmic_data;
65 -
66 - omap_register_i2c_bus(bus, clkrate, &pmic_i2c_board_info, 1);
67 -}
68 -
69 #if defined(CONFIG_TOUCHSCREEN_ADS7846) || \
70 defined(CONFIG_TOUCHSCREEN_ADS7846_MODULE)
71 static struct omap2_mcspi_device_config ads7846_mcspi_config = {
72 diff --git a/arch/arm/mach-omap2/common-board-devices.h b/arch/arm/mach-omap2/common-board-devices.h
73 index 6797190..a0b4a42 100644
74 --- a/arch/arm/mach-omap2/common-board-devices.h
75 +++ b/arch/arm/mach-omap2/common-board-devices.h
76 @@ -1,33 +1,11 @@
77 #ifndef __OMAP_COMMON_BOARD_DEVICES__
78 #define __OMAP_COMMON_BOARD_DEVICES__
80 +#include "twl-common.h"
81 +
82 #define NAND_BLOCK_SIZE SZ_128K
84 -struct twl4030_platform_data;
85 struct mtd_partition;
86 -
87 -void omap_pmic_init(int bus, u32 clkrate, const char *pmic_type, int pmic_irq,
88 - struct twl4030_platform_data *pmic_data);
89 -
90 -static inline void omap2_pmic_init(const char *pmic_type,
91 - struct twl4030_platform_data *pmic_data)
92 -{
93 - omap_pmic_init(2, 2600, pmic_type, INT_24XX_SYS_NIRQ, pmic_data);
94 -}
95 -
96 -static inline void omap3_pmic_init(const char *pmic_type,
97 - struct twl4030_platform_data *pmic_data)
98 -{
99 - omap_pmic_init(1, 2600, pmic_type, INT_34XX_SYS_NIRQ, pmic_data);
100 -}
101 -
102 -static inline void omap4_pmic_init(const char *pmic_type,
103 - struct twl4030_platform_data *pmic_data)
104 -{
105 - /* Phoenix Audio IC needs I2C1 to start with 400 KHz or less */
106 - omap_pmic_init(1, 400, pmic_type, OMAP44XX_IRQ_SYS_1N, pmic_data);
107 -}
108 -
109 struct ads7846_platform_data;
111 void omap_ads7846_init(int bus_num, int gpio_pendown, int gpio_debounce,
112 diff --git a/arch/arm/mach-omap2/twl-common.c b/arch/arm/mach-omap2/twl-common.c
113 new file mode 100644
114 index 0000000..4f7b24c
115 --- /dev/null
116 +++ b/arch/arm/mach-omap2/twl-common.c
117 @@ -0,0 +1,46 @@
118 +/*
119 + * twl-common.c
120 + *
121 + * Copyright (C) 2011 Texas Instruments, Inc..
122 + * Author: Peter Ujfalusi <peter.ujfalusi@ti.com>
123 + *
124 + * This program is free software; you can redistribute it and/or
125 + * modify it under the terms of the GNU General Public License
126 + * version 2 as published by the Free Software Foundation.
127 + *
128 + * This program is distributed in the hope that it will be useful, but
129 + * WITHOUT ANY WARRANTY; without even the implied warranty of
130 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
131 + * General Public License for more details.
132 + *
133 + * You should have received a copy of the GNU General Public License
134 + * along with this program; if not, write to the Free Software
135 + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
136 + * 02110-1301 USA
137 + *
138 + */
139 +
140 +#include <linux/i2c.h>
141 +#include <linux/i2c/twl.h>
142 +#include <linux/gpio.h>
143 +
144 +#include <plat/i2c.h>
145 +
146 +#include "twl-common.h"
147 +
148 +static struct i2c_board_info __initdata pmic_i2c_board_info = {
149 + .addr = 0x48,
150 + .flags = I2C_CLIENT_WAKE,
151 +};
152 +
153 +void __init omap_pmic_init(int bus, u32 clkrate,
154 + const char *pmic_type, int pmic_irq,
155 + struct twl4030_platform_data *pmic_data)
156 +{
157 + strncpy(pmic_i2c_board_info.type, pmic_type,
158 + sizeof(pmic_i2c_board_info.type));
159 + pmic_i2c_board_info.irq = pmic_irq;
160 + pmic_i2c_board_info.platform_data = pmic_data;
161 +
162 + omap_register_i2c_bus(bus, clkrate, &pmic_i2c_board_info, 1);
163 +}
164 diff --git a/arch/arm/mach-omap2/twl-common.h b/arch/arm/mach-omap2/twl-common.h
165 new file mode 100644
166 index 0000000..e9fe2ab
167 --- /dev/null
168 +++ b/arch/arm/mach-omap2/twl-common.h
169 @@ -0,0 +1,28 @@
170 +#ifndef __OMAP_PMIC_COMMON__
171 +#define __OMAP_PMIC_COMMON__
172 +
173 +struct twl4030_platform_data;
174 +
175 +void omap_pmic_init(int bus, u32 clkrate, const char *pmic_type, int pmic_irq,
176 + struct twl4030_platform_data *pmic_data);
177 +
178 +static inline void omap2_pmic_init(const char *pmic_type,
179 + struct twl4030_platform_data *pmic_data)
180 +{
181 + omap_pmic_init(2, 2600, pmic_type, INT_24XX_SYS_NIRQ, pmic_data);
182 +}
183 +
184 +static inline void omap3_pmic_init(const char *pmic_type,
185 + struct twl4030_platform_data *pmic_data)
186 +{
187 + omap_pmic_init(1, 2600, pmic_type, INT_34XX_SYS_NIRQ, pmic_data);
188 +}
189 +
190 +static inline void omap4_pmic_init(const char *pmic_type,
191 + struct twl4030_platform_data *pmic_data)
192 +{
193 + /* Phoenix Audio IC needs I2C1 to start with 400 KHz or less */
194 + omap_pmic_init(1, 400, pmic_type, OMAP44XX_IRQ_SYS_1N, pmic_data);
195 +}
196 +
197 +#endif /* __OMAP_PMIC_COMMON__ */
198 --
199 1.6.6.1