From 709ceb53b3c8814f729f1ee79c210e36c83eb80b Mon Sep 17 00:00:00 2001 From: Russell King Date: Wed, 31 Aug 2016 08:49:51 +0100 Subject: ARM: sa1100/assabet: switch assabet 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 --- arch/arm/mach-sa1100/assabet.c | 42 +++++++++++++----------------------------- 1 file changed, 13 insertions(+), 29 deletions(-) diff --git a/arch/arm/mach-sa1100/assabet.c b/arch/arm/mach-sa1100/assabet.c index 0edb1ecc0b11..118b23d524b2 100644 --- a/arch/arm/mach-sa1100/assabet.c +++ b/arch/arm/mach-sa1100/assabet.c @@ -325,36 +325,18 @@ static struct resource assabet_flash_resources[] = { }; -/* - * Assabet IrDA support code. - */ - -static int assabet_irda_set_power(struct device *dev, unsigned int state) -{ - static unsigned int bcr_state[4] = { - ASSABET_BCR_IRDA_MD0, - ASSABET_BCR_IRDA_MD1|ASSABET_BCR_IRDA_MD0, - ASSABET_BCR_IRDA_MD1, - 0 - }; - - if (state < 4) - ASSABET_BCR_frob(ASSABET_BCR_IRDA_MD1 | ASSABET_BCR_IRDA_MD0, - bcr_state[state]); - return 0; -} - -static void assabet_irda_set_speed(struct device *dev, unsigned int speed) -{ - if (speed < 4000000) - ASSABET_BCR_clear(ASSABET_BCR_IRDA_FSEL); - else - ASSABET_BCR_set(ASSABET_BCR_IRDA_FSEL); -} - static struct irda_platform_data assabet_irda_data = { - .set_power = assabet_irda_set_power, - .set_speed = assabet_irda_set_speed, +}; + +/* IrDA GPIO mappings */ +static struct gpiod_lookup_table assabet_irda_gpio_table = { + .dev_id = "sa11x0-ir", + .table = { + GPIO_LOOKUP("assabet", 3, "ir-fsel", GPIO_ACTIVE_HIGH), + GPIO_LOOKUP("assabet", 4, "ir-md0", GPIO_ACTIVE_HIGH), + GPIO_LOOKUP("assabet", 5, "ir-md1", GPIO_ACTIVE_HIGH), + { }, + }, }; static struct ucb1x00_plat_data assabet_ucb1x00_data = { @@ -569,6 +551,8 @@ static struct gpiod_lookup_table assabet_uart3_gpio_table = { static void __init assabet_init(void) { + gpiod_add_lookup_table(&assabet_irda_gpio_table); + /* * Ensure that the power supply is in "high power" mode. */ -- cgit