Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp5497580pxv; Wed, 21 Jul 2021 07:01:06 -0700 (PDT) X-Google-Smtp-Source: ABdhPJypZY+3uDzL9AnGtwcj/o/xa0nbQyVkpnRsnupNmYdTYyHtn32yOka6NKuasa+gvghA63s/ X-Received: by 2002:a05:6e02:2194:: with SMTP id j20mr24731898ila.108.1626876066746; Wed, 21 Jul 2021 07:01:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626876066; cv=none; d=google.com; s=arc-20160816; b=XbpluiR4uxDCdEF6giZMO6SX7WUIQm6kO8M8hDnS+X76a8qOO4QWHLGQK9oSzRQSjM LfOSYLbuZ9ctWHcRZHJ7bTmbTkG7imVwUZr7bmFeFISK7bEE2rcXayQVe1uuyoI9XdnB LJGSlW/clJUR2EreO6BkmaITQCODUndzVfAZ9oxzzb7PwbfqhRAYmDOBPAipg4D6Kq6+ J9CPDvU6ygV3FhwFcyPaus2w6NacsEkBM1m6LJNlUy879GQWI94CIl65irMJkGKut4p4 Y179FU3OmyhjFsuKoYkSRBoKHJfvMM76cY7bQtLlX2GP2NTz9u5UndX4vsTlyqdSa1QM wyhg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=YhGKiMvLflijXSrmxZUI0zkxs4yPgZa1KkbzjAiPrjk=; b=uWGpfWyVk85hFjN49teBFILLJ8KbOBn3XJX59giqpvB3WGNt8HPFu8U4GFx7XNiTWW 9sQvk+E7I8bVGaOpWO1USHkuBNUZc1LYb0+pFD3+sRc7YZkuvTyQCh/3/eItB2MoampY cN81rjErBYR9sP9DDHzWuOv+wYacMybbuQ0DPIuqDGurTKOFmKNXQyDDoj9vD5oXyLWZ ZnAz5HzfmwISyeVdmpVDy+Lp7Ejic/MhUBochjZE46NOnrrw7FdQR/EL+cKv66d4bPsB 8YYUgrCEtKUj9MJ/GL74g5Up6hf1ui12xtlqdMelJLTpmyf3OvZiaedKfDDz65LQCPsV DRGQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g17si25667937jaq.116.2021.07.21.07.00.52; Wed, 21 Jul 2021 07:01:06 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233165AbhGUMIt (ORCPT + 99 others); Wed, 21 Jul 2021 08:08:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60966 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231996AbhGUMIs (ORCPT ); Wed, 21 Jul 2021 08:08:48 -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 E45D9C061574 for ; Wed, 21 Jul 2021 05:49:24 -0700 (PDT) Received: from drehscheibe.grey.stw.pengutronix.de ([2a0a:edc0:0:c01:1d::a2]) by metis.ext.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1m6Bez-0005Rz-3Z; Wed, 21 Jul 2021 14:49:13 +0200 Received: from [2a0a:edc0:0:900:1d::77] (helo=ptz.office.stw.pengutronix.de) by drehscheibe.grey.stw.pengutronix.de with esmtp (Exim 4.92) (envelope-from ) id 1m6Bel-00009I-8O; Wed, 21 Jul 2021 14:48:59 +0200 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.92) (envelope-from ) id 1m6Bel-0000Yf-7G; Wed, 21 Jul 2021 14:48:59 +0200 Date: Wed, 21 Jul 2021 14:48:59 +0200 From: Uwe =?utf-8?Q?Kleine-K=C3=B6nig?= To: Billy Tsai Cc: "lee.jones@linaro.org" , "robh+dt@kernel.org" , "joel@jms.id.au" , "andrew@aj.id.au" , "thierry.reding@gmail.com" , "p.zabel@pengutronix.de" , "devicetree@vger.kernel.org" , "linux-arm-kernel@lists.infradead.org" , "linux-aspeed@lists.ozlabs.org" , "linux-kernel@vger.kernel.org" , "linux-pwm@vger.kernel.org" , BMC-SW Subject: Re: [v9 2/2] pwm: Add Aspeed ast2600 PWM support Message-ID: <20210721124859.clv6qlitbyomdz6s@pengutronix.de> References: <20210709065217.6153-1-billy_tsai@aspeedtech.com> <20210709065217.6153-3-billy_tsai@aspeedtech.com> <20210715150533.vppkw5oiomkxmfrn@pengutronix.de> <20210716070943.ayxkz2irkwhgincz@pengutronix.de> <20210716101301.l563tdwt5xuq5iq6@pengutronix.de> <3F12A498-DF5C-4954-8BCE-8C0C66BC9734@aspeedtech.com> <4BC9AEF6-31EA-4EDA-BCB2-7E4D44B6D5D2@aspeedtech.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="sh6jjxfikryciybj" Content-Disposition: inline In-Reply-To: <4BC9AEF6-31EA-4EDA-BCB2-7E4D44B6D5D2@aspeedtech.com> X-SA-Exim-Connect-IP: 2a0a:edc0:0:c01:1d::a2 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 --sh6jjxfikryciybj Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Jul 21, 2021 at 10:52:21AM +0000, Billy Tsai wrote: > Hi Uwe, >=20 > On 2021/7/16, 6:13 PM, "Uwe Kleine-K=F6nig" wrote: >=20 > On Fri, Jul 16, 2021 at 09:22:22AM +0000, Billy Tsai wrote: > >> On 2021/7/16, 3:10 PM, "Uwe Kleine-K=F6nig" wrote: > >>=20 > >> On Fri, Jul 16, 2021 at 01:48:20AM +0000, Billy Tsai wrote: > >> >> On 2021/7/15, 11:06 PM, "Uwe Kleine-K=F6nig" > wrote: > >> >> > Another is: The PWM doesn't support duty_cycle 0,= on such a request the > >> >> > PWM is disabled which results in a constant inact= ive level. > >> >>=20 > >> >> > (This is correct, is it? Or does it yield a const= ant 0 level?) > >> >>=20 > >> >> Our pwm can support duty_cycle 0 by unset CLK_ENABLE. > >>=20 > >> > This has a slightly different semantic though. Some cons= umer might > >> > expect that the following sequence: > >>=20 > >> > pwm_apply(mypwm, { .period =3D 10000, .duty_cycle =3D 10= 000, .enabled =3D true }) > >> > pwm_apply(mypwm, { .period =3D 10000, .duty_cycle =3D 0,= .enabled =3D true }) > >> > pwm_apply(mypwm, { .period =3D 10000, .duty_cycle =3D 10= 000, .enabled =3D true }) > >>=20 > >> > results in the output being low for an integer multiple = of 10 =B5s. This > >> > isn't given with setting CLK_ENABLE to zero, is it? (I d= idn't recheck, > >> > if the PWM doesn't complete periods on reconfiguration t= his doesn't > >> > matter much though.) > >> Thanks for the explanation. > >> Our hardware actually can only support duty from 1/256 to 256/= 256. > >> For this situation I can do possible solution: > >> We can though change polarity to meet this requirement. Invers= e the pin and use > >> duty_cycle 100.=20 > >> But I think this is not a good solution for this problem right? >=20 > > If this doesn't result in more glitches that would be fine for = me. > > (Assuming it is documented good enough in the code to be > > understandable.) >=20 > > The polarity of our pwm controller will affect the duty cycle range: > > PWM_POLARITY_INVERSED : Support duty_cycle from 0% to 99% > > PWM_POLARITY_NORMAL: Support duty_cycle from 1% to 100% > > Dynamic change polarity will result in more glitches. Thus, this wi= ll become > > a trade-off between 100% and 0% duty_cycle support for user to use = our pwm device. > > I will document it and send next patch. >=20 > For handling the situation that the user want to set the duty cycle to 0%= , the driver can: > 1. Just return the error. > 2. Use the minimum duty cycle value. > I don't know which solution will be the better way or others. > I would be grateful if you can give me some suggestion about this problem. I thought if you disable the PWM it emits the inactive level? Then this is the best you can do if duty_cycle =3D 0 is requested. Best regards Uwe --=20 Pengutronix e.K. | Uwe Kleine-K=F6nig | Industrial Linux Solutions | https://www.pengutronix.de/ | --sh6jjxfikryciybj Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAABCgAdFiEEfnIqFpAYrP8+dKQLwfwUeK3K7AkFAmD4F7gACgkQwfwUeK3K 7AkJmQgAnqDb+O4do8MRPO90e+3qhwE2WBmoUv3JcNTC4u/KvdJlWCq1JvKmGjAs L5nbyWsMVXT9A6Ry1xVvDH5jIVd9kpLns5ApiyURH94FUZR/wG9BfpaLdSDwzLzM W8WOr3c5Dcq9D/2j0cZ5xcjcg4kC31NkCkEL9U4dBYY+8XQ3f5zkKQgLzvJiEgSV P43lIjEFxmkZLZ2p+EWTMDK+fxYq6GXTcjLY+zVbmLh3S7kcTrf9ccSGS4tb8Xha oytit4cw0uUZ8tGk1dLSMysNexb/6p/QKfC5XSe7vshfobkDryGZUa9UQT4GmqTU h4V6Sk4tjTVpfnBEWUL5fadiMoc/nQ== =bCmv -----END PGP SIGNATURE----- --sh6jjxfikryciybj--