lkml.org 
[lkml]   [2022]   [Aug]   [29]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v3 4/4] thermal: qcom: tsens: Add reinit quirk support for tsens v2 controllers
On Thu, Aug 04, 2022 at 11:16:38AM +0530, Bhupesh Sharma wrote:
> Some Qualcomm tsens v2 controllers like those present on
> sm8150 SoC might require re-initialization via trustzone
> [via scm call(s)] when it enters a 'bad state' causing
> sensor temperatures/interrupts status to be in an
> 'invalid' state.
>
> Add hooks for the same in the qcom tsens driver.
>
> Devices requiring the same can pass the relevant
> compatible string in dt and the driver hook can
> be used accordingly.
>
> Cc: Bjorn Andersson <bjorn.andersson@linaro.org>
> Cc: Amit Kucheria <amitk@kernel.org>
> Cc: Thara Gopinath <thara.gopinath@gmail.com>
> Cc: linux-pm@vger.kernel.org
> Cc: linux-arm-msm@vger.kernel.org
> Signed-off-by: Bhupesh Sharma <bhupesh.sharma@linaro.org>

Reviewed-by: Bjorn Andersson <andersson@kernel.org>

> ---
> drivers/thermal/qcom/tsens-v2.c | 12 ++++++++++++
> drivers/thermal/qcom/tsens.c | 3 +++
> drivers/thermal/qcom/tsens.h | 2 +-
> 3 files changed, 16 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/thermal/qcom/tsens-v2.c b/drivers/thermal/qcom/tsens-v2.c
> index f521e4479cc5..431f17f99d34 100644
> --- a/drivers/thermal/qcom/tsens-v2.c
> +++ b/drivers/thermal/qcom/tsens-v2.c
> @@ -104,6 +104,18 @@ struct tsens_plat_data data_tsens_v2 = {
> .fields = tsens_v2_regfields,
> };
>
> +/*
> + * For some tsens v2 controllers, its suggested to monitor the
> + * controller health periodically and in case an issue is detected
> + * to reinit tsens controller via trustzone.
> + */
> +struct tsens_plat_data data_tsens_v2_reinit = {
> + .ops = &ops_generic_v2,
> + .feat = &tsens_v2_feat,
> + .needs_reinit_wa = true,
> + .fields = tsens_v2_regfields,
> +};
> +
> /* Kept around for backward compatibility with old msm8996.dtsi */
> struct tsens_plat_data data_8996 = {
> .num_sensors = 13,
> diff --git a/drivers/thermal/qcom/tsens.c b/drivers/thermal/qcom/tsens.c
> index c2d085fb5447..928b6a44fda8 100644
> --- a/drivers/thermal/qcom/tsens.c
> +++ b/drivers/thermal/qcom/tsens.c
> @@ -1145,6 +1145,9 @@ static const struct of_device_id tsens_table[] = {
> }, {
> .compatible = "qcom,msm8996-tsens",
> .data = &data_8996,
> + }, {
> + .compatible = "qcom,sm8150-tsens",
> + .data = &data_tsens_v2_reinit,
> }, {
> .compatible = "qcom,tsens-v1",
> .data = &data_tsens_v1,
> diff --git a/drivers/thermal/qcom/tsens.h b/drivers/thermal/qcom/tsens.h
> index 900d2a74d25e..03cc3a790972 100644
> --- a/drivers/thermal/qcom/tsens.h
> +++ b/drivers/thermal/qcom/tsens.h
> @@ -607,6 +607,6 @@ extern struct tsens_plat_data data_8916, data_8939, data_8974, data_9607;
> extern struct tsens_plat_data data_tsens_v1, data_8976;
>
> /* TSENS v2 targets */
> -extern struct tsens_plat_data data_8996, data_tsens_v2;
> +extern struct tsens_plat_data data_8996, data_tsens_v2_reinit, data_tsens_v2;
>
> #endif /* __QCOM_TSENS_H__ */
> --
> 2.35.3
>

\
 
 \ /
  Last update: 2022-08-30 00:16    [W:1.090 / U:1.624 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site