[U-Boot] [PATCH 6/7 v5] TMU: Add TMU support in dtt command
Akshay Saraswat
akshay.s at samsung.com
Mon Jan 21 12:11:44 CET 2013
Add generic TMU support alongwith i2c sensors in dtt command
to enable temperature reading in cases where TMU is present
instead of i2c sensors.
Signed-off-by: Akshay Saraswat <akshay.s at samsung.com>
---
Changes since v4:
- Removed tmu command and added to dtt.
common/cmd_dtt.c | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)
diff --git a/common/cmd_dtt.c b/common/cmd_dtt.c
index cd94423..715f4ba 100644
--- a/common/cmd_dtt.c
+++ b/common/cmd_dtt.c
@@ -28,6 +28,20 @@
#include <dtt.h>
#include <i2c.h>
+#if defined CONFIG_TMU_CMD_DTT
+#include <tmu.h>
+
+void dtt_get_temp(void)
+{
+ int cur_temp;
+
+ if (tmu_monitor(&cur_temp) == TMU_STATUS_INIT)
+ printf("TMU is in unknown state, temperature is invalid \n");
+ else
+ printf("Current temperature: %u degrees Celsius \n", cur_temp);
+}
+
+#else
static unsigned long sensor_initialized;
static void _initialize_dtt(void)
@@ -59,9 +73,13 @@ void dtt_init(void)
/* switch back to original I2C bus */
I2C_SET_BUS(old_bus);
}
+#endif
int do_dtt (cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
{
+#if defined CONFIG_TMU_CMD_DTT
+ dtt_get_temp();
+#else
int i;
unsigned char sensors[] = CONFIG_DTT_SENSORS;
int old_bus;
@@ -83,6 +101,7 @@ int do_dtt (cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
/* switch back to original I2C bus */
I2C_SET_BUS(old_bus);
+#endif
return 0;
} /* do_dtt() */
--
1.7.9.5
More information about the U-Boot
mailing list