Message ID | 20221022084737.1028-1-linux.amoon@gmail.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1134487wrr; Sat, 22 Oct 2022 03:07:27 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4vPKMWsIK2+z3X8th1rllpOCYugKbGKqupv1UN1jG1P00Z/O91KSl/hNQn5os376Bfe76D X-Received: by 2002:a17:907:a4e:b0:77d:94d:8148 with SMTP id be14-20020a1709070a4e00b0077d094d8148mr18724440ejc.607.1666433247033; Sat, 22 Oct 2022 03:07:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666433247; cv=none; d=google.com; s=arc-20160816; b=f/WrXMRGfZMBO1CtFJrmOfClf6zYzZzqfX68xtPDlwg2Hu6U6zcv61fgp2Dsm6z+yT PeQDg/JTkyI/Jzo5aKK1RMZqIWQ7IVCgjQwin40ZkJ2EhQlIRtGkD2F20MUJTQWOHITM YOd3mG/y9AyyWkhNFV+eZyWOB4IGMUBZL/ae7cZhpk/FFEfxc6SDZMSfLky/DavdCyxj 51eyBGEKojJsMDY9D19t4+9KTr5umWeWN6DeaJTufXnipwW/ezteM1hCyQ96q+NJhXO/ MtaRRsJVsS4aUfRLrdIAPr0g9xyFzpWfmBfYdCQGgCnaeG6eLiEqQPql5fCNohTF5czn vrUg== 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=weLbIcCNbVsHr1aN9+oDZ9csZQvS2rrHQIhJrGtb3xY=; b=j3HumN5Mu3bgohbfN4vYrPnwXWUjCLA9lAi6FWcGptTLWibqITMu2CkvBFDhXAuvIE 1xcSvQbK2Ycd6ldOHSrRB2wt5G8vG35dc9MGXGRyEy/bhIIyJ+3BfcSk/psbLn12KxjK DTSlAdnemnRLxxcxHagIC9tjo+MRSoMv7utCiXRtzlPumUP8eBRbRrgUdD8ptw3zgki9 u9waniiqCXDNmunqYxWeX6xn0GO09c7twBeapw3Ry5NbWSHAWsmVMDRszo6ItNi2ATfP 2v91RkD0o7C18qGY1AYyNPXmVKJ+Q0NVp9stE92aA9t76+hac2MYTF99TVeA+eU6YQfk haIA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=ZdhqrO8d; 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=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id hc35-20020a17090716a300b0078081036bdasi24897026ejc.501.2022.10.22.03.07.02; Sat, 22 Oct 2022 03:07:27 -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=@gmail.com header.s=20210112 header.b=ZdhqrO8d; 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=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229744AbiJVKE6 (ORCPT <rfc822;pwkd43@gmail.com> + 99 others); Sat, 22 Oct 2022 06:04:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37384 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230121AbiJVKEd (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Sat, 22 Oct 2022 06:04:33 -0400 Received: from mail-qv1-xf30.google.com (mail-qv1-xf30.google.com [IPv6:2607:f8b0:4864:20::f30]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C9ECE29C48B; Sat, 22 Oct 2022 02:20:31 -0700 (PDT) Received: by mail-qv1-xf30.google.com with SMTP id y10so3410426qvo.11; Sat, 22 Oct 2022 02:20:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=weLbIcCNbVsHr1aN9+oDZ9csZQvS2rrHQIhJrGtb3xY=; b=ZdhqrO8dUBRyrVmTSDjKjyupq7G+G+kVjVIz8irauY0guJaoETll1LdUIwOJfFCmca 28S01QR1hirbxyJViBW5U55IuOHMiXihd13MpBdIxY7B9uiAdjW0forCbIFmKI7Asw7V uzFD6M8splAU+GsKCmBY698w85NEwWSoCb3iGYOsqoXJqPDq4V+GcD7Eocr5Bkl/MaOM XSd4lUBoTkHefZUb0fPxlv33g1X39czbIo96ELLbLAkq8vns6+faSvUS4XSCrDhHMr+Q 1v10+vgpaCdGFQUvpqtf+xCqoHcgZ3El+k25SBSUfWmfNgJOR5EsUk+U9cSTfmEzxm8+ ojRA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=weLbIcCNbVsHr1aN9+oDZ9csZQvS2rrHQIhJrGtb3xY=; b=I3ZhNMm/4qp/xr8dd8Hry76uevZjrA4MN/cTG3LdsmAfykcfbttXF0/Y7kNigexCuF wgOHYOOJ5B8ILBXeK1SHyxqJQcRsTHFHAtMxsrIdKhqVNMxn2eTEsJf4q0JBKCNT6XtU 63dbJEGMIqyrmNuWx2ejm1Ghg2A6AJkENS+SriziTsy7wrJH4pw2xKkxtx19TE2MQ4v2 vAv/kojCb53xAzXAWuhZsE0fR/wOzJDSNP17ud+gEeUfLcDDhYYesHMB2xsLDrLNGhkV 2QXSynYrBCePvUyipVguchG2cttaTHU/v8X1cVPHXVgdOdkgZnK1QMQhE0UZ+Yw9L+19 rOVw== X-Gm-Message-State: ACrzQf0UBRIzuqFth4Ncmt82lT+HXDNgjG5bkWIqH6tdnN4wgb2eFyRP ctVmuxcF8Ur+ABrO5Y9YK6k1d9xAT74= X-Received: by 2002:a17:902:e80a:b0:184:6043:752d with SMTP id u10-20020a170902e80a00b001846043752dmr23163056plg.137.1666428479543; Sat, 22 Oct 2022 01:47:59 -0700 (PDT) Received: from localhost.localdomain ([103.51.72.20]) by smtp.gmail.com with ESMTPSA id s5-20020a625e05000000b005631f2b9ba2sm16843911pfb.14.2022.10.22.01.47.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 22 Oct 2022 01:47:58 -0700 (PDT) From: Anand Moon <linux.amoon@gmail.com> To: Rob Herring <robh+dt@kernel.org>, Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>, Neil Armstrong <neil.armstrong@linaro.org>, Kevin Hilman <khilman@baylibre.com>, Jerome Brunet <jbrunet@baylibre.com>, Martin Blumenstingl <martin.blumenstingl@googlemail.com> Cc: Anand Moon <linux.amoon@gmail.com>, Dan Johansen <strit@manjaro.org>, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-amlogic@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCHv3] arm64: dts: meson: Enable active coling using gpio-fan on Odroid N2/N2+ Date: Sat, 22 Oct 2022 08:47:34 +0000 Message-Id: <20221022084737.1028-1-linux.amoon@gmail.com> X-Mailer: git-send-email 2.38.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,FREEMAIL_FROM, 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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747381908164223429?= X-GMAIL-MSGID: =?utf-8?q?1747381908164223429?= |
Series |
[PATCHv3] arm64: dts: meson: Enable active coling using gpio-fan on Odroid N2/N2+
|
|
Commit Message
Anand Moon
Oct. 22, 2022, 8:47 a.m. UTC
Odroid N2/N2+ support active cooling via gpio-fan controller.
Add fan controls and tip point for cpu and ddr thermal sensor
on this boards. Drop bias-disable from set pwm_ao_d_10 the pin
as to allow transition from say pull-up to pull-down for on/off
of the fan.
Signed-off-by: Anand Moon <linux.amoon@gmail.com>
---
v2: changes tip name cpu-active --> ddr-active
v3: drop bias-disable for pwm_ao_d_10 pine.
---
.../boot/dts/amlogic/meson-g12-common.dtsi | 1 -
.../dts/amlogic/meson-g12b-odroid-n2.dtsi | 42 +++++++++++++++++++
2 files changed, 42 insertions(+), 1 deletion(-)
base-commit: 4da34b7d175dc99b8befebd69e96546c960d526c
Comments
Hi Anand, On Sat, Oct 22, 2022 at 10:48 AM Anand Moon <linux.amoon@gmail.com> wrote: > > Odroid N2/N2+ support active cooling via gpio-fan controller. > Add fan controls and tip point for cpu and ddr thermal sensor > on this boards. Drop bias-disable from set pwm_ao_d_10 the pin either use "on these boards" or "on this board" [...] > @@ -1982,7 +1982,6 @@ pwm_ao_d_10_pins: pwm-ao-d-10 { > mux { > groups = "pwm_ao_d_10"; > function = "pwm_ao_d"; > - bias-disable; &pwm_ao_d_10_pins is not referenced anywhere so it seems that this change has no impact on controlling the fan on Odroid-N2(+). How did you test this change? Best regards, Martin
Hi Martin, Thanks for your review comments.. On Sat, 22 Oct 2022 at 15:47, Martin Blumenstingl <martin.blumenstingl@googlemail.com> wrote: > > Hi Anand, > > On Sat, Oct 22, 2022 at 10:48 AM Anand Moon <linux.amoon@gmail.com> wrote: > > > > Odroid N2/N2+ support active cooling via gpio-fan controller. > > Add fan controls and tip point for cpu and ddr thermal sensor > > on this boards. Drop bias-disable from set pwm_ao_d_10 the pin > either use "on these boards" or "on this board" > > [...] > > @@ -1982,7 +1982,6 @@ pwm_ao_d_10_pins: pwm-ao-d-10 { > > mux { > > groups = "pwm_ao_d_10"; > > function = "pwm_ao_d"; > > - bias-disable; > &pwm_ao_d_10_pins is not referenced anywhere so it seems that this > change has no impact on controlling the fan on Odroid-N2(+). > How did you test this change? > Ok I felt these changes affect the behavior of the pinctrl * @PIN_CONFIG_BIAS_DISABLE: disable any pin bias on the pin, a * transition from say pull-up to pull-down implies that you disable * pull-up in the process, this setting disables all biasing. I mapped this is linked in pinctrl driver, pwm_ao_d_10_pins GPIOAO_10 see below [0] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/pinctrl/meson/pinctrl-meson-g12a.c?h=v6.1-rc1#n825 For testing, I tried to libgpio command to verify shown below, with this patch applied. $ gpioinfo .... gpiochip1 - 15 lines: line 0: unnamed unused input active-high line 1: unnamed unused input active-high line 2: unnamed "enable" output active-high [used] line 3: unnamed unused input active-high line 4: unnamed unused output active-high line 5: unnamed unused input active-high line 6: unnamed unused input active-high line 7: unnamed unused input active-high line 8: unnamed "regulator-tflash_vdd" output active-high [used] line 9: unnamed "TF_IO" output active-high [used] line 10: unnamed "gpio-fan" output active-high [used] line 11: unnamed "n2:blue" output active-high [used] line 12: unnamed unused input active-high line 13: unnamed unused input active-high line 14: unnamed unused input active-high $ cat /sys/kernel/debug/pinctrl/ff800000.sys-ctrl\:pinctrl@14-pinctrl-meson/pinmux-pins Pinmux settings per pin Format: pin (name): mux_owner gpio_owner hog? pin 0 (GPIOAO_0): ff803000.serial (GPIO UNCLAIMED) function uart_ao_a group uart_ao_a_tx pin 1 (GPIOAO_1): ff803000.serial (GPIO UNCLAIMED) function uart_ao_a group uart_ao_a_rx pin 2 (GPIOAO_2): (MUX UNCLAIMED) aobus-banks:1950 pin 3 (GPIOAO_3): (MUX UNCLAIMED) (GPIO UNCLAIMED) pin 4 (GPIOAO_4): (MUX UNCLAIMED) (GPIO UNCLAIMED) pin 5 (GPIOAO_5): ff808000.ir (GPIO UNCLAIMED) function remote_ao_input group remote_ao_input pin 6 (GPIOAO_6): (MUX UNCLAIMED) (GPIO UNCLAIMED) pin 7 (GPIOAO_7): (MUX UNCLAIMED) (GPIO UNCLAIMED) pin 8 (GPIOAO_8): (MUX UNCLAIMED) aobus-banks:1956 pin 9 (GPIOAO_9): (MUX UNCLAIMED) aobus-banks:1957 pin 10 (GPIOAO_10): (MUX UNCLAIMED) aobus-banks:1958 pin 11 (GPIOAO_11): (MUX UNCLAIMED) aobus-banks:1959 pin 12 (GPIOE_0): (MUX UNCLAIMED) (GPIO UNCLAIMED) pin 13 (GPIOE_1): ff802000.pwm (GPIO UNCLAIMED) function pwm_ao_d group pwm_ao_d_e pin 14 (GPIOE_2): ffd1b000.pwm (GPIO UNCLAIMED) function pwm_a_e group pwm_a_e $ sudo gpiomon gpiochip1 10 gpiomon: error waiting for events: Device or resource busy $ sudo gpioget gpiochip1 10 gpioget: error reading GPIO values: Device or resource busy If I am wrong I have previously sent it with a typo correction below. [1] https://lore.kernel.org/all/20221021050906.1158-1-linux.amoon@gmail.com/ Thanks -Anand > > Best regards, > Martin
Hi Anand, On Sat, Oct 22, 2022 at 1:27 PM Anand Moon <linux.amoon@gmail.com> wrote: [...] > > > @@ -1982,7 +1982,6 @@ pwm_ao_d_10_pins: pwm-ao-d-10 { > > > mux { > > > groups = "pwm_ao_d_10"; > > > function = "pwm_ao_d"; > > > - bias-disable; > > &pwm_ao_d_10_pins is not referenced anywhere so it seems that this > > change has no impact on controlling the fan on Odroid-N2(+). > > How did you test this change? > > > Ok I felt these changes affect the behavior of the pinctrl > > * @PIN_CONFIG_BIAS_DISABLE: disable any pin bias on the pin, a > * transition from say pull-up to pull-down implies that you disable > * pull-up in the process, this setting disables all biasing. > > I mapped this is linked in pinctrl driver, pwm_ao_d_10_pins GPIOAO_10 see below Yes, I understand this part. My concern is: &pwm_ao_d_10_pins settings only become active when this node is actively referenced. You can even see it in your output below... [...] > pin 10 (GPIOAO_10): (MUX UNCLAIMED) aobus-banks:1958 This shows that it's used as a GPIO. If the &pwm_ao_d_10_pins setting was used then it would show "function pwm_ao_d group pwm_ao_d_10" (similar to what GPIOE_1 shows in your output) If you want to know if a pull-up/down is enabled you can look at the output of: $ cat /sys/kernel/debug/pinctrl/ff800000.sys-ctrl\:pinctrl@14-pinctrl-meson/pinconf-pins (I'm sure this can also be retrieved from some userspace tools, but I don't know how) Best regards, Martin
Hi Martin, On Sat, 22 Oct 2022 at 17:22, Martin Blumenstingl <martin.blumenstingl@googlemail.com> wrote: > > Hi Anand, > > On Sat, Oct 22, 2022 at 1:27 PM Anand Moon <linux.amoon@gmail.com> wrote: > [...] > > > > @@ -1982,7 +1982,6 @@ pwm_ao_d_10_pins: pwm-ao-d-10 { > > > > mux { > > > > groups = "pwm_ao_d_10"; > > > > function = "pwm_ao_d"; > > > > - bias-disable; > > > &pwm_ao_d_10_pins is not referenced anywhere so it seems that this > > > change has no impact on controlling the fan on Odroid-N2(+). > > > How did you test this change? > > > > > Ok I felt these changes affect the behavior of the pinctrl > > > > * @PIN_CONFIG_BIAS_DISABLE: disable any pin bias on the pin, a > > * transition from say pull-up to pull-down implies that you disable > > * pull-up in the process, this setting disables all biasing. > > > > I mapped this is linked in pinctrl driver, pwm_ao_d_10_pins GPIOAO_10 see below > Yes, I understand this part. > My concern is: &pwm_ao_d_10_pins settings only become active when this > node is actively referenced. You can even see it in your output > below... > > [...] > > pin 10 (GPIOAO_10): (MUX UNCLAIMED) aobus-banks:1958 > This shows that it's used as a GPIO. If the &pwm_ao_d_10_pins setting > was used then it would show "function pwm_ao_d group pwm_ao_d_10" > (similar to what GPIOE_1 shows in your output) > > If you want to know if a pull-up/down is enabled you can look at the output of: > $ cat /sys/kernel/debug/pinctrl/ff800000.sys-ctrl\:pinctrl@14-pinctrl-meson/pinconf-pins > (I'm sure this can also be retrieved from some userspace tools, but I > don't know how) > I now switch using pwm-fan with the local changes I am able to link pwm_ao_d_10_pins but now the issue is fan keeps on spinning on boot-up and stays on. I can manually turn on off by using $ sudo gpioset gpiochip1 10=1 // fan on $ sudo gpioset gpiochip1 10=0 // fan off It is not controlled by the thermal tip as expected. I feel some configuration is missing in pwm-meson driver. Any input for me? $ sudo cat /sys/kernel/debug/pinctrl/ff800000.sys-ctrl\:pinctrl@14-pinctrl-meson/pinmux-pins [sudo] password for alarm: Pinmux settings per pin Format: pin (name): mux_owner gpio_owner hog? pin 0 (GPIOAO_0): ff803000.serial (GPIO UNCLAIMED) function uart_ao_a group uart_ao_a_tx pin 1 (GPIOAO_1): ff803000.serial (GPIO UNCLAIMED) function uart_ao_a group uart_ao_a_rx pin 2 (GPIOAO_2): (MUX UNCLAIMED) aobus-banks:1950 pin 3 (GPIOAO_3): (MUX UNCLAIMED) (GPIO UNCLAIMED) pin 4 (GPIOAO_4): (MUX UNCLAIMED) (GPIO UNCLAIMED) pin 5 (GPIOAO_5): ff808000.ir (GPIO UNCLAIMED) function remote_ao_input group remote_ao_input pin 6 (GPIOAO_6): (MUX UNCLAIMED) (GPIO UNCLAIMED) pin 7 (GPIOAO_7): (MUX UNCLAIMED) (GPIO UNCLAIMED) pin 8 (GPIOAO_8): (MUX UNCLAIMED) aobus-banks:1956 pin 9 (GPIOAO_9): (MUX UNCLAIMED) aobus-banks:1957 pin 10 (GPIOAO_10): ff807000.pwm (GPIO UNCLAIMED) function pwm_ao_d group pwm_ao_d_10 pin 11 (GPIOAO_11): (MUX UNCLAIMED) aobus-banks:1959 pin 12 (GPIOE_0): (MUX UNCLAIMED) (GPIO UNCLAIMED) pin 13 (GPIOE_1): ff802000.pwm (GPIO UNCLAIMED) function pwm_ao_d group pwm_ao_d_e pin 14 (GPIOE_2): ffd1b000.pwm (GPIO UNCLAIMED) function pwm_a_e group pwm_a_e $ sudo cat /sys/kernel/debug/pwm platform/ffd1b000.pwm, 2 PWM devices pwm-0 (regulator-vddcpu-a ): requested enabled period: 1250 ns duty: 838 ns polarity: normal pwm-1 ((null) ): period: 0 ns duty: 0 ns polarity: normal platform/ff807000.pwm, 2 PWM devices pwm-0 (pwm-fan ): requested period: 1250 ns duty: 0 ns polarity: normal pwm-1 ((null) ): period: 0 ns duty: 0 ns polarity: normal platform/ff802000.pwm, 2 PWM devices pwm-0 ((null) ): period: 0 ns duty: 0 ns polarity: normal pwm-1 (regulator-vddcpu-b ): requested enabled period: 1250 ns duty: 1213 ns polarity: normal I could observe a change in duty when we have stress testing the CPU. Thanks -Anand
Hi, On 25/10/2022 20:06, Anand Moon wrote: > Hi Martin, > > On Sat, 22 Oct 2022 at 17:22, Martin Blumenstingl > <martin.blumenstingl@googlemail.com> wrote: >> >> Hi Anand, >> >> On Sat, Oct 22, 2022 at 1:27 PM Anand Moon <linux.amoon@gmail.com> wrote: >> [...] >>>>> @@ -1982,7 +1982,6 @@ pwm_ao_d_10_pins: pwm-ao-d-10 { >>>>> mux { >>>>> groups = "pwm_ao_d_10"; >>>>> function = "pwm_ao_d"; >>>>> - bias-disable; >>>> &pwm_ao_d_10_pins is not referenced anywhere so it seems that this >>>> change has no impact on controlling the fan on Odroid-N2(+). >>>> How did you test this change? >>>> >>> Ok I felt these changes affect the behavior of the pinctrl >>> >>> * @PIN_CONFIG_BIAS_DISABLE: disable any pin bias on the pin, a >>> * transition from say pull-up to pull-down implies that you disable >>> * pull-up in the process, this setting disables all biasing. >>> >>> I mapped this is linked in pinctrl driver, pwm_ao_d_10_pins GPIOAO_10 see below >> Yes, I understand this part. >> My concern is: &pwm_ao_d_10_pins settings only become active when this >> node is actively referenced. You can even see it in your output >> below... >> >> [...] >>> pin 10 (GPIOAO_10): (MUX UNCLAIMED) aobus-banks:1958 >> This shows that it's used as a GPIO. If the &pwm_ao_d_10_pins setting >> was used then it would show "function pwm_ao_d group pwm_ao_d_10" >> (similar to what GPIOE_1 shows in your output) >> >> If you want to know if a pull-up/down is enabled you can look at the output of: >> $ cat /sys/kernel/debug/pinctrl/ff800000.sys-ctrl\:pinctrl@14-pinctrl-meson/pinconf-pins >> (I'm sure this can also be retrieved from some userspace tools, but I >> don't know how) >> > > I now switch using pwm-fan with the local changes I am able to link > pwm_ao_d_10_pins > but now the issue is fan keeps on spinning on boot-up and stays on. > > I can manually turn on off by using > $ sudo gpioset gpiochip1 10=1 // fan on > $ sudo gpioset gpiochip1 10=0 // fan off By doing that actually override the PWM function of the pin and set it as a GPIO. > > It is not controlled by the thermal tip as expected. > I feel some configuration is missing in pwm-meson driver. > Any input for me? > > $ sudo cat /sys/kernel/debug/pinctrl/ff800000.sys-ctrl\:pinctrl@14-pinctrl-meson/pinmux-pins > [sudo] password for alarm: > Pinmux settings per pin > Format: pin (name): mux_owner gpio_owner hog? > pin 0 (GPIOAO_0): ff803000.serial (GPIO UNCLAIMED) function uart_ao_a > group uart_ao_a_tx > pin 1 (GPIOAO_1): ff803000.serial (GPIO UNCLAIMED) function uart_ao_a > group uart_ao_a_rx > pin 2 (GPIOAO_2): (MUX UNCLAIMED) aobus-banks:1950 > pin 3 (GPIOAO_3): (MUX UNCLAIMED) (GPIO UNCLAIMED) > pin 4 (GPIOAO_4): (MUX UNCLAIMED) (GPIO UNCLAIMED) > pin 5 (GPIOAO_5): ff808000.ir (GPIO UNCLAIMED) function > remote_ao_input group remote_ao_input > pin 6 (GPIOAO_6): (MUX UNCLAIMED) (GPIO UNCLAIMED) > pin 7 (GPIOAO_7): (MUX UNCLAIMED) (GPIO UNCLAIMED) > pin 8 (GPIOAO_8): (MUX UNCLAIMED) aobus-banks:1956 > pin 9 (GPIOAO_9): (MUX UNCLAIMED) aobus-banks:1957 > pin 10 (GPIOAO_10): ff807000.pwm (GPIO UNCLAIMED) function pwm_ao_d > group pwm_ao_d_10 > pin 11 (GPIOAO_11): (MUX UNCLAIMED) aobus-banks:1959 > pin 12 (GPIOE_0): (MUX UNCLAIMED) (GPIO UNCLAIMED) > pin 13 (GPIOE_1): ff802000.pwm (GPIO UNCLAIMED) function pwm_ao_d > group pwm_ao_d_e > pin 14 (GPIOE_2): ffd1b000.pwm (GPIO UNCLAIMED) function pwm_a_e group pwm_a_e > > $ sudo cat /sys/kernel/debug/pwm > platform/ffd1b000.pwm, 2 PWM devices > pwm-0 (regulator-vddcpu-a ): requested enabled period: 1250 ns > duty: 838 ns polarity: normal > pwm-1 ((null) ): period: 0 ns duty: 0 ns polarity: normal > > platform/ff807000.pwm, 2 PWM devices > pwm-0 (pwm-fan ): requested period: 1250 ns duty: 0 ns > polarity: normal > pwm-1 ((null) ): period: 0 ns duty: 0 ns polarity: normal This should be on the pwm-1, hence the "pwm_AO_cd" name, "c" and "d" and the names of the outputs. So you need to use 1 as first PWM phandle argument instead of 0. > > platform/ff802000.pwm, 2 PWM devices > pwm-0 ((null) ): period: 0 ns duty: 0 ns polarity: normal > pwm-1 (regulator-vddcpu-b ): requested enabled period: 1250 ns > duty: 1213 ns polarity: normal > > I could observe a change in duty when we have stress testing the CPU. Can you share the complete change you did here ? > > Thanks > > -Anand Neil
Hi Neil, On Wed, 26 Oct 2022 at 13:32, Neil Armstrong <neil.armstrong@linaro.org> wrote: > > Hi, > > On 25/10/2022 20:06, Anand Moon wrote: > > Hi Martin, > > > > On Sat, 22 Oct 2022 at 17:22, Martin Blumenstingl > > <martin.blumenstingl@googlemail.com> wrote: > >> > >> Hi Anand, > >> > >> On Sat, Oct 22, 2022 at 1:27 PM Anand Moon <linux.amoon@gmail.com> wrote: > >> [...] > >>>>> @@ -1982,7 +1982,6 @@ pwm_ao_d_10_pins: pwm-ao-d-10 { > >>>>> mux { > >>>>> groups = "pwm_ao_d_10"; > >>>>> function = "pwm_ao_d"; > >>>>> - bias-disable; > >>>> &pwm_ao_d_10_pins is not referenced anywhere so it seems that this > >>>> change has no impact on controlling the fan on Odroid-N2(+). > >>>> How did you test this change? > >>>> > >>> Ok I felt these changes affect the behavior of the pinctrl > >>> > >>> * @PIN_CONFIG_BIAS_DISABLE: disable any pin bias on the pin, a > >>> * transition from say pull-up to pull-down implies that you disable > >>> * pull-up in the process, this setting disables all biasing. > >>> > >>> I mapped this is linked in pinctrl driver, pwm_ao_d_10_pins GPIOAO_10 see below > >> Yes, I understand this part. > >> My concern is: &pwm_ao_d_10_pins settings only become active when this > >> node is actively referenced. You can even see it in your output > >> below... > >> > >> [...] > >>> pin 10 (GPIOAO_10): (MUX UNCLAIMED) aobus-banks:1958 > >> This shows that it's used as a GPIO. If the &pwm_ao_d_10_pins setting > >> was used then it would show "function pwm_ao_d group pwm_ao_d_10" > >> (similar to what GPIOE_1 shows in your output) > >> > >> If you want to know if a pull-up/down is enabled you can look at the output of: > >> $ cat /sys/kernel/debug/pinctrl/ff800000.sys-ctrl\:pinctrl@14-pinctrl-meson/pinconf-pins > >> (I'm sure this can also be retrieved from some userspace tools, but I > >> don't know how) > >> > > > > I now switch using pwm-fan with the local changes I am able to link > > pwm_ao_d_10_pins > > but now the issue is fan keeps on spinning on boot-up and stays on. > > > > I can manually turn on off by using > > $ sudo gpioset gpiochip1 10=1 // fan on > > $ sudo gpioset gpiochip1 10=0 // fan off > > By doing that actually override the PWM function of the pin and set it as a GPIO. Yes, I just want to test if this pin is working. > > > > > It is not controlled by the thermal tip as expected. > > I feel some configuration is missing in pwm-meson driver. > > Any input for me? > > > > $ sudo cat /sys/kernel/debug/pinctrl/ff800000.sys-ctrl\:pinctrl@14-pinctrl-meson/pinmux-pins > > [sudo] password for alarm: > > Pinmux settings per pin > > Format: pin (name): mux_owner gpio_owner hog? > > pin 0 (GPIOAO_0): ff803000.serial (GPIO UNCLAIMED) function uart_ao_a > > group uart_ao_a_tx > > pin 1 (GPIOAO_1): ff803000.serial (GPIO UNCLAIMED) function uart_ao_a > > group uart_ao_a_rx > > pin 2 (GPIOAO_2): (MUX UNCLAIMED) aobus-banks:1950 > > pin 3 (GPIOAO_3): (MUX UNCLAIMED) (GPIO UNCLAIMED) > > pin 4 (GPIOAO_4): (MUX UNCLAIMED) (GPIO UNCLAIMED) > > pin 5 (GPIOAO_5): ff808000.ir (GPIO UNCLAIMED) function > > remote_ao_input group remote_ao_input > > pin 6 (GPIOAO_6): (MUX UNCLAIMED) (GPIO UNCLAIMED) > > pin 7 (GPIOAO_7): (MUX UNCLAIMED) (GPIO UNCLAIMED) > > pin 8 (GPIOAO_8): (MUX UNCLAIMED) aobus-banks:1956 > > pin 9 (GPIOAO_9): (MUX UNCLAIMED) aobus-banks:1957 > > pin 10 (GPIOAO_10): ff807000.pwm (GPIO UNCLAIMED) function pwm_ao_d > > group pwm_ao_d_10 > > pin 11 (GPIOAO_11): (MUX UNCLAIMED) aobus-banks:1959 > > pin 12 (GPIOE_0): (MUX UNCLAIMED) (GPIO UNCLAIMED) > > pin 13 (GPIOE_1): ff802000.pwm (GPIO UNCLAIMED) function pwm_ao_d > > group pwm_ao_d_e > > pin 14 (GPIOE_2): ffd1b000.pwm (GPIO UNCLAIMED) function pwm_a_e group pwm_a_e > > > > $ sudo cat /sys/kernel/debug/pwm > > platform/ffd1b000.pwm, 2 PWM devices > > pwm-0 (regulator-vddcpu-a ): requested enabled period: 1250 ns > > duty: 838 ns polarity: normal > > pwm-1 ((null) ): period: 0 ns duty: 0 ns polarity: normal > > > > platform/ff807000.pwm, 2 PWM devices > > pwm-0 (pwm-fan ): requested period: 1250 ns duty: 0 ns > > polarity: normal > > pwm-1 ((null) ): period: 0 ns duty: 0 ns polarity: normal > > This should be on the pwm-1, hence the "pwm_AO_cd" name, "c" and "d" and the > names of the outputs. > > So you need to use 1 as first PWM phandle argument instead of 0. > > > > > platform/ff802000.pwm, 2 PWM devices > > pwm-0 ((null) ): period: 0 ns duty: 0 ns polarity: normal > > pwm-1 (regulator-vddcpu-b ): requested enabled period: 1250 ns > > duty: 1213 ns polarity: normal > > > > I could observe a change in duty when we have stress testing the CPU. > > Can you share the complete change you did here ? > When I try to use pwm_AO_cd,, Either one of the PWM binds will fail to get the following error. &pwm_AO_cd { - pinctrl-0 = <&pwm_ao_d_e_pins>; + pinctrl-0 = <&pwm_ao_d_e_pins>, <&pwm_ao_d_10_pins>; pinctrl-names = "default"; clocks = <&xtal>; clock-names = "clkin1"; [ 3.941700] pwm-regulator regulator-vddcpu-b: error -EBUSY: Failed to get PWM [ 3.943198] pwm-regulator: probe of regulator-vddcpu-b failed with error -16 [ 3.956356] pwm-fan pwm-fan: error -EBUSY: Could not get PWM [ 3.956396] pwm-fan: probe of pwm-fan failed with error -16 Below are my changes with pwm_AO_ab --------------------------------------------------------------------------------------------- alarm@odroid-n2:~/linux-amlogic-5.y-devel$ git diff arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dtsi diff --git a/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dtsi b/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dtsi index fd3fa82e4c33..d038ba1e2453 100644 --- a/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dtsi +++ b/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dtsi @@ -39,6 +39,14 @@ emmc_pwrseq: emmc-pwrseq { reset-gpios = <&gpio BOOT_12 GPIO_ACTIVE_LOW>; }; + fan: pwm-fan { + compatible = "pwm-fan"; + pwms = <&pwm_AO_ab 1 1250 0>; + fan-supply = <&vcc_5v>; + #cooling-cells = <2>; + cooling-levels = <0 100 170 230>; + }; + leds { compatible = "gpio-leds"; @@ -410,6 +418,40 @@ &cpu103 { clock-latency = <50000>; }; +&cpu_thermal { + trips { + cpu_active: cpu-active { + temperature = <55000>; /* millicelsius */ + hysteresis = <2000>; /* millicelsius */ + type = "active"; + }; + }; + + cooling-maps { + map { + trip = <&cpu_active>; + cooling-device = <&fan THERMAL_NO_LIMIT THERMAL_NO_LIMIT>; + }; + }; +}; + +&ddr_thermal { + trips { + ddr_active: ddr-active { + temperature = <55000>; /* millicelsius */ + hysteresis = <2000>; /* millicelsius */ + type = "active"; + }; + }; + + cooling-maps { + map { + trip = <&ddr_active>; + cooling-device = <&fan THERMAL_NO_LIMIT THERMAL_NO_LIMIT>; + }; + }; +}; + &ext_mdio { external_phy: ethernet-phy@0 { /* Realtek RTL8211F (0x001cc916) */ @@ -547,6 +589,14 @@ &pwm_ab { status = "okay"; }; +&pwm_AO_ab { + pinctrl-0 = <&pwm_ao_d_10_pins>; + pinctrl-names = "default"; + clocks = <&xtal>; + clock-names = "clkin1"; + status = "okay"; +}; + &pwm_AO_cd { pinctrl-0 = <&pwm_ao_d_e_pins>; pinctrl-names = "default"; ------------------------------------------------------------------------------------------- > > > > Thanks > > > > -Anand > > Neil
Hi, On 26/10/2022 18:02, Anand Moon wrote: > Hi Neil, <snip> > > When I try to use pwm_AO_cd,, > Either one of the PWM binds will fail to get the following error. > > &pwm_AO_cd { > - pinctrl-0 = <&pwm_ao_d_e_pins>; > + pinctrl-0 = <&pwm_ao_d_e_pins>, <&pwm_ao_d_10_pins>; > pinctrl-names = "default"; > clocks = <&xtal>; > clock-names = "clkin1"; > > [ 3.941700] pwm-regulator regulator-vddcpu-b: error -EBUSY: Failed to get PWM > [ 3.943198] pwm-regulator: probe of regulator-vddcpu-b failed with error -16 > > [ 3.956356] pwm-fan pwm-fan: error -EBUSY: Could not get PWM > [ 3.956396] pwm-fan: probe of pwm-fan failed with error -16 Yeah because PWM "D" is already used by the "pwm_AO_ab" controller, so you can't use it for the FAN. > > Below are my changes with pwm_AO_ab > --------------------------------------------------------------------------------------------- > alarm@odroid-n2:~/linux-amlogic-5.y-devel$ git diff > arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dtsi > diff --git a/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dtsi > b/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dtsi > index fd3fa82e4c33..d038ba1e2453 100644 > --- a/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dtsi > +++ b/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dtsi > @@ -39,6 +39,14 @@ emmc_pwrseq: emmc-pwrseq { > reset-gpios = <&gpio BOOT_12 GPIO_ACTIVE_LOW>; > }; > > + fan: pwm-fan { > + compatible = "pwm-fan"; > + pwms = <&pwm_AO_ab 1 1250 0>; Here you use the "B" PWM signal, not the D. > + fan-supply = <&vcc_5v>; > + #cooling-cells = <2>; > + cooling-levels = <0 100 170 230>; > + }; > + > leds { <snip> > > +&pwm_AO_ab { > + pinctrl-0 = <&pwm_ao_d_10_pins>; The "pwm_AO_ab" controller only controls the PWM "A" & "B signals, not the "D" ! This basically enables the PWM "D" pin function to GPIOAO_10, it doesn't assign it to the "pwm_AO_ab" controller. So by enabling this pinctrl, it will duplicate the pwm_ao_d_e_pins signal to pwm_ao_d_10_pins, this is why the FAN spins non-stop. > + pinctrl-names = "default"; > + clocks = <&xtal>; > + clock-names = "clkin1"; > + status = "okay"; > +}; > + > &pwm_AO_cd { > pinctrl-0 = <&pwm_ao_d_e_pins>; > pinctrl-names = "default"; > ------------------------------------------------------------------------------------------- >>> >>> Thanks >>> >>> -Anand >> >> Neil Neil
diff --git a/arch/arm64/boot/dts/amlogic/meson-g12-common.dtsi b/arch/arm64/boot/dts/amlogic/meson-g12-common.dtsi index 45947c1031c4..10a09fe362fa 100644 --- a/arch/arm64/boot/dts/amlogic/meson-g12-common.dtsi +++ b/arch/arm64/boot/dts/amlogic/meson-g12-common.dtsi @@ -1982,7 +1982,6 @@ pwm_ao_d_10_pins: pwm-ao-d-10 { mux { groups = "pwm_ao_d_10"; function = "pwm_ao_d"; - bias-disable; }; }; diff --git a/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dtsi b/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dtsi index fd3fa82e4c33..667d2b774924 100644 --- a/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dtsi +++ b/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dtsi @@ -39,6 +39,14 @@ emmc_pwrseq: emmc-pwrseq { reset-gpios = <&gpio BOOT_12 GPIO_ACTIVE_LOW>; }; + fan: gpio-fan { + compatible = "gpio-fan"; + gpios = <&gpio_ao GPIOAO_10 GPIO_ACTIVE_HIGH>; + /* Using Dummy Speed */ + gpio-fan,speed-map = <0 0>, <1 1>; + #cooling-cells = <2>; + }; + leds { compatible = "gpio-leds"; @@ -410,6 +418,40 @@ &cpu103 { clock-latency = <50000>; }; +&cpu_thermal { + trips { + cpu_active: cpu-active { + temperature = <60000>; /* millicelsius */ + hysteresis = <2000>; /* millicelsius */ + type = "active"; + }; + }; + + cooling-maps { + map { + trip = <&cpu_active>; + cooling-device = <&fan THERMAL_NO_LIMIT THERMAL_NO_LIMIT>; + }; + }; +}; + +&ddr_thermal { + trips { + ddr_active: ddr-active { + temperature = <60000>; /* millicelsius */ + hysteresis = <2000>; /* millicelsius */ + type = "active"; + }; + }; + + cooling-maps { + map { + trip = <&ddr_active>; + cooling-device = <&fan THERMAL_NO_LIMIT THERMAL_NO_LIMIT>; + }; + }; +}; + &ext_mdio { external_phy: ethernet-phy@0 { /* Realtek RTL8211F (0x001cc916) */