aboutsummaryrefslogtreecommitdiff
path: root/src/mainboard/google/rush_ryu/chromeos.c
diff options
context:
space:
mode:
authorFurquan Shaikh <furquan@google.com>2014-11-10 23:22:01 -0800
committerPatrick Georgi <pgeorgi@google.com>2015-04-10 12:00:37 +0200
commitad73c4521b3512522d4b1728a5c280ae677f12f4 (patch)
tree489e02f5768eb88ea4d4b9f373620a1c9148ed75 /src/mainboard/google/rush_ryu/chromeos.c
parenta545778d133958712e0d7b317600bf066d688e22 (diff)
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>
Diffstat (limited to 'src/mainboard/google/rush_ryu/chromeos.c')
-rw-r--r--src/mainboard/google/rush_ryu/chromeos.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/src/mainboard/google/rush_ryu/chromeos.c b/src/mainboard/google/rush_ryu/chromeos.c
index f752aeee6c..2fd9bb1048 100644
--- a/src/mainboard/google/rush_ryu/chromeos.c
+++ b/src/mainboard/google/rush_ryu/chromeos.c
@@ -17,6 +17,7 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#include <boardid.h>
#include <boot/coreboot_tables.h>
#include <console/console.h>
#include <ec/google/chromeec/ec.h>
@@ -26,6 +27,14 @@
#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)
{
int count = 0;
@@ -48,9 +57,9 @@ void fill_lb_gpios(struct lb_gpios *gpios)
/* TODO(adurbin): add lid switch */
- /* Power: active low */
- gpios->gpios[count].port = POWER_BUTTON_INDEX,
- gpios->gpios[count].polarity = ACTIVE_HIGH;
+ /* Power: active low / high depending on board id */
+ gpios->gpios[count].port = POWER_BUTTON_INDEX;
+ gpios->gpios[count].polarity = get_pwr_btn_polarity();
gpios->gpios[count].value = gpio_get(POWER_BUTTON);
strncpy((char *)gpios->gpios[count].name, "power",
GPIO_MAX_NAME_LENGTH);