ryu: Select pwr btn polarity based on board id

Proto 0,1,2 boards had pwr btn active high. Proto 3 onwards boards will have pwr
btn active low. Thus, select power btn polarity based on board id.

BUG=chrome-os-partner:33545
BRANCH=None
TEST=Compiles successfully and boots to kernel prompt on ryu proto 1.

Change-Id: I9b06b10358b91d40cfdb418ef8cf4da1ae833121
Signed-off-by: Patrick Georgi <pgeorgi@chromium.org>
Original-Commit-Id: 7100a42b53a09ed4cb298f88d6f804f46fecacb5
Original-Change-Id: Icdf51b9324385de00f5787e81018518c5397215f
Original-Signed-off-by: Furquan Shaikh <furquan@google.com>
Original-Reviewed-on: https://chromium-review.googlesource.com/229011
Original-Tested-by: Furquan Shaikh <furquan@chromium.org>
Original-Reviewed-by: Aaron Durbin <adurbin@chromium.org>
Original-Commit-Queue: Furquan Shaikh <furquan@chromium.org>
Reviewed-on: http://review.coreboot.org/9418
Tested-by: build bot (Jenkins)
Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
This commit is contained in:
Furquan Shaikh 2014-11-10 23:22:01 -08:00 committed by Patrick Georgi
parent a545778d13
commit ad73c4521b
3 changed files with 16 additions and 7 deletions

View File

@ -17,6 +17,7 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/ */
#include <boardid.h>
#include <boot/coreboot_tables.h> #include <boot/coreboot_tables.h>
#include <console/console.h> #include <console/console.h>
#include <ec/google/chromeec/ec.h> #include <ec/google/chromeec/ec.h>
@ -26,6 +27,14 @@
#include "gpio.h" #include "gpio.h"
static inline uint32_t get_pwr_btn_polarity(void)
{
if (board_id() < BOARD_ID_PROTO_3)
return ACTIVE_HIGH;
return ACTIVE_LOW;
}
void fill_lb_gpios(struct lb_gpios *gpios) void fill_lb_gpios(struct lb_gpios *gpios)
{ {
int count = 0; int count = 0;
@ -48,9 +57,9 @@ void fill_lb_gpios(struct lb_gpios *gpios)
/* TODO(adurbin): add lid switch */ /* TODO(adurbin): add lid switch */
/* Power: active low */ /* Power: active low / high depending on board id */
gpios->gpios[count].port = POWER_BUTTON_INDEX, gpios->gpios[count].port = POWER_BUTTON_INDEX;
gpios->gpios[count].polarity = ACTIVE_HIGH; gpios->gpios[count].polarity = get_pwr_btn_polarity();
gpios->gpios[count].value = gpio_get(POWER_BUTTON); gpios->gpios[count].value = gpio_get(POWER_BUTTON);
strncpy((char *)gpios->gpios[count].name, "power", strncpy((char *)gpios->gpios[count].name, "power",
GPIO_MAX_NAME_LENGTH); GPIO_MAX_NAME_LENGTH);

View File

@ -58,9 +58,9 @@ enum {
SPI_1V8_WP_L = GPIO(R1), SPI_1V8_WP_L = GPIO(R1),
WRITE_PROTECT_L = SPI_1V8_WP_L, WRITE_PROTECT_L = SPI_1V8_WP_L,
WRITE_PROTECT_L_INDEX = GPIO_R1_INDEX, WRITE_PROTECT_L_INDEX = GPIO_R1_INDEX,
/* Power Button -- actually active high, but the net names are off. */ /* Power button - Depending on board id, maybe active high / low */
BTN_AP_PWR_L = GPIO(Q0), BTN_AP_PWR = GPIO(Q0),
POWER_BUTTON = BTN_AP_PWR_L, POWER_BUTTON = BTN_AP_PWR,
POWER_BUTTON_INDEX = GPIO_Q0_INDEX, POWER_BUTTON_INDEX = GPIO_Q0_INDEX,
}; };

View File

@ -39,7 +39,7 @@ static const struct pad_config padcfgs[] = {
PAD_CFG_GPIO_OUT0(KB_ROW12, PINMUX_PULL_DOWN), PAD_CFG_GPIO_OUT0(KB_ROW12, PINMUX_PULL_DOWN),
/* MDM_DET - expected to be pulled down by LTE modem */ /* MDM_DET - expected to be pulled down by LTE modem */
PAD_CFG_GPIO_INPUT(GPIO_PV1, PINMUX_PULL_UP), PAD_CFG_GPIO_INPUT(GPIO_PV1, PINMUX_PULL_UP),
/* Power Button - active high */ /* Power Button - active high / low depending on board id */
PAD_CFG_GPIO_INPUT(KB_COL0, PINMUX_PULL_UP), PAD_CFG_GPIO_INPUT(KB_COL0, PINMUX_PULL_UP),
/* BTN_AP_VOLD_L - active low */ /* BTN_AP_VOLD_L - active low */
PAD_CFG_GPIO_INPUT(KB_COL6, PINMUX_PULL_UP), PAD_CFG_GPIO_INPUT(KB_COL6, PINMUX_PULL_UP),