summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRussell King <rmk+kernel@armlinux.org.uk>2016-08-31 08:49:51 +0100
committerRussell King <rmk+kernel@armlinux.org.uk>2020-10-12 21:53:13 +0100
commit05761815a6800b3f2a212bcc5e13f1ef902da73d (patch)
treedcf91e010043046f537d5471481f5b546a392cf9
parent4b7da11ce280be7e861d60a474957f202ee55f6b (diff)
ARM: sa1100/h3xxx: switch h3xxx IrDA to use gpiod APIs
Switch the IrDA code to use the gpiod APIs rather than platform data with function callbacks. Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
-rw-r--r--arch/arm/mach-sa1100/h3100.c44
-rw-r--r--arch/arm/mach-sa1100/h3600.c44
2 files changed, 24 insertions, 64 deletions
diff --git a/arch/arm/mach-sa1100/h3100.c b/arch/arm/mach-sa1100/h3100.c
index 51eaeeaf3f10..d32e03ed6d1d 100644
--- a/arch/arm/mach-sa1100/h3100.c
+++ b/arch/arm/mach-sa1100/h3100.c
@@ -9,6 +9,7 @@
#include <linux/init.h>
#include <linux/kernel.h>
#include <linux/gpio.h>
+#include <linux/gpio/machine.h>
#include <video/sa1100fb.h>
@@ -82,44 +83,23 @@ static void __init h3100_map_io(void)
GAFR &= ~0x000001fb;
}
-/*
- * This turns the IRDA power on or off on the Compaq H3100
- */
-static struct gpio h3100_irda_gpio[] = {
- { H3100_GPIO_IR_ON, GPIOF_OUT_INIT_LOW, "IrDA power" },
- { H3100_GPIO_IR_FSEL, GPIOF_OUT_INIT_LOW, "IrDA fsel" },
+static struct irda_platform_data h3100_irda_data = {
};
-static int h3100_irda_set_power(struct device *dev, unsigned int state)
-{
- gpio_set_value(H3100_GPIO_IR_ON, state);
- return 0;
-}
-
-static void h3100_irda_set_speed(struct device *dev, unsigned int speed)
-{
- gpio_set_value(H3100_GPIO_IR_FSEL, !(speed < 4000000));
-}
-
-static int h3100_irda_startup(struct device *dev)
-{
- return gpio_request_array(h3100_irda_gpio, sizeof(h3100_irda_gpio));
-}
-
-static void h3100_irda_shutdown(struct device *dev)
-{
- return gpio_free_array(h3100_irda_gpio, sizeof(h3100_irda_gpio));
-}
-
-static struct irda_platform_data h3100_irda_data = {
- .set_power = h3100_irda_set_power,
- .set_speed = h3100_irda_set_speed,
- .startup = h3100_irda_startup,
- .shutdown = h3100_irda_shutdown,
+/* IrDA GPIO mappings */
+static struct gpiod_lookup_table h3100_irda_gpio_table = {
+ .dev_id = "sa11x0-ir",
+ .table = {
+ GPIO_LOOKUP("gpio", 8, "ir-power", GPIO_ACTIVE_HIGH),
+ GPIO_LOOKUP("gpio", 9, "ir-fsel", GPIO_ACTIVE_HIGH),
+ { },
+ },
};
static void __init h3100_mach_init(void)
{
+ gpiod_add_lookup_table(&h3100_irda_gpio_table);
+
h3xxx_mach_init();
sa11x0_register_pcmcia(-1, NULL);
diff --git a/arch/arm/mach-sa1100/h3600.c b/arch/arm/mach-sa1100/h3600.c
index baf529117b26..5f4fb3027799 100644
--- a/arch/arm/mach-sa1100/h3600.c
+++ b/arch/arm/mach-sa1100/h3600.c
@@ -9,6 +9,7 @@
#include <linux/init.h>
#include <linux/kernel.h>
#include <linux/gpio.h>
+#include <linux/gpio/machine.h>
#include <video/sa1100fb.h>
@@ -90,44 +91,23 @@ static void __init h3600_map_io(void)
h3xxx_map_io();
}
-/*
- * This turns the IRDA power on or off on the Compaq H3600
- */
-static struct gpio h3600_irda_gpio[] = {
- { H3600_EGPIO_IR_ON, GPIOF_OUT_INIT_LOW, "IrDA power" },
- { H3600_EGPIO_IR_FSEL, GPIOF_OUT_INIT_LOW, "IrDA fsel" },
+static struct irda_platform_data h3600_irda_data = {
};
-static int h3600_irda_set_power(struct device *dev, unsigned int state)
-{
- gpio_set_value(H3600_EGPIO_IR_ON, state);
- return 0;
-}
-
-static void h3600_irda_set_speed(struct device *dev, unsigned int speed)
-{
- gpio_set_value(H3600_EGPIO_IR_FSEL, !(speed < 4000000));
-}
-
-static int h3600_irda_startup(struct device *dev)
-{
- return gpio_request_array(h3600_irda_gpio, sizeof(h3600_irda_gpio));
-}
-
-static void h3600_irda_shutdown(struct device *dev)
-{
- return gpio_free_array(h3600_irda_gpio, sizeof(h3600_irda_gpio));
-}
-
-static struct irda_platform_data h3600_irda_data = {
- .set_power = h3600_irda_set_power,
- .set_speed = h3600_irda_set_speed,
- .startup = h3600_irda_startup,
- .shutdown = h3600_irda_shutdown,
+/* IrDA GPIO mappings */
+static struct gpiod_lookup_table h3600_irda_gpio_table = {
+ .dev_id = "sa11x0-ir",
+ .table = {
+ GPIO_LOOKUP("htc-egpio", 9, "ir-power", GPIO_ACTIVE_HIGH),
+ GPIO_LOOKUP("htc-egpio", 13, "ir-fsel", GPIO_ACTIVE_HIGH),
+ { },
+ },
};
static void __init h3600_mach_init(void)
{
+ gpiod_add_lookup_table(&h3600_irda_gpio_table);
+
h3xxx_mach_init();
sa11x0_register_lcd(&h3600_lcd_info);