diff options
| -rw-r--r-- | drivers/thermal/armada_thermal.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/drivers/thermal/armada_thermal.c b/drivers/thermal/armada_thermal.c index 6fd648337e63..f84d9f077fe2 100644 --- a/drivers/thermal/armada_thermal.c +++ b/drivers/thermal/armada_thermal.c | |||
| @@ -56,6 +56,7 @@ struct armada_thermal_data { | |||
| 56 | unsigned long coef_b; | 56 | unsigned long coef_b; |
| 57 | unsigned long coef_m; | 57 | unsigned long coef_m; |
| 58 | unsigned long coef_div; | 58 | unsigned long coef_div; |
| 59 | bool inverted; | ||
| 59 | 60 | ||
| 60 | /* Register shift and mask to access the sensor temperature */ | 61 | /* Register shift and mask to access the sensor temperature */ |
| 61 | unsigned int temp_shift; | 62 | unsigned int temp_shift; |
| @@ -138,7 +139,10 @@ static int armada_get_temp(struct thermal_zone_device *thermal, | |||
| 138 | m = priv->data->coef_m; | 139 | m = priv->data->coef_m; |
| 139 | div = priv->data->coef_div; | 140 | div = priv->data->coef_div; |
| 140 | 141 | ||
| 141 | *temp = (b - (m * reg)) / div; | 142 | if (priv->data->inverted) |
| 143 | *temp = ((m * reg) - b) / div; | ||
| 144 | else | ||
| 145 | *temp = (b - (m * reg)) / div; | ||
| 142 | return 0; | 146 | return 0; |
| 143 | } | 147 | } |
| 144 | 148 | ||
