Received: by 2002:a25:e7d8:0:0:0:0:0 with SMTP id e207csp2693247ybh; Mon, 9 Mar 2020 11:03:01 -0700 (PDT) X-Google-Smtp-Source: ADFU+vsaNK0B16yCiRGQ8cRomHT/kEY8CEx2NfnC4gYGE4zWP5ANGee3E8N5qZI1yZ2PoJsbPO6A X-Received: by 2002:a9d:4508:: with SMTP id w8mr14728386ote.154.1583776981693; Mon, 09 Mar 2020 11:03:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1583776981; cv=none; d=google.com; s=arc-20160816; b=lxPTkVfom0X3ShAKEv9FwJDH78vXAQa3vADuw/NabeettYm8p1wj0a0dpIPtfyqA2H flIP4PhBuu1J/J+39lEVIyC0fsr0by+VkLK9EfENo/+ln4yR5Q/FoMKxQAkDKB13LbpB iLEniK0h6SYioX9zSLVUQZjDAJzZnMsVqHM/lsherozy4akcv+GEs5OmB2nzgbtwnmRR NxQe+3j9EPR9yNVXfM+whB4ZUeeG3ArdsChKU9KnlFk0crKEhDtZ720vedK0x1aBO7yt D3j1unrsDDHHaS9BhOtiE/hzZ7feFzCez1UTpMOqwM/UR53xKzAElTO6Rg6jLyazqnCd RX9w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=w/hu0choDCO8DKzw3XY1/XyvgGqACFxYAbgxu8Ys1uE=; b=gKUvBuGCZbUuPgnCrrmqz8p+j25px+0tcTJBfH/6RCVcC5gHOlnvDRtceiq4GJYprj wXCoPXjolX6DdGzRvP3dLtqiKY2/s+SRdFI1l+KZlfH0CuL36Lk9xWQDNYHminR+4oyP +/oGbUmIEGy7iyGlfmx66dRbQQHTeY60Z39L7gzwAzJoOXgitKCw4gt32hbAX9I4DRJz jbP1gy3ac8QhyClIHa++zxSHUUeXgO9VvGN4qWPlwBlmeNAzqlDv7VgzBCmX7clzxidX jevaQHNynaKM4xqX4DVK2A6RdtA4LotSbLA+8lPgxOBuGxeecy8lIhpJho/ZwBMzF6o6 zRHw== 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 v19si6317438otq.57.2020.03.09.11.02.42; Mon, 09 Mar 2020 11:03:01 -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 S1726571AbgCISB2 (ORCPT + 99 others); Mon, 9 Mar 2020 14:01:28 -0400 Received: from muru.com ([72.249.23.125]:59418 "EHLO muru.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726170AbgCISB2 (ORCPT ); Mon, 9 Mar 2020 14:01:28 -0400 Received: from atomide.com (localhost [127.0.0.1]) by muru.com (Postfix) with ESMTPS id A5E9C80FA; Mon, 9 Mar 2020 18:02:12 +0000 (UTC) Date: Mon, 9 Mar 2020 11:01:23 -0700 From: Tony Lindgren To: Lokesh Vutla Cc: Thierry Reding , Uwe =?utf-8?Q?Kleine-K=C3=B6nig?= , Linux OMAP Mailing List , linux-kernel@vger.kernel.org, linux-pwm@vger.kernel.org, Sekhar Nori , Vignesh R , Sebastian Reichel Subject: Re: [PATCH v2 4/6] pwm: omap-dmtimer: Fix pwm disabling sequence Message-ID: <20200309180123.GP37466@atomide.com> References: <20200228095651.32464-1-lokeshvutla@ti.com> <20200228095651.32464-5-lokeshvutla@ti.com> <20200306181443.GJ37466@atomide.com> <9129d4fe-a17e-2fa6-764c-6a746fa5096d@ti.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <9129d4fe-a17e-2fa6-764c-6a746fa5096d@ti.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org * Lokesh Vutla [200309 04:53]: > Hi Tony, > > On 06/03/20 11:44 PM, Tony Lindgren wrote: > > * Lokesh Vutla [200228 09:58]: > >> 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); > >> } > > > > I'm seeing an issue with this patch where after use something is > > left on and power consumption stays higher by about 30 mW after > > use. > > Interesting...What is the PWM period and duty cycle in the test case? > Can you dump the following registers before and after disabling: > - TLDR > - TMAR > - TCLR Here's the state dumped before and after in omap_dm_timer_set_pwm(): omap_timer 4803e000.timer: XXX set_pwm before: tldr: fffffeb8 tmar: fffffffe tclr: 00000040 omap_timer 4803e000.timer: XXX set_pwm after: tldr: fffffeb8 tmar: fffffffe tclr: 00001842 omap_timer 4013e000.timer: XXX set_pwm before: tldr: fffffeb8 tmar: fffffffe tclr: 00000040 omap_timer 4013e000.timer: XXX set_pwm after: tldr: fffffeb8 tmar: fffffffe tclr: 00001842 omap_timer 4013e000.timer: XXX set_pwm before: tldr: fffffeb8 tmar: fffffffe tclr: 00001843 omap_timer 4013e000.timer: XXX set_pwm after: tldr: fffffeb8 tmar: fffffffe tclr: 00001841 omap_timer 4803e000.timer: XXX set_pwm before: tldr: fffffeb8 tmar: fffffffe tclr: 00001843 omap_timer 4803e000.timer: XXX set_pwm after: tldr: fffffeb8 tmar: fffffffe tclr: 00001841 So looks like the start bit is still enabled after use? I think the duty cycle depends on the strength set for rumble-test.c. > > I can reproduce this easily on droid4 with Sebastian's rumble-test > > app[0]. After use, I sometimes also hear the vibrator keep chirping > > quietly, so there seems to be some pwm still happening after disable :) > > hmm..The line clearly goes down on the scope after the current pwm duty cycle is > done and never comes back. OK Regards, Tony