From patchwork Thu Aug 9 12:32:33 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amit Kucheria X-Patchwork-Id: 10561387 X-Patchwork-Delegate: eduardo.valentin@ti.com Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 917D996FA for ; Thu, 9 Aug 2018 12:34:05 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7EC882A543 for ; Thu, 9 Aug 2018 12:34:05 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 727FD2A59D; Thu, 9 Aug 2018 12:34:05 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1E49D2A54D for ; Thu, 9 Aug 2018 12:34:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731990AbeHIO5l (ORCPT ); Thu, 9 Aug 2018 10:57:41 -0400 Received: from mail-pg1-f195.google.com ([209.85.215.195]:34539 "EHLO mail-pg1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731399AbeHIO5k (ORCPT ); Thu, 9 Aug 2018 10:57:40 -0400 Received: by mail-pg1-f195.google.com with SMTP id y5-v6so2702792pgv.1 for ; Thu, 09 Aug 2018 05:32:59 -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=zyKbfUOB0Y9T8bByL2E46QXLNpmRHMe5dD12vKApofY=; b=EUbM4/SIh7RAHxEjlJgTq6apupexB9/sDI3QO/YPngFPr1iC4TZjnKT5uHU6TgXbuq Dl54WWuhj2nbaU1XD6L0VEmkEMb+nW0TmZayNnpC5aMQIzPfP7O4XdQmGSix83xM7Sh+ Ur517vJlbwHPuKQVBIb5oughoqod27z2WwCT8= 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=zyKbfUOB0Y9T8bByL2E46QXLNpmRHMe5dD12vKApofY=; b=RfsDuBpRy3/soZaoF7RNP3ZOewL6wQ0+QJSxw/MpUkdiU48U4WvVJZBCyuda7wvRFV m7wvQL/sapjZHqyvvffZIgl4G/cBb8QZbZ7QfmnQFH8OL2JmxeyoQxcNzk2h35YVzhzP Z2rQX6Q940yIEDJXy3U679DOjifywS08Yd90UOgLc8+wzzDFfg5T4UZnRiTAhK9aOqOe yb0icPn7icq7S+/Wnc8tNFS0nQenbW0zTf5qYQDk1U56UmTmHXy3eOp3m+kfKWxdZDrk AtfJ/L787iOsvlZYnQoslz46DvC5ygS+VCi3waF2VDhcLOkUJyA25pzkSI8DBQXkWqKO TNlQ== X-Gm-Message-State: AOUpUlHUpdw6cbsS/IDrq5HsqmP1U7lHB8CtSbp/jzTJAzcGt69OjLOR ZRzWKsePGYA9mTcdKOoBXKMaPw== X-Google-Smtp-Source: AA+uWPynNbgSQQ9l/E1L3209WPLgCT7lV5BhDtWZ/Il0/Cm1U8gFwDoKDqPAPWZltPnd5jdW8qvJ1g== X-Received: by 2002:a63:8f03:: with SMTP id n3-v6mr2051619pgd.166.1533817978957; Thu, 09 Aug 2018 05:32:58 -0700 (PDT) Received: from localhost ([45.113.251.134]) by smtp.gmail.com with ESMTPSA id r1-v6sm20812005pfi.17.2018.08.09.05.32.57 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 09 Aug 2018 05:32:58 -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, smohanad@codeaurora.org, andy.gross@linaro.org, dianders@chromium.org, mka@chromium.org, David Brown , Rob Herring , Mark Rutland , Catalin Marinas , Will Deacon , Zhang Rui , linux-soc@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-pm@vger.kernel.org Subject: [PATCH v1 01/10] arm/arm64: dts: msm8974/msm8916: thermal: Split address space into two Date: Thu, 9 Aug 2018 18:02:33 +0530 Message-Id: X-Mailer: git-send-email 2.17.1 In-Reply-To: References: In-Reply-To: References: Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP We've earlier added support to split the register address space into TM and SROT regions. Split up the regmap address space into two for the remaining platforms that have a similar register layout and make corresponding changes to the get_temp_common() function used by these platforms. 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 Reviewed-by: Matthias Kaehlcke --- arch/arm/boot/dts/qcom-msm8974.dtsi | 6 ++++-- arch/arm64/boot/dts/qcom/msm8916.dtsi | 6 ++++-- drivers/thermal/qcom/tsens-common.c | 5 +++-- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/arch/arm/boot/dts/qcom-msm8974.dtsi b/arch/arm/boot/dts/qcom-msm8974.dtsi index d9019a49b292..3c4b81c29798 100644 --- a/arch/arm/boot/dts/qcom-msm8974.dtsi +++ b/arch/arm/boot/dts/qcom-msm8974.dtsi @@ -427,11 +427,13 @@ }; }; - tsens: thermal-sensor@fc4a8000 { + tsens: thermal-sensor@fc4a9000 { compatible = "qcom,msm8974-tsens"; - reg = <0xfc4a8000 0x2000>; + reg = <0xfc4a9000 0x1000>, /* TM */ + <0xfc4a8000 0x1000>; /* SROT */ nvmem-cells = <&tsens_calib>, <&tsens_backup>; nvmem-cell-names = "calib", "calib_backup"; + #qcom,sensors = <11>; #thermal-sensor-cells = <1>; }; diff --git a/arch/arm64/boot/dts/qcom/msm8916.dtsi b/arch/arm64/boot/dts/qcom/msm8916.dtsi index cc1040eacdf5..abf84df5a7bc 100644 --- a/arch/arm64/boot/dts/qcom/msm8916.dtsi +++ b/arch/arm64/boot/dts/qcom/msm8916.dtsi @@ -774,11 +774,13 @@ }; }; - tsens: thermal-sensor@4a8000 { + tsens: thermal-sensor@4a9000 { compatible = "qcom,msm8916-tsens"; - reg = <0x4a8000 0x2000>; + reg = <0x4a9000 0x1000>, /* TM */ + <0x4a8000 0x1000>; /* SROT */ nvmem-cells = <&tsens_caldata>, <&tsens_calsel>; nvmem-cell-names = "calib", "calib_sel"; + #qcom,sensors = <5>; #thermal-sensor-cells = <1>; }; diff --git a/drivers/thermal/qcom/tsens-common.c b/drivers/thermal/qcom/tsens-common.c index 6207d8d92351..478739543bbc 100644 --- a/drivers/thermal/qcom/tsens-common.c +++ b/drivers/thermal/qcom/tsens-common.c @@ -21,7 +21,7 @@ #include #include "tsens.h" -#define S0_ST_ADDR 0x1030 +#define STATUS_OFFSET 0x30 #define SN_ADDR_OFFSET 0x4 #define SN_ST_TEMP_MASK 0x3ff #define CAL_DEGC_PT1 30 @@ -107,8 +107,9 @@ int get_temp_common(struct tsens_device *tmdev, int id, int *temp) unsigned int status_reg; int last_temp = 0, ret; - status_reg = S0_ST_ADDR + s->hw_id * SN_ADDR_OFFSET; + status_reg = tmdev->tm_offset + STATUS_OFFSET + s->hw_id * SN_ADDR_OFFSET; ret = regmap_read(tmdev->map, status_reg, &code); + if (ret) return ret; last_temp = code & SN_ST_TEMP_MASK; From patchwork Thu Aug 9 12:32:34 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amit Kucheria X-Patchwork-Id: 10561385 X-Patchwork-Delegate: eduardo.valentin@ti.com Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 21D3D157B for ; Thu, 9 Aug 2018 12:34:05 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0DB7F2A543 for ; Thu, 9 Aug 2018 12:34:05 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 01DCB2A59D; Thu, 9 Aug 2018 12:34:04 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A95BF2A54D for ; Thu, 9 Aug 2018 12:34:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732063AbeHIO5p (ORCPT ); Thu, 9 Aug 2018 10:57:45 -0400 Received: from mail-pf1-f194.google.com ([209.85.210.194]:40003 "EHLO mail-pf1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732047AbeHIO5o (ORCPT ); Thu, 9 Aug 2018 10:57:44 -0400 Received: by mail-pf1-f194.google.com with SMTP id e13-v6so2784119pff.7 for ; Thu, 09 Aug 2018 05:33:03 -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=zbtXplXL4eCfyozOTLoTj7c7yf/Di+JxuuvxI0s2oo8=; b=b6rAd07HpkMnc5nB0TJyPTwaanaEBzqHYDhX6y1dkCJu1hA5Q70SstU81tyCkPZjYD QQjwDzlLeA+3D6T4w7qahzlS2ioLrmjnK/9ccUaCT07l5afJqb/0rxgUcI8KaqEZCOfG NWZTZDfJOysWY4FLhzQ8gcr5umfQWcAviNGp0= 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=zbtXplXL4eCfyozOTLoTj7c7yf/Di+JxuuvxI0s2oo8=; b=j6D+SeEH98oraQFVyjwXcNjkb0u6sQAZQ4xjsru1nw7IkE4LnnBqQssSJ01fvPy5qp X0b5LN5QEAqtwbRACcRgypK00YjpUMTKYKKrhXz+iHLW5vAC44Ji5nP+0NWtZCy0TjxM gxIFRv7dWwXdsXG4X/SrY5yCd/jBNPt9Ml4T662Y8G1Q1iTbkTagP3L+ONuZ2+m+hjRH CQ2H7IgPW/jHuE8g/8Jrhaoff1TMmfN3hwu40StHretdBxyj1VF1axO8l8AK1v03cgqL NMYgiRIPx5t3FzOusGsazdSZ+bUqYyqGoFiUVKUYqIKeL5MmA98rbOZWHKo8bcbVCc7C earw== X-Gm-Message-State: AOUpUlEXgyWSjwdnzLKsMdtQKTs650wd9+s7Jqv//N1ebW64WJEtb49N J2cLu/HWN48niAR131amHEJW2g== X-Google-Smtp-Source: AA+uWPw65ytn1LX2ZRGNXXn1EJu89v3kbg7dexqmknaBz1WUA03GZX/FK7WXpXeXs62USl97UXFFNQ== X-Received: by 2002:a63:c80e:: with SMTP id z14-v6mr1965521pgg.77.1533817983225; Thu, 09 Aug 2018 05:33:03 -0700 (PDT) Received: from localhost ([45.113.251.134]) by smtp.gmail.com with ESMTPSA id g15-v6sm17012656pfg.98.2018.08.09.05.33.02 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 09 Aug 2018 05:33:02 -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, smohanad@codeaurora.org, andy.gross@linaro.org, dianders@chromium.org, mka@chromium.org, Zhang Rui , Rob Herring , Mark Rutland , linux-pm@vger.kernel.org, devicetree@vger.kernel.org Subject: [PATCH v1 02/10] dt-bindings: thermal: Fix a typo in documentation Date: Thu, 9 Aug 2018 18:02:34 +0530 Message-Id: <08b528ddc26adcb57539b1ac9d352850d7d80bfb.1533815718.git.amit.kucheria@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: References: In-Reply-To: References: Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP c(1) + x(1) was actually meant to be c(1) * x(1). While we're at it, add some brackets to make it nicer to read. Signed-off-by: Amit Kucheria Reviewed-by: Matthias Kaehlcke Acked-by: Rob Herring --- Documentation/devicetree/bindings/thermal/thermal.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Documentation/devicetree/bindings/thermal/thermal.txt b/Documentation/devicetree/bindings/thermal/thermal.txt index cc553f0952c5..751104213d08 100644 --- a/Documentation/devicetree/bindings/thermal/thermal.txt +++ b/Documentation/devicetree/bindings/thermal/thermal.txt @@ -152,7 +152,7 @@ Optional property: Elem size: one cell the sensors listed in the thermal-sensors property. Elem type: signed Coefficients defaults to 1, in case this property is not specified. A simple linear polynomial is used: - Z = c0 * x0 + c1 + x1 + ... + c(n-1) * x(n-1) + cn. + Z = (c0 * x0) + (c1 * x1) + ... + (c(n-1) * x(n-1)) + cn. The coefficients are ordered and they match with sensors by means of sensor ID. Additional coefficients are From patchwork Thu Aug 9 12:32:35 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amit Kucheria X-Patchwork-Id: 10561381 X-Patchwork-Delegate: eduardo.valentin@ti.com Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 8DB9C13AC for ; Thu, 9 Aug 2018 12:34:02 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7B7D92A543 for ; Thu, 9 Aug 2018 12:34:02 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 667922A766; Thu, 9 Aug 2018 12:34:02 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DCD4F2A543 for ; Thu, 9 Aug 2018 12:34:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732104AbeHIO5t (ORCPT ); Thu, 9 Aug 2018 10:57:49 -0400 Received: from mail-pf1-f196.google.com ([209.85.210.196]:46303 "EHLO mail-pf1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732053AbeHIO5s (ORCPT ); Thu, 9 Aug 2018 10:57:48 -0400 Received: by mail-pf1-f196.google.com with SMTP id u24-v6so2771772pfn.13 for ; Thu, 09 Aug 2018 05:33:07 -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=GqaR+pMjJdkNsSIhnkSoF14V5peIytBf2o52E7KsCnE=; b=dfcO0CnvnkBsmBjgMJJUhSkx0NkiSIuooxhRfBJzC709HygUcr00z0coENS9ngv/3q 6ol8Gts0WWM0Pdfocy5zNf4J27bW4q6VLplzyFL9M9G4Z7XYuGdr3dQ4m4hoR8mv09Ol yH7Q64r/Gf7H2a4JbhxsPzdbukzDsqTaDfvBY= 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=GqaR+pMjJdkNsSIhnkSoF14V5peIytBf2o52E7KsCnE=; b=HeDYqEsC4sHJoFRCb4fD2dV0tvrJOy5iemtvWJ22D45uUFXd+pNPs+meVnwdmu8rw4 dYtQti7L0b7k25wWXek7g0UjJjfsBE7WHvnS+cAO2EQLtqHyBQwx+AP6zPWj2lcX4Okn lNwtE9HG63FJ69sl0ohTQta351X0/CwNDbRfXwnc0pIOdVxDphaAW8dB03bpVKhCRlkH edSgCE8pY35zTWcTXyyM4kelUVRe1RBlnHKWrYxMkta5R71foxINm2fPJmUavjQOvSxi YWTThQYqMVIg6PSn56CroJj7xQxHZFwKlPbjktjs+rpiR4+IrWTq94x4L1FjMalr6C/0 1neA== X-Gm-Message-State: AOUpUlHGM4nK39OOvd/LcVL+TANTTHK7vTV4JPeCB8rjNMgQ0+HTQgR9 AtZzROcaTIniF+oxI9e6d7VQyA== X-Google-Smtp-Source: AA+uWPwyUiKZHviMCbEGS8kEowv05Prr/LSkS2SQmpgGQu+SdrZ93voPcmG2iG3g7cCm6Yraa6tXww== X-Received: by 2002:a63:81c3:: with SMTP id t186-v6mr2027769pgd.413.1533817986719; Thu, 09 Aug 2018 05:33:06 -0700 (PDT) Received: from localhost ([45.113.251.134]) by smtp.gmail.com with ESMTPSA id z5-v6sm16478779pfi.4.2018.08.09.05.33.05 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 09 Aug 2018 05:33:06 -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, smohanad@codeaurora.org, andy.gross@linaro.org, dianders@chromium.org, mka@chromium.org, Zhang Rui , linux-pm@vger.kernel.org Subject: [PATCH v1 03/10] thermal: tsens: Add SPDX license identifiers Date: Thu, 9 Aug 2018 18:02:35 +0530 Message-Id: X-Mailer: git-send-email 2.17.1 In-Reply-To: References: In-Reply-To: References: Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The TSENS drivers use a GPL-2.0 license. Replace with equivalent SPDX tags and delete the full license text. Signed-off-by: Amit Kucheria Reviewed-by: Matthias Kaehlcke --- drivers/thermal/qcom/tsens-8916.c | 11 +---------- drivers/thermal/qcom/tsens-8960.c | 11 +---------- drivers/thermal/qcom/tsens-8974.c | 11 +---------- drivers/thermal/qcom/tsens-common.c | 11 +---------- drivers/thermal/qcom/tsens.c | 11 +---------- drivers/thermal/qcom/tsens.h | 11 ++--------- 6 files changed, 7 insertions(+), 59 deletions(-) diff --git a/drivers/thermal/qcom/tsens-8916.c b/drivers/thermal/qcom/tsens-8916.c index fdf561b8b81d..c4955c85e922 100644 --- a/drivers/thermal/qcom/tsens-8916.c +++ b/drivers/thermal/qcom/tsens-8916.c @@ -1,15 +1,6 @@ +// 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. - * */ #include diff --git a/drivers/thermal/qcom/tsens-8960.c b/drivers/thermal/qcom/tsens-8960.c index 0451277d3a8f..4af76de7dc2e 100644 --- a/drivers/thermal/qcom/tsens-8960.c +++ b/drivers/thermal/qcom/tsens-8960.c @@ -1,15 +1,6 @@ +// 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. - * */ #include diff --git a/drivers/thermal/qcom/tsens-8974.c b/drivers/thermal/qcom/tsens-8974.c index 9baf77e8cbe3..7e149edbfeb6 100644 --- a/drivers/thermal/qcom/tsens-8974.c +++ b/drivers/thermal/qcom/tsens-8974.c @@ -1,15 +1,6 @@ +// 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. - * */ #include diff --git a/drivers/thermal/qcom/tsens-common.c b/drivers/thermal/qcom/tsens-common.c index 478739543bbc..303e3fdaca98 100644 --- a/drivers/thermal/qcom/tsens-common.c +++ b/drivers/thermal/qcom/tsens-common.c @@ -1,15 +1,6 @@ +// 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. - * */ #include diff --git a/drivers/thermal/qcom/tsens.c b/drivers/thermal/qcom/tsens.c index a2c9bfae3d86..90bb431cf740 100644 --- a/drivers/thermal/qcom/tsens.c +++ b/drivers/thermal/qcom/tsens.c @@ -1,15 +1,6 @@ +// 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. - * */ #include diff --git a/drivers/thermal/qcom/tsens.h b/drivers/thermal/qcom/tsens.h index 14331eb45a86..8207610f326a 100644 --- a/drivers/thermal/qcom/tsens.h +++ b/drivers/thermal/qcom/tsens.h @@ -1,15 +1,8 @@ +/* SPDX-License-Identifier: GPL-2.0 */ /* * Copyright (c) 2015, The Linux Foundation. All rights reserved. - * - * This software is licensed under the terms of the GNU General Public - * License version 2, as published by the Free Software Foundation, and - * may be copied, distributed, and modified under those terms. - * - * 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. */ + #ifndef __QCOM_TSENS_H__ #define __QCOM_TSENS_H__ From patchwork Thu Aug 9 12:32:36 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amit Kucheria X-Patchwork-Id: 10561353 X-Patchwork-Delegate: eduardo.valentin@ti.com Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 4598713AC for ; Thu, 9 Aug 2018 12:33:13 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 350802624C for ; Thu, 9 Aug 2018 12:33:13 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 297C327968; Thu, 9 Aug 2018 12:33:13 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D04782624C for ; Thu, 9 Aug 2018 12:33:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732139AbeHIO5w (ORCPT ); Thu, 9 Aug 2018 10:57:52 -0400 Received: from mail-pg1-f195.google.com ([209.85.215.195]:38419 "EHLO mail-pg1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732136AbeHIO5w (ORCPT ); Thu, 9 Aug 2018 10:57:52 -0400 Received: by mail-pg1-f195.google.com with SMTP id k3-v6so2695761pgq.5 for ; Thu, 09 Aug 2018 05:33:10 -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=LajXdiR+UMjFusLCr0IrH9cyGv2mk15+PoiKf/4cna4=; b=dp3z1FdWV+2UM/p9OwFhQgpvGV9I72sQcZflwuQf1PLFveTjtGNRmQRLkaqTvrlLZG Kle5slvSSIksbdlO2jCJIJLCf4OoH1XLPjsxpBKiEldKEGwFKXEMyc6k80Hlm2OGIiVv UK43GFrevkBifNAgnt2y+h3hEQ09q4Lde6deg= 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=LajXdiR+UMjFusLCr0IrH9cyGv2mk15+PoiKf/4cna4=; b=ttaG0G6gPdtCgViC1Bqp/pV202YbHZh32seux0x20GhyPSrxDKoiEZgzh/HyQJm9ne sTI8VePeBxvL/pNO+M59kAi0YFJMHWmqDxZwXlCOSCINaVZvYXIylEndGCb7+I+ngUzd Dmsfqe0KIY24q7gZ+rPnek1JXKkUs3HZ0kL22Np9udb8kI2LWOOhAvfKppuXgdk16TbG RaUDfjMNyo8cLNxayB+lVUTfeSSzTCv2No42gC3va3I2UdXCe25PLNcaGV96a7KzxQoO tDV21Hw8wv5X7n8GkRccSbtoaVECHWxjBqgR1nedHn1czdoNkRRwgF0N8kBHuYygLiKn GlQQ== X-Gm-Message-State: AOUpUlFGF6Epcc9IdUTMLES4Yo3IvCLokEOPUOnsbYW3rt4dq+dQo/Br ZBsy9q+g8QjVW4SVPWX/eM3Rng== X-Google-Smtp-Source: AA+uWPzPyMgdO2kkhyzzGXNytsX3lfBz0ko88moZSlQql0zPIDYOhZx0SwmKuPf8U1iJ7VcpSHDntQ== X-Received: by 2002:a63:5660:: with SMTP id g32-v6mr2029301pgm.227.1533817990565; Thu, 09 Aug 2018 05:33:10 -0700 (PDT) Received: from localhost ([45.113.251.134]) by smtp.gmail.com with ESMTPSA id i28-v6sm11592220pfk.108.2018.08.09.05.33.09 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 09 Aug 2018 05:33:09 -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, smohanad@codeaurora.org, andy.gross@linaro.org, dianders@chromium.org, mka@chromium.org, Zhang Rui , linux-pm@vger.kernel.org Subject: [PATCH v1 04/10] thermal: tsens: Get rid of dead code Date: Thu, 9 Aug 2018 18:02:36 +0530 Message-Id: <0f945a83190de17df94a1bfcab48e6a86805cc9b.1533815718.git.amit.kucheria@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: References: In-Reply-To: References: Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP hw_id is dynamically allocated but not used anywhere. Get rid of dead code. Signed-off-by: Amit Kucheria Reviewed-by: Matthias Kaehlcke --- drivers/thermal/qcom/tsens.c | 5 ----- 1 file changed, 5 deletions(-) diff --git a/drivers/thermal/qcom/tsens.c b/drivers/thermal/qcom/tsens.c index 90bb431cf740..9a8e8f7b4ae1 100644 --- a/drivers/thermal/qcom/tsens.c +++ b/drivers/thermal/qcom/tsens.c @@ -80,11 +80,6 @@ static int tsens_register(struct tsens_device *tmdev) { int i; struct thermal_zone_device *tzd; - u32 *hw_id, n = tmdev->num_sensors; - - hw_id = devm_kcalloc(tmdev->dev, n, sizeof(u32), GFP_KERNEL); - if (!hw_id) - return -ENOMEM; for (i = 0; i < tmdev->num_sensors; i++) { tmdev->sensor[i].tmdev = tmdev; From patchwork Thu Aug 9 12:32:37 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amit Kucheria X-Patchwork-Id: 10561361 X-Patchwork-Delegate: eduardo.valentin@ti.com Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 5867F157B for ; Thu, 9 Aug 2018 12:33:17 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4698E26538 for ; Thu, 9 Aug 2018 12:33:17 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 39EA42624C; Thu, 9 Aug 2018 12:33:17 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AE23826538 for ; Thu, 9 Aug 2018 12:33:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732171AbeHIO54 (ORCPT ); Thu, 9 Aug 2018 10:57:56 -0400 Received: from mail-pg1-f196.google.com ([209.85.215.196]:36338 "EHLO mail-pg1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732137AbeHIO5z (ORCPT ); Thu, 9 Aug 2018 10:57:55 -0400 Received: by mail-pg1-f196.google.com with SMTP id h12-v6so2700573pgs.3 for ; Thu, 09 Aug 2018 05:33:14 -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=4iFvQEtHzfGSiaSbjmel4gFV6jgpew3aXPZrZrdD19k=; b=WFyj6fC/7ky3EvG+Ujae3rlnT7lLGoKBndzoXpaaeUs9X9MHu7DImpqIu6R4AUyqT0 dgikG2ZWEIzggDKKamPOBr7W4BrydKOmZGkK5fZwElYgyNsNJJNYOk30fL16zcni42pD 7CLGDA9T+6WyrBtuDnjL/xdpz2B+EP7E+8SUw= 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=4iFvQEtHzfGSiaSbjmel4gFV6jgpew3aXPZrZrdD19k=; b=KVEm4OK9xvAF2QBtmGU6z6o1QGPBowAREcNYmpJMlzBiQLpiANi7qI8DUvoKyXOK0/ mg6SYvr6tt3VzhO+eeu8LazXGsNEO9ENfYGN16j5W8s3LMNjLj08Y01zvQ++OSV26xSa VDNbXLP7CRBOFk39cipjZu+rYVQUb/xvwEGYVAyBpoYq10CFGLdBJgT91ObxeExhKcUL 4WKtjv8wx/RPx2uzoDbgJtLwDugBRW8ndNJS06EDuRAPyJQDuKVLsDTW50XmAYqWxySO bkO0uH9e5vIBb99E0SXmGlFvZDxAAjbq6oeic/2rSmNUs+Vk8+IfqmPwdKkCKI1vk8bt Miiw== X-Gm-Message-State: AOUpUlHcGSVBxsKKZbz/j3cgGzME5yXuxW1sS1jf6PgliMCPv2aBMLWo D8/XylL4ei86v27WFa3R6o0g4A== X-Google-Smtp-Source: AA+uWPz80tvJ9J3Ina1sWE7VK3ZDV4f0ewnfxzmx2CsWvSV5ndxBJ6vqrxfTcRChhBdH3QaR8c3FRA== X-Received: by 2002:a63:4d47:: with SMTP id n7-v6mr2017712pgl.270.1533817994112; Thu, 09 Aug 2018 05:33:14 -0700 (PDT) Received: from localhost ([45.113.251.134]) by smtp.gmail.com with ESMTPSA id v20-v6sm10603170pfk.12.2018.08.09.05.33.12 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 09 Aug 2018 05:33:13 -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, smohanad@codeaurora.org, andy.gross@linaro.org, dianders@chromium.org, mka@chromium.org, Zhang Rui , linux-pm@vger.kernel.org Subject: [PATCH v1 05/10] thermal: tsens: Rename map field in order to add a second address map Date: Thu, 9 Aug 2018 18:02:37 +0530 Message-Id: X-Mailer: git-send-email 2.17.1 In-Reply-To: References: In-Reply-To: References: Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The TSENS driver currently only uses a limited set of registers from the TM address space. So it was ok to map just that set of registers and call it "map". We'd now like to map a second set: SROT registers to introduce new functionality. Rename the "map" field to a more appropriate "tm_map". The 8960 doesn't have a clear split between TM and SROT registers. To avoid complicating the data structure, it will switchover to using tm_map for its maps. There is no functional change with this patch. Signed-off-by: Amit Kucheria Reviewed-by: Matthias Kaehlcke --- drivers/thermal/qcom/tsens-8960.c | 30 ++++++++++++++--------------- drivers/thermal/qcom/tsens-common.c | 17 ++++++++-------- drivers/thermal/qcom/tsens-v2.c | 6 +++--- drivers/thermal/qcom/tsens.h | 2 +- 4 files changed, 27 insertions(+), 28 deletions(-) diff --git a/drivers/thermal/qcom/tsens-8960.c b/drivers/thermal/qcom/tsens-8960.c index 4af76de7dc2e..0f0adb302a7b 100644 --- a/drivers/thermal/qcom/tsens-8960.c +++ b/drivers/thermal/qcom/tsens-8960.c @@ -60,7 +60,7 @@ static int suspend_8960(struct tsens_device *tmdev) { int ret; unsigned int mask; - struct regmap *map = tmdev->map; + struct regmap *map = tmdev->tm_map; ret = regmap_read(map, THRESHOLD_ADDR, &tmdev->ctx.threshold); if (ret) @@ -85,7 +85,7 @@ static int suspend_8960(struct tsens_device *tmdev) static int resume_8960(struct tsens_device *tmdev) { int ret; - struct regmap *map = tmdev->map; + struct regmap *map = tmdev->tm_map; ret = regmap_update_bits(map, CNTL_ADDR, SW_RST, SW_RST); if (ret) @@ -117,12 +117,12 @@ static int enable_8960(struct tsens_device *tmdev, int id) int ret; u32 reg, mask; - ret = regmap_read(tmdev->map, CNTL_ADDR, ®); + ret = regmap_read(tmdev->tm_map, CNTL_ADDR, ®); if (ret) return ret; mask = BIT(id + SENSOR0_SHIFT); - ret = regmap_write(tmdev->map, CNTL_ADDR, reg | SW_RST); + ret = regmap_write(tmdev->tm_map, CNTL_ADDR, reg | SW_RST); if (ret) return ret; @@ -131,7 +131,7 @@ static int enable_8960(struct tsens_device *tmdev, int id) else reg |= mask | SLP_CLK_ENA_8660 | EN; - ret = regmap_write(tmdev->map, CNTL_ADDR, reg); + ret = regmap_write(tmdev->tm_map, CNTL_ADDR, reg); if (ret) return ret; @@ -148,7 +148,7 @@ static void disable_8960(struct tsens_device *tmdev) mask <<= SENSOR0_SHIFT; mask |= EN; - ret = regmap_read(tmdev->map, CNTL_ADDR, ®_cntl); + ret = regmap_read(tmdev->tm_map, CNTL_ADDR, ®_cntl); if (ret) return; @@ -159,7 +159,7 @@ static void disable_8960(struct tsens_device *tmdev) else reg_cntl &= ~SLP_CLK_ENA_8660; - regmap_write(tmdev->map, CNTL_ADDR, reg_cntl); + regmap_write(tmdev->tm_map, CNTL_ADDR, reg_cntl); } static int init_8960(struct tsens_device *tmdev) @@ -167,8 +167,8 @@ static int init_8960(struct tsens_device *tmdev) int ret, i; u32 reg_cntl; - tmdev->map = dev_get_regmap(tmdev->dev, NULL); - if (!tmdev->map) + tmdev->tm_map = dev_get_regmap(tmdev->dev, NULL); + if (!tmdev->tm_map) return -ENODEV; /* @@ -184,14 +184,14 @@ static int init_8960(struct tsens_device *tmdev) } reg_cntl = SW_RST; - ret = regmap_update_bits(tmdev->map, CNTL_ADDR, SW_RST, reg_cntl); + ret = regmap_update_bits(tmdev->tm_map, CNTL_ADDR, SW_RST, reg_cntl); if (ret) return ret; if (tmdev->num_sensors > 1) { reg_cntl |= SLP_CLK_ENA | (MEASURE_PERIOD << 18); reg_cntl &= ~SW_RST; - ret = regmap_update_bits(tmdev->map, CONFIG_ADDR, + ret = regmap_update_bits(tmdev->tm_map, CONFIG_ADDR, CONFIG_MASK, CONFIG); } else { reg_cntl |= SLP_CLK_ENA_8660 | (MEASURE_PERIOD << 16); @@ -200,12 +200,12 @@ static int init_8960(struct tsens_device *tmdev) } reg_cntl |= GENMASK(tmdev->num_sensors - 1, 0) << SENSOR0_SHIFT; - ret = regmap_write(tmdev->map, CNTL_ADDR, reg_cntl); + ret = regmap_write(tmdev->tm_map, CNTL_ADDR, reg_cntl); if (ret) return ret; reg_cntl |= EN; - ret = regmap_write(tmdev->map, CNTL_ADDR, reg_cntl); + ret = regmap_write(tmdev->tm_map, CNTL_ADDR, reg_cntl); if (ret) return ret; @@ -252,12 +252,12 @@ static int get_temp_8960(struct tsens_device *tmdev, int id, int *temp) timeout = jiffies + usecs_to_jiffies(TIMEOUT_US); do { - ret = regmap_read(tmdev->map, INT_STATUS_ADDR, &trdy); + ret = regmap_read(tmdev->tm_map, INT_STATUS_ADDR, &trdy); if (ret) return ret; if (!(trdy & TRDY_MASK)) continue; - ret = regmap_read(tmdev->map, s->status, &code); + ret = regmap_read(tmdev->tm_map, s->status, &code); if (ret) return ret; *temp = code_to_mdegC(code, s); diff --git a/drivers/thermal/qcom/tsens-common.c b/drivers/thermal/qcom/tsens-common.c index 303e3fdaca98..0585084630b3 100644 --- a/drivers/thermal/qcom/tsens-common.c +++ b/drivers/thermal/qcom/tsens-common.c @@ -99,8 +99,7 @@ int get_temp_common(struct tsens_device *tmdev, int id, int *temp) int last_temp = 0, ret; status_reg = tmdev->tm_offset + STATUS_OFFSET + s->hw_id * SN_ADDR_OFFSET; - ret = regmap_read(tmdev->map, status_reg, &code); - + ret = regmap_read(tmdev->tm_map, status_reg, &code); if (ret) return ret; last_temp = code & SN_ST_TEMP_MASK; @@ -118,7 +117,7 @@ static const struct regmap_config tsens_config = { int __init init_common(struct tsens_device *tmdev) { - void __iomem *base; + void __iomem *tm_base; struct resource *res; struct platform_device *op = of_find_device_by_node(tmdev->dev->of_node); @@ -134,13 +133,13 @@ int __init init_common(struct tsens_device *tmdev) } res = platform_get_resource(op, IORESOURCE_MEM, 0); - base = devm_ioremap_resource(&op->dev, res); - if (IS_ERR(base)) - return PTR_ERR(base); + tm_base = devm_ioremap_resource(&op->dev, res); + if (IS_ERR(tm_base)) + return PTR_ERR(tm_base); - tmdev->map = devm_regmap_init_mmio(tmdev->dev, base, &tsens_config); - if (IS_ERR(tmdev->map)) - return PTR_ERR(tmdev->map); + tmdev->tm_map = devm_regmap_init_mmio(tmdev->dev, tm_base, &tsens_config); + if (IS_ERR(tmdev->tm_map)) + return PTR_ERR(tmdev->tm_map); return 0; } diff --git a/drivers/thermal/qcom/tsens-v2.c b/drivers/thermal/qcom/tsens-v2.c index 44da02f594ac..1bdef92e4521 100644 --- a/drivers/thermal/qcom/tsens-v2.c +++ b/drivers/thermal/qcom/tsens-v2.c @@ -21,7 +21,7 @@ static int get_temp_tsens_v2(struct tsens_device *tmdev, int id, int *temp) int ret; status_reg = tmdev->tm_offset + STATUS_OFFSET + s->hw_id * 4; - ret = regmap_read(tmdev->map, status_reg, &code); + ret = regmap_read(tmdev->tm_map, status_reg, &code); if (ret) return ret; last_temp = code & LAST_TEMP_MASK; @@ -29,7 +29,7 @@ static int get_temp_tsens_v2(struct tsens_device *tmdev, int id, int *temp) goto done; /* Try a second time */ - ret = regmap_read(tmdev->map, status_reg, &code); + ret = regmap_read(tmdev->tm_map, status_reg, &code); if (ret) return ret; if (code & STATUS_VALID_BIT) { @@ -40,7 +40,7 @@ static int get_temp_tsens_v2(struct tsens_device *tmdev, int id, int *temp) } /* Try a third/last time */ - ret = regmap_read(tmdev->map, status_reg, &code); + ret = regmap_read(tmdev->tm_map, status_reg, &code); if (ret) return ret; if (code & STATUS_VALID_BIT) { diff --git a/drivers/thermal/qcom/tsens.h b/drivers/thermal/qcom/tsens.h index 8207610f326a..58e98c4d3a8b 100644 --- a/drivers/thermal/qcom/tsens.h +++ b/drivers/thermal/qcom/tsens.h @@ -69,7 +69,7 @@ struct tsens_context { struct tsens_device { struct device *dev; u32 num_sensors; - struct regmap *map; + struct regmap *tm_map; u32 tm_offset; struct tsens_context ctx; const struct tsens_ops *ops; From patchwork Thu Aug 9 12:32:38 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amit Kucheria X-Patchwork-Id: 10561379 X-Patchwork-Delegate: eduardo.valentin@ti.com Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id DFBDD13AC for ; Thu, 9 Aug 2018 12:33:55 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CDCEE2A543 for ; Thu, 9 Aug 2018 12:33:55 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C07642A59D; Thu, 9 Aug 2018 12:33:55 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6BEEE2A543 for ; Thu, 9 Aug 2018 12:33:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732201AbeHIO6A (ORCPT ); Thu, 9 Aug 2018 10:58:00 -0400 Received: from mail-pg1-f196.google.com ([209.85.215.196]:43187 "EHLO mail-pg1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731140AbeHIO57 (ORCPT ); Thu, 9 Aug 2018 10:57:59 -0400 Received: by mail-pg1-f196.google.com with SMTP id a14-v6so2682290pgv.10 for ; Thu, 09 Aug 2018 05:33:17 -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=3ESQmXQZFM8HUugR+y7kuqNvZLR844rwPBdqMRc4GHg=; b=MD/s985U67JRAGE4XjUMo1kDCnx44R//xo5N7NcCMsgalYxjuwZx3InYj6GRi/CFis 1z1NHcjctzAHYiAIv6kdEJDF88CMMY6d418C84OdhzX8NPFDCaHXeCb2L6xIB1U7NuS5 +abUaD5hUkHc1v7+jf42YNWLW7XfhPrvAaWyU= 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=3ESQmXQZFM8HUugR+y7kuqNvZLR844rwPBdqMRc4GHg=; b=eVLM9eLyO7dz7fPEX75kdArZcA4idg4lxFQvTUhh0X15FzKYHk7Ip5PDUIrtvFyCO8 Jr+eSoyWWGf9WOr4l3PocdlJ4usJc8SyeUFowD+K2uYzLyakH2TRgDdHSaXMEA+d5pQk UcNWHd7EsAG+PPKjXbelOwTdnX+UGeY8l0zT1FXlZbL7x7XXZ0AWFQfPBFuKKyHg0Di2 aNcV4Xlv58S/93NS0ruFb2Wnr3LsE2c548lNzmdJ+tpyynTgBbSLAgJhKBiBlJdub3gH Ed1qaNnV+134hMKt1khR9bRdoYDgHVQ3ZgltuugTzePN5UFRpBK+63BlfMdkbnYWCfbO 4Hog== X-Gm-Message-State: AOUpUlGa7GKXHT0skEvJWO+6YMk8KnO79ktwB1t43GmdDh1pPd3f0GlV sXHkhbmSMENknr4h2XPZJF+pzQ== X-Google-Smtp-Source: AA+uWPxzAUwNYf+Vegu8iqqg36S0km4gd5a756a+BMMyMjFirZUBseXWHyhnU9hBErAHnkfBaXmw9A== X-Received: by 2002:a62:2ac8:: with SMTP id q191-v6mr2203566pfq.139.1533817997513; Thu, 09 Aug 2018 05:33:17 -0700 (PDT) Received: from localhost ([45.113.251.134]) by smtp.gmail.com with ESMTPSA id v7-v6sm21878001pgh.57.2018.08.09.05.33.16 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 09 Aug 2018 05:33:16 -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, smohanad@codeaurora.org, andy.gross@linaro.org, dianders@chromium.org, mka@chromium.org, Zhang Rui , linux-pm@vger.kernel.org Subject: [PATCH v1 06/10] thermal: tsens: Add the SROT address map Date: Thu, 9 Aug 2018 18:02:38 +0530 Message-Id: <3759de54da8dac772f43c098fcec322de179c1a4.1533815718.git.amit.kucheria@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: References: In-Reply-To: References: Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP On platforms whose device trees specify two address spaces for TSENS, the second one points to the SROT registers. Initialise the SROT map on those platforms. Signed-off-by: Amit Kucheria Reviewed-by: Matthias Kaehlcke --- drivers/thermal/qcom/tsens-common.c | 14 ++++++++++++-- drivers/thermal/qcom/tsens.h | 1 + 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/drivers/thermal/qcom/tsens-common.c b/drivers/thermal/qcom/tsens-common.c index 0585084630b3..0b8a793f15f4 100644 --- a/drivers/thermal/qcom/tsens-common.c +++ b/drivers/thermal/qcom/tsens-common.c @@ -117,16 +117,26 @@ static const struct regmap_config tsens_config = { int __init init_common(struct tsens_device *tmdev) { - void __iomem *tm_base; + void __iomem *tm_base, *srot_base; struct resource *res; struct platform_device *op = of_find_device_by_node(tmdev->dev->of_node); if (!op) return -EINVAL; - /* The driver only uses the TM register address space for now */ if (op->num_resources > 1) { + /* DT with separate SROT and TM address space */ tmdev->tm_offset = 0; + res = platform_get_resource(op, IORESOURCE_MEM, 1); + srot_base = devm_ioremap_resource(&op->dev, res); + if (IS_ERR(srot_base)) + return PTR_ERR(srot_base); + + tmdev->srot_map = devm_regmap_init_mmio(tmdev->dev, + srot_base, &tsens_config); + if (IS_ERR(tmdev->srot_map)) + return PTR_ERR(tmdev->srot_map); + } else { /* old DTs where SROT and TM were in a contiguous 2K block */ tmdev->tm_offset = 0x1000; diff --git a/drivers/thermal/qcom/tsens.h b/drivers/thermal/qcom/tsens.h index 58e98c4d3a8b..b9c4bcf255fa 100644 --- a/drivers/thermal/qcom/tsens.h +++ b/drivers/thermal/qcom/tsens.h @@ -70,6 +70,7 @@ struct tsens_device { struct device *dev; u32 num_sensors; struct regmap *tm_map; + struct regmap *srot_map; u32 tm_offset; struct tsens_context ctx; const struct tsens_ops *ops; From patchwork Thu Aug 9 12:32:39 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amit Kucheria X-Patchwork-Id: 10561365 X-Patchwork-Delegate: eduardo.valentin@ti.com Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id A2E7213AC for ; Thu, 9 Aug 2018 12:33:23 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 928262A12C for ; Thu, 9 Aug 2018 12:33:23 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 854CE2A543; Thu, 9 Aug 2018 12:33:23 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2480F2A12C for ; Thu, 9 Aug 2018 12:33:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732170AbeHIO6D (ORCPT ); Thu, 9 Aug 2018 10:58:03 -0400 Received: from mail-pf1-f195.google.com ([209.85.210.195]:42362 "EHLO mail-pf1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731130AbeHIO6C (ORCPT ); Thu, 9 Aug 2018 10:58:02 -0400 Received: by mail-pf1-f195.google.com with SMTP id l9-v6so2780883pff.9 for ; Thu, 09 Aug 2018 05:33: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=njW6jAZWOPdw7KJ/kbY+W+hKS572y0dkgyYwoknGJBU=; b=kBj3KSKqdrGbKlEZB8ILVyoVK8wPo4sqH0Ttz37olDY7oM8X97IojsYz+ogQTBqhZ4 pv3pbYSRO5b8h6DWWzDe4oFYlcmpQ+YOlq1IK0PKsTs9YjjkOXnFlOi2IFJw0m6Ha8Am w2Z2T16cRauQxtQDRoQjCYmPqzYfWEY+OX/0o= 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=njW6jAZWOPdw7KJ/kbY+W+hKS572y0dkgyYwoknGJBU=; b=HbKpfPWdgGdUPiLW+4fYF6t2FOwaA42G1lOANiH5Qj4wrRAKmkQmIELofxJ9/I/gN5 HqAihxuk59HjmZ6G3ArS4cLf8px+opvDcXAWFQLnVyxjTqMiVLSI0sL/CWiTXRmjFeNL wf3qzrvApB4XmaeNSwFftkhtg/ofQjaKZ4Hx6N1YBs0fATXpx9FMkS297ZIVW2bZejo8 Z9td4AaXFXup74htZxqAfYPWBiob3TLDAc0yswH7Pu0Ejv4E5wTg7/DCK+29mdlZrKgX mfyVYIp/ABRNnVH+1lEV1TOaNvpTd+7QLyJRU14diYMvu3tULnE+D1M/jvsgmYopdxSX ts0g== X-Gm-Message-State: AOUpUlFD02hAkrq7bw3gqhBmvi9kUE8MeWJJAIM0BwHYtxejyjbJ84Do N9B13slD6Dk5PicyFI15qfVucw== X-Google-Smtp-Source: AA+uWPxTt2J9lAQx2dtwd9kW9yJMcUG4IfXqvnmVcjSWEMHpzqLHcGqUcYb1mP1qbb5mdT+CD+43sA== X-Received: by 2002:a62:1449:: with SMTP id 70-v6mr2234037pfu.222.1533818001059; Thu, 09 Aug 2018 05:33:21 -0700 (PDT) Received: from localhost ([45.113.251.134]) by smtp.gmail.com with ESMTPSA id w192-v6sm7818876pfd.74.2018.08.09.05.33.19 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 09 Aug 2018 05:33:20 -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, smohanad@codeaurora.org, andy.gross@linaro.org, dianders@chromium.org, mka@chromium.org, Zhang Rui , linux-pm@vger.kernel.org Subject: [PATCH v1 07/10] thermal: tsens: Check if the IP is correctly enabled by firmware Date: Thu, 9 Aug 2018 18:02:39 +0530 Message-Id: <985ed415774fdac9ac21afad4b4b74f30f6c5068.1533815718.git.amit.kucheria@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: References: In-Reply-To: References: Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The SROT registers are initialised by the secure firmware at boot. We don't have write access to the registers. Check if the block is enabled before continuing. Signed-off-by: Amit Kucheria Reviewed-by: Matthias Kaehlcke --- drivers/thermal/qcom/tsens-common.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/drivers/thermal/qcom/tsens-common.c b/drivers/thermal/qcom/tsens-common.c index 0b8a793f15f4..d250b757d1f0 100644 --- a/drivers/thermal/qcom/tsens-common.c +++ b/drivers/thermal/qcom/tsens-common.c @@ -12,6 +12,11 @@ #include #include "tsens.h" +/* SROT */ +#define CTRL_OFFSET 0x4 +#define TSENS_EN BIT(0) + +/* TM */ #define STATUS_OFFSET 0x30 #define SN_ADDR_OFFSET 0x4 #define SN_ST_TEMP_MASK 0x3ff @@ -119,6 +124,8 @@ int __init init_common(struct tsens_device *tmdev) { void __iomem *tm_base, *srot_base; struct resource *res; + u32 code; + int ret; struct platform_device *op = of_find_device_by_node(tmdev->dev->of_node); if (!op) @@ -151,5 +158,15 @@ int __init init_common(struct tsens_device *tmdev) if (IS_ERR(tmdev->tm_map)) return PTR_ERR(tmdev->tm_map); + if (tmdev->srot_map) { + ret = regmap_read(tmdev->srot_map, CTRL_OFFSET, &code); + if (ret) + return ret; + if (!(code & TSENS_EN)) { + dev_err(tmdev->dev, "tsens device is not enabled\n"); + return -ENODEV; + } + } + return 0; } From patchwork Thu Aug 9 12:32:40 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amit Kucheria X-Patchwork-Id: 10561369 X-Patchwork-Delegate: eduardo.valentin@ti.com Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 1A0791390 for ; Thu, 9 Aug 2018 12:33:27 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 08D142A12C for ; Thu, 9 Aug 2018 12:33:27 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id F108A2A543; Thu, 9 Aug 2018 12:33:26 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9751A2A12C for ; Thu, 9 Aug 2018 12:33:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732270AbeHIO6G (ORCPT ); Thu, 9 Aug 2018 10:58:06 -0400 Received: from mail-pg1-f195.google.com ([209.85.215.195]:34568 "EHLO mail-pg1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731065AbeHIO6G (ORCPT ); Thu, 9 Aug 2018 10:58:06 -0400 Received: by mail-pg1-f195.google.com with SMTP id y5-v6so2703265pgv.1 for ; Thu, 09 Aug 2018 05:33:24 -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=Gct4lOuxYFWJ5iMbse3TfLVgnZuyuNabzMoHh2gRRuQ=; b=SngJGovQLy8KurtU6+ZIVcvxJ39PFS30jXQoqitXwU65m9c/yrARDeWfwwpnl7Z5HE VrcAh/dNNHLxiz2mdxOhTNKnpCLLEcaGcZDeBsF/IgizgMBqqKFf1ncFtwT3Sh1GDZmL 7knOvcTABQXmO1PSnC7s7LI8MbJWsFwaSG6Ps= 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=Gct4lOuxYFWJ5iMbse3TfLVgnZuyuNabzMoHh2gRRuQ=; b=q/nL89MY7c999RIhfyL8vNXv0xOd+Lm1FBn63J8ED33sqJp9qxdCNaIOf67Q+ejhkA aU2q1Hsc62laR3Iogwo2xcDHFdmWNebQLJd10uS9YEFXtc1MYVV+EZVlf0ANs6XmaoOv oOBuLMfvoRwCfyQ6azh435j9SEHmM4cjI3/RxQIEJQ4Q0F6DzOMF/14TnPjiWPPY1RBU gPuENKCY83AwlDkGl/OpGfUdzveRr4WXsTnv+VxElkRiTRr8OcpWPDcFTCoGcGrrVyO0 ApXdsK8rCQrAODx50wsFvfl6rtxe76/PMsLT5yMblTWCWh8BGH/rp7sceMX/TzijWQaU Z+lw== X-Gm-Message-State: AOUpUlHarx2Ii3XQ7KEhTOIpKGwP1g7jLwxOU1bnKhw+6phm1jCrjZnf cAjyGoMi7RlDTNp/qS4QI+Ijpg== X-Google-Smtp-Source: AA+uWPxl7f9PffgIeKBiuJe7dSIbVHCouAspjmh09C32JFNgZtAKjQiIvRVGHUNqsH7GepOxM5voPA== X-Received: by 2002:a62:5e45:: with SMTP id s66-v6mr2216120pfb.129.1533818004405; Thu, 09 Aug 2018 05:33:24 -0700 (PDT) Received: from localhost ([45.113.251.134]) by smtp.gmail.com with ESMTPSA id n9-v6sm12201171pfg.21.2018.08.09.05.33.23 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 09 Aug 2018 05:33:23 -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, smohanad@codeaurora.org, andy.gross@linaro.org, dianders@chromium.org, mka@chromium.org, Zhang Rui , linux-pm@vger.kernel.org Subject: [PATCH v1 08/10] thermal: tsens: Get rid of 'id' field Date: Thu, 9 Aug 2018 18:02:40 +0530 Message-Id: <3810cbe6b499d265d7e3fb97c408cb80a12d5850.1533815718.git.amit.kucheria@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: References: In-Reply-To: References: Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The hw_id field in 'struct tsens_sensor' can do the job of tracking unique ids for each sensor connected to each tsens device instance. It also allows hw_ids to be overridden (e.g. 8916) in cases where some sensors in a sequence are disabled on a particular platform. Use the hw_id field instead of the id field consistently across the tsens code. While, we're at it, document the fields of struct tsens_sensor. Signed-off-by: Amit Kucheria Reviewed-by: Matthias Kaehlcke --- drivers/thermal/qcom/tsens.c | 5 ++--- drivers/thermal/qcom/tsens.h | 10 +++++++++- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/drivers/thermal/qcom/tsens.c b/drivers/thermal/qcom/tsens.c index 9a8e8f7b4ae1..fb728ec5d77f 100644 --- a/drivers/thermal/qcom/tsens.c +++ b/drivers/thermal/qcom/tsens.c @@ -17,7 +17,7 @@ static int tsens_get_temp(void *data, int *temp) const struct tsens_sensor *s = data; struct tsens_device *tmdev = s->tmdev; - return tmdev->ops->get_temp(tmdev, s->id, temp); + return tmdev->ops->get_temp(tmdev, s->hw_id, temp); } static int tsens_get_trend(void *p, int trip, enum thermal_trend *trend) @@ -26,7 +26,7 @@ static int tsens_get_trend(void *p, int trip, enum thermal_trend *trend) struct tsens_device *tmdev = s->tmdev; if (tmdev->ops->get_trend) - return tmdev->ops->get_trend(tmdev, s->id, trend); + return tmdev->ops->get_trend(tmdev, s->hw_id, trend); return -ENOTSUPP; } @@ -83,7 +83,6 @@ static int tsens_register(struct tsens_device *tmdev) for (i = 0; i < tmdev->num_sensors; i++) { tmdev->sensor[i].tmdev = tmdev; - tmdev->sensor[i].id = i; tzd = devm_thermal_zone_of_sensor_register(tmdev->dev, i, &tmdev->sensor[i], &tsens_of_ops); diff --git a/drivers/thermal/qcom/tsens.h b/drivers/thermal/qcom/tsens.h index b9c4bcf255fa..2a3174dfc1a9 100644 --- a/drivers/thermal/qcom/tsens.h +++ b/drivers/thermal/qcom/tsens.h @@ -14,11 +14,19 @@ struct tsens_device; +/** + * struct tsens_sensor - sensor-specific data + * @tmdev: tsens device instance this sensor is connected to + * @tzd: thermal zone corresponding to this sensor + * @offset: offset from calibration data to convert ADC data to degrees + * @hw_id: unique sensor ID for each sensor connected to tsens device instance + * @slope: slope from calibration data to convert ADC data to degrees + * @status: 8960-specific status register addresses + */ struct tsens_sensor { struct tsens_device *tmdev; struct thermal_zone_device *tzd; int offset; - int id; int hw_id; int slope; u32 status;