mdm9615: Add calibration data for TSENS

MDM9615 has identical configuration for the number
of sensors and slope with MSM8960. Add support to
enable the TSENS for calibrated parts.

Change-Id: Ieb1f118ce916ab5a4f079b18b11541d86c3a5560
Signed-off-by: Siddartha Mohanadoss <smohanad@codeaurora.org>
diff --git a/arch/arm/mach-msm/board-9615.c b/arch/arm/mach-msm/board-9615.c
index a557764..8fe55ff 100644
--- a/arch/arm/mach-msm/board-9615.c
+++ b/arch/arm/mach-msm/board-9615.c
@@ -23,6 +23,7 @@
 #include <linux/leds.h>
 #include <linux/leds-pm8xxx.h>
 #include <linux/power/ltc4088-charger.h>
+#include <linux/msm_tsens.h>
 #include <asm/mach-types.h>
 #include <asm/mach/arch.h>
 #include <asm/hardware/gic.h>
@@ -508,6 +509,13 @@
 };
 #endif
 
+static struct tsens_platform_data msm_tsens_pdata  = {
+	.tsens_factor		= 1000,
+	.hw_type		= MDM_9615,
+	.tsens_num_sensor	= 5,
+	.slope = {1176, 1176, 1154, 1176, 1111},
+};
+
 static struct platform_device *common_devices[] = {
 	&msm9615_device_dmov,
 	&msm_device_smd,
@@ -530,7 +538,6 @@
 	&msm9615_device_qup_spi_gsbi3,
 	&msm_device_sps,
 	&msm9615_slim_ctrl,
-	&msm9615_device_tsens,
 	&msm_device_nand,
 	&msm_device_bam_dmux,
 	&msm9615_rpm_device,
@@ -599,6 +606,7 @@
 	msm_cpuidle_set_states(msm_cstates, ARRAY_SIZE(msm_cstates),
 						msm_pm_data);
 	BUG_ON(msm_pm_boot_init(&msm_pm_boot_pdata));
+	msm_tsens_early_init(&msm_tsens_pdata);
 }
 
 static void __init msm9615_cdp_init(void)
diff --git a/arch/arm/mach-msm/devices-9615.c b/arch/arm/mach-msm/devices-9615.c
index 28dceb0..8894b4b 100644
--- a/arch/arm/mach-msm/devices-9615.c
+++ b/arch/arm/mach-msm/devices-9615.c
@@ -15,7 +15,6 @@
 #include <linux/platform_device.h>
 #include <linux/irq.h>
 #include <linux/io.h>
-#include <linux/msm_tsens.h>
 #include <linux/platform_data/qcom_crypto_device.h>
 #include <linux/dma-mapping.h>
 #include <asm/hardware/gic.h>
@@ -442,21 +441,6 @@
 	.dev.platform_data = &msm_sps_pdata,
 };
 
-static struct tsens_platform_data msm_tsens_pdata = {
-	.slope			= {872, 872, 872, 872, 872},
-	.tsens_factor		= 1000,
-	.hw_type		= MSM_9615,
-	.tsens_num_sensor	= 5,
-};
-
-struct platform_device msm9615_device_tsens = {
-	.name		= "tsens8960-tm",
-	.id		= -1,
-	.dev 		= {
-		.platform_data = &msm_tsens_pdata,
-	},
-};
-
 #define MSM_NAND_PHYS		0x1B400000
 static struct resource resources_nand[] = {
 	[0] = {
diff --git a/drivers/thermal/msm8960_tsens.c b/drivers/thermal/msm8960_tsens.c
index c38b279..71df297 100644
--- a/drivers/thermal/msm8960_tsens.c
+++ b/drivers/thermal/msm8960_tsens.c
@@ -278,7 +278,7 @@
 			}
 			writel_relaxed(reg | TSENS_SW_RST, TSENS_CNTL_ADDR);
 			if (tmdev->hw_type == MSM_8960 ||
-				tmdev->hw_type == MSM_9615 ||
+				tmdev->hw_type == MDM_9615 ||
 				tmdev->hw_type == APQ_8064)
 				reg |= mask | TSENS_8960_SLP_CLK_ENA
 							| TSENS_EN;
@@ -294,7 +294,7 @@
 						TSENS_8960_SLP_CLK_ENA |
 						TSENS_EN);
 				else if (tmdev->hw_type == MSM_8960 ||
-						tmdev->hw_type == MSM_9615)
+						tmdev->hw_type == MDM_9615)
 					reg &= ~(SENSORS_EN |
 						TSENS_8960_SLP_CLK_ENA |
 						TSENS_EN);
@@ -677,7 +677,7 @@
 	unsigned int reg_cntl = 0;
 
 	reg_cntl = readl_relaxed(TSENS_CNTL_ADDR);
-	if (tmdev->hw_type == MSM_8960 || tmdev->hw_type == MSM_9615 ||
+	if (tmdev->hw_type == MSM_8960 || tmdev->hw_type == MDM_9615 ||
 			tmdev->hw_type == APQ_8064) {
 		writel_relaxed(reg_cntl &
 				~((((1 << tmdev->tsens_num_sensor) - 1) >> 1)
@@ -691,7 +691,7 @@
 	unsigned int reg_cntl = 0;
 
 	reg_cntl = readl_relaxed(TSENS_CNTL_ADDR);
-	if (tmdev->hw_type == MSM_8960 || tmdev->hw_type == MSM_9615 ||
+	if (tmdev->hw_type == MSM_8960 || tmdev->hw_type == MDM_9615 ||
 			tmdev->hw_type == APQ_8064)
 		writel_relaxed(reg_cntl &
 				~((((1 << tmdev->tsens_num_sensor) - 1) <<
@@ -712,7 +712,7 @@
 	reg_cntl = readl_relaxed(TSENS_CNTL_ADDR);
 	writel_relaxed(reg_cntl | TSENS_SW_RST, TSENS_CNTL_ADDR);
 
-	if (tmdev->hw_type == MSM_8960 || tmdev->hw_type == MSM_9615) {
+	if (tmdev->hw_type == MSM_8960 || tmdev->hw_type == MDM_9615) {
 		reg_cntl |= TSENS_8960_SLP_CLK_ENA |
 			(TSENS_MEASURE_PERIOD << 18) |
 			TSENS_LOWER_STATUS_CLR | TSENS_UPPER_STATUS_CLR |
@@ -853,7 +853,7 @@
 
 	if (tmdev->hw_type == MSM_8660)
 		rc = tsens_calib_sensors8660();
-	else if (tmdev->hw_type == MSM_8960 || tmdev->hw_type == MSM_9615 ||
+	else if (tmdev->hw_type == MSM_8960 || tmdev->hw_type == MDM_9615 ||
 		tmdev->hw_type == APQ_8064)
 		rc = tsens_calib_sensors8960();
 
diff --git a/include/linux/msm_tsens.h b/include/linux/msm_tsens.h
index 99b5acd..f5472ec 100644
--- a/include/linux/msm_tsens.h
+++ b/include/linux/msm_tsens.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, Code Aurora Forum. All rights reserved.
+ * Copyright (c) 2011-2012, Code Aurora Forum. All rights reserved.
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License version 2 and
@@ -21,7 +21,7 @@
 enum platform_type {
 	MSM_8660 = 0,
 	MSM_8960,
-	MSM_9615,
+	MDM_9615,
 	APQ_8064,
 	MSM_TYPE
 };