From patchwork Tue Aug 28 13:38: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: 145324 Delivered-To: patch@linaro.org Received: by 2002:a2e:1648:0:0:0:0:0 with SMTP id 8-v6csp1204246ljw; Tue, 28 Aug 2018 06:39:40 -0700 (PDT) X-Google-Smtp-Source: ANB0VdYn5qkrHLCVdBIVV1pbvATZf+0ZhpZelg/uiLgCRNX9lptvaH3zf9lVzIfbeyiKJa7vrT5E X-Received: by 2002:a63:f80a:: with SMTP id n10-v6mr1631200pgh.82.1535463580075; Tue, 28 Aug 2018 06:39:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1535463580; cv=none; d=google.com; s=arc-20160816; b=Zd+iayqe2Ymfr6o6F0xsgwyH0JDlVy7MgrOj1jOtGqR5Lr3j0msb2/RlpkY7BCDxrj S/3y65BxD4RYWyD3D53/OtgH0FwTJr+6riF0vFXIAxZT4YAeJ9epJxFyTpUL5Gkxsb/3 tvciP0e+rCoJWO2JQSAmH3Tn1bKX01qt501mNYZZ3XLsdh++5uqbByVVv/FofLZlWVvU oHiUnR2dBmVouxVtMGKPtDK9LcqBqY0iKj1EerhOHLNGklhrhvmfdNjLOF3kXa+I2UOx /e+AnJ4bZsuRGyXgGYgBM4OwPYCyBOEG/nenz6oWyj0qTD/NB5UBymt2N+KyF1oL6DUM yw/Q== 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=oeW4RqD9YtS5LZxw4vdI84WXKgqnp4V7aomxkAAem2w=; b=fsfDfUhuqGmpcl5CXh4gnVjfO6JXr3om3F6Ta+KRItlAyGhnizseO1pHeJZUs/wyfC RCtYjGZDsmDBKNH8bM68JWd1lvnyOiTl2SzHOke4QEtB3kaNs5yX9CExNboeweD+2Ugd yQKtQVvXkSUy7vLif2atGYbe3EsMWMNwAEzT4TqnDbHjG1RNQTTIkBbWBGpQykFXmjLq EFYUs4GNh7FIA5Jy8XqU2+YwJS0Tm9agSGTz19ekunGUZhsNWTBKHsRzuD/2Kv7SsTDD JcVBXN53ZglBc8mGTDh2bAcRiox7qirJ+bODBOJ0ICxCup59GW7t2sVsSk27Av6CBzAJ SxYg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=V8XdWfoo; spf=pass (google.com: best guess record for domain of linux-pm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-pm-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 l26-v6si1035052pfj.188.2018.08.28.06.39.39; Tue, 28 Aug 2018 06:39:40 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-pm-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=V8XdWfoo; spf=pass (google.com: best guess record for domain of linux-pm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-pm-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 S1728153AbeH1RbU (ORCPT + 10 others); Tue, 28 Aug 2018 13:31:20 -0400 Received: from mail-ed1-f66.google.com ([209.85.208.66]:43821 "EHLO mail-ed1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727273AbeH1RbU (ORCPT ); Tue, 28 Aug 2018 13:31:20 -0400 Received: by mail-ed1-f66.google.com with SMTP id z27-v6so1389728edb.10 for ; Tue, 28 Aug 2018 06:39:37 -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=oeW4RqD9YtS5LZxw4vdI84WXKgqnp4V7aomxkAAem2w=; b=V8XdWfooyN8xVF8PULrA9GGkYKytBKytVxeDi2VHGLuUR428z8Vq3Z3xskUYiKAtcU fbkfZ4SpWaLrgR6kQs27ZlB8PshdntUbv4/UF9PVGB5EFxkplq7ZDOId3ZfLFOLkvz9K kAGBAoDreYzptRokjRHUTghLmmcBTtX3uoEfc= 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=oeW4RqD9YtS5LZxw4vdI84WXKgqnp4V7aomxkAAem2w=; b=SbRXNuQrLJdpTaqFuYyVMdQP1aFGjgrj4QpdPjyM75TwQPlm7REa2Vubl/Lb0x//QZ 8zz42yTkdv1Hqq5A/QC9T2GWkzbDgrHjgJVJCMfkM++7uh3dStmueqTYFjrYChMoDW5y 1jk/XBiVH2/e/lpYotUntjvtpRJvocJT7hZEpgWE54WGPalYULzg7kwG4Y4gXnF66b6L QiVaduZqRa6K8Dqm37kDFsQUBoK3uqlnO3+hDZqFCCW5OQ0hzDBT5fi9OMKEZFgJPfJO C5k0sGS4XEVNtkk+6smMunXJOOgJBLKTIYLG/5r5VMZrIQyImsah9FrtRteg81aBj6Bu 6RvA== X-Gm-Message-State: APzg51BUhTTKJkSi/6nIXEl9fuYZm9wI/iW1mA5wuenGguLEYHkRpvrO WMLL582GjoUUJ3l2ZYY3L2CaLg== X-Received: by 2002:a50:b799:: with SMTP id h25-v6mr2501293ede.297.1535463576416; Tue, 28 Aug 2018 06:39:36 -0700 (PDT) Received: from localhost ([49.248.200.109]) by smtp.gmail.com with ESMTPSA id a33-v6sm648763eda.2.2018.08.28.06.39.34 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 28 Aug 2018 06:39:35 -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 , Daniel Lezcano , linux-pm@vger.kernel.org Subject: [PATCH v2 06/11] thermal: tsens: Rename map field in order to add a second address map Date: Tue, 28 Aug 2018 19:08:35 +0530 Message-Id: <9dd785eb1292e80e3ac4b52e1e4da431774c2211.1535462942.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 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(-) -- 2.17.1 Reviewed-by: Bjorn Andersson 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 Tue Aug 28 13:38: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: 145325 Delivered-To: patch@linaro.org Received: by 2002:a2e:1648:0:0:0:0:0 with SMTP id 8-v6csp1204355ljw; Tue, 28 Aug 2018 06:39:46 -0700 (PDT) X-Google-Smtp-Source: ANB0VdYSHNMZqamfrMFRxKEtubu7nVugfuSEfNiZAO/rHPmHIb/L+X/4cD5CzbNfv63oJ4niMPq1 X-Received: by 2002:a17:902:bd95:: with SMTP id q21-v6mr443775pls.284.1535463585903; Tue, 28 Aug 2018 06:39:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1535463585; cv=none; d=google.com; s=arc-20160816; b=t2Kdnhrh36Yzrr59BjiJhUwEcucwuQ5NfZtV0kYn9P5s697Zr4U1jaolhSJMNH6Zs5 J/O4cqNU499/m3Hzwj0mhzfUKtRjaMKcXBW77DL0Gu0GAk/32TxOz2RDgpToG9UQZOSm By5aM56a/hoGbnauPsjHOslEivtyqxa/cM9yt4Auhy8H9Oq5xTcZGgsEy3VZFo940kTz PnNgxp7glr9DTo6DPp2OBDJrf+CMGIyZ1rs4mZhn9H/AKffITyEWF/g9KrYjpHJPcwhy dswNqyRLRzb/9hj5HRJWOPCHJAZjPuMKZkvvbGFQF0rqJg/sN3ECXF5DEpvSszllnIvt pr/A== 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=Qc/vEh/hM8XwepQBATbsK+sfjDGVHNzidZ0MvqTnDnY=; b=H89hqQxKRu4hRuCCyjzNXR3bJx2G4WnruajF1Hfbq5/zB8CsVdrMPRUsI7Ox2QBV2O GzNg+BFchzy+SRK2X5ZsjvcHLx7Eyavlif1A2F8odIoBhUeHt9g4jxyB9moVkdNFjcK3 hpT/MXGFFrjCJ76juBTkmR4LJBnVWdK09k1DXRAG9AnWzrds3nwN5DBP+bMb0ER8ZrC2 cBmmTye/Ut83BVgoZr78NRRgwbbovvipdUSRdnb3SMtY6RdwkjQM/0FQTtCL7drzIfad I53OfSiGthftYR04L1vWau1Zqs0h4CY5u16QyJcKnJj5lugCAAJdcHyZ/ocTgIJ8mZUB t3hw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=XDgnm6dP; spf=pass (google.com: best guess record for domain of linux-pm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-pm-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 u42-v6si1142103pgn.86.2018.08.28.06.39.45; Tue, 28 Aug 2018 06:39:45 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-pm-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=XDgnm6dP; spf=pass (google.com: best guess record for domain of linux-pm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-pm-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 S1728011AbeH1Rb0 (ORCPT + 10 others); Tue, 28 Aug 2018 13:31:26 -0400 Received: from mail-ed1-f66.google.com ([209.85.208.66]:37271 "EHLO mail-ed1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727094AbeH1Rb0 (ORCPT ); Tue, 28 Aug 2018 13:31:26 -0400 Received: by mail-ed1-f66.google.com with SMTP id b10-v6so1402798eds.4 for ; Tue, 28 Aug 2018 06:39:43 -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=Qc/vEh/hM8XwepQBATbsK+sfjDGVHNzidZ0MvqTnDnY=; b=XDgnm6dPDHNs8LQ0Rb/kna7P+ofp36RdTusFhENVx3KmXTZDD7DP/yn4TQ8hfCyyTA jGWTqm9AqHeO/YJaSE7zOJL44vAO4mTNX/OKccc6WrmrJwVK3ngztkUCpgdqL+4qgh8g Qe9iXug49FuePaXhQY5oHP2vjbF3lmo+Hk5g0= 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=Qc/vEh/hM8XwepQBATbsK+sfjDGVHNzidZ0MvqTnDnY=; b=PmBrBbZx0G/S7QMs64Aku+n280PE0YCJKDhD+cawR8YpEuwK3jeAkLl934heNnC2x3 CnUUry181Kd8KxudrWvnRgmtATiNSWgYj46Y2K9KhGG0sGMcz6EK52Mei/d5BmSrNWUw 58LfmwVPh0sRbs4LtK0YtWBpbe3JypzI1DO6l0/4Vsooa13raSqfzO9ujEppR8maIWcJ BoEiy98v6iM+2FbpOXkMp5rEVTqNf6zQy2jpTqXvfhBHgiTef4IU4I+AJpImb+4f2i+G iRkC2ch4E4x0QbS1Fu6PsVVDqtleh/o/bbWxwYj1WaNQ5UsTUGuhNVRoF4gzv9BYOSmw YSJw== X-Gm-Message-State: APzg51Cuw2xq9MJ0wlbNH6iuwyWemYKokqkkex7IeaAPX4hCqc2Y2uak RkvfuyIQtxVnt9/r7vtvTI4tTQ== X-Received: by 2002:a50:a959:: with SMTP id m25-v6mr2662021edc.22.1535463582490; Tue, 28 Aug 2018 06:39:42 -0700 (PDT) Received: from localhost ([49.248.200.109]) by smtp.gmail.com with ESMTPSA id i3-v6sm697283eda.84.2018.08.28.06.39.40 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 28 Aug 2018 06:39:41 -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 , Daniel Lezcano , linux-pm@vger.kernel.org Subject: [PATCH v2 07/11] thermal: tsens: Add the SROT address map Date: Tue, 28 Aug 2018 19:08:36 +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 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(-) -- 2.17.1 Reviewed-by: Bjorn Andersson 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;