aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpio/sch_gpio.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gpio/sch_gpio.c')
-rw-r--r--drivers/gpio/sch_gpio.c57
1 files changed, 39 insertions, 18 deletions
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: