Files
OpenCellular/common/thermal_commands.c
Randall Spangler 247fdaf13d Change host command params/response pointers to void *
This removes a bunch of unnecessary typecasts, since you can assign
to/from void * without them.  This also uncovered a few cases where
const was being cast away for the input params; now fixed.

BUG=none
TEST=mkbp hash from u-boot console, and/or system boots ok

Change-Id: Ic314b9d2ca06226ea8a09703ef5c1a912eb7146d
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/28500
2012-07-26 16:25:34 -07:00

53 lines
1.4 KiB
C

/* Copyright (c) 2012 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.
*/
/* Thermal engine host commands for Chrome EC */
#include "common.h"
#include "host_command.h"
#include "thermal.h"
int thermal_command_set_threshold(struct host_cmd_handler_args *args)
{
const struct ec_params_thermal_set_threshold *p = args->params;
if (thermal_set_threshold(p->sensor_type, p->threshold_id, p->value))
return EC_RES_ERROR;
return EC_RES_SUCCESS;
}
DECLARE_HOST_COMMAND(EC_CMD_THERMAL_SET_THRESHOLD,
thermal_command_set_threshold,
EC_VER_MASK(0));
int thermal_command_get_threshold(struct host_cmd_handler_args *args)
{
const struct ec_params_thermal_get_threshold *p = args->params;
struct ec_response_thermal_get_threshold *r = args->response;
int value = thermal_get_threshold(p->sensor_type, p->threshold_id);
if (value == -1)
return EC_RES_ERROR;
r->value = value;
args->response_size = sizeof(*r);
return EC_RES_SUCCESS;
}
DECLARE_HOST_COMMAND(EC_CMD_THERMAL_GET_THRESHOLD,
thermal_command_get_threshold,
EC_VER_MASK(0));
int thermal_command_auto_fan_ctrl(struct host_cmd_handler_args *args)
{
if (thermal_toggle_auto_fan_ctrl(1))
return EC_RES_ERROR;
return EC_RES_SUCCESS;
}
DECLARE_HOST_COMMAND(EC_CMD_THERMAL_AUTO_FAN_CTRL,
thermal_command_auto_fan_ctrl,
EC_VER_MASK(0));