From patchwork Thu Jul 23 19:52:07 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bjorn Andersson X-Patchwork-Id: 6855901 Return-Path: X-Original-To: patchwork-linux-fbdev@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id B88C99F38B for ; Thu, 23 Jul 2015 19:52:30 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id DBD1920532 for ; Thu, 23 Jul 2015 19:52:29 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id E839620460 for ; Thu, 23 Jul 2015 19:52:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753850AbbGWTwP (ORCPT ); Thu, 23 Jul 2015 15:52:15 -0400 Received: from seldrel01.sonyericsson.com ([37.139.156.2]:15119 "EHLO seldrel01.sonyericsson.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753742AbbGWTwO (ORCPT ); Thu, 23 Jul 2015 15:52:14 -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] backlight: pm8941-wled: Add default-brightness property Date: Thu, 23 Jul 2015 12:52:07 -0700 Message-ID: <1437681127-15760-1-git-send-email-bjorn.andersson@sonymobile.com> X-Mailer: git-send-email 1.8.2.2 MIME-Version: 1.0 Sender: linux-fbdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fbdev@vger.kernel.org X-Spam-Status: No, score=-8.1 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Add the possibility of specifying the default brightness in DT. Signed-off-by: Bjorn Andersson --- This depends on the patch moving pm8941-wled to backlight [1]. The dt property is used by several other backlight drivers, so I considered this to be a "common" property and it's hence not prefixed with "qcom,". [1] https://lkml.org/lkml/2015/7/21/906 Documentation/devicetree/bindings/video/backlight/pm8941-wled.txt | 1 + drivers/video/backlight/pm8941-wled.c | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/Documentation/devicetree/bindings/video/backlight/pm8941-wled.txt b/Documentation/devicetree/bindings/video/backlight/pm8941-wled.txt index 424f8444a6cd..37503f8c3620 100644 --- a/Documentation/devicetree/bindings/video/backlight/pm8941-wled.txt +++ b/Documentation/devicetree/bindings/video/backlight/pm8941-wled.txt @@ -5,6 +5,7 @@ Required properties: - reg: slave address Optional properties: +- default-brightness: value from: 0-4095 - 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..b875e58df0fc 100644 --- a/drivers/video/backlight/pm8941-wled.c +++ b/drivers/video/backlight/pm8941-wled.c @@ -373,6 +373,7 @@ static int pm8941_wled_probe(struct platform_device *pdev) struct backlight_device *bl; struct pm8941_wled *wled; struct regmap *regmap; + u32 val = 0; int rc; regmap = dev_get_regmap(pdev->dev.parent, NULL); @@ -395,8 +396,11 @@ static int pm8941_wled_probe(struct platform_device *pdev) if (rc) return rc; + 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,