Commit 0aef1ee5 authored by Amit Kucheria's avatar Amit Kucheria Committed by Daniel Lezcano

drivers: thermal: tsens: De-constify struct tsens_features

struct tsens_features is currently initialized as part of platform data
at compile-time and not modifiable. We now have some usecases in feature
detection across IP versions where it is more flexible to update the
features after probing registers.

Remove const qualifier from tsens_features and the encapsulating
tsens_plat_data.
Signed-off-by: default avatarAmit Kucheria <amit.kucheria@linaro.org>
Reviewed-by: default avatarStephen Boyd <swboyd@chromium.org>
Signed-off-by: default avatarDaniel Lezcano <daniel.lezcano@linaro.org>
Link: https://lore.kernel.org/r/2919a72220470366ae11e0bb5330a4ea39838f71.1584015867.git.amit.kucheria@linaro.org
parent 39056e8a
...@@ -279,7 +279,7 @@ static const struct tsens_ops ops_8960 = { ...@@ -279,7 +279,7 @@ static const struct tsens_ops ops_8960 = {
.resume = resume_8960, .resume = resume_8960,
}; };
const struct tsens_plat_data data_8960 = { struct tsens_plat_data data_8960 = {
.num_sensors = 11, .num_sensors = 11,
.ops = &ops_8960, .ops = &ops_8960,
}; };
...@@ -327,7 +327,7 @@ static int calibrate_8974(struct tsens_priv *priv) ...@@ -327,7 +327,7 @@ static int calibrate_8974(struct tsens_priv *priv)
/* v0.1: 8916, 8974 */ /* v0.1: 8916, 8974 */
static const struct tsens_features tsens_v0_1_feat = { static struct tsens_features tsens_v0_1_feat = {
.ver_major = VER_0_1, .ver_major = VER_0_1,
.crit_int = 0, .crit_int = 0,
.adc = 1, .adc = 1,
...@@ -377,7 +377,7 @@ static const struct tsens_ops ops_8916 = { ...@@ -377,7 +377,7 @@ static const struct tsens_ops ops_8916 = {
.get_temp = get_temp_common, .get_temp = get_temp_common,
}; };
const struct tsens_plat_data data_8916 = { struct tsens_plat_data data_8916 = {
.num_sensors = 5, .num_sensors = 5,
.ops = &ops_8916, .ops = &ops_8916,
.hw_ids = (unsigned int []){0, 1, 2, 4, 5 }, .hw_ids = (unsigned int []){0, 1, 2, 4, 5 },
...@@ -392,7 +392,7 @@ static const struct tsens_ops ops_8974 = { ...@@ -392,7 +392,7 @@ static const struct tsens_ops ops_8974 = {
.get_temp = get_temp_common, .get_temp = get_temp_common,
}; };
const struct tsens_plat_data data_8974 = { struct tsens_plat_data data_8974 = {
.num_sensors = 11, .num_sensors = 11,
.ops = &ops_8974, .ops = &ops_8974,
.feat = &tsens_v0_1_feat, .feat = &tsens_v0_1_feat,
......
...@@ -299,7 +299,7 @@ static int calibrate_8976(struct tsens_priv *priv) ...@@ -299,7 +299,7 @@ static int calibrate_8976(struct tsens_priv *priv)
/* v1.x: msm8956,8976,qcs404,405 */ /* v1.x: msm8956,8976,qcs404,405 */
static const struct tsens_features tsens_v1_feat = { static struct tsens_features tsens_v1_feat = {
.ver_major = VER_1_X, .ver_major = VER_1_X,
.crit_int = 0, .crit_int = 0,
.adc = 1, .adc = 1,
...@@ -368,7 +368,7 @@ static const struct tsens_ops ops_generic_v1 = { ...@@ -368,7 +368,7 @@ static const struct tsens_ops ops_generic_v1 = {
.get_temp = get_temp_tsens_valid, .get_temp = get_temp_tsens_valid,
}; };
const struct tsens_plat_data data_tsens_v1 = { struct tsens_plat_data data_tsens_v1 = {
.ops = &ops_generic_v1, .ops = &ops_generic_v1,
.feat = &tsens_v1_feat, .feat = &tsens_v1_feat,
.fields = tsens_v1_regfields, .fields = tsens_v1_regfields,
...@@ -381,7 +381,7 @@ static const struct tsens_ops ops_8976 = { ...@@ -381,7 +381,7 @@ static const struct tsens_ops ops_8976 = {
}; };
/* Valid for both MSM8956 and MSM8976. Sensor ID 3 is unused. */ /* Valid for both MSM8956 and MSM8976. Sensor ID 3 is unused. */
const struct tsens_plat_data data_8976 = { struct tsens_plat_data data_8976 = {
.num_sensors = 11, .num_sensors = 11,
.ops = &ops_8976, .ops = &ops_8976,
.hw_ids = (unsigned int[]){0, 1, 2, 4, 5, 6, 7, 8, 9, 10}, .hw_ids = (unsigned int[]){0, 1, 2, 4, 5, 6, 7, 8, 9, 10},
......
...@@ -27,7 +27,7 @@ ...@@ -27,7 +27,7 @@
/* v2.x: 8996, 8998, sdm845 */ /* v2.x: 8996, 8998, sdm845 */
static const struct tsens_features tsens_v2_feat = { static struct tsens_features tsens_v2_feat = {
.ver_major = VER_2_X, .ver_major = VER_2_X,
.crit_int = 1, .crit_int = 1,
.adc = 0, .adc = 0,
...@@ -81,14 +81,14 @@ static const struct tsens_ops ops_generic_v2 = { ...@@ -81,14 +81,14 @@ static const struct tsens_ops ops_generic_v2 = {
.get_temp = get_temp_tsens_valid, .get_temp = get_temp_tsens_valid,
}; };
const struct tsens_plat_data data_tsens_v2 = { struct tsens_plat_data data_tsens_v2 = {
.ops = &ops_generic_v2, .ops = &ops_generic_v2,
.feat = &tsens_v2_feat, .feat = &tsens_v2_feat,
.fields = tsens_v2_regfields, .fields = tsens_v2_regfields,
}; };
/* Kept around for backward compatibility with old msm8996.dtsi */ /* Kept around for backward compatibility with old msm8996.dtsi */
const struct tsens_plat_data data_8996 = { struct tsens_plat_data data_8996 = {
.num_sensors = 13, .num_sensors = 13,
.ops = &ops_generic_v2, .ops = &ops_generic_v2,
.feat = &tsens_v2_feat, .feat = &tsens_v2_feat,
......
...@@ -440,7 +440,7 @@ struct tsens_plat_data { ...@@ -440,7 +440,7 @@ struct tsens_plat_data {
const u32 num_sensors; const u32 num_sensors;
const struct tsens_ops *ops; const struct tsens_ops *ops;
unsigned int *hw_ids; unsigned int *hw_ids;
const struct tsens_features *feat; struct tsens_features *feat;
const struct reg_field *fields; const struct reg_field *fields;
}; };
...@@ -481,7 +481,7 @@ struct tsens_priv { ...@@ -481,7 +481,7 @@ struct tsens_priv {
struct regmap_field *rf[MAX_REGFIELDS]; struct regmap_field *rf[MAX_REGFIELDS];
struct tsens_context ctx; struct tsens_context ctx;
const struct tsens_features *feat; struct tsens_features *feat;
const struct reg_field *fields; const struct reg_field *fields;
const struct tsens_ops *ops; const struct tsens_ops *ops;
...@@ -502,15 +502,15 @@ int tsens_set_trips(void *_sensor, int low, int high); ...@@ -502,15 +502,15 @@ int tsens_set_trips(void *_sensor, int low, int high);
irqreturn_t tsens_irq_thread(int irq, void *data); irqreturn_t tsens_irq_thread(int irq, void *data);
/* TSENS target */ /* TSENS target */
extern const struct tsens_plat_data data_8960; extern struct tsens_plat_data data_8960;
/* TSENS v0.1 targets */ /* TSENS v0.1 targets */
extern const struct tsens_plat_data data_8916, data_8974; extern struct tsens_plat_data data_8916, data_8974;
/* TSENS v1 targets */ /* TSENS v1 targets */
extern const struct tsens_plat_data data_tsens_v1, data_8976; extern struct tsens_plat_data data_tsens_v1, data_8976;
/* TSENS v2 targets */ /* TSENS v2 targets */
extern const struct tsens_plat_data data_8996, data_tsens_v2; extern struct tsens_plat_data data_8996, data_tsens_v2;
#endif /* __QCOM_TSENS_H__ */ #endif /* __QCOM_TSENS_H__ */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment