Received: by 2002:a05:6a10:17d3:0:0:0:0 with SMTP id hz19csp1297268pxb; Sat, 17 Apr 2021 12:59:43 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxMyQgeY+phWCuRm5Z+DfNnca1KtZLxCkuF9Z1OEuTs8OWUFJ82V9jj1KC6dwK9qt4ovIRx X-Received: by 2002:a05:6402:c7:: with SMTP id i7mr17136548edu.33.1618689583577; Sat, 17 Apr 2021 12:59:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1618689583; cv=none; d=google.com; s=arc-20160816; b=Meq9W8qvdC4GXYwFzpBLDjjm4pnVH2mU61KatZNAfapsAxsd8tgiPFqRtEls7sHagL V4o2fbrxkUloa22sVzORqBrrqJBFQbGXa01iBBSqwzkqaFtSJ2NF+xhugxFicVOfxDpF ox56XBV2qVLX0sJ9qmDKTRe+c4vvFWB1iCOiEOb+WdTfaOE1p/b937ucp8wdiMCofD4e WOosSbIcd/0QjzpDJn4stsKL4M9qFWbF5tAgk45i6D/qMCiUF0vos1ROS/NnCbQP8kTD WEnCugfXU5DsDkeULUhl092G4JkTo2WTBvoOdRtqk5UXxf5Tv0ft3fIDaI45SJRzmQBS rUGQ== 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=POBHZS9cjTsoMLH2qvbCDlIGZ/iGhm/MQtAbbgyxZ/Q=; b=ai17oOMHF1UYw2CBDJFHN1IQBEPbqa0MIINv2e6ZnvEsQ6AAm3mDtvyy6HBfgi96J8 S2mzCEDy1Gwsj4aK9J/YtxXv5lCiMsIAKzpPRvwZmM0dAAV/ii0VTyJ6WTelXkDDI0E2 /2yM10tqBxf1ysjc318hq74+MJhFwmz7unTpioRwMRm0avCBrEzNV0giSTH94EAbTVUC png9dPua9092NOlKIemqKiMGMMlyVZ3aYsxtyD9w4Q1tpC0LUzJ9EKj8WIo7bqZZZB+x W3CckY7FjQp6pBUjmV7xvS6vl3TgFOWWox9QJxxUiWf5gkH4HqqoY5zhTeUvnwmyE8Yb Xn6w== 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 w4si3231064edc.281.2021.04.17.12.59.20; Sat, 17 Apr 2021 12:59:43 -0700 (PDT) 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 S237044AbhDQT6X (ORCPT + 99 others); Sat, 17 Apr 2021 15:58:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33354 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236718AbhDQT6W (ORCPT ); Sat, 17 Apr 2021 15:58:22 -0400 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 0B9A1C061574 for ; Sat, 17 Apr 2021 12:57:56 -0700 (PDT) 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 1lXr4i-0007NH-2p; Sat, 17 Apr 2021 21:57:52 +0200 Received: from ukl by ptx.hi.pengutronix.de with local (Exim 4.92) (envelope-from ) id 1lXr4h-0003WW-G4; Sat, 17 Apr 2021 21:57:51 +0200 Date: Sat, 17 Apr 2021 21:57:51 +0200 From: Uwe =?utf-8?Q?Kleine-K=C3=B6nig?= To: Clemens Gruber Cc: linux-pwm@vger.kernel.org, Thierry Reding , Sven Van Asbroeck , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v9 2/8] pwm: pca9685: Support hardware readout Message-ID: <20210417195751.fmp23yalcrra5dtw@pengutronix.de> References: <20210415121455.39536-1-clemens.gruber@pqgruber.com> <20210415121455.39536-2-clemens.gruber@pqgruber.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="bvswtb7ux4j5wzkh" Content-Disposition: inline In-Reply-To: <20210415121455.39536-2-clemens.gruber@pqgruber.com> 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 --bvswtb7ux4j5wzkh Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hello, On Thu, Apr 15, 2021 at 02:14:49PM +0200, Clemens Gruber wrote: > Implement .get_state to read-out the current hardware state. >=20 > The hardware readout may return slightly different values than those > that were set in apply due to the limited range of possible prescale and > counter register values. >=20 > Also note that although the datasheet mentions 200 Hz as default > frequency when using the internal 25 MHz oscillator, the calculated > period from the default prescaler register setting of 30 is 5079040ns. >=20 > Signed-off-by: Clemens Gruber > --- > Changes since v8: > - As we left the math in apply as-is, use DIV_ROUND_DOWN in get_state I first thought this was wrong, because .apply uses ROUND_CLOSEST for period and ROUND_UP for duty. But as the calculation for period is exact this doesn't matter and round-down is indeed correct here. Reviewed-by: Uwe Kleine-K=F6nig Thanks Uwe --=20 Pengutronix e.K. | Uwe Kleine-K=F6nig | Industrial Linux Solutions | https://www.pengutronix.de/ | --bvswtb7ux4j5wzkh Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAABCgAdFiEEfnIqFpAYrP8+dKQLwfwUeK3K7AkFAmB7PbwACgkQwfwUeK3K 7AlUqggAgTeCATxyERnv7ObYyikmsKMbhQlvlJqeaf7fOM8yEU8NLr3jXl6rhp0M LDiZ9AxudFXQu9Y8+CiTOPSeX01y3ZyQmqGy7EUgnPN0483QgSVPHni1GLIKlciN vqGoGhv13Gv5HOWKecgHgUCuiHWyg8Rukm5ntThRtCdYA88yaNkYqxWyzRnc5Owd H/Pigj4Jt5tAG5cqz2SriP413uGBsD9t97mHPG7pKhU9UckFTNdTC5auw/xFvp8W jvpzuVT5cOGV6hHF3e193atsiRhT/VQYfJeXMukY9iGZ4tIqIlT1klJHeJaRG6t6 StjYQHCsZmEV+1Exfkt8DOANlkMGMA== =KL41 -----END PGP SIGNATURE----- --bvswtb7ux4j5wzkh--