From patchwork Fri Mar 22 16:17:22 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 160947 Delivered-To: patch@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp994172jan; Fri, 22 Mar 2019 09:18:30 -0700 (PDT) X-Google-Smtp-Source: APXvYqwxvZpR5YvQJMTx6rpQEmUqsjY+5Z9t/2cFFnxDBtEvic37BWbInSGH/0KJ7wL0EVNEHSMM X-Received: by 2002:a17:902:7e4b:: with SMTP id a11mr10334022pln.219.1553271510774; Fri, 22 Mar 2019 09:18:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553271510; cv=none; d=google.com; s=arc-20160816; b=rlIeZgDDJB3Q+kqWAxwvdUuERYq5TNNYMzJD209yJC6bIOEsz523yqdqANDObXpv8C XqOcMHRl0Exm8WllsEc6JDRSWpuZalduwOUwE1uBYcGR39nhS1lpWYEcxQQ+xipR9ZJW RLNfw5DUmJhydysfowHRY00LBQy3gkjfflSsR6h+Jpxe95wklEWLuisXnuwVE+GCEOqS XwO4U7tt50/fGZq/SU8aY5oTIaww6hYlk1JQsIoC5671j+Kl3O3BR5oFG4u6Dvl6R1Gx UZ1NjidKaY89WzMWpOzKmDCuZW3HF1xXyADCf7QGHtxMPpdec/ExRf698303fip49OAn MNTA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=OVeBF92GegLSrVjq+t17lnOS7C3sIC3BiDQspHPLSy0=; b=tbNI2/sqHfj3G56G7q5GFb2tB2p/UnZaTHy6+kOeBgUBXQSN++IcMkbBt+FejUmzV8 NWc0woaxeXabZ81sid2zw+vAephhTDs2MboJJPGr+tkTZPTus3sP0cBde8pFSj3/VAzS cbmMxhgMDVzMmqInw2B2JbipRbeKKjtLF7yYxZxWp8LjX5TPcsxC5ugWGCr7MSvn+Htr QYGW38M7Os+HGauEsvn829+m5IWDEPZY2k++T02TxPP4zHzpqdI+/cjOIL5aE/c1V7wg FgDojZWe152q/lCi4h4GpsJlQOnc419K72j1bYgiPYfxr6H3P7u7QG8GIdb24OK/L0Lb DylA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k25si6794115pfo.254.2019.03.22.09.18.30; Fri, 22 Mar 2019 09:18:30 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729655AbfCVQS2 (ORCPT + 31 others); Fri, 22 Mar 2019 12:18:28 -0400 Received: from mout.kundenserver.de ([212.227.17.13]:50421 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728506AbfCVQST (ORCPT ); Fri, 22 Mar 2019 12:18:19 -0400 Received: from wuerfel.lan ([149.172.19.189]) by mrelayeu.kundenserver.de (mreue108 [212.227.15.145]) with ESMTPA (Nemesis) id 1McGxG-1gZP252F1Y-00celC; Fri, 22 Mar 2019 17:18:09 +0100 From: Arnd Bergmann To: stable@vger.kernel.org, Thierry Reding , Lee Jones , Daniel Thompson , Jingoo Han , Bartlomiej Zolnierkiewicz Cc: Enric Balletbo i Serra , Arnd Bergmann , Wolfram Sang , linux-pwm@vger.kernel.org, linux-fbdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [BACKPORT 4.14.y 7/8] pwm-backlight: Enable/disable the PWM before/after LCD enable toggle. Date: Fri, 22 Mar 2019 17:17:22 +0100 Message-Id: <20190322161727.1153278-8-arnd@arndb.de> X-Mailer: git-send-email 2.20.0 In-Reply-To: <20190322161727.1153278-1-arnd@arndb.de> References: <20190322161727.1153278-1-arnd@arndb.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:98ZaXMT7Sqw9y1pDFUAjfR/TmDFSO4/c2yDoQqHy9p35Lv3HvzJ zciPwkDzqGxDKzw+WyOpVoyffMWXaocOntl7TtlIJdUdjLDZnGzBhBEQEf6Lcgax7rfjMbP JadONNGfZ5QYDpBv0C1un4TuFE4fNdhbI6D0fOhl9WT7Zv6H5O/2PwWOG2Xxf4JKv4YOpTw wRJEyGTPF0eJPlJ7PkILA== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1; V03:K0:lnfPOrnU93g=:E+yyWykToN2NNLGa8WibcA uFG5Nt4M9GyDb6fN4XzH3ZLvT65SN/4quOBwwQevFkiLbG5A4WlwB1O50Y2cvj5lbKqbmscZS 9LFfGY+rHuIr5ydKLThpH8eEklNBZyRWZjVY+wAjdtgbmJPbxS8uj3ooh2OZ2thwGvBhTS5Jb XFOoKGJ/8a25He5M9saGFK3iJfMpJsaQphb4obnGKxq6e623h7vO/Z3Gu3A4qpULAFl2YUYu+ bIi8VM0xMiUVgb7oZRnRvjgIOysy7yMp0Aro5wd3f+PGiSbzUXSaDk2EGxXp2sJFcMIVrRoX0 8csmoSFviYm0r2OMsFCZ6KFcru6s+zZ+cG0uDsLGf0nJvdDLduhEgDICbPM9caENgOl9hQYQs 6iREkPu6gznxJNeh2JmzT3rnVx7ZcPwhqRHI9HscXWH1Re14eNZ5ELG60jhcK5vPueVg31y3J rQFkRwl09XG1+ZZ575e7Qe9uf1blU2tiBOpgEOU4Yp2fMlixphAAcPQZtLdFymG3s7MZDZmvf VsLnK5qMT5FLLbPReDVbCuK7jWtWjWh83mawfe7+B1qJWtw9K7z1CGh+Mj8foYTCS8JkX5aTS aYJoat0Cs/L2hzL08kbCu4x3iiJqgaVtjYmuUIahPbciYsmtLnknUd6Uz+WBLDMNOVm+/UOVR UxvOWvLbTKTFP3VLuT4g0jSPcgWBM4wo5vPBv16eWR7ECDybaofPYNok+1uc1+hCX4fFFdFNB 3YyDKBHSJ24vamhc3MXW7OSz3WfnjCBXHky+aQ== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Enric Balletbo i Serra Before this patch the enable signal was set before the PWM signal and vice-versa on power off. This sequence is wrong, at least, it is on the different panels datasheets that I checked, so I inverted the sequence to follow the specs. For reference the following panels have the mentioned sequence: - N133HSE-EA1 (Innolux) - N116BGE (Innolux) - N156BGE-L21 (Innolux) - B101EAN0 (Auo) - B101AW03 (Auo) - LTN101NT05 (Samsung) - CLAA101WA01A (Chunghwa) Signed-off-by: Enric Balletbo i Serra Acked-by: Daniel Thompson Acked-by: Jingoo Han Acked-by: Thierry Reding Signed-off-by: Lee Jones (cherry picked from commit 5fb5caee92ba35a4a3baa61d45a78eb057e2c031) Signed-off-by: Arnd Bergmann --- drivers/video/backlight/pwm_bl.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) -- 2.20.0 diff --git a/drivers/video/backlight/pwm_bl.c b/drivers/video/backlight/pwm_bl.c index 0fa7d2bd0e48..155153ecb894 100644 --- a/drivers/video/backlight/pwm_bl.c +++ b/drivers/video/backlight/pwm_bl.c @@ -54,10 +54,11 @@ static void pwm_backlight_power_on(struct pwm_bl_data *pb, int brightness) if (err < 0) dev_err(pb->dev, "failed to enable power supply\n"); + pwm_enable(pb->pwm); + if (pb->enable_gpio) gpiod_set_value_cansleep(pb->enable_gpio, 1); - pwm_enable(pb->pwm); pb->enabled = true; } @@ -66,12 +67,12 @@ static void pwm_backlight_power_off(struct pwm_bl_data *pb) if (!pb->enabled) return; - pwm_config(pb->pwm, 0, pb->period); - pwm_disable(pb->pwm); - if (pb->enable_gpio) gpiod_set_value_cansleep(pb->enable_gpio, 0); + pwm_config(pb->pwm, 0, pb->period); + pwm_disable(pb->pwm); + regulator_disable(pb->power_supply); pb->enabled = false; }