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: 10561349 X-Patchwork-Delegate: agross@codeaurora.org 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 12BB113AC for ; Thu, 9 Aug 2018 12:33:02 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F3B182624C for ; Thu, 9 Aug 2018 12:33:01 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E78D02787C; Thu, 9 Aug 2018 12:33:01 +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=-7.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI,T_DKIM_INVALID 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 75FA02624C for ; Thu, 9 Aug 2018 12:33:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731985AbeHIO5l (ORCPT ); Thu, 9 Aug 2018 10:57:41 -0400 Received: from mail-pg1-f196.google.com ([209.85.215.196]:44544 "EHLO mail-pg1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731969AbeHIO5k (ORCPT ); Thu, 9 Aug 2018 10:57:40 -0400 Received: by mail-pg1-f196.google.com with SMTP id r1-v6so2681938pgp.11 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=a/Hnb4PRRj+BlGWhNP6nwvwWgGjBOHQ5A3SnybalO0kWrtU10q6PdnNB1SsW2km2cD wS/gLPIir8Z7mKw/uL80VMTvVpv+4GH3wkM4cx0TSgCB8haopQhR+ul6R6pUBNmEhtDq n/97G6HmwMc+9g4ybh4RprMwgwRjjFnH7RhexiEwC6Pr+xLEW0z7IpvLOLmDx1obdz8M TW5E6jM8Qsd9E34SzDqHaYLKcBFVqwNAWVdc8GvqfP9DUBU3oKGeCcOjk/GGLFSlO7Fo 0zzyxEmkj2qsML9KJm4Gazg2ZpG3jpfVYg8qs4dEiBnpnvg1a+FWeam3fRu+H0VusbkO A6Dg== X-Gm-Message-State: AOUpUlEfytLtKvxLlCspy/3uQQHKJmtXdywlXbJNBBzlaHRMri6P65V9 2fb3A0E6pCNH/JfFbGDqTT8dtw== 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-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@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: 10561383 X-Patchwork-Delegate: agross@codeaurora.org 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 CF10A1390 for ; Thu, 9 Aug 2018 12:34:04 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B9CF12A543 for ; Thu, 9 Aug 2018 12:34:04 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id AD7212A628; 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=-7.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI,T_DKIM_INVALID 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 51DFB2A543 for ; Thu, 9 Aug 2018 12:34:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732066AbeHIO5p (ORCPT ); Thu, 9 Aug 2018 10:57:45 -0400 Received: from mail-pf1-f193.google.com ([209.85.210.193]:36394 "EHLO mail-pf1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731193AbeHIO5o (ORCPT ); Thu, 9 Aug 2018 10:57:44 -0400 Received: by mail-pf1-f193.google.com with SMTP id b11-v6so2796677pfo.3 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=dmFyRC0UJJctBzJSzfuAb9hW3kVQOKEvrcvtfyqMFg6ZNalLrZQ0ifPs0/qkx6lQ8X 7aOmids7Xtkja7DmKNpl669d3F/HUad5d0Pgk5JwoZUDavaKiFOUx2bfMjVYsh6TvhQ+ 7IkVAhY1sqqOuYxvxffcrXz8sQpBpxHq8is/rEMJwzhhXKrWrgcE/6CkxEPxN3R6kGDM s+2zE04jEwLVGedWlIf4TyPwwhw6ewqVIb4uxKoFP8wthgopDSjb8M/f3JGenDeXq6UD xEdMy9BRoapQ/ugUe3wzR2+W5ito1iM21EnblqXhENJQAMPm8ZccrH2ktuLqEBn3umhu sWpA== X-Gm-Message-State: AOUpUlEd06Zy5uPLXmGd7A3+J5+YE/GnOZY2bTqucEQ48xhRNI0ppp06 Oc8MQP9smOPavrTaAo1v3UZMIQ== 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-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@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: 10561351 X-Patchwork-Delegate: agross@codeaurora.org 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 387971390 for ; Thu, 9 Aug 2018 12:33:11 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 26E0C2624C for ; Thu, 9 Aug 2018 12:33:11 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1A3552787C; Thu, 9 Aug 2018 12:33:11 +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=-7.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI,T_DKIM_INVALID 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 81D132624C for ; Thu, 9 Aug 2018 12:33:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732130AbeHIO5t (ORCPT ); Thu, 9 Aug 2018 10:57:49 -0400 Received: from mail-pf1-f196.google.com ([209.85.210.196]:34566 "EHLO mail-pf1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732094AbeHIO5s (ORCPT ); Thu, 9 Aug 2018 10:57:48 -0400 Received: by mail-pf1-f196.google.com with SMTP id k19-v6so2802549pfi.1 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=rCwXp/6uKT/OgwCLMcSOWYTncXmnCyAavmfEQjkm9Z2VTjvjSxpvXW6eY/FC9tk4Df MKD2+jdUuYl9a7oIlLpsj97L/3e+PzsSJ05ctRF/7WMXeJmo/u6K0UMPP65zr03fbHuG Gl8jJ1VV50YaPlspST+P3aZHP4JBy3RCCtLfcs3kQNgazmVwuO1LvZ815F1t8n4USjg3 Jggak8+eG1EJAbLSOo0dPWcN6NawdBwSlFG2XjSYad4lDaxrpwGOrCtCKh60SMQ7CQhU lli/KSXC/aQjEWxXl35jyyhUOVSI7ozG5KzT6j2EnZ+lPAJ/TOCkkAIulyUNNrMS4Uc/ y9pw== X-Gm-Message-State: AOUpUlFtRbiIQPA4lqn9uC/TRRH4CocRdc+UyGN37t1DDSmgQzT8IbMl g70d7SkfDTZ0f2dhBomwLiDAPA== 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-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@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: 10561355 X-Patchwork-Delegate: agross@codeaurora.org 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 6618B157B 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 5488C26538 for ; Thu, 9 Aug 2018 12:33:13 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 488102624C; 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=-7.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI,T_DKIM_INVALID 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 F16E326538 for ; Thu, 9 Aug 2018 12:33:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732138AbeHIO5w (ORCPT ); Thu, 9 Aug 2018 10:57:52 -0400 Received: from mail-pg1-f193.google.com ([209.85.215.193]:37772 "EHLO mail-pg1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732135AbeHIO5v (ORCPT ); Thu, 9 Aug 2018 10:57:51 -0400 Received: by mail-pg1-f193.google.com with SMTP id n7-v6so2697974pgq.4 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=rTIxuVaCAs5jRLFhWL/EvCj9CSdL138oBOXDxUkpJQGSNSkCMbee/LQ+HossiPT02p CbgRnqf1/CfBlXEmSZ4+kK2jS3xsYRvfsfHnXgh/twxcsdxnSk8aeorcIZkF8Q2cDwBn 1gMuoJhzvi2ksQrnPXBq5Z+RCmF9rjXzbyndYDdeAoA8nfHRclxG6PK7GrGRUVIoCUVU vBxr09EWlsv09Wc2zR1k+q2RUHvzURjdT+jIqoakc7H2/ScLXjbbz/d6fLrw1vk1qP6b HYDo2L1FW8Q7Cax8dSgxgmQ1Hl5VBDfhGIi5AL1LG5bxAQwPROPbQ/UD/JYZGlsVpkhm QB9Q== X-Gm-Message-State: AOUpUlFnoQncp/4ov5fmWMdUmRiyWM318gyJ1hl/gYcCfH/UY0B5E92+ qiMw1/ZiMfHgGTCRDermpygAuA== 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-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@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: 10561359 X-Patchwork-Delegate: agross@codeaurora.org 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 2E9BA13AC 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 1C59F2624C for ; Thu, 9 Aug 2018 12:33:17 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 10A6C27968; 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=-7.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI,T_DKIM_INVALID 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 596582624C for ; Thu, 9 Aug 2018 12:33:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732173AbeHIO54 (ORCPT ); Thu, 9 Aug 2018 10:57:56 -0400 Received: from mail-pg1-f196.google.com ([209.85.215.196]:37781 "EHLO mail-pg1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732169AbeHIO5z (ORCPT ); Thu, 9 Aug 2018 10:57:55 -0400 Received: by mail-pg1-f196.google.com with SMTP id n7-v6so2698054pgq.4 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=IyaIXV4u+Lrj+yFbL+qHFhzwVlf9ZsymX6L6RYjzYK3UuYYTwDwVUYcP/Rl6vhjYb6 xp1lvjw5D0Se148jIfPNF5GTs2+5d64FM2lCVv/Cd9h23K64+ctOB88xWomme3/bwl8U 78RNgqNj4IWWBzsOYPPjk5zWJLOwB2vJy1WUVcz8InPBwbmMblBs3joilEjVXXoUwbp7 KnKPjUJxrTrTZd2UG0UkWpXQD8FOZn66EuQDUjuvX9aW4BWax9KHN6jBVusTXt8XLeoD Z1VSGB8767sOi3fHAAH30b4k8vAOIem52dN7ZJ6jo/3gZM+GvmyylJdB49zarqeovaM1 xuQQ== X-Gm-Message-State: AOUpUlHhNQk2+UWQj/kHATI6JwH1lgFih82iRLDjfeJTB0C4MN/xAXId 2XkSfTWchNYmfsoGAl0SpVXCKw== 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-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@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: 10561363 X-Patchwork-Delegate: agross@codeaurora.org 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 AA3CD1390 for ; Thu, 9 Aug 2018 12:33:20 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 989B72624C for ; Thu, 9 Aug 2018 12:33:20 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8D24E2787C; Thu, 9 Aug 2018 12:33:20 +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=-7.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI,T_DKIM_INVALID 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 37D102624C for ; Thu, 9 Aug 2018 12:33:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732203AbeHIO6A (ORCPT ); Thu, 9 Aug 2018 10:58:00 -0400 Received: from mail-pg1-f196.google.com ([209.85.215.196]:33727 "EHLO mail-pg1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732100AbeHIO57 (ORCPT ); Thu, 9 Aug 2018 10:57:59 -0400 Received: by mail-pg1-f196.google.com with SMTP id r5-v6so2705235pgv.0 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=Bc3az5DlOHp46k8clmhNv8hb9XHydtgYDJ6HAU2TDKdH8ItUWP1nkQEILj86BZkTY3 L3bEUQ73J9b3eWKecmKyC/fmvx1qgCb1I0xlx9O8ebwS7qGqz+FMcUt6ioMxbNJqh38t 91w1fKmXm42A0X/bGglVOhAiH3Vuusod5wZY4ZRUQxmQ8kVIpRttuMxZukdEMGb+DwSd G9B0hJiNDt3zx7ofR0y0hlP0zJoXqyIU/Fx6XDkz0ordnoUWc+JE0cSRJicI9Hn3si9d 0Qcxt/0Hs2xYvWrlbVO3f6gf6voCenKFnasCu6qZhgIeuOVJP2Qnk+o/s3HnM9o4poUc j3Pw== X-Gm-Message-State: AOUpUlFP6AN+dLT9B68C16mi3yoDvOtxO0JDDqjYR1snfNGGM5U/3r9g nhmiphUbhIreP1u+tw6l2u3Hkw== 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-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@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: 10561367 X-Patchwork-Delegate: agross@codeaurora.org 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 E965A157B 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 D757C2A12C for ; Thu, 9 Aug 2018 12:33:23 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C9D982A507; 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=-7.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI,T_DKIM_INVALID 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 6F78D2A1A7 for ; Thu, 9 Aug 2018 12:33:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732237AbeHIO6C (ORCPT ); Thu, 9 Aug 2018 10:58:02 -0400 Received: from mail-pf1-f193.google.com ([209.85.210.193]:41553 "EHLO mail-pf1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732170AbeHIO6C (ORCPT ); Thu, 9 Aug 2018 10:58:02 -0400 Received: by mail-pf1-f193.google.com with SMTP id y10-v6so2785464pfn.8 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=s7FK9AHew2kzU0COro9TflWxd9RKIr4V2oZ34vcJnqdGCJJdrR4CAAXfn6Iq3eEx7Z zasHsNb7fWOZRUItbt+jwZKoIiHLh3Id8Cyb3v6eMlA+AQycgr22HbPMjBIQ/zyI99hz 5cEIhcWDzTH7cLNKWWGKntcIuZ9Rvry1S4zyskzfapn4ihPfEKyQIHsvj9wjHdUaeIYm VufRFK7nweYR3fR27C3JzO36BjFQHRHBnqTBLYoxrb6aLiIPgr4iPEfvvLH2Qw4BMolA 7X4FRaM8XuqS2YD8kZ/4ToDnwtplVXeu72Kz8imDaurPZwRK+fB7pdqnAbmx/eIIiXYT 5PWw== X-Gm-Message-State: AOUpUlHeUy7jdwDLxusvFQbRyAUua7qG8p8Abt9gNN+FJjl09aMzl7HX 2ZIi7WWmwd7+KbBq72AgIEVKkA== 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-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@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: 10561371 X-Patchwork-Delegate: agross@codeaurora.org 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 66062157B 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 543CC2A12C for ; Thu, 9 Aug 2018 12:33:27 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 488982A507; Thu, 9 Aug 2018 12:33:27 +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=-7.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI,T_DKIM_INVALID 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 EA2AA2A1A7 for ; Thu, 9 Aug 2018 12:33:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731065AbeHIO6G (ORCPT ); Thu, 9 Aug 2018 10:58:06 -0400 Received: from mail-pg1-f193.google.com ([209.85.215.193]:36349 "EHLO mail-pg1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732236AbeHIO6G (ORCPT ); Thu, 9 Aug 2018 10:58:06 -0400 Received: by mail-pg1-f193.google.com with SMTP id h12-v6so2700771pgs.3 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=AJd498YRn/S4nkNOwlwj8/1dr/HVEN5RGDbqFAoKo3O7jkKH+rrjaLobsQ4PB/kLng vp5am/tfJ9g+i5Qjz0g13pGeDMGyOf4hGWFPnZoVUkvSUbzCZu/op4Ki04cPFam1VHeK BKZ9GvAxaPfs8CpOZKJX2TID4J1NbXHTR5+Y9vSFsddqCQTXN8DTjXaEFR/h9fanQrSE Q5S0YxzU87Ap/QRlwbFaaFAtzTRgok/qqxpNklJKLepsUGoLZxFvjhMzYl4vHOVkaFv6 0bjH9EVWMbmzbX5L9ThuBrqbjOtHJU9RCalJ4pkG85vd5ugHKzYFpa8Mz9d+NE2d0XsX uuVw== X-Gm-Message-State: AOUpUlFp/cjoS5Ooma3lwGAfarstblDkRaSKbrDpIpFm8X8YU/DuLsDg Y4OdcHFdOi4xlNN8COK0whgzBQ== 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-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@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; From patchwork Thu Aug 9 12:32:41 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amit Kucheria X-Patchwork-Id: 10561375 X-Patchwork-Delegate: agross@codeaurora.org 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 C0AB413AC for ; Thu, 9 Aug 2018 12:33:31 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A937B2A12C for ; Thu, 9 Aug 2018 12:33:31 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9C7912A543; Thu, 9 Aug 2018 12:33:31 +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=-7.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI,T_DKIM_INVALID 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 285B92A12C for ; Thu, 9 Aug 2018 12:33:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732299AbeHIO6K (ORCPT ); Thu, 9 Aug 2018 10:58:10 -0400 Received: from mail-pl0-f67.google.com ([209.85.160.67]:37036 "EHLO mail-pl0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732298AbeHIO6J (ORCPT ); Thu, 9 Aug 2018 10:58:09 -0400 Received: by mail-pl0-f67.google.com with SMTP id d5-v6so2513857pll.4 for ; Thu, 09 Aug 2018 05:33:28 -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=P+8ZtXuBWeWo7/benGwezLj8nb3RsvbE1i3tK4LtIoc=; b=NCR4i49BGPwZ1Q345daLUuAdEIFBSZxRMTGevcSNH4M3yoq7mZWk1n9NIZLDrs/2pi vC2bPFG7w/ew0jpC+2tofjKhi6NBX4okIct1aSQNuTaI6WHRiPp+SyDd7ABFVZazN66Z bAXyvpQ74ya1J7OyLCOVh1J8z3c//t00wJiQg= 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=P+8ZtXuBWeWo7/benGwezLj8nb3RsvbE1i3tK4LtIoc=; b=KB9e8RXjZl82QDr3avtxpzMhm/Mq+pa7T7dw+qRUnuL27XfZ8BiDvyjYEwKathLcbt 0wjw56L+Wcd7A4DY0bNu4Q4m9SLYx63yDwrMBRZmDhpRTMT/MAmYfk80UYOuMKrLc8tj zpisr/4jNbLJUvtCU7ZkP4LHTl2i0kraF6hlaECszf+GWjkNIA+CqTkFpkQVo83sqAPJ 5kN27+LZL2hHWH5WQjrmSeDR3UAHbz51lTjZIXmecVnbCylwXQOPyuu6YTa+2Ec8Dx0J nc0o15PzBUFz8Fz5LcZ8odWSt0kbTRVYjFk2mKTGy9Q+mgk8eAkHdBD5jjnSqsyaso5U Yncg== X-Gm-Message-State: AOUpUlE0/MDIl2Q2VeEMteU1nwcE9cubfvQFmJJU2xtJlZBMMrCZxNjx nMSl5JRq0l/cLkgF7JIXzo9ziw== X-Google-Smtp-Source: AA+uWPygMCHE5JmIkTKVtQd6NnfXQJX7K8kxxw5k5vpscXyu5R9508aKzMEOoHPRsXEIt4uWIenY7w== X-Received: by 2002:a17:902:2ac3:: with SMTP id j61-v6mr1913890plb.172.1533818007813; Thu, 09 Aug 2018 05:33:27 -0700 (PDT) Received: from localhost ([45.113.251.134]) by smtp.gmail.com with ESMTPSA id f65-v6sm23210298pfj.46.2018.08.09.05.33.26 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 09 Aug 2018 05:33:27 -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 , linux-soc@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH v1 09/10] arm64: dts: qcom: Add reg-names for all tsens nodes Date: Thu, 9 Aug 2018 18:02:41 +0530 Message-Id: <188c07144d98bfbe2bbbb7d1f2941acdcf4e6682.1533815718.git.amit.kucheria@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: References: In-Reply-To: References: Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Instead of showing up as thermal-sensor@, the nodes will show up as tsens0_tm, tsen1_tm, tsens1_srot, etc. in /proc/iomem making it easier to read. IOW, 0c222000-0c2221fe : thermal-sensor@c263000 0c223000-0c2231fe : thermal-sensor@c265000 0c263000-0c2631fe : thermal-sensor@c263000 0c265000-0c2651fe : thermal-sensor@c265000 becomes 0c222000-0c2221fe : tsens0_srot 0c223000-0c2231fe : tsens1_srot 0c263000-0c2631fe : tsens0_tm 0c265000-0c2651fe : tsens1_tm Signed-off-by: Amit Kucheria Reviewed-by: Matthias Kaehlcke --- arch/arm/boot/dts/qcom-msm8974.dtsi | 1 + arch/arm64/boot/dts/qcom/msm8916.dtsi | 1 + arch/arm64/boot/dts/qcom/msm8996.dtsi | 2 ++ arch/arm64/boot/dts/qcom/sdm845.dtsi | 2 ++ 4 files changed, 6 insertions(+) diff --git a/arch/arm/boot/dts/qcom-msm8974.dtsi b/arch/arm/boot/dts/qcom-msm8974.dtsi index 3c4b81c29798..64c9f81ddd90 100644 --- a/arch/arm/boot/dts/qcom-msm8974.dtsi +++ b/arch/arm/boot/dts/qcom-msm8974.dtsi @@ -431,6 +431,7 @@ compatible = "qcom,msm8974-tsens"; reg = <0xfc4a9000 0x1000>, /* TM */ <0xfc4a8000 0x1000>; /* SROT */ + reg-names = "tsens_tm", "tsens_srot"; nvmem-cells = <&tsens_calib>, <&tsens_backup>; nvmem-cell-names = "calib", "calib_backup"; #qcom,sensors = <11>; diff --git a/arch/arm64/boot/dts/qcom/msm8916.dtsi b/arch/arm64/boot/dts/qcom/msm8916.dtsi index abf84df5a7bc..4e6a5e462a91 100644 --- a/arch/arm64/boot/dts/qcom/msm8916.dtsi +++ b/arch/arm64/boot/dts/qcom/msm8916.dtsi @@ -778,6 +778,7 @@ compatible = "qcom,msm8916-tsens"; reg = <0x4a9000 0x1000>, /* TM */ <0x4a8000 0x1000>; /* SROT */ + reg-names = "tsens_tm", "tsens_srot"; nvmem-cells = <&tsens_caldata>, <&tsens_calsel>; nvmem-cell-names = "calib", "calib_sel"; #qcom,sensors = <5>; diff --git a/arch/arm64/boot/dts/qcom/msm8996.dtsi b/arch/arm64/boot/dts/qcom/msm8996.dtsi index c2dca3a30091..7e5982daa2ed 100644 --- a/arch/arm64/boot/dts/qcom/msm8996.dtsi +++ b/arch/arm64/boot/dts/qcom/msm8996.dtsi @@ -969,6 +969,7 @@ compatible = "qcom,msm8996-tsens"; reg = <0x4a9000 0x1000>, /* TM */ <0x4a8000 0x1000>; /* SROT */ + reg-names = "tsens0_tm", "tsens0_srot"; #qcom,sensors = <13>; #thermal-sensor-cells = <1>; }; @@ -977,6 +978,7 @@ compatible = "qcom,msm8996-tsens"; reg = <0x4ad000 0x1000>, /* TM */ <0x4ac000 0x1000>; /* SROT */ + reg-names = "tsens1_tm", "tsens1_srot"; #qcom,sensors = <8>; #thermal-sensor-cells = <1>; }; diff --git a/arch/arm64/boot/dts/qcom/sdm845.dtsi b/arch/arm64/boot/dts/qcom/sdm845.dtsi index f722785df26b..efd5d7abd1cd 100644 --- a/arch/arm64/boot/dts/qcom/sdm845.dtsi +++ b/arch/arm64/boot/dts/qcom/sdm845.dtsi @@ -1531,6 +1531,7 @@ compatible = "qcom,sdm845-tsens", "qcom,tsens-v2"; reg = <0xc263000 0x1ff>, /* TM */ <0xc222000 0x1ff>; /* SROT */ + reg-names = "tsens0_tm", "tsens0_srot"; #qcom,sensors = <13>; #thermal-sensor-cells = <1>; }; @@ -1539,6 +1540,7 @@ compatible = "qcom,sdm845-tsens", "qcom,tsens-v2"; reg = <0xc265000 0x1ff>, /* TM */ <0xc223000 0x1ff>; /* SROT */ + reg-names = "tsens1_tm", "tsens1_srot"; #qcom,sensors = <8>; #thermal-sensor-cells = <1>; }; From patchwork Thu Aug 9 12:32:42 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amit Kucheria X-Patchwork-Id: 10561377 X-Patchwork-Delegate: agross@codeaurora.org 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 A778E1390 for ; Thu, 9 Aug 2018 12:33:43 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 956A22A543 for ; Thu, 9 Aug 2018 12:33:43 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 898662A557; Thu, 9 Aug 2018 12:33:43 +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=-7.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI,T_DKIM_INVALID 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 3BBF12A543 for ; Thu, 9 Aug 2018 12:33:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730839AbeHIO6X (ORCPT ); Thu, 9 Aug 2018 10:58:23 -0400 Received: from mail-pf1-f196.google.com ([209.85.210.196]:45187 "EHLO mail-pf1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731107AbeHIO6W (ORCPT ); Thu, 9 Aug 2018 10:58:22 -0400 Received: by mail-pf1-f196.google.com with SMTP id i26-v6so2777486pfo.12 for ; Thu, 09 Aug 2018 05:33:41 -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=sAJYfB7jNZkf4AcG1guaAuxl2U8HLNfaRN6C5i+mEB0=; b=Ss8H5pcerWFK5si4ToA9s7qHqAGD/RE97Mt1Wk4W+GvRcsNTKCUn0jdD0awEKgM8/+ ie9LhbJ4cCEF7KIEt1o98gfYTML2AUlOzYoXk6eBeTOQncND9MLgUBDIZK/vuhbZ3L8R cB3ttsk9yKkUsoRL7+2BKIaNeTmqyWcMtIi38= 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=sAJYfB7jNZkf4AcG1guaAuxl2U8HLNfaRN6C5i+mEB0=; b=qj6arTlUsiHUT2Rfne88Ea4opNLtKtbE6CiI1VThW/OQNHklWyTRWF9IMWAuMabypU 15g2rWBoj0dApDGT2oshN2UfR9Iijph5QP8CRdV52H3JA5feG5QiY7zKmL2v+JQTskuS KsjEQrtoLqr+xiAYYIgGmwE9WJoCeBWYfYvbDRq8o1x0IwmvprZTyzChIcc83B4TuCh7 a8s9wTIdO31ej2DBniQAUjSPlyyW1gwj0PBM31r+4kN/gncvJa/p/1YTVeTiwyjUnRol PVwEfPKmcxehU9jS01hfVS1uB/8dbqTW8YQ3249mbRsCR9mstvznq4SmDh3q2/4nqk50 VAPw== X-Gm-Message-State: AOUpUlHoEgEA3y4YmeGlz71V9h5XJnxBAD2YHOpgJr74AcPIh9u4InXH Aosan7nYN+aOwuCElz2O15Y9Hg== X-Google-Smtp-Source: AA+uWPzOAktDB7iTvMGyLirkA0uZOj3hPQHRnAuskry1koC7iu2jqqZfoUZ2KLwduc3SycqUuX0MuQ== X-Received: by 2002:a62:21cc:: with SMTP id o73-v6mr2228004pfj.21.1533818021023; Thu, 09 Aug 2018 05:33:41 -0700 (PDT) Received: from localhost ([45.113.251.134]) by smtp.gmail.com with ESMTPSA id 22-v6sm12853108pfl.126.2018.08.09.05.33.39 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 09 Aug 2018 05:33:40 -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 S. Miller" , Mauro Carvalho Chehab , Greg Kroah-Hartman , Andrew Morton , Arnd Bergmann Subject: [PATCH v1 10/10] MAINTAINERS: Add entry for Qualcomm TSENS thermal drivers Date: Thu, 9 Aug 2018 18:02:42 +0530 Message-Id: <106a459af3882745e78cb9b774dcfda08a96a6dd.1533815718.git.amit.kucheria@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: References: In-Reply-To: References: Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Create an entry for the TSENS drivers and mark them as maintained Signed-off-by: Amit Kucheria Reviewed-by: Matthias Kaehlcke Acked-by: Rajendra Nayak --- MAINTAINERS | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/MAINTAINERS b/MAINTAINERS index 68b4ff8ed205..ca6183d6d545 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -11862,6 +11862,13 @@ L: linux-arm-msm@vger.kernel.org S: Maintained F: drivers/iommu/qcom_iommu.c +QUALCOMM TSENS THERMAL DRIVER +M: Amit Kucheria +L: linux-pm@vger.kernel.org +L: linux-arm-msm@vger.kernel.org +S: Maintained +F: drivers/thermal/qcom/ + QUALCOMM VENUS VIDEO ACCELERATOR DRIVER M: Stanimir Varbanov L: linux-media@vger.kernel.org