Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp3030139pxu; Tue, 8 Dec 2020 01:21:15 -0800 (PST) X-Google-Smtp-Source: ABdhPJxTwkCS8bLF36ALay8bRD1Bdf++zaK0O3iMw/1UKc/0IZCBlBr9pft4ZmWgNka3ID6MhQJI X-Received: by 2002:a17:906:a182:: with SMTP id s2mr21559086ejy.249.1607419275216; Tue, 08 Dec 2020 01:21:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1607419275; cv=none; d=google.com; s=arc-20160816; b=Qdk5K1WxqpTXK4a9R6ouJPBa40HyouLz3y2/1aJwuIUTpFKjbnHviGX9jBOO7yAbtL 8WGEhfDAixaqKa8P8F8BLKjPXtP1FKhGbyOEHNPtjrmItXmVs0NNmmywl5vse8/BIecv 2TaGDxESdKh3QerFqcI3dABWtpqYN/eajW32eJDznRRxLbHn9NA3JzDnogcvsV/HB3hi m39uyed3qV4fsyPOelN5WlrVCCin2CSAgQUJfOiuaP1X57XhU6unLcio+zTmnRdzaZrG xlZ4l2oKS5m89rMc8Fk8VdkOM53mQhE2LP5YH2uazbeqNZtTlK0yBqHInK5AO44zFwwG q8Yw== 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=cPgpnMfif0ZGEqyyi5uj4/MiHCnJxsJHmb/D+YYZLOI=; b=LA0idr+cpmhswWMsAdBZy0EG3gZKPJ8HPg9xqzqMivekeQUuFB//ZTmdKkmruc3Biz EkFAHzmpPrl0QrbgwEimHhwVFihyv4hOQj68gx36W0kMZvHM0NQ+1yx3AnaREMpye4ax pwIprtMUJJJzkg1qBlZz9gjkVR9klLZUESEDGlNK0+A8WdbsPlnQQUfw4dRHT69U5O8b DEPsS5xC4ER6S+XYH3wF4lYl6UgjyfbnxGkjAFM5l/+yoEKMtlWIHq7HBTXUb+bjUdC8 y0qgB8simIAScap34l3Tpxwy5K27BvtMF841Zw76MIQqR+4NbNVo5L2w+PEkySrfv77y IpKw== 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 k7si7979423ejg.677.2020.12.08.01.20.52; Tue, 08 Dec 2020 01:21:15 -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 S1728640AbgLHJSk (ORCPT + 99 others); Tue, 8 Dec 2020 04:18:40 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45840 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728617AbgLHJSj (ORCPT ); Tue, 8 Dec 2020 04:18:39 -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 E70B2C061794 for ; Tue, 8 Dec 2020 01:17:58 -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 1kmZ88-00038m-HV; Tue, 08 Dec 2020 10:17:56 +0100 Received: from ukl by ptx.hi.pengutronix.de with local (Exim 4.92) (envelope-from ) id 1kmZ87-0000ts-RK; Tue, 08 Dec 2020 10:17:55 +0100 Date: Tue, 8 Dec 2020 10:17:55 +0100 From: Uwe =?utf-8?Q?Kleine-K=C3=B6nig?= To: Sven Van Asbroeck Cc: Clemens Gruber , linux-pwm@vger.kernel.org, Thierry Reding , Lee Jones , Linux Kernel Mailing List , Mika Westerberg , David Jander Subject: Re: [PATCH v4 1/4] pwm: pca9685: Switch to atomic API Message-ID: <20201208091755.hzsjrvbvsaeeyu7j@pengutronix.de> References: <20201207193629.493241-1-clemens.gruber@pqgruber.com> <20201207220025.42b6g76wq7ph5nvb@pengutronix.de> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="w7erqnmdibsumirg" 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 --w7erqnmdibsumirg Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hello Sven, On Mon, Dec 07, 2020 at 05:34:58PM -0500, Sven Van Asbroeck wrote: > On Mon, Dec 7, 2020 at 5:00 PM Uwe Kleine-K=F6nig > wrote: > > > > This is not acceptable, if you have two PWM outputs and a consumer > > modifies one of them the other must change. So if this chip only > > supports a single period length of all channels, the first consumer > > enabling a channel defines the period to be used. All later consumers > > must live with that. (Also the first must be denied modifying the period > > if a second consumer has enabled its PWM.) >=20 > That makes sense. However, a possible wrinkle: when more than one pwm cha= nnel > is requested, which one is able to change the period? >=20 > Example: > 1. start with all pwms free > 2. pwm_request(0), pwm_apply(period=3D200Hz) > 3. pwm_request(1) > 4. pwm_apply(1, period=3D400Hz) fails? Yes, pwm_apply_state is supposed to fail here (Sidenote: period is measured in ns, not Hz) > 5. pwm_apply(0, period=3D400Hz) succeeds? This succeeds iff channel 1 isn't enabled. (Unless changing might change the polarity of pwm #1 even if disabled.) > And if (5) succeeds, then pwm_get_state(1) will still return period=3D200= Hz, > because the pwm core doesn't realize anything has changed. Are you ok > with this behaviour? "if (5) succeeds" implies channel 1 is disabled (it might otherwise have been enabled by the bootloader or a previous consumer). With that sorted out, I'm ok that pwm_get_state() reports .period=3D200Hz (or whatever other value) because it also reports .enabled =3D false which makes every interpretation of the other values in pwm_state (apart from =2Epolarity) moot. Best regards Uwe --=20 Pengutronix e.K. | Uwe Kleine-K=F6nig | Industrial Linux Solutions | https://www.pengutronix.de/ | --w7erqnmdibsumirg Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAABCgAdFiEEfnIqFpAYrP8+dKQLwfwUeK3K7AkFAl/PRMEACgkQwfwUeK3K 7AlKtwf9GTIu54y6Y9y21dtPvGrGeTZoFJW/gPIFrMnM5soegyUzbmttauya0GSW HZl1Mo5GaFxMjiNLfQmllwCJAQDqt9qOYczcUq8DDdBi0RUK8rO2dFJ5TFfCGhWj urttYRwEZuUBz9cZnG6CAI2hoSeC7mgn3VY4SDzG9J6AdmsjO/7w4hRBag+q4u8x wMlR1pMr1dVQxLk6TYUSHOV9ghKfvAjf5V37rIQHmGYI2MO4rqBaQJRjoCgWLQq6 rZI6LNbu6y5wQPSi+ptc5F7pJYQbkMtfHI2F3BQ1938kMU3pUMUh1tOy4XTkw22B ikfdwZNvbL2JTXh2P7tD72TIOIjQNw== =a93B -----END PGP SIGNATURE----- --w7erqnmdibsumirg--