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:11 +0100
commit4b7da11ce280be7e861d60a474957f202ee55f6b (patch)
tree4cadbb0441a0d67cc420bbe1b5c53489ded946b6
parent709ceb53b3c8814f729f1ee79c210e36c83eb80b (diff)
ARM: sa1100/collie: switch collie 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/collie.c40
1 files changed, 12 insertions, 28 deletions
diff --git a/arch/arm/mach-sa1100/collie.c b/arch/arm/mach-sa1100/collie.c
index 3cc2b71e16f0..8ed0cbfaa0f4 100644
--- a/arch/arm/mach-sa1100/collie.c
+++ b/arch/arm/mach-sa1100/collie.c
@@ -21,6 +21,7 @@
#include <linux/kernel.h>
#include <linux/tty.h>
#include <linux/delay.h>
+#include <linux/gpio/machine.h>
#include <linux/platform_data/sa11x0-serial.h>
#include <linux/platform_device.h>
#include <linux/mfd/ucb1x00.h>
@@ -97,35 +98,16 @@ static struct mcp_plat_data collie_mcp_data = {
.codec_pdata = &collie_ucb1x00_data,
};
-static int collie_ir_startup(struct device *dev)
-{
- int rc = gpio_request(COLLIE_GPIO_IR_ON, "IrDA");
- if (rc)
- return rc;
- rc = gpio_direction_output(COLLIE_GPIO_IR_ON, 1);
-
- if (!rc)
- return 0;
-
- gpio_free(COLLIE_GPIO_IR_ON);
- return rc;
-}
-
-static void collie_ir_shutdown(struct device *dev)
-{
- gpio_free(COLLIE_GPIO_IR_ON);
-}
-
-static int collie_ir_set_power(struct device *dev, unsigned int state)
-{
- gpio_set_value(COLLIE_GPIO_IR_ON, !state);
- return 0;
-}
-
static struct irda_platform_data collie_ir_data = {
- .startup = collie_ir_startup,
- .shutdown = collie_ir_shutdown,
- .set_power = collie_ir_set_power,
+};
+
+/* IrDA GPIO mappings */
+static struct gpiod_lookup_table collie_irda_gpio_table = {
+ .dev_id = "sa11x0-ir",
+ .table = {
+ GPIO_LOOKUP("ucb1x00", 3, "ir-power", GPIO_ACTIVE_LOW),
+ { },
+ },
};
/*
@@ -357,6 +339,8 @@ static void __init collie_init(void)
{
int ret = 0;
+ gpiod_add_lookup_table(&collie_irda_gpio_table);
+
/* cpu initialize */
GAFR = GPIO_SSP_TXD | GPIO_SSP_SCLK | GPIO_SSP_SFRM | GPIO_SSP_CLK |
GPIO_MCP_CLK | GPIO_32_768kHz;