Commit 83545d836cf12a6381b530c5c7aeacf057f86aa9

Authored by Jorge Eduardo Candelaria
Committed by Liam Girdwood
1 parent a2974732ca

GPIO: TPS65910: Move driver to drivers/gpio/

The GPIO driver should reside in drivers/gpio/ for better
organization.

Signed-off-by: Jorge Eduardo Candelaria <jedu@slimlogic.co.uk>
Acked-by: Grant Likely <grant.likely@secretlab.ca>
Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>

Showing 6 changed files with 102 additions and 93 deletions Side-by-side Diff

drivers/gpio/Kconfig
... ... @@ -424,5 +424,12 @@
424 424 depends on AB8500_CORE && BROKEN
425 425 help
426 426 Select this to enable the AB8500 IC GPIO driver
  427 +
  428 +config GPIO_TPS65910
  429 + bool "TPS65910 GPIO"
  430 + depends on MFD_TPS65910
  431 + help
  432 + Select this option to enable GPIO driver for the TPS65910
  433 + chip family.
427 434 endif
drivers/gpio/Makefile
... ... @@ -40,4 +40,5 @@
40 40 obj-$(CONFIG_GPIO_VX855) += vx855_gpio.o
41 41 obj-$(CONFIG_GPIO_ML_IOH) += ml_ioh_gpio.o
42 42 obj-$(CONFIG_AB8500_GPIO) += ab8500-gpio.o
  43 +obj-$(CONFIG_GPIO_TPS65910) += tps65910-gpio.o
drivers/gpio/tps65910-gpio.c
  1 +/*
  2 + * tps65910-gpio.c -- TI TPS6591x
  3 + *
  4 + * Copyright 2010 Texas Instruments Inc.
  5 + *
  6 + * Author: Graeme Gregory <gg@slimlogic.co.uk>
  7 + * Author: Jorge Eduardo Candelaria jedu@slimlogic.co.uk>
  8 + *
  9 + * This program is free software; you can redistribute it and/or modify it
  10 + * under the terms of the GNU General Public License as published by the
  11 + * Free Software Foundation; either version 2 of the License, or (at your
  12 + * option) any later version.
  13 + *
  14 + */
  15 +
  16 +#include <linux/kernel.h>
  17 +#include <linux/module.h>
  18 +#include <linux/errno.h>
  19 +#include <linux/gpio.h>
  20 +#include <linux/i2c.h>
  21 +#include <linux/mfd/tps65910.h>
  22 +
  23 +static int tps65910_gpio_get(struct gpio_chip *gc, unsigned offset)
  24 +{
  25 + struct tps65910 *tps65910 = container_of(gc, struct tps65910, gpio);
  26 + uint8_t val;
  27 +
  28 + tps65910->read(tps65910, TPS65910_GPIO0, 1, &val);
  29 +
  30 + if (val & GPIO0_GPIO_STS_MASK)
  31 + return 1;
  32 +
  33 + return 0;
  34 +}
  35 +
  36 +static void tps65910_gpio_set(struct gpio_chip *gc, unsigned offset,
  37 + int value)
  38 +{
  39 + struct tps65910 *tps65910 = container_of(gc, struct tps65910, gpio);
  40 +
  41 + if (value)
  42 + tps65910_set_bits(tps65910, TPS65910_GPIO0,
  43 + GPIO0_GPIO_SET_MASK);
  44 + else
  45 + tps65910_clear_bits(tps65910, TPS65910_GPIO0,
  46 + GPIO0_GPIO_SET_MASK);
  47 +}
  48 +
  49 +static int tps65910_gpio_output(struct gpio_chip *gc, unsigned offset,
  50 + int value)
  51 +{
  52 + struct tps65910 *tps65910 = container_of(gc, struct tps65910, gpio);
  53 +
  54 + /* Set the initial value */
  55 + tps65910_gpio_set(gc, 0, value);
  56 +
  57 + return tps65910_set_bits(tps65910, TPS65910_GPIO0, GPIO0_GPIO_CFG_MASK);
  58 +}
  59 +
  60 +static int tps65910_gpio_input(struct gpio_chip *gc, unsigned offset)
  61 +{
  62 + struct tps65910 *tps65910 = container_of(gc, struct tps65910, gpio);
  63 +
  64 + return tps65910_clear_bits(tps65910, TPS65910_GPIO0,
  65 + GPIO0_GPIO_CFG_MASK);
  66 +}
  67 +
  68 +void tps65910_gpio_init(struct tps65910 *tps65910, int gpio_base)
  69 +{
  70 + int ret;
  71 +
  72 + if (!gpio_base)
  73 + return;
  74 +
  75 + tps65910->gpio.owner = THIS_MODULE;
  76 + tps65910->gpio.label = tps65910->i2c_client->name;
  77 + tps65910->gpio.dev = tps65910->dev;
  78 + tps65910->gpio.base = gpio_base;
  79 + tps65910->gpio.ngpio = 1;
  80 + tps65910->gpio.can_sleep = 1;
  81 +
  82 + tps65910->gpio.direction_input = tps65910_gpio_input;
  83 + tps65910->gpio.direction_output = tps65910_gpio_output;
  84 + tps65910->gpio.set = tps65910_gpio_set;
  85 + tps65910->gpio.get = tps65910_gpio_get;
  86 +
  87 + ret = gpiochip_add(&tps65910->gpio);
  88 +
  89 + if (ret)
  90 + dev_warn(tps65910->dev, "GPIO registration failed: %d\n", ret);
  91 +}
... ... @@ -721,8 +721,9 @@
721 721  
722 722 config MFD_TPS65910
723 723 bool "TPS65910 Power Management chip"
724   - depends on I2C=y && GPIOLIB
  724 + depends on I2C=y
725 725 select MFD_CORE
  726 + select GPIO_TPS65910
726 727 help
727 728 if you say yes here you get support for the TPS65910 series of
728 729 Power Management chips.
drivers/mfd/Makefile
... ... @@ -93,5 +93,5 @@
93 93 obj-$(CONFIG_MFD_OMAP_USB_HOST) += omap-usb-host.o
94 94 obj-$(CONFIG_MFD_PM8921_CORE) += pm8921-core.o
95 95 obj-$(CONFIG_MFD_PM8XXX_IRQ) += pm8xxx-irq.o
96   -obj-$(CONFIG_MFD_TPS65910) += tps65910.o tps65910-gpio.o tps65910-irq.o
  96 +obj-$(CONFIG_MFD_TPS65910) += tps65910.o tps65910-irq.o
drivers/mfd/tps65910-gpio.c
1   -/*
2   - * tps65910-gpio.c -- TI TPS6591x
3   - *
4   - * Copyright 2010 Texas Instruments Inc.
5   - *
6   - * Author: Graeme Gregory <gg@slimlogic.co.uk>
7   - * Author: Jorge Eduardo Candelaria jedu@slimlogic.co.uk>
8   - *
9   - * This program is free software; you can redistribute it and/or modify it
10   - * under the terms of the GNU General Public License as published by the
11   - * Free Software Foundation; either version 2 of the License, or (at your
12   - * option) any later version.
13   - *
14   - */
15   -
16   -#include <linux/kernel.h>
17   -#include <linux/module.h>
18   -#include <linux/errno.h>
19   -#include <linux/gpio.h>
20   -#include <linux/i2c.h>
21   -#include <linux/mfd/tps65910.h>
22   -
23   -static int tps65910_gpio_get(struct gpio_chip *gc, unsigned offset)
24   -{
25   - struct tps65910 *tps65910 = container_of(gc, struct tps65910, gpio);
26   - uint8_t val;
27   -
28   - tps65910->read(tps65910, TPS65910_GPIO0, 1, &val);
29   -
30   - if (val & GPIO0_GPIO_STS_MASK)
31   - return 1;
32   -
33   - return 0;
34   -}
35   -
36   -static void tps65910_gpio_set(struct gpio_chip *gc, unsigned offset,
37   - int value)
38   -{
39   - struct tps65910 *tps65910 = container_of(gc, struct tps65910, gpio);
40   -
41   - if (value)
42   - tps65910_set_bits(tps65910, TPS65910_GPIO0,
43   - GPIO0_GPIO_SET_MASK);
44   - else
45   - tps65910_clear_bits(tps65910, TPS65910_GPIO0,
46   - GPIO0_GPIO_SET_MASK);
47   -}
48   -
49   -static int tps65910_gpio_output(struct gpio_chip *gc, unsigned offset,
50   - int value)
51   -{
52   - struct tps65910 *tps65910 = container_of(gc, struct tps65910, gpio);
53   -
54   - /* Set the initial value */
55   - tps65910_gpio_set(gc, 0, value);
56   -
57   - return tps65910_set_bits(tps65910, TPS65910_GPIO0, GPIO0_GPIO_CFG_MASK);
58   -}
59   -
60   -static int tps65910_gpio_input(struct gpio_chip *gc, unsigned offset)
61   -{
62   - struct tps65910 *tps65910 = container_of(gc, struct tps65910, gpio);
63   -
64   - return tps65910_clear_bits(tps65910, TPS65910_GPIO0,
65   - GPIO0_GPIO_CFG_MASK);
66   -}
67   -
68   -void tps65910_gpio_init(struct tps65910 *tps65910, int gpio_base)
69   -{
70   - int ret;
71   -
72   - if (!gpio_base)
73   - return;
74   -
75   - tps65910->gpio.owner = THIS_MODULE;
76   - tps65910->gpio.label = tps65910->i2c_client->name;
77   - tps65910->gpio.dev = tps65910->dev;
78   - tps65910->gpio.base = gpio_base;
79   - tps65910->gpio.ngpio = 1;
80   - tps65910->gpio.can_sleep = 1;
81   -
82   - tps65910->gpio.direction_input = tps65910_gpio_input;
83   - tps65910->gpio.direction_output = tps65910_gpio_output;
84   - tps65910->gpio.set = tps65910_gpio_set;
85   - tps65910->gpio.get = tps65910_gpio_get;
86   -
87   - ret = gpiochip_add(&tps65910->gpio);
88   -
89   - if (ret)
90   - dev_warn(tps65910->dev, "GPIO registration failed: %d\n", ret);
91   -}