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>
#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_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;
struct ubnt_ledbar {
struct mutex lock;
struct i2c_client *client;
struct led_classdev led_red;
struct led_classdev led_green;
struct i2c_client *client;
struct led_classdev led_red;
struct led_classdev led_green;
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,
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;
char i2c_response;
int ret = 0;
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_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);
gpiod_set_value(ledbar->enable_gpio, 1);
+ ledbar->led_count = 1;
+ of_property_read_u32(np, "led-count", &ledbar->led_count);
+
ledbar->client = client;
mutex_init(&ledbar->lock);
ledbar->client = client;
mutex_init(&ledbar->lock);