From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id B1422CEDDBB for ; Thu, 10 Oct 2024 03:32:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: Content-Type:In-Reply-To:From:References:Cc:To:Subject:MIME-Version:Date: Message-ID:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=gQnsQNQ/PBK1SteM9oC4cO5u8kTLGnBUpC1Tp8O2a+Y=; b=rx0tecSIn/z/+im0o8gg2qsgXQ Z7h+bDxLzZZx0iVJZMG9ogMdRweOuX8UhqwTAq2is+OzxwbxaFL+2JzME7ACoRaPDcidH5mQToa/O fvi6psWdjqXrrYuXFU6ZogmZtZI56lvpZ0EP/mGxbT6hup6bkvv9VHP801TeGytoxgjwxoC/s6olC yILT+8TrGJi9iU80gIxKCh7DOoizTzSRRrH7HC9LYmxUnDmcO8MrY2xwDUHJN4N9k3z5Q3/qtKVZ8 z5QLecXNV8eVWFjn8/NO+SHhKHrSzzu7VgXm18ku0ekES6I3eR9j+J/rHxS4D31os+tUkW7LKupbO 41o7ZBcA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1syjuM-0000000BOvu-1tAE; Thu, 10 Oct 2024 03:32:10 +0000 Received: from phobos.denx.de ([2a01:238:438b:c500:173d:9f52:ddab:ee01]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1syjrj-0000000BObR-3otA for linux-arm-kernel@lists.infradead.org; Thu, 10 Oct 2024 03:29:29 +0000 Received: from [127.0.0.1] (p578adb1c.dip0.t-ipconnect.de [87.138.219.28]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: marex@denx.de) by phobos.denx.de (Postfix) with ESMTPSA id 723AF88FAB; Thu, 10 Oct 2024 05:29:25 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=denx.de; s=phobos-20191101; t=1728530966; bh=gQnsQNQ/PBK1SteM9oC4cO5u8kTLGnBUpC1Tp8O2a+Y=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=Bz4DAGzlzPqKpi94IKhRnwm9EDdVDYpweUjGZCxQC5/5v0ZScB7AHUZz99xNZ3sO4 fXwHcb7Wfo9g1chTT07xZ3hg5iFnq2wW6XoqMOs1YdkzmI9d3BtX9usExRCZZJQLzV fO3hNP8Mq+sf/y5TZAPx6e7mnwBjwjBGeNJ724egjSM81vhEV5VWl+VcmLrtD8e50W EECJ93i9aovobS4t1zqCX1ZT0BP6CJDEKP02T/pxQj/Vfe3eBSSbD8ndTnnMHse5+3 by8zd7hh3H5bfHb22YWv0AwSVzznnQYTNEq0KmGuZSzbip+bdhut1fsmmlM4iYJJg2 HMrbWIqvnBwMg== Message-ID: <0ea547b0-5ccb-4cf7-bb57-807caf8649ca@denx.de> Date: Thu, 10 Oct 2024 03:18:58 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v8 1/1] pwm: imx27: workaround of the pwm output bug when decrease the duty cycle To: Frank Li Cc: u.kleine-koenig@baylibre.com, conor+dt@kernel.org, devicetree@vger.kernel.org, festevam@gmail.com, francesco@dolcini.it, imx@lists.linux.dev, jun.li@nxp.com, kernel@pengutronix.de, krzk+dt@kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-pwm@vger.kernel.org, p.zabel@pengutronix.de, pratikmanvar09@gmail.com, robh@kernel.org, s.hauer@pengutronix.de, shawnguo@kernel.org, xiaoning.wang@nxp.com References: <20241008194123.1943141-1-Frank.Li@nxp.com> <41cc47bd-f18f-463b-a0dc-843088ecf91e@denx.de> Content-Language: en-US From: Marek Vasut In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241009_202928_127418_18C36E2D X-CRM114-Status: GOOD ( 10.49 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On 10/9/24 5:37 PM, Frank Li wrote: > On Wed, Oct 09, 2024 at 03:55:35AM +0200, Marek Vasut wrote: >> On 10/8/24 9:41 PM, Frank Li wrote: >> >> [...] >> >>> + c = clkrate * 1500; >>> + do_div(c, NSEC_PER_SEC); >>> + >>> + local_irq_save(flags); >>> + val = FIELD_GET(MX3_PWMSR_FIFOAV, readl_relaxed(imx->mmio_base + MX3_PWMSR)); >>> + >>> + if (duty_cycles < imx->duty_cycle && (cr & MX3_PWMCR_EN)) { >> >> I think you can use state->enabled instead of (cr & MX3_PWMCR_EN). > > state->enabled is new state. Need check old state here. If old state is > disable, needn't this workaround at all. Can you add code comment like this please ? Thank you !