aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMilo(Woogyom) Kim <milo.kim@ti.com>2013-02-05 05:25:26 -0500
committerBryan Wu <cooloney@gmail.com>2013-02-06 18:59:30 -0500
commit12f022d27bcdd606527ae1b3c9ad20cc8c90ce98 (patch)
treebf8e6c143ef735f3339a84102fd53e3e4346eea4
parent93ca4093adb757d5140071e72b2e9bfbb519b6c1 (diff)
leds-lp55xx: clean up definitions
Remove unused definitions and change hex values to capital letters Signed-off-by: Milo(Woogyom) Kim <milo.kim@ti.com> Signed-off-by: Bryan Wu <cooloney@gmail.com>
-rw-r--r--drivers/leds/leds-lp5521.c26
-rw-r--r--drivers/leds/leds-lp5523.c56
2 files changed, 12 insertions, 70 deletions
diff --git a/drivers/leds/leds-lp5521.c b/drivers/leds/leds-lp5521.c
index f05eb6e31d58..b2a0d877cdc1 100644
--- a/drivers/leds/leds-lp5521.c
+++ b/drivers/leds/leds-lp5521.c
@@ -39,18 +39,9 @@
39 39
40#include "leds-lp55xx-common.h" 40#include "leds-lp55xx-common.h"
41 41
42#define LP5521_PROGRAM_LENGTH 32 /* in bytes */ 42#define LP5521_PROGRAM_LENGTH 32
43 43#define LP5521_MAX_LEDS 3
44#define LP5521_MAX_LEDS 3 /* Maximum number of LEDs */ 44#define LP5521_CMD_DIRECT 0x3F
45#define LP5521_MAX_ENGINES 3 /* Maximum number of engines */
46
47#define LP5521_ENG_MASK_BASE 0x30 /* 00110000 */
48#define LP5521_ENG_STATUS_MASK 0x07 /* 00000111 */
49
50#define LP5521_CMD_LOAD 0x15 /* 00010101 */
51#define LP5521_CMD_RUN 0x2a /* 00101010 */
52#define LP5521_CMD_DIRECT 0x3f /* 00111111 */
53#define LP5521_CMD_DISABLED 0x00 /* 00000000 */
54 45
55/* Registers */ 46/* Registers */
56#define LP5521_REG_ENABLE 0x00 47#define LP5521_REG_ENABLE 0x00
@@ -62,22 +53,14 @@
62#define LP5521_REG_G_CURRENT 0x06 53#define LP5521_REG_G_CURRENT 0x06
63#define LP5521_REG_B_CURRENT 0x07 54#define LP5521_REG_B_CURRENT 0x07
64#define LP5521_REG_CONFIG 0x08 55#define LP5521_REG_CONFIG 0x08
65#define LP5521_REG_R_CHANNEL_PC 0x09
66#define LP5521_REG_G_CHANNEL_PC 0x0A
67#define LP5521_REG_B_CHANNEL_PC 0x0B
68#define LP5521_REG_STATUS 0x0C 56#define LP5521_REG_STATUS 0x0C
69#define LP5521_REG_RESET 0x0D 57#define LP5521_REG_RESET 0x0D
70#define LP5521_REG_GPO 0x0E
71#define LP5521_REG_R_PROG_MEM 0x10 58#define LP5521_REG_R_PROG_MEM 0x10
72#define LP5521_REG_G_PROG_MEM 0x30 59#define LP5521_REG_G_PROG_MEM 0x30
73#define LP5521_REG_B_PROG_MEM 0x50 60#define LP5521_REG_B_PROG_MEM 0x50
74 61
75#define LP5521_PROG_MEM_BASE LP5521_REG_R_PROG_MEM
76#define LP5521_PROG_MEM_SIZE 0x20
77
78/* Base register to set LED current */ 62/* Base register to set LED current */
79#define LP5521_REG_LED_CURRENT_BASE LP5521_REG_R_CURRENT 63#define LP5521_REG_LED_CURRENT_BASE LP5521_REG_R_CURRENT
80
81/* Base register to set the brightness */ 64/* Base register to set the brightness */
82#define LP5521_REG_LED_PWM_BASE LP5521_REG_R_PWM 65#define LP5521_REG_LED_PWM_BASE LP5521_REG_R_PWM
83 66
@@ -96,9 +79,6 @@
96/* default R channel current register value */ 79/* default R channel current register value */
97#define LP5521_REG_R_CURR_DEFAULT 0xAF 80#define LP5521_REG_R_CURR_DEFAULT 0xAF
98 81
99/* Pattern Mode */
100#define PATTERN_OFF 0
101
102/* Reset register value */ 82/* Reset register value */
103#define LP5521_RESET 0xFF 83#define LP5521_RESET 0xFF
104 84
diff --git a/drivers/leds/leds-lp5523.c b/drivers/leds/leds-lp5523.c
index b14bde2db24f..e145ce984b1d 100644
--- a/drivers/leds/leds-lp5523.c
+++ b/drivers/leds/leds-lp5523.c
@@ -39,76 +39,38 @@
39 39
40#include "leds-lp55xx-common.h" 40#include "leds-lp55xx-common.h"
41 41
42#define LP5523_PROGRAM_LENGTH 32
43#define LP5523_MAX_LEDS 9
44
45/* Registers */
42#define LP5523_REG_ENABLE 0x00 46#define LP5523_REG_ENABLE 0x00
43#define LP5523_REG_OP_MODE 0x01 47#define LP5523_REG_OP_MODE 0x01
44#define LP5523_REG_RATIOMETRIC_MSB 0x02
45#define LP5523_REG_RATIOMETRIC_LSB 0x03
46#define LP5523_REG_ENABLE_LEDS_MSB 0x04 48#define LP5523_REG_ENABLE_LEDS_MSB 0x04
47#define LP5523_REG_ENABLE_LEDS_LSB 0x05 49#define LP5523_REG_ENABLE_LEDS_LSB 0x05
48#define LP5523_REG_LED_CNTRL_BASE 0x06
49#define LP5523_REG_LED_PWM_BASE 0x16 50#define LP5523_REG_LED_PWM_BASE 0x16
50#define LP5523_REG_LED_CURRENT_BASE 0x26 51#define LP5523_REG_LED_CURRENT_BASE 0x26
51#define LP5523_REG_CONFIG 0x36 52#define LP5523_REG_CONFIG 0x36
52#define LP5523_REG_CHANNEL1_PC 0x37 53#define LP5523_REG_STATUS 0x3A
53#define LP5523_REG_CHANNEL2_PC 0x38 54#define LP5523_REG_RESET 0x3D
54#define LP5523_REG_CHANNEL3_PC 0x39
55#define LP5523_REG_STATUS 0x3a
56#define LP5523_REG_GPO 0x3b
57#define LP5523_REG_VARIABLE 0x3c
58#define LP5523_REG_RESET 0x3d
59#define LP5523_REG_TEMP_CTRL 0x3e
60#define LP5523_REG_TEMP_READ 0x3f
61#define LP5523_REG_TEMP_WRITE 0x40
62#define LP5523_REG_LED_TEST_CTRL 0x41 55#define LP5523_REG_LED_TEST_CTRL 0x41
63#define LP5523_REG_LED_TEST_ADC 0x42 56#define LP5523_REG_LED_TEST_ADC 0x42
64#define LP5523_REG_ENG1_VARIABLE 0x45 57#define LP5523_REG_PROG_PAGE_SEL 0x4F
65#define LP5523_REG_ENG2_VARIABLE 0x46
66#define LP5523_REG_ENG3_VARIABLE 0x47
67#define LP5523_REG_MASTER_FADER1 0x48
68#define LP5523_REG_MASTER_FADER2 0x49
69#define LP5523_REG_MASTER_FADER3 0x4a
70#define LP5523_REG_CH1_PROG_START 0x4c
71#define LP5523_REG_CH2_PROG_START 0x4d
72#define LP5523_REG_CH3_PROG_START 0x4e
73#define LP5523_REG_PROG_PAGE_SEL 0x4f
74#define LP5523_REG_PROG_MEM 0x50 58#define LP5523_REG_PROG_MEM 0x50
75 59
76#define LP5523_CMD_LOAD 0x15 /* 00010101 */ 60/* Bit description in registers */
77#define LP5523_CMD_RUN 0x2a /* 00101010 */
78#define LP5523_CMD_DISABLED 0x00 /* 00000000 */
79
80#define LP5523_ENABLE 0x40 61#define LP5523_ENABLE 0x40
81#define LP5523_AUTO_INC 0x40 62#define LP5523_AUTO_INC 0x40
82#define LP5523_PWR_SAVE 0x20 63#define LP5523_PWR_SAVE 0x20
83#define LP5523_PWM_PWR_SAVE 0x04 64#define LP5523_PWM_PWR_SAVE 0x04
84#define LP5523_CP_1 0x08
85#define LP5523_CP_1_5 0x10
86#define LP5523_CP_AUTO 0x18 65#define LP5523_CP_AUTO 0x18
87#define LP5523_INT_CLK 0x01
88#define LP5523_AUTO_CLK 0x02 66#define LP5523_AUTO_CLK 0x02
67
89#define LP5523_EN_LEDTEST 0x80 68#define LP5523_EN_LEDTEST 0x80
90#define LP5523_LEDTEST_DONE 0x80 69#define LP5523_LEDTEST_DONE 0x80
91#define LP5523_RESET 0xFF 70#define LP5523_RESET 0xFF
92
93#define LP5523_DEFAULT_CURRENT 50 /* microAmps */
94#define LP5523_PROGRAM_LENGTH 32 /* in bytes */
95#define LP5523_PROGRAM_PAGES 6
96#define LP5523_ADC_SHORTCIRC_LIM 80 71#define LP5523_ADC_SHORTCIRC_LIM 80
97
98#define LP5523_MAX_LEDS 9
99#define LP5523_ENGINES 3
100
101#define LP5523_ENG_MASK_BASE 0x30 /* 00110000 */
102
103#define LP5523_ENG_STATUS_MASK 0x07 /* 00000111 */
104
105#define LP5523_IRQ_FLAGS IRQF_TRIGGER_FALLING
106
107#define LP5523_EXT_CLK_USED 0x08 72#define LP5523_EXT_CLK_USED 0x08
108 73
109#define LED_ACTIVE(mux, led) (!!(mux & (0x0001 << led)))
110#define SHIFT_MASK(id) (((id) - 1) * 2)
111
112/* Memory Page Selection */ 74/* Memory Page Selection */
113#define LP5523_PAGE_ENG1 0 75#define LP5523_PAGE_ENG1 0
114#define LP5523_PAGE_ENG2 1 76#define LP5523_PAGE_ENG2 1