diff options
author | Bjorn Andersson <bjorn.andersson@sonymobile.com> | 2015-10-26 10:45:08 -0700 |
---|---|---|
committer | Lee Jones <lee.jones@linaro.org> | 2015-10-30 18:47:51 +0000 |
commit | 9d6c243502b7f0a9696bc6fe5b473e40d8478d28 (patch) | |
tree | 1f720d8ef52e0162b79cbb3627a4e959fbb0aa9b /drivers/video | |
parent | fc18111b8973e2c7cc0c2ba6183795e5266ddff7 (diff) | |
download | op-kernel-dev-9d6c243502b7f0a9696bc6fe5b473e40d8478d28.zip op-kernel-dev-9d6c243502b7f0a9696bc6fe5b473e40d8478d28.tar.gz |
backlight: pm8941-wled: Add default-brightness property
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>
Diffstat (limited to 'drivers/video')
-rw-r--r-- | drivers/video/backlight/pm8941-wled.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/drivers/video/backlight/pm8941-wled.c b/drivers/video/backlight/pm8941-wled.c index 78bba87..0b6d219 100644 --- a/drivers/video/backlight/pm8941-wled.c +++ b/drivers/video/backlight/pm8941-wled.c @@ -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, |