gpio-ich.c (ff4709b44cc0755ce7af4c7b3a18580f388b3bff) gpio-ich.c (c086bea543023329f3676492749f64914d0cf69f)
1/*
2 * Intel ICH6-10, Series 5 and 6, Atom C2000 (Avoton/Rangeley) GPIO driver
3 *
4 * Copyright (C) 2010 Extreme Engineering Solutions.
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or

--- 4 unchanged lines hidden (view full) ---

13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19 */
20
1/*
2 * Intel ICH6-10, Series 5 and 6, Atom C2000 (Avoton/Rangeley) GPIO driver
3 *
4 * Copyright (C) 2010 Extreme Engineering Solutions.
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or

--- 4 unchanged lines hidden (view full) ---

13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19 */
20
21#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
22
23#include <linux/ioport.h>
24#include <linux/module.h>
25#include <linux/pci.h>
26#include <linux/gpio/driver.h>
27#include <linux/platform_device.h>
28#include <linux/mfd/lpc_ich.h>
29#include <linux/bitops.h>

--- 422 unchanged lines hidden (view full) ---

452 * registers which are needed to read the the GPE0 register for GPI pins
453 * 0 - 15 on some chipsets.
454 */
455 if (!ichx_priv.desc->uses_gpe0)
456 goto init;
457
458 res_pm = platform_get_resource(pdev, IORESOURCE_IO, ICH_RES_GPE0);
459 if (!res_pm) {
21
22#include <linux/ioport.h>
23#include <linux/module.h>
24#include <linux/pci.h>
25#include <linux/gpio/driver.h>
26#include <linux/platform_device.h>
27#include <linux/mfd/lpc_ich.h>
28#include <linux/bitops.h>

--- 422 unchanged lines hidden (view full) ---

451 * registers which are needed to read the the GPE0 register for GPI pins
452 * 0 - 15 on some chipsets.
453 */
454 if (!ichx_priv.desc->uses_gpe0)
455 goto init;
456
457 res_pm = platform_get_resource(pdev, IORESOURCE_IO, ICH_RES_GPE0);
458 if (!res_pm) {
460 pr_warn("ACPI BAR is unavailable, GPI 0 - 15 unavailable\n");
459 dev_warn(dev, "ACPI BAR is unavailable, GPI 0 - 15 unavailable\n");
461 goto init;
462 }
463
464 if (!devm_request_region(dev, res_pm->start, resource_size(res_pm),
465 pdev->name)) {
460 goto init;
461 }
462
463 if (!devm_request_region(dev, res_pm->start, resource_size(res_pm),
464 pdev->name)) {
466 pr_warn("ACPI BAR is busy, GPI 0 - 15 unavailable\n");
465 dev_warn(dev, "ACPI BAR is busy, GPI 0 - 15 unavailable\n");
467 goto init;
468 }
469
470 ichx_priv.pm_base = res_pm;
471
472init:
473 ichx_gpiolib_setup(&ichx_priv.chip);
474 err = gpiochip_add_data(&ichx_priv.chip, NULL);
475 if (err) {
466 goto init;
467 }
468
469 ichx_priv.pm_base = res_pm;
470
471init:
472 ichx_gpiolib_setup(&ichx_priv.chip);
473 err = gpiochip_add_data(&ichx_priv.chip, NULL);
474 if (err) {
476 pr_err("Failed to register GPIOs\n");
475 dev_err(dev, "Failed to register GPIOs\n");
477 return err;
478 }
479
476 return err;
477 }
478
480 pr_info("GPIO from %d to %d on %s\n", ichx_priv.chip.base,
481 ichx_priv.chip.base + ichx_priv.chip.ngpio - 1, DRV_NAME);
479 dev_info(dev, "GPIO from %d to %d\n", ichx_priv.chip.base,
480 ichx_priv.chip.base + ichx_priv.chip.ngpio - 1);
482
483 return 0;
484}
485
486static int ichx_gpio_remove(struct platform_device *pdev)
487{
488 gpiochip_remove(&ichx_priv.chip);
489

--- 17 unchanged lines hidden ---
481
482 return 0;
483}
484
485static int ichx_gpio_remove(struct platform_device *pdev)
486{
487 gpiochip_remove(&ichx_priv.chip);
488

--- 17 unchanged lines hidden ---