Skip to content

Commit 5bc23a0

Browse files
committed
Merge tag 'backlight-for-linus-4.4' of git://git.kernel.org/pub/scm/linux/kernel/git/lee/backlight
Pull backlight updates from Lee Jones: "New Device Support - None New Functionality: - None Core Frameworks: - Reject legacy PWM request for device defined in DT Fix-ups: - Remove unnecessary MODULE_ALIAS(); adp8860_bl, adp8870_bl - Simplify code: pm8941-wled - Supply default-brightness logic; pm8941-wled Bug Fixes: - Clean up OF node; 88pm860x_bl - Ensure struct is zeroed; lp855x_bl" * tag 'backlight-for-linus-4.4' of git://git.kernel.org/pub/scm/linux/kernel/git/lee/backlight: backlight: pm8941-wled: Add default-brightness property backlight: pm8941-wled: Fix ptr_ret.cocci warnings backlight: pwm: Reject legacy PWM request for device defined in DT backlight: 88pm860x_bl: Add missing of_node_put backlight: adp8870: Remove unnecessary MODULE_ALIAS() backlight: adp8860: Remove unnecessary MODULE_ALIAS() backlight: lp855x: Make sure props struct is zeroed
2 parents 4dcee4d + 9d6c243 commit 5bc23a0

7 files changed

Lines changed: 22 additions & 16 deletions

File tree

‎Documentation/devicetree/bindings/video/backlight/pm8941-wled.txt‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ Required properties:
55
- reg: slave address
66

77
Optional properties:
8+
- default-brightness: brightness value on boot, value from: 0-4095
9+
default: 2048
810
- label: The name of the backlight device
911
- qcom,cs-out: bool; enable current sink output
1012
- qcom,cabc: bool; enable content adaptive backlight control

‎drivers/video/backlight/88pm860x_bl.c‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,7 @@ static int pm860x_backlight_dt_init(struct platform_device *pdev,
180180
data->iset = PM8606_WLED_CURRENT(iset);
181181
of_property_read_u32(np, "marvell,88pm860x-pwm",
182182
&data->pwm);
183+
of_node_put(np);
183184
break;
184185
}
185186
}

‎drivers/video/backlight/adp8860_bl.c‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -819,4 +819,3 @@ module_i2c_driver(adp8860_driver);
819819
MODULE_LICENSE("GPL v2");
820820
MODULE_AUTHOR("Michael Hennerich <hennerich@blackfin.uclinux.org>");
821821
MODULE_DESCRIPTION("ADP8860 Backlight driver");
822-
MODULE_ALIAS("i2c:adp8860-backlight");

‎drivers/video/backlight/adp8870_bl.c‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -992,4 +992,3 @@ module_i2c_driver(adp8870_driver);
992992
MODULE_LICENSE("GPL v2");
993993
MODULE_AUTHOR("Michael Hennerich <hennerich@blackfin.uclinux.org>");
994994
MODULE_DESCRIPTION("ADP8870 Backlight driver");
995-
MODULE_ALIAS("i2c:adp8870-backlight");

‎drivers/video/backlight/lp855x_bl.c‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -283,6 +283,7 @@ static int lp855x_backlight_register(struct lp855x *lp)
283283
struct lp855x_platform_data *pdata = lp->pdata;
284284
const char *name = pdata->name ? : DEFAULT_BL_NAME;
285285

286+
memset(&props, 0, sizeof(props));
286287
props.type = BACKLIGHT_PLATFORM;
287288
props.max_brightness = MAX_BRIGHTNESS;
288289

‎drivers/video/backlight/pm8941-wled.c‎

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@
1717
#include <linux/of_device.h>
1818
#include <linux/regmap.h>
1919

20+
/* From DT binding */
21+
#define PM8941_WLED_DEFAULT_BRIGHTNESS 2048
22+
2023
#define PM8941_WLED_REG_VAL_BASE 0x40
2124
#define PM8941_WLED_REG_VAL_MAX 0xFFF
2225

@@ -373,6 +376,7 @@ static int pm8941_wled_probe(struct platform_device *pdev)
373376
struct backlight_device *bl;
374377
struct pm8941_wled *wled;
375378
struct regmap *regmap;
379+
u32 val;
376380
int rc;
377381

378382
regmap = dev_get_regmap(pdev->dev.parent, NULL);
@@ -395,16 +399,17 @@ static int pm8941_wled_probe(struct platform_device *pdev)
395399
if (rc)
396400
return rc;
397401

402+
val = PM8941_WLED_DEFAULT_BRIGHTNESS;
403+
of_property_read_u32(pdev->dev.of_node, "default-brightness", &val);
404+
398405
memset(&props, 0, sizeof(struct backlight_properties));
399406
props.type = BACKLIGHT_RAW;
407+
props.brightness = val;
400408
props.max_brightness = PM8941_WLED_REG_VAL_MAX;
401409
bl = devm_backlight_device_register(&pdev->dev, wled->name,
402410
&pdev->dev, wled,
403411
&pm8941_wled_ops, &props);
404-
if (IS_ERR(bl))
405-
return PTR_ERR(bl);
406-
407-
return 0;
412+
return PTR_ERR_OR_ZERO(bl);
408413
};
409414

410415
static const struct of_device_id pm8941_wled_match_table[] = {

‎drivers/video/backlight/pwm_bl.c‎

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -271,19 +271,18 @@ static int pwm_backlight_probe(struct platform_device *pdev)
271271
}
272272

273273
pb->pwm = devm_pwm_get(&pdev->dev, NULL);
274-
if (IS_ERR(pb->pwm)) {
275-
ret = PTR_ERR(pb->pwm);
276-
if (ret == -EPROBE_DEFER)
277-
goto err_alloc;
278-
274+
if (IS_ERR(pb->pwm) && PTR_ERR(pb->pwm) != -EPROBE_DEFER
275+
&& !pdev->dev.of_node) {
279276
dev_err(&pdev->dev, "unable to request PWM, trying legacy API\n");
280277
pb->legacy = true;
281278
pb->pwm = pwm_request(data->pwm_id, "pwm-backlight");
282-
if (IS_ERR(pb->pwm)) {
283-
dev_err(&pdev->dev, "unable to request legacy PWM\n");
284-
ret = PTR_ERR(pb->pwm);
285-
goto err_alloc;
286-
}
279+
}
280+
281+
if (IS_ERR(pb->pwm)) {
282+
ret = PTR_ERR(pb->pwm);
283+
if (ret != -EPROBE_DEFER)
284+
dev_err(&pdev->dev, "unable to request PWM\n");
285+
goto err_alloc;
287286
}
288287

289288
dev_dbg(&pdev->dev, "got pwm for backlight\n");

0 commit comments

Comments
 (0)