Received: by 2002:a05:7412:251c:b0:e2:908c:2ebd with SMTP id w28csp331340rda; Sat, 21 Oct 2023 09:23:05 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGIvoiLq3Sto8W9RlwY3KrGrYVEuWd1mESJVY3phmzafpN0lWK2Kvx+cte9zEnrC4muqOjj X-Received: by 2002:a05:6358:999e:b0:143:1063:d1ed with SMTP id j30-20020a056358999e00b001431063d1edmr5464890rwb.26.1697905385663; Sat, 21 Oct 2023 09:23:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697905385; cv=none; d=google.com; s=arc-20160816; b=tDQRHpD+tVmsqX4NV650xRKAD0NrhJ9hWBY7jIg7m0Pynzm3CsCpuHgWA+0kH0J0p/ ul0MgD1NXmt1AYmzII1TxrvDpvhaDuzFSyrcqRqbZAwmoNpGzjRQ0xk5oZA1BPdskW+i g/uv/tz34P+STc+7e4NN7p1E/c413ICzVzNRXMPKmxVhjjF9zrJvjaDceN63Sgz/wGvi fC86QFvGANybKIScjqZUWZR450I14OeVqrztK9wmoXJO4IGKAOZ+3D74XWudsJxnHtvh p+f42vwDDlSO117V35/GbBNkcM6x3JhP2/hyaeF+lWRMhyPHUIwIxVRw3Bb4BI4VIRr7 N6ow== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=bq4OEcwD40oryiY81T817LlNpOkk1oBYf6X08dXM5lM=; fh=Yin6e1WWVuOF0Ku3e5BEI5iuQ/WF+aHMaWlb7zREUyk=; b=FR/ZdUkj6+1CB10N8he9tk6v9agsHXT1+9DKz3Wp/B8EpYlma/KxNxHBlH0HLSbm4v tO/w26uP7uMKJZjw8KLh0/yzNHdaOTPTKvtdu8gS8sY4P65fUdtvt7vjySx9JCuWExO9 pxk0OMIzSUORlZI9f9p9Je43aBNeLBLuL7sLDb9FfRhN9gW23BkhrVTPekKEiXudhkD9 ZS8Tr36hHY1O7AFr92khqq8Hh+Qvx89oI8uvvnVuGqev+eHTpuS3vCVB3KelZySxLSzD zcPPPvdW8pZFkeyqxJUxe6gaKXyEdvrwIFVe6S+bYAZ6bLz1PJV1ikT2cSFJ5b2zptTx 9dsg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="HZc0/7Li"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from morse.vger.email (morse.vger.email. [23.128.96.31]) by mx.google.com with ESMTPS id d64-20020a633643000000b005855f67e490si3733575pga.690.2023.10.21.09.23.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 21 Oct 2023 09:23:05 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) client-ip=23.128.96.31; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="HZc0/7Li"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by morse.vger.email (Postfix) with ESMTP id F10E98026967; Sat, 21 Oct 2023 09:23:00 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231785AbjJUQWn (ORCPT + 99 others); Sat, 21 Oct 2023 12:22:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60686 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231783AbjJUQWl (ORCPT ); Sat, 21 Oct 2023 12:22:41 -0400 Received: from mail-lj1-x22d.google.com (mail-lj1-x22d.google.com [IPv6:2a00:1450:4864:20::22d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CB70BD7A for ; Sat, 21 Oct 2023 09:22:26 -0700 (PDT) Received: by mail-lj1-x22d.google.com with SMTP id 38308e7fff4ca-2c5071165d5so3194831fa.0 for ; Sat, 21 Oct 2023 09:22:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697905345; x=1698510145; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=bq4OEcwD40oryiY81T817LlNpOkk1oBYf6X08dXM5lM=; b=HZc0/7LiCDpQAz3/J1MM0KFQ7YwQAmYjW00L7nzTWJ3UgqmXmXS8qbmOD+Cie6Xq+5 jLLdLgdntKRTKRFnN+qeYfYSUvSRyHOx9GptSJAf/UljTKJAMFGOosCosZ4XCbrAQcmA CiGvAGhWJqCIdrtl43pOCZyPyoQHwZTTlX5qBS2/nG3on5uOEnfvYnpe0z3XYfnmfRmk n09SD6aWmwvYy0wdItPnk5uyyIlnva+QCk1KtkfdPB3lyEHYdDWsfBOpQOP29WqZX+NE NMyUxmn4X1PpOyj68Uc7Nr5JhnB7GPygEldsRhYXAzTvOwn7q12Skr1POjgp79jBnMT4 XrAQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697905345; x=1698510145; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=bq4OEcwD40oryiY81T817LlNpOkk1oBYf6X08dXM5lM=; b=VZrLK89q0U9hE9If7kAqtpSJfB4fwePIJ4dJbhWHEnk6PqypVIKwOMNdtG3zabrwFq tZ8tnkL9ZQCGY5qpCwA50QeZOO9c/mDdS/iQPRMn7n8x+FAVEIWVLdn+HJv8QkCWIsy/ URvjFf+rPouP1HHfEC6gQRke1ZhUfWMpghFisRlS2F4xch1wJCgYL1vcFx0XhZfIy+je /A0/PLIk0gmstqTK1XBE3QntCA3biPDatwhsb+A4jjD6uSB9gy4yJT4TfxeMYW/0w/6S UdJQz67B7Xn7+eNVJs16x29O5vs5GeyHfQNCsdIm1G3llSoQ/N9DmaTsG7O6TzJgRHt8 VYbQ== X-Gm-Message-State: AOJu0YwivsKAJBgO70v/AKm0nOdjSwhZlnLQVhKmVNQtaytAzT0zyZoz ep1sBufYqHey0cFopfLpKWVxAw== X-Received: by 2002:a2e:a690:0:b0:2bf:f670:36dc with SMTP id q16-20020a2ea690000000b002bff67036dcmr2963289lje.49.1697905344949; Sat, 21 Oct 2023 09:22:24 -0700 (PDT) Received: from [192.168.1.116] (abyl4.neoplus.adsl.tpnet.pl. [83.9.31.4]) by smtp.gmail.com with ESMTPSA id j10-20020a2e3c0a000000b002b657f10b78sm867290lja.58.2023.10.21.09.22.23 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 21 Oct 2023 09:22:24 -0700 (PDT) Message-ID: <9a37d4a4-dcdf-4c39-8059-b640969f242a@linaro.org> Date: Sat, 21 Oct 2023 18:22:22 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH 4/4] arm64: dts: qcom: qcm6490-fairphone-fp5: Add PM7325 thermals Content-Language: en-US To: Luca Weiss , Luca Weiss , Andy Gross , Bjorn Andersson , Jonathan Cameron , Lars-Peter Clausen , Rob Herring , Krzysztof Kozlowski , Conor Dooley , ~postmarketos/upstreaming@lists.sr.ht Cc: 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 References: <20231013-fp5-thermals-v1-0-f14df01922e6@fairphone.com> <20231013-fp5-thermals-v1-4-f14df01922e6@fairphone.com> <34da335e-cbcd-4dc2-8a86-f31369db1fcd@linaro.org> <4958673.31r3eYUQgx@z3ntu.xyz> <5ac0d16a-0303-46c7-a008-31280629cc11@linaro.org> From: Konrad Dybcio In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit 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 morse.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (morse.vger.email [0.0.0.0]); Sat, 21 Oct 2023 09:23:01 -0700 (PDT) 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 >>>>> --- >>>>> >>>>> 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 >>>>> >>>>> #include >>>>> #include >>>>> #include >>>>> >>>>> @@ -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