Received: by 2002:a05:6358:700f:b0:131:369:b2a3 with SMTP id 15csp3296722rwo; Fri, 4 Aug 2023 02:36:19 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEP1UCKgs/eg96E4j3HOeUrvHErcdXE6q6B16ndU6KjG0stfL3fsLDUxP2RlTCwNKiNuAk1 X-Received: by 2002:a17:902:f809:b0:1b8:76fc:5bf6 with SMTP id ix9-20020a170902f80900b001b876fc5bf6mr1111541plb.43.1691141779236; Fri, 04 Aug 2023 02:36:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691141779; cv=none; d=google.com; s=arc-20160816; b=foHAh7tZrYihoPu4uFXfwPlTqaGlKhXykxEeuTz+b+FfBR/WErUHagRsvGx/boifN0 Hp51LF77ygUqP8l8O2AHz+N6B4zi0c94aENE2q7zV5JqTtKb+oj6iqys0hfye6ZhlUBf 9pVoQKYtG6SQJrwSlcu4TfW23gj3OfrQRFV6R0JcCS9yQIx+ye5fNVq56UtjkZ5gK5lG K7eIQn6MdXG+Eo5YGj5EvV7khBMJKO/DuOoP0kVQnb6GWDtGoOTYHUBZtRHjPIS2J6kH Q8Dzm8xivsazChYQTScvyTI0aa4sAh1wV7nKjRoZ2ZT3pMKiDsmDu9IFBFXJfHCHd4fJ U94g== 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:dkim-signature; bh=nw5+/JxpGVNWYBikvHS/WSGFFtXWD1uPMXYFJbgrFIE=; fh=GfG2raAahlW7M7ya4HTNhdKMGt9PDofZhqAzqhr/j7I=; b=IMnM2f60PPFTXLO6iTYJd5IJWuv9ToeqJPoyK2PQnaUF1IGS9TRFMeVnNxZ97KGkpm KML6m1ut+g59w5XetQgkgZLR2SZmluP79r3nkIU3FHO0Aoxgn4p/z/KVrGmZYLTu6hto RrIXoiYAxvtUI0+Ay6Smx2l+EGq9RUfZYdRcK+cNbCAyvL/xGfItFBtHaeIeT+IPE9sJ JLHB1X/1b9dFr0Px+pNxlWwpRU/Kzuv38gSEWH98h68VSFmyFEogbNZJhlZ8hO0JkHR0 JtNIT0uqdbL3u3rW+jwJLBw1KUekWePn2Tm9OIOq/uczJ9NaSvsh3Ev7lKquEHTdW40C /jUQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microchip.com header.s=mchp header.b=NLiUML3t; 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; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=microchip.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s13-20020a170902ea0d00b001b811261289si1524829plg.482.2023.08.04.02.36.06; Fri, 04 Aug 2023 02:36:19 -0700 (PDT) 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; dkim=pass header.i=@microchip.com header.s=mchp header.b=NLiUML3t; 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; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=microchip.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230149AbjHDJNc (ORCPT + 99 others); Fri, 4 Aug 2023 05:13:32 -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: X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, RCVD_IN_MSPIKE_H5,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS,SPF_NONE, URIBL_BLOCKED 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 --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--