Received: by 2002:a25:e7d8:0:0:0:0:0 with SMTP id e207csp86210ybh; Wed, 11 Mar 2020 21:23:48 -0700 (PDT) X-Google-Smtp-Source: ADFU+vsQT6TT9HMNcmcRFlAUFu3wrVts+Vrddxd2HN1PNwYYOWqMnFzSv0sKqebytL/MRAj3yU8D X-Received: by 2002:a9d:3df6:: with SMTP id l109mr4841851otc.284.1583987028495; Wed, 11 Mar 2020 21:23:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1583987028; cv=none; d=google.com; s=arc-20160816; b=TJ3M0N7wy4U8YGz1mxU6kB+kM0fdY2CsjY3/ft0CVJjErxBMXTnfe/O358tlz/dT+1 HP/76MWkT+J8xC2jIdk4wy6hExf16nSb8b40E9XVtuyc3PoK3DFs83QJjx8Dg8KZXDPU C2Mj+6gF9GX/chcLZtGEec1zRvtxOdjf+t0b0igymvseSyRRF3agavF6wN7mW7krb2o4 bo1P2mWxakXYWoStqA2ztX3NmhiA4A32ZEiL9fXKq4vglHe3IvCWMXE3nTYhZdK1YrJO skKxv1duiQyTQNxOMRWzU2u4/pu/E8pczRrFUzd+8Hs5ClDTvKE06WUr1GtWom9Wozs1 f7SQ== 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 :dkim-signature; bh=yfnmLmGqZuF901NMzFzpc45U1ki5pwP1FoJ5cXVm0Gs=; b=XTsf0gWiaMju2hWfyzCQeeu8nRkt0dOTO4eMaSO6/ZY9xWoJCyJoFzkfoAax5kXsKj /edFaVIHJl9BpC+5BrAhLf8oRTiWCG3hEAApARz5qrxj87eWnl4PqTa5fJnomwKEinX6 dQnVvm2mnvZl+2WPiEihcR359VpXRyO1rwR1Ys3rbv0uF4bf0EQN7eH8XzdtcCGfQtAW knzDwkE5sXfThdHeEwNXzo168yePZCKYZX5LUvFBzd4wXy0uKoO4gCSS17ymUXM4ETAF XC9YzAfApaLIdL+SlflMieiFcD4AD/0apui+I03VpMlmNGlB6RszwGPufzDMy0s44mbf rqCA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=flpdtK8U; 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; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x9si2044917oia.194.2020.03.11.21.23.36; Wed, 11 Mar 2020 21:23:48 -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; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=flpdtK8U; 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; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387765AbgCLEXQ (ORCPT + 99 others); Thu, 12 Mar 2020 00:23:16 -0400 Received: from fllv0016.ext.ti.com ([198.47.19.142]:55984 "EHLO fllv0016.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387756AbgCLEXP (ORCPT ); Thu, 12 Mar 2020 00:23:15 -0400 Received: from lelv0266.itg.ti.com ([10.180.67.225]) by fllv0016.ext.ti.com (8.15.2/8.15.2) with ESMTP id 02C4NAsb048186; Wed, 11 Mar 2020 23:23:10 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1583986990; bh=yfnmLmGqZuF901NMzFzpc45U1ki5pwP1FoJ5cXVm0Gs=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=flpdtK8UGKXOtYAp3k90usk+H0Ie8fbWlz1Yyao4DHETWGv9CH1iOkiGFD9WE8GMS 6YhsN05mEq0On1GFMXRxlQWyor9bz7ba4TMEGDYhQ+3IDx+wuKC/tpPpN3H36dfbZX RuHP0raFe/P/MAgnR6oVvRgY0cdmT6cpQf5D0WBM= Received: from DLEE112.ent.ti.com (dlee112.ent.ti.com [157.170.170.23]) by lelv0266.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 02C4NALN039572 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Wed, 11 Mar 2020 23:23:10 -0500 Received: from DLEE112.ent.ti.com (157.170.170.23) by DLEE112.ent.ti.com (157.170.170.23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1847.3; Wed, 11 Mar 2020 23:23:10 -0500 Received: from localhost.localdomain (10.64.41.19) by DLEE112.ent.ti.com (157.170.170.23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1847.3 via Frontend Transport; Wed, 11 Mar 2020 23:23:10 -0500 Received: from uda0131933.dhcp.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by localhost.localdomain (8.15.2/8.15.2) with ESMTP id 02C4Mvgj065984; Wed, 11 Mar 2020 23:23:07 -0500 From: Lokesh Vutla To: Thierry Reding , =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig?= CC: Tony Lindgren , Linux OMAP Mailing List , , , Sekhar Nori , Vignesh R , Lokesh Vutla Subject: [PATCH v3 3/5] pwm: omap-dmtimer: Fix pwm enabling sequence Date: Thu, 12 Mar 2020 09:52:08 +0530 Message-ID: <20200312042210.17344-4-lokeshvutla@ti.com> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20200312042210.17344-1-lokeshvutla@ti.com> References: <20200312042210.17344-1-lokeshvutla@ti.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org To configure DM timer is pwm mode the following needs to be set in OMAP_TIMER_CTRL_REG using set_pwm callback: - Set toggle mode on PORTIMERPWM output pin - Set trigger on overflow and match on PORTIMERPWM output pin. - Set auto reload This is a one time configuration and needs to be set before the start of the dm timer. But the current driver tries to set the same configuration for every period/duty cycle update, which is not needed. So move the pwm setup before enabling timer and do not update it in pwm_omap_dmtimer_config. Tested-by: Tony Lindgren Signed-off-by: Lokesh Vutla --- drivers/pwm/pwm-omap-dmtimer.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/pwm/pwm-omap-dmtimer.c b/drivers/pwm/pwm-omap-dmtimer.c index 92aac6c86b95..85b17b49980b 100644 --- a/drivers/pwm/pwm-omap-dmtimer.c +++ b/drivers/pwm/pwm-omap-dmtimer.c @@ -81,6 +81,11 @@ static int pwm_omap_dmtimer_enable(struct pwm_chip *chip, struct pwm_omap_dmtimer_chip *omap = to_pwm_omap_dmtimer_chip(chip); mutex_lock(&omap->mutex); + omap->pdata->set_pwm(omap->dm_timer, + pwm_get_polarity(pwm) == PWM_POLARITY_INVERSED, + true, OMAP_TIMER_TRIGGER_OVERFLOW_AND_COMPARE, + true); + pwm_omap_dmtimer_start(omap); mutex_unlock(&omap->mutex); @@ -197,11 +202,6 @@ static int pwm_omap_dmtimer_config(struct pwm_chip *chip, dev_dbg(chip->dev, "load value: %#08x (%d), match value: %#08x (%d)\n", load_value, load_value, match_value, match_value); - omap->pdata->set_pwm(omap->dm_timer, - pwm_get_polarity(pwm) == PWM_POLARITY_INVERSED, - true, OMAP_TIMER_TRIGGER_OVERFLOW_AND_COMPARE, - true); - /* If config was called while timer was running it must be reenabled. */ if (timer_active) pwm_omap_dmtimer_start(omap); -- 2.23.0