From e98e470136f0910a64bed8a77c067e6976dd23de Mon Sep 17 00:00:00 2001 From: Jiri Pinkava Date: Mon, 24 May 2010 10:08:47 +0200 Subject: [PATCH 10/14] n30: Add PDA power supply status on Acer n30 / n35 Signed-off-by: Jiri Pinkava --- arch/arm/mach-s3c2410/mach-n30.c | 53 ++++++++++++++++++++++++++++++++++++++ 1 files changed, 53 insertions(+), 0 deletions(-) diff --git a/arch/arm/mach-s3c2410/mach-n30.c b/arch/arm/mach-s3c2410/mach-n30.c index 36ed810..9c0e5b8 100644 --- a/arch/arm/mach-s3c2410/mach-n30.c +++ b/arch/arm/mach-s3c2410/mach-n30.c @@ -23,6 +23,7 @@ #include #include #include +#include #include #include #include @@ -185,6 +186,56 @@ static struct s3c2410_ts_mach_info n30_ts_cfg __initdata = { .cfg_gpio = s3c24xx_ts_cfg_gpio, }; +/* It would be possible to register GPG1 as interrupt resource EINT9 + * with the pda_power code, but since GPC7 cannot have an interrupt + * connected to it, the pda_power driver will use polling anyway. In + * addition to that, since the USB driver already requests EINT9, the + * request_irq in pda_power fails. So don't do that. */ + +/* +static struct resource n30_power_resource[] = { + { + .name = "usb", + .start = IRQ_EINT9, + .end = IRQ_EINT9, + .flags = IORESOURCE_IRQ, + }, +}; +*/ + +static int n30_is_ac_online(void) +{ + return gpio_get_value(S3C2410_GPC(7)); +} + +static int n30_is_usb_online(void) +{ + return gpio_get_value(S3C2410_GPG(1)); +} + +static char *n30_power_supplied_to[] = { + "battery", +}; + +static struct pda_power_pdata n30_power_pdata = { + .is_ac_online = n30_is_ac_online, + .is_usb_online = n30_is_usb_online, + .supplied_to = n30_power_supplied_to, + .num_supplicants = ARRAY_SIZE(n30_power_supplied_to), +}; + +static struct platform_device n30_power = { + .name = "pda-power", + .id = -1, + .dev = { + .platform_data = &n30_power_pdata, + }, +/* + .num_resources = ARRAY_SIZE(n30_power_resource), + .resource = n30_power_resource, +*/ +}; + static struct platform_device n30_battery = { .name = "n30-battery", .id = -1, @@ -545,6 +596,7 @@ static struct platform_device *n30_devices[] __initdata = { &s3c_device_adc, &s3c_device_ts, &n30_battery, + &n30_power, &n30_button_device, &n30_blue_led, &n30_warning_led, @@ -569,6 +621,7 @@ static struct platform_device *n35_devices[] __initdata = { &n35_button_device, &n35_blue_led, &n35_warning_led, + &n30_power, }; static struct s3c2410_platform_i2c __initdata n30_i2ccfg = { -- 1.7.3.1