mirror of
https://github.com/Telecominfraproject/OpenCellular.git
synced 2025-12-27 18:25:05 +00:00
Ryu: Add a console command to control the buttons VolUp and VolDown
(cherry-pick back to ToT) FAFT needs these buttons (VolUp and VolDown) be controllable such that it can automate the firmware mode switching flows. It is done by EC overwriting the GPIO values such that AP can see the results. BRANCH=ToT,smaug BUG=None TEST=AP boots into the firmware menu screen. Run the following commands in EC console: > btnpress voldown 1 > btnpress voldown 0 # See the next option selected, like a real button pressed > btnpress volup 1 > btnpress volup 0 # Boot in the selected option, like a real button pressed > btnpress volup Button volup pressed = 0 Change-Id: I5e0b514d9986b8e5729ffd3560560d650669e0b7 Signed-off-by: Vic Yang <victoryang@google.com> Signed-off-by: Tom Wai-Hong Tam <waihong@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/294882 Reviewed-by: Randall Spangler <rspangler@chromium.org> (cherry picked from commit 77291b156d10f31dd059a4662aa249a8f8ea762e) Reviewed-on: https://chromium-review.googlesource.com/295162
This commit is contained in:
committed by
ChromeOS Commit Bot
parent
456d1baa25
commit
38ddecb897
@@ -561,3 +561,45 @@ static int host_event_status_host_cmd(struct host_cmd_handler_args *args)
|
||||
}
|
||||
DECLARE_HOST_COMMAND(EC_CMD_PD_HOST_EVENT_STATUS, host_event_status_host_cmd,
|
||||
EC_VER_MASK(0));
|
||||
|
||||
/****************************************************************************/
|
||||
/* Console commands */
|
||||
|
||||
static int cmd_btn_press(int argc, char **argv)
|
||||
{
|
||||
enum gpio_signal gpio;
|
||||
char *e;
|
||||
int v;
|
||||
|
||||
if (argc < 2)
|
||||
return EC_ERROR_PARAM_COUNT;
|
||||
|
||||
if (!strcasecmp(argv[1], "volup"))
|
||||
gpio = GPIO_BTN_VOLU_L;
|
||||
else if (!strcasecmp(argv[1], "voldown"))
|
||||
gpio = GPIO_BTN_VOLD_L;
|
||||
else
|
||||
return EC_ERROR_PARAM1;
|
||||
|
||||
if (argc < 3) {
|
||||
/* Just reading */
|
||||
ccprintf("Button %s pressed = %d\n", argv[1],
|
||||
!gpio_get_level(gpio));
|
||||
return EC_SUCCESS;
|
||||
}
|
||||
|
||||
v = strtoi(argv[2], &e, 0);
|
||||
if (*e)
|
||||
return EC_ERROR_PARAM2;
|
||||
|
||||
if (v)
|
||||
gpio_set_flags(gpio, GPIO_OUT_LOW);
|
||||
else
|
||||
gpio_set_flags(gpio, GPIO_INPUT | GPIO_PULL_UP);
|
||||
|
||||
return EC_SUCCESS;
|
||||
}
|
||||
DECLARE_CONSOLE_COMMAND(btnpress, cmd_btn_press,
|
||||
"<volup|voldown> [0|1]",
|
||||
"Simulate button press",
|
||||
NULL);
|
||||
|
||||
@@ -26,8 +26,8 @@ GPIO(CAM_SYNC_INT_L, PIN(C, 7), GPIO_INT_FALLING)
|
||||
GPIO(COMPASS_DRDY, PIN(A, 8), GPIO_INPUT)
|
||||
|
||||
/* Buttons */
|
||||
GPIO(BTN_VOLD_L, PIN(C, 0), GPIO_INPUT | GPIO_PULL_UP)
|
||||
GPIO(BTN_VOLU_L, PIN(A, 2), GPIO_INPUT | GPIO_PULL_UP)
|
||||
GPIO(BTN_VOLD_L, PIN(C, 0), GPIO_ODR_HIGH | GPIO_PULL_UP)
|
||||
GPIO(BTN_VOLU_L, PIN(A, 2), GPIO_ODR_HIGH | GPIO_PULL_UP)
|
||||
|
||||
/* PD RX/TX */
|
||||
GPIO(USBC_CC1_PD, PIN(A, 1), GPIO_ANALOG)
|
||||
|
||||
Reference in New Issue
Block a user