summaryrefslogtreecommitdiff
path: root/drivers/hwmon
diff options
context:
space:
mode:
authorBitan Biswas <bbiswas@nvidia.com>2011-08-05 16:02:19 +0530
committerDan Willemsen <dwillemsen@nvidia.com>2011-11-30 21:48:04 -0800
commit26f1f88dab2af0e1f8d4313f1fa965877fc312de (patch)
tree95418f28b157c20379adfd82f55f06fba78599b4 /drivers/hwmon
parentfc684b15f55be43ec41126e4b18b6fdaddff0f23 (diff)
hwmon: tegra: tsensor: disable hardware reset
Hardware reset and clock divide feature of tsensor is disabled as the temperature readings are not accurate. Incorrect threshold calculations and temperature readings are seen to show tsensor reset during boot up. bug 860513 Original-Change-Id: Ib64259f3e400eddde54056dae495983930b5c107 Reviewed-on: http://git-master/r/45487 Reviewed-by: Bitan Biswas <bbiswas@nvidia.com> Tested-by: Bitan Biswas <bbiswas@nvidia.com> Reviewed-by: Venu Byravarasu <vbyravarasu@nvidia.com> Reviewed-by: Hanumanth Venkateswa Moganty <vmoganty@nvidia.com> Rebase-Id: R01841af1297ed369ea52e6207358cc13296c93e3
Diffstat (limited to 'drivers/hwmon')
-rw-r--r--drivers/hwmon/tegra-tsensor.c28
1 files changed, 21 insertions, 7 deletions
diff --git a/drivers/hwmon/tegra-tsensor.c b/drivers/hwmon/tegra-tsensor.c
index 0317038f2800..440ca3c38e51 100644
--- a/drivers/hwmon/tegra-tsensor.c
+++ b/drivers/hwmon/tegra-tsensor.c
@@ -40,6 +40,9 @@
#include <mach/tsensor.h>
#include <mach/tegra_fuse.h>
+/* macro to enable tsensor hw reset and clock divide */
+#define ENABLE_TSENSOR_HW_RESET 0
+
/* We have multiple tsensor instances with following registers */
#define SENSOR_CFG0 0x40
#define SENSOR_CFG1 0x48
@@ -211,7 +214,7 @@ static unsigned int init_flag;
static int tsensor_count_2_temp(struct tegra_tsensor_data *data,
unsigned int count, int *p_temperature);
static unsigned int tsensor_get_threshold_counter(
- struct tegra_tsensor_data *data, unsigned int temp);
+ struct tegra_tsensor_data *data, int temp);
/* tsensor register access functions */
@@ -1146,13 +1149,15 @@ endLabel:
/* tsensor threshold temperature to threshold counter conversion function */
static unsigned int tsensor_get_threshold_counter(
struct tegra_tsensor_data *data,
- unsigned int temp_threshold)
+ int temp_threshold)
{
unsigned int counter1, counter2;
unsigned int curr_avg, min_max;
unsigned int counter;
int err;
+ if (temp_threshold < 0)
+ return MAX_THRESHOLD;
tsensor_temp_2_count(data, temp_threshold, &counter1, &counter2);
err = tsensor_read_counter(data, tsensor_index, &curr_avg, &min_max);
if (err < 0) {
@@ -1212,7 +1217,9 @@ static void tsensor_threshold_setup(
dev_dbg(data->hwmon_dev, "\n hysteresis_temp=%d, count=%d ",
(unsigned int)(data->sw_intr_temp - data->hysteresis),
hysteresis_count);
- th0_diff = th1_count - hysteresis_count;
+ th0_diff = (th1_count == DEFAULT_THRESHOLD_TH1) ?
+ DEFAULT_THRESHOLD_TH0 :
+ (th1_count - hysteresis_count);
dev_dbg(data->hwmon_dev, "\n th0_diff=%d ", th0_diff);
}
dev_dbg(data->hwmon_dev, "\n before threshold program TH dump: ");
@@ -1265,12 +1272,12 @@ static int tsensor_config_setup(struct tegra_tsensor_data *data)
SENSOR_CFG0_M_SHIFT) |
((DEFAULT_TSENSOR_N & SENSOR_CFG0_N_MASK) <<
SENSOR_CFG0_N_SHIFT) |
+#if ENABLE_TSENSOR_HW_RESET
(1 << SENSOR_CFG0_OVERFLOW_INTR) |
- /*(1 << SENSOR_CFG0_RST_INTR_SHIFT) |
- (1 << SENSOR_CFG0_HW_DIV2_INTR_SHIFT) |*/
- (1 << SENSOR_CFG0_STOP_SHIFT) |
(1 << SENSOR_CFG0_RST_ENABLE_SHIFT) |
- (1 << SENSOR_CFG0_HW_DIV2_ENABLE_SHIFT));
+ (1 << SENSOR_CFG0_HW_DIV2_ENABLE_SHIFT) |
+#endif
+ (1 << SENSOR_CFG0_STOP_SHIFT));
tsensor_writel(data, config0, ((i << 16) | SENSOR_CFG0));
tsensor_threshold_setup(data, i, true);
@@ -1427,6 +1434,13 @@ static int tegra_tsensor_setup(struct platform_device *pdev)
dev_dbg(&pdev->dev, "\n before tsensor get platform data %s ",
__func__);
tsensor_data = pdev->dev.platform_data;
+#if !ENABLE_TSENSOR_HW_RESET
+ /* FIXME: remove this once tsensor temperature is reliable */
+ tsensor_data->hw_clk_div_temperature = -1;
+ tsensor_data->hw_reset_temperature = -1;
+ tsensor_data->sw_intr_temperature = -1;
+ tsensor_data->hysteresis = -1;
+#endif
dev_dbg(&pdev->dev, "\n tsensor platform_data=0x%x ",
(unsigned int)pdev->dev.platform_data);
dev_dbg(&pdev->dev, "\n clk_div temperature=%d ",