From patchwork Tue Jun 12 10:54:53 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amit Kucheria X-Patchwork-Id: 138306 Delivered-To: patch@linaro.org Received: by 2002:a2e:970d:0:0:0:0:0 with SMTP id r13-v6csp5189870lji; Tue, 12 Jun 2018 03:55:34 -0700 (PDT) X-Google-Smtp-Source: ADUXVKLMeeON9hHBJlZqsavBBv4jXx83iDfeFjbG/GcxpdJT26TI89Cf8BpovHtBZgfK1nU8ZETt X-Received: by 2002:a17:902:4545:: with SMTP id m63-v6mr3584163pld.268.1528800934050; Tue, 12 Jun 2018 03:55:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528800934; cv=none; d=google.com; s=arc-20160816; b=DxtwyYMtgQq1zxrYcI6bqhOjoFTwChxkfK10BiWPh00Cp1ZJsIuF/PUFiXhZ8zASEv qIPm3nl5dxfcO7NrnBQJokSzKGjNwCXn9bDdkdLUXafaH2pB6ujgbBTQBmJNJlqQhid1 lU3EnNyRqr1J15kl892otgXCzw9/xRryj+rsFegCOFsow5sJznW7BdUTPjiHyWUh+urc NkHpAmckWgnsLXmbJyJuB85l5UE0oUo34v0qy7ULucndyaYvGqQTJnr8EGrjnSm13Sqt gjA294kJCvCrdxqcduiQiKmxSNTPOPnpkbRb5TuqcQ8/h+O4RgItBK+2pp58qHAF42Xl Neqg== 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 :arc-authentication-results; bh=RqHvCXWgQNEn4X6AU/ZqYttyBtBVtMakbjX0moav5Ps=; b=zNi/ir/WKRp2k12NEcY2I4psdeJRfHTypTFgRgxNbDz95dXCiHMTlAWLrLWEpGc390 Zaujs9WXlcURgB/q18n1z3egzta73xSEJMRarc6OdNUKjlsroenkqjifJ9R9pfY9ER6N TX1+jAGr8i4+UheYa/f1BQr+zWCv7bHMacDQ6ArDmJ2fpWBG0k2dNthojt6UxpprrFMw JIzLV6GOmecXY6gN3hDLGwdM7ufRhvSIJKy6pwaJELEa5y+Yh53NTPHvGS9j2xh0lgEm 7qLWyGQpEr38oDT+ezlXBR1uYYBTrCuNCF5cPz6DaeSn6LtZl9y8gF3z9DkU4gL6Pblf gTHw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Up8T1MT1; 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 n6-v6si490650pga.622.2018.06.12.03.55.33; Tue, 12 Jun 2018 03:55:34 -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=Up8T1MT1; 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 S932743AbeFLKzb (ORCPT + 30 others); Tue, 12 Jun 2018 06:55:31 -0400 Received: from mail-lf0-f66.google.com ([209.85.215.66]:37984 "EHLO mail-lf0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752705AbeFLKz2 (ORCPT ); Tue, 12 Jun 2018 06:55:28 -0400 Received: by mail-lf0-f66.google.com with SMTP id i83-v6so35291621lfh.5 for ; Tue, 12 Jun 2018 03:55:27 -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=RqHvCXWgQNEn4X6AU/ZqYttyBtBVtMakbjX0moav5Ps=; b=Up8T1MT1sRqeYPD7+MHE3gD4Z6QM81LwNESmlHEaknYQXnd8blYYYz7t8W7CFJpS7/ uJxt2MyL1AGg8FpH5M8kBFnfrZgWeHXyI86y4Bdy8dvVjsa9zD69x2CPwmub5KdbUDtA LDGpLZBiVqGN8pc2W/f9OjMvHwRFqwYz3LkO4= 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=RqHvCXWgQNEn4X6AU/ZqYttyBtBVtMakbjX0moav5Ps=; b=MmQBRkW4D0I2AXnV8YWpI1rQqJ0tQnaAO2T5WD60yqFg2xcUZB4GQNfXq7OHM0HINP TxSgIACbSSa8ewwtLDAv/BqhG5396la5o5Iuxj9XBko+nOOKwfoxwXS0hd7IcoiGMltd slMfMx6FHZcYos9JkEgatiyYKLn8hbMHvCCgliBeRICDfI+48ys2Kzmbcc0H7PjEVD3c /QYo4nuUHVyiKjJcqlSC153kKSCsi4QxFiUetxH1xbVAhi2BJWQ2QY41iiepNDFBJ1T2 SAIaWPxBYsKf0M4Hjxnl9u93On/Y0CYCHGDKnAI1gyolfTAqJ1nQpah4tikPRKWB1Reu S6YA== X-Gm-Message-State: APt69E3AC8QLW0J6uV8lt3pJ1yNKn64xiWEO7yWDNBtqHfoTaXVotWwY yEMZN/PwEq3jx5YCD/qCo0zEJcsageU= X-Received: by 2002:a2e:7a0f:: with SMTP id v15-v6mr2170228ljc.68.1528800926644; Tue, 12 Jun 2018 03:55:26 -0700 (PDT) Received: from localhost (85-76-96-64-nat.elisa-mobile.fi. [85.76.96.64]) by smtp.gmail.com with ESMTPSA id c74-v6sm137026lfh.78.2018.06.12.03.55.25 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 12 Jun 2018 03:55:25 -0700 (PDT) From: Amit Kucheria To: linux-kernel@vger.kernel.org Cc: rnayak@codeaurora.org, linux-arm-msm@vger.kernel.org, bjorn.andersson@linaro.org, edubezval@gmail.com, Zhang Rui , linux-pm@vger.kernel.org (open list:THERMAL) Subject: [PATCH v2 1/5] thermal: tsens: Get rid of unused fields in structure Date: Tue, 12 Jun 2018 13:54:53 +0300 Message-Id: <940c162eac1e8d948e553899dafa10fdaab9399d.1528799892.git.amit.kucheria@linaro.org> X-Mailer: git-send-email 2.7.4 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 status_field and trdy are unused in any of the tsens drivers. Remove them. Signed-off-by: Amit Kucheria Reviewed-by: Bjorn Andersson Acked-by: Rajendra Nayak --- drivers/thermal/qcom/tsens.h | 2 -- 1 file changed, 2 deletions(-) -- 2.7.4 diff --git a/drivers/thermal/qcom/tsens.h b/drivers/thermal/qcom/tsens.h index 911c197..dc56e1e 100644 --- a/drivers/thermal/qcom/tsens.h +++ b/drivers/thermal/qcom/tsens.h @@ -77,9 +77,7 @@ struct tsens_device { struct device *dev; u32 num_sensors; struct regmap *map; - struct regmap_field *status_field; struct tsens_context ctx; - bool trdy; const struct tsens_ops *ops; struct tsens_sensor sensor[0]; }; From patchwork Tue Jun 12 10:54:54 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amit Kucheria X-Patchwork-Id: 138307 Delivered-To: patch@linaro.org Received: by 2002:a2e:970d:0:0:0:0:0 with SMTP id r13-v6csp5189966lji; Tue, 12 Jun 2018 03:55:40 -0700 (PDT) X-Google-Smtp-Source: ADUXVKJ52qGgaPRgeYEZ0bbA7jXTS7+rZAJwPCxnHFn9g8Q3dR21anyTAILzzg9yed+VtGHkozyl X-Received: by 2002:a62:3a59:: with SMTP id h86-v6mr3302006pfa.209.1528800940262; Tue, 12 Jun 2018 03:55:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528800940; cv=none; d=google.com; s=arc-20160816; b=CSBI38jnW4Jp+R8uaZKm1QI9zRdCMFcp5qL2TWU9UlwBLE8AF9+NjQIqGWaK1gDPHW f+doyYoUrDumnv0foF6FXK2LtgA9jMqGrxyldY2mIebH1BAdb6yd1TysU0clCqRgWCov Z4auTv7W6Ebc4KiYqyheSHOq8KQya+C2TsHHS4QqoI8Oy1F6zWKflHleWPGSp186iQHF vNAo9k9J4fXQFvhr4BTP5E7qDjjDeYjAC9vPaMmxXm3fKQAQCAADk+ndbLvTdXEC1kpr m8u9TEgFnFUrl1XQrpCnVucEVa61n16GtP73NzUBFmrvkiAXlNsQf/5JtzJzQ/B3ZZr3 p9QQ== 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 :arc-authentication-results; bh=FhQ3e9gC5p6WExs3bb82v6CtoZfQFTo9EGSLXEduIAI=; b=rjSLXJxNvnkACsGuWeYpTTJzc/ztH/XqGUVyJyAKfWOu+idUiXchEpJStLQtL6Ob/X j4tU5t7rSo09EGbpU4cQie1eJKaRh3QH9ehlYYd+8MTcgSDFz1vH27sCuT8X51e7KtcC F0NGeBK1aqD2gkJLHMa5Qg41sttPtKQNw9wJPOXp84c0MLHZL5Ka+hL5p64Fq/mbBzcm Z8SG67IiHhgfR8STnBZkeYZooJxSDb6tbkNlhPbdNmoqnlBWgoQrJ1vc+ioA0RbOkqvD PMJpWwLOShkRJdttS0XeYxNx9EXdDnFBb1NSHnre37P46nFk4w8caD/XzjN3vQC8eF3+ 4gyg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=fQO+AqLr; 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 l4-v6si612830plt.497.2018.06.12.03.55.39; Tue, 12 Jun 2018 03:55:40 -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=fQO+AqLr; 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 S933119AbeFLKzh (ORCPT + 30 others); Tue, 12 Jun 2018 06:55:37 -0400 Received: from mail-lf0-f66.google.com ([209.85.215.66]:36710 "EHLO mail-lf0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932811AbeFLKzc (ORCPT ); Tue, 12 Jun 2018 06:55:32 -0400 Received: by mail-lf0-f66.google.com with SMTP id u4-v6so35317780lff.3 for ; Tue, 12 Jun 2018 03:55:31 -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=FhQ3e9gC5p6WExs3bb82v6CtoZfQFTo9EGSLXEduIAI=; b=fQO+AqLrFnsGd6ljfxqQ4QrzpUlkP2SvBd3pxXeAS1wS8oSx+eZeUKSEM63LDYg+nh I9Qk6qJqjo/0ho/YczOBrxA0E78sxzBLEtAPvZ1ZlDpvxmSEeRu4bhcjpHO/bB2bsTb8 mM6IqT6a6vPP3QIsTBDWYSw8KhSxl00fEWZDo= 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=FhQ3e9gC5p6WExs3bb82v6CtoZfQFTo9EGSLXEduIAI=; b=fK2wqupxjkYZwGJo/B0xa3DjNncunOWeyOi8lfQ60srn++Bbz8VQppRnxSywEvQWkY gyTzyc0E4AJe1CwD8WKpYd7Iq2U0YCtf9Wpsx8hf8svKhtk33XJIhd7i7+jOa8l8fWl/ ScI0jlGOkMjZG2FwOc67nU4sty/DwwldHwZjkttBDcX8J4P9iNYvjidig2QPA6UrVbEs ZNnFJrc+XlwteF2RD7J93bahAdgWcigTuk0KWdsUBDJrgl0NLUahrknUQ9Luuu4WlnQm 9NL/wqV5JHCs+pYPZ2R/Vr78d++UIZFufanyhkj5hw2k4Gtch/s88cssRs6TqwrtvxP6 DF9g== X-Gm-Message-State: APt69E0Z6/SFW3dmOnxKsFIPlVrFXX8AQ0ztx98iLsB9tgijKjZiliWF 3VbaHxoEuowcnVuAsUicWsotpabfTB0= X-Received: by 2002:a2e:980f:: with SMTP id a15-v6mr2028012ljj.143.1528800930670; Tue, 12 Jun 2018 03:55:30 -0700 (PDT) Received: from localhost (85-76-96-64-nat.elisa-mobile.fi. [85.76.96.64]) by smtp.gmail.com with ESMTPSA id d4-v6sm160166ljg.44.2018.06.12.03.55.29 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 12 Jun 2018 03:55:29 -0700 (PDT) From: Amit Kucheria To: linux-kernel@vger.kernel.org Cc: rnayak@codeaurora.org, linux-arm-msm@vger.kernel.org, bjorn.andersson@linaro.org, edubezval@gmail.com, Andy Gross , David Brown , Rob Herring , Mark Rutland , Catalin Marinas , Will Deacon , Zhang Rui , linux-soc@vger.kernel.org (open list:ARM/QUALCOMM SUPPORT), devicetree@vger.kernel.org (open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS), linux-arm-kernel@lists.infradead.org (moderated list:ARM64 PORT (AARCH64 ARCHITECTURE)), linux-pm@vger.kernel.org (open list:THERMAL) Subject: [PATCH v2 2/5] dt: qcom: 8996: thermal: Move to DT initialisation Date: Tue, 12 Jun 2018 13:54:54 +0300 Message-Id: <683ceb9a7d283bcad47fc6e8e4fcfbd7e76c1018.1528799892.git.amit.kucheria@linaro.org> X-Mailer: git-send-email 2.7.4 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 We also split up the regmap address space into two, one for the TM registers, the other for the SROT registers. This was required to deal with different address offsets for the TM and SROT registers across different SoC families. Since tsens-common.c/init_common() currently only registers one address space, the order is important (TM before SROT).This is OK since the code doesn't really use the SROT functionality yet. Signed-off-by: Amit Kucheria --- arch/arm64/boot/dts/qcom/msm8996.dtsi | 12 +++++++++++- drivers/thermal/qcom/tsens-8996.c | 1 - 2 files changed, 11 insertions(+), 2 deletions(-) -- 2.7.4 diff --git a/arch/arm64/boot/dts/qcom/msm8996.dtsi b/arch/arm64/boot/dts/qcom/msm8996.dtsi index 410ae78..b4aab18 100644 --- a/arch/arm64/boot/dts/qcom/msm8996.dtsi +++ b/arch/arm64/boot/dts/qcom/msm8996.dtsi @@ -451,7 +451,17 @@ tsens0: thermal-sensor@4a8000 { compatible = "qcom,msm8996-tsens"; - reg = <0x4a8000 0x2000>; + reg = <0x4a9000 0x1000>, /* TM */ + <0x4a8000 0x1000>; /* SROT */ + #qcom,sensors = <13>; + #thermal-sensor-cells = <1>; + }; + + tsens1: thermal-sensor@4ac000 { + compatible = "qcom,msm8996-tsens"; + reg = <0x4ad000 0x1000>, /* TM */ + <0x4ac000 0x1000>; /* SROT */ + #qcom,sensors = <8>; #thermal-sensor-cells = <1>; }; diff --git a/drivers/thermal/qcom/tsens-8996.c b/drivers/thermal/qcom/tsens-8996.c index e1f7781..6e59078 100644 --- a/drivers/thermal/qcom/tsens-8996.c +++ b/drivers/thermal/qcom/tsens-8996.c @@ -79,6 +79,5 @@ static const struct tsens_ops ops_8996 = { }; const struct tsens_data data_8996 = { - .num_sensors = 13, .ops = &ops_8996, }; From patchwork Tue Jun 12 10:54:55 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amit Kucheria X-Patchwork-Id: 138308 Delivered-To: patch@linaro.org Received: by 2002:a2e:970d:0:0:0:0:0 with SMTP id r13-v6csp5190035lji; Tue, 12 Jun 2018 03:55:46 -0700 (PDT) X-Google-Smtp-Source: ADUXVKIc2SnIvjNl3ruZo80LEzQ/t/TtI3pYV7S7tOwFCJCvRv0qxLKJgqvt4rjs3Yb6PkKWbELF X-Received: by 2002:a17:902:7c8b:: with SMTP id y11-v6mr3436504pll.222.1528800946159; Tue, 12 Jun 2018 03:55:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528800946; cv=none; d=google.com; s=arc-20160816; b=E/PjYaL5En2/a+wbGkV0h5brzPH3JlmyAzx9jFNHXD+Qbbbvs6kkm3T5qQvAKLC3Yh h/m6IC4dXW02ZN4mSiO2VrguS6RU6vVOK6+DLkwER/sAcKI7x5c6Dcq1H87K/0xf367y IdR+4qRepRmuFDqjTm9NUoRLKKMwot2dw4EMPoKgGYvAehficlkkUs+HpQfvll7qowZl 2Xz73aXghJxDuS8X1U9asadM2KrX8XwIr0Jv4O4Op4NhdxawJAT8+ouHAZbij5mJwvC/ GV75LkfOkIu+dORyGHLOPG9X3InTELr08WTYdN92MDj6E7d6pxwfxnxvND1DDyJ/5NZa zx0w== 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 :arc-authentication-results; bh=kb84Dckh+p8fYYPXbIUYnlgkmp3CDvlZRfts5T+sPAM=; b=MYV6ByC2bEnXjtsbcC3I4GnKjPgrDbv0UzI12OcDXDt1fjyuV09XDIxNrFu/UKH7QT LdaSPinXe07QU9KJC+XFJzTXxxvtPg0QJB+YSDlzr2e+OVRZyTC6NgktCJW8UgBBYK3h Qqj7NvEOo86/+fA6QtVMTKN9B9zewas0oWS/mjtB5hfonXp141aNWBxQa7LRCc5mKjhu A+As0h/DuNOS9PMyAqQuoQWA989AMTOJfQqUYfP2ZvatWedJa/yTKdIRDmkJuON0sWcJ JG2YkYiZajm1tAqltIYiksFpGI7DJzM5lbt9CUL9Il270VRbIPS0yt9+H9JvN97Joq43 iSMQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=aoUzxBPz; 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 l4-v6si612830plt.497.2018.06.12.03.55.45; Tue, 12 Jun 2018 03:55:46 -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=aoUzxBPz; 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 S933245AbeFLKzo (ORCPT + 30 others); Tue, 12 Jun 2018 06:55:44 -0400 Received: from mail-lf0-f65.google.com ([209.85.215.65]:36727 "EHLO mail-lf0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933135AbeFLKzk (ORCPT ); Tue, 12 Jun 2018 06:55:40 -0400 Received: by mail-lf0-f65.google.com with SMTP id u4-v6so35318279lff.3 for ; Tue, 12 Jun 2018 03:55:39 -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=kb84Dckh+p8fYYPXbIUYnlgkmp3CDvlZRfts5T+sPAM=; b=aoUzxBPz/KFZAGm6hQNulusSxAuv3gk6DKRSF9BnEIv+kb5oQq1ic19z948O+qZyGF TPZbVT3xRvknFc44bniUyl9AYYtGWHnLXF4cMZ+qJsNYpNbmGvFAiTHxAhz58FVrsTGt n/CdrnV/tKuDNi1SK5cuHUHsiXGJeYnJOo0Ws= 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=kb84Dckh+p8fYYPXbIUYnlgkmp3CDvlZRfts5T+sPAM=; b=LuJFuqfGBnyCFehHi5SD7WGqSsUcT8rUJd65EyFxc8ls14xySMKL0AotvPDA9QubWE fLbXdbaFe6PaxUiwV0ZuicjouO0hM8wf8hWSU7C8LcVwVRgP7bs7nIBIL79HUC/1eqTh EIKgtWTYGrjAbRhbk0i7sJzc8PYz5ACVRFA6jyU2DVvv+pCkqSe+GVFF7WkQN8HIZQGo JLcYX7WKEhQYUsGEvK7axRjtT8LWEY2du1Du07WwtwnUWK/n6Xbs9nj2fAIvkdExCXEV xtL/CJnIUQgoRkSmjvkWhQFAo4Z4pEci2GgUfv6QWaWgrpohghidc5XJsd8e2YvDGUiF H7oQ== X-Gm-Message-State: APt69E17zjJr2AQIvHckBglNiKZrgZ01yR/7NPiLVHOTzZSGR4hn6MHf e6oH/EAI+Dvs4E84ZkKZiuXL11O7EG4= X-Received: by 2002:a19:484b:: with SMTP id v72-v6mr1893398lfa.120.1528800938654; Tue, 12 Jun 2018 03:55:38 -0700 (PDT) Received: from localhost (85-76-96-64-nat.elisa-mobile.fi. [85.76.96.64]) by smtp.gmail.com with ESMTPSA id q84-v6sm156569lja.50.2018.06.12.03.55.37 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 12 Jun 2018 03:55:38 -0700 (PDT) From: Amit Kucheria To: linux-kernel@vger.kernel.org Cc: rnayak@codeaurora.org, linux-arm-msm@vger.kernel.org, bjorn.andersson@linaro.org, edubezval@gmail.com, Zhang Rui , linux-pm@vger.kernel.org (open list:THERMAL) Subject: [PATCH v2 3/5] thermal: tsens: Move 8996 get_temp() to common code for reuse Date: Tue, 12 Jun 2018 13:54:55 +0300 Message-Id: X-Mailer: git-send-email 2.7.4 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 The TSENS block inside the 8996 is internally classified as version 2. Several other SoC families use this block and can share this code. Rename get_temp() to reflect that it can be used across the v2 family. Signed-off-by: Amit Kucheria --- drivers/thermal/qcom/tsens-8996.c | 73 ++----------------------------------- drivers/thermal/qcom/tsens-common.c | 69 ++++++++++++++++++++++++++++++----- drivers/thermal/qcom/tsens.h | 1 + 3 files changed, 63 insertions(+), 80 deletions(-) -- 2.7.4 diff --git a/drivers/thermal/qcom/tsens-8996.c b/drivers/thermal/qcom/tsens-8996.c index 6e59078..a0d9096 100644 --- a/drivers/thermal/qcom/tsens-8996.c +++ b/drivers/thermal/qcom/tsens-8996.c @@ -1,81 +1,14 @@ +// SPDX-License-Identifier: GPL-2.0 /* * Copyright (c) 2015, The Linux Foundation. All rights reserved. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 and - * only version 2 as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * + * Copyright (c) 2018, Linaro Limited */ -#include -#include #include "tsens.h" -#define STATUS_OFFSET 0x10a0 -#define LAST_TEMP_MASK 0xfff -#define STATUS_VALID_BIT BIT(21) -#define CODE_SIGN_BIT BIT(11) - -static int get_temp_8996(struct tsens_device *tmdev, int id, int *temp) -{ - struct tsens_sensor *s = &tmdev->sensor[id]; - u32 code; - unsigned int sensor_addr; - int last_temp = 0, last_temp2 = 0, last_temp3 = 0, ret; - - sensor_addr = STATUS_OFFSET + s->hw_id * 4; - ret = regmap_read(tmdev->map, sensor_addr, &code); - if (ret) - return ret; - last_temp = code & LAST_TEMP_MASK; - if (code & STATUS_VALID_BIT) - goto done; - - /* Try a second time */ - ret = regmap_read(tmdev->map, sensor_addr, &code); - if (ret) - return ret; - if (code & STATUS_VALID_BIT) { - last_temp = code & LAST_TEMP_MASK; - goto done; - } else { - last_temp2 = code & LAST_TEMP_MASK; - } - - /* Try a third/last time */ - ret = regmap_read(tmdev->map, sensor_addr, &code); - if (ret) - return ret; - if (code & STATUS_VALID_BIT) { - last_temp = code & LAST_TEMP_MASK; - goto done; - } else { - last_temp3 = code & LAST_TEMP_MASK; - } - - if (last_temp == last_temp2) - last_temp = last_temp2; - else if (last_temp2 == last_temp3) - last_temp = last_temp3; -done: - /* Code sign bit is the sign extension for a negative value */ - if (last_temp & CODE_SIGN_BIT) - last_temp |= ~CODE_SIGN_BIT; - - /* Temperatures are in deciCelicius */ - *temp = last_temp * 100; - - return 0; -} - static const struct tsens_ops ops_8996 = { .init = init_common, - .get_temp = get_temp_8996, + .get_temp = get_temp_tsens_v2, }; const struct tsens_data data_8996 = { diff --git a/drivers/thermal/qcom/tsens-common.c b/drivers/thermal/qcom/tsens-common.c index b1449ad..961ace4 100644 --- a/drivers/thermal/qcom/tsens-common.c +++ b/drivers/thermal/qcom/tsens-common.c @@ -1,15 +1,7 @@ +// SPDX-License-Identifier: GPL-2.0 /* * Copyright (c) 2015, The Linux Foundation. All rights reserved. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 and - * only version 2 as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * + * Copyright (c) 2018, Linaro Limited */ #include @@ -117,6 +109,63 @@ int get_temp_common(struct tsens_device *tmdev, int id, int *temp) return 0; } +#define STATUS_OFFSET 0xa0 +#define LAST_TEMP_MASK 0xfff +#define STATUS_VALID_BIT BIT(21) +#define CODE_SIGN_BIT BIT(11) + +int get_temp_tsens_v2(struct tsens_device *tmdev, int id, int *temp) +{ + struct tsens_sensor *s = &tmdev->sensor[id]; + u32 code; + unsigned int sensor_addr; + int last_temp = 0, last_temp2 = 0, last_temp3 = 0, ret; + + sensor_addr = STATUS_OFFSET + s->hw_id * 4; + ret = regmap_read(tmdev->map, sensor_addr, &code); + if (ret) + return ret; + last_temp = code & LAST_TEMP_MASK; + if (code & STATUS_VALID_BIT) + goto done; + + /* Try a second time */ + ret = regmap_read(tmdev->map, sensor_addr, &code); + if (ret) + return ret; + if (code & STATUS_VALID_BIT) { + last_temp = code & LAST_TEMP_MASK; + goto done; + } else { + last_temp2 = code & LAST_TEMP_MASK; + } + + /* Try a third/last time */ + ret = regmap_read(tmdev->map, sensor_addr, &code); + if (ret) + return ret; + if (code & STATUS_VALID_BIT) { + last_temp = code & LAST_TEMP_MASK; + goto done; + } else { + last_temp3 = code & LAST_TEMP_MASK; + } + + if (last_temp == last_temp2) + last_temp = last_temp2; + else if (last_temp2 == last_temp3) + last_temp = last_temp3; +done: + /* Code sign bit is the sign extension for a negative value */ + if (last_temp & CODE_SIGN_BIT) + last_temp |= ~CODE_SIGN_BIT; + + /* Temperatures are in deciCelicius */ + *temp = last_temp * 100; + + return 0; +} + static const struct regmap_config tsens_config = { .reg_bits = 32, .val_bits = 32, diff --git a/drivers/thermal/qcom/tsens.h b/drivers/thermal/qcom/tsens.h index dc56e1e..80b273d 100644 --- a/drivers/thermal/qcom/tsens.h +++ b/drivers/thermal/qcom/tsens.h @@ -86,6 +86,7 @@ char *qfprom_read(struct device *, const char *); void compute_intercept_slope(struct tsens_device *, u32 *, u32 *, u32); int init_common(struct tsens_device *); int get_temp_common(struct tsens_device *, int, int *); +int get_temp_tsens_v2(struct tsens_device *, int, int *); extern const struct tsens_data data_8916, data_8974, data_8960, data_8996; From patchwork Tue Jun 12 10:54:56 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amit Kucheria X-Patchwork-Id: 138310 Delivered-To: patch@linaro.org Received: by 2002:a2e:970d:0:0:0:0:0 with SMTP id r13-v6csp5190192lji; Tue, 12 Jun 2018 03:55:57 -0700 (PDT) X-Google-Smtp-Source: ADUXVKLZRYQqWL5qtlWkwbAh0AdWOrWacGqOgCYXFAnoJOkYN9tCGz0yynhQ2OiUliygrEQdDeG3 X-Received: by 2002:a62:1f45:: with SMTP id f66-v6mr3275192pff.253.1528800957605; Tue, 12 Jun 2018 03:55:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528800957; cv=none; d=google.com; s=arc-20160816; b=wl4wyvjiZVC9ItwOfiehnxP5xFPD5A015QYnk/W8ULwfHCNjoVlCqRgDiVtvxOnT3M RoBMj3KLyca2vQf19OY0V6ph/Orx74o1h4rz4cihwdwgF4mRLGwKGMMmXvoY5zmOTXo4 LXRsNvx2XyV/r8uarNOREB29vq3Cfi7vEYvKDXyckvPoiUx/Yf9ix4bwMOqG1F4KXz64 hVnWyQIoFPVQG5MW8SD5tlfGD8Q3ZrbHHqc4HBPCbAIh0mTG/YtG4xg9TlUT0isyUZjq F4aEVskd2DWJFIBO1gtENz6VAdQgiDASN/JHeNrf5jy5yjGmdOgWeChvZ7vAmAzwJHx9 8ZlA== 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 :arc-authentication-results; bh=ZU3YeEU8NY37ah8kUZqdRgYcmcdIceilqJcD26/ugtA=; b=S+XyDi7gjQ0jVX9rW6r73RvXUrOqSTxNa+ahhLwRZAIkYu/3ufug1INo92+TyGrt3M wG/UmacsK7CvYP/vF52p7rg3EwiASBEI2wC/MLOz8oTNMgxOVUmYKDDy/hzV1helTarT Y56um8RoDrA7Kfu2Gyeg5+uxwWnHlz7w6hWk/MgYa9nkt2LHFQyUvFOxSy7kZMH0P7uZ w0cD7rNII57Ifd6kSzHIHnzMXF3WluduFehJzo8kNCMvDETwAI03CgDlfug8mdNa/S6r ZvMc/3/tHLIfZyOhxL8CnvuY0bXXh4weDdUlojKaOsIz/M87etV0Rf0nkmKKeFO48CWb zL5Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=TNCzBA9n; 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 g9-v6si628592plt.232.2018.06.12.03.55.57; Tue, 12 Jun 2018 03:55:57 -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=TNCzBA9n; 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 S933392AbeFLKzz (ORCPT + 30 others); Tue, 12 Jun 2018 06:55:55 -0400 Received: from mail-lf0-f65.google.com ([209.85.215.65]:38029 "EHLO mail-lf0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933277AbeFLKzw (ORCPT ); Tue, 12 Jun 2018 06:55:52 -0400 Received: by mail-lf0-f65.google.com with SMTP id i83-v6so35293125lfh.5 for ; Tue, 12 Jun 2018 03:55:51 -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=ZU3YeEU8NY37ah8kUZqdRgYcmcdIceilqJcD26/ugtA=; b=TNCzBA9nlVNF9zMGGflcePqzSP0AuUh5G5L6KQ11c4UonGfOQKgdcA1i4EKZDqOtNt jpLKEmGCXuBsJl/Z8Ut+mNU6BhTPmUDsQl8SGmRKge+8RupkVyglgHPNybmYoIGnH4kt xzdF/TeGj+zCjSiBC2RDNA0uY8kB4VuyLvvY8= 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=ZU3YeEU8NY37ah8kUZqdRgYcmcdIceilqJcD26/ugtA=; b=lfKhn8hUgO37UEshmq2dnbMNJ8F2NudoojgnDPy5/Zu/yP5bKUBljI9yLLDv5qxaEh 97LZx2ayAYhSyQra2D4eYBcK4j1/o1WlPFhQ6wnM0SFrN77JWW7OzJCmDw631fJ2xqjp gWya6UW2B2meArmvFHJUpzt24v1OilBCD7YdqzLI5fH8DjqZ9ziwo+t3x4kRfW3mJWql dYuMNKHG/Bs88q+hVQg/lsUXcA0H89k7mk2VJn+Jjz0N+3JDiUbO/sBfwxm3F++tvQAe MKbHzj+KdjVSG/iDl/WlOaKB+94ooGN4uBLEvp0lziPifHPaK7Qvwe+70bQCojzjvRPC P5iA== X-Gm-Message-State: APt69E0R5nc0rYisTu4dIpfvNk0I5gdU/cN7oAMATwNxm6gQ/ZGqbAgm DBUriu0Esgu+N/tWxeJoIl4qFLE2GJc= X-Received: by 2002:a2e:1d59:: with SMTP id d86-v6mr2145279ljd.104.1528800950694; Tue, 12 Jun 2018 03:55:50 -0700 (PDT) Received: from localhost (85-76-96-64-nat.elisa-mobile.fi. [85.76.96.64]) by smtp.gmail.com with ESMTPSA id o11-v6sm163996lji.0.2018.06.12.03.55.49 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 12 Jun 2018 03:55:50 -0700 (PDT) From: Amit Kucheria To: linux-kernel@vger.kernel.org Cc: rnayak@codeaurora.org, linux-arm-msm@vger.kernel.org, bjorn.andersson@linaro.org, edubezval@gmail.com, Zhang Rui , Rob Herring , Mark Rutland , linux-pm@vger.kernel.org (open list:THERMAL), devicetree@vger.kernel.org (open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS) Subject: [PATCH v2 4/5] thermal: tsens: Add support for SDM845 Date: Tue, 12 Jun 2018 13:54:56 +0300 Message-Id: X-Mailer: git-send-email 2.7.4 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 SDM845 uses the TSENS v2 IP block Signed-off-by: Amit Kucheria --- Documentation/devicetree/bindings/thermal/qcom-tsens.txt | 1 + drivers/thermal/qcom/Makefile | 2 +- drivers/thermal/qcom/tsens-sdm845.c | 15 +++++++++++++++ drivers/thermal/qcom/tsens.c | 3 +++ drivers/thermal/qcom/tsens.h | 5 ++++- 5 files changed, 24 insertions(+), 2 deletions(-) create mode 100644 drivers/thermal/qcom/tsens-sdm845.c -- 2.7.4 diff --git a/Documentation/devicetree/bindings/thermal/qcom-tsens.txt b/Documentation/devicetree/bindings/thermal/qcom-tsens.txt index 292ed89..8652499 100644 --- a/Documentation/devicetree/bindings/thermal/qcom-tsens.txt +++ b/Documentation/devicetree/bindings/thermal/qcom-tsens.txt @@ -5,6 +5,7 @@ Required properties: - "qcom,msm8916-tsens" : For 8916 Family of SoCs - "qcom,msm8974-tsens" : For 8974 Family of SoCs - "qcom,msm8996-tsens" : For 8996 Family of SoCs + - "qcom,sdm845-tsens" : For SDM845 Family of SoCs - reg: Address range of the thermal registers - #thermal-sensor-cells : Should be 1. See ./thermal.txt for a description. diff --git a/drivers/thermal/qcom/Makefile b/drivers/thermal/qcom/Makefile index 2cc2193..dc9f169 100644 --- a/drivers/thermal/qcom/Makefile +++ b/drivers/thermal/qcom/Makefile @@ -1,2 +1,2 @@ obj-$(CONFIG_QCOM_TSENS) += qcom_tsens.o -qcom_tsens-y += tsens.o tsens-common.o tsens-8916.o tsens-8974.o tsens-8960.o tsens-8996.o +qcom_tsens-y += tsens.o tsens-common.o tsens-8916.o tsens-8974.o tsens-8960.o tsens-8996.o tsens-sdm845.o diff --git a/drivers/thermal/qcom/tsens-sdm845.c b/drivers/thermal/qcom/tsens-sdm845.c new file mode 100644 index 0000000..a647265 --- /dev/null +++ b/drivers/thermal/qcom/tsens-sdm845.c @@ -0,0 +1,15 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Copyright (c) 2018, Linaro Limited + */ + +#include "tsens.h" + +static const struct tsens_ops ops_sdm845 = { + .init = init_common, + .get_temp = get_temp_tsens_v2, +}; + +const struct tsens_data data_sdm845 = { + .ops = &ops_sdm845, +}; diff --git a/drivers/thermal/qcom/tsens.c b/drivers/thermal/qcom/tsens.c index 3f9fe6a..314a20f 100644 --- a/drivers/thermal/qcom/tsens.c +++ b/drivers/thermal/qcom/tsens.c @@ -72,6 +72,9 @@ static const struct of_device_id tsens_table[] = { }, { .compatible = "qcom,msm8996-tsens", .data = &data_8996, + }, { + .compatible = "qcom,sdm845-tsens", + .data = &data_sdm845, }, {} }; diff --git a/drivers/thermal/qcom/tsens.h b/drivers/thermal/qcom/tsens.h index 80b273d..e4c0a38 100644 --- a/drivers/thermal/qcom/tsens.h +++ b/drivers/thermal/qcom/tsens.h @@ -88,6 +88,9 @@ int init_common(struct tsens_device *); int get_temp_common(struct tsens_device *, int, int *); int get_temp_tsens_v2(struct tsens_device *, int, int *); -extern const struct tsens_data data_8916, data_8974, data_8960, data_8996; +/* TSENS v1 targets */ +extern const struct tsens_data data_8916, data_8974, data_8960; +/* TSENS v2 targets */ +extern const struct tsens_data data_8996, data_sdm845; #endif /* __QCOM_TSENS_H__ */ From patchwork Tue Jun 12 10:54:57 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amit Kucheria X-Patchwork-Id: 138311 Delivered-To: patch@linaro.org Received: by 2002:a2e:970d:0:0:0:0:0 with SMTP id r13-v6csp5190259lji; Tue, 12 Jun 2018 03:56:03 -0700 (PDT) X-Google-Smtp-Source: ADUXVKLO9y6EALJB7gGwZD28RASAE5TfjvpANg+Ua4BvwiW8QGfzvg7J1ZpgOwk5ualCauAkkeAn X-Received: by 2002:a65:4841:: with SMTP id i1-v6mr2738865pgs.75.1528800963221; Tue, 12 Jun 2018 03:56:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528800963; cv=none; d=google.com; s=arc-20160816; b=ggVPgA99TRObVyGcPdrmsDMy8M+kYizH3doNSACkjoVjFLL6WvJYMThhEZVNYDebPP 7Q2jvByph6wzvKxedI2D79X0X0enECqf+5Tg9td6Dw5/36XWottxv8hSe3tJoCBXAtXn EZZZlEYY+O9W8/bBM6QOxkL43uzzG2Uvb/TkX5X5bo2R2NzZjaqBVnQL0rG2jt1IjSb4 TH8hBLZdjTau/IiFvF9AU+gQzbNBTH0F9s0D+67ysWRBgIHv2oMaJcAm6jTJnbNbcSIQ dYiemu6ADydMD/CujBojWqj/byuJlp0RZF7kf17HedMyq4OKEKTyIKN7rpKKd0k3Yapi U9xg== 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 :arc-authentication-results; bh=IsTrdZ+kDihtM/XHpghRzKqziLMnz08SUOtIHPMaoHk=; b=I8P+S6Qg8Yp7Xw0+90uNh9zwxr/vAK7YeB/fMZ4H26fEiZiPh8VpFHEcHdB4geNWZ/ zgZhqdsl21fZko7QttJdiqJB/mdrMxsHPsPPgAuy0IJwW1kYSllx3H7QMH4xzZmFWnoX IL9y7sVoRHvNrK5Ni2M9b+Uvzr46s6DF8XisGofTxc+7nR7+3NY00QHGMgaOwVNhXgRP a28Roba5BW0ff+Xmw21mn63w32COzJzLk2nbSNtGPn40EBQYbETkUsFi+oF55dKEpIQC brfGC0gXXb7O+0d4JIaGGErivgW8NcVdSrVC27jYOhFqCf8hAt1R5bvK+cZyL4h2+uxo O8lA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=isZzJiXi; 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 g9-v6si628592plt.232.2018.06.12.03.56.02; Tue, 12 Jun 2018 03:56:03 -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=isZzJiXi; 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 S933277AbeFLK4A (ORCPT + 30 others); Tue, 12 Jun 2018 06:56:00 -0400 Received: from mail-lf0-f68.google.com ([209.85.215.68]:39809 "EHLO mail-lf0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933394AbeFLKz4 (ORCPT ); Tue, 12 Jun 2018 06:55:56 -0400 Received: by mail-lf0-f68.google.com with SMTP id t134-v6so35302927lff.6 for ; Tue, 12 Jun 2018 03:55:55 -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=IsTrdZ+kDihtM/XHpghRzKqziLMnz08SUOtIHPMaoHk=; b=isZzJiXi+rLTzHRpafJw0fs25sc4Vi13LlgvCI0+WtbmNyJvAigBgGl6PF3870/xAQ v9KBEXySnExvg87WZ3yeSuXXUOdktnxloyDc2xuyBIhK9TjzSxxTfyEZ0XfpsRx1+1Je 6mAY59v72Qq3GYZSwmxh4mS4xcBnJGogj56LE= 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=IsTrdZ+kDihtM/XHpghRzKqziLMnz08SUOtIHPMaoHk=; b=mojhqvk6r4UB/Fp3eJwGOz2YoHUnFUXe9XUhoo816BePE6cviFLv3gcvYWsBHloqnv X5GaDYLLZNNnsRBdXPnXGu81HfxFh5eS8a75YMsKNEhHdUMoCU6Yu2FGRy1CYe3BSZGD dtSbmFMIuy718OoDREjz8V5Amu51pbWl2RsOA/9hezu9yryBJynMFrRiDizv70v5qB54 mpWHARNwyH3zEFHhLSqHeKSj+EA57lzTRn0C4iMwKvj+2F7FFrXssSmQ82/S4a/JoI0x /IikPn79XKrMktgCf+MmID40rZW5Z1+KM5xPJwLpUIVp0d6MtyFhsa6trThstmTRXQv8 gGmQ== X-Gm-Message-State: APt69E2kHI346t1UF5ikKk+JSmn5ZEuoylHQ09lFGgjCYl5+akVB/r2U O2fzGkiVa1hh3LkzzAOxSuIxCEQuGTg= X-Received: by 2002:a19:1c5:: with SMTP id 188-v6mr1919305lfb.67.1528800954642; Tue, 12 Jun 2018 03:55:54 -0700 (PDT) Received: from localhost (85-76-96-64-nat.elisa-mobile.fi. [85.76.96.64]) by smtp.gmail.com with ESMTPSA id r27-v6sm144699lfi.8.2018.06.12.03.55.53 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 12 Jun 2018 03:55:54 -0700 (PDT) From: Amit Kucheria To: linux-kernel@vger.kernel.org Cc: rnayak@codeaurora.org, linux-arm-msm@vger.kernel.org, bjorn.andersson@linaro.org, edubezval@gmail.com, Zhang Rui , linux-pm@vger.kernel.org (open list:THERMAL) Subject: [PATCH v2 5/5] thermal: tsens: Check if we have valid data before reading Date: Tue, 12 Jun 2018 13:54:57 +0300 Message-Id: <021331bdb04642e9ddf34accda65a93b850c4a23.1528799892.git.amit.kucheria@linaro.org> X-Mailer: git-send-email 2.7.4 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 Signed-off-by: Amit Kucheria --- drivers/thermal/qcom/tsens-common.c | 9 +++++++++ 1 file changed, 9 insertions(+) -- 2.7.4 Reviewed-by: Bjorn Andersson diff --git a/drivers/thermal/qcom/tsens-common.c b/drivers/thermal/qcom/tsens-common.c index 961ace4..f510e61 100644 --- a/drivers/thermal/qcom/tsens-common.c +++ b/drivers/thermal/qcom/tsens-common.c @@ -114,6 +114,9 @@ int get_temp_common(struct tsens_device *tmdev, int id, int *temp) #define STATUS_VALID_BIT BIT(21) #define CODE_SIGN_BIT BIT(11) +#define TRDY_OFFSET 0xe4 +#define TRDY_READY_BIT BIT(0) + int get_temp_tsens_v2(struct tsens_device *tmdev, int id, int *temp) { struct tsens_sensor *s = &tmdev->sensor[id]; @@ -121,6 +124,12 @@ int get_temp_tsens_v2(struct tsens_device *tmdev, int id, int *temp) unsigned int sensor_addr; int last_temp = 0, last_temp2 = 0, last_temp3 = 0, ret; + ret = regmap_read(tmdev->map, TRDY_OFFSET, &code); + if (ret) + return ret; + if (code & TRDY_READY_BIT) + return -ENODATA; + sensor_addr = STATUS_OFFSET + s->hw_id * 4; ret = regmap_read(tmdev->map, sensor_addr, &code); if (ret)