Skip to content

Commit 20a451f

Browse files
linuswRussell King (Oracle)
authored andcommitted
ARM: 9101/1: sa1100/assabet: convert LEDs to gpiod APIs
Convert the Assabet LEDs to use the gpiod APIs. Signed-off-by: Linus Walleij <[email protected]> Signed-off-by: Russell King (Oracle) <[email protected]>
1 parent abc25bb commit 20a451f

File tree

1 file changed

+13
-11
lines changed

1 file changed

+13
-11
lines changed

arch/arm/mach-sa1100/assabet.c

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ void ASSABET_BCR_frob(unsigned int mask, unsigned int val)
8484
}
8585
EXPORT_SYMBOL(ASSABET_BCR_frob);
8686

87-
static int __init assabet_init_gpio(void __iomem *reg, u32 def_val)
87+
static void __init assabet_init_gpio(void __iomem *reg, u32 def_val)
8888
{
8989
struct gpio_chip *gc;
9090

@@ -94,11 +94,9 @@ static int __init assabet_init_gpio(void __iomem *reg, u32 def_val)
9494
assabet_names, NULL, NULL);
9595

9696
if (IS_ERR(gc))
97-
return PTR_ERR(gc);
97+
return;
9898

9999
assabet_bcr_gc = gc;
100-
101-
return gc->base;
102100
}
103101

104102
/*
@@ -475,16 +473,23 @@ static struct gpiod_lookup_table assabet_cf_vcc_gpio_table = {
475473
},
476474
};
477475

476+
static struct gpiod_lookup_table assabet_leds_gpio_table = {
477+
.dev_id = "leds-gpio",
478+
.table = {
479+
GPIO_LOOKUP("assabet", 13, NULL, GPIO_ACTIVE_LOW),
480+
GPIO_LOOKUP("assabet", 14, NULL, GPIO_ACTIVE_LOW),
481+
{ },
482+
},
483+
};
484+
478485
static struct gpio_led assabet_leds[] __initdata = {
479486
{
480487
.name = "assabet:red",
481488
.default_trigger = "cpu0",
482-
.active_low = 1,
483489
.default_state = LEDS_GPIO_DEFSTATE_KEEP,
484490
}, {
485491
.name = "assabet:green",
486492
.default_trigger = "heartbeat",
487-
.active_low = 1,
488493
.default_state = LEDS_GPIO_DEFSTATE_KEEP,
489494
},
490495
};
@@ -603,6 +608,7 @@ static void __init assabet_init(void)
603608
&assabet_keys_pdata,
604609
sizeof(assabet_keys_pdata));
605610

611+
gpiod_add_lookup_table(&assabet_leds_gpio_table);
606612
gpio_led_register_device(-1, &assabet_leds_pdata);
607613

608614
#ifndef ASSABET_PAL_VIDEO
@@ -739,7 +745,6 @@ static void __init assabet_map_io(void)
739745

740746
void __init assabet_init_irq(void)
741747
{
742-
unsigned int assabet_gpio_base;
743748
u32 def_val;
744749

745750
sa1100_init_irq();
@@ -754,10 +759,7 @@ void __init assabet_init_irq(void)
754759
*
755760
* This must precede any driver calls to BCR_set() or BCR_clear().
756761
*/
757-
assabet_gpio_base = assabet_init_gpio((void *)&ASSABET_BCR, def_val);
758-
759-
assabet_leds[0].gpio = assabet_gpio_base + 13;
760-
assabet_leds[1].gpio = assabet_gpio_base + 14;
762+
assabet_init_gpio((void *)&ASSABET_BCR, def_val);
761763
}
762764

763765
MACHINE_START(ASSABET, "Intel-Assabet")

0 commit comments

Comments
 (0)