Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932786AbbHJUOA (ORCPT ); Mon, 10 Aug 2015 16:14:00 -0400 Received: from seldrel01.sonyericsson.com ([37.139.156.2]:1226 "EHLO seldrel01.sonyericsson.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754569AbbHJUN5 (ORCPT ); Mon, 10 Aug 2015 16:13:57 -0400 From: Bjorn Andersson To: Rob Herring , Pawel Moll , Mark Rutland , Ian Campbell , Jingoo Han , Lee Jones , Jean-Christophe Plagniol-Villard , Tomi Valkeinen CC: Rob Clark , , , , Subject: [PATCH v2] backlight: pm8941-wled: Add default-brightness property Date: Mon, 10 Aug 2015 13:13:51 -0700 Message-ID: <1439237631-11243-1-git-send-email-bjorn.andersson@sonymobile.com> X-Mailer: git-send-email 1.8.2.2 MIME-Version: 1.0 Content-Type: text/plain Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2811 Lines: 73 Default the brightness to 2048 and add possibility to override this in device tree. Suggested-by: Rob Clark Signed-off-by: Bjorn Andersson --- After going back and forth on this one I decided that the best unit of this property (which could become a common backlight property) would be to use "units of brightness". The value will either come from the boot loader picking a value in some way or from a user finding a good value by tweaking sysfs - both which will be in "units of brightness". Documentation/devicetree/bindings/video/backlight/pm8941-wled.txt | 2 ++ drivers/video/backlight/pm8941-wled.c | 8 ++++++++ 2 files changed, 10 insertions(+) diff --git a/Documentation/devicetree/bindings/video/backlight/pm8941-wled.txt b/Documentation/devicetree/bindings/video/backlight/pm8941-wled.txt index 424f8444a6cd..e5b294dafc58 100644 --- a/Documentation/devicetree/bindings/video/backlight/pm8941-wled.txt +++ b/Documentation/devicetree/bindings/video/backlight/pm8941-wled.txt @@ -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 diff --git a/drivers/video/backlight/pm8941-wled.c b/drivers/video/backlight/pm8941-wled.c index c704c3236034..e1298147bcbb 100644 --- a/drivers/video/backlight/pm8941-wled.c +++ b/drivers/video/backlight/pm8941-wled.c @@ -17,6 +17,9 @@ #include #include +/* 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, -- 1.8.2.2 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/