Received: by 2002:a05:6358:a55:b0:ec:fcf4:3ecf with SMTP id 21csp4544153rwb; Tue, 17 Jan 2023 02:10:35 -0800 (PST) X-Google-Smtp-Source: AMrXdXu76c5NRPtqPII60G06uzrEMoXHc4eE7Gr2lhKxjfOHSZoRz8Vec6MGxoBOTxUlb8yd+DYZ X-Received: by 2002:a17:90a:d344:b0:229:4b4f:99e7 with SMTP id i4-20020a17090ad34400b002294b4f99e7mr2944919pjx.16.1673950235524; Tue, 17 Jan 2023 02:10:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673950235; cv=none; d=google.com; s=arc-20160816; b=Mn9Tkkbx797N0DU5lCHcJEjpl5AiR9wRIaVGH5KmPYL/MHeiVP139zXz83hUWFEAP+ 7X9KT/JzjABzXSdgO84X5nEz482wK0MNDjRUqcneudbQul9Qsj/YhlWTOU8Rkh3I/RuH QNy9k/d2QvKc9H7xs5ucOygDcTvGNq7V7iVgopeTg7uknW3xVDE0diz3t0rTG0Jp1USU 5sZr/yXUC7o8mgFdXrE2fF+n3EhMz+ckgLOJcaf+hZXeSF32bFs+UVXeKcF25ta5aSrn BZ/sacksiLI/L08plK/bU/Wj5kxR1fgATEG1L0coWSxh2O7pxKI6cisysL/IBcMHGaXc RjIA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=FV9nUVm/3W8S9XiP51zEd4Rl44Fcj8LLaPZ2bVwALNE=; b=MWDzGyGOHMdU/PiB5bO1O0q7mm/24ef/ExXYuL73Fp0pKcyoBo0zLSmKgTqY4lh5bC R0CniKV+2dKHmB6GwhTsp5FCuSVHAcQ1mMzsLrc9SflFwEJrU6zYHH7/mQzTw3/4OZL+ opoFMRS4uNCs3vn5XhSmUuBm9m4n/DlPWz5UgZ7Yx0uvbeo5m4OLAdF1YwwWNUpLI0Td aOUAScggiqmV5NxFP5BucS2gshaLuNN0oyQWwCIqWz3MluyKJQqW3cJgtfw8KNj4UAR5 J5tgOUZXMHGq75Y0pEuyY5cZLHFxkh2cNT3+bhuHhrf3m4rcBnuNHa8/7j5J9vCw1bKC Om/A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sifive.com header.s=google header.b=T7CgfJmn; 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 pi1-20020a17090b1e4100b002298afc963asi3779891pjb.189.2023.01.17.02.10.29; Tue, 17 Jan 2023 02:10:35 -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; dkim=pass header.i=@sifive.com header.s=google header.b=T7CgfJmn; 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 S236580AbjAQJec (ORCPT + 49 others); Tue, 17 Jan 2023 04:34:32 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33514 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236606AbjAQJdZ (ORCPT ); Tue, 17 Jan 2023 04:33:25 -0500 Received: from mail-yw1-x1131.google.com (mail-yw1-x1131.google.com [IPv6:2607:f8b0:4864:20::1131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3A81583C8 for ; Tue, 17 Jan 2023 01:32:53 -0800 (PST) Received: by mail-yw1-x1131.google.com with SMTP id 00721157ae682-4a263c4ddbaso415022677b3.0 for ; Tue, 17 Jan 2023 01:32:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sifive.com; s=google; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=FV9nUVm/3W8S9XiP51zEd4Rl44Fcj8LLaPZ2bVwALNE=; b=T7CgfJmnRp3JHN/VR2DJA2oyuzskW7ry7gryfRwHM6Kf/pwwm4aN3D/1fVDcakoMpK ZM61iW6f819f4/PK4wzG2DggDR51HP0ebzGUQ4vTirnJQe7A2oMZhVSG5XYet+V/h2LV WfhT4acFhTh8nE+ZDd6B3RVb+BayfTGynKysQbQ/dLmqKZeB5vCy4QAd0szmUVCHRXpE lsqFG/uqBqpzlOC9c6NeFSMCE71igtRKQD07+EUg9QTIZxXffJDoueOFknwpwkHtMw2+ E/UA9+4VZOl6daYFtUfDujEIosnxyBf8L3Ju+UTGh70rLPoMkV1yaatcF46Fy8KRdZNP 3X4Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=FV9nUVm/3W8S9XiP51zEd4Rl44Fcj8LLaPZ2bVwALNE=; b=YbUDKbYspa27GdNjmrT6fGVxpFAvWSi2x+r0o5dOgQdVhBj5IoIWcuPQo6TX4/WCCx IHWbLEhq3b6tzS2BDY+JJdm4GLCcTjEYpSuW3UGoFMMaxvzIB0FVxNbcUJ3k/3wcfkKs GzM51tsY3s3hxmxC5QRK2N1D+RJrc+cVNKjAh7Qpjbibwa3999pupOPFitLY9vczZHDD 02uCn7FlOibomMe00zGpqcfWSSS+oDRhiqGd9GklUwDz/tu9+jGPTL7zfBHVhqwQ66NP bOA3/V7jIJQ7ztsgN6z5aBD+CKkvymVhiREo+7rEmpBps3LOPvv+5Kr3FhinpbTNxpTp EoQw== X-Gm-Message-State: AFqh2kpDEI8SaTcE2AWgV/4iF2Llga3SwSWBwzslVqYh0RWdKAeYjYpC S7TvIjtM1xlHwkS9xQJ5Hez7z5TEOHkfZ+JMwZOrrw== X-Received: by 2002:a81:9b95:0:b0:3ea:9ce2:cd76 with SMTP id s143-20020a819b95000000b003ea9ce2cd76mr342335ywg.217.1673947972381; Tue, 17 Jan 2023 01:32:52 -0800 (PST) MIME-Version: 1.0 References: <20230113083115.2590-1-nylon.chen@sifive.com> <95F1EAA0-D8D6-4F8A-8049-5E7BFDE4C06C@jrtc27.com> In-Reply-To: <95F1EAA0-D8D6-4F8A-8049-5E7BFDE4C06C@jrtc27.com> From: Nylon Chen Date: Tue, 17 Jan 2023 17:32:40 +0800 Message-ID: Subject: Re: [PATCH 0/2] Change PWM-controlled LED pin active mode and algorithm To: Jessica Clarke Cc: Conor Dooley , Paul Walmsley , Palmer Dabbelt , Linux Kernel Mailing List , linux-riscv , nylon7717@gmail.com, zong.li@sifive.com, greentime.hu@sifive.com, vincent.chen@sifive.com, Thierry Reding , =?UTF-8?Q?Uwe_Kleine=2DK=C3=B6nig?= , linux-pwm@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, 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 Hi Conor, Jessica thanks for your reply. Jessica Clarke =E6=96=BC 2023=E5=B9=B41=E6=9C=8814=E6= =97=A5 =E9=80=B1=E5=85=AD =E4=B8=8A=E5=8D=883:24=E5=AF=AB=E9=81=93=EF=BC=9A > > On 13 Jan 2023, at 18:32, Conor Dooley wrote: > > > > +CC Uwe, Thierry, linux-pwm > > > > Hey Nylon, > > > > Please run scripts/get_maintainer.pl before sending patches, you missed > > both me & the PWM maintainers unfortunately! > > AFAIK, the PWM maintainers use patchwork, so you will probably have to > > resend this patchset so that it is on their radar. > > I've marked the series as "Changes Requested" on the RISC-V one. I got it. I will base it on get_maintainer.pl, re-sent it. > > > > On Fri, Jan 13, 2023 at 04:31:13PM +0800, Nylon Chen wrote: > > > >> According to the circuit diagram of User LEDs - RGB described in the > >> manual hifive-unmatched-schematics-v3.pdf[0]. > >> The behavior of PWM is acitve-high. > >> > >> According to the descriptionof PWM for pwmcmp in SiFive FU740-C000 > >> Manual[1]. > >> The pwm algorithm is (PW) pulse active time =3D (D) duty * (T) period= [2]. > >> The `frac` variable is pulse "inactive" time so we need to invert it. > >> > >> So this patchset removes active-low in DTS and adds reverse logic to > >> the driver. > >> > >> [0]:https://sifive-china.oss-cn-zhangjiakou.aliyuncs.com/HiFIve%20Unma= tched/hifive-unmatched-schematics-v3.pdf > >> [1]:https://sifive-china.oss-cn-zhangjiakou.aliyuncs.com/HiFIve%20Unma= tched/fu740-c000-manual-v1p2.pdf > >> [2]:https://en.wikipedia.org/wiki/Duty_cycle > > > > Please delete link 2, convert the other two to standard Link: tags and > > put this information in the dts patch. Possibly into the PWM patch too, > > depending on what the PWM maintainers think. I got it. I will fix it. > > This info should be in the commit history IMO and the commit message fo= r > > the dts patch says what's obvious from the diff without any explanation > > as to why. > > > > I did a bit of looking around on lore, to see if I could figure out > > why it was done like this in the first place, and I found: > > https://lore.kernel.org/linux-pwm/CAJ2_jOG2M03aLBgUOgGjWH9CUxq2aTG97eSX= 70=3DUaSbGCMMF_g@mail.gmail.com/ > > That DTS documentation makes no sense to me, why does what the LED is > wired to matter? Whether you have your transistor next to ground or > next to Vdd doesn=E2=80=99t matter, what matters is whether the transisto= r is > on or off. Maybe what they mean is whether the *PWM's output* / *the > transistor's input* is pulled to ground or Vdd? In which case the > property would indeed not apply here. > > Unless that=E2=80=99s written assuming the LED is wired directly to the P= WM, in > which case it would make sense, but that=E2=80=99s a very narrow-minded v= iew of > what the PWM output is (directly) driving. > > Jess > This is a HiFive Unmatched/Unleashed LED-PWM layout VDD | | _____ \ / LED \ / --- | | | ______ | | - | ^ --> |------ PWM |___|___| | | __ - GND - the waveform e.g. duty=3D30s, period=3D100s, actvie-high =3D 30%, active-low =3D 70% V ^ | | ----------| | | | | |______ |__________ > t When VCC is high, the LED will be illuminated, which is an active-high logic. This is why we need to remove "active-low". So, according to my understanding, Unleashed's DTS should also remove active-low. > > That doesn't explain the driver, but it does explain the dts being that > > way. Perhaps a Fixes tag is also in order? But only if both patches get > > one, otherwise backporting would lead to breakage. > > > > The min() construct appears to have been there since the RFC driver was > > first posted. > > > > Thanks, > > Conor. > > > >> > >> Nylon Chen (2): > >> riscv: dts: sifive unmatched: Remove PWM controlled LED's active-low > > > > nit: s/sifive unmatched:/sifive: unmatched:/ I got it. I will fix it. > > > >> properties > >> pwm: sifive: change the PWM controlled LED algorithm > >> > >> arch/riscv/boot/dts/sifive/hifive-unmatched-a00.dts | 4 ---- > >> drivers/pwm/pwm-sifive.c | 1 + > >> 2 files changed, 1 insertion(+), 4 deletions(-) > >> > >> -- > >> 2.36.1 > >> > >> > >> _______________________________________________ > >> linux-riscv mailing list > >> linux-riscv@lists.infradead.org > >> http://lists.infradead.org/mailman/listinfo/linux-riscv > > _______________________________________________ > > linux-riscv mailing list > > linux-riscv@lists.infradead.org > > http://lists.infradead.org/mailman/listinfo/linux-riscv >