From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0FE44C001DB for ; Fri, 4 Aug 2023 09:13:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230178AbjHDJNe (ORCPT ); Fri, 4 Aug 2023 05:13:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59424 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230271AbjHDJNB (ORCPT ); Fri, 4 Aug 2023 05:13:01 -0400 Received: from esa.microchip.iphmx.com (esa.microchip.iphmx.com [68.232.153.233]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D0AE35593; Fri, 4 Aug 2023 02:10:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1691140207; x=1722676207; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=OU7g0r3M/XB9LzgVs7uLjBcYUCr80nlIE17NRVSfSeI=; b=NLiUML3tVpFmH5CrATbvGByH9lM1ZoGUMq1G3uopGd3bqFdnHX+lxkFn YGc/xRazVu6wKD961cqpqnKPaTcjKJMXJsP//py3R188alENAiP9B/Y9a QG+XIEaTJ223tbqpaVbWpMXfVPqEohSkY7JTzFZPhMMzhr5ahJhnO+mdF gdSfQexizj7tgjy42Lk4fjJViVDMoWqGI3qBpTdz6zXKySwmMaJMC7nDv 2mYM77er8oR8K25+WOrl+5W0fhZ49CPnNISVbjpddrTd14PF3p3u2fs4q qbMNfv8VWVAxSrSffSYbYxxq7V41OFWI4bCjkMSCElGawFaxoOPtBHajx w==; X-IronPort-AV: E=Sophos;i="6.01,254,1684825200"; d="asc'?scan'208";a="239780977" X-Amp-Result: UNKNOWN X-Amp-Original-Verdict: FILE UNKNOWN Received: from unknown (HELO email.microchip.com) ([170.129.1.10]) by esa1.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 04 Aug 2023 02:10:06 -0700 Received: from chn-vm-ex03.mchp-main.com (10.10.85.151) by chn-vm-ex04.mchp-main.com (10.10.85.152) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.21; Fri, 4 Aug 2023 02:10:06 -0700 Received: from wendy (10.10.115.15) by chn-vm-ex03.mchp-main.com (10.10.85.151) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.21 via Frontend Transport; Fri, 4 Aug 2023 02:10:03 -0700 Date: Fri, 4 Aug 2023 10:09:27 +0100 From: Conor Dooley To: Nylon Chen CC: , , , , , , , , , , , , , Subject: Re: [PATCH v4 0/1] Change PWM-controlled LED pin active mode and algorithm Message-ID: <20230804-jaundice-outpost-b8fbc9044e0d@wendy> References: <20230803085734.340-1-nylon.chen@sifive.com> <20230803-vehicular-leggings-2830239f818a@wendy> <20230803-caretaker-voicing-e982f2334067@wendy> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="drXNa9U6BVDiMxxh" Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --drXNa9U6BVDiMxxh Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Aug 04, 2023 at 02:54:33PM +0800, Nylon Chen wrote: > Hi Conor, >=20 > Thank you for patiently giving me advice. I appreciate your help. >=20 > Not long ago, I said, "This patch needs to be accompanied by > modifications to the pwm_sifive_apply() function to make sense." >=20 > I recently reviewed the v3 version, and after discussing it with Emil, > there are several areas that require modification. I will provide the > necessary changes for each of them: >=20 > 1. polarity check. (Suggestion from Uwe) > - if (state->polarity !=3D PWM_POLARITY_INVERSED) > + if (state->polarity !=3D PWM_POLARITY_NORMAL) > 2. avoid using old periodperiod, not state->period > - period =3D max(state->period, ddata->approx_period); > - frac =3D DIV64_U64_ROUND_CLOSEST(num, state->period); > + frac =3D DIV64_U64_ROUND_CLOSEST(num, period); > 3. add a conditional check can be added in the code to set > ddata->approx_period to state->period when state->period is smaller > than ddata->approx_period > if (state->period !=3D ddata->approx_period) { > ... > + if (state->period < ddata->approx_period) { > + ddata->approx_period =3D state->period; > + } > - ddata->approx_period =3D state->period; > + period =3D ddata->approx_period; >=20 > I will use 'unmatched' on my end to verify again. If there are any > other errors, feel free to point them out. Thank you. I'm not sure of the driver details without going and looking into the code itself, but this sounds like it makes a lot more sense than just flipping the polarity in the dts. Thanks for taking another look! --drXNa9U6BVDiMxxh Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iHUEABYIAB0WIQRh246EGq/8RLhDjO14tDGHoIJi0gUCZMzARwAKCRB4tDGHoIJi 0qDdAQCi6vcuaP29QFEGbJjRy3gSuS59BLhmOBTY1CNGgezTMQEA56t+2koBs6Of s0vx0OPO9U9ugfjxAQT1KVCC/BlxBQw= =fu/T -----END PGP SIGNATURE----- --drXNa9U6BVDiMxxh--