Commit 6841a91dc5cfcb02b99413fa4199d9a8ce5ae770

Authored by Milo Kim
Committed by Bryan Wu
1 parent e5862b9a52

leds: lp55xx: add common data structure for program

LP55xx family devices have internal three program engines which are used for
loading LED patterns. To maintain legacy device attributes, specific data
structure is used, 'mode' and 'led_mux'. The mode is used for showing/storing
current engine mode such like disabled, load and run. Then led_mux is used for
showing/storing current output LED selection.

This is only for LP5523/55231.

Signed-off-by: Milo Kim <milo.kim@ti.com>
Signed-off-by: Bryan Wu <cooloney@gmail.com>

Showing 1 changed file with 19 additions and 0 deletions Side-by-side Diff

drivers/leds/leds-lp55xx-common.h
... ... @@ -20,8 +20,15 @@
20 20 LP55XX_ENGINE_1,
21 21 LP55XX_ENGINE_2,
22 22 LP55XX_ENGINE_3,
  23 + LP55XX_ENGINE_MAX = LP55XX_ENGINE_3,
23 24 };
24 25  
  26 +enum lp55xx_engine_mode {
  27 + LP55XX_ENGINE_DISABLED,
  28 + LP55XX_ENGINE_LOAD,
  29 + LP55XX_ENGINE_RUN,
  30 +};
  31 +
25 32 struct lp55xx_led;
26 33 struct lp55xx_chip;
27 34  
... ... @@ -72,6 +79,16 @@
72 79 };
73 80  
74 81 /*
  82 + * struct lp55xx_engine
  83 + * @mode : Engine mode
  84 + * @led_mux : Mux bits for LED selection. Only used in LP5523
  85 + */
  86 +struct lp55xx_engine {
  87 + enum lp55xx_engine_mode mode;
  88 + u16 led_mux;
  89 +};
  90 +
  91 +/*
75 92 * struct lp55xx_chip
76 93 * @cl : I2C communication for access registers
77 94 * @pdata : Platform specific data
... ... @@ -79,6 +96,7 @@
79 96 * @num_leds : Number of registered LEDs
80 97 * @cfg : Device specific configuration data
81 98 * @engine_idx : Selected engine number
  99 + * @engines : Engine structure for the device attribute R/W interface
82 100 * @fw : Firmware data for running a LED pattern
83 101 */
84 102 struct lp55xx_chip {
... ... @@ -89,6 +107,7 @@
89 107 int num_leds;
90 108 struct lp55xx_device_config *cfg;
91 109 enum lp55xx_engine_index engine_idx;
  110 + struct lp55xx_engine engines[LP55XX_ENGINE_MAX];
92 111 const struct firmware *fw;
93 112 };
94 113