Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp6327356rwb; Mon, 5 Dec 2022 10:41:49 -0800 (PST) X-Google-Smtp-Source: AA0mqf5g4RVLO2UQF/izSBDfPGFGPQ0kPkfBJ9vt8Axfs86hfeKtZAU/mubmvU47E8vM2GscM7ri X-Received: by 2002:a17:906:6703:b0:7ae:5dd6:e62d with SMTP id a3-20020a170906670300b007ae5dd6e62dmr60178903ejp.518.1670265709517; Mon, 05 Dec 2022 10:41:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670265709; cv=none; d=google.com; s=arc-20160816; b=jv54vvdHuXuuI3xxkTTcz3InunFNZEM2a5kdZldS57avKnZIF/kX9h8Upvd56E385J oCRWuciBdmZ9wLiO8hCWNnHuXHlTw8Rhzp5wrfc7xauIyP4Mh5Iddoi+f0qhyMPEtQA7 lgr5+p9OiJWP5P3QYMdKQokurYhFGgW1GDTDDjQV6FUdWfZVwNjMgsnsCbO37wCC1rUI oMSkioEiwcdx6TfhczWZa7PfAmcUT8Ubfdl2QQZ8wmwbhzadgjNbh5eSZQ8ZUHO+5lIz /iz6pvIaFav/0friVDeiLxndmos6AKIebVxSZCnro5dg4TA3HbifXfeOi68QTt/HIuYB kOpQ== 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=3JwivHpYyoFxhiiSyK0kJiLlaaDhohDnlnruRlOot2I=; b=IKm8Shttwt1fJs6ocCOX5oQ0jbUR9i93QRHattBAzETsnRJd+9gYjgtWgC52chVsiR i3y5Uvj8ruae7SOFBKfghLi2/wPF99/xfXzzW0+bbfv9syCSy213+fgx7zPmgDLBd+9O lzOFE8r/vsSzTkv181ht2+zYlWBXQfUz35ddez1KYhpbUKAB+het4uYNeRhc/oShsfEA 6BnV4lbnPpH9jylfz063IOFgwmAaTa1KQoomAZuMLJCd4Ac6keigW0c0pZ6uJre3k0OT Ix2EaoT5xwJUToMVmaUCI4vlrEZQehf7MD4Eym9rJN9QKz9l4t0FDilIxmsTnpvfp+xk BB9A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id nd17-20020a170907629100b0078e15c30a6csi12502732ejc.559.2022.12.05.10.41.30; Mon, 05 Dec 2022 10:41:49 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231349AbiLESOD (ORCPT + 81 others); Mon, 5 Dec 2022 13:14:03 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59332 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229891AbiLESOB (ORCPT ); Mon, 5 Dec 2022 13:14:01 -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 5402CC30 for ; Mon, 5 Dec 2022 10:14:00 -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 1p2FyS-0002ph-5Y; Mon, 05 Dec 2022 19:13:52 +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 1p2FyO-002Wur-Ea; Mon, 05 Dec 2022 19:13:49 +0100 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.94.2) (envelope-from ) id 1p2FyO-002qP9-DL; Mon, 05 Dec 2022 19:13:48 +0100 Date: Mon, 5 Dec 2022 19:13:48 +0100 From: Uwe =?utf-8?Q?Kleine-K=C3=B6nig?= To: Conor Dooley Cc: Conor Dooley , Thierry Reding , Daire McNamara , linux-kernel@vger.kernel.org, linux-pwm@vger.kernel.org, linux-riscv@lists.infradead.org Subject: Re: [PATCH v12 1/2] pwm: add microchip soft ip corePWM driver Message-ID: <20221205181348.3bvugpjr7xgf6uk5@pengutronix.de> References: <20221117164950.cssukd63fywzuwua@pengutronix.de> <20221117210433.n5j7upqqksld42mu@pengutronix.de> <20221130103755.lhil2jaw3oufr2sf@pengutronix.de> <20221205160328.wn4rcs6uxuuaxftd@pengutronix.de> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="kjxhhs4q4yv2cfmm" Content-Disposition: inline In-Reply-To: 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=-2.6 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_LOW, SPF_HELO_NONE,SPF_PASS autolearn=ham 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 --kjxhhs4q4yv2cfmm Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hello Conor, On Mon, Dec 05, 2022 at 05:13:42PM +0000, Conor Dooley wrote: > Figured I was better off doing something quickly & asking rather than > polishing only to find out it was disliked ;) :-) > > - in .apply() check the current time, add the current period and store > > the result to ddata->updatetimestamp > > - in .get_state do: > > if (current_time >=3D ddata->updatetimestamp) > > process fine > > else: > > timeout (or wait until ddata->updatetimestamp?) > >=20 > > Actually I'd prefer to wait instead of -ETIMEOUT. >=20 > Prefer to wait in get_state() or in both it & apply()? Prefer to wait where it's necessary ... > Depending on how far away updatetimestamp is, would we still not want to > time out if it is going to be a long time, no? I'd prefer a slow but right value over a quick error. The sun4i driver has in its .apply(): /* We need a full period to elapse before disabling the channel. */ delay_us =3D DIV_ROUND_UP_ULL(cstate.period, NSEC_PER_USEC); if ((delay_us / 500) > MAX_UDELAY_MS) msleep(delay_us / 1000 + 1); else usleep_range(delay_us, delay_us * 2); so it's at least not new in general to have a waiting time in O(period). Best regards Uwe --=20 Pengutronix e.K. | Uwe Kleine-K=F6nig | Industrial Linux Solutions | https://www.pengutronix.de/ | --kjxhhs4q4yv2cfmm Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAABCgAdFiEEfnIqFpAYrP8+dKQLwfwUeK3K7AkFAmOONNkACgkQwfwUeK3K 7AmE2wgAk2sWVpLdReSy1pSzeYCZ6ioUVHCTzslq0tljPK15BnT/FAMYPMhSozRS I6ZEmm3iRyJ4TiOgFbUVYIpNIe4UUvrAA8kfQ5zViM3mKKL9zXdpRXaG+cQPwl+p RM8KE2Yzd9wJWFCwx951zMBGxCfIqj2I06vCnBbi2rbBUzZbMy5dzFiyw/IKaMiv u8ylSqijubQSOQQ7gsZbp2MqpZO2ZH1IAdFyCslAeIoIUo6I9UnGLJS0fYG6fmLX 2iMjTiml+SfLnob6YfDQiwTLv+WOOVPhDwmx0f/FCeugOftF5jyJyVIy+TJ9EB9m /c9nw3rglCUesb6zI6guMd7nlr5ZqQ== =OBsk -----END PGP SIGNATURE----- --kjxhhs4q4yv2cfmm--