diff options
Diffstat (limited to 'extras/recipes-kernel/linux/linux-omap-psp-2.6.32/omap3-touchbook/0016-ARM-OMAP-omap3-touchbook-update-boardfile.patch')
-rw-r--r-- | extras/recipes-kernel/linux/linux-omap-psp-2.6.32/omap3-touchbook/0016-ARM-OMAP-omap3-touchbook-update-boardfile.patch | 620 |
1 files changed, 620 insertions, 0 deletions
diff --git a/extras/recipes-kernel/linux/linux-omap-psp-2.6.32/omap3-touchbook/0016-ARM-OMAP-omap3-touchbook-update-boardfile.patch b/extras/recipes-kernel/linux/linux-omap-psp-2.6.32/omap3-touchbook/0016-ARM-OMAP-omap3-touchbook-update-boardfile.patch new file mode 100644 index 00000000..0dc58abf --- /dev/null +++ b/extras/recipes-kernel/linux/linux-omap-psp-2.6.32/omap3-touchbook/0016-ARM-OMAP-omap3-touchbook-update-boardfile.patch | |||
@@ -0,0 +1,620 @@ | |||
1 | From 67a87638586acaf7907f94d2f0d3b09190c23880 Mon Sep 17 00:00:00 2001 | ||
2 | From: Gregoire Gentil <gregoire@gentil.com> | ||
3 | Date: Fri, 12 Mar 2010 11:49:16 +0100 | ||
4 | Subject: [PATCH 16/17] ARM: OMAP: omap3-touchbook: update boardfile | ||
5 | |||
6 | --- | ||
7 | arch/arm/mach-omap2/board-omap3touchbook.c | 417 +++++++++++++++++++++------- | ||
8 | 1 files changed, 322 insertions(+), 95 deletions(-) | ||
9 | |||
10 | diff --git a/arch/arm/mach-omap2/board-omap3touchbook.c b/arch/arm/mach-omap2/board-omap3touchbook.c | ||
11 | index fc3e03c..c22a3e3 100644 | ||
12 | --- a/arch/arm/mach-omap2/board-omap3touchbook.c | ||
13 | +++ b/arch/arm/mach-omap2/board-omap3touchbook.c | ||
14 | @@ -1,7 +1,7 @@ | ||
15 | /* | ||
16 | * linux/arch/arm/mach-omap2/board-omap3touchbook.c | ||
17 | * | ||
18 | - * Copyright (C) 2009 Always Innovating | ||
19 | + * Copyright (C) 2009-2010 Always Innovating | ||
20 | * | ||
21 | * Modified from mach-omap2/board-omap3beagleboard.c | ||
22 | * | ||
23 | @@ -33,6 +33,7 @@ | ||
24 | #include <linux/spi/spi.h> | ||
25 | |||
26 | #include <linux/spi/ads7846.h> | ||
27 | +#include <linux/mma7455l.h> | ||
28 | |||
29 | #include <linux/regulator/machine.h> | ||
30 | #include <linux/i2c/twl.h> | ||
31 | @@ -45,6 +46,7 @@ | ||
32 | |||
33 | #include <plat/board.h> | ||
34 | #include <plat/common.h> | ||
35 | +#include <plat/display.h> | ||
36 | #include <plat/gpmc.h> | ||
37 | #include <plat/nand.h> | ||
38 | #include <plat/usb.h> | ||
39 | @@ -60,18 +62,22 @@ | ||
40 | |||
41 | #include <asm/setup.h> | ||
42 | |||
43 | +#include <plat/dmtimer.h> | ||
44 | +#include <linux/backlight.h> | ||
45 | |||
46 | #define GPMC_CS0_BASE 0x60 | ||
47 | #define GPMC_CS_SIZE 0x30 | ||
48 | |||
49 | #define NAND_BLOCK_SIZE SZ_128K | ||
50 | |||
51 | +#define OMAP3_HJ_GPIO 56 | ||
52 | #define OMAP3_AC_GPIO 136 | ||
53 | +#define OMAP3_TS2_GPIO 154 | ||
54 | #define OMAP3_TS_GPIO 162 | ||
55 | #define TB_BL_PWM_TIMER 9 | ||
56 | #define TB_KILL_POWER_GPIO 168 | ||
57 | |||
58 | -unsigned long touchbook_revision; | ||
59 | +unsigned long ai_revision = 2; | ||
60 | |||
61 | static struct mtd_partition omap3touchbook_nand_partitions[] = { | ||
62 | /* All the partition sizes are listed in terms of NAND block size */ | ||
63 | @@ -126,6 +132,103 @@ static struct platform_device omap3touchbook_nand_device = { | ||
64 | .resource = &omap3touchbook_nand_resource, | ||
65 | }; | ||
66 | |||
67 | +static int touchbook_enable_dvi(struct omap_dss_device *dssdev) | ||
68 | +{ | ||
69 | + if (dssdev->reset_gpio != -1) | ||
70 | + gpio_set_value(dssdev->reset_gpio, 1); | ||
71 | + | ||
72 | + return 0; | ||
73 | +} | ||
74 | + | ||
75 | +static void touchbook_disable_dvi(struct omap_dss_device *dssdev) | ||
76 | +{ | ||
77 | + if (dssdev->reset_gpio != -1) | ||
78 | + gpio_set_value(dssdev->reset_gpio, 0); | ||
79 | +} | ||
80 | + | ||
81 | +static struct omap_dss_device touchbook_dvi_device = { | ||
82 | + .type = OMAP_DISPLAY_TYPE_DPI, | ||
83 | + .name = "dvi", | ||
84 | + .driver_name = "generic_panel", | ||
85 | + .phy.dpi.data_lines = 24, | ||
86 | + .reset_gpio = 176, | ||
87 | + .platform_enable = touchbook_enable_dvi, | ||
88 | + .platform_disable = touchbook_disable_dvi, | ||
89 | +}; | ||
90 | + | ||
91 | +static int touchbook_panel_enable_tv(struct omap_dss_device *dssdev) | ||
92 | +{ | ||
93 | +#define ENABLE_VDAC_DEDICATED 0x03 | ||
94 | +#define ENABLE_VDAC_DEV_GRP 0x20 | ||
95 | + | ||
96 | + twl_i2c_write_u8(TWL4030_MODULE_PM_RECEIVER, | ||
97 | + ENABLE_VDAC_DEDICATED, | ||
98 | + TWL4030_VDAC_DEDICATED); | ||
99 | + twl_i2c_write_u8(TWL4030_MODULE_PM_RECEIVER, | ||
100 | + ENABLE_VDAC_DEV_GRP, TWL4030_VDAC_DEV_GRP); | ||
101 | + | ||
102 | + return 0; | ||
103 | +} | ||
104 | + | ||
105 | +static void touchbook_panel_disable_tv(struct omap_dss_device *dssdev) | ||
106 | +{ | ||
107 | + twl_i2c_write_u8(TWL4030_MODULE_PM_RECEIVER, 0x00, | ||
108 | + TWL4030_VDAC_DEDICATED); | ||
109 | + twl_i2c_write_u8(TWL4030_MODULE_PM_RECEIVER, 0x00, | ||
110 | + TWL4030_VDAC_DEV_GRP); | ||
111 | +} | ||
112 | + | ||
113 | +static struct omap_dss_device touchbook_tv_device = { | ||
114 | + .name = "tv", | ||
115 | + .driver_name = "venc", | ||
116 | + .type = OMAP_DISPLAY_TYPE_VENC, | ||
117 | + .phy.venc.type = OMAP_DSS_VENC_TYPE_SVIDEO, | ||
118 | + .platform_enable = touchbook_panel_enable_tv, | ||
119 | + .platform_disable = touchbook_panel_disable_tv, | ||
120 | +}; | ||
121 | + | ||
122 | +static struct omap_dss_device *touchbook_dss_devices[] = { | ||
123 | + &touchbook_dvi_device, | ||
124 | + &touchbook_tv_device, | ||
125 | +}; | ||
126 | + | ||
127 | +static struct omap_dss_board_info touchbook_dss_data = { | ||
128 | + .num_devices = ARRAY_SIZE(touchbook_dss_devices), | ||
129 | + .devices = touchbook_dss_devices, | ||
130 | + .default_device = &touchbook_dvi_device, | ||
131 | +}; | ||
132 | + | ||
133 | +static struct platform_device touchbook_dss_device = { | ||
134 | + .name = "omapdss", | ||
135 | + .id = -1, | ||
136 | + .dev = { | ||
137 | + .platform_data = &touchbook_dss_data, | ||
138 | + }, | ||
139 | +}; | ||
140 | + | ||
141 | +static struct regulator_consumer_supply touchbook_vdac_supply = { | ||
142 | + .supply = "vdda_dac", | ||
143 | + .dev = &touchbook_dss_device.dev, | ||
144 | +}; | ||
145 | + | ||
146 | +static struct regulator_consumer_supply touchbook_vdvi_supply = { | ||
147 | + .supply = "vdds_dsi", | ||
148 | + .dev = &touchbook_dss_device.dev, | ||
149 | +}; | ||
150 | + | ||
151 | +static void __init touchbook_display_init(void) | ||
152 | +{ | ||
153 | + int r; | ||
154 | + | ||
155 | + r = gpio_request(touchbook_dvi_device.reset_gpio, "DVI reset"); | ||
156 | + if (r < 0) { | ||
157 | + printk(KERN_ERR "Unable to get DVI reset GPIO\n"); | ||
158 | + return; | ||
159 | + } | ||
160 | + | ||
161 | + gpio_direction_output(touchbook_dvi_device.reset_gpio, 0); | ||
162 | +} | ||
163 | + | ||
164 | #include "sdram-micron-mt46h32m32lf-6.h" | ||
165 | |||
166 | static struct twl4030_hsmmc_info mmc[] = { | ||
167 | @@ -137,15 +240,6 @@ static struct twl4030_hsmmc_info mmc[] = { | ||
168 | {} /* Terminator */ | ||
169 | }; | ||
170 | |||
171 | -static struct platform_device omap3_touchbook_lcd_device = { | ||
172 | - .name = "omap3touchbook_lcd", | ||
173 | - .id = -1, | ||
174 | -}; | ||
175 | - | ||
176 | -static struct omap_lcd_config omap3_touchbook_lcd_config __initdata = { | ||
177 | - .ctrl_name = "internal", | ||
178 | -}; | ||
179 | - | ||
180 | static struct regulator_consumer_supply touchbook_vmmc1_supply = { | ||
181 | .supply = "vmmc", | ||
182 | }; | ||
183 | @@ -177,6 +271,7 @@ static int touchbook_twl_gpio_setup(struct device *dev, | ||
184 | * power switch and overcurrent detect | ||
185 | */ | ||
186 | |||
187 | +#if 0 | ||
188 | gpio_request(gpio + 1, "EHCI_nOC"); | ||
189 | gpio_direction_input(gpio + 1); | ||
190 | |||
191 | @@ -187,6 +282,7 @@ static int touchbook_twl_gpio_setup(struct device *dev, | ||
192 | /* TWL4030_GPIO_MAX + 1 == ledB, PMU_STAT (out, active low LED) */ | ||
193 | gpio_leds[2].gpio = gpio + TWL4030_GPIO_MAX + 1; | ||
194 | |||
195 | +#endif | ||
196 | return 0; | ||
197 | } | ||
198 | |||
199 | @@ -201,16 +297,6 @@ static struct twl4030_gpio_platform_data touchbook_gpio_data = { | ||
200 | .setup = touchbook_twl_gpio_setup, | ||
201 | }; | ||
202 | |||
203 | -static struct regulator_consumer_supply touchbook_vdac_supply = { | ||
204 | - .supply = "vdac", | ||
205 | - .dev = &omap3_touchbook_lcd_device.dev, | ||
206 | -}; | ||
207 | - | ||
208 | -static struct regulator_consumer_supply touchbook_vdvi_supply = { | ||
209 | - .supply = "vdvi", | ||
210 | - .dev = &omap3_touchbook_lcd_device.dev, | ||
211 | -}; | ||
212 | - | ||
213 | /* VMMC1 for MMC1 pins CMD, CLK, DAT0..DAT3 (20 mA, plus card == max 220 mA) */ | ||
214 | static struct regulator_init_data touchbook_vmmc1 = { | ||
215 | .constraints = { | ||
216 | @@ -283,6 +369,15 @@ static struct twl4030_codec_data touchbook_codec_data = { | ||
217 | .audio = &touchbook_audio_data, | ||
218 | }; | ||
219 | |||
220 | +static struct twl4030_bci_platform_data touchbook_bci_data = { | ||
221 | + .tblsize = 0, | ||
222 | + .no_backup_battery = 1, | ||
223 | +}; | ||
224 | + | ||
225 | +static struct twl4030_madc_platform_data touchbook_madc_data = { | ||
226 | + .irq_line = 1, | ||
227 | +}; | ||
228 | + | ||
229 | static struct twl4030_platform_data touchbook_twldata = { | ||
230 | .irq_base = TWL4030_IRQ_BASE, | ||
231 | .irq_end = TWL4030_IRQ_END, | ||
232 | @@ -291,10 +386,15 @@ static struct twl4030_platform_data touchbook_twldata = { | ||
233 | .usb = &touchbook_usb_data, | ||
234 | .gpio = &touchbook_gpio_data, | ||
235 | .codec = &touchbook_codec_data, | ||
236 | + .madc = &touchbook_madc_data, | ||
237 | .vmmc1 = &touchbook_vmmc1, | ||
238 | .vsim = &touchbook_vsim, | ||
239 | .vdac = &touchbook_vdac, | ||
240 | .vpll2 = &touchbook_vpll2, | ||
241 | + | ||
242 | + /* TouchBook BCI */ | ||
243 | + .bci = &touchbook_bci_data, | ||
244 | + .madc = &touchbook_madc_data, | ||
245 | }; | ||
246 | |||
247 | static struct i2c_board_info __initdata touchbook_i2c_boardinfo[] = { | ||
248 | @@ -310,10 +410,18 @@ static struct i2c_board_info __initdata touchBook_i2c_boardinfo[] = { | ||
249 | { | ||
250 | I2C_BOARD_INFO("bq27200", 0x55), | ||
251 | }, | ||
252 | + { | ||
253 | + I2C_BOARD_INFO("chacha", 0x40), | ||
254 | + .irq = OMAP_GPIO_IRQ(OMAP3_TS2_GPIO), | ||
255 | + }, | ||
256 | + { | ||
257 | + I2C_BOARD_INFO("ds1307", 0x68), | ||
258 | + }, | ||
259 | }; | ||
260 | |||
261 | static int __init omap3_touchbook_i2c_init(void) | ||
262 | { | ||
263 | + int ret; | ||
264 | /* Standard TouchBook bus */ | ||
265 | omap_register_i2c_bus(1, 2600, touchbook_i2c_boardinfo, | ||
266 | ARRAY_SIZE(touchbook_i2c_boardinfo)); | ||
267 | @@ -322,53 +430,16 @@ static int __init omap3_touchbook_i2c_init(void) | ||
268 | omap_register_i2c_bus(3, 100, touchBook_i2c_boardinfo, | ||
269 | ARRAY_SIZE(touchBook_i2c_boardinfo)); | ||
270 | |||
271 | - return 0; | ||
272 | -} | ||
273 | - | ||
274 | -static void __init omap3_ads7846_init(void) | ||
275 | -{ | ||
276 | - if (gpio_request(OMAP3_TS_GPIO, "ads7846_pen_down")) { | ||
277 | - printk(KERN_ERR "Failed to request GPIO %d for " | ||
278 | - "ads7846 pen down IRQ\n", OMAP3_TS_GPIO); | ||
279 | - return; | ||
280 | + ret = gpio_request(OMAP3_TS2_GPIO, "chacha"); | ||
281 | + if (ret < 0) { | ||
282 | + printk(KERN_ERR "Failed to request GPIO %d for chacha IRQ\n", OMAP3_TS2_GPIO); | ||
283 | + return 0; | ||
284 | } | ||
285 | + gpio_direction_input(OMAP3_TS2_GPIO); | ||
286 | |||
287 | - gpio_direction_input(OMAP3_TS_GPIO); | ||
288 | - omap_set_gpio_debounce(OMAP3_TS_GPIO, 1); | ||
289 | - omap_set_gpio_debounce_time(OMAP3_TS_GPIO, 0xa); | ||
290 | + return 0; | ||
291 | } | ||
292 | |||
293 | -static struct ads7846_platform_data ads7846_config = { | ||
294 | - .x_min = 100, | ||
295 | - .y_min = 265, | ||
296 | - .x_max = 3950, | ||
297 | - .y_max = 3750, | ||
298 | - .x_plate_ohms = 40, | ||
299 | - .pressure_max = 255, | ||
300 | - .debounce_max = 10, | ||
301 | - .debounce_tol = 5, | ||
302 | - .debounce_rep = 1, | ||
303 | - .gpio_pendown = OMAP3_TS_GPIO, | ||
304 | - .keep_vref_on = 1, | ||
305 | -}; | ||
306 | - | ||
307 | -static struct omap2_mcspi_device_config ads7846_mcspi_config = { | ||
308 | - .turbo_mode = 0, | ||
309 | - .single_channel = 1, /* 0: slave, 1: master */ | ||
310 | -}; | ||
311 | - | ||
312 | -static struct spi_board_info omap3_ads7846_spi_board_info[] __initdata = { | ||
313 | - { | ||
314 | - .modalias = "ads7846", | ||
315 | - .bus_num = 4, | ||
316 | - .chip_select = 0, | ||
317 | - .max_speed_hz = 1500000, | ||
318 | - .controller_data = &ads7846_mcspi_config, | ||
319 | - .irq = OMAP_GPIO_IRQ(OMAP3_TS_GPIO), | ||
320 | - .platform_data = &ads7846_config, | ||
321 | - } | ||
322 | -}; | ||
323 | - | ||
324 | static struct gpio_led gpio_leds[] = { | ||
325 | { | ||
326 | .name = "touchbook::usr0", | ||
327 | @@ -412,6 +483,7 @@ static struct gpio_keys_button gpio_buttons[] = { | ||
328 | .gpio = 183, | ||
329 | .desc = "power", | ||
330 | .wakeup = 1, | ||
331 | + .active_low = 1, | ||
332 | }, | ||
333 | }; | ||
334 | |||
335 | @@ -428,23 +500,8 @@ static struct platform_device keys_gpio = { | ||
336 | }, | ||
337 | }; | ||
338 | |||
339 | -static struct omap_board_config_kernel omap3_touchbook_config[] __initdata = { | ||
340 | - { OMAP_TAG_LCD, &omap3_touchbook_lcd_config }, | ||
341 | -}; | ||
342 | - | ||
343 | -#ifdef CONFIG_OMAP_MUX | ||
344 | -static struct omap_board_mux board_mux[] __initdata = { | ||
345 | - { .reg_offset = OMAP_MUX_TERMINATOR }, | ||
346 | -}; | ||
347 | -#else | ||
348 | -#define board_mux NULL | ||
349 | -#endif | ||
350 | - | ||
351 | static void __init omap3_touchbook_init_irq(void) | ||
352 | { | ||
353 | - omap3_mux_init(board_mux, OMAP_PACKAGE_CBB); | ||
354 | - omap_board_config = omap3_touchbook_config; | ||
355 | - omap_board_config_size = ARRAY_SIZE(omap3_touchbook_config); | ||
356 | omap2_init_common_hw(mt46h32m32lf6_sdrc_params, | ||
357 | mt46h32m32lf6_sdrc_params, omap35x_mpu_rate_table, | ||
358 | omap35x_dsp_rate_table, omap35x_l3_rate_table); | ||
359 | @@ -456,9 +513,9 @@ static void __init omap3_touchbook_init_irq(void) | ||
360 | } | ||
361 | |||
362 | static struct platform_device *omap3_touchbook_devices[] __initdata = { | ||
363 | - &omap3_touchbook_lcd_device, | ||
364 | &leds_gpio, | ||
365 | &keys_gpio, | ||
366 | + &touchbook_dss_device, | ||
367 | }; | ||
368 | |||
369 | static void __init omap3touchbook_flash_init(void) | ||
370 | @@ -500,7 +557,7 @@ static void __init omap3touchbook_flash_init(void) | ||
371 | } | ||
372 | } | ||
373 | |||
374 | -static struct ehci_hcd_omap_platform_data ehci_pdata __initconst = { | ||
375 | +static struct ehci_hcd_omap_platform_data ehci_pdata __initdata = { | ||
376 | |||
377 | .port_mode[0] = EHCI_HCD_OMAP_MODE_PHY, | ||
378 | .port_mode[1] = EHCI_HCD_OMAP_MODE_PHY, | ||
379 | @@ -512,6 +569,170 @@ static struct ehci_hcd_omap_platform_data ehci_pdata __initconst = { | ||
380 | .reset_gpio_port[2] = -EINVAL | ||
381 | }; | ||
382 | |||
383 | +#ifdef CONFIG_OMAP_MUX | ||
384 | +static struct omap_board_mux board_mux[] __initdata = { | ||
385 | + { .reg_offset = OMAP_MUX_TERMINATOR }, | ||
386 | +}; | ||
387 | +#else | ||
388 | +#define board_mux NULL | ||
389 | +#endif | ||
390 | + | ||
391 | +static struct ads7846_platform_data ads7846_config = { | ||
392 | + .x_min = 100, | ||
393 | + .y_min = 265, | ||
394 | + .x_max = 3950, | ||
395 | + .y_max = 3750, | ||
396 | + .x_plate_ohms = 40, | ||
397 | + .pressure_max = 255, | ||
398 | + .debounce_max = 10, | ||
399 | + .debounce_tol = 5, | ||
400 | + .debounce_rep = 1, | ||
401 | + .gpio_pendown = OMAP3_TS_GPIO, | ||
402 | + .keep_vref_on = 1, | ||
403 | +}; | ||
404 | + | ||
405 | +static struct omap2_mcspi_device_config ads7846_mcspi_config = { | ||
406 | + .turbo_mode = 0, | ||
407 | + .single_channel = 1, /* 0: slave, 1: master */ | ||
408 | +}; | ||
409 | + | ||
410 | +static struct spi_board_info omap3_ads7846_spi_board_info[] __initdata = { | ||
411 | + { | ||
412 | + .modalias = "ads7846", | ||
413 | + .bus_num = 4, | ||
414 | + .chip_select = 0, | ||
415 | + .max_speed_hz = 1500000, | ||
416 | + .controller_data = &ads7846_mcspi_config, | ||
417 | + .irq = OMAP_GPIO_IRQ(OMAP3_TS_GPIO), | ||
418 | + .platform_data = &ads7846_config, | ||
419 | + } | ||
420 | +}; | ||
421 | + | ||
422 | +static void __init omap3_ads7846_init(void) | ||
423 | +{ | ||
424 | + if (gpio_request(OMAP3_TS_GPIO, "ads7846_pen_down")) { | ||
425 | + printk(KERN_ERR "Failed to request GPIO %d for " | ||
426 | + "ads7846 pen down IRQ\n", OMAP3_TS_GPIO); | ||
427 | + return; | ||
428 | + } | ||
429 | + | ||
430 | + gpio_direction_input(OMAP3_TS_GPIO); | ||
431 | + omap_set_gpio_debounce(OMAP3_TS_GPIO, 1); | ||
432 | + omap_set_gpio_debounce_time(OMAP3_TS_GPIO, 0xa); | ||
433 | +} | ||
434 | + | ||
435 | +static struct mma7455l_platform_data mma7455l_config = { | ||
436 | + .calibration_x = -4, | ||
437 | + .calibration_y = 28, | ||
438 | + .calibration_z = -28, | ||
439 | +}; | ||
440 | + | ||
441 | +static struct omap2_mcspi_device_config mma7455l_mcspi_config = { | ||
442 | + .turbo_mode = 0, | ||
443 | + .single_channel = 1, /* 0: slave, 1: master */ | ||
444 | +}; | ||
445 | + | ||
446 | +static struct spi_board_info omap3_mma7455l_spi_board_info[] __initdata = { | ||
447 | + { | ||
448 | + .modalias = "mma7455l", | ||
449 | + .bus_num = 3, | ||
450 | + .chip_select = 0, | ||
451 | + .max_speed_hz = 200000, | ||
452 | + .irq = OMAP_GPIO_IRQ(OMAP3_AC_GPIO), | ||
453 | + .controller_data = &mma7455l_mcspi_config, //(void *) 135, | ||
454 | + .platform_data = &mma7455l_config, | ||
455 | + } | ||
456 | +}; | ||
457 | + | ||
458 | +static void __init omap3_mma7455l_init(void) | ||
459 | +{ | ||
460 | + int ret; | ||
461 | + | ||
462 | + ret = gpio_request(OMAP3_AC_GPIO, "mma7455l"); | ||
463 | + if (ret < 0) { | ||
464 | + printk(KERN_ERR "Failed to request GPIO %d for mma7455l IRQ\n", OMAP3_AC_GPIO); | ||
465 | + return; | ||
466 | + } | ||
467 | + | ||
468 | + gpio_direction_input(OMAP3_AC_GPIO); | ||
469 | +} | ||
470 | + | ||
471 | +static int touchbook_backlight_brightness = 50; | ||
472 | +static struct omap_dm_timer *touchbook_backlight_pwm; | ||
473 | + | ||
474 | +static int touchbook_backlight_read(struct backlight_device *bd) | ||
475 | +{ | ||
476 | + return touchbook_backlight_brightness; | ||
477 | +} | ||
478 | + | ||
479 | +static int touchbook_backlight_update(struct backlight_device *bd) | ||
480 | +{ | ||
481 | + int value = bd->props.brightness; | ||
482 | + touchbook_backlight_brightness = value; | ||
483 | + | ||
484 | + /* Frequency calculation: | ||
485 | + - For 200Hz PWM, you want to load -164 (=> -32768Hz / 200Hz). | ||
486 | + - Minimum duty cycle for the backlight is 15%. | ||
487 | + - You have (164*0.85) => ~140 levels of brightness. | ||
488 | + */ | ||
489 | + | ||
490 | + /* Halve input brightness */ | ||
491 | + if (!bd->props.boost) | ||
492 | + value /= 2; | ||
493 | + | ||
494 | + /* For maximum brightness, just stop the timer... */ | ||
495 | + if(value != bd->props.max_brightness) | ||
496 | + { | ||
497 | + /* Load the appropriate value for 200Hz PWM */ | ||
498 | + u32 period = clk_get_rate(omap_dm_timer_get_fclk(touchbook_backlight_pwm)) / bd->props.pwm_fq; | ||
499 | + | ||
500 | + /* Minimum duty cycle is 15% */ | ||
501 | + u32 minimum = (period * bd->props.min_duty) / 100; | ||
502 | + u32 maximum = (period * 17) / 20; | ||
503 | + | ||
504 | + /* Work out match value */ | ||
505 | + u32 match = (maximum * value) / 100; | ||
506 | + | ||
507 | + /* Start... */ | ||
508 | + omap_dm_timer_set_load(touchbook_backlight_pwm, 1, 0xFFFFFFFF - period - 1); | ||
509 | + omap_dm_timer_set_match(touchbook_backlight_pwm, 1, 0xFFFFFFFF - minimum - match); | ||
510 | + omap_dm_timer_write_counter(touchbook_backlight_pwm, -1); | ||
511 | + omap_dm_timer_start(touchbook_backlight_pwm); | ||
512 | + } | ||
513 | + else | ||
514 | + omap_dm_timer_stop(touchbook_backlight_pwm); | ||
515 | + | ||
516 | + | ||
517 | + return 0; | ||
518 | +} | ||
519 | + | ||
520 | +static struct backlight_ops touchbook_backlight_properties = { | ||
521 | + .get_brightness = touchbook_backlight_read, | ||
522 | + .update_status = touchbook_backlight_update, | ||
523 | +}; | ||
524 | + | ||
525 | +static void __init omap3_touchbook_backlight_init(void) | ||
526 | +{ | ||
527 | + static struct backlight_device *bd; | ||
528 | + bd = backlight_device_register("touchbook", NULL, NULL, &touchbook_backlight_properties); | ||
529 | + | ||
530 | + if(bd) | ||
531 | + { | ||
532 | + touchbook_backlight_pwm = omap_dm_timer_request_specific(TB_BL_PWM_TIMER); | ||
533 | + omap_dm_timer_enable(touchbook_backlight_pwm); | ||
534 | + omap_dm_timer_set_source(touchbook_backlight_pwm, OMAP_TIMER_SRC_SYS_CLK); | ||
535 | + omap_dm_timer_set_pwm(touchbook_backlight_pwm, 1, 1, OMAP_TIMER_TRIGGER_OVERFLOW_AND_COMPARE); | ||
536 | + | ||
537 | + bd->props.max_brightness = 100; | ||
538 | + bd->props.brightness = touchbook_backlight_brightness; | ||
539 | + bd->props.boost = 0; | ||
540 | + bd->props.min_duty = 15; | ||
541 | + bd->props.pwm_fq = 200; | ||
542 | + } | ||
543 | + | ||
544 | + touchbook_backlight_update(bd); | ||
545 | +} | ||
546 | + | ||
547 | static void omap3_touchbook_poweroff(void) | ||
548 | { | ||
549 | int r; | ||
550 | @@ -525,33 +746,26 @@ static void omap3_touchbook_poweroff(void) | ||
551 | gpio_direction_output(TB_KILL_POWER_GPIO, 0); | ||
552 | } | ||
553 | |||
554 | -static void __init early_touchbook_revision(char **p) | ||
555 | +static int __init ai_revision_instance(char *str) | ||
556 | { | ||
557 | - if (!*p) | ||
558 | - return; | ||
559 | + if (!str) | ||
560 | + return -EINVAL; | ||
561 | + | ||
562 | + ai_revision = simple_strtoul(str, NULL, 10); | ||
563 | |||
564 | - strict_strtoul(*p, 10, &touchbook_revision); | ||
565 | + return 0; | ||
566 | } | ||
567 | -__early_param("tbr=", early_touchbook_revision); | ||
568 | |||
569 | static void __init omap3_touchbook_init(void) | ||
570 | { | ||
571 | pm_power_off = omap3_touchbook_poweroff; | ||
572 | |||
573 | + omap3_mux_init(board_mux, OMAP_PACKAGE_CBB); | ||
574 | omap3_touchbook_i2c_init(); | ||
575 | platform_add_devices(omap3_touchbook_devices, | ||
576 | ARRAY_SIZE(omap3_touchbook_devices)); | ||
577 | omap_serial_init(); | ||
578 | |||
579 | - omap_mux_init_gpio(170, OMAP_PIN_INPUT); | ||
580 | - gpio_request(176, "DVI_nPD"); | ||
581 | - /* REVISIT leave DVI powered down until it's needed ... */ | ||
582 | - gpio_direction_output(176, true); | ||
583 | - | ||
584 | - /* Touchscreen and accelerometer */ | ||
585 | - spi_register_board_info(omap3_ads7846_spi_board_info, | ||
586 | - ARRAY_SIZE(omap3_ads7846_spi_board_info)); | ||
587 | - omap3_ads7846_init(); | ||
588 | usb_musb_init(); | ||
589 | usb_ehci_init(&ehci_pdata); | ||
590 | omap3touchbook_flash_init(); | ||
591 | @@ -559,6 +773,17 @@ static void __init omap3_touchbook_init(void) | ||
592 | /* Ensure SDRC pins are mux'd for self-refresh */ | ||
593 | omap_mux_init_signal("sdrc_cke0", OMAP_PIN_OUTPUT); | ||
594 | omap_mux_init_signal("sdrc_cke1", OMAP_PIN_OUTPUT); | ||
595 | + | ||
596 | + touchbook_display_init(); | ||
597 | + omap3_touchbook_backlight_init(); | ||
598 | + | ||
599 | + /* Touchscreen and accelerometer */ | ||
600 | + spi_register_board_info(omap3_ads7846_spi_board_info, | ||
601 | + ARRAY_SIZE(omap3_ads7846_spi_board_info)); | ||
602 | + spi_register_board_info(omap3_mma7455l_spi_board_info, | ||
603 | + ARRAY_SIZE(omap3_mma7455l_spi_board_info)); | ||
604 | + omap3_ads7846_init(); | ||
605 | + omap3_mma7455l_init(); | ||
606 | } | ||
607 | |||
608 | static void __init omap3_touchbook_map_io(void) | ||
609 | @@ -567,6 +792,8 @@ static void __init omap3_touchbook_map_io(void) | ||
610 | omap2_map_common_io(); | ||
611 | } | ||
612 | |||
613 | +early_param("air", ai_revision_instance); | ||
614 | + | ||
615 | MACHINE_START(TOUCHBOOK, "OMAP3 touchbook Board") | ||
616 | /* Maintainer: Gregoire Gentil - http://www.alwaysinnovating.com */ | ||
617 | .phys_io = 0x48000000, | ||
618 | -- | ||
619 | 1.6.6.1 | ||
620 | |||