Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp9106903pxu; Mon, 28 Dec 2020 06:49:09 -0800 (PST) X-Google-Smtp-Source: ABdhPJx4xzhR8BE/e3fBrQud/iGQ8wDyas++f2esqAv3tvxOsYHEzLtKNuyWJWsc0ZHNjj93gtHn X-Received: by 2002:a17:906:4bc5:: with SMTP id x5mr41954899ejv.55.1609166948908; Mon, 28 Dec 2020 06:49:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1609166948; cv=none; d=google.com; s=arc-20160816; b=rVBMXSqTV79UIMuKa3TxerC0poYOjM70KS56zoMqkQLd5hA63VNUvOsjj5wol6M6l+ TwqeKl8EkOFgJwQ/fUJP0OsfyL7ftHnw4fAzaYHnKEr7vcVMr63OM3XuCow2ENBLtRcZ wTdjpCGCDioCFm1Kh1SAMEIkzyvcttpjk163C+PRP67YEAnrtpVtxqqaLI6FVMJO72me QNFMk/aDQkCvEGh/S2mQL0K28MzQbXkdGn3v3b7U+1wDkl1gc6Id1Po7IVFjN9rayIYN FcBxUh+dSEFaxrH7gQzwX/G1iG+bSZzO40xo9r/sJiamALSwwxmrOPXKGf5Hrq81wiZN S5eg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=b9pW2OLWDIPVMNNdZ1ZG6jz9Jd+TzbCyrGMFNXwpzPI=; b=ezK6rGBojokPwUhrFGrW2wsxmE8FgoEOuH2/Xn/vAey8GJXMRbJdW3sdfT2gH6aIAR pUjufpE4eh5YvW1EyT1C0TXtNo6G+w4hZa+BXizYrkEFsD8IZdUyP3k+82w2n5Zyw/AQ WMcSsHW18evyp+pnfssDdlNDr7GuvO94kDoX8K9PgOa81EPVAKLxsQUCX+VG8O9Rqvul iBJglLECX60XRJgNAqlQhVgRE7fwqACqv10oJyNnGXppbbVvk8AIQTJ7pqLUv8eIuP9k wPZEWfRvWKqkea5EAOq7B6JrEF1cyLl2Obq6byzz+mabGImFc42D9Arv6TkmYUzVyToI 0s8A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=tAUEREY6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g9si23970848edn.361.2020.12.28.06.48.46; Mon, 28 Dec 2020 06:49:08 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=tAUEREY6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2392363AbgL1Oqx (ORCPT + 99 others); Mon, 28 Dec 2020 09:46:53 -0500 Received: from mail.kernel.org ([198.145.29.99]:59798 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2502900AbgL1OXs (ORCPT ); Mon, 28 Dec 2020 09:23:48 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id B4582206D4; Mon, 28 Dec 2020 14:23:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1609165387; bh=MmG8KOuktm7mFn9OvCZwv5Ou7Rl4C6yIs4bp9OjUqw0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tAUEREY6sa9X+5/4bdpnnRlUs3oc2CNnqg07rO8XYxEmOpbzPj4bE1GzrRs71X6no QQ+yOWq7UgMcG5A8071KdbcwJDEzY4syicQ37CFu+g84KYeXt5FoU6GyAmp4gyI+0Y fsGMJNn8miYgbMd/eP24bYdg3ZBhS+B1IXr89zyU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Taras Galchenko , =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig?= , Thierry Reding , Sasha Levin Subject: [PATCH 5.10 482/717] pwm: sun4i: Remove erroneous else branch Date: Mon, 28 Dec 2020 13:48:00 +0100 Message-Id: <20201228125044.061381976@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201228125020.963311703@linuxfoundation.org> References: <20201228125020.963311703@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Thierry Reding [ Upstream commit 6eefb79d6f5bc4086bd02c76f1072dd4a8d9d9f6 ] Commit d3817a647059 ("pwm: sun4i: Remove redundant needs_delay") changed the logic of an else branch so that the PWM_EN and PWM_CLK_GATING bits are now cleared if the PWM is to be disabled, whereas previously the condition was always false, and hence the branch never got executed. This code is reported causing backlight issues on boards based on the Allwinner A20 SoC. Fix this by removing the else branch, which restores the behaviour prior to the offending commit. Note that the PWM_EN and PWM_CLK_GATING bits still get cleared later in sun4i_pwm_apply() if the PWM is to be disabled. Fixes: d3817a647059 ("pwm: sun4i: Remove redundant needs_delay") Reported-by: Taras Galchenko Suggested-by: Taras Galchenko Tested-by: Taras Galchenko Reviewed-by: Uwe Kleine-König Signed-off-by: Thierry Reding Signed-off-by: Sasha Levin --- drivers/pwm/pwm-sun4i.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/drivers/pwm/pwm-sun4i.c b/drivers/pwm/pwm-sun4i.c index 38a4c5c1317b2..482d5b9cec1fb 100644 --- a/drivers/pwm/pwm-sun4i.c +++ b/drivers/pwm/pwm-sun4i.c @@ -294,12 +294,8 @@ static int sun4i_pwm_apply(struct pwm_chip *chip, struct pwm_device *pwm, ctrl |= BIT_CH(PWM_CLK_GATING, pwm->hwpwm); - if (state->enabled) { + if (state->enabled) ctrl |= BIT_CH(PWM_EN, pwm->hwpwm); - } else { - ctrl &= ~BIT_CH(PWM_EN, pwm->hwpwm); - ctrl &= ~BIT_CH(PWM_CLK_GATING, pwm->hwpwm); - } sun4i_pwm_writel(sun4i_pwm, ctrl, PWM_CTRL_REG); -- 2.27.0