summaryrefslogtreecommitdiff
path: root/driver/temp_sensor/g78x.c
diff options
context:
space:
mode:
Diffstat (limited to 'driver/temp_sensor/g78x.c')
-rw-r--r--driver/temp_sensor/g78x.c41
1 files changed, 17 insertions, 24 deletions
diff --git a/driver/temp_sensor/g78x.c b/driver/temp_sensor/g78x.c
index c4fd0ff243..82cb2d26e9 100644
--- a/driver/temp_sensor/g78x.c
+++ b/driver/temp_sensor/g78x.c
@@ -1,4 +1,4 @@
-/* Copyright 2016 The Chromium OS Authors. All rights reserved.
+/* Copyright 2016 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -35,15 +35,14 @@ static int has_power(void)
static int raw_read8(const int offset, int *data_ptr)
{
- return i2c_read8(I2C_PORT_THERMAL, G78X_I2C_ADDR_FLAGS,
- offset, data_ptr);
+ return i2c_read8(I2C_PORT_THERMAL, G78X_I2C_ADDR_FLAGS, offset,
+ data_ptr);
}
#ifdef CONFIG_CMD_TEMP_SENSOR
static int raw_write8(const int offset, int data)
{
- return i2c_write8(I2C_PORT_THERMAL, G78X_I2C_ADDR_FLAGS,
- offset, data);
+ return i2c_write8(I2C_PORT_THERMAL, G78X_I2C_ADDR_FLAGS, offset, data);
}
#endif
@@ -113,10 +112,8 @@ 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 temp_reg,
- const int therm_limit_reg,
- const int high_limit_reg,
+static void print_temps(const char *name, const int temp_reg,
+ const int therm_limit_reg, const int high_limit_reg,
const int low_limit_reg)
{
int value;
@@ -145,19 +142,15 @@ static int print_status(void)
return EC_ERROR_NOT_POWERED;
}
- print_temps("Local", G78X_TEMP_LOCAL,
- G78X_LOCAL_TEMP_THERM_LIMIT,
- G78X_LOCAL_TEMP_HIGH_LIMIT_R,
- G78X_LOCAL_TEMP_LOW_LIMIT_R);
+ print_temps("Local", G78X_TEMP_LOCAL, G78X_LOCAL_TEMP_THERM_LIMIT,
+ G78X_LOCAL_TEMP_HIGH_LIMIT_R, G78X_LOCAL_TEMP_LOW_LIMIT_R);
- print_temps("Remote1", G78X_TEMP_REMOTE1,
- G78X_REMOTE1_TEMP_THERM_LIMIT,
+ print_temps("Remote1", G78X_TEMP_REMOTE1, G78X_REMOTE1_TEMP_THERM_LIMIT,
G78X_REMOTE1_TEMP_HIGH_LIMIT_R,
G78X_REMOTE1_TEMP_LOW_LIMIT_R);
#ifdef CONFIG_TEMP_SENSOR_G782
- print_temps("Remote2", G78X_TEMP_REMOTE1,
- G78X_REMOTE2_TEMP_THERM_LIMIT,
+ print_temps("Remote2", G78X_TEMP_REMOTE1, G78X_REMOTE2_TEMP_THERM_LIMIT,
G78X_REMOTE2_TEMP_HIGH_LIMIT_R,
G78X_REMOTE2_TEMP_LOW_LIMIT_R);
#endif
@@ -165,20 +158,20 @@ static int print_status(void)
ccprintf("\n");
if (raw_read8(G78X_STATUS, &value) == EC_SUCCESS)
- ccprintf("STATUS: %pb\n", BINARY_VALUE(value, 8));
+ ccprintf("STATUS: 0x%x\n", value);
#ifdef CONFIG_TEMP_SENSOR_G782
if (raw_read8(G78X_STATUS1, &value) == EC_SUCCESS)
- ccprintf("STATUS1: %pb\n", BINARY_VALUE(value, 8));
+ ccprintf("STATUS1: 0x%x\n", value);
#endif
if (raw_read8(G78X_CONFIGURATION_R, &value) == EC_SUCCESS)
- ccprintf("CONFIG: %pb\n", BINARY_VALUE(value, 8));
+ ccprintf("CONFIG: 0x%x\n", value);
return EC_SUCCESS;
}
-static int command_g78x(int argc, char **argv)
+static int command_g78x(int argc, const char **argv)
{
char *command;
char *e;
@@ -207,8 +200,7 @@ static int command_g78x(int argc, char **argv)
rv = raw_read8(offset, &data);
if (rv < 0)
return rv;
- ccprintf("Byte at offset 0x%02x is %pb\n",
- offset, BINARY_VALUE(data, 8));
+ ccprintf("Byte at offset 0x%02x is 0x%x\n", offset, data);
return rv;
}
@@ -231,7 +223,8 @@ static int command_g78x(int argc, char **argv)
return rv;
}
-DECLARE_CONSOLE_COMMAND(g78x, command_g78x,
+DECLARE_CONSOLE_COMMAND(
+ g78x, command_g78x,
"[settemp|setbyte <offset> <value>] or [getbyte <offset>]. "
"Temps in Celsius.",
"Print g781/g782 temp sensor status or set parameters.");