From patchwork Mon Sep 23 21:41:07 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thierry Reding X-Patchwork-Id: 2930231 Return-Path: X-Original-To: patchwork-linux-omap@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 369BF9F2B8 for ; Mon, 23 Sep 2013 21:43:32 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 622012038B for ; Mon, 23 Sep 2013 21:43:31 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 5CAA52037D for ; Mon, 23 Sep 2013 21:43:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754484Ab3IWVnN (ORCPT ); Mon, 23 Sep 2013 17:43:13 -0400 Received: from mail-bk0-f54.google.com ([209.85.214.54]:50947 "EHLO mail-bk0-f54.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754442Ab3IWVmx (ORCPT ); Mon, 23 Sep 2013 17:42:53 -0400 Received: by mail-bk0-f54.google.com with SMTP id mz12so1417000bkb.13 for ; Mon, 23 Sep 2013 14:42:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=dhUSSpAX4ovplMP6k3wz6XEebfTZD1bFNJdHpnI2K14=; b=Vk9wkfs52dT1Hm71id32/zBS+g8ZRT8NQhRGr9mg2vskFArv+lrzu70DdBmgtQEFRg q1iSXMhViAh/NHhXvWcu3orA37DvX6Y1E612DN9TVhrb+VOvATyDtkzbIQcFGpGDX3Hg EWCG2Xe23HPDWRmKmv5y/Ahfyax4pvyZ47+caGIyqiI0AgdK6vHekxZFQveRVfjFtSex TWMLqb6DxNXp5kc9fRPR2Qee/DWO3Cs3w/xCGH88XeEfwwIuYj6DXEERHvdapshXmJ4O 9/pgQHnvfagy8fD12u199OTBzELSuEFCkJHRjQCkpbfl4olKjnGutV04cJkcwWfgRFJI TmXw== X-Received: by 10.204.63.7 with SMTP id z7mr19432960bkh.23.1379972571178; Mon, 23 Sep 2013 14:42:51 -0700 (PDT) Received: from localhost (port-13639.pppoe.wtnet.de. [84.46.53.124]) by mx.google.com with ESMTPSA id zl3sm9650157bkb.4.1969.12.31.16.00.00 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Mon, 23 Sep 2013 14:42:50 -0700 (PDT) From: Thierry Reding To: Thierry Reding Cc: Rob Herring , Pawel Moll , Mark Rutland , Stephen Warren , Ian Campbell , Tony Lindgren , Eric Miao , Haojian Zhuang , Ben Dooks , Kukjin Kim , Simon Horman , Magnus Damm , Guan Xuetao , devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-omap@vger.kernel.org, openezx-devel@lists.openezx.org, linux-samsung-soc@vger.kernel.org, linux-sh@vger.kernel.org, linux-pwm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 10/10] pwm-backlight: Allow backlight to remain disabled on boot Date: Mon, 23 Sep 2013 23:41:07 +0200 Message-Id: <1379972467-11243-11-git-send-email-treding@nvidia.com> X-Mailer: git-send-email 1.8.4 In-Reply-To: <1379972467-11243-1-git-send-email-treding@nvidia.com> References: <1379972467-11243-1-git-send-email-treding@nvidia.com> Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org X-Spam-Status: No, score=-5.7 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, KHOP_BIG_TO_CC, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=unavailable 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 The default for backlight devices is to be enabled immediately when registering with the backlight core. This can be useful for setups that use a simple framebuffer device and where the backlight cannot otherwise be hooked up to the panel. However, when dealing with more complex setups, such as those of recent ARM SoCs, this can be problematic. Since the backlight is usually setup separately from the display controller, the probe order is not usually deterministic. That can lead to situations where the backlight will be powered up and the panel will show an uninitialized framebuffer. Furthermore, subsystems such as DRM have advanced functionality to set the power mode of a panel. In order to allow such setups to power up the panel at exactly the right moment, a way is needed to prevent the backlight core from powering the backlight up automatically when it is registered. This commit introduces a new boot_off field in the platform data (and also implements getting the same information from device tree). When set the initial backlight power mode will be set to "off". Signed-off-by: Thierry Reding --- Note: Perhaps it would be more useful to make this the default behaviour in the backlight core? Many other subsystems and frameworks assume that a resource is off unless explicitly enabled. --- .../devicetree/bindings/video/backlight/pwm-backlight.txt | 1 + drivers/video/backlight/pwm_bl.c | 8 ++++++++ include/linux/pwm_backlight.h | 2 ++ 3 files changed, 11 insertions(+) diff --git a/Documentation/devicetree/bindings/video/backlight/pwm-backlight.txt b/Documentation/devicetree/bindings/video/backlight/pwm-backlight.txt index 3898f26..1271886 100644 --- a/Documentation/devicetree/bindings/video/backlight/pwm-backlight.txt +++ b/Documentation/devicetree/bindings/video/backlight/pwm-backlight.txt @@ -16,6 +16,7 @@ Optional properties: "pwms" property (see PWM binding[0]) - enable-gpios: a list of GPIOs to enable and disable the backlight - power-supply: regulator for supply voltage + - backlight-boot-off: keep the backlight disabled on boot [0]: Documentation/devicetree/bindings/pwm/pwm.txt diff --git a/drivers/video/backlight/pwm_bl.c b/drivers/video/backlight/pwm_bl.c index a2b3876..3b2d9cf 100644 --- a/drivers/video/backlight/pwm_bl.c +++ b/drivers/video/backlight/pwm_bl.c @@ -184,6 +184,8 @@ static int pwm_backlight_parse_dt(struct device *dev, if (gpio_is_valid(data->enable_gpio) && (flags & OF_GPIO_ACTIVE_LOW)) data->enable_gpio_flags |= PWM_BACKLIGHT_GPIO_ACTIVE_LOW; + data->boot_off = of_property_read_bool(node, "backlight-boot-off"); + return 0; } @@ -318,6 +320,12 @@ static int pwm_backlight_probe(struct platform_device *pdev) } bl->props.brightness = data->dft_brightness; + + if (data->boot_off) + bl->props.power = FB_BLANK_POWERDOWN; + else + bl->props.power = FB_BLANK_UNBLANK; + backlight_update_status(bl); platform_set_drvdata(pdev, bl); diff --git a/include/linux/pwm_backlight.h b/include/linux/pwm_backlight.h index 2de2e27..ea4a239 100644 --- a/include/linux/pwm_backlight.h +++ b/include/linux/pwm_backlight.h @@ -18,6 +18,8 @@ struct platform_pwm_backlight_data { unsigned int *levels; int enable_gpio; unsigned long enable_gpio_flags; + bool boot_off; + int (*init)(struct device *dev); int (*notify)(struct device *dev, int brightness); void (*notify_after)(struct device *dev, int brightness);