From patchwork Thu Oct 26 12:49:45 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Lothar_Wa=C3=9Fmann?= X-Patchwork-Id: 10028135 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 76C2F6032C for ; Thu, 26 Oct 2017 13:10:48 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 67A5A28E0C for ; Thu, 26 Oct 2017 13:10:48 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 34F9128E22; Thu, 26 Oct 2017 13:10:48 +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 5ACA028E62 for ; Thu, 26 Oct 2017 13:10:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932320AbdJZNKm (ORCPT ); Thu, 26 Oct 2017 09:10:42 -0400 Received: from smtprelay09.ispgateway.de ([134.119.228.113]:61936 "EHLO smtprelay09.ispgateway.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932273AbdJZNKk (ORCPT ); Thu, 26 Oct 2017 09:10:40 -0400 X-Greylist: delayed 1243 seconds by postgrey-1.27 at vger.kernel.org; Thu, 26 Oct 2017 09:10:39 EDT Received: from [89.1.81.74] (helo=ipc1.ka-ro) by smtprelay09.ispgateway.de with esmtpsa (TLSv1.2:ECDHE-RSA-AES128-GCM-SHA256:128) (Exim 4.89) (envelope-from ) id 1e7hbb-0005gS-M6; Thu, 26 Oct 2017 14:49:51 +0200 Received: from lothar by ipc1.ka-ro with local (Exim 4.84_2 #2 (Debian)) id 1e7hbZ-00057S-6O; Thu, 26 Oct 2017 14:49:49 +0200 From: =?UTF-8?q?Lothar=20Wa=C3=9Fmann?= To: Bartlomiej Zolnierkiewicz , Daniel Thompson , Jacek Anaszewski , Jingoo Han , Lee Jones , Mark Rutland , Pavel Machek , Richard Purdie , Rob Herring , Thierry Reding , devicetree@vger.kernel.org, linux-fbdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-leds@vger.kernel.org, linux-pwm@vger.kernel.org Cc: =?UTF-8?q?Lothar=20Wa=C3=9Fmann?= Subject: [PATCH 1/2] backlight: pwm_bl: Enable PWM before switching regulator on Date: Thu, 26 Oct 2017 14:49:45 +0200 Message-Id: <1509022186-19636-3-git-send-email-LW@KARO-electronics.de> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1509022186-19636-1-git-send-email-LW@KARO-electronics.de> References: <1509022186-19636-1-git-send-email-LW@KARO-electronics.de> MIME-Version: 1.0 X-Df-Sender: bHdAa2Fyby1lbGVjdHJvbmljcy5kZQ== 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 When the PWM is re-enabled after being switched off, the backlight may flicker due to the backlight power being switched on while the PWM is still unconfigured. This is especially true if the PWM output is active low (assuming that the PWM output is low when the PWM is not enabled). Configure the PWM before switching backlight power on to prevent this. Signed-off-by: Lothar Waßmann --- 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 002f1ce..921f322 100644 --- a/drivers/video/backlight/pwm_bl.c +++ b/drivers/video/backlight/pwm_bl.c @@ -50,6 +50,8 @@ static void pwm_backlight_power_on(struct pwm_bl_data *pb, int brightness) if (pb->enabled) return; + pwm_enable(pb->pwm); + err = regulator_enable(pb->power_supply); if (err < 0) dev_err(pb->dev, "failed to enable power supply\n"); @@ -57,7 +59,6 @@ static void pwm_backlight_power_on(struct pwm_bl_data *pb, int brightness) if (pb->enable_gpio) gpiod_set_value_cansleep(pb->enable_gpio, 1); - pwm_enable(pb->pwm); pb->enabled = true; }