diff options
author | Tony Lindgren <tony@atomide.com> | 2006-12-07 16:58:17 -0500 |
---|---|---|
committer | Tony Lindgren <tony@atomide.com> | 2007-09-20 21:34:50 -0400 |
commit | a524626b113e36fc70cb456449444018e3045d5f (patch) | |
tree | 90307a026ae10a96d214d8822d363e2452df7d72 /arch/arm/mach-omap1/board-palmte.c | |
parent | c79ed1940ca9a4af5e9c182ac51f28dadd32956d (diff) |
ARM: OMAP: Sync board specific files with linux-omap
This patch syncs omap board specific files with linux-omap tree.
Patch consists mostly of driver updates done in linux-omap
tree for drivers not yet in mainline kernel.
Signed-off-by: Tony Lindgren <tony@atomide.com>
Diffstat (limited to 'arch/arm/mach-omap1/board-palmte.c')
-rw-r--r-- | arch/arm/mach-omap1/board-palmte.c | 123 |
1 files changed, 0 insertions, 123 deletions
diff --git a/arch/arm/mach-omap1/board-palmte.c b/arch/arm/mach-omap1/board-palmte.c index 9af031ad63b8..2f9d00a00135 100644 --- a/arch/arm/mach-omap1/board-palmte.c +++ b/arch/arm/mach-omap1/board-palmte.c | |||
@@ -321,116 +321,6 @@ static struct tsc2102_config palmte_tsc2102_config = { | |||
321 | .alsa_config = &palmte_alsa_config, | 321 | .alsa_config = &palmte_alsa_config, |
322 | }; | 322 | }; |
323 | 323 | ||
324 | static struct omap_mcbsp_reg_cfg palmte_mcbsp1_regs = { | ||
325 | .spcr2 = FRST | GRST | XRST | XINTM(3), | ||
326 | .xcr2 = XDATDLY(1) | XFIG, | ||
327 | .xcr1 = XWDLEN1(OMAP_MCBSP_WORD_32), | ||
328 | .pcr0 = SCLKME | FSXP | CLKXP, | ||
329 | }; | ||
330 | |||
331 | static struct omap_alsa_codec_config palmte_alsa_config = { | ||
332 | .name = "TSC2102 audio", | ||
333 | .mcbsp_regs_alsa = &palmte_mcbsp1_regs, | ||
334 | .codec_configure_dev = NULL, /* tsc2102_configure, */ | ||
335 | .codec_set_samplerate = NULL, /* tsc2102_set_samplerate, */ | ||
336 | .codec_clock_setup = NULL, /* tsc2102_clock_setup, */ | ||
337 | .codec_clock_on = NULL, /* tsc2102_clock_on, */ | ||
338 | .codec_clock_off = NULL, /* tsc2102_clock_off, */ | ||
339 | .get_default_samplerate = NULL, /* tsc2102_get_default_samplerate, */ | ||
340 | }; | ||
341 | |||
342 | #ifdef CONFIG_APM | ||
343 | /* | ||
344 | * Values measured in 10 minute intervals averaged over 10 samples. | ||
345 | * May differ slightly from device to device but should be accurate | ||
346 | * enough to give basic idea of battery life left and trigger | ||
347 | * potential alerts. | ||
348 | */ | ||
349 | static const int palmte_battery_sample[] = { | ||
350 | 2194, 2157, 2138, 2120, | ||
351 | 2104, 2089, 2075, 2061, | ||
352 | 2048, 2038, 2026, 2016, | ||
353 | 2008, 1998, 1989, 1980, | ||
354 | 1970, 1958, 1945, 1928, | ||
355 | 1910, 1888, 1860, 1827, | ||
356 | 1791, 1751, 1709, 1656, | ||
357 | }; | ||
358 | |||
359 | #define INTERVAL 10 | ||
360 | #define BATTERY_HIGH_TRESHOLD 66 | ||
361 | #define BATTERY_LOW_TRESHOLD 33 | ||
362 | |||
363 | static void palmte_get_power_status(struct apm_power_info *info, int *battery) | ||
364 | { | ||
365 | int charging, batt, hi, lo, mid; | ||
366 | |||
367 | charging = !omap_get_gpio_datain(PALMTE_DC_GPIO); | ||
368 | batt = battery[0]; | ||
369 | if (charging) | ||
370 | batt -= 60; | ||
371 | |||
372 | hi = ARRAY_SIZE(palmte_battery_sample); | ||
373 | lo = 0; | ||
374 | |||
375 | info->battery_flag = 0; | ||
376 | info->units = APM_UNITS_MINS; | ||
377 | |||
378 | if (batt > palmte_battery_sample[lo]) { | ||
379 | info->battery_life = 100; | ||
380 | info->time = INTERVAL * ARRAY_SIZE(palmte_battery_sample); | ||
381 | } else if (batt <= palmte_battery_sample[hi - 1]) { | ||
382 | info->battery_life = 0; | ||
383 | info->time = 0; | ||
384 | } else { | ||
385 | while (hi > lo + 1) { | ||
386 | mid = (hi + lo) >> 2; | ||
387 | if (batt <= palmte_battery_sample[mid]) | ||
388 | lo = mid; | ||
389 | else | ||
390 | hi = mid; | ||
391 | } | ||
392 | |||
393 | mid = palmte_battery_sample[lo] - palmte_battery_sample[hi]; | ||
394 | hi = palmte_battery_sample[lo] - batt; | ||
395 | info->battery_life = 100 - (100 * lo + 100 * hi / mid) / | ||
396 | ARRAY_SIZE(palmte_battery_sample); | ||
397 | info->time = INTERVAL * (ARRAY_SIZE(palmte_battery_sample) - | ||
398 | lo) - INTERVAL * hi / mid; | ||
399 | } | ||
400 | |||
401 | if (charging) { | ||
402 | info->ac_line_status = APM_AC_ONLINE; | ||
403 | info->battery_status = APM_BATTERY_STATUS_CHARGING; | ||
404 | info->battery_flag |= APM_BATTERY_FLAG_CHARGING; | ||
405 | } else { | ||
406 | info->ac_line_status = APM_AC_OFFLINE; | ||
407 | if (info->battery_life > BATTERY_HIGH_TRESHOLD) | ||
408 | info->battery_status = APM_BATTERY_STATUS_HIGH; | ||
409 | else if (info->battery_life > BATTERY_LOW_TRESHOLD) | ||
410 | info->battery_status = APM_BATTERY_STATUS_LOW; | ||
411 | else | ||
412 | info->battery_status = APM_BATTERY_STATUS_CRITICAL; | ||
413 | } | ||
414 | |||
415 | if (info->battery_life > BATTERY_HIGH_TRESHOLD) | ||
416 | info->battery_flag |= APM_BATTERY_FLAG_HIGH; | ||
417 | else if (info->battery_life > BATTERY_LOW_TRESHOLD) | ||
418 | info->battery_flag |= APM_BATTERY_FLAG_LOW; | ||
419 | else | ||
420 | info->battery_flag |= APM_BATTERY_FLAG_CRITICAL; | ||
421 | } | ||
422 | #else | ||
423 | #define palmte_get_power_status NULL | ||
424 | #endif | ||
425 | |||
426 | static struct tsc2102_config palmte_tsc2102_config = { | ||
427 | .use_internal = 0, | ||
428 | .monitor = TSC_BAT1 | TSC_AUX | TSC_TEMP, | ||
429 | .temp_at25c = { 2200, 2615 }, | ||
430 | .apm_report = palmte_get_power_status, | ||
431 | .alsa_config = &palmte_alsa_config, | ||
432 | }; | ||
433 | |||
434 | static struct omap_board_config_kernel palmte_config[] = { | 324 | static struct omap_board_config_kernel palmte_config[] = { |
435 | { OMAP_TAG_USB, &palmte_usb_config }, | 325 | { OMAP_TAG_USB, &palmte_usb_config }, |
436 | { OMAP_TAG_MMC, &palmte_mmc_config }, | 326 | { OMAP_TAG_MMC, &palmte_mmc_config }, |
@@ -449,17 +339,6 @@ static struct spi_board_info palmte_spi_info[] __initdata = { | |||
449 | }, | 339 | }, |
450 | }; | 340 | }; |
451 | 341 | ||
452 | static struct spi_board_info palmte_spi_info[] __initdata = { | ||
453 | { | ||
454 | .modalias = "tsc2102", | ||
455 | .bus_num = 2, /* uWire (officially) */ | ||
456 | .chip_select = 0, /* As opposed to 3 */ | ||
457 | .irq = OMAP_GPIO_IRQ(PALMTE_PINTDAV_GPIO), | ||
458 | .platform_data = &palmte_tsc2102_config, | ||
459 | .max_speed_hz = 8000000, | ||
460 | }, | ||
461 | }; | ||
462 | |||
463 | /* Periodically check for changes on important input pins */ | 342 | /* Periodically check for changes on important input pins */ |
464 | struct timer_list palmte_pin_timer; | 343 | struct timer_list palmte_pin_timer; |
465 | int prev_power, prev_headphones; | 344 | int prev_power, prev_headphones; |
@@ -539,8 +418,6 @@ static void __init omap_palmte_init(void) | |||
539 | 418 | ||
540 | spi_register_board_info(palmte_spi_info, ARRAY_SIZE(palmte_spi_info)); | 419 | spi_register_board_info(palmte_spi_info, ARRAY_SIZE(palmte_spi_info)); |
541 | 420 | ||
542 | spi_register_board_info(palmte_spi_info, ARRAY_SIZE(palmte_spi_info)); | ||
543 | |||
544 | omap_serial_init(); | 421 | omap_serial_init(); |
545 | palmte_gpio_setup(); | 422 | palmte_gpio_setup(); |
546 | } | 423 | } |