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 X-Spam-Level: X-Spam-Status: No, score=-3.7 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7A98DC433ED for ; Mon, 3 May 2021 06:24:00 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 471D661185 for ; Mon, 3 May 2021 06:24:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232555AbhECGYv (ORCPT ); Mon, 3 May 2021 02:24:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55576 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230364AbhECGYm (ORCPT ); Mon, 3 May 2021 02:24:42 -0400 Received: from metis.ext.pengutronix.de (metis.ext.pengutronix.de [IPv6:2001:67c:670:201:290:27ff:fe1d:cc33]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AF943C061760 for ; Sun, 2 May 2021 23:23:48 -0700 (PDT) Received: from ptx.hi.pengutronix.de ([2001:67c:670:100:1d::c0]) by metis.ext.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1ldRzX-0007IU-4G; Mon, 03 May 2021 08:23:39 +0200 Received: from ukl by ptx.hi.pengutronix.de with local (Exim 4.92) (envelope-from ) id 1ldRzW-0004dp-9h; Mon, 03 May 2021 08:23:38 +0200 Date: Mon, 3 May 2021 08:23:38 +0200 From: Uwe =?utf-8?Q?Kleine-K=C3=B6nig?= To: Billy Tsai Cc: "devicetree@vger.kernel.org" , "kernel@pengutronix.de" , "linux-aspeed@lists.ozlabs.org" , "linux-pwm@vger.kernel.org" , "andrew@aj.id.au" , "linux-kernel@vger.kernel.org" , "robh+dt@kernel.org" , "thierry.reding@gmail.com" , "joel@jms.id.au" , "p.zabel@pengutronix.de" , BMC-SW , "lee.jones@linaro.org" , "linux-arm-kernel@lists.infradead.org" Subject: Re: [v2 2/2] pwm: Add Aspeed ast2600 PWM support Message-ID: <20210503062338.meohvoth7cyfppvu@pengutronix.de> References: <20210414104939.1093-1-billy_tsai@aspeedtech.com> <20210414104939.1093-3-billy_tsai@aspeedtech.com> <20210426204333.gzqke6td33dtugnh@pengutronix.de> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="5y5vjbuhxw63o4ix" Content-Disposition: inline In-Reply-To: X-SA-Exim-Connect-IP: 2001:67c:670:100:1d::c0 X-SA-Exim-Mail-From: ukl@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-kernel@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --5y5vjbuhxw63o4ix Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hello, your second reply is nearly identical to the first. It would be helpful to only write new stuff in new mail. I think there is only a single new paragraph that I will reply to here. On Mon, May 03, 2021 at 05:57:23AM +0000, Billy Tsai wrote: > On 2021/4/27, 4:44 AM,Uwe Kleine-K=C3=B6nigwrote: > > Also please round down in the division to never provide a duty_cycle > > bigger than the requested vaule. Also you have to use the actually = used > > period as divider, not state->period. >=20 > I don=E2=80=99t think that I should use the actually used period as divid= er.=20 > The state->duty_cycle is relative with state->period, not the actual peri= od > if I use the actual period the precision of the duty cycle may lose. The strategy you should implement in .apply() is: Pick the biggest period that is not bigger than the requested period. With that period pick the biggest duty_cycle that is not bigger than the requested duty_cycle. As the actual period might be smaller than state->period, dividing by the latter yields a result that might be too small. See commit 8035e6c66a5e98f098edf7441667de74affb4e78 (currently in next) for a similar example. Best regards Uwe --=20 Pengutronix e.K. | Uwe Kleine-K=C3=B6nig = | Industrial Linux Solutions | https://www.pengutronix.de/ | --5y5vjbuhxw63o4ix Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAABCgAdFiEEfnIqFpAYrP8+dKQLwfwUeK3K7AkFAmCPluYACgkQwfwUeK3K 7AmNUQf/RU+MvNyHvcNs7PNM65vJmNt/GqO+QIvkMt2Jt09HQxMESc4nGb/eyxiO GgV+XttkbD8Y1pxQH9zC2JrqvHyZYBRsQGQ+rUK7zpa2/Svh4QZtXlD1RXC6xUPu idFpx1NMNVAKqhZcmoVAoA4RibtH6hOeCoup0CHz92MnBI+n6hCffNH6mTYlP9jQ rHj+NzkQWF2Le0lAfxV/GG52BDl9GyB9vuvgYFoLs8L+sLooYFtxYIT7a6fiXcA/ KqZwcHutRaQTt/HDItgVukV9+nMEbQuNKxix1Jqa7gxbF+2bA4Sqm5JXLhD0J+LD J+dG3SrAbDKUgrzurGN30sY+rZKrBA== =/bfj -----END PGP SIGNATURE----- --5y5vjbuhxw63o4ix-- 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 X-Spam-Level: X-Spam-Status: No, score=-4.4 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7836FC433B4 for ; Mon, 3 May 2021 06:27:30 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id CDB6A61185 for ; Mon, 3 May 2021 06:27:29 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org CDB6A61185 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=pengutronix.de Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=desiato.20200630; h=Sender:Content-Type: List-Subscribe:List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id: In-Reply-To:MIME-Version:References:Message-ID:Subject:Cc:To:From:Date: Reply-To:Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date :Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=F4tig80YUKhHM7oeQN+YGCnS0wVftDhg9IwN7B5kZm4=; b=odN6XxW1aprkTl+CayqW2DhUA RTfYvApDrQ42CAvZ1QWKD2dGV79wUy5VmX0/QHeHG5uBfHQYSWruUzrcGl1cNzTR1hIKq6xV8mhnb VTMpnA9gXZeHxM9UkVsVp/0HRaGwcueshSgk0hN+S3LwXfT2J4VzN+jkpkMGmoTl64FRWITnmWTYc SKS5vo9njWyGldr/xZNCPCo5+b5jnq/nEWgPcm1F/Vpmby1gQN/FNgghdaaeK1c8OeC6JSfWyNtxE Lx41BVYQ426HK6O1kN+WJZZOfe7dO0lZqWTERUQhVZfFwFMkdvHi5m8qyg+Qe7Vjjbtnd48vBPX9/ jHHSYY6Qw==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1ldRzw-00DHLA-0n; Mon, 03 May 2021 06:24:04 +0000 Received: from bombadil.infradead.org ([2607:7c80:54:e::133]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1ldRzr-00DHL0-6o for linux-arm-kernel@desiato.infradead.org; Mon, 03 May 2021 06:23:59 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=In-Reply-To:Content-Type:MIME-Version :References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=+Dwvc9lLCnECsBYwRH+IJv0lYVpwfAgvlNAZldNgcfE=; b=ANGXkdHacafcyvtrlxN2PZH+Hc cwrKMVk1Jyh2FKGPK8Jcv+9AwNPajOm20uhatfAIzPkzrSF6qTiLt7r/gqNMNSPomjdrRDh5u9wdX CQyOnDce0x6oOLbtjHM0GbKvREErkBUuHMcvid11lQEXipVI97N7iT3jPryXTNMBuoENsxvpXJe0F VsxiX924k7ujtlEY1njfYLisc7ahrYN0LeKvt8rkr2D3EqmwF3PB2/IgbyjqgvbL8qZ5NnOyqbzKv ePXJzqR1cBHIbMIDifdEDjEO8gODbCDZO8T7EZ4ownFA7wPAUo0/cB+yxKlkcB6WVlae2GtfuNG70 lvXb7lBw==; Received: from metis.ext.pengutronix.de ([2001:67c:670:201:290:27ff:fe1d:cc33]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1ldRzo-002rgm-CQ for linux-arm-kernel@lists.infradead.org; Mon, 03 May 2021 06:23:57 +0000 Received: from ptx.hi.pengutronix.de ([2001:67c:670:100:1d::c0]) by metis.ext.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1ldRzX-0007IU-4G; Mon, 03 May 2021 08:23:39 +0200 Received: from ukl by ptx.hi.pengutronix.de with local (Exim 4.92) (envelope-from ) id 1ldRzW-0004dp-9h; Mon, 03 May 2021 08:23:38 +0200 Date: Mon, 3 May 2021 08:23:38 +0200 From: Uwe =?utf-8?Q?Kleine-K=C3=B6nig?= To: Billy Tsai Cc: "devicetree@vger.kernel.org" , "kernel@pengutronix.de" , "linux-aspeed@lists.ozlabs.org" , "linux-pwm@vger.kernel.org" , "andrew@aj.id.au" , "linux-kernel@vger.kernel.org" , "robh+dt@kernel.org" , "thierry.reding@gmail.com" , "joel@jms.id.au" , "p.zabel@pengutronix.de" , BMC-SW , "lee.jones@linaro.org" , "linux-arm-kernel@lists.infradead.org" Subject: Re: [v2 2/2] pwm: Add Aspeed ast2600 PWM support Message-ID: <20210503062338.meohvoth7cyfppvu@pengutronix.de> References: <20210414104939.1093-1-billy_tsai@aspeedtech.com> <20210414104939.1093-3-billy_tsai@aspeedtech.com> <20210426204333.gzqke6td33dtugnh@pengutronix.de> MIME-Version: 1.0 In-Reply-To: X-SA-Exim-Connect-IP: 2001:67c:670:100:1d::c0 X-SA-Exim-Mail-From: ukl@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-arm-kernel@lists.infradead.org X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210502_232356_448436_651D9283 X-CRM114-Status: GOOD ( 17.51 ) 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: , Content-Type: multipart/mixed; boundary="===============5017198685076848174==" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org --===============5017198685076848174== Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="5y5vjbuhxw63o4ix" Content-Disposition: inline --5y5vjbuhxw63o4ix Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hello, your second reply is nearly identical to the first. It would be helpful to only write new stuff in new mail. I think there is only a single new paragraph that I will reply to here. On Mon, May 03, 2021 at 05:57:23AM +0000, Billy Tsai wrote: > On 2021/4/27, 4:44 AM,Uwe Kleine-K=C3=B6nigwrote: > > Also please round down in the division to never provide a duty_cycle > > bigger than the requested vaule. Also you have to use the actually = used > > period as divider, not state->period. >=20 > I don=E2=80=99t think that I should use the actually used period as divid= er.=20 > The state->duty_cycle is relative with state->period, not the actual peri= od > if I use the actual period the precision of the duty cycle may lose. The strategy you should implement in .apply() is: Pick the biggest period that is not bigger than the requested period. With that period pick the biggest duty_cycle that is not bigger than the requested duty_cycle. As the actual period might be smaller than state->period, dividing by the latter yields a result that might be too small. See commit 8035e6c66a5e98f098edf7441667de74affb4e78 (currently in next) for a similar example. Best regards Uwe --=20 Pengutronix e.K. | Uwe Kleine-K=C3=B6nig = | Industrial Linux Solutions | https://www.pengutronix.de/ | --5y5vjbuhxw63o4ix Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAABCgAdFiEEfnIqFpAYrP8+dKQLwfwUeK3K7AkFAmCPluYACgkQwfwUeK3K 7AmNUQf/RU+MvNyHvcNs7PNM65vJmNt/GqO+QIvkMt2Jt09HQxMESc4nGb/eyxiO GgV+XttkbD8Y1pxQH9zC2JrqvHyZYBRsQGQ+rUK7zpa2/Svh4QZtXlD1RXC6xUPu idFpx1NMNVAKqhZcmoVAoA4RibtH6hOeCoup0CHz92MnBI+n6hCffNH6mTYlP9jQ rHj+NzkQWF2Le0lAfxV/GG52BDl9GyB9vuvgYFoLs8L+sLooYFtxYIT7a6fiXcA/ KqZwcHutRaQTt/HDItgVukV9+nMEbQuNKxix1Jqa7gxbF+2bA4Sqm5JXLhD0J+LD J+dG3SrAbDKUgrzurGN30sY+rZKrBA== =/bfj -----END PGP SIGNATURE----- --5y5vjbuhxw63o4ix-- --===============5017198685076848174== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel --===============5017198685076848174==--