]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
backlight: pm8941-wled: Add default-brightness property
authorBjorn Andersson <bjorn.andersson@sonymobile.com>
Mon, 26 Oct 2015 17:45:08 +0000 (10:45 -0700)
committerLee Jones <lee.jones@linaro.org>
Fri, 30 Oct 2015 18:47:51 +0000 (18:47 +0000)
Default the brightness to 2048 and add possibility to override this in
device tree.

Suggested-by: Rob Clark <robdclark@gmail.com>
Signed-off-by: Bjorn Andersson <bjorn.andersson@sonymobile.com>
Acked-by: Rob Herring <robh@kernel.org>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
Documentation/devicetree/bindings/video/backlight/pm8941-wled.txt
drivers/video/backlight/pm8941-wled.c

index 424f8444a6cd9364aba9267be34e66a6657aa786..e5b294dafc5837f9d580531ad1471bdd9ad3f55d 100644 (file)
@@ -5,6 +5,8 @@ Required properties:
 - reg: slave address
 
 Optional properties:
+- default-brightness: brightness value on boot, value from: 0-4095
+       default: 2048
 - label: The name of the backlight device
 - qcom,cs-out: bool; enable current sink output
 - qcom,cabc: bool; enable content adaptive backlight control
index 78bba87551b2547a92b7aeea75fca8490c51be6d..0b6d21955d91ae875b870664c651e12e08a5ef9f 100644 (file)
@@ -17,6 +17,9 @@
 #include <linux/of_device.h>
 #include <linux/regmap.h>
 
+/* From DT binding */
+#define PM8941_WLED_DEFAULT_BRIGHTNESS         2048
+
 #define PM8941_WLED_REG_VAL_BASE               0x40
 #define  PM8941_WLED_REG_VAL_MAX               0xFFF
 
@@ -373,6 +376,7 @@ static int pm8941_wled_probe(struct platform_device *pdev)
        struct backlight_device *bl;
        struct pm8941_wled *wled;
        struct regmap *regmap;
+       u32 val;
        int rc;
 
        regmap = dev_get_regmap(pdev->dev.parent, NULL);
@@ -395,8 +399,12 @@ static int pm8941_wled_probe(struct platform_device *pdev)
        if (rc)
                return rc;
 
+       val = PM8941_WLED_DEFAULT_BRIGHTNESS;
+       of_property_read_u32(pdev->dev.of_node, "default-brightness", &val);
+
        memset(&props, 0, sizeof(struct backlight_properties));
        props.type = BACKLIGHT_RAW;
+       props.brightness = val;
        props.max_brightness = PM8941_WLED_REG_VAL_MAX;
        bl = devm_backlight_device_register(&pdev->dev, wled->name,
                                            &pdev->dev, wled,