From 0fa3702aa6e265b44a27c2ffc62009043da9e558 Mon Sep 17 00:00:00 2001
From: Rahix <rahix@rahix.de>
Date: Mon, 19 Aug 2019 16:50:24 +0200
Subject: [PATCH] fix(libcard10): Initialize GPIO before PMIC

pmic_init() uses the GPIO API internally to set up the PMIC
interrupt handler.  This does not work properly if called before
GPIO_Init() and will lead to the power-button never interrupting
Epicardium.

Fixes #83.

Signed-off-by: Rahix <rahix@rahix.de>
---
 lib/card10/card10.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/card10/card10.c b/lib/card10/card10.c
index 35cd1a58..16346737 100644
--- a/lib/card10/card10.c
+++ b/lib/card10/card10.c
@@ -41,6 +41,8 @@ void card10_init(void)
 	I2C_Shutdown(MXC_I2C1_BUS0);
 	I2C_Init(MXC_I2C1_BUS0, I2C_FAST_MODE, NULL);
 
+	GPIO_Init();
+
 	pmic_init();
 	pmic_set_led(0, 0);
 	pmic_set_led(1, 0);
@@ -48,8 +50,6 @@ void card10_init(void)
 
 	portexpander_init();
 
-	GPIO_Init();
-
 	PB_Init();
 
 	TMR_Delay(MXC_TMR0, MSEC(1000), 0);
-- 
GitLab