Received: by 2002:a05:6a10:d5a5:0:0:0:0 with SMTP id gn37csp4929792pxb; Tue, 5 Oct 2021 13:33:31 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwNMTJFCfhfq7OajqVzxcWNrvlIqeYx7+EQc1gw4eqFh1esZBTPKP3DQTFscWQ9AhoKmW8x X-Received: by 2002:a17:906:d937:: with SMTP id rn23mr14607257ejb.101.1633466010851; Tue, 05 Oct 2021 13:33:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1633466010; cv=none; d=google.com; s=arc-20160816; b=HlS5fJ9WfRvTyD5MOiHayFqhm3qH61lf3Ir1mwpMR5rRfttGliQ3a0/VaN3HT+sPJd bCz3q5YUi4AQI5cqZe//oXxS5CZJNtd67XVuS5P7yf1A+P4Oz65Q947UtTui7+yXN1cP gYlsz+REg5EocKS8cROWHdbDzg1flyEsEqT+wBUOgiqNl/D+sJ9fyuhWwob6tW5MZlWS dB46SCPsUPFi/mziR+bXAq0NvxzqEUSMZUm0T7igfvCedY0YPrvdowjCdfudFrEEmvcp lE0PK+MTPQcl7ZGMDyHgdzIArn59RlZMo1Y4rG8Uw96EYyXBG7c32KW4e06raWsgfE4R oJBA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:dkim-signature; bh=ZyooK385UPa/hejgXrvQ3R8D7J/IvgX2J1+dY+z5Tfw=; b=1CEwMepoPjQVT2CDoydT9PlesxweoaM8OG5EMF6eeN5+x/Ez5TYS8mgEEuBN1kK0D5 zh7fXb9yphePr7o23fWyo2niPYD6JviK4qUmKREmjv/VW5/aNMe8FuY7UQ0MaaQgi3R0 d0zvyyzhUMU+fOnLzMgyCro6lJ0ftAV4XbX2FvhLRLDeyGMvSxv0RyNH1jPDLkCsZ+4E d43iznx4urV7DoouoHHF6enJW1D+N6Mb5pLFD7Dj3FAbrPX1VyRPInffyVBoOjBtq7Tu GN5ubiGs10twgsCFLTMuiG3EtaKl9BkimTHNbAINRjQoduO/R1mN0CW8N+RJ/4XKNxqQ MkAA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=dq8RULmq; 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 do4si13897980ejc.579.2021.10.05.13.33.07; Tue, 05 Oct 2021 13:33:30 -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=dq8RULmq; 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 S235994AbhJEUcu (ORCPT + 99 others); Tue, 5 Oct 2021 16:32:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45902 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236110AbhJEUct (ORCPT ); Tue, 5 Oct 2021 16:32:49 -0400 Received: from mail-qt1-x832.google.com (mail-qt1-x832.google.com [IPv6:2607:f8b0:4864:20::832]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B2C44C061755 for ; Tue, 5 Oct 2021 13:30:58 -0700 (PDT) Received: by mail-qt1-x832.google.com with SMTP id z23so356487qtv.9 for ; Tue, 05 Oct 2021 13:30:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=ZyooK385UPa/hejgXrvQ3R8D7J/IvgX2J1+dY+z5Tfw=; b=dq8RULmqd/pqVqtZm6l3zrjAcWOiMybIlP1ptQScoFB8gpWrSQ8JidbN23s38m6K75 5JgEoQurQtd2GoBxSHNmZM4ISkx5owMoAEl2w3xHjqn230lrazOB1eTJ1QJAx8LVWXyy SS2NweOIXmW9f3SvFpWPIPSumSt/q0bl6wzVijpo7KjXmzf29sYxvpU/kZMQHSU4PeQQ 228E10Ocp8fdk/G/Bw3Q5ZMXagGDLvrEyBEdNiPfO5ibORVbo1tYC82Cu6BWDfl2OfSM N+/H9K77hetRTmTbDuW8vJXji/7ePhCXQ+6Bokf9XT/Zh0Yf2N7/7jEeOpvfm2uEPlCY /9KQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=ZyooK385UPa/hejgXrvQ3R8D7J/IvgX2J1+dY+z5Tfw=; b=V8LgkNpBU+kIm7acoklI4zQN8nzOAfAONZrA7Kpl94qBl5uu06fqzxi8ywwH3C/P4i UNt0UW+W8EJ9n+yZJDbIhxJaEja0BJP5GJoyHFzAriHxH9e6auGEUqhNkTq+qcId+9Un XrepcrFxurE/Z9HOdlqKz/w94rwrxWm861hs9fz5uC5lSAUTZIZoWrpX39iqB3u+KemO wgEBttnH9/+2L4vgU8/wkDmEOiaHrs3SupHNMsjH7V9o+iv63ODtMwE8kfjU40bGYsqQ xzli9YMJo4ZtE4AHYhJOvBDC37CkEDAG4mObuZSDeXG8qrq+9LbZV7e8DTiDcKezpqjq 7T4Q== X-Gm-Message-State: AOAM5304uHy6SVz9iEYQ6FuJMWHTPZ68TyAHcva8BfIdV8s/pAoq51tE uyabQV/DnVJSSmJ1DQxBsYS0co0BrH2H2g== X-Received: by 2002:ac8:51d7:: with SMTP id d23mr22813497qtn.332.1633465857492; Tue, 05 Oct 2021 13:30:57 -0700 (PDT) Received: from [192.168.1.93] (pool-71-163-245-5.washdc.fios.verizon.net. [71.163.245.5]) by smtp.gmail.com with ESMTPSA id n16sm11924195qta.51.2021.10.05.13.30.56 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 05 Oct 2021 13:30:56 -0700 (PDT) Subject: Re: [PATCH v2 4/4] arm64: dts: qcom: sdm845: mtp: Add vadc channels and thermal zones To: Dmitry Baryshkov , Bjorn Andersson Cc: Matthias Kaehlcke , Andy Gross , Zhang Rui , Daniel Lezcano , Amit Kucheria , Rob Herring , "open list:DRM DRIVER FOR MSM ADRENO GPU" , Linux PM , "open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS" , open list References: <20210923212311.2877048-1-bjorn.andersson@linaro.org> <20210923212311.2877048-5-bjorn.andersson@linaro.org> From: Thara Gopinath Message-ID: Date: Tue, 5 Oct 2021 16:30:56 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 10/4/21 4:56 PM, Dmitry Baryshkov wrote: > 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. I know I am joining late to this party, since v3 is out. But before I send my acked-by, wanted to check/state a few things. To me, the not-so-perfect approach that you mention here is actually not so bad, considering the thermal sensor driver already is aware of internals of the adc device. The duplicating of node is kind of confusing. Also did you explore using one of _channel_write apis in iio framework to move all the writes into the adc device instead of thermal sensor driver ? > -- Warm Regards Thara (She/Her/Hers)