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>
This commit is contained in:
parent
1efc15812d
commit
b3b97473ee
1 changed files with 23 additions and 0 deletions
|
@ -114,6 +114,27 @@ static inline int __blink_ctl_mask(int port)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int led_power_set(struct pm860x_chip *chip, int port, int on)
|
||||||
|
{
|
||||||
|
int ret = -EINVAL;
|
||||||
|
|
||||||
|
switch (port) {
|
||||||
|
case PM8606_LED1_RED:
|
||||||
|
case PM8606_LED1_GREEN:
|
||||||
|
case PM8606_LED1_BLUE:
|
||||||
|
ret = on ? pm8606_osc_enable(chip, RGB1_ENABLE) :
|
||||||
|
pm8606_osc_disable(chip, RGB1_ENABLE);
|
||||||
|
break;
|
||||||
|
case PM8606_LED2_RED:
|
||||||
|
case PM8606_LED2_GREEN:
|
||||||
|
case PM8606_LED2_BLUE:
|
||||||
|
ret = on ? pm8606_osc_enable(chip, RGB2_ENABLE) :
|
||||||
|
pm8606_osc_disable(chip, RGB2_ENABLE);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
static void pm860x_led_work(struct work_struct *work)
|
static void pm860x_led_work(struct work_struct *work)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -126,6 +147,7 @@ static void pm860x_led_work(struct work_struct *work)
|
||||||
chip = led->chip;
|
chip = led->chip;
|
||||||
mutex_lock(&led->lock);
|
mutex_lock(&led->lock);
|
||||||
if ((led->current_brightness == 0) && led->brightness) {
|
if ((led->current_brightness == 0) && led->brightness) {
|
||||||
|
led_power_set(chip, led->port, 1);
|
||||||
if (led->iset) {
|
if (led->iset) {
|
||||||
pm860x_set_bits(led->i2c, __led_off(led->port),
|
pm860x_set_bits(led->i2c, __led_off(led->port),
|
||||||
LED_CURRENT_MASK, led->iset);
|
LED_CURRENT_MASK, led->iset);
|
||||||
|
@ -149,6 +171,7 @@ static void pm860x_led_work(struct work_struct *work)
|
||||||
LED_CURRENT_MASK, 0);
|
LED_CURRENT_MASK, 0);
|
||||||
mask = __blink_ctl_mask(led->port);
|
mask = __blink_ctl_mask(led->port);
|
||||||
pm860x_set_bits(led->i2c, PM8606_WLED3B, mask, 0);
|
pm860x_set_bits(led->i2c, PM8606_WLED3B, mask, 0);
|
||||||
|
led_power_set(chip, led->port, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
led->current_brightness = led->brightness;
|
led->current_brightness = led->brightness;
|
||||||
|
|
Loading…
Reference in a new issue