From patchwork Sun Apr 16 10:35:46 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Kocialkowski X-Patchwork-Id: 9682677 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id DFD1F60138 for ; Sun, 16 Apr 2017 10:45:34 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CF1C12807E for ; Sun, 16 Apr 2017 10:45:34 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C26CD28236; Sun, 16 Apr 2017 10:45:34 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E9F522807E for ; Sun, 16 Apr 2017 10:45:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755204AbdDPKpa (ORCPT ); Sun, 16 Apr 2017 06:45:30 -0400 Received: from gagarine.paulk.fr ([109.190.93.129]:57497 "EHLO gagarine.paulk.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754304AbdDPKp2 (ORCPT ); Sun, 16 Apr 2017 06:45:28 -0400 X-Greylist: delayed 550 seconds by postgrey-1.27 at vger.kernel.org; Sun, 16 Apr 2017 06:45:27 EDT Received: by gagarine.paulk.fr (Postfix, from userid 65534) id D7C8820FEF; Sun, 16 Apr 2017 12:36:15 +0200 (CEST) Received: from localhost.localdomain (collins [192.168.1.129]) by gagarine.paulk.fr (Postfix) with ESMTP id D6623200D1; Sun, 16 Apr 2017 12:36:11 +0200 (CEST) From: Paul Kocialkowski To: linux-kernel@vger.kernel.org Cc: Thierry Reding , Lee Jones , Daniel Thompson , Jingoo Han , Bartlomiej Zolnierkiewicz , linux-pwm@vger.kernel.org, linux-fbdev@vger.kernel.org, linux-tegra@vger.kernel.org, Paul Kocialkowski Subject: [PATCH] backlight: pwm_bl: Fix condition to set enable gpio as output Date: Sun, 16 Apr 2017 12:35:46 +0200 Message-Id: <20170416103546.3021-1-contact@paulk.fr> X-Mailer: git-send-email 2.12.2 Sender: linux-fbdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fbdev@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The move to a dedicated pwm_backlight_initial_power_state function in commit 7613c922315e308a6486d802abed2eb74443dffd modified the condition to set the enable gpio as output. This breaks specific use cases using that GPIO, such as tegra124-based nyan Chromebooks where backlight stopped working. This puts the condition back to the way it was before the move. Signed-off-by: Paul Kocialkowski --- drivers/video/backlight/pwm_bl.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/video/backlight/pwm_bl.c b/drivers/video/backlight/pwm_bl.c index d7efcb632f7d..e81b2b55be2b 100644 --- a/drivers/video/backlight/pwm_bl.c +++ b/drivers/video/backlight/pwm_bl.c @@ -304,7 +304,8 @@ static int pwm_backlight_probe(struct platform_device *pdev) * early. Leave the decision of the initial backlight state for later. */ if (pb->enable_gpio && - gpiod_get_direction(pb->enable_gpio) == GPIOF_DIR_IN) + (gpiod_get_direction(pb->enable_gpio) == GPIOF_DIR_IN || + gpiod_get_value(pb->enable_gpio) != 0)) gpiod_direction_output(pb->enable_gpio, 1); pb->power_supply = devm_regulator_get(&pdev->dev, "power");