linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
To: Konrad Dybcio <konrad.dybcio@somainline.org>
Cc: ~postmarketos/upstreaming@lists.sr.ht,
	martin.botka@somainline.org,
	angelogioacchino.delregno@somainline.org,
	marijn.suijten@somainline.org, jamipkettunen@somainline.org,
	Amit Kucheria <amitk@kernel.org>,
	Thara Gopinath <thara.gopinath@linaro.org>,
	Andy Gross <agross@kernel.org>,
	Bjorn Andersson <bjorn.andersson@linaro.org>,
	"Rafael J. Wysocki" <rafael@kernel.org>,
	Daniel Lezcano <daniel.lezcano@linaro.org>,
	Zhang Rui <rui.zhang@intel.com>,
	linux-pm@vger.kernel.org, linux-arm-msm@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v3 2/2] thermal: qcom: tsens-v1: Add support for MSM8992/4 TSENS
Date: Mon, 27 Jun 2022 18:15:15 +0300	[thread overview]
Message-ID: <CAA8EJpqM5i88UKSrQyG1pMM6NQb8naTri-jNt++q7oKB-zdGAg@mail.gmail.com> (raw)
In-Reply-To: <20220501202025.211567-2-konrad.dybcio@somainline.org>

On Sun, 1 May 2022 at 23:21, Konrad Dybcio <konrad.dybcio@somainline.org> wrote:
>
> MSM8994, despite being heavily based on MSM8974, uses the
> 1.2 version of TSENS. Also, 8994 being 8994, it has a custom
> way of calculating the slope.
>
> MSM8992 in turn is a cut-down version of MSM8994 and uses
> the same TSENS hardware, albeit with a different set of sensors.
>
> Also tested on 8976 (by a person who didn't want to be named)
> to make sure the 11->16 max_sensors changes didn't break anything.
>
> Signed-off-by: Konrad Dybcio <konrad.dybcio@somainline.org>
> ---
> Changes since v2:
>
> - don't use slope before it's initialized (whoops!)
> - don't re-assign the same value to p[0..15]
> - free calib_rsel
> - use the same ops for 8992 and 8994
>
>  drivers/thermal/qcom/tsens-v1.c | 293 ++++++++++++++++++++++++++++++--
>  drivers/thermal/qcom/tsens.c    |   6 +
>  drivers/thermal/qcom/tsens.h    |   2 +-
>  3 files changed, 288 insertions(+), 13 deletions(-)
>
> diff --git a/drivers/thermal/qcom/tsens-v1.c b/drivers/thermal/qcom/tsens-v1.c
> index 573e261ccca7..58864962f370 100644
> --- a/drivers/thermal/qcom/tsens-v1.c
> +++ b/drivers/thermal/qcom/tsens-v1.c
> @@ -142,6 +142,99 @@
>  #define CAL_SEL_MASK   7
>  #define CAL_SEL_SHIFT  0
>
> +/* eeprom layout data for 8994 */
> +#define MSM8994_BASE0_MASK     0x3ff
> +#define MSM8994_BASE1_MASK     0xffc00
> +#define MSM8994_BASE0_SHIFT    0
> +#define MSM8994_BASE1_SHIFT    10

Generally I feel that all the _MASK values can be better generated
using the GENMASK and newly defined _SHIFT value.

> +
> +#define MSM8994_S0_MASK        0xf00000
> +#define MSM8994_S1_MASK        0xf000000
> +#define MSM8994_S2_MASK        0xf0000000
> +#define MSM8994_S3_MASK        0xf
> +#define MSM8994_S4_MASK        0xf0
> +#define MSM8994_S5_MASK        0xf00
> +#define MSM8994_S6_MASK        0xf000
> +#define MSM8994_S7_MASK        0xf0000
> +#define MSM8994_S8_MASK        0xf00000
> +#define MSM8994_S9_MASK        0xf000000
> +#define MSM8994_S10_MASK       0xf0000000
> +#define MSM8994_S11_MASK       0xf
> +#define MSM8994_S12_MASK       0xf0
> +#define MSM8994_S13_MASK       0xf00
> +#define MSM8994_S14_MASK       0xf000
> +#define MSM8994_S15_MASK       0xf0000
> +
> +#define MSM8994_S0_SHIFT       20
> +#define MSM8994_S1_SHIFT       24
> +#define MSM8994_S2_SHIFT       28
> +#define MSM8994_S3_SHIFT       0
> +#define MSM8994_S4_SHIFT       4
> +#define MSM8994_S5_SHIFT       8
> +#define MSM8994_S6_SHIFT       12
> +#define MSM8994_S7_SHIFT       16
> +#define MSM8994_S8_SHIFT       20
> +#define MSM8994_S9_SHIFT       24
> +#define MSM8994_S10_SHIFT      28
> +#define MSM8994_S11_SHIFT      0
> +#define MSM8994_S12_SHIFT      4
> +#define MSM8994_S13_SHIFT      8
> +#define MSM8994_S14_SHIFT      12
> +#define MSM8994_S15_SHIFT      16

[skipped the rest]

-- 
With best wishes
Dmitry

  parent reply	other threads:[~2022-06-27 15:15 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-01 20:20 [PATCH v3 1/2] dt-bindings: thermal: tsens: Add msm8992/4 compatibles Konrad Dybcio
2022-05-01 20:20 ` [PATCH v3 2/2] thermal: qcom: tsens-v1: Add support for MSM8992/4 TSENS Konrad Dybcio
2022-06-27 14:55   ` Konrad Dybcio
2022-06-27 15:15   ` Dmitry Baryshkov [this message]
2022-06-28 13:19     ` Konrad Dybcio
2022-06-28 13:27       ` Dmitry Baryshkov

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=CAA8EJpqM5i88UKSrQyG1pMM6NQb8naTri-jNt++q7oKB-zdGAg@mail.gmail.com \
    --to=dmitry.baryshkov@linaro.org \
    --cc=agross@kernel.org \
    --cc=amitk@kernel.org \
    --cc=angelogioacchino.delregno@somainline.org \
    --cc=bjorn.andersson@linaro.org \
    --cc=daniel.lezcano@linaro.org \
    --cc=jamipkettunen@somainline.org \
    --cc=konrad.dybcio@somainline.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=marijn.suijten@somainline.org \
    --cc=martin.botka@somainline.org \
    --cc=rafael@kernel.org \
    --cc=rui.zhang@intel.com \
    --cc=thara.gopinath@linaro.org \
    --cc=~postmarketos/upstreaming@lists.sr.ht \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).