aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-pxa/tosa.c
diff options
context:
space:
mode:
authorDmitry Eremin-Solenikov <dbaryshkov@gmail.com>2014-10-24 13:14:22 -0400
committerRobert Jarzmik <robert.jarzmik@free.fr>2014-11-19 17:53:13 -0500
commit62a7575720c5079846e20553fc95fcdb78544d69 (patch)
tree0b424f5e3f8d6802a38f3bb078d16663dd458b75 /arch/arm/mach-pxa/tosa.c
parent7b472ac75689af196d868b3f2322edb44b8096d3 (diff)
ARM: pxa: tosa: switch to gpio-charger
Switch to simpler gpio-charger module. PDA power requires additional setup in platform file and is more suited for boards with separate AC and USB charging inputs. Tosa has a unified input, so it's better suited for gpio-charger. Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com> Signed-off-by: Robert Jarzmik <robert.jarzmik@free.fr>
Diffstat (limited to 'arch/arm/mach-pxa/tosa.c')
-rw-r--r--arch/arm/mach-pxa/tosa.c41
1 files changed, 7 insertions, 34 deletions
diff --git a/arch/arm/mach-pxa/tosa.c b/arch/arm/mach-pxa/tosa.c
index c158a6e3e0aa..7780d1faa06f 100644
--- a/arch/arm/mach-pxa/tosa.c
+++ b/arch/arm/mach-pxa/tosa.c
@@ -30,7 +30,7 @@
30#include <linux/gpio_keys.h> 30#include <linux/gpio_keys.h>
31#include <linux/input.h> 31#include <linux/input.h>
32#include <linux/gpio.h> 32#include <linux/gpio.h>
33#include <linux/pda_power.h> 33#include <linux/power/gpio-charger.h>
34#include <linux/spi/spi.h> 34#include <linux/spi/spi.h>
35#include <linux/spi/pxa2xx_spi.h> 35#include <linux/spi/pxa2xx_spi.h>
36#include <linux/input/matrix_keypad.h> 36#include <linux/input/matrix_keypad.h>
@@ -361,44 +361,17 @@ static struct pxaficp_platform_data tosa_ficp_platform_data = {
361/* 361/*
362 * Tosa AC IN 362 * Tosa AC IN
363 */ 363 */
364static int tosa_power_init(struct device *dev)
365{
366 int ret = gpio_request(TOSA_GPIO_AC_IN, "ac in");
367 if (ret)
368 goto err_gpio_req;
369
370 ret = gpio_direction_input(TOSA_GPIO_AC_IN);
371 if (ret)
372 goto err_gpio_in;
373
374 return 0;
375
376err_gpio_in:
377 gpio_free(TOSA_GPIO_AC_IN);
378err_gpio_req:
379 return ret;
380}
381
382static void tosa_power_exit(struct device *dev)
383{
384 gpio_free(TOSA_GPIO_AC_IN);
385}
386
387static int tosa_power_ac_online(void)
388{
389 return gpio_get_value(TOSA_GPIO_AC_IN) == 0;
390}
391
392static char *tosa_ac_supplied_to[] = { 364static char *tosa_ac_supplied_to[] = {
393 "main-battery", 365 "main-battery",
394 "backup-battery", 366 "backup-battery",
395 "jacket-battery", 367 "jacket-battery",
396}; 368};
397 369
398static struct pda_power_pdata tosa_power_data = { 370static struct gpio_charger_platform_data tosa_power_data = {
399 .init = tosa_power_init, 371 .name = "charger",
400 .is_ac_online = tosa_power_ac_online, 372 .type = POWER_SUPPLY_TYPE_MAINS,
401 .exit = tosa_power_exit, 373 .gpio = TOSA_GPIO_AC_IN,
374 .gpio_active_low = 1,
402 .supplied_to = tosa_ac_supplied_to, 375 .supplied_to = tosa_ac_supplied_to,
403 .num_supplicants = ARRAY_SIZE(tosa_ac_supplied_to), 376 .num_supplicants = ARRAY_SIZE(tosa_ac_supplied_to),
404}; 377};
@@ -415,7 +388,7 @@ static struct resource tosa_power_resource[] = {
415}; 388};
416 389
417static struct platform_device tosa_power_device = { 390static struct platform_device tosa_power_device = {
418 .name = "pda-power", 391 .name = "gpio-charger",
419 .id = -1, 392 .id = -1,
420 .dev.platform_data = &tosa_power_data, 393 .dev.platform_data = &tosa_power_data,
421 .resource = tosa_power_resource, 394 .resource = tosa_power_resource,