Received: by 2002:a25:e7d8:0:0:0:0:0 with SMTP id e207csp134895ybh; Tue, 10 Mar 2020 21:14:31 -0700 (PDT) X-Google-Smtp-Source: ADFU+vs8wfz4+PY3GgZTR11rk0d4nUuhnHQ9pefXymusDj/jNxA4Pg6dOlcVDjsNAAMQ6+PN1aIv X-Received: by 2002:a05:6830:103:: with SMTP id i3mr810945otp.270.1583900071044; Tue, 10 Mar 2020 21:14:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1583900071; cv=none; d=google.com; s=arc-20160816; b=N5cumw+uW1dcOZTpF6Bl21DA5c08VAnbHx2tOS2F9nvvlXfrvrxq3xFajq0+pz/Io9 wI2+YEy9gQ3Jz8HXWsxBjCmP0xaCryOzds1DQ44aGGqEAUU7T1T5N3rPWdRRjw77PpMg sNlfDBFn/J/BkXmzNgld6lvzzPixmIf3BA4DtUikVUuIPX6YqT9hBa6WQJyaUHkc2gAU J1LYvLE0JgVC+sIRWwRaIzy14AD+u38ykujpM3I7A2SXeVqkdXV7q6izGIaWcxDCmfC5 lCf/StHy4bW7yoJNh8k+UGV2drUqZa3/CPTDL00UMYUCGgUkvrTURKQhNR794xgJyyol S9kQ== 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 :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=5ofOG+gfPhoCmIZuODzbDvCrnXBGO1iU4BMFVihuZv0=; b=H7eCOo7wiFGuI9TEx7hybZirTKiJYsa527hIt7flbnqwfrJDGjuVLIFkSSjx5wITOp JEi9wWJw6jag2sTzDMEURmvcjpOm37/LeQD2BKtB9l3+VrdQsx77dAtDsMIz9Qs5b6zx koKwrc6G33PV3IGvnEJD1+NSXH8HjJzxJursQCcEftGq2EXvQKo9Wb6NYl5PI50kqN/g /JKyIst4JnPTY3BRFK6VSmx20vH0pAlOmM4Tmz8rqOSHLsyuNlkOLJtzZ408TnBcew+w PHc3T3J5Aq7bhztUa6PyNiZKoFcDtaZ1fQFExKZP++2s6G8u+Y66RDmO5/FrGL+qU/4w Nn2w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=HHqxNgTA; 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 l20si480730otn.37.2020.03.10.21.14.16; Tue, 10 Mar 2020 21:14:31 -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=HHqxNgTA; 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 S1726189AbgCKENu (ORCPT + 99 others); Wed, 11 Mar 2020 00:13:50 -0400 Received: from fllv0015.ext.ti.com ([198.47.19.141]:41052 "EHLO fllv0015.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725379AbgCKENu (ORCPT ); Wed, 11 Mar 2020 00:13:50 -0400 Received: from lelv0265.itg.ti.com ([10.180.67.224]) by fllv0015.ext.ti.com (8.15.2/8.15.2) with ESMTP id 02B4Dblu125647; Tue, 10 Mar 2020 23:13:37 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1583900017; bh=5ofOG+gfPhoCmIZuODzbDvCrnXBGO1iU4BMFVihuZv0=; h=Subject:To:CC:References:From:Date:In-Reply-To; b=HHqxNgTAkdPmlgBcyBRt8vw4//wXk7a+cDh/MitEhOTQUXnWyREtXboOtlrv8B46H H26TH35w5hXSwBZzdV0/ivFV1v6FhXBO1KDVuXPEdre4UZSFSbAiF77QZHZvsKgwuJ cFdOGixee9bWYIwry8zbwCXt7izizSgNEczcD2EU= Received: from DFLE112.ent.ti.com (dfle112.ent.ti.com [10.64.6.33]) by lelv0265.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 02B4DbpB127963 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Tue, 10 Mar 2020 23:13:37 -0500 Received: from DFLE104.ent.ti.com (10.64.6.25) by DFLE112.ent.ti.com (10.64.6.33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1847.3; Tue, 10 Mar 2020 23:13:37 -0500 Received: from localhost.localdomain (10.64.41.19) by DFLE104.ent.ti.com (10.64.6.25) 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; Tue, 10 Mar 2020 23:13:37 -0500 Received: from [10.24.69.20] (ileax41-snat.itg.ti.com [10.172.224.153]) by localhost.localdomain (8.15.2/8.15.2) with ESMTP id 02B4DY32014325; Tue, 10 Mar 2020 23:13:35 -0500 Subject: Re: [PATCH v2 4/6] pwm: omap-dmtimer: Fix pwm disabling sequence To: Tony Lindgren CC: Thierry Reding , =?UTF-8?Q?Uwe_Kleine-K=c3=b6nig?= , Linux OMAP Mailing List , , , Sekhar Nori , Vignesh R , Sebastian Reichel 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> <20200310155242.GT37466@atomide.com> From: Lokesh Vutla Message-ID: <296e28b7-7925-5dfa-ce5a-c0b2a2f1c2e0@ti.com> Date: Wed, 11 Mar 2020 09:42:39 +0530 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.7.0 MIME-Version: 1.0 In-Reply-To: <20200310155242.GT37466@atomide.com> Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 7bit 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 On 10/03/20 9:22 PM, Tony Lindgren wrote: > * 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? If that's the case, mis behavior should have happened without this patch as well. Is it possible for you to dump the registers when you are observing higher power consumption after the use? However, I see an issue with the patch itself as pm_runtime is not disabled after the pwm is stopped. Not sure how that could be nullified with this approach. Thanks and regards, Lokesh