diff options
-rw-r--r-- | Documentation/leds/leds-lp5521.txt | 19 | ||||
-rw-r--r-- | Documentation/leds/leds-lp5562.txt | 15 | ||||
-rw-r--r-- | drivers/leds/leds-lp5521.c | 19 | ||||
-rw-r--r-- | drivers/leds/leds-lp5562.c | 14 | ||||
-rw-r--r-- | include/linux/platform_data/leds-lp55xx.h | 22 |
5 files changed, 27 insertions, 62 deletions
diff --git a/Documentation/leds/leds-lp5521.txt b/Documentation/leds/leds-lp5521.txt index 270f57196339..79e4c2e6e5e8 100644 --- a/Documentation/leds/leds-lp5521.txt +++ b/Documentation/leds/leds-lp5521.txt | |||
@@ -81,22 +81,3 @@ static struct lp55xx_platform_data lp5521_platform_data = { | |||
81 | 81 | ||
82 | If the current is set to 0 in the platform data, that channel is | 82 | If the current is set to 0 in the platform data, that channel is |
83 | disabled and it is not visible in the sysfs. | 83 | disabled and it is not visible in the sysfs. |
84 | |||
85 | The 'update_config' : CONFIG register (ADDR 08h) | ||
86 | This value is platform-specific data. | ||
87 | If update_config is not defined, the CONFIG register is set with | ||
88 | 'LP5521_PWRSAVE_EN | LP5521_CP_MODE_AUTO | LP5521_R_TO_BATT'. | ||
89 | (Enable auto-powersave, set charge pump to auto, red to battery) | ||
90 | |||
91 | example of update_config : | ||
92 | |||
93 | #define LP5521_CONFIGS (LP5521_PWM_HF | LP5521_PWRSAVE_EN | \ | ||
94 | LP5521_CP_MODE_AUTO | LP5521_R_TO_BATT | \ | ||
95 | LP5521_CLK_INT) | ||
96 | |||
97 | static struct lp55xx_platform_data lp5521_pdata = { | ||
98 | .led_config = lp5521_led_config, | ||
99 | .num_channels = ARRAY_SIZE(lp5521_led_config), | ||
100 | .clock_mode = LP55XX_CLOCK_INT, | ||
101 | .update_config = LP5521_CONFIGS, | ||
102 | }; | ||
diff --git a/Documentation/leds/leds-lp5562.txt b/Documentation/leds/leds-lp5562.txt index 96061000dd93..5a823ff6b393 100644 --- a/Documentation/leds/leds-lp5562.txt +++ b/Documentation/leds/leds-lp5562.txt | |||
@@ -118,18 +118,3 @@ static struct lp55xx_platform_data lp5562_platform_data = { | |||
118 | 118 | ||
119 | If the current is set to 0 in the platform data, that channel is | 119 | If the current is set to 0 in the platform data, that channel is |
120 | disabled and it is not visible in the sysfs. | 120 | disabled and it is not visible in the sysfs. |
121 | |||
122 | The 'update_config' : CONFIG register (ADDR 08h) | ||
123 | This value is platform-specific data. | ||
124 | If update_config is not defined, the CONFIG register is set with | ||
125 | 'LP5562_PWRSAVE_EN | LP5562_CLK_AUTO'. | ||
126 | (Enable auto-powersave, set automatic clock source selection) | ||
127 | |||
128 | #define LP5562_CONFIGS (LP5562_PWM_HF | LP5562_PWRSAVE_EN | \ | ||
129 | LP5562_CLK_SRC_EXT) | ||
130 | |||
131 | static struct lp55xx_platform_data lp5562_pdata = { | ||
132 | .led_config = lp5562_led_config, | ||
133 | .num_channels = ARRAY_SIZE(lp5562_led_config), | ||
134 | .update_config = LP5562_CONFIGS, | ||
135 | }; | ||
diff --git a/drivers/leds/leds-lp5521.c b/drivers/leds/leds-lp5521.c index 7f10304219ea..19752c928aa2 100644 --- a/drivers/leds/leds-lp5521.c +++ b/drivers/leds/leds-lp5521.c | |||
@@ -68,6 +68,18 @@ | |||
68 | #define LP5521_ENABLE_RUN_PROGRAM \ | 68 | #define LP5521_ENABLE_RUN_PROGRAM \ |
69 | (LP5521_ENABLE_DEFAULT | LP5521_EXEC_RUN) | 69 | (LP5521_ENABLE_DEFAULT | LP5521_EXEC_RUN) |
70 | 70 | ||
71 | /* CONFIG register */ | ||
72 | #define LP5521_PWM_HF 0x40 /* PWM: 0 = 256Hz, 1 = 558Hz */ | ||
73 | #define LP5521_PWRSAVE_EN 0x20 /* 1 = Power save mode */ | ||
74 | #define LP5521_CP_MODE_OFF 0 /* Charge pump (CP) off */ | ||
75 | #define LP5521_CP_MODE_BYPASS 8 /* CP forced to bypass mode */ | ||
76 | #define LP5521_CP_MODE_1X5 0x10 /* CP forced to 1.5x mode */ | ||
77 | #define LP5521_CP_MODE_AUTO 0x18 /* Automatic mode selection */ | ||
78 | #define LP5521_R_TO_BATT 0x04 /* R out: 0 = CP, 1 = Vbat */ | ||
79 | #define LP5521_CLK_INT 0x01 /* Internal clock */ | ||
80 | #define LP5521_DEFAULT_CFG \ | ||
81 | (LP5521_PWM_HF | LP5521_PWRSAVE_EN | LP5521_CP_MODE_AUTO) | ||
82 | |||
71 | /* Status */ | 83 | /* Status */ |
72 | #define LP5521_EXT_CLK_USED 0x08 | 84 | #define LP5521_EXT_CLK_USED 0x08 |
73 | 85 | ||
@@ -296,8 +308,11 @@ static int lp5521_post_init_device(struct lp55xx_chip *chip) | |||
296 | /* Set all PWMs to direct control mode */ | 308 | /* Set all PWMs to direct control mode */ |
297 | ret = lp55xx_write(chip, LP5521_REG_OP_MODE, LP5521_CMD_DIRECT); | 309 | ret = lp55xx_write(chip, LP5521_REG_OP_MODE, LP5521_CMD_DIRECT); |
298 | 310 | ||
299 | val = chip->pdata->update_config ? | 311 | /* Update configuration for the clock setting */ |
300 | : (LP5521_PWRSAVE_EN | LP5521_CP_MODE_AUTO | LP5521_R_TO_BATT); | 312 | val = LP5521_DEFAULT_CFG; |
313 | if (!lp55xx_is_extclk_used(chip)) | ||
314 | val |= LP5521_CLK_INT; | ||
315 | |||
301 | ret = lp55xx_write(chip, LP5521_REG_CONFIG, val); | 316 | ret = lp55xx_write(chip, LP5521_REG_CONFIG, val); |
302 | if (ret) | 317 | if (ret) |
303 | return ret; | 318 | return ret; |
diff --git a/drivers/leds/leds-lp5562.c b/drivers/leds/leds-lp5562.c index f8b927788c3a..513f2390ca2d 100644 --- a/drivers/leds/leds-lp5562.c +++ b/drivers/leds/leds-lp5562.c | |||
@@ -71,8 +71,10 @@ | |||
71 | 71 | ||
72 | /* CONFIG Register 08h */ | 72 | /* CONFIG Register 08h */ |
73 | #define LP5562_REG_CONFIG 0x08 | 73 | #define LP5562_REG_CONFIG 0x08 |
74 | #define LP5562_DEFAULT_CFG \ | 74 | #define LP5562_PWM_HF 0x40 |
75 | (LP5562_PWM_HF | LP5562_PWRSAVE_EN | LP5562_CLK_INT) | 75 | #define LP5562_PWRSAVE_EN 0x20 |
76 | #define LP5562_CLK_INT 0x01 /* Internal clock */ | ||
77 | #define LP5562_DEFAULT_CFG (LP5562_PWM_HF | LP5562_PWRSAVE_EN) | ||
76 | 78 | ||
77 | /* RESET Register 0Dh */ | 79 | /* RESET Register 0Dh */ |
78 | #define LP5562_REG_RESET 0x0D | 80 | #define LP5562_REG_RESET 0x0D |
@@ -280,7 +282,7 @@ static void lp5562_firmware_loaded(struct lp55xx_chip *chip) | |||
280 | static int lp5562_post_init_device(struct lp55xx_chip *chip) | 282 | static int lp5562_post_init_device(struct lp55xx_chip *chip) |
281 | { | 283 | { |
282 | int ret; | 284 | int ret; |
283 | u8 update_cfg = chip->pdata->update_config ? : LP5562_DEFAULT_CFG; | 285 | u8 cfg = LP5562_DEFAULT_CFG; |
284 | 286 | ||
285 | /* Set all PWMs to direct control mode */ | 287 | /* Set all PWMs to direct control mode */ |
286 | ret = lp55xx_write(chip, LP5562_REG_OP_MODE, LP5562_CMD_DIRECT); | 288 | ret = lp55xx_write(chip, LP5562_REG_OP_MODE, LP5562_CMD_DIRECT); |
@@ -289,7 +291,11 @@ static int lp5562_post_init_device(struct lp55xx_chip *chip) | |||
289 | 291 | ||
290 | lp5562_wait_opmode_done(); | 292 | lp5562_wait_opmode_done(); |
291 | 293 | ||
292 | ret = lp55xx_write(chip, LP5562_REG_CONFIG, update_cfg); | 294 | /* Update configuration for the clock setting */ |
295 | if (!lp55xx_is_extclk_used(chip)) | ||
296 | cfg |= LP5562_CLK_INT; | ||
297 | |||
298 | ret = lp55xx_write(chip, LP5562_REG_CONFIG, cfg); | ||
293 | if (ret) | 299 | if (ret) |
294 | return ret; | 300 | return ret; |
295 | 301 | ||
diff --git a/include/linux/platform_data/leds-lp55xx.h b/include/linux/platform_data/leds-lp55xx.h index 1f1041e8b4fc..202e290faea8 100644 --- a/include/linux/platform_data/leds-lp55xx.h +++ b/include/linux/platform_data/leds-lp55xx.h | |||
@@ -20,25 +20,6 @@ | |||
20 | #define LP55XX_CLOCK_INT 1 | 20 | #define LP55XX_CLOCK_INT 1 |
21 | #define LP55XX_CLOCK_EXT 2 | 21 | #define LP55XX_CLOCK_EXT 2 |
22 | 22 | ||
23 | /* Bits in LP5521 CONFIG register. 'update_config' in lp55xx_platform_data */ | ||
24 | #define LP5521_PWM_HF 0x40 /* PWM: 0 = 256Hz, 1 = 558Hz */ | ||
25 | #define LP5521_PWRSAVE_EN 0x20 /* 1 = Power save mode */ | ||
26 | #define LP5521_CP_MODE_OFF 0 /* Charge pump (CP) off */ | ||
27 | #define LP5521_CP_MODE_BYPASS 8 /* CP forced to bypass mode */ | ||
28 | #define LP5521_CP_MODE_1X5 0x10 /* CP forced to 1.5x mode */ | ||
29 | #define LP5521_CP_MODE_AUTO 0x18 /* Automatic mode selection */ | ||
30 | #define LP5521_R_TO_BATT 4 /* R out: 0 = CP, 1 = Vbat */ | ||
31 | #define LP5521_CLK_SRC_EXT 0 /* Ext-clk source (CLK_32K) */ | ||
32 | #define LP5521_CLK_INT 1 /* Internal clock */ | ||
33 | #define LP5521_CLK_AUTO 2 /* Automatic clock selection */ | ||
34 | |||
35 | /* Bits in LP5562 CONFIG register */ | ||
36 | #define LP5562_PWM_HF LP5521_PWM_HF | ||
37 | #define LP5562_PWRSAVE_EN LP5521_PWRSAVE_EN | ||
38 | #define LP5562_CLK_SRC_EXT LP5521_CLK_SRC_EXT | ||
39 | #define LP5562_CLK_INT LP5521_CLK_INT | ||
40 | #define LP5562_CLK_AUTO LP5521_CLK_AUTO | ||
41 | |||
42 | struct lp55xx_led_config { | 23 | struct lp55xx_led_config { |
43 | const char *name; | 24 | const char *name; |
44 | u8 chan_nr; | 25 | u8 chan_nr; |
@@ -86,9 +67,6 @@ struct lp55xx_platform_data { | |||
86 | /* Predefined pattern data */ | 67 | /* Predefined pattern data */ |
87 | struct lp55xx_predef_pattern *patterns; | 68 | struct lp55xx_predef_pattern *patterns; |
88 | unsigned int num_patterns; | 69 | unsigned int num_patterns; |
89 | |||
90 | /* _CONFIG register */ | ||
91 | u8 update_config; | ||
92 | }; | 70 | }; |
93 | 71 | ||
94 | #endif /* _LEDS_LP55XX_H */ | 72 | #endif /* _LEDS_LP55XX_H */ |