Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp4230048pxb; Tue, 2 Mar 2021 09:41:43 -0800 (PST) X-Google-Smtp-Source: ABdhPJwfKStptJDGQmPz8OMHDHqFzGosRwUHtSi+CcOgUAJ+oVRn11vpRj80ucolyoFhxVRcqGir X-Received: by 2002:a17:906:706:: with SMTP id y6mr21801180ejb.274.1614706903297; Tue, 02 Mar 2021 09:41:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1614706903; cv=none; d=google.com; s=arc-20160816; b=oxklV5sIlHpM7qKfYP9V2VyuIdA0N5Jmuh5xPkcEFBQwUFzrFX8RyapOr55p9DlBlA DJ+3wSyqh6k0gGd48qi5Bq6GOK/wV6/qm4GLiSVMcdGRpgI03lqatHmu6lYGPms3/f+7 KdVzW4ua4LpNEtN7HQIFhG1Uj3ZH4ccWE93H3vOjqqfzmHa1WqFdKt97c+vRrv0r4O0l LsNtIWdCH4JSAEbP9aNJ8tAcVuRp+wnhy7CD0i4ueMq/NSxj1TAL5aFvqwaKnlkZDiFw iu+wlGa8Aaqp3967zlIRz0qbh2iWqxrVAmYj0Ji2HQrIycVc5ItknQNfw+NkknPdjtwL W1tA== 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=5pzi0wj5oYr8UieV1zvwsUMewap7kPTgGWQyiUBINvo=; b=IRYtxOGwvMRKVhqjO7IRjzuqeKRSw6krQ2Y3wfsTWmd0zMOtZHb0BMXCDxq3ZkgtnS DGBIl2krgBGts33s+5ZLt0a5CmLOeKFggvgW/fzpfYL9eVYedLCSHYZk9Cz8Ri2UC5aZ E15lkmA5YYHSpaC/gFvwO798e/7+dKvyF3MCwp7/zdA8QwvHrUuSpzYVpLV3BTDmDcwP +iwkaEHf1nLT4TiwhtYugM55QxZ7P2o3mzr/gXLEfqxA/IeAG1V9DLeqdONH3DKLHl88 Xp+iKA3w3SJGuHmb59wv/BWt17lFYns2kpz8FBGo355XTQnvimXpAGgZxCbU0Fu1zU1o vLwg== 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 q1si13421632edn.100.2021.03.02.09.41.19; Tue, 02 Mar 2021 09:41:43 -0800 (PST) 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 S1574982AbhCBDwN (ORCPT + 99 others); Mon, 1 Mar 2021 22:52:13 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49960 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244578AbhCAVxc (ORCPT ); Mon, 1 Mar 2021 16:53:32 -0500 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 058A2C06178A for ; Mon, 1 Mar 2021 13:52:51 -0800 (PST) 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 1lGqTA-0003uP-Ul; Mon, 01 Mar 2021 22:52:48 +0100 Received: from ukl by ptx.hi.pengutronix.de with local (Exim 4.92) (envelope-from ) id 1lGqTA-0000yM-Aq; Mon, 01 Mar 2021 22:52:48 +0100 Date: Mon, 1 Mar 2021 22:52:48 +0100 From: Uwe =?utf-8?Q?Kleine-K=C3=B6nig?= To: Clemens Gruber Cc: Sven Van Asbroeck , Thierry Reding , Linux Kernel Mailing List , linux-pwm@vger.kernel.org Subject: Re: [PATCH v5 2/7] pwm: pca9685: Support hardware readout Message-ID: <20210301215248.ekclgxc7dq6asdz5@pengutronix.de> References: <20210111203532.m3yvq6e5bcpjs7mc@pengutronix.de> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="gj4wfq3selp6pd7x" 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 --gj4wfq3selp6pd7x Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hello, On Mon, Feb 01, 2021 at 06:24:02PM +0100, Clemens Gruber wrote: > Hi Sven, Thierry, Uwe, >=20 > On Fri, Jan 29, 2021 at 05:16:51PM -0500, Sven Van Asbroeck wrote: > > Hi Clemens, > >=20 > > On Fri, Jan 29, 2021 at 4:24 PM Sven Van Asbroeck = wrote: > > > > > > LEN_ON =3D 409, LED_OFF =3D 1228 and > > > LED_ON =3D 419, LED_OFF =3D 1238 > > > produce the same result. you can't see the difference between the two > > > when scoping the channel. there are probably more ways to do this, > > > some might surprise us. It's a tricky chip. > >=20 > > Please ignore this example, it's bogus. In my defence, it's a Friday > > afternoon here :) >=20 > Happens to the best of us :) >=20 > >=20 > > But consider the following: imagine the bootloader has enabled a few > > pwm channels, and the driver's .probe() has left them on/unchanged. > > Then the user enables another pwm channel, and tries to change the > > period/prescaler. How would pca9685_may_change_prescaler() know > > if changing the prescaler is allowed? > >=20 > > And the following: imagine the bootloader has enabled a few > > pwm channels, and the driver's .probe() has left them on/unchanged. > > After .probe(), the runtime_pm will immediately put the chip to sleep, > > because it's unaware that some channels are alive. >=20 > (We could read out the state in .probe. If a pwm is already enabled by > the bootloader, then the user can't change the period. Also, the chip > would not be put to sleep. >=20 > The user then can export channels and see if they are enabled. If he > wants to change the period, he needs to find the one enabled by the > bootloader and change the period there, before he requests more. > If the bootloader enabled more than one, then he has to disable all but > one to change the period. >=20 > Or did I miss something?) >=20 > >=20 > > I'm sure I'm overlooking a few complications here. probe not changing > > the existing configuration, will add a lot of complexity to the driver. > > I'm not saying this is necessarily bad, just a tradeoff. Or, a manageme= nt > > decision. >=20 > But I agree that it is simpler if we keep the resets in probe. It would > also avoid a potentially breaking change for users that do not reset > their pca9685 chips in their bootloader code. I would prefer to drop the reset. If the bootloader left with an invalid state, this is active for sure until the PWM driver is loaded. If you don't reset, the time is extended (usually) until the consumer comes along and corrects the setting. So the downside of not resetting is quite limited, but if you disable the PWM in .probe() the effect can be worse. And consistency dictates to not reset. > Removing the resets could then be left as something to discuss further > in the future and something that belongs in a separate patch series? That would be fine for me, too. Best regards Uwe --=20 Pengutronix e.K. | Uwe Kleine-K=F6nig | Industrial Linux Solutions | https://www.pengutronix.de/ | --gj4wfq3selp6pd7x Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAABCgAdFiEEfnIqFpAYrP8+dKQLwfwUeK3K7AkFAmA9YiwACgkQwfwUeK3K 7AlgXwgAnzhuKRCBTL0mE5C8Cm2uGnKevigkpVEBf8j4eBCtBhp4/q5+3Gk6B1U+ 8ejxoyhnYh29dsZH5xHY/ud28aV1u3F6IP7TDRc/crSxR2JDWTa+2EqDnEI6/k9G eLdd1zwGJ/kM7A55JKz/fsIFy5ttO2m6Chno76A7btGGGxfPzsSMktszIiM8Q06z adB13RWo5H8eHIfnEox/2/s7KYDpHpRXAJEwKVXjezIsw6QqYEosV8L0u+LxGPSy 0EA+J1lrMfmb+Z1wqIy+orgCV6UIbseTqfauisL/JKuNf0iPa7mA2fpwuxJRM53D G8bHpMRHJjDqnnEBe4739grlLK+Xvw== =fR4v -----END PGP SIGNATURE----- --gj4wfq3selp6pd7x--