From b33d12d3d72df3272c9c017cd93577ba1c9b24bb Mon Sep 17 00:00:00 2001 From: Paul Gortmaker Date: Sun, 27 Mar 2016 11:44:48 -0400 Subject: gpio: xgene: make explicitly non-modular The Kconfig currently controlling compilation of this code is: drivers/gpio/Kconfig:config GPIO_XGENE drivers/gpio/Kconfig: bool "APM X-Gene GPIO controller support" ...meaning that it currently is not being built as a module by anyone. Lets remove the modular code that is essentially orphaned, so that when reading the driver there is no doubt it is builtin-only. Since module_platform_driver() uses the same init level priority as builtin_platform_driver() the init ordering remains unchanged with this commit. Also note that MODULE_DEVICE_TABLE is a no-op for non-modular code. We also delete the MODULE_LICENSE tag etc. since all that information is already contained at the top of the file in the comments. Cc: Feng Kan Cc: Alexandre Courbot Cc: linux-gpio@vger.kernel.org Signed-off-by: Paul Gortmaker Signed-off-by: Linus Walleij --- drivers/gpio/gpio-xgene.c | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) (limited to 'drivers/gpio/gpio-xgene.c') diff --git a/drivers/gpio/gpio-xgene.c b/drivers/gpio/gpio-xgene.c index c0aa387664bf..4193502fe3be 100644 --- a/drivers/gpio/gpio-xgene.c +++ b/drivers/gpio/gpio-xgene.c @@ -17,7 +17,6 @@ * along with this program. If not, see . */ -#include #include #include #include @@ -211,7 +210,6 @@ static const struct of_device_id xgene_gpio_of_match[] = { { .compatible = "apm,xgene-gpio", }, {}, }; -MODULE_DEVICE_TABLE(of, xgene_gpio_of_match); static struct platform_driver xgene_gpio_driver = { .driver = { @@ -221,9 +219,4 @@ static struct platform_driver xgene_gpio_driver = { }, .probe = xgene_gpio_probe, }; - -module_platform_driver(xgene_gpio_driver); - -MODULE_AUTHOR("Feng Kan "); -MODULE_DESCRIPTION("APM X-Gene GPIO driver"); -MODULE_LICENSE("GPL"); +builtin_platform_driver(xgene_gpio_driver); -- cgit v1.2.3 From 0c60de3f73cddde6a83979c64f63cb1101f5326c Mon Sep 17 00:00:00 2001 From: Duc Dang Date: Sat, 30 Apr 2016 13:49:27 -0700 Subject: gpio: xgene: Enable ACPI support for X-Gene GFC GPIO driver This patch enables ACPI support for X-Gene GFC GPIO driver. Signed-off-by: Duc Dang Signed-off-by: Linus Walleij --- drivers/gpio/gpio-xgene.c | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'drivers/gpio/gpio-xgene.c') diff --git a/drivers/gpio/gpio-xgene.c b/drivers/gpio/gpio-xgene.c index 4193502fe3be..46faecd1f580 100644 --- a/drivers/gpio/gpio-xgene.c +++ b/drivers/gpio/gpio-xgene.c @@ -17,6 +17,7 @@ * along with this program. If not, see . */ +#include #include #include #include @@ -211,10 +212,18 @@ static const struct of_device_id xgene_gpio_of_match[] = { {}, }; +#ifdef CONFIG_ACPI +static const struct acpi_device_id xgene_gpio_acpi_match[] = { + { "APMC0D14", 0 }, + { }, +}; +#endif + static struct platform_driver xgene_gpio_driver = { .driver = { .name = "xgene-gpio", .of_match_table = xgene_gpio_of_match, + .acpi_match_table = ACPI_PTR(xgene_gpio_acpi_match), .pm = XGENE_GPIO_PM_OPS, }, .probe = xgene_gpio_probe, -- cgit v1.2.3 From 3b711e0781f34400326f911c15784e84deca84b6 Mon Sep 17 00:00:00 2001 From: Linus Walleij Date: Sun, 1 May 2016 10:29:10 +0200 Subject: gpio: xgene: implement .get_direction() This implements the .get_direction() callback for the xgene GPIO controller. Cc: Duc Dang Cc: Feng Kan Signed-off-by: Linus Walleij --- drivers/gpio/gpio-xgene.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'drivers/gpio/gpio-xgene.c') diff --git a/drivers/gpio/gpio-xgene.c b/drivers/gpio/gpio-xgene.c index 46faecd1f580..dc85dcd47d19 100644 --- a/drivers/gpio/gpio-xgene.c +++ b/drivers/gpio/gpio-xgene.c @@ -85,6 +85,17 @@ static void xgene_gpio_set(struct gpio_chip *gc, unsigned int offset, int val) spin_unlock_irqrestore(&chip->lock, flags); } +static int xgene_gpio_get_direction(struct gpio_chip *gc, unsigned int offset) +{ + struct xgene_gpio *chip = gpiochip_get_data(gc); + unsigned long bank_offset, bit_offset; + + bank_offset = GPIO_SET_DR_OFFSET + GPIO_BANK_OFFSET(offset); + bit_offset = GPIO_BIT_OFFSET(offset); + + return !!(ioread32(chip->base + bank_offset) & BIT(bit_offset)); +} + static int xgene_gpio_dir_in(struct gpio_chip *gc, unsigned int offset) { struct xgene_gpio *chip = gpiochip_get_data(gc); @@ -184,6 +195,7 @@ static int xgene_gpio_probe(struct platform_device *pdev) spin_lock_init(&gpio->lock); gpio->chip.parent = &pdev->dev; + gpio->chip.get_direction = xgene_gpio_get_direction; gpio->chip.direction_input = xgene_gpio_dir_in; gpio->chip.direction_output = xgene_gpio_dir_out; gpio->chip.get = xgene_gpio_get; -- cgit v1.2.3