From patchwork Mon May 29 20:42:58 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Wunderlich X-Patchwork-Id: 100424 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp1758220vqr; Mon, 29 May 2023 13:47:49 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7f3WIR6OgAtP+XDFKWFhtsy3+x+wQ+dBhitynqnLgZyIGOr3oTDolg43ugzs2u/cbhIc6Q X-Received: by 2002:a17:902:7898:b0:1a6:54ce:4311 with SMTP id q24-20020a170902789800b001a654ce4311mr266206pll.43.1685393268897; Mon, 29 May 2023 13:47:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685393268; cv=none; d=google.com; s=arc-20160816; b=R1OAleDN0RzBgy79iOMgJ2A0ybM/4JdJl+78oALVTo466ixAwpbLjX4Diyja0umIGl /Fn0O5cQGf0Wl0nOUAzknr63vRZa6AbuceU9jrl50CiC+ibK9itOWtxN1mlO0ahw5TKp M5NZwfFgDoLcFOeFyp42LnaaTMLJqeg55GW8ngGJsFlzliAgfeWfoa/r4NXle7mYsxrp +m8Wlx4Vibk5mu6CkGuTamOz4fcnVjaDWPqu+9zX9imXppqlxAYc6phB32vLnXHx0+e0 9eP3k8itOJVfrMDc6RnYQxyfle0jTCcCewhAMc4/DsNjf81qSObWCdz7q+mN813prLs/ 9UOQ== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=NiNTNWADcq8Wf9sTDfcLcaA78qUAbBkS8piCK+YIth4=; b=UuLtEu1UGV7LEfc3VqhlrmFWM8ccSEV52GND6UT0WnUiMsd0dh6OJbUbScWOhkMgwZ jeonUC3p/nVlsEkBlRdP0+bxQTFizQSunU57yFEhIqhZhwoMxVtv/Mq5zm3e3UgRdEJV XqKD2q+/KVeb0cDr++2zDSw9ASjScIFOLm2tNQRFsCQExzfbncBvfpqDMQHzZ46fKQim VNy7jhpXM0uEJqpvawOXU9KSiDXeN9izw3YeDjMHvPbofI504O8cuL+dn5FOBE3TyZ9J X5ZDpZ1QjM3gqa5v6CJdq7W2T+nZVKZsNdlZeDhTmdhADJsWWwq57SGCH1Nm7f6DKAQr HYPw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mailerdienst.de header.s=20200217 header.b=X7uCk1A5; 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: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u6-20020a170902e80600b001aadba392c1si2967145plg.464.2023.05.29.13.47.35; Mon, 29 May 2023 13:47:48 -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=@mailerdienst.de header.s=20200217 header.b=X7uCk1A5; 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 S229708AbjE2Unw (ORCPT + 99 others); Mon, 29 May 2023 16:43:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52696 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229632AbjE2Unn (ORCPT ); Mon, 29 May 2023 16:43:43 -0400 Received: from mxout1.routing.net (mxout1.routing.net [134.0.28.11]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 964F9DB; Mon, 29 May 2023 13:43:38 -0700 (PDT) Received: from mxbox2.masterlogin.de (unknown [192.168.10.89]) by mxout1.routing.net (Postfix) with ESMTP id 695513FC7F; Mon, 29 May 2023 20:43:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mailerdienst.de; s=20200217; t=1685393015; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=NiNTNWADcq8Wf9sTDfcLcaA78qUAbBkS8piCK+YIth4=; b=X7uCk1A5RWowtoLg5C28QXGgBuPhnlgquA0AlaMFd43ibD+ZUiiExwvswPC2MKv8xwn93/ lYdNhnN/6uXhuWKKJ1g57S9tFrJvZcprKeOWolnq3tU34kfnUUp1wV3Es+/nhVbwQv8nsJ lqZPUaqmWk5su9LXSJu66RUD+Zv4PZg= Received: from frank-G5.. (fttx-pool-217.61.156.2.bambit.de [217.61.156.2]) by mxbox2.masterlogin.de (Postfix) with ESMTPSA id 4483E1006D1; Mon, 29 May 2023 20:43:34 +0000 (UTC) From: Frank Wunderlich To: linux-mediatek@lists.infradead.org Cc: Frank Wunderlich , Jonathan Cameron , Lars-Peter Clausen , Rob Herring , Krzysztof Kozlowski , Matthias Brugger , AngeloGioacchino Del Regno , Srinivas Kandagatla , "Hui.Liu" , Zhiyong Tao , Andrew-CT Chen , Lala Lin , linux-iio@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Daniel Golle Subject: [PATCH v2 4/4] arm64: dts: mt7986: add pwm-fan and cooling-maps to BPI-R3 dts Date: Mon, 29 May 2023 22:42:58 +0200 Message-Id: <20230529204258.65238-5-linux@fw-web.de> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230529204258.65238-1-linux@fw-web.de> References: <20230529204258.65238-1-linux@fw-web.de> MIME-Version: 1.0 X-Mail-ID: b1d02627-873f-44dd-a92e-df7ed1a9bf87 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL, SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE,T_SPF_TEMPERROR 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1767262932500346463?= X-GMAIL-MSGID: =?utf-8?q?1767262932500346463?= From: Daniel Golle Add pwm-fan and cooling-maps to BananaPi-R3 devicetree. Signed-off-by: Daniel Golle Signed-off-by: Frank Wunderlich Reviewed-by: AngeloGioacchino Del Regno --- this is based on Patch from openwrt. as my PWM-fan seems to need 5v pwm signal and r3 only provides 3v3 on 3pin-socket it does not work for me. --- .../dts/mediatek/mt7986a-bananapi-bpi-r3.dts | 31 +++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/arch/arm64/boot/dts/mediatek/mt7986a-bananapi-bpi-r3.dts b/arch/arm64/boot/dts/mediatek/mt7986a-bananapi-bpi-r3.dts index 782519429497..29c018bbf29d 100644 --- a/arch/arm64/boot/dts/mediatek/mt7986a-bananapi-bpi-r3.dts +++ b/arch/arm64/boot/dts/mediatek/mt7986a-bananapi-bpi-r3.dts @@ -37,6 +37,15 @@ dcin: regulator-12vd { regulator-always-on; }; + fan: pwm-fan { + compatible = "pwm-fan"; + #cooling-cells = <2>; + /* cooling level (0, 1, 2) - pwm inverted */ + cooling-levels = <255 96 0>; + pwms = <&pwm 0 10000 0>; + status = "okay"; + }; + gpio-keys { compatible = "gpio-keys"; @@ -132,6 +141,28 @@ sfp2: sfp-2 { }; }; +&cpu_thermal { + cooling-maps { + cpu-active-high { + /* active: set fan to cooling level 2 */ + cooling-device = <&fan 2 2>; + trip = <&cpu_trip_active_high>; + }; + + cpu-active-low { + /* active: set fan to cooling level 1 */ + cooling-device = <&fan 1 1>; + trip = <&cpu_trip_active_low>; + }; + + cpu-passive { + /* passive: set fan to cooling level 0 */ + cooling-device = <&fan 0 0>; + trip = <&cpu_trip_passive>; + }; + }; +}; + &crypto { status = "okay"; };