diff options
author | Russell King <rmk+kernel@armlinux.org.uk> | 2016-08-31 08:49:51 +0100 |
---|---|---|
committer | Russell King (Oracle) <rmk+kernel@armlinux.org.uk> | 2022-05-23 15:58:16 +0100 |
commit | 1e160d5828c5459055086115b3edb1f267686481 (patch) | |
tree | 9f58c52e32f20e3e1f7d4419e8a9815cfcfaf284 /arch/arm | |
parent | 26322a4631713035c07db8b7138f7f14e3ccc6d6 (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>
Diffstat (limited to 'arch/arm')
-rw-r--r-- | arch/arm/mach-sa1100/collie.c | 40 |
1 files changed, 12 insertions, 28 deletions
diff --git a/arch/arm/mach-sa1100/collie.c b/arch/arm/mach-sa1100/collie.c index 14c33ed05318..7449f7986f06 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> @@ -118,35 +119,16 @@ static struct gpiod_lookup_table collie_battery_gpiod_table = { }, }; -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), + { }, + }, }; /* @@ -379,6 +361,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; |