aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/mediatek/files
diff options
context:
space:
mode:
authorSven Wegener <sven.wegener@stealer.net>2021-06-12 21:56:22 +0200
committerDaniel Golle <daniel@makrotopia.org>2022-09-11 20:26:42 +0100
commit76198e8f09a607c6aca2621f59d7a4cd7f6653e3 (patch)
tree3e8f8ad5e1ff4d9fd3da16d6e4d75ff8c297b217 /target/linux/mediatek/files
parent013a956f086dc5d88f6e9cbd852ed4d900d436e0 (diff)
downloadupstream-76198e8f09a607c6aca2621f59d7a4cd7f6653e3.tar.gz
upstream-76198e8f09a607c6aca2621f59d7a4cd7f6653e3.tar.bz2
upstream-76198e8f09a607c6aca2621f59d7a4cd7f6653e3.zip
mediatek: add led count
The LEDs connected to the MCU are so-called smart LEDs and their signal is daisy-chained. Because of this, the MCU needs to be told how many LEDs are connected. It also means the LEDs could be individually controlled, if the MCU has a command for this. Signed-off-by: Sven Wegener <sven.wegener@stealer.net>
Diffstat (limited to 'target/linux/mediatek/files')
-rw-r--r--target/linux/mediatek/files/drivers/leds/leds-ubnt-ledbar.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/target/linux/mediatek/files/drivers/leds/leds-ubnt-ledbar.c b/target/linux/mediatek/files/drivers/leds/leds-ubnt-ledbar.c
index 10d240d2be..555340c5e8 100644
--- a/target/linux/mediatek/files/drivers/leds/leds-ubnt-ledbar.c
+++ b/target/linux/mediatek/files/drivers/leds/leds-ubnt-ledbar.c
@@ -31,9 +31,11 @@
#define UBNT_LEDBAR_TRANSACTION_BLUE_IDX 2
#define UBNT_LEDBAR_TRANSACTION_GREEN_IDX 3
#define UBNT_LEDBAR_TRANSACTION_RED_IDX 4
+#define UBNT_LEDBAR_TRANSACTION_LED_COUNT_IDX 6
struct ubnt_ledbar {
struct mutex lock;
+ u32 led_count;
struct i2c_client *client;
struct led_classdev led_red;
struct led_classdev led_green;
@@ -60,7 +62,7 @@ static int ubnt_ledbar_apply_state(struct ubnt_ledbar *ledbar)
char setup_msg[UBNT_LEDBAR_TRANSACTION_LENGTH] = {0x40, 0x10, 0x00, 0x00,
0x00, 0x00, 0x00, 0x11};
char led_msg[UBNT_LEDBAR_TRANSACTION_LENGTH] = {0x40, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x01, 0x00};
+ 0x00, 0x00, 0x00, 0x00};
char i2c_response;
int ret = 0;
@@ -69,6 +71,7 @@ static int ubnt_ledbar_apply_state(struct ubnt_ledbar *ledbar)
led_msg[UBNT_LEDBAR_TRANSACTION_BLUE_IDX] = ledbar->led_blue.brightness;
led_msg[UBNT_LEDBAR_TRANSACTION_GREEN_IDX] = ledbar->led_green.brightness;
led_msg[UBNT_LEDBAR_TRANSACTION_RED_IDX] = ledbar->led_red.brightness;
+ led_msg[UBNT_LEDBAR_TRANSACTION_LED_COUNT_IDX] = ledbar->led_count;
gpiod_set_value(ledbar->enable_gpio, 1);
@@ -191,6 +194,9 @@ static int ubnt_ledbar_probe(struct i2c_client *client,
return ret;
}
+ ledbar->led_count = 1;
+ of_property_read_u32(np, "led-count", &ledbar->led_count);
+
ledbar->client = client;
mutex_init(&ledbar->lock);