Skip to content

Commit 183cb10

Browse files
committed
fwk: implement host command to return chassis status
Signed-off-by: Josh-Tsai <josh_tsai@compal.com>
1 parent 233785e commit 183cb10

File tree

2 files changed

+23
-0
lines changed

2 files changed

+23
-0
lines changed

zephyr/program/lotus/include/board_host_command.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,16 @@ struct ec_response_fp_led_level {
200200
uint8_t level;
201201
} __ec_align1;
202202

203+
/*****************************************************************************/
204+
/*
205+
* This command return the chassis status
206+
*/
207+
#define EC_CMD_CHASSIS_OPEN_CHECK 0x3E0F
208+
209+
struct ec_response_chassis_open_check {
210+
uint8_t status;
211+
} __ec_align1;
212+
203213
/*****************************************************************************/
204214
/*
205215
* This command uses to notify the EC that the system is in ACPI mode.

zephyr/program/lotus/src/board_host_command.c

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -269,6 +269,19 @@ static enum ec_status fp_led_level_control(struct host_cmd_handler_args *args)
269269
}
270270
DECLARE_HOST_COMMAND(EC_CMD_FP_LED_LEVEL_CONTROL, fp_led_level_control, EC_VER_MASK(0));
271271

272+
static enum ec_status chassis_open_check(struct host_cmd_handler_args *args)
273+
{
274+
struct ec_response_chassis_open_check *r = args->response;
275+
int status = gpio_pin_get_dt(GPIO_DT_FROM_NODELABEL(gpio_chassis_open_l));
276+
277+
r->status = !status & 0x01;
278+
args->response_size = sizeof(*r);
279+
280+
return EC_RES_SUCCESS;
281+
282+
}
283+
DECLARE_HOST_COMMAND(EC_CMD_CHASSIS_OPEN_CHECK, chassis_open_check, EC_VER_MASK(0));
284+
272285
static enum ec_status enter_acpi_mode(struct host_cmd_handler_args *args)
273286
{
274287
hook_call_deferred(&sci_enable_data, 250 * MSEC);

0 commit comments

Comments
 (0)