[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20220713145655.3844109-5-carlos.bilbao@amd.com>
Date: Wed, 13 Jul 2022 09:57:00 -0500
From: Carlos Bilbao <carlos.bilbao@....com>
To: <bjorn.andersson@...aro.org>, <amitk@...nel.org>,
<thara.gopinath@...il.com>, <konrad.dybcio@...ainline.org>
CC: <agross@...nel.org>, <david.brown@...aro.org>,
<linux-pm@...r.kernel.org>, <linux-arm-msm@...r.kernel.org>,
<linux-kernel@...r.kernel.org>, <bilbao@...edu>,
Carlos Bilbao <carlos.bilbao@....com>
Subject: [PATCH 4/4] thermal/drivers/qcom: Use array for max num sensors per version
Use a constant array MAX_NUM_SENSORS[] for maximum number of sensors per
version (v0.1, v1, v2).
Signed-off-by: Carlos Bilbao <carlos.bilbao@....com>
---
drivers/thermal/qcom/tsens-8960.c | 2 +-
drivers/thermal/qcom/tsens-v0_1.c | 4 ++--
drivers/thermal/qcom/tsens-v1.c | 2 +-
drivers/thermal/qcom/tsens-v2.c | 2 +-
drivers/thermal/qcom/tsens.h | 6 ++++++
5 files changed, 11 insertions(+), 5 deletions(-)
diff --git a/drivers/thermal/qcom/tsens-8960.c b/drivers/thermal/qcom/tsens-8960.c
index b41ff164e67a..05db9bf0e2c6 100644
--- a/drivers/thermal/qcom/tsens-8960.c
+++ b/drivers/thermal/qcom/tsens-8960.c
@@ -263,6 +263,6 @@ static const struct tsens_ops ops_8960 = {
};
const struct tsens_plat_data data_8960 = {
- .num_sensors = 11,
+ .num_sensors = MAX_NUM_SENSORS[VER_0_1],
.ops = &ops_8960,
};
diff --git a/drivers/thermal/qcom/tsens-v0_1.c b/drivers/thermal/qcom/tsens-v0_1.c
index 6f26fadf4c27..d29046cffc6b 100644
--- a/drivers/thermal/qcom/tsens-v0_1.c
+++ b/drivers/thermal/qcom/tsens-v0_1.c
@@ -324,7 +324,7 @@ static const struct tsens_features tsens_v0_1_feat = {
.crit_int = 0,
.adc = 1,
.srot_split = 1,
- .max_sensors = 11,
+ .max_sensors = MAX_NUM_SENSORS[VER_0_1],
};
static const struct reg_field tsens_v0_1_regfields[MAX_REGFIELDS] = {
@@ -374,7 +374,7 @@ static const struct tsens_ops ops_8974 = {
};
const struct tsens_plat_data data_8974 = {
- .num_sensors = 11,
+ .num_sensors = MAX_NUM_SENSORS[VER_0_1],
.ops = &ops_8974,
.feat = &tsens_v0_1_feat,
.fields = tsens_v0_1_regfields,
diff --git a/drivers/thermal/qcom/tsens-v1.c b/drivers/thermal/qcom/tsens-v1.c
index 10b595d4f619..2007deb45723 100644
--- a/drivers/thermal/qcom/tsens-v1.c
+++ b/drivers/thermal/qcom/tsens-v1.c
@@ -149,7 +149,7 @@ static const struct tsens_features tsens_v1_feat = {
.crit_int = 0,
.adc = 1,
.srot_split = 1,
- .max_sensors = 11,
+ .max_sensors = MAX_NUM_SENSORS[VER_1_X],
};
static const struct reg_field tsens_v1_regfields[MAX_REGFIELDS] = {
diff --git a/drivers/thermal/qcom/tsens-v2.c b/drivers/thermal/qcom/tsens-v2.c
index 0a4f2b8fcab6..002809e6a0b5 100644
--- a/drivers/thermal/qcom/tsens-v2.c
+++ b/drivers/thermal/qcom/tsens-v2.c
@@ -32,7 +32,7 @@ static const struct tsens_features tsens_v2_feat = {
.crit_int = 1,
.adc = 0,
.srot_split = 1,
- .max_sensors = 16,
+ .max_sensors = MAX_NUM_SENSORS[VER_2_X],
};
static const struct reg_field tsens_v2_regfields[MAX_REGFIELDS] = {
diff --git a/drivers/thermal/qcom/tsens.h b/drivers/thermal/qcom/tsens.h
index 2fd94997245b..39645bbe9f95 100644
--- a/drivers/thermal/qcom/tsens.h
+++ b/drivers/thermal/qcom/tsens.h
@@ -26,6 +26,12 @@ enum tsens_ver {
VER_2_X,
};
+static const int MAX_NUM_SENSORS[] = {
+ [VER_0_1] = 11,
+ [VER_1_X] = 11,
+ [VER_2_X] = 16,
+};
+
/**
* struct tsens_sensor - data for each sensor connected to the tsens device
* @priv: tsens device instance that this sensor is connected to
--
2.31.1
Powered by blists - more mailing lists