Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp1986461imm; Thu, 9 Aug 2018 05:34:29 -0700 (PDT) X-Google-Smtp-Source: AA+uWPw2qgWDAZ0Glp3Pqcz8FlCqFl33mEER/wulASXOiUFFGrp7oAlk6QB3ZYyTNbhvj85YBQYm X-Received: by 2002:a17:902:3081:: with SMTP id v1-v6mr1998523plb.58.1533818069800; Thu, 09 Aug 2018 05:34:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533818069; cv=none; d=google.com; s=arc-20160816; b=lHQu07xzXDIlKLgsWFDB1Z2Hjdx0/dLDb6I6xw7jHhwuPTgAnw3VDetHF6C6+lSGUj ldKKP408yE7uKcX8/z1BfIkDa4itZ5AlzIDvRDRt70qqpGDLn1ugm/JXp52BYW2v7PA7 UCzaHRIHLwiXhQmgrflBx9kqb8pg8AGMIZiwtmSfauz213Oi/LPTgzlvsLPmnulDoEjx chZRElwOD5YgAYmH69Yo7JRSmrBKJoddXDTiVT7S8oUo96exYrmaZrBqkaNLx7QX8SXZ kQQ4F9IZeeVou9tz2YBGCfbby9Vk8ksD8Ok8f00BaeaExMiut89KwWD/gok6hAZkahzH 2GWA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:references :in-reply-to:message-id:date:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=zyKbfUOB0Y9T8bByL2E46QXLNpmRHMe5dD12vKApofY=; b=JTL5enaHfKp/s1xdqew2fHIhbj3Ww7sZfHqKwI10x+AzX5H0zVhdMeqNViYxaUzoG7 nVcMoPu/Omf+OXHkNqtuu89OjmUmasHHLWw/PB/4bA5rddvzOyeZy4TaNLAvIqteZ4f9 iPzf1EuoT5PrIUcPMR8O5VZJf9mAC5fZAGI659GnSm9VECnzEjFLgyP3GWm7mB/jliqL 77JLsMInoHdvvleNozKBwY7+bAgh635DkTCfempPox08/B9m2dk9wuDw93ZkeIxa//1y 9WEMPOV7t/t9+XHtVEoE4ekZ7KlHxiTliKe6FZMLgKga6UaQ45mmM6L+ziQUT4KWTaUA HrTg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="EUbM4/SI"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n7-v6si7032248pfn.241.2018.08.09.05.34.15; Thu, 09 Aug 2018 05:34:29 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="EUbM4/SI"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732006AbeHIO5l (ORCPT + 99 others); Thu, 9 Aug 2018 10:57:41 -0400 Received: from mail-pg1-f194.google.com ([209.85.215.194]:40804 "EHLO mail-pg1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731973AbeHIO5k (ORCPT ); Thu, 9 Aug 2018 10:57:40 -0400 Received: by mail-pg1-f194.google.com with SMTP id x5-v6so2689286pgp.7 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=q4wlZrmmXwnNm+smwj+nIY6sBDtq4jWrEu+cIUt9Y0u0Z6hJgbKIeGKF8AGvOFT8cd B+BCrpe6mxHjTymf/ZYMn1LqhuFXrtLKzK9q7PP+HhKtMQ2Qf6YIBeKGI4cPHmfGIYum CX/ZRg/WyEHQlxWD8OlyUByWAilj9VF6Ip7+QgPo8YUd1nWbVxJadrC6vaCp6RXCgPCs EIQlRoRDltANzgb/OiT1exExz5lZQqNBTe/IFUTbjPOnrm2PXOeUYrPN3il/qrHyrhiT zsj4IUPOqr8YAxwkKhH5nU6AuIEEkkC3z+Hp7U94BrwFdxssULha2rRnDGGBUkySxETm y+sA== X-Gm-Message-State: AOUpUlFzxuoJQBMSVX8eABPpVr+d78m3t018OCTaoV41q/VmNZJwvnKW A9V2RN9BqSfQVfDp0LBdRtbNTuN8giA= 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-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- 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; -- 2.17.1