Commit b3b97473ee07ae8904e9d8fe02914de2188d302c

Authored by Jett.Zhou
Committed by Samuel Ortiz
1 parent 1efc15812d

led: Modified power control of pm860x led

Since several sub modules such as backlight, leds and vibrator depend
on the refernce group and internal oscillator in pm8606, so modified
the power control of led in pm8606 by unified interface.

Signed-off-by: Jett.Zhou <jtzhou@marvell.com>
Cc: Richard Purdie <rpurdie@rpsys.net>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>

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

drivers/leds/leds-88pm860x.c
... ... @@ -114,6 +114,27 @@
114 114 return ret;
115 115 }
116 116  
  117 +static 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 +
117 138 static void pm860x_led_work(struct work_struct *work)
118 139 {
119 140  
... ... @@ -126,6 +147,7 @@
126 147 chip = led->chip;
127 148 mutex_lock(&led->lock);
128 149 if ((led->current_brightness == 0) && led->brightness) {
  150 + led_power_set(chip, led->port, 1);
129 151 if (led->iset) {
130 152 pm860x_set_bits(led->i2c, __led_off(led->port),
131 153 LED_CURRENT_MASK, led->iset);
... ... @@ -149,6 +171,7 @@
149 171 LED_CURRENT_MASK, 0);
150 172 mask = __blink_ctl_mask(led->port);
151 173 pm860x_set_bits(led->i2c, PM8606_WLED3B, mask, 0);
  174 + led_power_set(chip, led->port, 0);
152 175 }
153 176 }
154 177 led->current_brightness = led->brightness;