|
@@ -193,7 +193,7 @@ static int sun4i_get_temp(const struct sun4i_ts_data *ts, long *temp)
|
|
if (ts->temp_data == -1)
|
|
if (ts->temp_data == -1)
|
|
return -EAGAIN;
|
|
return -EAGAIN;
|
|
|
|
|
|
- *temp = (ts->temp_data - ts->temp_offset) * ts->temp_step;
|
|
|
|
|
|
+ *temp = ts->temp_data * ts->temp_step - ts->temp_offset;
|
|
|
|
|
|
return 0;
|
|
return 0;
|
|
}
|
|
}
|
|
@@ -255,17 +255,17 @@ static int sun4i_ts_probe(struct platform_device *pdev)
|
|
ts->ignore_fifo_data = true;
|
|
ts->ignore_fifo_data = true;
|
|
ts->temp_data = -1;
|
|
ts->temp_data = -1;
|
|
if (of_device_is_compatible(np, "allwinner,sun6i-a31-ts")) {
|
|
if (of_device_is_compatible(np, "allwinner,sun6i-a31-ts")) {
|
|
- /* Allwinner SDK has temperature = -271 + (value / 6) (C) */
|
|
|
|
- ts->temp_offset = 1626;
|
|
|
|
|
|
+ /* Allwinner SDK has temperature (C) = (value / 6) - 271 */
|
|
|
|
+ ts->temp_offset = 271000;
|
|
ts->temp_step = 167;
|
|
ts->temp_step = 167;
|
|
} else if (of_device_is_compatible(np, "allwinner,sun4i-a10-ts")) {
|
|
} else if (of_device_is_compatible(np, "allwinner,sun4i-a10-ts")) {
|
|
/*
|
|
/*
|
|
* The A10 temperature sensor has quite a wide spread, these
|
|
* The A10 temperature sensor has quite a wide spread, these
|
|
* parameters are based on the averaging of the calibration
|
|
* parameters are based on the averaging of the calibration
|
|
* results of 4 completely different boards, with a spread of
|
|
* results of 4 completely different boards, with a spread of
|
|
- * temp_step from 96 - 170 and temp_offset from 1758 - 3310.
|
|
|
|
|
|
+ * temp_step from 0.096 - 0.170 and temp_offset from 176 - 331.
|
|
*/
|
|
*/
|
|
- ts->temp_offset = 2570;
|
|
|
|
|
|
+ ts->temp_offset = 257000;
|
|
ts->temp_step = 133;
|
|
ts->temp_step = 133;
|
|
} else {
|
|
} else {
|
|
/*
|
|
/*
|
|
@@ -273,13 +273,13 @@ static int sun4i_ts_probe(struct platform_device *pdev)
|
|
* the temperature. The formula used here is from the AXP209,
|
|
* the temperature. The formula used here is from the AXP209,
|
|
* which is designed by X-Powers, an affiliate of Allwinner:
|
|
* which is designed by X-Powers, an affiliate of Allwinner:
|
|
*
|
|
*
|
|
- * temperature = -144.7 + (value * 0.1)
|
|
|
|
|
|
+ * temperature (C) = (value * 0.1) - 144.7
|
|
*
|
|
*
|
|
* Allwinner does not have any documentation whatsoever for
|
|
* Allwinner does not have any documentation whatsoever for
|
|
* this hardware. Moreover, it is claimed that the sensor
|
|
* this hardware. Moreover, it is claimed that the sensor
|
|
* is inaccurate and cannot work properly.
|
|
* is inaccurate and cannot work properly.
|
|
*/
|
|
*/
|
|
- ts->temp_offset = 1447;
|
|
|
|
|
|
+ ts->temp_offset = 144700;
|
|
ts->temp_step = 100;
|
|
ts->temp_step = 100;
|
|
}
|
|
}
|
|
|
|
|