Message ID | 20231013-fp5-thermals-v1-4-f14df01922e6@fairphone.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2908:b0:403:3b70:6f57 with SMTP id ib8csp1734909vqb; Fri, 13 Oct 2023 01:12:28 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFTdSlLawY8S3Lu+L3C0Blh/7dMVWole6xr0PRQ55C8a5PmYYQ8vVyue60K1swIwOKxktDx X-Received: by 2002:a05:6a21:a596:b0:163:d382:ba84 with SMTP id gd22-20020a056a21a59600b00163d382ba84mr32392191pzc.5.1697184748429; Fri, 13 Oct 2023 01:12:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697184748; cv=none; d=google.com; s=arc-20160816; b=CSYeZcEkEAK1jVndGks+amhye60tvA6bBQJnQbHBqRon52mPN//8RRqKcSOHemWPHm mBtSEfuCmRZCqNKwh6HwwCC6AB8hR4nLhtjbKsf3GDxBoItfQLlGhcZAGpnxIEGHZCT9 aBNDdc751fxFGdm8hsNmz2wzdpmsZ4PTKNdrsZS6VtxAVrr13UCKV+8AaYxwBCcpQ9vq YUBUokfmngfaZXilffASXNkyJEk7pK966ASv7jJv6p75CvAUiY3ywZRbZWmUzoR+tmXZ AU8n8YqeqmbgBT9noTldjrZytwIt2EC7Xwp3vlz6d1Vbb4g9YlFQX2VNF6BBgrUFCZlM pJuw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:in-reply-to:references:message-id :content-transfer-encoding:mime-version:subject:date:from :dkim-signature; bh=dT253bU1TN+2VYGYyTK7tnK4dl9BBDdqFWVEHyQXP0Q=; fh=TaIMO6VqurOlFtSkuOdlPBpqoEGRWJJ8lInFKm6Jv5A=; b=uHY91UUJ5wiSqiIaZmhYJCwrF78/ptuPvVTZl/8RckP+pZonLTY37cZvEKKbualhvE q65MB0YgTTZQpTPsnZMZEMXbj18aPRVz2vvkEJhDezILWTwuXMpwQliyvwj83S3+Uwuy 9M+eP0qwgGDe9c8mAP1vPkMHVbXXnIOFvtEw1SJLViMuUlUEZqwl91leQ2VDGgdzFkYV j7WynOyLvjNhxHYn9WicJ+GSOeY1OZq6nyhNphk4XYbaUh71cyFdKq+ECLhMJMmXUm1+ w2DfrvY/Auy40xEdCvepDVz0XWIV7tZEKZg6+Rp63QZxO2kT8xHgeB8BWTjH5bj7rUsr kLiQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@fairphone.com header.s=fair header.b=2nqsGwrR; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=fairphone.com Received: from howler.vger.email (howler.vger.email. [23.128.96.34]) by mx.google.com with ESMTPS id oj6-20020a17090b4d8600b0027768e7a9aesi4421304pjb.120.2023.10.13.01.12.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Oct 2023 01:12:28 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) client-ip=23.128.96.34; Authentication-Results: mx.google.com; dkim=pass header.i=@fairphone.com header.s=fair header.b=2nqsGwrR; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=fairphone.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id C19BE808E0C7; Fri, 13 Oct 2023 01:11:17 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230138AbjJMIKg (ORCPT <rfc822;rua109.linux@gmail.com> + 19 others); Fri, 13 Oct 2023 04:10:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47552 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230022AbjJMIKV (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Fri, 13 Oct 2023 04:10:21 -0400 Received: from mail-ed1-x52d.google.com (mail-ed1-x52d.google.com [IPv6:2a00:1450:4864:20::52d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 393CDFA for <linux-kernel@vger.kernel.org>; Fri, 13 Oct 2023 01:10:19 -0700 (PDT) Received: by mail-ed1-x52d.google.com with SMTP id 4fb4d7f45d1cf-53d9b94731aso3370859a12.1 for <linux-kernel@vger.kernel.org>; Fri, 13 Oct 2023 01:10:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fairphone.com; s=fair; t=1697184617; x=1697789417; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=dT253bU1TN+2VYGYyTK7tnK4dl9BBDdqFWVEHyQXP0Q=; b=2nqsGwrRpvwg6YT0WPFGKfZl4mqK7tdOps0qTh8CCjsDTt1DJzlcUp1i28Ktc2oKnZ bKCwiIBekakHVfrgr6XaJIy4/3l6pYYTSOdaRh6vLgJSHUk03WSHsYmH4CmO4U7N75VF xWa+Rt3GqKoI0sLcpu2rvTRuB7L7OJRpNDnMVitQB4Fg8SghCOUKxnMOm5oLM4gzgMj9 o2yjA7kNylHnfk35yAZXYJraIWlZbufXXWqvt7ol+gmAV71g4mvfQ7xDDqVK1GSM8ovj dz8r2BZbx/MeGkJQnxb4Cul4ZvSlSjDYQ0ycU4co/Ph3FVFv3e6eX5RhDn0DZEVaEFlz Uu6A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697184617; x=1697789417; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=dT253bU1TN+2VYGYyTK7tnK4dl9BBDdqFWVEHyQXP0Q=; b=V3YYbY8x4aZnU9JzQKtT/ShxekWEaeEzzxg+Jp2y2VWHnGtVs6XRQfHKBoU3UetNIn ysZI92GQmCNTMDbW6mGS3722RI2oE6s8PB7SGEOBja33RjHGF+t64iEpz2dDJ9JYZaWt HKHS7CXoBGi8ZAb6cnfvw5Zj7qgQISb1TjYig7VNHQC3im4uFD1Miey5yGLMMfkGz2ww zk9tPh2x1sH0Zg8pHCr+HdA9ThoKGNUuoLN94DnSD8xRWw335p5APepDGpTeSKa0Fiy0 tZH62DhUF2KYW+i1uTYfWdK410IDQZKZl//hI+vF3+OAzbCwW7IkCmtjuqc6PPy5bT3O bSGA== X-Gm-Message-State: AOJu0YwXCIgpNMsrY/2Sl61mVfDjHOcGTbHabho5s0Y+E/QBKaCv4ZYb U2L3Rf7IgFqaXpA7Srf8YPKn+g== X-Received: by 2002:a17:907:75da:b0:9ad:cf30:10c with SMTP id jl26-20020a17090775da00b009adcf30010cmr25008658ejc.46.1697184616863; Fri, 13 Oct 2023 01:10:16 -0700 (PDT) Received: from otso.luca.vpn.lucaweiss.eu (144-178-202-138.static.ef-service.nl. [144.178.202.138]) by smtp.gmail.com with ESMTPSA id q14-20020a170906360e00b009a5f1d1564dsm11910761ejb.126.2023.10.13.01.10.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Oct 2023 01:10:16 -0700 (PDT) From: Luca Weiss <luca.weiss@fairphone.com> Date: Fri, 13 Oct 2023 10:09:56 +0200 Subject: [PATCH 4/4] arm64: dts: qcom: qcm6490-fairphone-fp5: Add PM7325 thermals MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20231013-fp5-thermals-v1-4-f14df01922e6@fairphone.com> References: <20231013-fp5-thermals-v1-0-f14df01922e6@fairphone.com> In-Reply-To: <20231013-fp5-thermals-v1-0-f14df01922e6@fairphone.com> To: Andy Gross <agross@kernel.org>, Bjorn Andersson <andersson@kernel.org>, Konrad Dybcio <konrad.dybcio@linaro.org>, Jonathan Cameron <jic23@kernel.org>, Lars-Peter Clausen <lars@metafoo.de>, Rob Herring <robh+dt@kernel.org>, Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>, Conor Dooley <conor+dt@kernel.org> Cc: ~postmarketos/upstreaming@lists.sr.ht, phone-devel@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-iio@vger.kernel.org, devicetree@vger.kernel.org, Luca Weiss <luca.weiss@fairphone.com> X-Mailer: b4 0.12.3 X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on howler.vger.email Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (howler.vger.email [0.0.0.0]); Fri, 13 Oct 2023 01:11:17 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1779627194714802931 X-GMAIL-MSGID: 1779627194714802931 |
Series |
Add Fairphone 5 thermals (PMK7325, PM7250B, PM7325)
|
|
Commit Message
Luca Weiss
Oct. 13, 2023, 8:09 a.m. UTC
Configure the thermals for the QUIET_THERM, CAM_FLASH_THERM, MSM_THERM
and RFC_CAM_THERM thermistors connected to PM7325.
With this PMIC the software communication to the ADC is going through
PMK7325 (= PMK8350).
Signed-off-by: Luca Weiss <luca.weiss@fairphone.com>
---
arch/arm64/boot/dts/qcom/qcm6490-fairphone-fp5.dts | 117 +++++++++++++++++++++
1 file changed, 117 insertions(+)
Comments
On 13.10.2023 10:09, Luca Weiss wrote: > Configure the thermals for the QUIET_THERM, CAM_FLASH_THERM, MSM_THERM > and RFC_CAM_THERM thermistors connected to PM7325. > > With this PMIC the software communication to the ADC is going through > PMK7325 (= PMK8350). > > Signed-off-by: Luca Weiss <luca.weiss@fairphone.com> > --- > arch/arm64/boot/dts/qcom/qcm6490-fairphone-fp5.dts | 117 +++++++++++++++++++++ > 1 file changed, 117 insertions(+) > > diff --git a/arch/arm64/boot/dts/qcom/qcm6490-fairphone-fp5.dts b/arch/arm64/boot/dts/qcom/qcm6490-fairphone-fp5.dts > index 2c01f799a6b2..d0b1e4e507ff 100644 > --- a/arch/arm64/boot/dts/qcom/qcm6490-fairphone-fp5.dts > +++ b/arch/arm64/boot/dts/qcom/qcm6490-fairphone-fp5.dts > @@ -9,6 +9,7 @@ > #define PM7250B_SID 8 > #define PM7250B_SID1 9 > > +#include <dt-bindings/iio/qcom,spmi-adc7-pm7325.h> > #include <dt-bindings/iio/qcom,spmi-adc7-pmk8350.h> > #include <dt-bindings/leds/common.h> > #include <dt-bindings/pinctrl/qcom,pmic-gpio.h> > @@ -137,6 +138,20 @@ afvdd_2p8: regulator-afvdd-2p8 { > }; > > thermal-zones { > + camera-thermal { > + polling-delay-passive = <0>; > + polling-delay = <0>; > + thermal-sensors = <&pmk8350_adc_tm 2>; > + > + trips { > + active-config0 { > + temperature = <125000>; are > + rear-cam-thermal { > + temperature = <125000>; you > + sdm-skin-thermal { > + temperature = <125000>; sure about these temps? Konrad
On Samstag, 14. Oktober 2023 01:13:29 CEST Konrad Dybcio wrote: > On 13.10.2023 10:09, Luca Weiss wrote: > > Configure the thermals for the QUIET_THERM, CAM_FLASH_THERM, MSM_THERM > > and RFC_CAM_THERM thermistors connected to PM7325. > > > > With this PMIC the software communication to the ADC is going through > > PMK7325 (= PMK8350). > > > > Signed-off-by: Luca Weiss <luca.weiss@fairphone.com> > > --- > > > > arch/arm64/boot/dts/qcom/qcm6490-fairphone-fp5.dts | 117 > > +++++++++++++++++++++ 1 file changed, 117 insertions(+) > > > > diff --git a/arch/arm64/boot/dts/qcom/qcm6490-fairphone-fp5.dts > > b/arch/arm64/boot/dts/qcom/qcm6490-fairphone-fp5.dts index > > 2c01f799a6b2..d0b1e4e507ff 100644 > > --- a/arch/arm64/boot/dts/qcom/qcm6490-fairphone-fp5.dts > > +++ b/arch/arm64/boot/dts/qcom/qcm6490-fairphone-fp5.dts > > @@ -9,6 +9,7 @@ > > > > #define PM7250B_SID 8 > > #define PM7250B_SID1 9 > > > > +#include <dt-bindings/iio/qcom,spmi-adc7-pm7325.h> > > > > #include <dt-bindings/iio/qcom,spmi-adc7-pmk8350.h> > > #include <dt-bindings/leds/common.h> > > #include <dt-bindings/pinctrl/qcom,pmic-gpio.h> > > > > @@ -137,6 +138,20 @@ afvdd_2p8: regulator-afvdd-2p8 { > > > > }; > > > > thermal-zones { > > > > + camera-thermal { > > + polling-delay-passive = <0>; > > + polling-delay = <0>; > > + thermal-sensors = <&pmk8350_adc_tm 2>; > > + > > + trips { > > + active-config0 { > > + temperature = <125000>; > > are > > > + rear-cam-thermal { > > > > + temperature = <125000>; > > you > > > + sdm-skin-thermal { > > > > + temperature = <125000>; > > sure > > about these temps? (email from my other address, quicker right now) Well yes and no. Yes as in those are the temps specified in downstream dtb. No as in I'm 99% sure there's user space with definitely lower threshold that actually does something in response to the temps. I didn't look too much into this but does the kernel even do something when it hits one of these trip points? I assume when there's a cooling device thing specified then it can actually tell the driver to do something, but without (and most drivers don't support this?) I'm assuming the kernel can't do much anyways? So e.g. when the temperature for the flash led is reached I'm assuming downstream (+Android) either dims the led or turns it off? But I'd have to dig quite a bit into the thermal setup there to check what it's really doing. But for now I think it's okay to put this current thermal config into dts and we'll improve it later when 1. I understand more and 2. maybe some useful drivers support the cooling bits? Regards Luca > > Konrad
On 10/14/23 19:52, Luca Weiss wrote: > On Samstag, 14. Oktober 2023 01:13:29 CEST Konrad Dybcio wrote: >> On 13.10.2023 10:09, Luca Weiss wrote: >>> Configure the thermals for the QUIET_THERM, CAM_FLASH_THERM, MSM_THERM >>> and RFC_CAM_THERM thermistors connected to PM7325. >>> >>> With this PMIC the software communication to the ADC is going through >>> PMK7325 (= PMK8350). >>> >>> Signed-off-by: Luca Weiss <luca.weiss@fairphone.com> >>> --- >>> >>> arch/arm64/boot/dts/qcom/qcm6490-fairphone-fp5.dts | 117 >>> +++++++++++++++++++++ 1 file changed, 117 insertions(+) >>> >>> diff --git a/arch/arm64/boot/dts/qcom/qcm6490-fairphone-fp5.dts >>> b/arch/arm64/boot/dts/qcom/qcm6490-fairphone-fp5.dts index >>> 2c01f799a6b2..d0b1e4e507ff 100644 >>> --- a/arch/arm64/boot/dts/qcom/qcm6490-fairphone-fp5.dts >>> +++ b/arch/arm64/boot/dts/qcom/qcm6490-fairphone-fp5.dts >>> @@ -9,6 +9,7 @@ >>> >>> #define PM7250B_SID 8 >>> #define PM7250B_SID1 9 >>> >>> +#include <dt-bindings/iio/qcom,spmi-adc7-pm7325.h> >>> >>> #include <dt-bindings/iio/qcom,spmi-adc7-pmk8350.h> >>> #include <dt-bindings/leds/common.h> >>> #include <dt-bindings/pinctrl/qcom,pmic-gpio.h> >>> >>> @@ -137,6 +138,20 @@ afvdd_2p8: regulator-afvdd-2p8 { >>> >>> }; >>> >>> thermal-zones { >>> >>> + camera-thermal { >>> + polling-delay-passive = <0>; >>> + polling-delay = <0>; >>> + thermal-sensors = <&pmk8350_adc_tm 2>; >>> + >>> + trips { >>> + active-config0 { >>> + temperature = <125000>; >> >> are >> >>> + rear-cam-thermal { >>> >>> + temperature = <125000>; >> >> you >> >>> + sdm-skin-thermal { >>> >>> + temperature = <125000>; >> >> sure >> >> about these temps? > > (email from my other address, quicker right now) > > Well yes and no. > > Yes as in those are the temps specified in downstream dtb. > No as in I'm 99% sure there's user space with definitely lower threshold that > actually does something in response to the temps. > > I didn't look too much into this but does the kernel even do something when it > hits one of these trip points? I assume when there's a cooling device thing > specified then it can actually tell the driver to do something, but without > (and most drivers don't support this?) I'm assuming the kernel can't do much > anyways? > > So e.g. when the temperature for the flash led is reached I'm assuming > downstream (+Android) either dims the led or turns it off? But I'd have to dig > quite a bit into the thermal setup there to check what it's really doing. I think reaching "critical" shuts down the platform, unless something registering the thermal zone explicitly overrides the behavior. > > But for now I think it's okay to put this current thermal config into dts and > we'll improve it later when 1. I understand more and 2. maybe some useful > drivers support the cooling bits? Yeah it's better than nothing, but ultimately we should probably move the values that userspace daemon operates on here in the dt.. Konrad
On Wed Oct 18, 2023 at 10:28 PM CEST, Konrad Dybcio wrote: > > > On 10/14/23 19:52, Luca Weiss wrote: > > On Samstag, 14. Oktober 2023 01:13:29 CEST Konrad Dybcio wrote: > >> On 13.10.2023 10:09, Luca Weiss wrote: > >>> Configure the thermals for the QUIET_THERM, CAM_FLASH_THERM, MSM_THERM > >>> and RFC_CAM_THERM thermistors connected to PM7325. > >>> > >>> With this PMIC the software communication to the ADC is going through > >>> PMK7325 (= PMK8350). > >>> > >>> Signed-off-by: Luca Weiss <luca.weiss@fairphone.com> > >>> --- > >>> > >>> arch/arm64/boot/dts/qcom/qcm6490-fairphone-fp5.dts | 117 > >>> +++++++++++++++++++++ 1 file changed, 117 insertions(+) > >>> > >>> diff --git a/arch/arm64/boot/dts/qcom/qcm6490-fairphone-fp5.dts > >>> b/arch/arm64/boot/dts/qcom/qcm6490-fairphone-fp5.dts index > >>> 2c01f799a6b2..d0b1e4e507ff 100644 > >>> --- a/arch/arm64/boot/dts/qcom/qcm6490-fairphone-fp5.dts > >>> +++ b/arch/arm64/boot/dts/qcom/qcm6490-fairphone-fp5.dts > >>> @@ -9,6 +9,7 @@ > >>> > >>> #define PM7250B_SID 8 > >>> #define PM7250B_SID1 9 > >>> > >>> +#include <dt-bindings/iio/qcom,spmi-adc7-pm7325.h> > >>> > >>> #include <dt-bindings/iio/qcom,spmi-adc7-pmk8350.h> > >>> #include <dt-bindings/leds/common.h> > >>> #include <dt-bindings/pinctrl/qcom,pmic-gpio.h> > >>> > >>> @@ -137,6 +138,20 @@ afvdd_2p8: regulator-afvdd-2p8 { > >>> > >>> }; > >>> > >>> thermal-zones { > >>> > >>> + camera-thermal { > >>> + polling-delay-passive = <0>; > >>> + polling-delay = <0>; > >>> + thermal-sensors = <&pmk8350_adc_tm 2>; > >>> + > >>> + trips { > >>> + active-config0 { > >>> + temperature = <125000>; > >> > >> are > >> > >>> + rear-cam-thermal { > >>> > >>> + temperature = <125000>; > >> > >> you > >> > >>> + sdm-skin-thermal { > >>> > >>> + temperature = <125000>; > >> > >> sure > >> > >> about these temps? > > > > (email from my other address, quicker right now) > > > > Well yes and no. > > > > Yes as in those are the temps specified in downstream dtb. > > No as in I'm 99% sure there's user space with definitely lower threshold that > > actually does something in response to the temps. > > > > I didn't look too much into this but does the kernel even do something when it > > hits one of these trip points? I assume when there's a cooling device thing > > specified then it can actually tell the driver to do something, but without > > (and most drivers don't support this?) I'm assuming the kernel can't do much > > anyways? > > > > So e.g. when the temperature for the flash led is reached I'm assuming > > downstream (+Android) either dims the led or turns it off? But I'd have to dig > > quite a bit into the thermal setup there to check what it's really doing. > I think reaching "critical" shuts down the platform, unless something > registering the thermal zone explicitly overrides the behavior. Should probably be easy to test, especially the camera flash thermal zone heats up *very* quickly when the flash is on, so should be trivial to set the trip point down from 125degC to e.g. 45degC and see what happens. So I did this and... nothing happened. I watched /sys/class/thermal/thermal_zone34/temp climb above 45degC and nothing happened. I guess trip type being "passive" and no cooling-device makes it not do anything. ==> /sys/class/thermal/thermal_zone34/trip_point_0_hyst <== 1000 ==> /sys/class/thermal/thermal_zone34/trip_point_0_temp <== 45000 ==> /sys/class/thermal/thermal_zone34/trip_point_0_type <== passive From Documentation/devicetree/bindings/thermal/thermal-zones.yaml: - active # enable active cooling e.g. fans - passive # enable passive cooling e.g. throttling cpu - hot # send notification to driver - critical # send notification to driver, trigger shutdown So unless we want to just shut down the system (with "critical"), I don't think thermal can't really do anything else right now, since e.g. leds-qcom-flash.c driver doesn't have any cooling support to lower the brightness or turn off the LED. So.. in essence not much we can do right now. But seems we also cannot remove this (kinda useless) trip since we need at least one trip point in the dts if I read the bindings yaml correctly. > > > > > But for now I think it's okay to put this current thermal config into dts and > > we'll improve it later when 1. I understand more and 2. maybe some useful > > drivers support the cooling bits? > Yeah it's better than nothing, but ultimately we should probably move > the values that userspace daemon operates on here in the dt.. For sure.. I spent a bit of time looking into the proprietary Qualcomm thermal-daemon sources but didn't really see much interesting things there for this platform, maybe some of this thermal handling is somewhere else - or half of these thermal zones aren't even used with Android. So.. good to get the current patch upstream or not? :) Regards Luca > > Konrad
On 10/20/23 13:31, Luca Weiss wrote: > On Wed Oct 18, 2023 at 10:28 PM CEST, Konrad Dybcio wrote: >> >> >> On 10/14/23 19:52, Luca Weiss wrote: >>> On Samstag, 14. Oktober 2023 01:13:29 CEST Konrad Dybcio wrote: >>>> On 13.10.2023 10:09, Luca Weiss wrote: >>>>> Configure the thermals for the QUIET_THERM, CAM_FLASH_THERM, MSM_THERM >>>>> and RFC_CAM_THERM thermistors connected to PM7325. >>>>> >>>>> With this PMIC the software communication to the ADC is going through >>>>> PMK7325 (= PMK8350). >>>>> >>>>> Signed-off-by: Luca Weiss <luca.weiss@fairphone.com> >>>>> --- >>>>> >>>>> arch/arm64/boot/dts/qcom/qcm6490-fairphone-fp5.dts | 117 >>>>> +++++++++++++++++++++ 1 file changed, 117 insertions(+) >>>>> >>>>> diff --git a/arch/arm64/boot/dts/qcom/qcm6490-fairphone-fp5.dts >>>>> b/arch/arm64/boot/dts/qcom/qcm6490-fairphone-fp5.dts index >>>>> 2c01f799a6b2..d0b1e4e507ff 100644 >>>>> --- a/arch/arm64/boot/dts/qcom/qcm6490-fairphone-fp5.dts >>>>> +++ b/arch/arm64/boot/dts/qcom/qcm6490-fairphone-fp5.dts >>>>> @@ -9,6 +9,7 @@ >>>>> >>>>> #define PM7250B_SID 8 >>>>> #define PM7250B_SID1 9 >>>>> >>>>> +#include <dt-bindings/iio/qcom,spmi-adc7-pm7325.h> >>>>> >>>>> #include <dt-bindings/iio/qcom,spmi-adc7-pmk8350.h> >>>>> #include <dt-bindings/leds/common.h> >>>>> #include <dt-bindings/pinctrl/qcom,pmic-gpio.h> >>>>> >>>>> @@ -137,6 +138,20 @@ afvdd_2p8: regulator-afvdd-2p8 { >>>>> >>>>> }; >>>>> >>>>> thermal-zones { >>>>> >>>>> + camera-thermal { >>>>> + polling-delay-passive = <0>; >>>>> + polling-delay = <0>; >>>>> + thermal-sensors = <&pmk8350_adc_tm 2>; >>>>> + >>>>> + trips { >>>>> + active-config0 { >>>>> + temperature = <125000>; >>>> >>>> are >>>> >>>>> + rear-cam-thermal { >>>>> >>>>> + temperature = <125000>; >>>> >>>> you >>>> >>>>> + sdm-skin-thermal { >>>>> >>>>> + temperature = <125000>; >>>> >>>> sure >>>> >>>> about these temps? >>> >>> (email from my other address, quicker right now) >>> >>> Well yes and no. >>> >>> Yes as in those are the temps specified in downstream dtb. >>> No as in I'm 99% sure there's user space with definitely lower threshold that >>> actually does something in response to the temps. >>> >>> I didn't look too much into this but does the kernel even do something when it >>> hits one of these trip points? I assume when there's a cooling device thing >>> specified then it can actually tell the driver to do something, but without >>> (and most drivers don't support this?) I'm assuming the kernel can't do much >>> anyways? >>> >>> So e.g. when the temperature for the flash led is reached I'm assuming >>> downstream (+Android) either dims the led or turns it off? But I'd have to dig >>> quite a bit into the thermal setup there to check what it's really doing. >> I think reaching "critical" shuts down the platform, unless something >> registering the thermal zone explicitly overrides the behavior. > > Should probably be easy to test, especially the camera flash thermal > zone heats up *very* quickly when the flash is on, so should be trivial > to set the trip point down from 125degC to e.g. 45degC and see what > happens. > > So I did this and... nothing happened. > I watched /sys/class/thermal/thermal_zone34/temp climb above 45degC and > nothing happened. > > I guess trip type being "passive" and no cooling-device makes it not do > anything. > > ==> /sys/class/thermal/thermal_zone34/trip_point_0_hyst <== > 1000 > ==> /sys/class/thermal/thermal_zone34/trip_point_0_temp <== > 45000 > ==> /sys/class/thermal/thermal_zone34/trip_point_0_type <== > passive > > From Documentation/devicetree/bindings/thermal/thermal-zones.yaml: > > - active # enable active cooling e.g. fans > - passive # enable passive cooling e.g. throttling cpu > - hot # send notification to driver > - critical # send notification to driver, trigger shutdown > > So unless we want to just shut down the system (with "critical"), I > don't think thermal can't really do anything else right now, since e.g. > leds-qcom-flash.c driver doesn't have any cooling support to lower the > brightness or turn off the LED. > > So.. in essence not much we can do right now. Yeah.. crashing the phone because the LED is too hot is sorta suboptimal! Though I mainly had the skin temp in mind.. > > But seems we also cannot remove this (kinda useless) trip since we need > at least one trip point in the dts if I read the bindings yaml > correctly. Right > >> >>> >>> But for now I think it's okay to put this current thermal config into dts and >>> we'll improve it later when 1. I understand more and 2. maybe some useful >>> drivers support the cooling bits? >> Yeah it's better than nothing, but ultimately we should probably move >> the values that userspace daemon operates on here in the dt.. > > For sure.. I spent a bit of time looking into the proprietary Qualcomm > thermal-daemon sources but didn't really see much interesting things > there for this platform, maybe some of this thermal handling is > somewhere else - or half of these thermal zones aren't even used with > Android. > > So.. good to get the current patch upstream or not? :) Yep, just having the ability to read out thing is always good ;) Konrad
diff --git a/arch/arm64/boot/dts/qcom/qcm6490-fairphone-fp5.dts b/arch/arm64/boot/dts/qcom/qcm6490-fairphone-fp5.dts index 2c01f799a6b2..d0b1e4e507ff 100644 --- a/arch/arm64/boot/dts/qcom/qcm6490-fairphone-fp5.dts +++ b/arch/arm64/boot/dts/qcom/qcm6490-fairphone-fp5.dts @@ -9,6 +9,7 @@ #define PM7250B_SID 8 #define PM7250B_SID1 9 +#include <dt-bindings/iio/qcom,spmi-adc7-pm7325.h> #include <dt-bindings/iio/qcom,spmi-adc7-pmk8350.h> #include <dt-bindings/leds/common.h> #include <dt-bindings/pinctrl/qcom,pmic-gpio.h> @@ -137,6 +138,20 @@ afvdd_2p8: regulator-afvdd-2p8 { }; thermal-zones { + camera-thermal { + polling-delay-passive = <0>; + polling-delay = <0>; + thermal-sensors = <&pmk8350_adc_tm 2>; + + trips { + active-config0 { + temperature = <125000>; + hysteresis = <1000>; + type = "passive"; + }; + }; + }; + chg-skin-thermal { polling-delay-passive = <0>; polling-delay = <0>; @@ -165,6 +180,48 @@ active-config0 { }; }; + quiet-thermal { + polling-delay-passive = <0>; + polling-delay = <0>; + thermal-sensors = <&pmk8350_adc_tm 1>; + + trips { + active-config0 { + temperature = <125000>; + hysteresis = <1000>; + type = "passive"; + }; + }; + }; + + rear-cam-thermal { + polling-delay-passive = <0>; + polling-delay = <0>; + thermal-sensors = <&pmk8350_adc_tm 4>; + + trips { + active-config0 { + temperature = <125000>; + hysteresis = <1000>; + type = "passive"; + }; + }; + }; + + sdm-skin-thermal { + polling-delay-passive = <0>; + polling-delay = <0>; + thermal-sensors = <&pmk8350_adc_tm 3>; + + trips { + active-config0 { + temperature = <125000>; + hysteresis = <1000>; + type = "passive"; + }; + }; + }; + xo-thermal { polling-delay-passive = <0>; polling-delay = <0>; @@ -538,6 +595,34 @@ xo-therm@0 { qcom,ratiometric; qcom,hw-settle-time-us = <200>; }; + + quiet-therm@1 { + reg = <1>; + io-channels = <&pmk8350_vadc PM7325_ADC7_AMUX_THM1_100K_PU>; + qcom,ratiometric; + qcom,hw-settle-time-us = <200>; + }; + + cam-flash-therm@2 { + reg = <2>; + io-channels = <&pmk8350_vadc PM7325_ADC7_AMUX_THM2_100K_PU>; + qcom,ratiometric; + qcom,hw-settle-time-us = <200>; + }; + + sdm-skin-therm@3 { + reg = <3>; + io-channels = <&pmk8350_vadc PM7325_ADC7_AMUX_THM3_100K_PU>; + qcom,ratiometric; + qcom,hw-settle-time-us = <200>; + }; + + wide-rfc-therm@4 { + reg = <4>; + io-channels = <&pmk8350_vadc PM7325_ADC7_AMUX_THM4_100K_PU>; + qcom,ratiometric; + qcom,hw-settle-time-us = <200>; + }; }; &pmk8350_rtc { @@ -554,6 +639,38 @@ channel@44 { qcom,pre-scaling = <1 1>; label = "pmk8350_xo_therm"; }; + + channel@144 { + reg = <PM7325_ADC7_AMUX_THM1_100K_PU>; + qcom,ratiometric; + qcom,hw-settle-time = <200>; + qcom,pre-scaling = <1 1>; + label = "pm7325_quiet_therm"; + }; + + channel@145 { + reg = <PM7325_ADC7_AMUX_THM2_100K_PU>; + qcom,ratiometric; + qcom,hw-settle-time = <200>; + qcom,pre-scaling = <1 1>; + label = "pm7325_cam_flash_therm"; + }; + + channel@146 { + reg = <PM7325_ADC7_AMUX_THM3_100K_PU>; + qcom,ratiometric; + qcom,hw-settle-time = <200>; + qcom,pre-scaling = <1 1>; + label = "pm7325_sdm_skin_therm"; + }; + + channel@147 { + reg = <PM7325_ADC7_AMUX_THM4_100K_PU>; + qcom,ratiometric; + qcom,hw-settle-time = <200>; + qcom,pre-scaling = <1 1>; + label = "pm7325_wide_rfc_therm"; + }; }; &pon_pwrkey {