summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStephen Rothwell <sfr@canb.auug.org.au>2014-11-28 14:28:00 +1100
committerStephen Rothwell <sfr@canb.auug.org.au>2014-11-28 14:28:00 +1100
commitc3764b52e3b2c60ff53d5e02170bef96c1d44b0e (patch)
tree712d8833dc9a5d3153a2f2237035658b2ea2ddee
parentfed4618aa433eeb92a5d90117b7c1ff88ae3780b (diff)
parent3e0e9ce4ae9b9d16a070fd7ead92a367da1abb3a (diff)
Merge remote-tracking branch 'backlight/for-backlight-next'
-rw-r--r--drivers/video/backlight/pwm_bl.c5
-rw-r--r--include/linux/backlight.h3
2 files changed, 6 insertions, 2 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 {
struct regulator *power_supply;
struct gpio_desc *enable_gpio;
unsigned int scale;
+ bool legacy;
int (*notify)(struct device *,
int brightness);
void (*notify_after)(struct device *,
@@ -274,7 +275,7 @@ static int pwm_backlight_probe(struct platform_device *pdev)
pb->pwm = devm_pwm_get(&pdev->dev, NULL);
if (IS_ERR(pb->pwm)) {
dev_err(&pdev->dev, "unable to request PWM, trying legacy API\n");
-
+ pb->legacy = true;
pb->pwm = pwm_request(data->pwm_id, "pwm-backlight");
if (IS_ERR(pb->pwm)) {
dev_err(&pdev->dev, "unable to request legacy PWM\n");
@@ -339,6 +340,8 @@ static int pwm_backlight_remove(struct platform_device *pdev)
if (pb->exit)
pb->exit(&pdev->dev);
+ if (pb->legacy)
+ pwm_free(pb->pwm);
return 0;
}
diff --git a/include/linux/backlight.h b/include/linux/backlight.h
index adb14a8616df..92b9817b1725 100644
--- a/include/linux/backlight.h
+++ b/include/linux/backlight.h
@@ -157,7 +157,8 @@ struct generic_bl_info {
void (*kick_battery)(void);
};
-#ifdef CONFIG_OF
+#if defined(CONFIG_OF) && (defined(CONFIG_BACKLIGHT_CLASS_DEVICE) || \
+ defined(CONFIG_BACKLIGHT_CLASS_DEVICE_MODULE))
struct backlight_device *of_find_backlight_by_node(struct device_node *node);
#else
static inline struct backlight_device *