summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMary Ruthven <mruthven@chromium.org>2018-02-16 17:02:49 -0800
committerchrome-bot <chrome-bot@chromium.org>2018-02-20 20:31:53 -0800
commit64a4e6b7045861c57505bcbbc8ad3a5ad6e0e5ed (patch)
treef3fa1135717892ef3809ea34cb14cbd9c4a584bf
parentf483d46b01992dfbaf274aaef4e382ca0091e407 (diff)
downloadchrome-ec-64a4e6b7045861c57505bcbbc8ad3a5ad6e0e5ed.tar.gz
cr50: remove set capabilities from powerbtn
Cr50 cannot override the state of the power button. It was possible with dev cr50 chips, but the capability was removed in prod chips. Change the console command, so it is only used to get the state of the power button. Remove all of the commands used to override the power button. BUG=b:73557298 BRANCH=none TEST=none Change-Id: I99cb5e8a18dd972fba460c434364702f06a26305 Signed-off-by: Mary Ruthven <mruthven@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/926964 Reviewed-by: Randall Spangler <rspangler@chromium.org> Reviewed-by: Vadim Bendebury <vbendeb@chromium.org> Reviewed-by: Brian Norris <briannorris@chromium.org>
-rw-r--r--board/cr50/power_button.c30
-rw-r--r--chip/g/rbox.c25
-rw-r--r--chip/g/rbox.h15
3 files changed, 2 insertions, 68 deletions
diff --git a/board/cr50/power_button.c b/board/cr50/power_button.c
index bf178e893f..96b3bb7774 100644
--- a/board/cr50/power_button.c
+++ b/board/cr50/power_button.c
@@ -84,35 +84,9 @@ void board_physical_presence_enable(int enable)
static int command_powerbtn(int argc, char **argv)
{
- char *e;
- int ms = 200;
-
- if (argc > 1) {
- if (!strcasecmp("pulse", argv[1])) {
- if (argc == 3) {
- ms = strtoi(argv[2], &e, 0);
- if (*e)
- return EC_ERROR_PARAM2;
- }
-
- ccprintf("Force %dms power button press\n", ms);
-
- rbox_powerbtn_press();
- msleep(ms);
- rbox_powerbtn_release();
- } else if (!strcasecmp("press", argv[1])) {
- rbox_powerbtn_press();
- } else if (!strcasecmp("release", argv[1])) {
- rbox_powerbtn_release();
- } else
- return EC_ERROR_PARAM1;
- }
-
ccprintf("powerbtn: %s\n",
- rbox_powerbtn_override_is_enabled() ? "forced press" :
rbox_powerbtn_is_pressed() ? "pressed\n" : "released\n");
return EC_SUCCESS;
}
-DECLARE_CONSOLE_COMMAND(powerbtn, command_powerbtn,
- "[pulse [ms] | press | release]",
- "get/set the state of the power button");
+DECLARE_CONSOLE_COMMAND(powerbtn, command_powerbtn, "",
+ "get the state of the power button");
diff --git a/chip/g/rbox.c b/chip/g/rbox.c
index fc09b8792a..c30e80a871 100644
--- a/chip/g/rbox.c
+++ b/chip/g/rbox.c
@@ -10,36 +10,11 @@
#define POWER_BUTTON 2
-static uint8_t val;
-
int rbox_powerbtn_is_pressed(void)
{
return !GREAD_FIELD(RBOX, CHECK_OUTPUT, PWRB_OUT);
}
-int rbox_powerbtn_override_is_enabled(void)
-{
- return GREAD_FIELD(RBOX, OVERRIDE_OUTPUT, EN) & (1 << POWER_BUTTON);
-}
-
-void rbox_powerbtn_release(void)
-{
- GWRITE_FIELD(RBOX, OVERRIDE_OUTPUT, EN, 0);
- GWRITE_FIELD(RBOX, OVERRIDE_OUTPUT, OEN, 0);
- GWRITE_FIELD(RBOX, OVERRIDE_OUTPUT, VAL, val);
-}
-
-void rbox_powerbtn_press(void)
-{
- if (rbox_powerbtn_override_is_enabled())
- return;
-
- val = GREAD_FIELD(RBOX, OVERRIDE_OUTPUT, VAL);
- GWRITE_FIELD(RBOX, OVERRIDE_OUTPUT, VAL, ~(1 << POWER_BUTTON) & val);
- GWRITE_FIELD(RBOX, OVERRIDE_OUTPUT, OEN, 1 << POWER_BUTTON);
- GWRITE_FIELD(RBOX, OVERRIDE_OUTPUT, EN, 1 << POWER_BUTTON);
-}
-
static void rbox_release_ec_reset(void)
{
/* Unfreeze the PINMUX */
diff --git a/chip/g/rbox.h b/chip/g/rbox.h
index e327faaf8e..5d08118c54 100644
--- a/chip/g/rbox.h
+++ b/chip/g/rbox.h
@@ -10,19 +10,4 @@
* Return true if the power button output shows it is pressed
*/
int rbox_powerbtn_is_pressed(void);
-
-/**
- * Return true if power button rbox output override is enabled
- */
-int rbox_powerbtn_override_is_enabled(void);
-
-/**
- * Disable the output override
- */
-void rbox_powerbtn_release(void);
-
-/**
- * Override power button output to force a power button press
- */
-void rbox_powerbtn_press(void);
#endif /* __CROS_RBOX_H */