aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/video/backlight/pwm_bl.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/video/backlight/pwm_bl.c b/drivers/video/backlight/pwm_bl.c
index cb5ae4c08469..3a145a643e0d 100644
--- a/drivers/video/backlight/pwm_bl.c
+++ b/drivers/video/backlight/pwm_bl.c
@@ -34,6 +34,7 @@ struct pwm_bl_data {
34 struct regulator *power_supply; 34 struct regulator *power_supply;
35 struct gpio_desc *enable_gpio; 35 struct gpio_desc *enable_gpio;
36 unsigned int scale; 36 unsigned int scale;
37 bool legacy;
37 int (*notify)(struct device *, 38 int (*notify)(struct device *,
38 int brightness); 39 int brightness);
39 void (*notify_after)(struct device *, 40 void (*notify_after)(struct device *,
@@ -274,7 +275,7 @@ static int pwm_backlight_probe(struct platform_device *pdev)
274 pb->pwm = devm_pwm_get(&pdev->dev, NULL); 275 pb->pwm = devm_pwm_get(&pdev->dev, NULL);
275 if (IS_ERR(pb->pwm)) { 276 if (IS_ERR(pb->pwm)) {
276 dev_err(&pdev->dev, "unable to request PWM, trying legacy API\n"); 277 dev_err(&pdev->dev, "unable to request PWM, trying legacy API\n");
277 278 pb->legacy = true;
278 pb->pwm = pwm_request(data->pwm_id, "pwm-backlight"); 279 pb->pwm = pwm_request(data->pwm_id, "pwm-backlight");
279 if (IS_ERR(pb->pwm)) { 280 if (IS_ERR(pb->pwm)) {
280 dev_err(&pdev->dev, "unable to request legacy PWM\n"); 281 dev_err(&pdev->dev, "unable to request legacy PWM\n");
@@ -339,6 +340,8 @@ static int pwm_backlight_remove(struct platform_device *pdev)
339 340
340 if (pb->exit) 341 if (pb->exit)
341 pb->exit(&pdev->dev); 342 pb->exit(&pdev->dev);
343 if (pb->legacy)
344 pwm_free(pb->pwm);
342 345
343 return 0; 346 return 0;
344} 347}