summaryrefslogtreecommitdiff
path: root/arch/arm/mach-tegra/tegra3_tsensor.c
diff options
context:
space:
mode:
authorBitan Biswas <bbiswas@nvidia.com>2011-06-10 13:09:00 +0530
committerDan Willemsen <dwillemsen@nvidia.com>2011-11-30 21:47:25 -0800
commit82323cafdf23cf57cab48f18083e0d4e1bef3ed0 (patch)
tree6a42a3d846186337ea583d266c33dd5c3b685534 /arch/arm/mach-tegra/tegra3_tsensor.c
parent3a515d19515bed05ed720e8b34a86f9be04a766f (diff)
arm: tegra: tsensor: driver instantiation
Tegra internal tsensor driver supported for fuse revision 0.8 and above. Bug 661228 Original-Change-Id: I820f6b5f20c20bb2d1ba04266148f5969ab84444 Reviewed-on: http://git-master/r/36054 Reviewed-by: Varun Colbert <vcolbert@nvidia.com> Tested-by: Varun Colbert <vcolbert@nvidia.com> Rebase-Id: R4725524b5e3f83b4cd3dd7d0020ef2d6e09a87d0
Diffstat (limited to 'arch/arm/mach-tegra/tegra3_tsensor.c')
-rw-r--r--arch/arm/mach-tegra/tegra3_tsensor.c57
1 files changed, 57 insertions, 0 deletions
diff --git a/arch/arm/mach-tegra/tegra3_tsensor.c b/arch/arm/mach-tegra/tegra3_tsensor.c
new file mode 100644
index 000000000000..cbf5c5ab2522
--- /dev/null
+++ b/arch/arm/mach-tegra/tegra3_tsensor.c
@@ -0,0 +1,57 @@
+/*
+ * arch/arm/mach-tegra/tegra3_tsensor.c
+ *
+ * Copyright (C) 2011 NVIDIA Corporation.
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ */
+
+#include <linux/kernel.h>
+#include <linux/init.h>
+#include "board.h"
+
+#ifdef CONFIG_SENSORS_TEGRA_TSENSOR
+#include <mach/tsensor.h>
+#include "devices.h"
+#include "fuse.h"
+
+static struct tegra_tsensor_platform_data tsensor_data = {
+ .hysteresis = 5,
+ .sw_intr_temperature = 75,
+ .hw_clk_div_temperature = 80,
+ .hw_reset_temperature = 90,
+};
+
+/* fuse revision constants used for tsensor */
+#define FUSE_TEST_PROGRAM_REVISION_0 0x128
+#define TSENSOR_FUSE_REVISION_DECIMAL 8
+#define TSENSOR_FUSE_REVISION_INTEGER 0
+
+void __init tegra_tsensor_init(void)
+{
+ unsigned int reg, fuse_rev_integer, fuse_rev_decimal;
+ /* tsensor driver is instantiated based on fuse revision */
+ reg = tegra_fuse_readl(FUSE_TEST_PROGRAM_REVISION_0);
+ fuse_rev_decimal = (reg & 0xf);
+ fuse_rev_integer = ((reg >> 4) & 0x7);
+ pr_info("\nTegra3 fuse revision %d.%d \n", fuse_rev_integer,
+ fuse_rev_decimal);
+ if ((fuse_rev_decimal >= TSENSOR_FUSE_REVISION_DECIMAL) &&
+ (fuse_rev_integer >= TSENSOR_FUSE_REVISION_INTEGER)) {
+ /* set platform data for device before register */
+ tegra_tsensor_device.dev.platform_data = &tsensor_data;
+ platform_device_register(&tegra_tsensor_device);
+ }
+}
+#else
+void __init tegra_tsensor_init(void) { }
+#endif
+