Received: by 2002:a25:c205:0:0:0:0:0 with SMTP id s5csp491979ybf; Fri, 28 Feb 2020 01:58:31 -0800 (PST) X-Google-Smtp-Source: APXvYqzy9B2uLpZ6lD0KYy3VwVA8xWuUdwIxaiJE2osN8NkzFl8c4zQS/4QbpIXHmgc2mVtRhYpX X-Received: by 2002:a05:6808:3b4:: with SMTP id n20mr2429009oie.78.1582883911434; Fri, 28 Feb 2020 01:58:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582883911; cv=none; d=google.com; s=arc-20160816; b=UxYZLufwzDft952W/Oem/bu/pJnXhYaX/OiBx5dxfVZ7DVTewbq45tiV9+Z19emsY8 HpaLTiE8lOQ5Zb4aoHtGXmL9gEd2sE34ahZpq04QLt1ovJQzC3ZCEpNroRKJ5oPwW+I8 kMTk0qXKkN+R54ssdxK6ed6Cc1Hpy0hGVyej7RGFP2xlWeoUUk36r9iEf7AqcpoaB3/6 ACh8PiLVyTlkaXPRhwtERBkIsfpnxvKK7nz7KMnFHb7PbAwqRvbVsS4oOXhMj8g7cj45 ECn6z6LwN42DXjB7wrou5gxDnq8oSrlYGMcG3UTtFK4CJYxEPyvm6+n2aSnXYMeHbhaz GxIw== 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=fs0KZTPJtZZlBP7pB30VsjNcC7vtHtoLJB0mbseDTu8=; b=btd02p7XwpW76kRGQDgZTfFZLOdFPZgRObVrcqe0nu9H0nLi3KKTTOI8Wckc7fPgUB 6WpdW5+Cy2r0yv0kKv+cD6gspyhTLDvSnvrrKODwlAmW6Yy3AiKTTCbQSiDzHefbJSf5 m17pwTBfYibaJHWO5DPvmLeYo0WwAZpf3gSjsOI5XD1JhjI6WfeJ2Nit6PiAewBlpNPd UfedYyQ49+hwXTm7Nk4vMjzXFD2K8SMlgLTWN3zMOiQlUCS0JVJCPCeKtk15GkrgEBYN JAKhlbWABoERvDsGK66+JKSx0oaTVbmOlmv6nEY15H3CTYWUF1eZfZjwaxtCOPln8HXE JOeQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b="FqQft/eq"; 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 13si1581479oiy.28.2020.02.28.01.58.19; Fri, 28 Feb 2020 01:58:31 -0800 (PST) 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="FqQft/eq"; 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 S1727083AbgB1J6F (ORCPT + 99 others); Fri, 28 Feb 2020 04:58:05 -0500 Received: from lelv0143.ext.ti.com ([198.47.23.248]:55546 "EHLO lelv0143.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727053AbgB1J6E (ORCPT ); Fri, 28 Feb 2020 04:58:04 -0500 Received: from fllv0034.itg.ti.com ([10.64.40.246]) by lelv0143.ext.ti.com (8.15.2/8.15.2) with ESMTP id 01S9vx5C011947; Fri, 28 Feb 2020 03:57:59 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1582883879; bh=fs0KZTPJtZZlBP7pB30VsjNcC7vtHtoLJB0mbseDTu8=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=FqQft/eqKV61MhNjXdSkIkphqOjSA/TWTZ55rE8lVao9X/GzbZJkIH/ii/Ry5523i B/gzz4uYHb7b3FgN1r69UxqbnbrmKnByQUdLoV82KZcc0sohxQx3ajqfchy/EFgzre YucDGF77uZC9rVFF+QDvRyQEZyrvrOtT0iGz9Apw= Received: from DFLE114.ent.ti.com (dfle114.ent.ti.com [10.64.6.35]) by fllv0034.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 01S9vxPI029494 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Fri, 28 Feb 2020 03:57:59 -0600 Received: from DFLE105.ent.ti.com (10.64.6.26) by DFLE114.ent.ti.com (10.64.6.35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1847.3; Fri, 28 Feb 2020 03:57:59 -0600 Received: from localhost.localdomain (10.64.41.19) by DFLE105.ent.ti.com (10.64.6.26) 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; Fri, 28 Feb 2020 03:57:59 -0600 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 01S9vhLI115767; Fri, 28 Feb 2020 03:57:56 -0600 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 v2 4/6] pwm: omap-dmtimer: Fix pwm disabling sequence Date: Fri, 28 Feb 2020 15:26:49 +0530 Message-ID: <20200228095651.32464-5-lokeshvutla@ti.com> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20200228095651.32464-1-lokeshvutla@ti.com> References: <20200228095651.32464-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 pwm_omap_dmtimer_disable() calls .stop callback which abruptly stops the timer counter. This doesn't complete the current pwm cycle and immediately disables the pwm. Instead disable the auto reload functionality which allows to complete the current pwm cycle and then disables the timer. Signed-off-by: Lokesh Vutla --- drivers/pwm/pwm-omap-dmtimer.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/drivers/pwm/pwm-omap-dmtimer.c b/drivers/pwm/pwm-omap-dmtimer.c index bc338619232d..89b3c25d02b8 100644 --- a/drivers/pwm/pwm-omap-dmtimer.c +++ b/drivers/pwm/pwm-omap-dmtimer.c @@ -93,8 +93,16 @@ static void pwm_omap_dmtimer_disable(struct pwm_chip *chip, { struct pwm_omap_dmtimer_chip *omap = to_pwm_omap_dmtimer_chip(chip); + /* + * Disable auto reload so that the current cycle gets completed and + * then the counter stops. + */ mutex_lock(&omap->mutex); - omap->pdata->stop(omap->dm_timer); + omap->pdata->set_pwm(omap->dm_timer, + pwm_get_polarity(pwm) == PWM_POLARITY_INVERSED, + true, OMAP_TIMER_TRIGGER_OVERFLOW_AND_COMPARE, + false); + mutex_unlock(&omap->mutex); } -- 2.23.0