FreeCalypso > hg > freecalypso-tools
annotate target-utils/lunadrv/sleep.c @ 860:7d4f080f66db
fc-add-ramps: actually produce correct output
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Sat, 18 Dec 2021 21:17:33 +0000 |
parents | a66095c7f35f |
children | 57f7db8c4f45 |
rev | line source |
---|---|
849
a66095c7f35f
lunadrv: add suspend and resume commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1 /* |
a66095c7f35f
lunadrv: add suspend and resume commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
2 * This module implements suspend and resume commands for entering |
a66095c7f35f
lunadrv: add suspend and resume commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
3 * and exiting ILI9225G sleep mode. These commands are expected |
a66095c7f35f
lunadrv: add suspend and resume commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
4 * to work the same on both HaoRan and Formike LCDs, but the |
a66095c7f35f
lunadrv: add suspend and resume commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
5 * current measurement resistor that allows one to see the actual |
a66095c7f35f
lunadrv: add suspend and resume commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
6 * power supply current drawn by the LCD is present only on lunalcd2 |
a66095c7f35f
lunadrv: add suspend and resume commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
7 * boards. |
a66095c7f35f
lunadrv: add suspend and resume commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
8 */ |
a66095c7f35f
lunadrv: add suspend and resume commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
9 |
a66095c7f35f
lunadrv: add suspend and resume commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
10 #include "types.h" |
a66095c7f35f
lunadrv: add suspend and resume commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
11 #include "luna.h" |
a66095c7f35f
lunadrv: add suspend and resume commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
12 |
a66095c7f35f
lunadrv: add suspend and resume commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
13 void |
a66095c7f35f
lunadrv: add suspend and resume commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
14 cmd_suspend() |
a66095c7f35f
lunadrv: add suspend and resume commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
15 { |
a66095c7f35f
lunadrv: add suspend and resume commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
16 LCD_REG_WR(0x0007, 0); /* display off */ |
a66095c7f35f
lunadrv: add suspend and resume commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
17 wait_ARM_cycles(DELAY_1MS * 50); |
a66095c7f35f
lunadrv: add suspend and resume commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
18 LCD_REG_WR(0x0010, 1); /* suspend mode */ |
a66095c7f35f
lunadrv: add suspend and resume commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
19 } |
a66095c7f35f
lunadrv: add suspend and resume commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
20 |
a66095c7f35f
lunadrv: add suspend and resume commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
21 void |
a66095c7f35f
lunadrv: add suspend and resume commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
22 cmd_resume() |
a66095c7f35f
lunadrv: add suspend and resume commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
23 { |
a66095c7f35f
lunadrv: add suspend and resume commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
24 LCD_REG_WR(0x0010, 0); /* out of suspend */ |
a66095c7f35f
lunadrv: add suspend and resume commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
25 wait_ARM_cycles(DELAY_1MS * 50); |
a66095c7f35f
lunadrv: add suspend and resume commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
26 LCD_REG_WR(0x0007, 0x1017); /* display on */ |
a66095c7f35f
lunadrv: add suspend and resume commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
27 } |