thermal: msm8960: Check for SOC version
8960 TSENS is not supported on V1 version. Enable it only
for V2 version.
Signed-off-by: Siddartha Mohanadoss <smohanad@codeaurora.org>
diff --git a/drivers/thermal/msm8960_tsens.c b/drivers/thermal/msm8960_tsens.c
index 87ea567..eb244d4 100644
--- a/drivers/thermal/msm8960_tsens.c
+++ b/drivers/thermal/msm8960_tsens.c
@@ -25,6 +25,7 @@
#include <linux/io.h>
#include <mach/msm_iomap.h>
+#include <mach/socinfo.h>
/* Trips: from very hot to very cold */
enum tsens_trip_type {
@@ -715,6 +716,16 @@
return 0;
}
+static int tsens_check_version_support(void)
+{
+ int rc = 0;
+
+ if (tmdev->hw_type == MSM_8960)
+ if (SOCINFO_VERSION_MAJOR(socinfo_get_version()) == 1)
+ rc = -ENODEV;
+ return rc;
+}
+
static int tsens_calib_sensors(void)
{
int rc;
@@ -752,6 +763,12 @@
tmdev->tsens_num_sensor = pdata->tsens_num_sensor;
tmdev->hw_type = pdata->hw_type;
+ rc = tsens_check_version_support();
+ if (rc < 0) {
+ kfree(tmdev);
+ return rc;
+ }
+
rc = tsens_calib_sensors();
if (rc < 0) {
kfree(tmdev);