Commit 1b6e3e51 authored by Amit Kucheria's avatar Amit Kucheria Committed by Eduardo Valentin

drivers: thermal: tsens: Introduce IP-specific max_sensor count

The IP can support 'm' sensors while the platform can enable 'n' sensors
of the 'm' where n <= m.

Track maximum sensors supported by the IP so that we can correctly track
what subset of the sensors are supported on the platform.
Signed-off-by: default avatarAmit Kucheria <amit.kucheria@linaro.org>
Signed-off-by: default avatarEduardo Valentin <edubezval@gmail.com>
parent 66ad8a10
...@@ -198,7 +198,7 @@ int __init init_common(struct tsens_priv *priv) ...@@ -198,7 +198,7 @@ int __init init_common(struct tsens_priv *priv)
goto err_put_device; goto err_put_device;
} }
/* now alloc regmap_fields in tm_map */ /* now alloc regmap_fields in tm_map */
for (i = 0, j = LAST_TEMP_0; i < priv->num_sensors; i++, j++) { for (i = 0, j = LAST_TEMP_0; i < priv->feat->max_sensors; i++, j++) {
priv->rf[j] = devm_regmap_field_alloc(dev, priv->tm_map, priv->rf[j] = devm_regmap_field_alloc(dev, priv->tm_map,
priv->fields[j]); priv->fields[j]);
if (IS_ERR(priv->rf[j])) { if (IS_ERR(priv->rf[j])) {
...@@ -206,7 +206,7 @@ int __init init_common(struct tsens_priv *priv) ...@@ -206,7 +206,7 @@ int __init init_common(struct tsens_priv *priv)
goto err_put_device; goto err_put_device;
} }
} }
for (i = 0, j = VALID_0; i < priv->num_sensors; i++, j++) { for (i = 0, j = VALID_0; i < priv->feat->max_sensors; i++, j++) {
priv->rf[j] = devm_regmap_field_alloc(dev, priv->tm_map, priv->rf[j] = devm_regmap_field_alloc(dev, priv->tm_map,
priv->fields[j]); priv->fields[j]);
if (IS_ERR(priv->rf[j])) { if (IS_ERR(priv->rf[j])) {
......
...@@ -324,6 +324,7 @@ static const struct tsens_features tsens_v0_1_feat = { ...@@ -324,6 +324,7 @@ static const struct tsens_features tsens_v0_1_feat = {
.crit_int = 0, .crit_int = 0,
.adc = 1, .adc = 1,
.srot_split = 1, .srot_split = 1,
.max_sensors = 11,
}; };
static const struct reg_field tsens_v0_1_regfields[MAX_REGFIELDS] = { static const struct reg_field tsens_v0_1_regfields[MAX_REGFIELDS] = {
......
...@@ -88,6 +88,7 @@ static const struct tsens_features tsens_v2_feat = { ...@@ -88,6 +88,7 @@ static const struct tsens_features tsens_v2_feat = {
.crit_int = 1, .crit_int = 1,
.adc = 0, .adc = 0,
.srot_split = 1, .srot_split = 1,
.max_sensors = 16,
}; };
static const struct reg_field tsens_v2_regfields[MAX_REGFIELDS] = { static const struct reg_field tsens_v2_regfields[MAX_REGFIELDS] = {
......
...@@ -242,12 +242,14 @@ enum regfield_ids { ...@@ -242,12 +242,14 @@ enum regfield_ids {
* @adc: do the sensors only output adc code (instead of temperature)? * @adc: do the sensors only output adc code (instead of temperature)?
* @srot_split: does the IP neatly splits the register space into SROT and TM, * @srot_split: does the IP neatly splits the register space into SROT and TM,
* with SROT only being available to secure boot firmware? * with SROT only being available to secure boot firmware?
* @max_sensors: maximum sensors supported by this version of the IP
*/ */
struct tsens_features { struct tsens_features {
unsigned int ver_major; unsigned int ver_major;
unsigned int crit_int:1; unsigned int crit_int:1;
unsigned int adc:1; unsigned int adc:1;
unsigned int srot_split:1; unsigned int srot_split:1;
unsigned int max_sensors;
}; };
/** /**
......
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