@@ -626,9 +626,14 @@ static void pwm_backlight_remove(struct platform_device *pdev)
{
struct backlight_device *bl = platform_get_drvdata(pdev);
struct pwm_bl_data *pb = bl_get_data(bl);
+ struct pwm_state state;
backlight_device_unregister(bl);
pwm_backlight_power_off(pb);
+ pwm_get_state(pb->pwm, &state);
+ state.duty_cycle = 0;
+ state.enabled = false;
+ pwm_apply_state(pb->pwm, &state);
if (pb->exit)
pb->exit(&pdev->dev);
@@ -638,8 +643,13 @@ static void pwm_backlight_shutdown(struct platform_device *pdev)
{
struct backlight_device *bl = platform_get_drvdata(pdev);
struct pwm_bl_data *pb = bl_get_data(bl);
+ struct pwm_state state;
pwm_backlight_power_off(pb);
+ pwm_get_state(pb->pwm, &state);
+ state.duty_cycle = 0;
+ state.enabled = false;
+ pwm_apply_state(pb->pwm, &state);
}
#ifdef CONFIG_PM_SLEEP
@@ -647,12 +657,24 @@ static int pwm_backlight_suspend(struct device *dev)
{
struct backlight_device *bl = dev_get_drvdata(dev);
struct pwm_bl_data *pb = bl_get_data(bl);
+ struct pwm_state state;
if (pb->notify)
pb->notify(pb->dev, 0);
pwm_backlight_power_off(pb);
+ /*
+ * Note that disabling the PWM doesn't guarantee that the output stays
+ * at its inactive state. However without the PWM disabled, the PWM
+ * driver refuses to suspend. So disable here even though this might
+ * enable the backlight on poorly designed boards.
+ */
+ pwm_get_state(pb->pwm, &state);
+ state.duty_cycle = 0;
+ state.enabled = false;
+ pwm_apply_state(pb->pwm, &state);
+
if (pb->notify_after)
pb->notify_after(pb->dev, 0);