Received: by 2002:a25:e7d8:0:0:0:0:0 with SMTP id e207csp822316ybh; Tue, 10 Mar 2020 08:53:32 -0700 (PDT) X-Google-Smtp-Source: ADFU+vtgUSKfsTqqTTrveWt5T/LOHS1Bp0Mb1njrMqAraG2hbZu9yxHHMDe55a/5iPfkeki3UpCe X-Received: by 2002:a9d:b89:: with SMTP id 9mr17693149oth.297.1583855612630; Tue, 10 Mar 2020 08:53:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1583855612; cv=none; d=google.com; s=arc-20160816; b=ZeSJe5ojFfMMgha9+al9DTus1Au9guqW6WW6F/0SiMNwa42CV74SmPJUfxrtv9p4x7 M2zlw3cTx1osg7WXorGh6/fKP9So+IahqZdWSUDxla0kn+iv828IPmes0ZNlYVXyKzIB dmOGket0APas8V+/A3OOX1P6omIn8gINwMtcsZmiMsuQNUjG5uNDPCr55appRWE8Tgpa 3yD8YomW7C5CINN8PjB/qMgfsTsaky48TDyd+IUhzsYDtA1l31c5a02MGi6h2KfiKWTA LYZtzC0n8qSTb9RTHp0x8FepfLJisdZ542RKpFla1t/tZNAm7ggZWmgqMUggVrastwMr pgEg== 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=/Zl0FjrrgGfpr98ImaFMJ826Jhb0W2U9UxGq2c9AJSU=; b=cASZetgtXqp/VpBr2jNo4iE7/wZQmdxqKGRN3ee6VMPf1H3uJfPJK8oQfAutYMjEQ8 GIhGKpcGyH7HMtLJC04zvwmZyGnwYMma3BHWOscIh2BHdrrJ+rYwPPFR+T1AcTMPc/ve SFD2B5LmTu0ncyKv+cL5e+2b/WiR8VIZdvN8PoKGCGCr3HAPeOwMEaiT6G4AFd5HAMxv aZ4/n+nzbzv8PeuAiPMKa/TRhSSf+GmfCFvjNMCTlbgSOZ+SH4/FdxciMsj26N7D9nFq vLjx3A4qWmFnqSiaMEXJtErSqzDzeexlWqkEzPDwCGChsX3yGZLMNXAFf+nUj4dljG6x zQeg== 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 a5si879177oii.181.2020.03.10.08.53.19; Tue, 10 Mar 2020 08:53:32 -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 S1726636AbgCJPwr (ORCPT + 99 others); Tue, 10 Mar 2020 11:52:47 -0400 Received: from muru.com ([72.249.23.125]:59528 "EHLO muru.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726426AbgCJPwq (ORCPT ); Tue, 10 Mar 2020 11:52:46 -0400 Received: from atomide.com (localhost [127.0.0.1]) by muru.com (Postfix) with ESMTPS id 3ED81810A; Tue, 10 Mar 2020 15:53:31 +0000 (UTC) Date: Tue, 10 Mar 2020 08:52:42 -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: <20200310155242.GT37466@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> <20200309180123.GP37466@atomide.com> <666dbb7a-db98-d16a-ee73-27d353d2a317@ti.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <666dbb7a-db98-d16a-ee73-27d353d2a317@ti.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org * Lokesh Vutla [200310 07:06]: > Hi Tony, > > [...snip...] > > >>>> > >>>> + /* > >>>> + * 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 > > > > Looking at the registers: > period = 327 *(1000/clk_freq in MHz) ns > duty_cycle = perioid. > > I did simulate this behavior on BeagleBoneBlack on timer7. PWM is going down > after disabling. > > > So looks like the start bit is still enabled after use? > > Right, that is expected. The start bit gets disabled automatically once the pwm > period completes. This is because auto reload bit is off. That's the main idea > of this patch so that PWM period is completed after disabling, else PWM is > stopped abruptly. OK > Not sure why it is not happening in your case. If you think it is not needed, I > can drop this patch and add a limitation saying that PWM gets disabled > immediately without completing the current cycle. Could it be that we now have the cpu_pm notifier restore something invalid after exiting idle that restarts the counter? Regards, Tony