diff options
-rw-r--r-- | board/reef_it8320/board.c | 35 | ||||
-rw-r--r-- | common/host_command_pd.c | 34 | ||||
-rw-r--r-- | common/usb_pd_host_cmd.c | 36 |
3 files changed, 36 insertions, 69 deletions
diff --git a/board/reef_it8320/board.c b/board/reef_it8320/board.c index a9af42a492..630f3f950f 100644 --- a/board/reef_it8320/board.c +++ b/board/reef_it8320/board.c @@ -103,41 +103,6 @@ void board_pd_vconn_ctrl(int port, enum usbpd_cc_pin cc_pin, int enabled) } } -/* - * PD host event status for host command - * Note: this variable must be aligned on 4-byte boundary because we pass the - * address to atomic_ functions which use assembly to access them. - */ -static uint32_t pd_host_event_status __aligned(4); - -static enum ec_status -hc_pd_host_event_status(struct host_cmd_handler_args *args) -{ - struct ec_response_host_event_status *r = args->response; - - /* Read and clear the host event status to return to AP */ - r->status = atomic_read_clear(&pd_host_event_status); - - args->response_size = sizeof(*r); - return EC_RES_SUCCESS; -} -DECLARE_HOST_COMMAND(EC_CMD_PD_HOST_EVENT_STATUS, hc_pd_host_event_status, - EC_VER_MASK(0)); - -#if defined(HAS_TASK_HOSTCMD) && !defined(TEST_BUILD) -/* Send host event up to AP */ -void pd_send_host_event(int mask) -{ - /* mask must be set */ - if (!mask) - return; - - atomic_or(&pd_host_event_status, mask); - /* interrupt the AP */ - host_set_single_event(EC_HOST_EVENT_PD_MCU); -} -#endif - const enum gpio_signal hibernate_wake_pins[] = { GPIO_AC_PRESENT, GPIO_LID_OPEN, diff --git a/common/host_command_pd.c b/common/host_command_pd.c index 565ae4cacf..869cad4493 100644 --- a/common/host_command_pd.c +++ b/common/host_command_pd.c @@ -227,37 +227,3 @@ void pd_command_task(void *u) } } -#if defined(USB_TCPM_WITH_OFF_CHIP_TCPC) && defined(CONFIG_HOSTCMD_EVENTS) -/* - * PD host event status for host command - * Note: this variable must be aligned on 4-byte boundary because we pass the - * address to atomic_ functions which use assembly to access them. - */ -static uint32_t pd_host_event_status __aligned(4); - -static enum ec_status -hc_pd_host_event_status(struct host_cmd_handler_args *args) -{ - struct ec_response_host_event_status *r = args->response; - - /* Read and clear the host event status to return to AP */ - r->status = atomic_read_clear(&pd_host_event_status); - - args->response_size = sizeof(*r); - return EC_RES_SUCCESS; -} -DECLARE_HOST_COMMAND(EC_CMD_PD_HOST_EVENT_STATUS, hc_pd_host_event_status, - EC_VER_MASK(0)); - -/* Send host event up to AP */ -void pd_send_host_event(int mask) -{ - /* mask must be set */ - if (!mask) - return; - - atomic_or(&pd_host_event_status, mask); - /* interrupt the AP */ - host_set_single_event(EC_HOST_EVENT_PD_MCU); -} -#endif diff --git a/common/usb_pd_host_cmd.c b/common/usb_pd_host_cmd.c index 8bb96228c0..11345a7624 100644 --- a/common/usb_pd_host_cmd.c +++ b/common/usb_pd_host_cmd.c @@ -7,6 +7,7 @@ #include <string.h> +#include "atomic.h" #include "battery.h" #include "charge_manager.h" #include "console.h" @@ -588,4 +589,39 @@ static enum ec_status pd_control(struct host_cmd_handler_args *args) DECLARE_HOST_COMMAND(EC_CMD_PD_CONTROL, pd_control, EC_VER_MASK(0)); #endif /* CONFIG_HOSTCMD_PD_CONTROL */ +#if !defined(CONFIG_USB_PD_TCPM_STUB) && !defined(TEST_BUILD) +/* + * PD host event status for host command + * Note: this variable must be aligned on 4-byte boundary because we pass the + * address to atomic_ functions which use assembly to access them. + */ +static uint32_t pd_host_event_status __aligned(4); + +static enum ec_status +hc_pd_host_event_status(struct host_cmd_handler_args *args) +{ + struct ec_response_host_event_status *r = args->response; + + /* Read and clear the host event status to return to AP */ + r->status = atomic_read_clear(&pd_host_event_status); + + args->response_size = sizeof(*r); + return EC_RES_SUCCESS; +} +DECLARE_HOST_COMMAND(EC_CMD_PD_HOST_EVENT_STATUS, hc_pd_host_event_status, + EC_VER_MASK(0)); + +/* Send host event up to AP */ +void pd_send_host_event(int mask) +{ + /* mask must be set */ + if (!mask) + return; + + atomic_or(&pd_host_event_status, mask); + /* interrupt the AP */ + host_set_single_event(EC_HOST_EVENT_PD_MCU); +} +#endif /* ! CONFIG_USB_PD_TCPM_STUB && ! TEST_BUILD */ + #endif /* HAS_TASK_HOSTCMD */ |