Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp3712792pxv; Mon, 26 Jul 2021 10:02:07 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx7BT2s2MWy68NkUiv1sfCaibRygv0HeiyeoCV/tc4DaZ8HYGP05adNOi9/4kyg7ziBUFfq X-Received: by 2002:aa7:db11:: with SMTP id t17mr22333237eds.297.1627318927270; Mon, 26 Jul 2021 10:02:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1627318927; cv=none; d=google.com; s=arc-20160816; b=imVIg1nhW+XW6UvLN8hyGuXveY/27biPpy6N7LtE0EcDKBjEm5rDGHtOBxBjZpZ4su N1RvArSdIma7gfarbAelUsZyOZkwccZ0WdjgUFydiqL3OhDnugEe4RT7H8H0mXbJT7VP 8/hu2bwWYcU7PlV6YcCs8wXtFvJUm3TDjE/RNItHk1YOYUp5ta1bK+0i48xGOVDuorOg tfDfP3G2a82JkFNbYDjYLCrKqg2SqpQ0faP3QqDXPS4TvVlkaFBDBihx8qk8LmTTaxTV LhH4355g8awezTaDFplN08HwO8AuBFnGDMZpQF7NnaGLsvyzgntD3lo9I49a3lCa97S1 h2zg== 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=rE4v2SNEqepKvdNmB0Dz/1LO/1dZLMnnUzDA+8cOdP0=; b=B2LcH4S32kD+SSFLvoOtrA7wfVAEgUpSAEbAeoJFNjakcIgK4WpVjPNtrP15CfRfgr g2oLabFbC53ouJ6AuHUf5JJbafpQRuEeDzn60dCunhX1Yl5nso+ZzyV6ygqxYHe+R+RX VTsTl/uGXLvWzc7G5s41BixSA5eHDgTswCGv3Q0x2lE7AS4puXguqyS4zSmT8IHFS1Bz n8pftlsKi8SqerJfNkDTlxAC7TFBMLfjvzQDDELgdsuj+/wn8u736AQGeSDQbYWkMG+m nBnnPwRsmWvndzpv8TKnL5BivpJMUf1WDPWMIEyJHtXuhMu9LcHNezMMXdlaCSF47jiB 9baA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=YFICQCwA; 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 t5si472408eds.212.2021.07.26.10.01.37; Mon, 26 Jul 2021 10:02:07 -0700 (PDT) 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=YFICQCwA; 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 S236629AbhGZPf2 (ORCPT + 99 others); Mon, 26 Jul 2021 11:35:28 -0400 Received: from mail.kernel.org ([198.145.29.99]:34098 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237040AbhGZPUd (ORCPT ); Mon, 26 Jul 2021 11:20:33 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id D30066023D; Mon, 26 Jul 2021 16:01:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1627315262; bh=7s5Io78B8qEB4Mf4qIYhGmMivr56dVf84PgmMUN0MJ8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YFICQCwABOIswDDre9NspCRrYqE4VMjPoGMB12pR81ILyKXN1tZFN0TxaEsTojWfV jUSCNslZTOoi98XSd33hKsCkbbZk1jp3hibtFA3jhqMDcesEzkukG69jIe/5BZSMbJ RuFkbi2sAAc3oUpE922XhBmDRZTMmVPJbVNB0yd8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig?= , Thierry Reding , Sasha Levin Subject: [PATCH 5.10 027/167] pwm: sprd: Ensure configuring period and duty_cycle isnt wrongly skipped Date: Mon, 26 Jul 2021 17:37:40 +0200 Message-Id: <20210726153840.279592560@linuxfoundation.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210726153839.371771838@linuxfoundation.org> References: <20210726153839.371771838@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: Uwe Kleine-König [ Upstream commit 65e2e6c1c20104ed19060a38f4edbf14e9f9a9a5 ] As the last call to sprd_pwm_apply() might have exited early if state->enabled was false, the values for period and duty_cycle stored in pwm->state might not have been written to hardware and it must be ensured that they are configured before enabling the PWM. Fixes: 8aae4b02e8a6 ("pwm: sprd: Add Spreadtrum PWM support") Signed-off-by: Uwe Kleine-König Signed-off-by: Thierry Reding Signed-off-by: Sasha Levin --- drivers/pwm/pwm-sprd.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/drivers/pwm/pwm-sprd.c b/drivers/pwm/pwm-sprd.c index 5123d948efd6..9eeb59cb81b6 100644 --- a/drivers/pwm/pwm-sprd.c +++ b/drivers/pwm/pwm-sprd.c @@ -180,13 +180,10 @@ static int sprd_pwm_apply(struct pwm_chip *chip, struct pwm_device *pwm, } } - if (state->period != cstate->period || - state->duty_cycle != cstate->duty_cycle) { - ret = sprd_pwm_config(spc, pwm, state->duty_cycle, - state->period); - if (ret) - return ret; - } + ret = sprd_pwm_config(spc, pwm, state->duty_cycle, + state->period); + if (ret) + return ret; sprd_pwm_write(spc, pwm->hwpwm, SPRD_PWM_ENABLE, 1); } else if (cstate->enabled) { -- 2.30.2