All of lore.kernel.org
 help / color / mirror / Atom feed
From: Matthias Kaehlcke <mka@chromium.org>
To: Amit Kucheria <amit.kucheria@linaro.org>
Cc: linux-kernel@vger.kernel.org, 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,
	Zhang Rui <rui.zhang@intel.com>,
	linux-pm@vger.kernel.org
Subject: Re: [PATCH v1 05/10] thermal: tsens: Rename map field in order to add a second address map
Date: Thu, 9 Aug 2018 12:32:48 -0700	[thread overview]
Message-ID: <20180809193248.GM160295@google.com> (raw)
In-Reply-To: <f3bdc0b9f98f834e2b420f737a0cec075c2c450d.1533815718.git.amit.kucheria@linaro.org>

On Thu, Aug 09, 2018 at 06:02:37PM +0530, Amit Kucheria wrote:
> 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 <amit.kucheria@linaro.org>
> ---
>  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, &reg);
> +	ret = regmap_read(tmdev->tm_map, CNTL_ADDR, &reg);
>  	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, &reg_cntl);
> +	ret = regmap_read(tmdev->tm_map, CNTL_ADDR, &reg_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;

Reviewed-by: Matthias Kaehlcke <mka@chromium.org>

  reply	other threads:[~2018-08-09 19:32 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-09 12:32 [PATCH v1 00/10] Another round of tsens cleanups Amit Kucheria
2018-08-09 12:32 ` Amit Kucheria
2018-08-09 12:32 ` [PATCH v1 01/10] arm/arm64: dts: msm8974/msm8916: thermal: Split address space into two Amit Kucheria
2018-08-09 12:32   ` Amit Kucheria
2018-08-09 19:10   ` Matthias Kaehlcke
2018-08-09 19:10     ` Matthias Kaehlcke
2018-08-10  4:50     ` Amit Kucheria
2018-08-10  4:50       ` Amit Kucheria
2018-08-10  4:50       ` Amit Kucheria
2018-08-24 23:21   ` Eduardo Valentin
2018-08-24 23:21     ` Eduardo Valentin
2018-08-24 23:27   ` Eduardo Valentin
2018-08-24 23:27     ` Eduardo Valentin
2018-08-27 12:54     ` Amit Kucheria
2018-08-27 12:54       ` Amit Kucheria
2018-08-09 12:32 ` [PATCH v1 02/10] dt-bindings: thermal: Fix a typo in documentation Amit Kucheria
2018-08-09 19:16   ` Matthias Kaehlcke
2018-08-13 21:49   ` Rob Herring
2018-08-24 23:24   ` Eduardo Valentin
2018-08-31  8:14     ` Daniel Lezcano
2018-08-09 12:32 ` [PATCH v1 03/10] thermal: tsens: Add SPDX license identifiers Amit Kucheria
2018-08-09 19:19   ` Matthias Kaehlcke
2018-08-09 12:32 ` [PATCH v1 04/10] thermal: tsens: Get rid of dead code Amit Kucheria
2018-08-09 19:23   ` Matthias Kaehlcke
2018-08-09 12:32 ` [PATCH v1 05/10] thermal: tsens: Rename map field in order to add a second address map Amit Kucheria
2018-08-09 19:32   ` Matthias Kaehlcke [this message]
2018-08-09 12:32 ` [PATCH v1 06/10] thermal: tsens: Add the SROT " Amit Kucheria
2018-08-09 19:46   ` Matthias Kaehlcke
2018-08-09 12:32 ` [PATCH v1 07/10] thermal: tsens: Check if the IP is correctly enabled by firmware Amit Kucheria
2018-08-09 20:37   ` Matthias Kaehlcke
2018-08-24 23:30   ` Eduardo Valentin
2018-08-27 13:04     ` Amit Kucheria
2018-08-09 12:32 ` [PATCH v1 08/10] thermal: tsens: Get rid of 'id' field Amit Kucheria
2018-08-09 20:55   ` Matthias Kaehlcke
2018-08-09 12:32 ` [PATCH v1 09/10] arm64: dts: qcom: Add reg-names for all tsens nodes Amit Kucheria
2018-08-09 12:32   ` Amit Kucheria
2018-08-09 21:05   ` Matthias Kaehlcke
2018-08-09 21:05     ` Matthias Kaehlcke
2018-08-09 12:32 ` [PATCH v1 10/10] MAINTAINERS: Add entry for Qualcomm TSENS thermal drivers Amit Kucheria
2018-08-09 21:08   ` Matthias Kaehlcke
2018-08-14  5:11   ` Rajendra Nayak

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180809193248.GM160295@google.com \
    --to=mka@chromium.org \
    --cc=amit.kucheria@linaro.org \
    --cc=andy.gross@linaro.org \
    --cc=bjorn.andersson@linaro.org \
    --cc=dianders@chromium.org \
    --cc=edubezval@gmail.com \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=rnayak@codeaurora.org \
    --cc=rui.zhang@intel.com \
    --cc=smohanad@codeaurora.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.