ARM: footbridge: fix EBSA285 LEDs
- The LEDs register is write-only: it can't be read-modify-written.
- The LEDs are write-1-for-off not 0.
- The check for the platform was inverted.
Fixes: cf6856d693
("ARM: mach-footbridge: retire custom LED code")
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Cc: stable@vger.kernel.org
This commit is contained in:
parent
43659222e7
commit
67130c5464
1 changed files with 13 additions and 9 deletions
|
@ -30,21 +30,24 @@ static const struct {
|
||||||
const char *name;
|
const char *name;
|
||||||
const char *trigger;
|
const char *trigger;
|
||||||
} ebsa285_leds[] = {
|
} ebsa285_leds[] = {
|
||||||
{ "ebsa285:amber", "heartbeat", },
|
{ "ebsa285:amber", "cpu0", },
|
||||||
{ "ebsa285:green", "cpu0", },
|
{ "ebsa285:green", "heartbeat", },
|
||||||
{ "ebsa285:red",},
|
{ "ebsa285:red",},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static unsigned char hw_led_state;
|
||||||
|
|
||||||
static void ebsa285_led_set(struct led_classdev *cdev,
|
static void ebsa285_led_set(struct led_classdev *cdev,
|
||||||
enum led_brightness b)
|
enum led_brightness b)
|
||||||
{
|
{
|
||||||
struct ebsa285_led *led = container_of(cdev,
|
struct ebsa285_led *led = container_of(cdev,
|
||||||
struct ebsa285_led, cdev);
|
struct ebsa285_led, cdev);
|
||||||
|
|
||||||
if (b != LED_OFF)
|
if (b == LED_OFF)
|
||||||
*XBUS_LEDS |= led->mask;
|
hw_led_state |= led->mask;
|
||||||
else
|
else
|
||||||
*XBUS_LEDS &= ~led->mask;
|
hw_led_state &= ~led->mask;
|
||||||
|
*XBUS_LEDS = hw_led_state;
|
||||||
}
|
}
|
||||||
|
|
||||||
static enum led_brightness ebsa285_led_get(struct led_classdev *cdev)
|
static enum led_brightness ebsa285_led_get(struct led_classdev *cdev)
|
||||||
|
@ -52,18 +55,19 @@ static enum led_brightness ebsa285_led_get(struct led_classdev *cdev)
|
||||||
struct ebsa285_led *led = container_of(cdev,
|
struct ebsa285_led *led = container_of(cdev,
|
||||||
struct ebsa285_led, cdev);
|
struct ebsa285_led, cdev);
|
||||||
|
|
||||||
return (*XBUS_LEDS & led->mask) ? LED_FULL : LED_OFF;
|
return hw_led_state & led->mask ? LED_OFF : LED_FULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int __init ebsa285_leds_init(void)
|
static int __init ebsa285_leds_init(void)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
if (machine_is_ebsa285())
|
if (!machine_is_ebsa285())
|
||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
|
|
||||||
/* 3 LEDS All ON */
|
/* 3 LEDS all off */
|
||||||
*XBUS_LEDS |= XBUS_LED_AMBER | XBUS_LED_GREEN | XBUS_LED_RED;
|
hw_led_state = XBUS_LED_AMBER | XBUS_LED_GREEN | XBUS_LED_RED;
|
||||||
|
*XBUS_LEDS = hw_led_state;
|
||||||
|
|
||||||
for (i = 0; i < ARRAY_SIZE(ebsa285_leds); i++) {
|
for (i = 0; i < ARRAY_SIZE(ebsa285_leds); i++) {
|
||||||
struct ebsa285_led *led;
|
struct ebsa285_led *led;
|
||||||
|
|
Loading…
Add table
Reference in a new issue