ARM: pxa: zylonite: use gpio lookup instead mfp header

The mach/mfp.h header is only used by this one driver
for hardcoded gpio numbers. Change that to use a lookup
table instead.

Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Cc: linux-input@vger.kernel.org
Acked-by: Robert Jarzmik <robert.jarzmik@free.fr>
Acked-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
This commit is contained in:
Arnd Bergmann 2019-09-11 23:20:45 +02:00
parent 0ca7231fe3
commit f0b66b606a
2 changed files with 41 additions and 8 deletions

View File

@ -32,6 +32,7 @@
#include <linux/platform_data/usb-ohci-pxa27x.h>
#include <linux/platform_data/keypad-pxa27x.h>
#include <linux/platform_data/mtd-nand-pxa3xx.h>
#include <mach/mfp.h>
#include "devices.h"
#include "generic.h"
@ -425,6 +426,35 @@ static void __init zylonite_init_ohci(void)
static inline void zylonite_init_ohci(void) {}
#endif /* CONFIG_USB_OHCI_HCD || CONFIG_USB_OHCI_HCD_MODULE */
static struct gpiod_lookup_table zylonite_wm97xx_touch_gpio15_table = {
.dev_id = "wm97xx-touch.0",
.table = {
GPIO_LOOKUP("gpio-pxa", mfp_to_gpio(MFP_PIN_GPIO15),
"touch", GPIO_ACTIVE_LOW),
{ },
},
};
static struct gpiod_lookup_table zylonite_wm97xx_touch_gpio26_table = {
.dev_id = "wm97xx-touch.0",
.table = {
GPIO_LOOKUP("gpio-pxa", mfp_to_gpio(MFP_PIN_GPIO26),
"touch", GPIO_ACTIVE_LOW),
{ },
},
};
static void __init zylonite_init_wm97xx_touch(void)
{
if (!IS_ENABLED(CONFIG_TOUCHSCREEN_WM97XX_ZYLONITE))
return;
if (cpu_is_pxa320())
gpiod_add_lookup_table(&zylonite_wm97xx_touch_gpio15_table);
else
gpiod_add_lookup_table(&zylonite_wm97xx_touch_gpio26_table);
}
static void __init zylonite_init(void)
{
pxa_set_ffuart_info(NULL);
@ -450,6 +480,7 @@ static void __init zylonite_init(void)
zylonite_init_nand();
zylonite_init_leds();
zylonite_init_ohci();
zylonite_init_wm97xx_touch();
}
MACHINE_START(ZYLONITE, "PXA3xx Platform Development Kit (aka Zylonite)")

View File

@ -17,14 +17,13 @@
#include <linux/moduleparam.h>
#include <linux/kernel.h>
#include <linux/delay.h>
#include <linux/gpio.h>
#include <linux/gpio/consumer.h>
#include <linux/irq.h>
#include <linux/interrupt.h>
#include <linux/io.h>
#include <linux/soc/pxa/cpu.h>
#include <linux/wm97xx.h>
#include <mach/mfp.h>
#include <mach/regs-ac97.h>
struct continuous {
@ -181,14 +180,17 @@ static struct wm97xx_mach_ops zylonite_mach_ops = {
static int zylonite_wm97xx_probe(struct platform_device *pdev)
{
struct wm97xx *wm = platform_get_drvdata(pdev);
int gpio_touch_irq;
struct gpio_desc *gpio_touch_irq;
int err;
if (cpu_is_pxa320())
gpio_touch_irq = mfp_to_gpio(MFP_PIN_GPIO15);
else
gpio_touch_irq = mfp_to_gpio(MFP_PIN_GPIO26);
gpio_touch_irq = devm_gpiod_get(&pdev->dev, "touch", GPIOD_IN);
err = PTR_ERR_OR_ZERO(gpio_touch_irq);
if (err) {
dev_err(&pdev->dev, "Cannot get irq gpio: %d\n", err);
return err;
}
wm->pen_irq = gpio_to_irq(gpio_touch_irq);
wm->pen_irq = gpiod_to_irq(gpio_touch_irq);
irq_set_irq_type(wm->pen_irq, IRQ_TYPE_EDGE_BOTH);
wm97xx_config_gpio(wm, WM97XX_GPIO_13, WM97XX_GPIO_IN,