diff target-utils/lunadrv/sleep.c @ 865:57f7db8c4f45

lunadrv: add reset-suspend command
author Mychaela Falconia <falcon@freecalypso.org>
date Thu, 24 Mar 2022 06:39:13 +0000
parents a66095c7f35f
children
line wrap: on
line diff
--- 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);
+}