summaryrefslogtreecommitdiff
path: root/driver/temp_sensor
diff options
context:
space:
mode:
authorVijay Hiremath <vijay.p.hiremath@intel.com>2015-07-27 12:39:35 -0700
committerChromeOS Commit Bot <chromeos-commit-bot@chromium.org>2015-07-29 21:18:25 +0000
commit1b45f6ed717c8c1a62cbe0698bc2217b69ce1483 (patch)
treed986841aada034e9514c53a4bf849e135e4e652a /driver/temp_sensor
parent511766b6388099ed6894f7209430de145397afc4 (diff)
downloadchrome-ec-1b45f6ed717c8c1a62cbe0698bc2217b69ce1483.tar.gz
Driver: Add macros to conditionally compile the console commands
Added macros to conditionally compile the console commands to save the memory. These macros can be enabled/disabled in the board specific files. BUG=none TEST=make buildall -j BRANCH=none Change-Id: I108a072c333762cd24ea973612202c9cc4d40914 Signed-off-by: Vijay Hiremath <vijay.p.hiremath@intel.com> Reviewed-on: https://chromium-review.googlesource.com/288950 Reviewed-by: Shawn N <shawnn@chromium.org>
Diffstat (limited to 'driver/temp_sensor')
-rw-r--r--driver/temp_sensor/g781.c6
-rw-r--r--driver/temp_sensor/tmp006.c2
-rw-r--r--driver/temp_sensor/tmp432.c6
3 files changed, 14 insertions, 0 deletions
diff --git a/driver/temp_sensor/g781.c b/driver/temp_sensor/g781.c
index c178a37ace..c301588637 100644
--- a/driver/temp_sensor/g781.c
+++ b/driver/temp_sensor/g781.c
@@ -35,10 +35,12 @@ static int raw_read8(const int offset, int *data_ptr)
return i2c_read8(I2C_PORT_THERMAL, G781_I2C_ADDR, offset, data_ptr);
}
+#ifdef CONFIG_CMD_TEMP_SENSOR
static int raw_write8(const int offset, int data)
{
return i2c_write8(I2C_PORT_THERMAL, G781_I2C_ADDR, offset, data);
}
+#endif
static int get_temp(const int offset, int *temp_ptr)
{
@@ -53,6 +55,7 @@ static int get_temp(const int offset, int *temp_ptr)
return EC_SUCCESS;
}
+#ifdef CONFIG_CMD_TEMP_SENSOR
static int set_temp(const int offset, int temp)
{
if (temp < -127 || temp > 127)
@@ -60,6 +63,7 @@ static int set_temp(const int offset, int temp)
return raw_write8(offset, (uint8_t)temp);
}
+#endif
int g781_get_val(int idx, int *temp_ptr)
{
@@ -93,6 +97,7 @@ static void temp_sensor_poll(void)
}
DECLARE_HOOK(HOOK_SECOND, temp_sensor_poll, HOOK_PRIO_TEMP_SENSOR);
+#ifdef CONFIG_CMD_TEMP_SENSOR
static int print_status(void)
{
int value;
@@ -208,3 +213,4 @@ DECLARE_CONSOLE_COMMAND(g781, command_g781,
"[settemp|setbyte <offset> <value>] or [getbyte <offset>]. "
"Temps in Celsius.",
"Print g781 temp sensor status or set parameters.", NULL);
+#endif
diff --git a/driver/temp_sensor/tmp006.c b/driver/temp_sensor/tmp006.c
index 52cd01a85a..a816f20ec2 100644
--- a/driver/temp_sensor/tmp006.c
+++ b/driver/temp_sensor/tmp006.c
@@ -360,6 +360,7 @@ DECLARE_HOST_COMMAND(EC_CMD_TMP006_GET_RAW,
/*****************************************************************************/
/* Console commands */
+#ifdef CONFIG_CMD_TEMP_SENSOR
/**
* Print temperature info for a sensor; used by console command.
*/
@@ -437,6 +438,7 @@ DECLARE_CONSOLE_COMMAND(tmp006, command_sensor_info,
"[ <index> ]",
"Print TMP006 sensors",
NULL);
+#endif
/* Disable the t6cal command until/unless we have FP support in printf */
#if 0
diff --git a/driver/temp_sensor/tmp432.c b/driver/temp_sensor/tmp432.c
index b0f1c056f2..830dbebcd7 100644
--- a/driver/temp_sensor/tmp432.c
+++ b/driver/temp_sensor/tmp432.c
@@ -36,10 +36,12 @@ static int raw_read8(const int offset, int *data_ptr)
return i2c_read8(I2C_PORT_THERMAL, TMP432_I2C_ADDR, offset, data_ptr);
}
+#ifdef CONFIG_CMD_TEMP_SENSOR
static int raw_write8(const int offset, int data)
{
return i2c_write8(I2C_PORT_THERMAL, TMP432_I2C_ADDR, offset, data);
}
+#endif
static int get_temp(const int offset, int *temp_ptr)
{
@@ -54,6 +56,7 @@ static int get_temp(const int offset, int *temp_ptr)
return EC_SUCCESS;
}
+#ifdef CONFIG_CMD_TEMP_SENSOR
static int tmp432_set_temp(const int offset, int temp)
{
if (temp < -127 || temp > 127)
@@ -61,6 +64,7 @@ static int tmp432_set_temp(const int offset, int temp)
return raw_write8(offset, (uint8_t)temp);
}
+#endif
int tmp432_get_val(int idx, int *temp_ptr)
{
@@ -102,6 +106,7 @@ static void temp_sensor_poll(void)
}
DECLARE_HOOK(HOOK_SECOND, temp_sensor_poll, HOOK_PRIO_TEMP_SENSOR);
+#ifdef CONFIG_CMD_TEMP_SENSOR
static void print_temps(
const char *name,
const int tmp432_temp_reg,
@@ -215,3 +220,4 @@ DECLARE_CONSOLE_COMMAND(tmp432, command_tmp432,
"[settemp|setbyte <offset> <value>] or [getbyte <offset>]. "
"Temps in Celsius.",
"Print tmp432 temp sensor status or set parameters.", NULL);
+#endif