Received: by 2002:a05:6a10:d5a5:0:0:0:0 with SMTP id gn37csp4072392pxb; Mon, 4 Oct 2021 16:48:35 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzaDU7t9lDG8DH5ykkdtYp6YTMyLDO5aT6zpYFk+fVb/JPQ1LhD+pwlPxyiDBw8tFbVuNx7 X-Received: by 2002:a17:906:b782:: with SMTP id dt2mr20783559ejb.310.1633391314855; Mon, 04 Oct 2021 16:48:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1633391314; cv=none; d=google.com; s=arc-20160816; b=F53EB9sm33OHFMNKcKs+UURl1gAK+wi+sL1nGqnHTSrz3Nr2A2aRyEN1/9bUgQDwdJ QluGiCyAr2KANbbF4fufuX7qQsD+DCgEu/VUJjbZO+RYEE75SykY3npDv9WXsxLqYbW6 WYgU4ELIeMgfUL33AuMPAJZErFmqfjEarIPIKTKbmMncIBiQPSyG0kArtE59tDx+jlxr 7Er+aZZ8+e16yQ/iQZDi9UKU3FRA9Y/QepVnv2omJLub65sW1y6nnT66U62uZFE3OLEA mKsdaO4NMVR1IwoF/IdmrE75wCbNYxqcgDFuo3UBxHuy9bgDEjoRCESSyNzAgOXAAGnu i/OA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=1eQiWMZ4lymZhXSohlx4RiHi1Znkn0XwFspzyAQ+6Iw=; b=CNm6uYbLna3abeoH2dKVmPwUJI2T0XO389csKaYrgwXplAfDm/Y2jmU5J6ltI8V8Hh 6WyifAQu1apE56krc43FMBXatn9EoIkS23e1B7NVt/m70DsrcTLiisOT7LBfH+ir53zB qJL+87eHKgg/+JwUpUJkkygO6Etfw4yCmQ61Hgx8qejxIZ2GYPubpGbnIE8vHDPB0esx adJfJWDDeWQPRiyyXJ3N03Hzpdu4YArE3uKzpheffDgZiEMUr18wS2TfnpeT8c556xdk K8Hx3l82IrBwjpw57SivqFxvBh1xNSDSt1abHjBsznuSSAX7sOGHdhUYfHV0iRXoMA+4 ErYA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="yAj0KI/Q"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g14si21063298edj.523.2021.10.04.16.48.11; Mon, 04 Oct 2021 16:48:34 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="yAj0KI/Q"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233367AbhJDU6P (ORCPT + 99 others); Mon, 4 Oct 2021 16:58:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57306 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229486AbhJDU6N (ORCPT ); Mon, 4 Oct 2021 16:58:13 -0400 Received: from mail-qt1-x830.google.com (mail-qt1-x830.google.com [IPv6:2607:f8b0:4864:20::830]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C70BAC061745 for ; Mon, 4 Oct 2021 13:56:23 -0700 (PDT) Received: by mail-qt1-x830.google.com with SMTP id r1so17187888qta.12 for ; Mon, 04 Oct 2021 13:56:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=1eQiWMZ4lymZhXSohlx4RiHi1Znkn0XwFspzyAQ+6Iw=; b=yAj0KI/Q4RAtOOwCLsC+i6W48grzLyHT6dYmBvRQ80kX4+c6EJhAiV63SRn7d7PMCp IomeYeocu716ENOjAmxvDgQwOYqr+OmL5Mf3fm8h9RlXpNfecoRWuiloIIV9hzPQfA/Q t6LdNbGcfFB0Sfn/SF7S+dbscHu1phxbLpYSE907d54wt7MbORsLhRkoZ527iRDjP1Mg QVZlPS+BJvEO9b3jyje9Lnu2yF9F02ne+U/1skn8S+jyeVmFo0I5XW0IM8coNfwwTjOX Tx0j8OJ2Mx3fqYk66PX2Hbr5UDe30WRM12n1GR6gpejN2iW83OpVHuQ/D1KxC7v8jXIt QVdg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=1eQiWMZ4lymZhXSohlx4RiHi1Znkn0XwFspzyAQ+6Iw=; b=p9fvUNH4NA4sZUCTTACNq3u/iGa4OYmyBZ0zQlE6EM42a7Ve70jMiNplI8O8Vp6KM8 j3CfRL5+ErPcZzmLqL8AHgAifbehTvddmtefpC2SKdeyI0btp5GzXB4aluDxjH42KyqB XF/1av4BaxTII+6Y4pE/W0EEOHXWFeNFazkx+okHsw8fiwlevzAFdgfHlWkGsAqvAdqr yBeFo+fYfHpu77qjPV4aAtVPKvzWbNbm/CyJK4QadiDrmni3qGlwwakGS+zMOSLZHQjv E8zbLOB7hMbjBl32uqBkII8bH+nswX+WuLlD9yaaGxftWuEV0dYEZuJO5w7kJJXnQpWy 3MnA== X-Gm-Message-State: AOAM530Cq2f7iGiMhge2e5avKkl9QS4sSxanqJz6943OUOqgSaXvjZI5 Ww0v/SMdVPycdpl7kkpxdZ4d8XbXHUH60FiF7jT4OA== X-Received: by 2002:ac8:1011:: with SMTP id z17mr15928369qti.388.1633380982877; Mon, 04 Oct 2021 13:56:22 -0700 (PDT) MIME-Version: 1.0 References: <20210923212311.2877048-1-bjorn.andersson@linaro.org> <20210923212311.2877048-5-bjorn.andersson@linaro.org> In-Reply-To: From: Dmitry Baryshkov Date: Mon, 4 Oct 2021 23:56:11 +0300 Message-ID: Subject: Re: [PATCH v2 4/4] arm64: dts: qcom: sdm845: mtp: Add vadc channels and thermal zones To: Bjorn Andersson Cc: Matthias Kaehlcke , Andy Gross , Zhang Rui , Daniel Lezcano , Amit Kucheria , Rob Herring , Thara Gopinath , "open list:DRM DRIVER FOR MSM ADRENO GPU" , Linux PM , "open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS" , open list Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 4 Oct 2021 at 23:13, Bjorn Andersson wrote: > > On Wed 29 Sep 11:40 PDT 2021, Matthias Kaehlcke wrote: > > > On Thu, Sep 23, 2021 at 02:23:11PM -0700, Bjorn Andersson wrote: > > > Downstream defines four ADC channels related to thermal sensors external > > > to the PM8998 and two channels for internal voltage measurements. > > > > > > Add these to the upstream SDM845 MTP, describe the thermal monitor > > > channels and add thermal_zones for these. > > > > > > Signed-off-by: Bjorn Andersson > > > --- > > > > > > In addition to the iio channels exposed by v1, Daniel wanted thermal_zones... > > > > > > Changes since v1: > > > - Enable the pm8998_adc_tm and describe the ADC channels > > > - Add thermal-zones for the new channels > > > > > > arch/arm64/boot/dts/qcom/sdm845-mtp.dts | 128 ++++++++++++++++++++++++ > > > 1 file changed, 128 insertions(+) > > > > > > diff --git a/arch/arm64/boot/dts/qcom/sdm845-mtp.dts b/arch/arm64/boot/dts/qcom/sdm845-mtp.dts > [..] > > > +&pm8998_adc { > > > + adc-chan@4c { > > > + reg = ; > > > + label = "xo_therm"; > > > + }; > > > + > > > + adc-chan@4d { > > > + reg = ; > > > + label = "msm_therm"; > > > + }; > > > + > > > + adc-chan@4f { > > > + reg = ; > > > + label = "pa_therm1"; > > > + }; > > > + > > > + adc-chan@51 { > > > + reg = ; > > > + label = "quiet_therm"; > > > + }; > > > + > > > + adc-chan@83 { > > > + reg = ; > > > + label = "vph_pwr"; > > > + }; > > > + > > > + adc-chan@85 { > > > + reg = ; > > > + label = "vcoin"; > > > + }; > > > +}; > > > + > > > +&pm8998_adc_tm { > > > + status = "okay"; > > > + > > > + xo-thermistor@1 { > > > + reg = <1>; > > > + io-channels = <&pm8998_adc ADC5_XO_THERM_100K_PU>; > > > + qcom,ratiometric; > > > + qcom,hw-settle-time-us = <200>; > > > + }; > > > + > > > + msm-thermistor@2 { > > > + reg = <2>; > > > + io-channels = <&pm8998_adc ADC5_AMUX_THM1_100K_PU>; > > > + qcom,ratiometric; > > > + qcom,hw-settle-time-us = <200>; > > > + }; > > > + > > > + pa-thermistor@3 { > > > + reg = <3>; > > > + io-channels = <&pm8998_adc ADC5_AMUX_THM3_100K_PU>; > > > + qcom,ratiometric; > > > + qcom,hw-settle-time-us = <200>; > > > + }; > > > + > > > + quiet-thermistor@4 { > > > + reg = <4>; > > > + io-channels = <&pm8998_adc ADC5_AMUX_THM5_100K_PU>; > > > + qcom,ratiometric; > > > + qcom,hw-settle-time-us = <200>; > > > + }; > > > +}; > > > + > > > > The example in the 'qcom,spmi-adc-tm5' binding specifies 'qcom,ratiometric' > > and 'qcom,hw-settle-time-us' for both the ADC and the thermal monitor, so do > > several board files (e.g. sm8250-mtp.dts and qrb5165-rb5.dts). This apparent > > redundancy bothered me earlier, it's not really clear to me whether it's > > needed/recommended or not. Do you happen to have any insights on this? > > Hmm, you're right and I missed this in defining my channels. I've not > looked at this detail, just got reasonable readings from my thermal > zones and was happy about that. > > Dmitry, do you have any further insights why these properties are > supposed to be duplicated between the adc channel and the thermal zones? Because both ADC channel and thermal zone registers should be programmed accordingly. One not-so-perfect approach would be to use io-channels property to locate the adc's adc-chan node and to parse it. However this way thermal driver would have to know the exact structure of adc's device tree nodes. Another (even worse) solution would be to introduce qcom-specific API to query these properties from the IIO channel. Selecting between these two options I decided to follow the downstream path and just to duplicate these few properties. -- With best wishes Dmitry