aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpio
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gpio')
-rw-r--r--drivers/gpio/Kconfig7
-rw-r--r--drivers/gpio/janz-ttl.c3
-rw-r--r--drivers/gpio/rdc321x-gpio.c3
-rw-r--r--drivers/gpio/sch_gpio.c57
-rw-r--r--drivers/gpio/timbgpio.c6
5 files changed, 51 insertions, 25 deletions
diff --git a/drivers/gpio/Kconfig b/drivers/gpio/Kconfig
index b46442d7d66e..d8d0cda2641d 100644
--- a/drivers/gpio/Kconfig
+++ b/drivers/gpio/Kconfig
@@ -100,18 +100,21 @@ config GPIO_VR41XX
100 Say yes here to support the NEC VR4100 series General-purpose I/O Uint 100 Say yes here to support the NEC VR4100 series General-purpose I/O Uint
101 101
102config GPIO_SCH 102config GPIO_SCH
103 tristate "Intel SCH GPIO" 103 tristate "Intel SCH/TunnelCreek GPIO"
104 depends on GPIOLIB && PCI && X86 104 depends on GPIOLIB && PCI && X86
105 select MFD_CORE 105 select MFD_CORE
106 select LPC_SCH 106 select LPC_SCH
107 help 107 help
108 Say yes here to support GPIO interface on Intel Poulsbo SCH. 108 Say yes here to support GPIO interface on Intel Poulsbo SCH
109 or Intel Tunnel Creek processor.
109 The Intel SCH contains a total of 14 GPIO pins. Ten GPIOs are 110 The Intel SCH contains a total of 14 GPIO pins. Ten GPIOs are
110 powered by the core power rail and are turned off during sleep 111 powered by the core power rail and are turned off during sleep
111 modes (S3 and higher). The remaining four GPIOs are powered by 112 modes (S3 and higher). The remaining four GPIOs are powered by
112 the Intel SCH suspend power supply. These GPIOs remain 113 the Intel SCH suspend power supply. These GPIOs remain
113 active during S3. The suspend powered GPIOs can be used to wake the 114 active during S3. The suspend powered GPIOs can be used to wake the
114 system from the Suspend-to-RAM state. 115 system from the Suspend-to-RAM state.
116 The Intel Tunnel Creek processor has 5 GPIOs powered by the
117 core power rail and 9 from suspend power supply.
115 118
116 This driver can also be built as a module. If so, the module 119 This driver can also be built as a module. If so, the module
117 will be called sch-gpio. 120 will be called sch-gpio.
diff --git a/drivers/gpio/janz-ttl.c b/drivers/gpio/janz-ttl.c
index 813ac077e5d7..2514fb075f4a 100644
--- a/drivers/gpio/janz-ttl.c
+++ b/drivers/gpio/janz-ttl.c
@@ -15,6 +15,7 @@
15#include <linux/interrupt.h> 15#include <linux/interrupt.h>
16#include <linux/delay.h> 16#include <linux/delay.h>
17#include <linux/platform_device.h> 17#include <linux/platform_device.h>
18#include <linux/mfd/core.h>
18#include <linux/io.h> 19#include <linux/io.h>
19#include <linux/gpio.h> 20#include <linux/gpio.h>
20#include <linux/slab.h> 21#include <linux/slab.h>
@@ -149,7 +150,7 @@ static int __devinit ttl_probe(struct platform_device *pdev)
149 struct resource *res; 150 struct resource *res;
150 int ret; 151 int ret;
151 152
152 pdata = pdev->dev.platform_data; 153 pdata = mfd_get_data(pdev);
153 if (!pdata) { 154 if (!pdata) {
154 dev_err(dev, "no platform data\n"); 155 dev_err(dev, "no platform data\n");
155 ret = -ENXIO; 156 ret = -ENXIO;
diff --git a/drivers/gpio/rdc321x-gpio.c b/drivers/gpio/rdc321x-gpio.c
index 897e0577e65e..a9bda881935a 100644
--- a/drivers/gpio/rdc321x-gpio.c
+++ b/drivers/gpio/rdc321x-gpio.c
@@ -27,6 +27,7 @@
27#include <linux/pci.h> 27#include <linux/pci.h>
28#include <linux/gpio.h> 28#include <linux/gpio.h>
29#include <linux/mfd/rdc321x.h> 29#include <linux/mfd/rdc321x.h>
30#include <linux/mfd/core.h>
30#include <linux/slab.h> 31#include <linux/slab.h>
31 32
32struct rdc321x_gpio { 33struct rdc321x_gpio {
@@ -135,7 +136,7 @@ static int __devinit rdc321x_gpio_probe(struct platform_device *pdev)
135 struct rdc321x_gpio *rdc321x_gpio_dev; 136 struct rdc321x_gpio *rdc321x_gpio_dev;
136 struct rdc321x_gpio_pdata *pdata; 137 struct rdc321x_gpio_pdata *pdata;
137 138
138 pdata = platform_get_drvdata(pdev); 139 pdata = mfd_get_data(pdev);
139 if (!pdata) { 140 if (!pdata) {
140 dev_err(&pdev->dev, "no platform data supplied\n"); 141 dev_err(&pdev->dev, "no platform data supplied\n");
141 return -ENODEV; 142 return -ENODEV;
diff --git a/drivers/gpio/sch_gpio.c b/drivers/gpio/sch_gpio.c
index 583521352c16..56060421cdff 100644
--- a/drivers/gpio/sch_gpio.c
+++ b/drivers/gpio/sch_gpio.c
@@ -25,6 +25,7 @@
25#include <linux/errno.h> 25#include <linux/errno.h>
26#include <linux/acpi.h> 26#include <linux/acpi.h>
27#include <linux/platform_device.h> 27#include <linux/platform_device.h>
28#include <linux/pci_ids.h>
28 29
29#include <linux/gpio.h> 30#include <linux/gpio.h>
30 31
@@ -187,7 +188,11 @@ static struct gpio_chip sch_gpio_resume = {
187static int __devinit sch_gpio_probe(struct platform_device *pdev) 188static int __devinit sch_gpio_probe(struct platform_device *pdev)
188{ 189{
189 struct resource *res; 190 struct resource *res;
190 int err; 191 int err, id;
192
193 id = pdev->id;
194 if (!id)
195 return -ENODEV;
191 196
192 res = platform_get_resource(pdev, IORESOURCE_IO, 0); 197 res = platform_get_resource(pdev, IORESOURCE_IO, 0);
193 if (!res) 198 if (!res)
@@ -198,12 +203,40 @@ static int __devinit sch_gpio_probe(struct platform_device *pdev)
198 203
199 gpio_ba = res->start; 204 gpio_ba = res->start;
200 205
201 sch_gpio_core.base = 0; 206 switch (id) {
202 sch_gpio_core.ngpio = 10; 207 case PCI_DEVICE_ID_INTEL_SCH_LPC:
203 sch_gpio_core.dev = &pdev->dev; 208 sch_gpio_core.base = 0;
209 sch_gpio_core.ngpio = 10;
210
211 sch_gpio_resume.base = 10;
212 sch_gpio_resume.ngpio = 4;
213
214 /*
215 * GPIO[6:0] enabled by default
216 * GPIO7 is configured by the CMC as SLPIOVR
217 * Enable GPIO[9:8] core powered gpios explicitly
218 */
219 outb(0x3, gpio_ba + CGEN + 1);
220 /*
221 * SUS_GPIO[2:0] enabled by default
222 * Enable SUS_GPIO3 resume powered gpio explicitly
223 */
224 outb(0x8, gpio_ba + RGEN);
225 break;
226
227 case PCI_DEVICE_ID_INTEL_ITC_LPC:
228 sch_gpio_core.base = 0;
229 sch_gpio_core.ngpio = 5;
230
231 sch_gpio_resume.base = 5;
232 sch_gpio_resume.ngpio = 9;
233 break;
234
235 default:
236 return -ENODEV;
237 }
204 238
205 sch_gpio_resume.base = 10; 239 sch_gpio_core.dev = &pdev->dev;
206 sch_gpio_resume.ngpio = 4;
207 sch_gpio_resume.dev = &pdev->dev; 240 sch_gpio_resume.dev = &pdev->dev;
208 241
209 err = gpiochip_add(&sch_gpio_core); 242 err = gpiochip_add(&sch_gpio_core);
@@ -214,18 +247,6 @@ static int __devinit sch_gpio_probe(struct platform_device *pdev)
214 if (err < 0) 247 if (err < 0)
215 goto err_sch_gpio_resume; 248 goto err_sch_gpio_resume;
216 249
217 /*
218 * GPIO[6:0] enabled by default
219 * GPIO7 is configured by the CMC as SLPIOVR
220 * Enable GPIO[9:8] core powered gpios explicitly
221 */
222 outb(0x3, gpio_ba + CGEN + 1);
223 /*
224 * SUS_GPIO[2:0] enabled by default
225 * Enable SUS_GPIO3 resume powered gpio explicitly
226 */
227 outb(0x8, gpio_ba + RGEN);
228
229 return 0; 250 return 0;
230 251
231err_sch_gpio_resume: 252err_sch_gpio_resume:
diff --git a/drivers/gpio/timbgpio.c b/drivers/gpio/timbgpio.c
index 0265872e57d1..edbe1eae531f 100644
--- a/drivers/gpio/timbgpio.c
+++ b/drivers/gpio/timbgpio.c
@@ -23,6 +23,7 @@
23#include <linux/module.h> 23#include <linux/module.h>
24#include <linux/gpio.h> 24#include <linux/gpio.h>
25#include <linux/platform_device.h> 25#include <linux/platform_device.h>
26#include <linux/mfd/core.h>
26#include <linux/irq.h> 27#include <linux/irq.h>
27#include <linux/io.h> 28#include <linux/io.h>
28#include <linux/timb_gpio.h> 29#include <linux/timb_gpio.h>
@@ -228,7 +229,7 @@ static int __devinit timbgpio_probe(struct platform_device *pdev)
228 struct gpio_chip *gc; 229 struct gpio_chip *gc;
229 struct timbgpio *tgpio; 230 struct timbgpio *tgpio;
230 struct resource *iomem; 231 struct resource *iomem;
231 struct timbgpio_platform_data *pdata = pdev->dev.platform_data; 232 struct timbgpio_platform_data *pdata = mfd_get_data(pdev);
232 int irq = platform_get_irq(pdev, 0); 233 int irq = platform_get_irq(pdev, 0);
233 234
234 if (!pdata || pdata->nr_pins > 32) { 235 if (!pdata || pdata->nr_pins > 32) {
@@ -319,14 +320,13 @@ err_mem:
319static int __devexit timbgpio_remove(struct platform_device *pdev) 320static int __devexit timbgpio_remove(struct platform_device *pdev)
320{ 321{
321 int err; 322 int err;
322 struct timbgpio_platform_data *pdata = pdev->dev.platform_data;
323 struct timbgpio *tgpio = platform_get_drvdata(pdev); 323 struct timbgpio *tgpio = platform_get_drvdata(pdev);
324 struct resource *iomem = platform_get_resource(pdev, IORESOURCE_MEM, 0); 324 struct resource *iomem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
325 int irq = platform_get_irq(pdev, 0); 325 int irq = platform_get_irq(pdev, 0);
326 326
327 if (irq >= 0 && tgpio->irq_base > 0) { 327 if (irq >= 0 && tgpio->irq_base > 0) {
328 int i; 328 int i;
329 for (i = 0; i < pdata->nr_pins; i++) { 329 for (i = 0; i < tgpio->gpio.ngpio; i++) {
330 irq_set_chip(tgpio->irq_base + i, NULL); 330 irq_set_chip(tgpio->irq_base + i, NULL);
331 irq_set_chip_data(tgpio->irq_base + i, NULL); 331 irq_set_chip_data(tgpio->irq_base + i, NULL);
332 } 332 }