From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from metis.whiteo.stw.pengutronix.de (metis.whiteo.stw.pengutronix.de [185.203.201.7]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2D10856461 for ; Mon, 26 Feb 2024 08:44:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.203.201.7 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708937067; cv=none; b=UY9DhtdEeL5rPJB/q6MSOPxchGSWB28y1DPThgrGGUBNRZSbXELDXX7rysaGhP2JtI8EqCxQ51gyf4T4ECWKuZORsWjz/20Qzz+gtKxZWHjql3iuHUcapbpVn6+FQKOL8dEN/Bliw9KzGiSQBaj8SuCiT8rrciNe6ZmPJr52Sk8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708937067; c=relaxed/simple; bh=14h6bEt9kyYrSJWXkUqMar7Y0aGg2X9iIPMlMIea9ZE=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=mpbIOOqjabJhd6m3wVdbUUxNYoY0uIv8DZwohvGphFqtqwyv3Pp02fzP8NHrMiSfCs6ti1sW/kxNCwbsxVhSrSDwP8rAx3z0CYcYMR/+V1rw6ap3WxIFP8Iry0l/0cF19QJhT0/gKysZzNR5WmPO9aFPhohELEZ+8dLoE8dBqUo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=pengutronix.de; spf=pass smtp.mailfrom=pengutronix.de; arc=none smtp.client-ip=185.203.201.7 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=pengutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=pengutronix.de Received: from drehscheibe.grey.stw.pengutronix.de ([2a0a:edc0:0:c01:1d::a2]) by metis.whiteo.stw.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1reWav-00043K-Bh; Mon, 26 Feb 2024 09:44:17 +0100 Received: from [2a0a:edc0:0:900:1d::77] (helo=ptz.office.stw.pengutronix.de) by drehscheibe.grey.stw.pengutronix.de with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1reWau-002xOT-CL; Mon, 26 Feb 2024 09:44:16 +0100 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.96) (envelope-from ) id 1reWau-00BVlo-0w; Mon, 26 Feb 2024 09:44:16 +0100 Date: Mon, 26 Feb 2024 09:44:16 +0100 From: Uwe =?utf-8?Q?Kleine-K=C3=B6nig?= To: Leif Middelschulte Cc: Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , NXP Linux Team , Leif Middelschulte , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-pwm@vger.kernel.org Subject: Re: [PATCH v4 1/2] pwm: imx27: fix race condition .apply,.get_state Message-ID: References: <20230906154215.4ikrrbx4xgx2nmu5@pengutronix.de> <20240224112902.55539-1-Leif.Middelschulte@gmail.com> Precedence: bulk X-Mailing-List: linux-pwm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="gx6q65kgn6hbj44y" Content-Disposition: inline In-Reply-To: <20240224112902.55539-1-Leif.Middelschulte@gmail.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.whiteo.stw.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-pwm@vger.kernel.org --gx6q65kgn6hbj44y Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hello, On Sat, Feb 24, 2024 at 12:29:00PM +0100, Leif Middelschulte wrote: > From: Leif Middelschulte >=20 > With CONFIG_PWM_DEBUG=3Dy after writing a value to the PWMSAR > register in .apply(), the register is read in .get_state(). > Unless a period completed in the meantime, this read yields the > previously used duty cycle configuration. As the PWM_DEBUG code > applies the read out configuration for testing purposes this > effectively undoes the intended effect by rewriting the previous > hardware state. >=20 > Note that this change merely implements a sensible heuristic. > The i.MX has a 4 slot FIFO to configure the duty cycle. This FIFO > cannot be read back in its entirety. The "write x then read back > x from hw" semantics are therefore not easily applicable. > With this change, the .get_state() function tries to wait for some > stabilization in the FIFO (empty state). In this state it keeps > applying the last value written to the sample register. >=20 > Signed-off-by: Leif Middelschulte Another few things I noticed only after replying to this patch and trying to apply #2: - Please make sure you have a S-o-b line for the sender (i.e. you with your gmail identity). - My reply to your klsmartin.com address couldn't be delivered, The MS mailserver told: "leif.middelschulte wasn't found at klsmartin.com." - Please start a new thread if you send a v5, as applying patches from a thread containing many patches is a bit less trivial. - Consider using git format-patch's --base parameter to document your patch base. Best regards Uwe --=20 Pengutronix e.K. | Uwe Kleine-K=F6nig | Industrial Linux Solutions | https://www.pengutronix.de/ | --gx6q65kgn6hbj44y Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAABCgAdFiEEP4GsaTp6HlmJrf7Tj4D7WH0S/k4FAmXcT18ACgkQj4D7WH0S /k5/1AgAsv7GIPFu33eJYqefznjKB5CWEDraqN7l2mBgZ1sW9MPtWm9AvON87WET 0az+MsQVtH4wN1BcZa+3SgKY+Q1r56+FOaD3Y3GUdkEvEvIWLK+EQppYooHMaacK IaS+hRJwoFqzrGjjzlqQRE5vXN0szSjgOn/zFYq0vfMsQohd8ibY+5SdtaBwfSlh bTPt5MnqBCfzMEG9r9MVwZrdyojy3/BSgeutK5AKZr1KWsNQ3pwDm4414ChL2tVw pjxRedvVYk6ThHO77XOxXzjrietgeh5D6Bg4r5wWwTrjENtK//h+843O8C0dCT6v QnBgwigIWpRgcen7zPGO7VfclV8pQg== =+JRg -----END PGP SIGNATURE----- --gx6q65kgn6hbj44y--