Commit 68a3cb6b authored by andrzej zaborowski's avatar andrzej zaborowski Committed by Tony Lindgren

ARM: OMAP: Palm T|E board definition update

Update board-palmte.c with chages including:
 - reflect the APM header change to make the file build again,
 - use the gpio-switch driver for the task of GPIO polling,
 - fix a fatal typo with wrong shift size,
 - update the copyright notice.
Signed-off-by: default avatarAndrzej Zaborowski <balrog@zabor.org>
Signed-off-by: default avatarTony Lindgren <tony@atomide.com>
parent 2b588224
...@@ -10,6 +10,8 @@ ...@@ -10,6 +10,8 @@
* Maintainters : http://palmtelinux.sf.net * Maintainters : http://palmtelinux.sf.net
* palmtelinux-developpers@lists.sf.net * palmtelinux-developpers@lists.sf.net
* *
* Copyright (c) 2006 Andrzej Zaborowski <balrog@zabor.org>
*
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as * it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation. * published by the Free Software Foundation.
...@@ -24,8 +26,8 @@ ...@@ -24,8 +26,8 @@
#include <linux/spi/spi.h> #include <linux/spi/spi.h>
#include <linux/spi/tsc2102.h> #include <linux/spi/tsc2102.h>
#include <linux/interrupt.h> #include <linux/interrupt.h>
#include <linux/apm-emulation.h>
#include <asm/apm.h>
#include <asm/hardware.h> #include <asm/hardware.h>
#include <asm/mach-types.h> #include <asm/mach-types.h>
#include <asm/mach/arch.h> #include <asm/mach/arch.h>
...@@ -43,6 +45,7 @@ ...@@ -43,6 +45,7 @@
#include <asm/arch/common.h> #include <asm/arch/common.h>
#include <asm/arch/mcbsp.h> #include <asm/arch/mcbsp.h>
#include <asm/arch/omap-alsa.h> #include <asm/arch/omap-alsa.h>
#include <asm/arch/gpio-switch.h>
static void __init omap_palmte_init_irq(void) static void __init omap_palmte_init_irq(void)
{ {
...@@ -51,11 +54,11 @@ static void __init omap_palmte_init_irq(void) ...@@ -51,11 +54,11 @@ static void __init omap_palmte_init_irq(void)
omap_gpio_init(); omap_gpio_init();
} }
static int palmte_keymap[] = { static const int palmte_keymap[] = {
KEY(0, 0, KEY_F1), KEY(0, 0, KEY_F1), /* Calendar */
KEY(0, 1, KEY_F2), KEY(0, 1, KEY_F2), /* Contacts */
KEY(0, 2, KEY_F3), KEY(0, 2, KEY_F3), /* Tasks List */
KEY(0, 3, KEY_F4), KEY(0, 3, KEY_F4), /* Note Pad */
KEY(0, 4, KEY_POWER), KEY(0, 4, KEY_POWER),
KEY(1, 0, KEY_LEFT), KEY(1, 0, KEY_LEFT),
KEY(1, 1, KEY_DOWN), KEY(1, 1, KEY_DOWN),
...@@ -68,7 +71,7 @@ static int palmte_keymap[] = { ...@@ -68,7 +71,7 @@ static int palmte_keymap[] = {
static struct omap_kp_platform_data palmte_kp_data = { static struct omap_kp_platform_data palmte_kp_data = {
.rows = 8, .rows = 8,
.cols = 8, .cols = 8,
.keymap = palmte_keymap, .keymap = (int *) palmte_keymap,
.rep = 1, .rep = 1,
.delay = 12, .delay = 12,
}; };
...@@ -180,7 +183,7 @@ static struct platform_device palmte_irda_device = { ...@@ -180,7 +183,7 @@ static struct platform_device palmte_irda_device = {
.resource = palmte_irda_resources, .resource = palmte_irda_resources,
}; };
static struct platform_device *devices[] __initdata = { static struct platform_device *palmte_devices[] __initdata = {
&palmte_rom_device, &palmte_rom_device,
&palmte_kp_device, &palmte_kp_device,
&palmte_lcd_device, &palmte_lcd_device,
...@@ -273,7 +276,7 @@ static void palmte_get_power_status(struct apm_power_info *info, int *battery) ...@@ -273,7 +276,7 @@ static void palmte_get_power_status(struct apm_power_info *info, int *battery)
info->time = 0; info->time = 0;
} else { } else {
while (hi > lo + 1) { while (hi > lo + 1) {
mid = (hi + lo) >> 2; mid = (hi + lo) >> 1;
if (batt <= palmte_battery_sample[mid]) if (batt <= palmte_battery_sample[mid])
lo = mid; lo = mid;
else else
...@@ -339,74 +342,64 @@ static struct spi_board_info palmte_spi_info[] __initdata = { ...@@ -339,74 +342,64 @@ static struct spi_board_info palmte_spi_info[] __initdata = {
}, },
}; };
/* Periodically check for changes on important input pins */ static void palmte_headphones_detect(void *data, int state) {
struct timer_list palmte_pin_timer; if (state) {
int prev_power, prev_headphones;
static void palmte_pin_handler(unsigned long data) {
int power, headphones;
power = !omap_get_gpio_datain(PALMTE_DC_GPIO);
headphones = omap_get_gpio_datain(PALMTE_HEADPHONES_GPIO);
if (power && !prev_power)
printk(KERN_INFO "PM: cable connected\n");
else if (!power && prev_power)
printk(KERN_INFO "PM: cable disconnected\n");
if (headphones && !prev_headphones) {
/* Headphones connected, disable speaker */ /* Headphones connected, disable speaker */
omap_set_gpio_dataout(PALMTE_SPEAKER_GPIO, 0); omap_set_gpio_dataout(PALMTE_SPEAKER_GPIO, 0);
printk(KERN_INFO "PM: speaker off\n"); printk(KERN_INFO "PM: speaker off\n");
} else if (!headphones && prev_headphones) { } else {
/* Headphones unplugged, re-enable speaker */ /* Headphones unplugged, re-enable speaker */
omap_set_gpio_dataout(PALMTE_SPEAKER_GPIO, 1); omap_set_gpio_dataout(PALMTE_SPEAKER_GPIO, 1);
printk(KERN_INFO "PM: speaker on\n"); printk(KERN_INFO "PM: speaker on\n");
} }
prev_power = power;
prev_headphones = headphones;
mod_timer(&palmte_pin_timer, jiffies + msecs_to_jiffies(500));
} }
static void __init palmte_gpio_setup(void) static struct omap_gpio_switch palmte_switches[] __initdata = {
/* Speaker-enable pin is an output */
{
.name = "speaker-enable",
.gpio = PALMTE_SPEAKER_GPIO,
.type = OMAP_GPIO_SWITCH_TYPE_ACTIVITY,
.flags = OMAP_GPIO_SWITCH_FLAG_OUTPUT |
OMAP_GPIO_SWITCH_FLAG_INVERTED,
},
/* Indicates whether power is from DC-IN or battery */
{
.name = "dc-in",
.gpio = PALMTE_DC_GPIO,
.type = OMAP_GPIO_SWITCH_TYPE_CONNECTION,
.flags = OMAP_GPIO_SWITCH_FLAG_INVERTED,
},
/* Indicates whether a USB host is on the other end of the cable */
{
.name = "usb",
.gpio = PALMTE_USBDETECT_GPIO,
.type = OMAP_GPIO_SWITCH_TYPE_CONNECTION,
},
/* High when headphones jack is plugged in */
{
.name = "headphones",
.gpio = PALMTE_HEADPHONES_GPIO,
.type = OMAP_GPIO_SWITCH_TYPE_CONNECTION,
.notify = palmte_headphones_detect,
},
};
static void __init palmte_misc_gpio_setup(void)
{ {
/* Set TSC2102 PINTDAV pin as input */ /* Set TSC2102 PINTDAV pin as input (used by TSC2102 driver) */
if (omap_request_gpio(PALMTE_PINTDAV_GPIO)) { if (omap_request_gpio(PALMTE_PINTDAV_GPIO)) {
printk(KERN_ERR "Could not reserve PINTDAV GPIO!\n"); printk(KERN_ERR "Could not reserve PINTDAV GPIO!\n");
return; return;
} }
omap_set_gpio_direction(PALMTE_PINTDAV_GPIO, 1); omap_set_gpio_direction(PALMTE_PINTDAV_GPIO, 1);
/* Monitor cable-connected signals */ /* Set USB-or-DC-IN pin as input (unused) */
if (omap_request_gpio(PALMTE_DC_GPIO) || if (omap_request_gpio(PALMTE_USB_OR_DC_GPIO)) {
omap_request_gpio(PALMTE_USB_OR_DC_GPIO) ||
omap_request_gpio(PALMTE_USBDETECT_GPIO)) {
printk(KERN_ERR "Could not reserve cable signal GPIO!\n"); printk(KERN_ERR "Could not reserve cable signal GPIO!\n");
return; return;
} }
omap_set_gpio_direction(PALMTE_DC_GPIO, 1);
omap_set_gpio_direction(PALMTE_USB_OR_DC_GPIO, 1); omap_set_gpio_direction(PALMTE_USB_OR_DC_GPIO, 1);
omap_set_gpio_direction(PALMTE_USBDETECT_GPIO, 1);
/* Set speaker-enable pin as output */
if (omap_request_gpio(PALMTE_SPEAKER_GPIO)) {
printk(KERN_ERR "Could not reserve speaker GPIO!\n");
return;
}
omap_set_gpio_direction(PALMTE_SPEAKER_GPIO, 0);
/* Monitor the headphones-connected signal */
if (omap_request_gpio(PALMTE_HEADPHONES_GPIO)) {
printk(KERN_ERR "Could not reserve headphones signal GPIO!\n");
return;
}
omap_set_gpio_direction(PALMTE_HEADPHONES_GPIO, 1);
prev_power = omap_get_gpio_datain(PALMTE_DC_GPIO);
prev_headphones = !omap_get_gpio_datain(PALMTE_HEADPHONES_GPIO);
setup_timer(&palmte_pin_timer, palmte_pin_handler, 0);
palmte_pin_handler(0);
} }
static void __init omap_palmte_init(void) static void __init omap_palmte_init(void)
...@@ -414,12 +407,15 @@ static void __init omap_palmte_init(void) ...@@ -414,12 +407,15 @@ static void __init omap_palmte_init(void)
omap_board_config = palmte_config; omap_board_config = palmte_config;
omap_board_config_size = ARRAY_SIZE(palmte_config); omap_board_config_size = ARRAY_SIZE(palmte_config);
platform_add_devices(devices, ARRAY_SIZE(devices)); platform_add_devices(palmte_devices, ARRAY_SIZE(palmte_devices));
spi_register_board_info(palmte_spi_info, ARRAY_SIZE(palmte_spi_info)); spi_register_board_info(palmte_spi_info, ARRAY_SIZE(palmte_spi_info));
omap_register_gpio_switches(palmte_switches,
ARRAY_SIZE(palmte_switches));
palmte_misc_gpio_setup();
omap_serial_init(); omap_serial_init();
palmte_gpio_setup();
} }
static void __init omap_palmte_map_io(void) static void __init omap_palmte_map_io(void)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment