Received: by 2002:a05:6a10:9afc:0:0:0:0 with SMTP id t28csp2271268pxm; Fri, 4 Mar 2022 12:48:18 -0800 (PST) X-Google-Smtp-Source: ABdhPJyHWPN2wt1tm08EWV3hWTORCCsSIIumahFN3CJl+HUAxoJaJwBzs4lcQ/OfHvgkG6sqwklG X-Received: by 2002:a17:903:234c:b0:151:9e66:c3b0 with SMTP id c12-20020a170903234c00b001519e66c3b0mr181758plh.46.1646426897945; Fri, 04 Mar 2022 12:48:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1646426897; cv=none; d=google.com; s=arc-20160816; b=iX0P7oCLSHgQIZgcZViGbAkCYytkBzwM/mAu02CPqnRuTLBu7sLMGFwg5fu4bY9sCG /1V4Aip3uWUSsMQmBdrDNd5JgQNzM9DRS2rIft33eYggp84BSnfdPZWhW28hNvOhQk/R pLT2EY2W+mAwIteI3DUH5hiir9xv3o+PSO/VpwPr5Vqh6R0U8Vnx7+0w/1H3WMEdBjte LQN2f/p0iksHofft0WPvwWA5PlhXUn1zXPNWBOwOw0VI2kVrlm7gNQnDZwdkkXPHo5oB M+jqcXyZsCTUx5NFXYu9ghRgOn+eDF194HCW6/cKIA7ekZ5N03Ro/E7s/GUP7q29uJ8Q q4Ew== 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=LWit6O6ZmQjwhbZpSSAbmInOPWg20W6acEmljLqg3mE=; b=TR9LYMEQa8pIKTAI3k6gQYWiDbSZtcvYeCiqSyX3wVT88/Q7QYjYojR8LgW1T88thK JPR73y+u+Vb37wduoNKbQIUTMku2UjYxhyMtBPus9wAGMbW/hrSygh49tbP48k8Z14IU 6pPQhPKX+Cz/mrMvua4TitzjWQs0qbarLnZHHjdf/nIG5K0zWTx/bj8tCnrGsHgihetC eoNou2Fg3+fjX8M8SZXzl3ztdN+IHvuGSVAv/zWMkNbYIRfdCoLmAvtQBxr+9/KUw8m/ E9hLXG61NPS9JZitnGgtl1NlmlWzmck5PHgTX+gcEaj/u8RsuPnDMLVUV9F9KLUgGOWs YNAg== ARC-Authentication-Results: i=1; mx.google.com; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id n75-20020a628f4e000000b004e1dc67eaa8si5553618pfd.306.2022.03.04.12.48.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 04 Mar 2022 12:48:17 -0800 (PST) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 63C0631E051; Fri, 4 Mar 2022 11:49:26 -0800 (PST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233166AbiCCV5k (ORCPT + 99 others); Thu, 3 Mar 2022 16:57:40 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33862 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230147AbiCCV5j (ORCPT ); Thu, 3 Mar 2022 16:57: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 5C63041612 for ; Thu, 3 Mar 2022 13:56:49 -0800 (PST) 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 1nPtRG-0006SQ-4Q; Thu, 03 Mar 2022 22:56:46 +0100 Received: from [2a0a:edc0:0:900:1d::77] (helo=ptz.office.stw.pengutronix.de) by drehscheibe.grey.stw.pengutronix.de with esmtp (Exim 4.94.2) (envelope-from ) id 1nPtRF-002UFJ-A5; Thu, 03 Mar 2022 22:56:44 +0100 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.94.2) (envelope-from ) id 1nPtRD-006n2H-UC; Thu, 03 Mar 2022 22:56:43 +0100 Date: Thu, 3 Mar 2022 22:56:40 +0100 From: Uwe =?utf-8?Q?Kleine-K=C3=B6nig?= To: Max Kellermann Cc: linux-pwm@vger.kernel.org, thierry.reding@gmail.com, lee.jones@linaro.org, linux-kernel@vger.kernel.org, andrey@lebedev.lt, stable@vger.kernel.org Subject: Re: [PATCH 3/3] pwm-sun4i: calculate the delay without rounding down to jiffies Message-ID: <20220303215640.m23yozioeqxvmlfc@pengutronix.de> References: <20220125123429.3490883-1-max.kellermann@gmail.com> <20220125123429.3490883-3-max.kellermann@gmail.com> <20220224165135.g4ufknd3alrhnfx3@pengutronix.de> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="jer5rcewuptdavq4" Content-Disposition: inline In-Reply-To: <20220224165135.g4ufknd3alrhnfx3@pengutronix.de> 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 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --jer5rcewuptdavq4 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, Feb 24, 2022 at 05:51:35PM +0100, Uwe Kleine-K=F6nig wrote: > On Tue, Jan 25, 2022 at 01:34:29PM +0100, Max Kellermann wrote: > > This fixes a problem that was supposed to be addressed by commit > > 6eefb79d6f5bc ("pwm: sun4i: Remove erroneous else branch") - backlight > > could not be switched off on some Allwinner A20. The commit was > > correct, but was not a reliable fix for the problem, which was timing > > related. > >=20 > > The real problem for the backlight switching problem was that sleeping > > for a full period did not work, because delay_us is always zero. > >=20 > > It is zero because the period (plus 1 microsecond) is rounded down to > > the next "jiffies", but the period is less than one jiffy. > >=20 > > On my Cubieboard 2, the period is 5ms, and 1 jiffy (at the default > > HZ=3D100) is 10ms, so nsecs_to_jiffies(10ms+1us)=3D0. > >=20 > > The roundtrip from nanoseconds to jiffies and back to microseconds is > > an unnecessary loss of precision; always rounding down (via > > nsecs_to_jiffies()) then causes the breakage. > >=20 > > This patch eliminates this roundtrip, and directly converts from > > nanoseconds to microseconds (for usleep_range()), using > > DIV_ROUND_UP_ULL() to force rounding up. This way, the sleep time is > > never zero, and after the sleep, we are guaranteed to be in a > > different period, and the device is ready for another control command > > for sure. > >=20 > > Cc: stable@vger.kernel.org > > Signed-off-by: Max Kellermann >=20 > Sounds reasonable >=20 > Acked-by; Uwe Kleine-K=F6nig /me had problems with is keyboard, the Shift-key didn't work and so I typed a ; instead a :. To make patchwork pick up my tag, I'll repeat it here: Acked-by: Uwe Kleine-K=F6nig Thanks Uwe --=20 Pengutronix e.K. | Uwe Kleine-K=F6nig | Industrial Linux Solutions | https://www.pengutronix.de/ | --jer5rcewuptdavq4 Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAABCgAdFiEEfnIqFpAYrP8+dKQLwfwUeK3K7AkFAmIhOZUACgkQwfwUeK3K 7AlIfgf9HeL94rE/TP4y8ECAlIoCb0eRRWZ4Zj1TM0SxRd1KtmcvQHx/jfivLc8H IVuljJbzUmrEKRTTXzSZ2Ptj4Lgs3jBYARTklK/lR+NTn9dI1AQyv2TK7Sf3S4fE ZESjVxH610fLuLTG8aVVCT3mN8PMb6V5RJfIZ1ee5/lyWWkzXWkvGvW89I8+vZYe ic93WQx9tKt93L8w8SAat/J6OhLhHVXHUSc0Ia/LBGpU6KDHCsaSj58W5G9bbF76 1/YKmMj636lZfN8ts7kNmHiwCsgwFbFqd/nPuRehyDITg1vBADDlPboyTk0KHf8h 7KT0qN1D2OIqm/ZeWWEpm1sszA5d7w== =DJyp -----END PGP SIGNATURE----- --jer5rcewuptdavq4--