]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/commitdiff
drivers/video/backlight/tps65217_bl.c add default brightness value option
authorMatus Ujhelyi <ujhelyi.m@gmail.com>
Mon, 29 Apr 2013 23:18:08 +0000 (16:18 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Tue, 30 Apr 2013 01:28:19 +0000 (18:28 -0700)
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>
Documentation/devicetree/bindings/video/backlight/tps65217-backlight.txt
drivers/video/backlight/tps65217_bl.c
include/linux/mfd/tps65217.h

index 76485247b35d46af1fb5ee875095d9f43dc3a7ec..5fb9279ac2874885456187c5e9504da095c2a82c 100644 (file)
@@ -9,6 +9,7 @@ Required properties:
 - backlight: node for specifying WLED1 and WLED2 lines in TPS65217
 - isel: selection bit, valid values: 1 for ISEL1 (low-level) and 2 for ISEL2 (high-level)
 - fdim: PWM dimming frequency, valid values: 100, 200, 500, 1000
+- default-brightness: valid values: 0-100
 
 Each regulator is defined using the standard binding for regulators.
 
@@ -20,5 +21,7 @@ Example:
                backlight {
                        isel = <1>;  /* 1 - ISET1, 2 ISET2 */
                        fdim = <100>; /* TPS65217_BL_FDIM_100HZ */
+                       default-brightness = <50>;
                };
        };
+
index 70881633b45afff2592a69347272892f33cf2d6c..05782312aeb34dbadeca7545ba24c52edcb02f5c 100644 (file)
@@ -245,6 +245,18 @@ tps65217_bl_parse_dt(struct platform_device *pdev)
                }
        }
 
+       if (!of_property_read_u32(node, "default-brightness", &val)) {
+               if (val < 0 ||
+                       val > 100) {
+                       dev_err(&pdev->dev,
+                               "invalid 'default-brightness' value in the device tree\n");
+                       err = ERR_PTR(-EINVAL);
+                       goto err;
+               }
+
+               pdata->dft_brightness = val;
+       }
+
        of_node_put(node);
 
        return pdata;
@@ -311,7 +323,8 @@ static int tps65217_bl_probe(struct platform_device *pdev)
                return PTR_ERR(tps65217_bl->bl);
        }
 
-       tps65217_bl->bl->props.brightness = 0;
+       tps65217_bl->bl->props.brightness = pdata->dft_brightness;
+       backlight_update_status(tps65217_bl->bl);
        platform_set_drvdata(pdev, tps65217_bl);
 
        return 0;
index 290762f939304706ebdd27c6181e0fa34afd365c..29eab2bd3dfab4ccaddbf687e99b1225f13ba4dd 100644 (file)
@@ -228,6 +228,7 @@ enum tps65217_bl_fdim {
 struct tps65217_bl_pdata {
        enum tps65217_bl_isel isel;
        enum tps65217_bl_fdim fdim;
+       int dft_brightness;
 };
 
 /**