Files
OpenCellular/common/temp_sensor_commands.c
Vic Yang dfe22b2b1e Add back LPC temperature read command as workaround.
Until we solve the I2C hanging issue, we need a reliable way to read
temperature. Add back LPC temperature read command that actually trigger
a I2C read.

Signed-off-by: Vic Yang <victoryang@google.com>

BUG=chrome-os-partner:8452,chrome-os-partner:8495
TEST=none

Change-Id: Icddd1fe3c1f09889bca633af19041a8aca582de9
2012-03-14 20:53:42 +08:00

40 lines
1.2 KiB
C

/* Copyright (c) 2011 The Chromium OS Authors. All rights reserved.
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
/* Temperature sensor module for Chrome EC */
/* This LPC command only serves as a workaround to provide reliable temperature
* reading method until we solve the I2C hanging issue. Remove this when
* possible. */
#include "console.h"
#include "host_command.h"
#include "temp_sensor.h"
#include "temp_sensor_commands.h"
#include "lpc_commands.h"
#include "uart.h"
#include "util.h"
/*****************************************************************************/
/* Host commands */
enum lpc_status temp_sensor_command_get_readings(uint8_t *data)
{
struct lpc_params_temp_sensor_get_readings *p =
(struct lpc_params_temp_sensor_get_readings *)data;
struct lpc_response_temp_sensor_get_readings *r =
(struct lpc_response_temp_sensor_get_readings *)data;
int rv;
rv = temp_sensor_read(p->temp_sensor_id);
if (rv == -1)
return EC_LPC_RESULT_ERROR;
r->value = rv;
return EC_LPC_RESULT_SUCCESS;
}
DECLARE_HOST_COMMAND(EC_LPC_COMMAND_TEMP_SENSOR_GET_READINGS,
temp_sensor_command_get_readings);