diff options
author | Matus Ujhelyi <ujhelyi.m@gmail.com> | 2013-04-29 19:18:08 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2013-04-29 21:28:19 -0400 |
commit | 4d22f8c306233433bdf9298b2e7806e9c71674bc (patch) | |
tree | 49b3a37f0cb85d98936d4e02b66e85f27f50c158 | |
parent | 17e45db62a4683a7318294d652895dfad575da41 (diff) |
drivers/video/backlight/tps65217_bl.c add default brightness value option
Signed-off-by: Matus Ujhelyi <matus.ujhelyi@streamunlimited.com>
Cc: Grant Likely <grant.likely@secretlab.ca>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r-- | Documentation/devicetree/bindings/video/backlight/tps65217-backlight.txt | 3 | ||||
-rw-r--r-- | drivers/video/backlight/tps65217_bl.c | 15 | ||||
-rw-r--r-- | include/linux/mfd/tps65217.h | 1 |
3 files changed, 18 insertions, 1 deletions
diff --git a/Documentation/devicetree/bindings/video/backlight/tps65217-backlight.txt b/Documentation/devicetree/bindings/video/backlight/tps65217-backlight.txt index 76485247b35d..5fb9279ac287 100644 --- a/Documentation/devicetree/bindings/video/backlight/tps65217-backlight.txt +++ b/Documentation/devicetree/bindings/video/backlight/tps65217-backlight.txt | |||
@@ -9,6 +9,7 @@ Required properties: | |||
9 | - backlight: node for specifying WLED1 and WLED2 lines in TPS65217 | 9 | - backlight: node for specifying WLED1 and WLED2 lines in TPS65217 |
10 | - isel: selection bit, valid values: 1 for ISEL1 (low-level) and 2 for ISEL2 (high-level) | 10 | - isel: selection bit, valid values: 1 for ISEL1 (low-level) and 2 for ISEL2 (high-level) |
11 | - fdim: PWM dimming frequency, valid values: 100, 200, 500, 1000 | 11 | - fdim: PWM dimming frequency, valid values: 100, 200, 500, 1000 |
12 | - default-brightness: valid values: 0-100 | ||
12 | 13 | ||
13 | Each regulator is defined using the standard binding for regulators. | 14 | Each regulator is defined using the standard binding for regulators. |
14 | 15 | ||
@@ -20,5 +21,7 @@ Example: | |||
20 | backlight { | 21 | backlight { |
21 | isel = <1>; /* 1 - ISET1, 2 ISET2 */ | 22 | isel = <1>; /* 1 - ISET1, 2 ISET2 */ |
22 | fdim = <100>; /* TPS65217_BL_FDIM_100HZ */ | 23 | fdim = <100>; /* TPS65217_BL_FDIM_100HZ */ |
24 | default-brightness = <50>; | ||
23 | }; | 25 | }; |
24 | }; | 26 | }; |
27 | |||
diff --git a/drivers/video/backlight/tps65217_bl.c b/drivers/video/backlight/tps65217_bl.c index 70881633b45a..05782312aeb3 100644 --- a/drivers/video/backlight/tps65217_bl.c +++ b/drivers/video/backlight/tps65217_bl.c | |||
@@ -245,6 +245,18 @@ tps65217_bl_parse_dt(struct platform_device *pdev) | |||
245 | } | 245 | } |
246 | } | 246 | } |
247 | 247 | ||
248 | if (!of_property_read_u32(node, "default-brightness", &val)) { | ||
249 | if (val < 0 || | ||
250 | val > 100) { | ||
251 | dev_err(&pdev->dev, | ||
252 | "invalid 'default-brightness' value in the device tree\n"); | ||
253 | err = ERR_PTR(-EINVAL); | ||
254 | goto err; | ||
255 | } | ||
256 | |||
257 | pdata->dft_brightness = val; | ||
258 | } | ||
259 | |||
248 | of_node_put(node); | 260 | of_node_put(node); |
249 | 261 | ||
250 | return pdata; | 262 | return pdata; |
@@ -311,7 +323,8 @@ static int tps65217_bl_probe(struct platform_device *pdev) | |||
311 | return PTR_ERR(tps65217_bl->bl); | 323 | return PTR_ERR(tps65217_bl->bl); |
312 | } | 324 | } |
313 | 325 | ||
314 | tps65217_bl->bl->props.brightness = 0; | 326 | tps65217_bl->bl->props.brightness = pdata->dft_brightness; |
327 | backlight_update_status(tps65217_bl->bl); | ||
315 | platform_set_drvdata(pdev, tps65217_bl); | 328 | platform_set_drvdata(pdev, tps65217_bl); |
316 | 329 | ||
317 | return 0; | 330 | return 0; |
diff --git a/include/linux/mfd/tps65217.h b/include/linux/mfd/tps65217.h index 290762f93930..29eab2bd3dfa 100644 --- a/include/linux/mfd/tps65217.h +++ b/include/linux/mfd/tps65217.h | |||
@@ -228,6 +228,7 @@ enum tps65217_bl_fdim { | |||
228 | struct tps65217_bl_pdata { | 228 | struct tps65217_bl_pdata { |
229 | enum tps65217_bl_isel isel; | 229 | enum tps65217_bl_isel isel; |
230 | enum tps65217_bl_fdim fdim; | 230 | enum tps65217_bl_fdim fdim; |
231 | int dft_brightness; | ||
231 | }; | 232 | }; |
232 | 233 | ||
233 | /** | 234 | /** |