pandora: Re-organize the GPIO button definitions.
authorUrja Rannikko <urjaman@gmail.com>
Tue, 25 Jun 2013 04:15:30 +0000 (05:15 +0100)
committerGrazvydas Ignotas <notasas@gmail.com>
Sun, 3 Jul 2016 00:10:28 +0000 (03:10 +0300)
Should have no difference in code.

Signed-off-by: Urja Rannikko <urjaman@gmail.com>
board/pandora/kbd.c
board/pandora/menu.c
board/pandora/pandora-buttons.h [new file with mode: 0644]

index 5bfef4f..f35f2d1 100644 (file)
@@ -48,6 +48,8 @@
 #include <asm/arch/sys_proto.h>
 #include <asm/mach-types.h>
 
+#include "pandora-buttons.h"
+
 DECLARE_GLOBAL_DATA_PTR;
 
 #ifdef CONFIG_KEYBOARD
@@ -179,13 +181,14 @@ int twl4030_kbd_tstc(void)
                if (keys[7]&0x08) mods |= 4; /* Shift */
 
                /* Add L from GPIOs as shift also */
-               if (!(readl(&gpio4_base->datain) & GPIO6)) /* R */
+               if (!(readl(&gpio4_base->datain) & BTN_L)) /* L */
                        mods |= 4;
 
                /* Add ctrl state from the GPIOs (R or select) */
-               if (!(readl(&gpio4_base->datain) & GPIO9)) /* R */
+               if (!(readl(&gpio4_base->datain) & BTN_R)) /* R */
                        mods |= 1;
-               if (!(readl(&gpio4_base->datain) & GPIO8)) /* Select */
+
+               if (!(readl(&gpio4_base->datain) & BTN_SELECT)) /* Select */
                        mods |= 1;
 
                for (c = 0; c < 8; c++) {
index eba4595..d14527b 100644 (file)
@@ -6,12 +6,7 @@
 #include <lcd.h>
 #include <twl4030.h>
 
-/* game buttons as in GPIO bank 4 */
-#define BTN_R          GPIO9
-#define BTN_UP         GPIO14
-#define BTN_DOWN       GPIO7
-#define BTN_G2         GPIO15
-#define BTN_G3         GPIO10
+#include "pandora-buttons.h"
 
 struct menu_item {
        const char *name;
diff --git a/board/pandora/pandora-buttons.h b/board/pandora/pandora-buttons.h
new file mode 100644 (file)
index 0000000..869d828
--- /dev/null
@@ -0,0 +1,40 @@
+/*
+ * (C) Copyright 2010
+ * Grazvydas Ignotas <notasas@gmail.com>
+ *
+ * (C) Copyright 2013
+ * Urja Rannikko <urjaman@gmail.com>
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+#ifndef _PANDORA_BUTTONS_H_
+#define _PANDORA_BUTTONS_H_
+
+/* game buttons as in GPIO bank 4 */
+#define BTN_LEFT       GPIO0
+#define BTN_RIGHT      GPIO2
+#define BTN_L          GPIO6
+#define BTN_DOWN       GPIO7
+#define BTN_SELECT     GPIO8
+#define BTN_R          GPIO9
+#define BTN_G3         GPIO10
+#define BTN_UP         GPIO14
+#define BTN_G2         GPIO15
+
+#endif