From a617b36bbc0a1d175bbe98e009e903c1ea0e2be5 Mon Sep 17 00:00:00 2001 From: Janusz Krzysztofik Date: Fri, 22 Jun 2018 00:41:27 +0200 Subject: Input: ams_delta_serio: use IRQ resource The driver still obtains IRQ number from a hardcoded GPIO. Use IRQ resource instead. For this to work on Amstrad Delta, add the IRQ resource to ams-delta-serio platform device structure. Obtain the IRQ number assigned to "keybrd_clk" GPIO pin from FIQ initialization routine. As a benefit, the driver no longer needs to include . Signed-off-by: Janusz Krzysztofik Acked-by: Dmitry Torokhov Signed-off-by: Tony Lindgren --- arch/arm/mach-omap1/ams-delta-fiq.c | 20 +++++++++++++++++++- arch/arm/mach-omap1/ams-delta-fiq.h | 3 ++- arch/arm/mach-omap1/board-ams-delta.c | 17 ++++++++++++++++- 3 files changed, 37 insertions(+), 3 deletions(-) (limited to 'arch') diff --git a/arch/arm/mach-omap1/ams-delta-fiq.c b/arch/arm/mach-omap1/ams-delta-fiq.c index e72935034d42..82ca4246a5e4 100644 --- a/arch/arm/mach-omap1/ams-delta-fiq.c +++ b/arch/arm/mach-omap1/ams-delta-fiq.c @@ -20,6 +20,7 @@ #include #include #include +#include #include @@ -84,7 +85,8 @@ static irqreturn_t deferred_fiq(int irq, void *dev_id) return IRQ_HANDLED; } -void __init ams_delta_init_fiq(struct gpio_chip *chip) +void __init ams_delta_init_fiq(struct gpio_chip *chip, + struct platform_device *serio) { struct gpio_desc *gpiod, *data = NULL, *clk = NULL; void *fiqhandler_start; @@ -201,6 +203,22 @@ void __init ams_delta_init_fiq(struct gpio_chip *chip) val = omap_readl(OMAP_IH1_BASE + offset) | 1; omap_writel(val, OMAP_IH1_BASE + offset); + /* Initialize serio device IRQ resource */ + serio->resource[0].start = gpiod_to_irq(clk); + serio->resource[0].end = serio->resource[0].start; + + /* + * Since FIQ handler performs handling of GPIO registers for + * "keybrd_clk" IRQ pin, ams_delta_serio driver used to set + * handle_simple_irq() as active IRQ handler for that pin to avoid + * bad interaction with gpio-omap driver. This is no longer needed + * as handle_simple_irq() is now the default handler for OMAP GPIO + * edge interrupts. + * This comment replaces the obsolete code which has been removed + * from the ams_delta_serio driver and stands here only as a reminder + * of that dependency on gpio-omap driver behavior. + */ + return; out_gpio: diff --git a/arch/arm/mach-omap1/ams-delta-fiq.h b/arch/arm/mach-omap1/ams-delta-fiq.h index 3f691d68aa62..fd76df3cce37 100644 --- a/arch/arm/mach-omap1/ams-delta-fiq.h +++ b/arch/arm/mach-omap1/ams-delta-fiq.h @@ -35,7 +35,8 @@ #ifndef __ASSEMBLER__ extern unsigned char qwerty_fiqin_start, qwerty_fiqin_end; -extern void __init ams_delta_init_fiq(struct gpio_chip *chip); +extern void __init ams_delta_init_fiq(struct gpio_chip *chip, + struct platform_device *pdev); #endif #endif diff --git a/arch/arm/mach-omap1/board-ams-delta.c b/arch/arm/mach-omap1/board-ams-delta.c index 902c24cc8508..f453b08ed7ef 100644 --- a/arch/arm/mach-omap1/board-ams-delta.c +++ b/arch/arm/mach-omap1/board-ams-delta.c @@ -521,9 +521,24 @@ static struct platform_device cx20442_codec_device = { .id = -1, }; +static struct resource ams_delta_serio_resources[] = { + { + .flags = IORESOURCE_IRQ, + /* + * Initialize IRQ resource with invalid IRQ number. + * It will be replaced with dynamically allocated GPIO IRQ + * obtained from GPIO chip as soon as the chip is available. + */ + .start = -EINVAL, + .end = -EINVAL, + }, +}; + static struct platform_device ams_delta_serio_device = { .name = "ams-delta-serio", .id = PLATFORM_DEVID_NONE, + .num_resources = ARRAY_SIZE(ams_delta_serio_resources), + .resource = ams_delta_serio_resources, }; static struct regulator_consumer_supply keybrd_pwr_consumers[] = { @@ -632,7 +647,7 @@ static void __init omap_gpio_deps_init(void) return; } - ams_delta_init_fiq(chip); + ams_delta_init_fiq(chip, &ams_delta_serio_device); } static void __init ams_delta_init(void) -- cgit v1.2.3