Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Matus Ujhelyi and committed by
Linus Torvalds
4d22f8c3 17e45db6

+18 -1
+3
Documentation/devicetree/bindings/video/backlight/tps65217-backlight.txt
··· 9 9 - backlight: node for specifying WLED1 and WLED2 lines in TPS65217 10 10 - isel: selection bit, valid values: 1 for ISEL1 (low-level) and 2 for ISEL2 (high-level) 11 11 - fdim: PWM dimming frequency, valid values: 100, 200, 500, 1000 12 + - default-brightness: valid values: 0-100 12 13 13 14 Each regulator is defined using the standard binding for regulators. 14 15 ··· 21 20 backlight { 22 21 isel = <1>; /* 1 - ISET1, 2 ISET2 */ 23 22 fdim = <100>; /* TPS65217_BL_FDIM_100HZ */ 23 + default-brightness = <50>; 24 24 }; 25 25 }; 26 +
+14 -1
drivers/video/backlight/tps65217_bl.c
··· 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 260 of_node_put(node); 249 261 250 262 return pdata; ··· 323 311 return PTR_ERR(tps65217_bl->bl); 324 312 } 325 313 326 - tps65217_bl->bl->props.brightness = 0; 314 + tps65217_bl->bl->props.brightness = pdata->dft_brightness; 315 + backlight_update_status(tps65217_bl->bl); 327 316 platform_set_drvdata(pdev, tps65217_bl); 328 317 329 318 return 0;
+1
include/linux/mfd/tps65217.h
··· 228 228 struct tps65217_bl_pdata { 229 229 enum tps65217_bl_isel isel; 230 230 enum tps65217_bl_fdim fdim; 231 + int dft_brightness; 231 232 }; 232 233 233 234 /**