From patchwork Tue Aug 27 12:14:04 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amit Kucheria X-Patchwork-Id: 172281 Delivered-To: patch@linaro.org Received: by 2002:a92:d204:0:0:0:0:0 with SMTP id y4csp5702369ily; Tue, 27 Aug 2019 05:15:01 -0700 (PDT) X-Google-Smtp-Source: APXvYqxwH/BXaMipu+VwzniVrJg2iVimP9Ld5Dq8oNm+c6yTNBLYUEpXc7tshk2CyltxslzqZInH X-Received: by 2002:a63:2004:: with SMTP id g4mr20004647pgg.97.1566908101410; Tue, 27 Aug 2019 05:15:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566908101; cv=none; d=google.com; s=arc-20160816; b=G50oEddFAo8gwaxryCfuw0XVHDEh1NEcRLmTx9qsOR4KViR8knhmbfbXCICJok1AlW 7XRJmXSQ6emsZbgx2+/GhAfHZuLcG7FM0iU1wAc6yezOpLPCJ9Vj2LKisyQoSc0ULzn9 IoPq9CLBLtmee+LKAjgSY2CDgpGBHpd+j7v6+Jg4PhFNOJLJHcHOS0rp49el3p8Es9hj l+5eRa4MBiwzFJy8q4qq6u+aa65JjQy/ruCigiymNrLpY77X+yJO4PrOroMYSzP9uAnx ToBQsl2FnWtZcz4eUwZieG61aZCAugYYGx/57vXmdUdvgQIvualmbMlEaYrz7dSKaoJB SWBg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:references :in-reply-to:message-id:date:subject:cc:to:from:dkim-signature; bh=R8SVDVYDPqPD92rv7vIeGNMJyLBzmIm/PMxRYwWOMAE=; b=PT2e5A904QQFcblxqceWETYyQkN3NR03qNHb10KDV6AEJGvnN6ueRTU/VpbP/kJ+U0 qYKrfaLNoBkZjqb3ZX+bzcsM2tC5ZkJfvnA8WRDIGZAmnmZwrQb71CDYAJr0vWN5s7+y PKOL1XzGBjP7y+x1QketQMBhjEUgJfbNaudJQP6HoOAYRC4OHOeHTtg3X2S6rhwScM+1 NnZfFYCRFqtILcQRFABM6RgmU4LGmlPaYw9WRW+2rdFYliIofQYRWdrDTuiZueyJAYOA 1WvHrezgGObj2FWApxaaK2klaO/y7D2aVIrncmVoitcipHiSwyShf9ejdtZHrlmchqfC CmBA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ZrzooqLl; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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. [209.132.180.67]) by mx.google.com with ESMTP id g31si2633704plg.233.2019.08.27.05.15.01; Tue, 27 Aug 2019 05:15:01 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ZrzooqLl; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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 S1729911AbfH0MPA (ORCPT + 28 others); Tue, 27 Aug 2019 08:15:00 -0400 Received: from mail-pf1-f195.google.com ([209.85.210.195]:36740 "EHLO mail-pf1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729867AbfH0MO5 (ORCPT ); Tue, 27 Aug 2019 08:14:57 -0400 Received: by mail-pf1-f195.google.com with SMTP id w2so14018323pfi.3 for ; Tue, 27 Aug 2019 05:14:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :in-reply-to:references; bh=R8SVDVYDPqPD92rv7vIeGNMJyLBzmIm/PMxRYwWOMAE=; b=ZrzooqLlegbOShgbGsH2MK5xvpPaVSmHD/uxSLmeXrdazxVBHUw3GUXSK5Wo3Y2lkS +EIr5jWTKWTmPxi5/twmpbewDG3PSoSM3SX2PSQvnyIp0AaQnQMKOjdzUuN8scocPqaq fwjHknRt5+X56MFeLpmN01ghBK/NYJzMhx+6zi+eHIYHzOrl/ecjiMuwwjq7iAd4bylI nO4avgUA6v+KpXsTPw7bmYwZv2cBoLtroMDxcv7UWH/PeE9Kh3vtcMOPftP1RIsWiLBj ZNCwEp0vpkRWoMgoSrS1qZjDu2cwUO4hkvcANV7ZMgrdjo50l22m2xkou+csppAMkJZ/ Tknw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:in-reply-to:references; bh=R8SVDVYDPqPD92rv7vIeGNMJyLBzmIm/PMxRYwWOMAE=; b=AIoB2l9/pAHkmJhQqO4DvpJoQlf8Tj9TgASmmwOwAfGLzS5V3aqYIgvNWLkaCYFRkg Afy2XPZ7pcsaouiy96SVRJo/hnXnqZV88qhDFBbDdZnpjwmRK6TxlCMJNHK0gDJTU9OI 3JIK5H/uyPJ9UAwDuBDM2zO7m1JiiIgRFgG/6DscdwoxF/DkJa31NQE3qi3kZFfXnCdU G4y2vDPaihF3QzgC5XV6wWYM64EnX+drgKK8lMnLNszyyJJA1/l6j1eCeMz7d7A1RbWt ViRArqHPaIlIkJFL/O8tuaTyZ55g88zNqkGv2oxn+2JK0Y5Q8ah2ziwy+gqQnyTx5D3U q3Aw== X-Gm-Message-State: APjAAAV+GLTjmEvAM2aRV9uditP5aor9fD3bNMUc8ZsZ6v7HrktGBRi0 BXUoCDcm3HrO9I7W5vMktcj6D7QSiM48eg== X-Received: by 2002:a63:de43:: with SMTP id y3mr21196569pgi.211.1566908096789; Tue, 27 Aug 2019 05:14:56 -0700 (PDT) Received: from localhost ([49.248.54.193]) by smtp.gmail.com with ESMTPSA id e13sm18212271pfl.130.2019.08.27.05.14.55 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 27 Aug 2019 05:14:56 -0700 (PDT) From: Amit Kucheria To: linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, bjorn.andersson@linaro.org, edubezval@gmail.com, agross@kernel.org, sboyd@kernel.org, masneyb@onstation.org, marc.w.gonzalez@free.fr, Daniel Lezcano , Mark Rutland , Rob Herring , Zhang Rui Cc: devicetree@vger.kernel.org Subject: [PATCH v2 08/15] arm64: dts: sdm845: thermal: Add interrupt support Date: Tue, 27 Aug 2019 17:44:04 +0530 Message-Id: <32c755a9b9959b358e99d3b0957c283a6c6f0e89.1566907161.git.amit.kucheria@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: References: In-Reply-To: References: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Register upper-lower interrupts for each of the two tsens controllers. Signed-off-by: Amit Kucheria --- arch/arm64/boot/dts/qcom/sdm845.dtsi | 88 +++++++++++++++------------- 1 file changed, 46 insertions(+), 42 deletions(-) -- 2.17.1 diff --git a/arch/arm64/boot/dts/qcom/sdm845.dtsi b/arch/arm64/boot/dts/qcom/sdm845.dtsi index 4babff5f19b5c..fdd74c39b744e 100644 --- a/arch/arm64/boot/dts/qcom/sdm845.dtsi +++ b/arch/arm64/boot/dts/qcom/sdm845.dtsi @@ -2386,6 +2386,8 @@ reg = <0 0x0c263000 0 0x1ff>, /* TM */ <0 0x0c222000 0 0x1ff>; /* SROT */ #qcom,sensors = <13>; + interrupts = ; + interrupt-names = "uplow"; #thermal-sensor-cells = <1>; }; @@ -2394,6 +2396,8 @@ reg = <0 0x0c265000 0 0x1ff>, /* TM */ <0 0x0c223000 0 0x1ff>; /* SROT */ #qcom,sensors = <8>; + interrupts = ; + interrupt-names = "uplow"; #thermal-sensor-cells = <1>; }; @@ -2712,8 +2716,8 @@ thermal-zones { cpu0-thermal { - polling-delay-passive = <250>; - polling-delay = <1000>; + polling-delay-passive = <0>; + polling-delay = <0>; thermal-sensors = <&tsens0 1>; @@ -2756,8 +2760,8 @@ }; cpu1-thermal { - polling-delay-passive = <250>; - polling-delay = <1000>; + polling-delay-passive = <0>; + polling-delay = <0>; thermal-sensors = <&tsens0 2>; @@ -2800,8 +2804,8 @@ }; cpu2-thermal { - polling-delay-passive = <250>; - polling-delay = <1000>; + polling-delay-passive = <0>; + polling-delay = <0>; thermal-sensors = <&tsens0 3>; @@ -2844,8 +2848,8 @@ }; cpu3-thermal { - polling-delay-passive = <250>; - polling-delay = <1000>; + polling-delay-passive = <0>; + polling-delay = <0>; thermal-sensors = <&tsens0 4>; @@ -2888,8 +2892,8 @@ }; cpu4-thermal { - polling-delay-passive = <250>; - polling-delay = <1000>; + polling-delay-passive = <0>; + polling-delay = <0>; thermal-sensors = <&tsens0 7>; @@ -2932,8 +2936,8 @@ }; cpu5-thermal { - polling-delay-passive = <250>; - polling-delay = <1000>; + polling-delay-passive = <0>; + polling-delay = <0>; thermal-sensors = <&tsens0 8>; @@ -2976,8 +2980,8 @@ }; cpu6-thermal { - polling-delay-passive = <250>; - polling-delay = <1000>; + polling-delay-passive = <0>; + polling-delay = <0>; thermal-sensors = <&tsens0 9>; @@ -3020,8 +3024,8 @@ }; cpu7-thermal { - polling-delay-passive = <250>; - polling-delay = <1000>; + polling-delay-passive = <0>; + polling-delay = <0>; thermal-sensors = <&tsens0 10>; @@ -3064,8 +3068,8 @@ }; aoss0-thermal { - polling-delay-passive = <250>; - polling-delay = <1000>; + polling-delay-passive = <0>; + polling-delay = <0>; thermal-sensors = <&tsens0 0>; @@ -3079,8 +3083,8 @@ }; cluster0-thermal { - polling-delay-passive = <250>; - polling-delay = <1000>; + polling-delay-passive = <0>; + polling-delay = <0>; thermal-sensors = <&tsens0 5>; @@ -3099,8 +3103,8 @@ }; cluster1-thermal { - polling-delay-passive = <250>; - polling-delay = <1000>; + polling-delay-passive = <0>; + polling-delay = <0>; thermal-sensors = <&tsens0 6>; @@ -3119,8 +3123,8 @@ }; gpu-thermal-top { - polling-delay-passive = <250>; - polling-delay = <1000>; + polling-delay-passive = <0>; + polling-delay = <0>; thermal-sensors = <&tsens0 11>; @@ -3134,8 +3138,8 @@ }; gpu-thermal-bottom { - polling-delay-passive = <250>; - polling-delay = <1000>; + polling-delay-passive = <0>; + polling-delay = <0>; thermal-sensors = <&tsens0 12>; @@ -3149,8 +3153,8 @@ }; aoss1-thermal { - polling-delay-passive = <250>; - polling-delay = <1000>; + polling-delay-passive = <0>; + polling-delay = <0>; thermal-sensors = <&tsens1 0>; @@ -3164,8 +3168,8 @@ }; q6-modem-thermal { - polling-delay-passive = <250>; - polling-delay = <1000>; + polling-delay-passive = <0>; + polling-delay = <0>; thermal-sensors = <&tsens1 1>; @@ -3179,8 +3183,8 @@ }; mem-thermal { - polling-delay-passive = <250>; - polling-delay = <1000>; + polling-delay-passive = <0>; + polling-delay = <0>; thermal-sensors = <&tsens1 2>; @@ -3194,8 +3198,8 @@ }; wlan-thermal { - polling-delay-passive = <250>; - polling-delay = <1000>; + polling-delay-passive = <0>; + polling-delay = <0>; thermal-sensors = <&tsens1 3>; @@ -3209,8 +3213,8 @@ }; q6-hvx-thermal { - polling-delay-passive = <250>; - polling-delay = <1000>; + polling-delay-passive = <0>; + polling-delay = <0>; thermal-sensors = <&tsens1 4>; @@ -3224,8 +3228,8 @@ }; camera-thermal { - polling-delay-passive = <250>; - polling-delay = <1000>; + polling-delay-passive = <0>; + polling-delay = <0>; thermal-sensors = <&tsens1 5>; @@ -3239,8 +3243,8 @@ }; video-thermal { - polling-delay-passive = <250>; - polling-delay = <1000>; + polling-delay-passive = <0>; + polling-delay = <0>; thermal-sensors = <&tsens1 6>; @@ -3254,8 +3258,8 @@ }; modem-thermal { - polling-delay-passive = <250>; - polling-delay = <1000>; + polling-delay-passive = <0>; + polling-delay = <0>; thermal-sensors = <&tsens1 7>; From patchwork Tue Aug 27 12:14:05 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amit Kucheria X-Patchwork-Id: 172282 Delivered-To: patch@linaro.org Received: by 2002:a92:d204:0:0:0:0:0 with SMTP id y4csp5702447ily; Tue, 27 Aug 2019 05:15:05 -0700 (PDT) X-Google-Smtp-Source: APXvYqxs6TGrg6xl4qdAx0tVT7W8jjOnq9fb2CwJCk88s99oUi71PPkEMtIM1p0jph0jbWfhUaw2 X-Received: by 2002:a63:c203:: with SMTP id b3mr21105714pgd.450.1566908105606; Tue, 27 Aug 2019 05:15:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566908105; cv=none; d=google.com; s=arc-20160816; b=uUlE9E4AwfAu3T88iZJWeAHshUX5nDkVfg+sbONaU12SRsvz40NHM5+jwGdBNgh8Us qjy4+J5oopY6XlKqQQYjIINNWPDVDsy4vWBCy3qim93HjkE15xr2ScZKWmWr1oS2xGNq kBgf4b4acR1h18ZyXGIFdaKqwPEGJ/Vfi63pDXONYk0R7imBOnWAy41OwN2zbySoRiWB 6UseCobdTrgNMJU1A8DUoffXg8RErvoOtX43Wy4baeLEzFJLZEYTRUphK/xsxeAWBjHL eFAoESJQ+TPSUjzM3k8OBxwzvy0oqbhSCBMJcPEzv64dAO2NLycusNSBOitpnmbo7219 Z/gA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:references :in-reply-to:message-id:date:subject:cc:to:from:dkim-signature; bh=Z0Le2PAu5WlIzLrzHU7A+NgFGbrzrQB5/n7YQK779lQ=; b=ebWbkYxA9GWGt0K117m7BhDgUMuu6rBx4tGZxvtqGorfmeVZzJHjRXMnaySgsxXrPk cIAX6RYz7ZGw32KkU+MXcmiKG/tT+xsAG0cXiCBP+ahGbbLX5rV3ob16dmocBDqGYlVm WFCbp+ommWy1HvX0xPSMuZKZ/5ALmUj5SB3dcuDo3WJKOc4YLn4vCoWdLUc+M8O8NK7P 6KJs/BToU3lUsxZEzfA5x+yAY+o3ZESSmi1SF3T+C3iVjJWzIUTSd+KibUKU8vY+DIn4 u3duyUVdJpX5XPG5sit56DpG7MxH1R6pfCAK9QCFLdrqdeTjCY2p/T9XK6vC/AAujxJQ dXEQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=whhOKA68; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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. [209.132.180.67]) by mx.google.com with ESMTP id q7si971253pfg.203.2019.08.27.05.15.05; Tue, 27 Aug 2019 05:15:05 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=whhOKA68; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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 S1729945AbfH0MPE (ORCPT + 28 others); Tue, 27 Aug 2019 08:15:04 -0400 Received: from mail-pf1-f193.google.com ([209.85.210.193]:42334 "EHLO mail-pf1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729916AbfH0MPC (ORCPT ); Tue, 27 Aug 2019 08:15:02 -0400 Received: by mail-pf1-f193.google.com with SMTP id i30so14000281pfk.9 for ; Tue, 27 Aug 2019 05:15:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :in-reply-to:references; bh=Z0Le2PAu5WlIzLrzHU7A+NgFGbrzrQB5/n7YQK779lQ=; b=whhOKA68YptOYkj4IkTgoOPKKfPHlSFwGl1urwiruMkzIGkYQcY4eGQH+oGLL0o3FR ah28jbdMtX56fl5LBfgovM3UL/CJujI5CG9fGDDCydwezhToV+s2eeFjLd6vRDKIZJJ0 5W9Dlgmk8HcUoOE1NyXRGQwEv1+kv5F3O/pGbVzSVV4AJrQqbLqKdhW8YUUGSmB0HzFS +LfAdgaWNiFJTeCfG1A75xlQX47dZs4oPCcaTBA/J7wc8lQs08aQzczYk8ogKGbcFlcJ u6d8NjmjO7pRMrMZZ9CK/SPQ1MRXKEdzPO8lI8LnF1Q3aG5ELhfAVAo9z6Z90nglQMX/ G/Gg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:in-reply-to:references; bh=Z0Le2PAu5WlIzLrzHU7A+NgFGbrzrQB5/n7YQK779lQ=; b=i8RxfdxEBthYupCjWCATlR/RnRRoc4Jd92+UBPq4XUORSIOq9sxa4izMuwjzampo4b 2GBr5iBf7OakW4dcn5ZH1y4/XyUxzxzCHY/MHeeLW8pNjZs+OLo5j+sq7GRKemLqYWEA cBNC4euw1YEY9Mj4ZBTDGN6EtRoSU9pdMXPFiYVqqRUgKhXmIXILtBARsSgF45+xXiEL cwNLLY1MS9Lp/+Eixy0ZL/1pN1W8lwBJIt5d4obQ6PR/PEOZiyphz6m1Q+egtXTaQU3y GYmuq5aoGWHa8r4iwAhvYtqhYjYUO2q2adhFntx5o/HsApTfMGwLyCXRs5QljqY2jVyb 797A== X-Gm-Message-State: APjAAAVwV/PzyxuEJZZNWoOp3vLWIvzKKcPlN3l4+R8HoV41iQAfjy+k ZRsFuHZJrcR4qFygr/r/B3PLBn1SqU1CBQ== X-Received: by 2002:a17:90a:bf0e:: with SMTP id c14mr8812038pjs.140.1566908100794; Tue, 27 Aug 2019 05:15:00 -0700 (PDT) Received: from localhost ([49.248.54.193]) by smtp.gmail.com with ESMTPSA id o3sm4426355pje.1.2019.08.27.05.14.59 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 27 Aug 2019 05:15:00 -0700 (PDT) From: Amit Kucheria To: linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, bjorn.andersson@linaro.org, edubezval@gmail.com, agross@kernel.org, sboyd@kernel.org, masneyb@onstation.org, marc.w.gonzalez@free.fr, Daniel Lezcano , Mark Rutland , Rob Herring , Zhang Rui Cc: devicetree@vger.kernel.org Subject: [PATCH v2 09/15] arm64: dts: msm8996: thermal: Add interrupt support Date: Tue, 27 Aug 2019 17:44:05 +0530 Message-Id: <1cb5ab682bce53d32f3a73b5b29cc6c3e800bfcc.1566907161.git.amit.kucheria@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: References: In-Reply-To: References: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Register upper-lower interrupts for each of the two tsens controllers. Signed-off-by: Amit Kucheria --- arch/arm64/boot/dts/qcom/msm8996.dtsi | 60 ++++++++++++++------------- 1 file changed, 32 insertions(+), 28 deletions(-) -- 2.17.1 diff --git a/arch/arm64/boot/dts/qcom/msm8996.dtsi b/arch/arm64/boot/dts/qcom/msm8996.dtsi index 96c0a481f454e..bb763b362c162 100644 --- a/arch/arm64/boot/dts/qcom/msm8996.dtsi +++ b/arch/arm64/boot/dts/qcom/msm8996.dtsi @@ -175,8 +175,8 @@ thermal-zones { cpu0-thermal { - polling-delay-passive = <250>; - polling-delay = <1000>; + polling-delay-passive = <0>; + polling-delay = <0>; thermal-sensors = <&tsens0 3>; @@ -196,8 +196,8 @@ }; cpu1-thermal { - polling-delay-passive = <250>; - polling-delay = <1000>; + polling-delay-passive = <0>; + polling-delay = <0>; thermal-sensors = <&tsens0 5>; @@ -217,8 +217,8 @@ }; cpu2-thermal { - polling-delay-passive = <250>; - polling-delay = <1000>; + polling-delay-passive = <0>; + polling-delay = <0>; thermal-sensors = <&tsens0 8>; @@ -238,8 +238,8 @@ }; cpu3-thermal { - polling-delay-passive = <250>; - polling-delay = <1000>; + polling-delay-passive = <0>; + polling-delay = <0>; thermal-sensors = <&tsens0 10>; @@ -259,8 +259,8 @@ }; gpu-thermal-top { - polling-delay-passive = <250>; - polling-delay = <1000>; + polling-delay-passive = <0>; + polling-delay = <0>; thermal-sensors = <&tsens1 6>; @@ -274,8 +274,8 @@ }; gpu-thermal-bottom { - polling-delay-passive = <250>; - polling-delay = <1000>; + polling-delay-passive = <0>; + polling-delay = <0>; thermal-sensors = <&tsens1 7>; @@ -289,8 +289,8 @@ }; m4m-thermal { - polling-delay-passive = <250>; - polling-delay = <1000>; + polling-delay-passive = <0>; + polling-delay = <0>; thermal-sensors = <&tsens0 1>; @@ -304,8 +304,8 @@ }; l3-or-venus-thermal { - polling-delay-passive = <250>; - polling-delay = <1000>; + polling-delay-passive = <0>; + polling-delay = <0>; thermal-sensors = <&tsens0 2>; @@ -319,8 +319,8 @@ }; cluster0-l2-thermal { - polling-delay-passive = <250>; - polling-delay = <1000>; + polling-delay-passive = <0>; + polling-delay = <0>; thermal-sensors = <&tsens0 7>; @@ -334,8 +334,8 @@ }; cluster1-l2-thermal { - polling-delay-passive = <250>; - polling-delay = <1000>; + polling-delay-passive = <0>; + polling-delay = <0>; thermal-sensors = <&tsens0 12>; @@ -349,8 +349,8 @@ }; camera-thermal { - polling-delay-passive = <250>; - polling-delay = <1000>; + polling-delay-passive = <0>; + polling-delay = <0>; thermal-sensors = <&tsens1 1>; @@ -364,8 +364,8 @@ }; q6-dsp-thermal { - polling-delay-passive = <250>; - polling-delay = <1000>; + polling-delay-passive = <0>; + polling-delay = <0>; thermal-sensors = <&tsens1 2>; @@ -379,8 +379,8 @@ }; mem-thermal { - polling-delay-passive = <250>; - polling-delay = <1000>; + polling-delay-passive = <0>; + polling-delay = <0>; thermal-sensors = <&tsens1 3>; @@ -394,8 +394,8 @@ }; modemtx-thermal { - polling-delay-passive = <250>; - polling-delay = <1000>; + polling-delay-passive = <0>; + polling-delay = <0>; thermal-sensors = <&tsens1 4>; @@ -591,6 +591,8 @@ reg = <0x4a9000 0x1000>, /* TM */ <0x4a8000 0x1000>; /* SROT */ #qcom,sensors = <13>; + interrupts = ; + interrupt-names = "uplow"; #thermal-sensor-cells = <1>; }; @@ -599,6 +601,8 @@ reg = <0x4ad000 0x1000>, /* TM */ <0x4ac000 0x1000>; /* SROT */ #qcom,sensors = <8>; + interrupts = ; + interrupt-names = "uplow"; #thermal-sensor-cells = <1>; }; From patchwork Tue Aug 27 12:14:07 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amit Kucheria X-Patchwork-Id: 172284 Delivered-To: patch@linaro.org Received: by 2002:a92:d204:0:0:0:0:0 with SMTP id y4csp5702660ily; Tue, 27 Aug 2019 05:15:14 -0700 (PDT) X-Google-Smtp-Source: APXvYqyIaISNPSI/JaLUnyAhmT8Zd6gGI9yWRdSeKhtMxTTasN4n98Uj+GyNOSxsTHPLGE42GBXj X-Received: by 2002:a63:e44b:: with SMTP id i11mr20372731pgk.297.1566908114482; Tue, 27 Aug 2019 05:15:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566908114; cv=none; d=google.com; s=arc-20160816; b=GUDZdYWeamjzO6kmMgIT5HBE4HO2B+VD2U/vHWz5f218ZmcMmX8ivibgiNC6GMzgxV N9IFXvhwuZhw2WNu3AxbRboJuACpvQrccI3/V2RM40T9jl3ey8oUCxA7VXAehgUmnWns rpYHTOevwfpjd1lC4DHxeTgr8miAj0QDPHPXZLOCvWn0hsBmwqnjvqsZD8+oxYvDCX1x H6mHOtQ6Cdhk2WmbJz05q8rWY4Qysp/zxniPcatYs1Uci4gOCBYVnj96DuJiIBkwnsl2 +sSTL4YHzzZATSLZDZVrPqrLPW5cPeSyxliOqkc2y3akHyYZ14exT6YA4p2hJpuqGlKI B9dg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:references :in-reply-to:message-id:date:subject:cc:to:from:dkim-signature; bh=A5EmULFtDl5i5Z5Rzq6bwCLJMqdhrquKs6z6Oe0kR7k=; b=LAX/kik8U6BtcVGl2PnJoSj1uPEGpKKAA4jzBoO6jE/8anCcEl8auWDNOIrCK2u665 8fQfg/wBXdNbtLt6GvPuZyDBJ/uDJLCcaq4FY1ita+KP02Zl/a6ep3JCV9qF19hNqmMQ aw5oCpHmlJN3Jb2YDTpPY9KHQ3GDEGLQ+amHdopjmLRb+srAjlExN+b3KkL0MZA9mGDz luxO/UvfUCOAa+V6Xh3MmwLpEWZCmE3nRrnVSO8hFlxm2S/riPgpZsBsuh8/W7mNFaFj OaQfLoB/SPNycQctksmv4/PkJzozuLHf06WjzWWrt577VUZFxFkIcEoBCe992//EblXu iI/A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=w8Oc3pFT; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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. [209.132.180.67]) by mx.google.com with ESMTP id t22si8978937plr.283.2019.08.27.05.15.14; Tue, 27 Aug 2019 05:15:14 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=w8Oc3pFT; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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 S1730007AbfH0MPN (ORCPT + 28 others); Tue, 27 Aug 2019 08:15:13 -0400 Received: from mail-pf1-f196.google.com ([209.85.210.196]:43944 "EHLO mail-pf1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729970AbfH0MPK (ORCPT ); Tue, 27 Aug 2019 08:15:10 -0400 Received: by mail-pf1-f196.google.com with SMTP id v12so14009061pfn.10 for ; Tue, 27 Aug 2019 05:15:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :in-reply-to:references; bh=A5EmULFtDl5i5Z5Rzq6bwCLJMqdhrquKs6z6Oe0kR7k=; b=w8Oc3pFTLBEG/TCudB+3yJrs26KIoXt8+oquaINe8ipfHBdCvRtTU91u9i6DY4GYt+ 8eY3a1EtCU596QzEwlekxoIyrRWYiGX+xds3Hdr9pFDWU5xYL+aRQ08Ox/2lVe3GcK4w 1rDJcbz0JF660l/Fbj9uk8WqP9yLlXMLcVXKb7SEOeCcTG+e8Ir95+L31hFrP28xZB3z 6+u2oLuZyYU5JrbaCo9d7gx5EcjVMVCrdaYMyCostqbCap80ct7DaJP+sKFELi4OW4tt raFuviw9pDZdduFFpSy3BOhU0FdEL3hGDFbsxG8GOsZiAaShDUm8nIrcxWOOPD9+vauJ whHw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:in-reply-to:references; bh=A5EmULFtDl5i5Z5Rzq6bwCLJMqdhrquKs6z6Oe0kR7k=; b=LcG5eYpd9sitAOyTMoX0nF8UjA7Aaq8o/+cLxs+54Lgazhzu8oLpWOPwFm1KUY9lnF GPQ5R9k7fmoggmakR6Iq2os5I05Ev29CQtTB/8Z+ELzhq2eDZSvfj3+fAmUBbTCS/NrW TQp3osOhYMyz9gyHxZRlhsJWcyCUFghCByOiw1iEY9w7n1onfh3pGqTM7Ry2eqIinsCJ rXTBazKGLXOb9P7VoF7+UJDgjnqh1cShMCF+nNMuh3XlyLw5KZTEP/eQEqFtg/+GcQY7 vtos0XLj1bOjp+MZW5Ki7dk/QrQuS7r/jYPz2QQt8t5KNGlgAikt0R2a4hnZG35lXVaD q9dw== X-Gm-Message-State: APjAAAXCsdgD8o9ublkwAGqeKX3IvRTYWOpPbe5DY7fCPP6ZxJObqG+D rMvaGNF3FTkSfPzIKmkZZWZ7OblTCyDWhQ== X-Received: by 2002:a63:c009:: with SMTP id h9mr20902459pgg.166.1566908108909; Tue, 27 Aug 2019 05:15:08 -0700 (PDT) Received: from localhost ([49.248.54.193]) by smtp.gmail.com with ESMTPSA id d3sm3159687pjz.31.2019.08.27.05.15.07 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 27 Aug 2019 05:15:08 -0700 (PDT) From: Amit Kucheria To: linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, bjorn.andersson@linaro.org, edubezval@gmail.com, agross@kernel.org, sboyd@kernel.org, masneyb@onstation.org, marc.w.gonzalez@free.fr, Daniel Lezcano , Mark Rutland , Rob Herring , Zhang Rui Cc: devicetree@vger.kernel.org Subject: [PATCH v2 11/15] arm64: dts: qcs404: thermal: Add interrupt support Date: Tue, 27 Aug 2019 17:44:07 +0530 Message-Id: <74b10329041835ea1b019817729fe2d87f83e65b.1566907161.git.amit.kucheria@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: References: In-Reply-To: References: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Register upper-lower interrupt for the tsens controller. Signed-off-by: Amit Kucheria --- arch/arm64/boot/dts/qcom/qcs404.dtsi | 42 +++++++++++++++------------- 1 file changed, 22 insertions(+), 20 deletions(-) -- 2.17.1 diff --git a/arch/arm64/boot/dts/qcom/qcs404.dtsi b/arch/arm64/boot/dts/qcom/qcs404.dtsi index 3d0789775009c..065a60d50a07f 100644 --- a/arch/arm64/boot/dts/qcom/qcs404.dtsi +++ b/arch/arm64/boot/dts/qcom/qcs404.dtsi @@ -280,6 +280,8 @@ nvmem-cells = <&tsens_caldata>; nvmem-cell-names = "calib"; #qcom,sensors = <10>; + interrupts = ; + interrupt-names = "uplow"; #thermal-sensor-cells = <1>; }; @@ -1071,8 +1073,8 @@ thermal-zones { aoss-thermal { - polling-delay-passive = <250>; - polling-delay = <1000>; + polling-delay-passive = <0>; + polling-delay = <0>; thermal-sensors = <&tsens 0>; @@ -1086,8 +1088,8 @@ }; q6-hvx-thermal { - polling-delay-passive = <250>; - polling-delay = <1000>; + polling-delay-passive = <0>; + polling-delay = <0>; thermal-sensors = <&tsens 1>; @@ -1101,8 +1103,8 @@ }; lpass-thermal { - polling-delay-passive = <250>; - polling-delay = <1000>; + polling-delay-passive = <0>; + polling-delay = <0>; thermal-sensors = <&tsens 2>; @@ -1116,8 +1118,8 @@ }; wlan-thermal { - polling-delay-passive = <250>; - polling-delay = <1000>; + polling-delay-passive = <0>; + polling-delay = <0>; thermal-sensors = <&tsens 3>; @@ -1131,8 +1133,8 @@ }; cluster-thermal { - polling-delay-passive = <250>; - polling-delay = <1000>; + polling-delay-passive = <0>; + polling-delay = <0>; thermal-sensors = <&tsens 4>; @@ -1165,8 +1167,8 @@ }; cpu0-thermal { - polling-delay-passive = <250>; - polling-delay = <1000>; + polling-delay-passive = <0>; + polling-delay = <0>; thermal-sensors = <&tsens 5>; @@ -1199,8 +1201,8 @@ }; cpu1-thermal { - polling-delay-passive = <250>; - polling-delay = <1000>; + polling-delay-passive = <0>; + polling-delay = <0>; thermal-sensors = <&tsens 6>; @@ -1233,8 +1235,8 @@ }; cpu2-thermal { - polling-delay-passive = <250>; - polling-delay = <1000>; + polling-delay-passive = <0>; + polling-delay = <0>; thermal-sensors = <&tsens 7>; @@ -1267,8 +1269,8 @@ }; cpu3-thermal { - polling-delay-passive = <250>; - polling-delay = <1000>; + polling-delay-passive = <0>; + polling-delay = <0>; thermal-sensors = <&tsens 8>; @@ -1301,8 +1303,8 @@ }; gpu-thermal { - polling-delay-passive = <250>; - polling-delay = <1000>; + polling-delay-passive = <0>; + polling-delay = <0>; thermal-sensors = <&tsens 9>; From patchwork Tue Aug 27 12:14:10 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amit Kucheria X-Patchwork-Id: 172287 Delivered-To: patch@linaro.org Received: by 2002:a92:d204:0:0:0:0:0 with SMTP id y4csp5702965ily; Tue, 27 Aug 2019 05:15:27 -0700 (PDT) X-Google-Smtp-Source: APXvYqx+vhv4uZ2eTzCAhLEPqnWiS8fMghj0QCSFtClOVXGVCKruJJnV7RreE0ZgtcnE9iNT/jvW X-Received: by 2002:a17:902:2f43:: with SMTP id s61mr23450279plb.22.1566908127610; Tue, 27 Aug 2019 05:15:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566908127; cv=none; d=google.com; s=arc-20160816; b=LwhSGjeRNiZs7Is3hZpTx6PZIJiCwQeTn23cZnbHiDktLYaCoBDQh09KCHWQUBHcGZ 2vy0lUdfx24slDSqoDikGJpTWZXvS/udhwzco0AjfSM6uEE8g+70gqUDz36dENi1hii5 7qmrd8XrLjnAHGhG3NTIZ+c+mP7YR+yxOa3Hu1/XG5nvwPJ8KNxLogkyv2TTfbxbJQLz FFKzM4F2JNF8siG3ShwQ8KYUNus7XOePdG7G4HYH51vyIjfcv2nVzSCGbZtupHSHRLCO X2lFq7yKpb71TfYRwhUgt6wAKVFOpoBF73KPLskT7CQpJ2KQCjs7JHBsM4WMVmijNFwM k3Fw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:references :in-reply-to:message-id:date:subject:cc:to:from:dkim-signature; bh=tpMa3H6oDslAvJvzcnjT35SZi+/Pan/FSKgVHqFgjrU=; b=RHMAZIgZoLaqz85HSre3uPWIfHS8g5NArYm0Bk0wVip8AAITH7XCfCiE6c08sicOgP IpO+3tdnjtm7XcANYPPd/Cr5DDy8SfNCUKdEPgcY7Hebf+lj7s5ycFpOArl91VYUiqGM +o2s74L1cNMdYr/FWB8qfXICRhRUCV0M9NECjkY3WKwCoAeEtapGmBZnzczmh78yDQH8 oP4q+rsc1y9fmUdq4SN0zv3fdFxQKUPbk/m1hu2Eq6YVd75PwgEC3uQa4laF3vXazPmH M9ZKv+WQ+nmwl2OLpdb+Kdtb+1DB8uQZ5IInGIdFmUBVG2bAXXH0WXOra9d+/ZGrlV4F YGlQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=qCwNVOy6; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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. [209.132.180.67]) by mx.google.com with ESMTP id x6si12115075pgq.473.2019.08.27.05.15.27; Tue, 27 Aug 2019 05:15:27 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=qCwNVOy6; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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 S1730089AbfH0MP0 (ORCPT + 28 others); Tue, 27 Aug 2019 08:15:26 -0400 Received: from mail-pg1-f193.google.com ([209.85.215.193]:43937 "EHLO mail-pg1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730038AbfH0MPW (ORCPT ); Tue, 27 Aug 2019 08:15:22 -0400 Received: by mail-pg1-f193.google.com with SMTP id k3so12579345pgb.10 for ; Tue, 27 Aug 2019 05:15:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :in-reply-to:references; bh=tpMa3H6oDslAvJvzcnjT35SZi+/Pan/FSKgVHqFgjrU=; b=qCwNVOy6HgLQaFN7+4h9IgDrY9FcEPl1q5fmZlMULgrtQfFVT5Q8lss/apTYPIFzPz zxH4qf6wxqnt4CRoqrniwyAobXOTwlFI9rNXugc3qeCi1OOlUKjSlFzLRpWXjmfePpbQ cVv1xIPUe57QATVsk+kWK5AgQiOF5KlxrBDo/rMDNyWSCw8ptdnsqWHP6xBBRTS+MFxW dBsc4lVdmvxX9zgl9iY85qV6AH1DgL+ffnM6G35wkEMC92oE1rUFYnjnjaqCIpNSCgKt NwahPa409/XgV/s8XYmdxjAuKjyeoVggJeLgsoBo8RSWrtBkC7euQ8V9eJJSAWAI0ViH 7slw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:in-reply-to:references; bh=tpMa3H6oDslAvJvzcnjT35SZi+/Pan/FSKgVHqFgjrU=; b=UMmD88De1x2Zpg5IaRfEfB9c0lZh9InSWzGUotLbkA2SzaYCtoCh5x941IJgasvf4u s5P2wh48gga5x7Ms2XYZuCDJe5uESzVMZ1wCa7FfX3iqcpVsqOKjG7rtsClEzZvRFjsh fpCCvif0X8JhvL/YHZ1e+qttmzWYtC7FsbK28XFPRHEPVpNL4u+jIdyhD+OhPktNVtn1 Z7bDeh6RCXaIen8u3cCF3BoDEBE8erg1PM0PFzB3hJUFJKNipY4bgbgibc2/r3SONBdX UwRU6Ju9ZIFJznielwG+XmcCtC4hVTqJLtVoiA0H3yUUCve2jmJeFBnM5y6xZ0m/fsKL jNVg== X-Gm-Message-State: APjAAAUWPwIX/V2E56ENUlrk8XzykWaWmayAq3UQuezygnElxHQt3s8O FdRuk/y22azRTLfH+hNAII6zdqPUwAMilQ== X-Received: by 2002:a17:90a:342d:: with SMTP id o42mr25704928pjb.27.1566908121004; Tue, 27 Aug 2019 05:15:21 -0700 (PDT) Received: from localhost ([49.248.54.193]) by smtp.gmail.com with ESMTPSA id p10sm14943262pff.132.2019.08.27.05.15.19 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 27 Aug 2019 05:15:20 -0700 (PDT) From: Amit Kucheria To: linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, bjorn.andersson@linaro.org, edubezval@gmail.com, agross@kernel.org, sboyd@kernel.org, masneyb@onstation.org, marc.w.gonzalez@free.fr, Daniel Lezcano , Mark Rutland , Rob Herring , Zhang Rui Cc: linux-pm@vger.kernel.org Subject: [PATCH v2 14/15] drivers: thermal: tsens: Create function to return sign-extended temperature Date: Tue, 27 Aug 2019 17:44:10 +0530 Message-Id: <64a3d07ebe5c4cfb4643d91f5f6605e8a4ffa48b.1566907161.git.amit.kucheria@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: References: In-Reply-To: References: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hide the details of how to convert values read from TSENS HW to mCelsius behind a function. All versions of the IP can be supported as a result. Signed-off-by: Amit Kucheria --- drivers/thermal/qcom/tsens-common.c | 50 +++++++++++++++++++++-------- drivers/thermal/qcom/tsens.h | 2 ++ 2 files changed, 38 insertions(+), 14 deletions(-) -- 2.17.1 diff --git a/drivers/thermal/qcom/tsens-common.c b/drivers/thermal/qcom/tsens-common.c index ea2c46cc6a66a..06b44cfd5eab9 100644 --- a/drivers/thermal/qcom/tsens-common.c +++ b/drivers/thermal/qcom/tsens-common.c @@ -84,13 +84,43 @@ static inline int code_to_degc(u32 adc_code, const struct tsens_sensor *s) return degc; } +/** + * tsens_hw_to_mC - Return sign-extended temperature in mCelsius. + * @s: Pointer to sensor struct + * @field: Index into regmap_field array pointing to temperature data + * + * This function handles temperature returned in ADC code or deciCelsius + * depending on IP version. + * + * Return: Temperature in milliCelsius on success, a negative errno will + * be returned in error cases + */ +static int tsens_hw_to_mC(struct tsens_sensor *s, int field) +{ + struct tsens_priv *priv = s->priv; + u32 temp = 0; + int ret; + + ret = regmap_field_read(priv->rf[field], &temp); + if (ret) + return ret; + + if (priv->feat->adc) { + /* Convert temperature from ADC code to milliCelsius */ + return code_to_degc(temp, s) * 1000; + } + + /* deciCelsius -> milliCelsius along with sign extension */ + return sign_extend32(temp, priv->tempres) * 100; +} + int get_temp_tsens_valid(struct tsens_sensor *s, int *temp) { struct tsens_priv *priv = s->priv; int hw_id = s->hw_id; u32 temp_idx = LAST_TEMP_0 + hw_id; u32 valid_idx = VALID_0 + hw_id; - u32 last_temp = 0, valid, mask; + u32 valid; int ret; ret = regmap_field_read(priv->rf[valid_idx], &valid); @@ -108,19 +138,7 @@ int get_temp_tsens_valid(struct tsens_sensor *s, int *temp) } /* Valid bit is set, OK to read the temperature */ - ret = regmap_field_read(priv->rf[temp_idx], &last_temp); - if (ret) - return ret; - - if (priv->feat->adc) { - /* Convert temperature from ADC code to milliCelsius */ - *temp = code_to_degc(last_temp, s) * 1000; - } else { - mask = GENMASK(priv->fields[LAST_TEMP_0].msb, - priv->fields[LAST_TEMP_0].lsb); - /* Convert temperature from deciCelsius to milliCelsius */ - *temp = sign_extend32(last_temp, fls(mask) - 1) * 100; - } + *temp = tsens_hw_to_mC(s, temp_idx); return 0; } @@ -310,6 +328,10 @@ int __init init_common(struct tsens_priv *priv) goto err_put_device; } } + + /* Save away resolution of signed temperature value for this IP */ + priv->tempres = priv->fields[LAST_TEMP_0].msb - priv->fields[LAST_TEMP_0].lsb; + for (i = 0, j = VALID_0; i < priv->feat->max_sensors; i++, j++) { priv->rf[j] = devm_regmap_field_alloc(dev, priv->tm_map, priv->fields[j]); diff --git a/drivers/thermal/qcom/tsens.h b/drivers/thermal/qcom/tsens.h index e1d6af71b2b9a..409395e436f32 100644 --- a/drivers/thermal/qcom/tsens.h +++ b/drivers/thermal/qcom/tsens.h @@ -283,6 +283,7 @@ struct tsens_context { * struct tsens_priv - private data for each instance of the tsens IP * @dev: pointer to struct device * @num_sensors: number of sensors enabled on this device + * @tempres: number of bits used to represent signed temperature (resolution) * @tm_map: pointer to TM register address space * @srot_map: pointer to SROT register address space * @tm_offset: deal with old device trees that don't address TM and SROT @@ -299,6 +300,7 @@ struct tsens_context { struct tsens_priv { struct device *dev; u32 num_sensors; + u32 tempres; struct regmap *tm_map; struct regmap *srot_map; u32 tm_offset;