backlight: jiggle the order of powering on backlight and deconfiguring the backlight PWM on blank/restore. Also, don't mess with the IO state of the PWM pin, if the PWM is disabled, it's disabled, all we need to do is turn the power off.

This commit is contained in:
Matt Sealey
2011-02-21 18:45:31 -06:00
parent 24d20827a9
commit affb43356d
2 changed files with 7 additions and 21 deletions

View File

@@ -120,24 +120,10 @@ static struct gpio_led mx51_efikasb_leds[] = {
};
#if defined(CONFIG_BACKLIGHT_PWM)
static void mx51_efikasb_backlight_power(int on)
static void mx51_efikasb_backlight_power(int state)
{
if (on) {
mxc_free_iomux(EFIKASB_PWM_BACKLIGHT, IOMUX_CONFIG_GPIO);
mxc_request_iomux(EFIKASB_PWM_BACKLIGHT, IOMUX_CONFIG_ALT1);
msleep(10);
gpio_set_value(IOMUX_TO_GPIO(EFIKASB_PWM_BACKLIGHT_EN), 0); /* Backlight Power On */
} else {
gpio_set_value(IOMUX_TO_GPIO(EFIKASB_PWM_BACKLIGHT_EN), 1); /* Backlight Power Off */
msleep(10);
mxc_free_iomux(EFIKASB_PWM_BACKLIGHT, IOMUX_CONFIG_ALT1);
mxc_request_iomux(EFIKASB_PWM_BACKLIGHT, IOMUX_CONFIG_GPIO);
gpio_direction_output(IOMUX_TO_GPIO(EFIKASB_PWM_BACKLIGHT), 0);
}
msleep(10);
gpio_set_value(IOMUX_TO_GPIO(EFIKASB_PWM_BACKLIGHT_EN), !state);
}
static struct platform_pwm_backlight_data mx51_efikasb_backlight_data = {

View File

@@ -50,12 +50,12 @@ static int pwm_backlight_update_status(struct backlight_device *bl)
brightness = pb->notify(brightness);
if (brightness == 0) {
pwm_config(pb->pwm, 0, pb->period);
pwm_disable(pb->pwm);
if (pb->power) {
pb->power(0);
pb->power_state = 0;
}
pwm_config(pb->pwm, 0, pb->period);
pwm_disable(pb->pwm);
} else {
pwm_config(pb->pwm, brightness * pb->period / max, pb->period);
pwm_enable(pb->pwm);
@@ -87,12 +87,12 @@ static void pwm_bl_blank(struct pwm_bl_data *pb, int type)
case FB_BLANK_POWERDOWN:
case FB_BLANK_VSYNC_SUSPEND:
case FB_BLANK_HSYNC_SUSPEND:
pwm_config(pb->pwm, 0, pb->period);
pwm_disable(pb->pwm);
if (pb->power) {
pb->power(0);
pb->power_state = 0;
}
pwm_config(pb->pwm, 0, pb->period);
pwm_disable(pb->pwm);
break;
}
}