Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp514557rwr; Thu, 20 Apr 2023 02:37:36 -0700 (PDT) X-Google-Smtp-Source: AKy350YvyoJEUQaP8J5NKQ4IPQ20hUntpp6v3K0Eq7Bohi7YeERf5+nJq0hJKQyMzdRmPl4aZdgx X-Received: by 2002:a17:902:dac7:b0:1a6:9762:6eee with SMTP id q7-20020a170902dac700b001a697626eeemr1118369plx.40.1681983455959; Thu, 20 Apr 2023 02:37:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681983455; cv=none; d=google.com; s=arc-20160816; b=UfR7MV5WTITcSNsXCD0oeO/7MYBnYivx4RxOq4TRzElI00MV/pOHHYesAdqSz1DVxw FTY13j2Dzs0iQZdCeA+d20Zh8M0ca4uVuZWW3CrLfrq1pujBkpM9gKK/JUpCMwQYU4Gu kuWc6cAM1fOKuKrzvO37mmG3RYm7jVMTVJlxTe8KvF9ndpo5eb4m3mAFsFVnA5a8YahW xYzzmeUf+77d/KYVXQh2KR0HmbfPa0vXmZq0aUGWw3u1eS8cwxAXgZ0L48LW1DXOKZYE VWsKXzp3YA3pFvyvTDoO4m2/+yRKSJ5sHqWd7CdvsCvwVaTNpvtl/oaDMJtMI4cPP3o4 UTYw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=02xaOyihgmHWk8PXEKiM2D9tpDK72+IwxLY1vrHA/24=; b=SgvvWeWFXkDrmmlhfpoHDzn9Uf4qmsyMwcScVFiJRKrCvVA/yYBgMOcnY/yz+BWzDS fAg3/WXWJ1jwBeNBApBroAebr7QKim72QCR0jtGCeg/SLbh3sVc6UYSM+JhzomtlkFwY bLC3pZxvDQ+/OWGHbYfkL77FSKp7xxZ4Io1V6Y4mZWeeFyBNkx7l5yv+yA+Mqdqchz1/ iKBpdbm5IYLYSwTEStLonmXiYPXfXiJh18tinIJbtmQOnDydF3RPJLEM4h0B479iYPBF lE8P7sgj8vWH8kZDLRzFSD9cGC6PPra/f54ISXcKT7nSPrSXCqahCO7ymU08MQZEaIJg NAtA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sifive.com header.s=google header.b=iqhQj+Yv; 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=sifive.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h8-20020a170902680800b001a67ffb3546si1400598plk.231.2023.04.20.02.37.23; Thu, 20 Apr 2023 02:37:35 -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=@sifive.com header.s=google header.b=iqhQj+Yv; 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=sifive.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234017AbjDTJfJ (ORCPT + 99 others); Thu, 20 Apr 2023 05:35:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49868 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234188AbjDTJfG (ORCPT ); Thu, 20 Apr 2023 05:35:06 -0400 Received: from mail-pf1-x42c.google.com (mail-pf1-x42c.google.com [IPv6:2607:f8b0:4864:20::42c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4FF46FC for ; Thu, 20 Apr 2023 02:35:04 -0700 (PDT) Received: by mail-pf1-x42c.google.com with SMTP id d2e1a72fcca58-63b57c49c4cso728064b3a.3 for ; Thu, 20 Apr 2023 02:35:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sifive.com; s=google; t=1681983304; x=1684575304; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=02xaOyihgmHWk8PXEKiM2D9tpDK72+IwxLY1vrHA/24=; b=iqhQj+YvmgYUadoSx8Q38GJdBLIgRvHSHPqXOVMYrfAEXM3+fTnPvbPtwbJROMhBFi 9QdybdFqhOqIbMcRM/76IE7KMIIBWw/qViOquAwi7f5sOo1Tq/rMlZM6cAI3mUt87K1r j/WH3J/AqFmBek6kgmo1rJ3yDFpFZDb65D85mPBlgwQJUSNSB5v3eTvYxM2qYvVVON5d MHUZxVuxKGaW57X5k6m2yX0+tcz/5TNL1hhY3JbXMVEYGTjGAl/4jdNyZZnbESCqsPzC UXMDa6bPAYqLTIKW5AwbFR7qFgkC7MQdcFumLTv9Fk6r3srnRhaBEd5I9eTW221l2w3G flWQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1681983304; x=1684575304; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=02xaOyihgmHWk8PXEKiM2D9tpDK72+IwxLY1vrHA/24=; b=CP/cTKhFG35BKk0DMtqylmkcDEzAyxgNQSyIlixOL6e40Gn1gMEuKsVuOGT4MYYcHe Z3plNCBCeiIA6LvOyHUwSyFvzKVaxvK7MSItK43GhPUH2aMHs4uAxxztX1xmL75d1w0i b7gWK+SZYjs/XwIsWAVrKHGL7ea60J0bZqYuSP7mrF1Bj9biyi6opgOIKeZEAf2uCp1z XSBrBlw28wouMW10xE197VVIpzl5CuD35F0AmlLxkMbWpWo4nbdv3RWDC1aNzI/i60J3 ia4CKuiTZb4iu8QOJgQwzc5kYd98K7VxVnXXJYoJpCkISckrkydeWQDT/xOMcvbxZcSQ brpA== X-Gm-Message-State: AAQBX9flhhfIZjHVEUNA3rQE4/CwcKftebLwA+vfSgS9a+SKlh1VKeqF R6eGuw+UE0uu4tAx3uT2HGc1bA== X-Received: by 2002:a05:6a21:1518:b0:ef:53b5:fa01 with SMTP id nq24-20020a056a21151800b000ef53b5fa01mr1066780pzb.49.1681983303722; Thu, 20 Apr 2023 02:35:03 -0700 (PDT) Received: from hsinchu15.internal.sifive.com (59-124-168-89.hinet-ip.hinet.net. [59.124.168.89]) by smtp.gmail.com with ESMTPSA id p5-20020a63c145000000b0051ba9d772f9sm781551pgi.59.2023.04.20.02.35.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 Apr 2023 02:35:03 -0700 (PDT) From: Nylon Chen To: aou@eecs.berkeley.edu, conor@kernel.org, emil.renner.berthing@canonical.com, geert+renesas@glider.be, heiko@sntech.de, krzysztof.kozlowski+dt@linaro.org, palmer@dabbelt.com, paul.walmsley@sifive.com, robh+dt@kernel.org, thierry.reding@gmail.com, u.kleine-koenig@pengutronix.de, devicetree@vger.kernel.org, linux-pwm@vger.kernel.org, linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org Cc: nylon.chen@sifive.com, nylon7717@gmail.com, zong.li@sifive.com, greentime.hu@sifive.com, vincent.chen@sifive.com Subject: [PATCH v3 0/2] Change PWM-controlled LED pin active mode and algorithm Date: Thu, 20 Apr 2023 17:34:55 +0800 Message-Id: <20230420093457.18936-1-nylon.chen@sifive.com> X-Mailer: git-send-email 2.40.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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,T_SCC_BODY_TEXT_LINE autolearn=unavailable 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 According to the circuit diagram of User LEDs - RGB described in the manual hifive-unleashed-a00.pdf[0] and hifive-unmatched-schematics-v3.pdf[1]. The behavior of PWM is acitve-high. According to the descriptionof PWM for pwmcmp in SiFive FU740-C000 Manual[2]. The pwm algorithm is (PW) pulse active time = (D) duty * (T) period. 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. Updated patches: 2 New patches: (none) Unchanged patches: 1 Links: - [0]: https://sifive.cdn.prismic.io/sifive/c52a8e32-05ce-4aaf-95c8-7bf8453f8698_hifive-unleashed-a00-schematics-1.pdf - [1]: https://sifive.cdn.prismic.io/sifive/6a06d6c0-6e66-49b5-8e9e-e68ce76f4192_hifive-unmatched-schematics-v3.pdf - [2]: https://sifive.cdn.prismic.io/sifive/1a82e600-1f93-4f41-b2d8-86ed8b16acba_fu740-c000-manual-v1p6.pdf Changed in v3: - Convert the reference link to standard link. - Move the inverted function before taking the minimum value. - Change polarity check condition(high and low). - Pick the biggest period length possible that is not bigger than the requested period. Changed in v2: - Convert the reference link to standard link. - Fix typo: s/sifive unmatched:/sifive: unmatched:/. - Remove active-low from hifive-unleashed-a00.dts. - Include this reference link in the dts and pwm commit messages. Nylon Chen (2): riscv: dts: sifive: unleashed/unmatched: Remove PWM controlled LED's active-low properties pwm: sifive: change the PWM controlled LED algorithm arch/riscv/boot/dts/sifive/hifive-unleashed-a00.dts | 4 ---- arch/riscv/boot/dts/sifive/hifive-unmatched-a00.dts | 4 ---- drivers/pwm/pwm-sifive.c | 9 ++++++--- 3 files changed, 6 insertions(+), 11 deletions(-) -- 2.40.0