aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/leds/leds-88pm860x.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/leds/leds-88pm860x.c')
-rw-r--r--drivers/leds/leds-88pm860x.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/drivers/leds/leds-88pm860x.c b/drivers/leds/leds-88pm860x.c
index 4ca00624bd18..5b61aaf7ac0f 100644
--- a/drivers/leds/leds-88pm860x.c
+++ b/drivers/leds/leds-88pm860x.c
@@ -114,6 +114,27 @@ static inline int __blink_ctl_mask(int port)
114 return ret; 114 return ret;
115} 115}
116 116
117static int led_power_set(struct pm860x_chip *chip, int port, int on)
118{
119 int ret = -EINVAL;
120
121 switch (port) {
122 case PM8606_LED1_RED:
123 case PM8606_LED1_GREEN:
124 case PM8606_LED1_BLUE:
125 ret = on ? pm8606_osc_enable(chip, RGB1_ENABLE) :
126 pm8606_osc_disable(chip, RGB1_ENABLE);
127 break;
128 case PM8606_LED2_RED:
129 case PM8606_LED2_GREEN:
130 case PM8606_LED2_BLUE:
131 ret = on ? pm8606_osc_enable(chip, RGB2_ENABLE) :
132 pm8606_osc_disable(chip, RGB2_ENABLE);
133 break;
134 }
135 return ret;
136}
137
117static void pm860x_led_work(struct work_struct *work) 138static void pm860x_led_work(struct work_struct *work)
118{ 139{
119 140
@@ -126,6 +147,7 @@ static void pm860x_led_work(struct work_struct *work)
126 chip = led->chip; 147 chip = led->chip;
127 mutex_lock(&led->lock); 148 mutex_lock(&led->lock);
128 if ((led->current_brightness == 0) && led->brightness) { 149 if ((led->current_brightness == 0) && led->brightness) {
150 led_power_set(chip, led->port, 1);
129 if (led->iset) { 151 if (led->iset) {
130 pm860x_set_bits(led->i2c, __led_off(led->port), 152 pm860x_set_bits(led->i2c, __led_off(led->port),
131 LED_CURRENT_MASK, led->iset); 153 LED_CURRENT_MASK, led->iset);
@@ -149,6 +171,7 @@ static void pm860x_led_work(struct work_struct *work)
149 LED_CURRENT_MASK, 0); 171 LED_CURRENT_MASK, 0);
150 mask = __blink_ctl_mask(led->port); 172 mask = __blink_ctl_mask(led->port);
151 pm860x_set_bits(led->i2c, PM8606_WLED3B, mask, 0); 173 pm860x_set_bits(led->i2c, PM8606_WLED3B, mask, 0);
174 led_power_set(chip, led->port, 0);
152 } 175 }
153 } 176 }
154 led->current_brightness = led->brightness; 177 led->current_brightness = led->brightness;