changeset 865:57f7db8c4f45

lunadrv: add reset-suspend command
author Mychaela Falconia <falcon@freecalypso.org>
date Thu, 24 Mar 2022 06:39:13 +0000
parents 82d4a7438639
children 1976ce568ccd
files target-utils/lunadrv/cmdtab.c target-utils/lunadrv/sleep.c
diffstat 2 files changed, 22 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/target-utils/lunadrv/cmdtab.c	Thu Mar 24 04:00:37 2022 +0000
+++ b/target-utils/lunadrv/cmdtab.c	Thu Mar 24 06:39:13 2022 +0000
@@ -12,6 +12,7 @@
 extern void cmd_r32();
 extern void cmd_rd();
 extern void cmd_rect();
+extern void cmd_reset_suspend();
 extern void cmd_resume();
 extern void cmd_suspend();
 extern void cmd_w8();
@@ -46,6 +47,7 @@
 	{"r32", cmd_r32},
 	{"rd", cmd_rd},
 	{"rect", cmd_rect},
+	{"reset-suspend", cmd_reset_suspend},
 	{"resume", cmd_resume},
 	{"suspend", cmd_suspend},
 	{"w8", cmd_w8},
--- a/target-utils/lunadrv/sleep.c	Thu Mar 24 04:00:37 2022 +0000
+++ b/target-utils/lunadrv/sleep.c	Thu Mar 24 06:39:13 2022 +0000
@@ -25,3 +25,23 @@
 	wait_ARM_cycles(DELAY_1MS * 50);
 	LCD_REG_WR(0x0007, 0x1017);		/* display on */
 }
+
+/*
+ * If we wish to run sans-UI firmware on an LCD-equipped board,
+ * we would like to put the ILI9225G controller into its lowest
+ * power mode, without doing anything else to it.  The following
+ * reset-suspend command prototypes this functionality.
+ */
+
+void
+cmd_reset_suspend()
+{
+	/* reset pulse */
+	CNTL_RST_REG |= EXT_RESET;
+	wait_ARM_cycles(DELAY_1MS * 10);
+	CNTL_RST_REG &= ~EXT_RESET;
+	/* datasheet says it needs 50 ms */
+	wait_ARM_cycles(DELAY_1MS * 50);
+	/* and straight into suspend mode */
+	LCD_REG_WR(0x0010, 1);
+}