summaryrefslogtreecommitdiff
path: root/firmware/drivers/power.c
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/drivers/power.c')
-rw-r--r--firmware/drivers/power.c31
1 files changed, 31 insertions, 0 deletions
diff --git a/firmware/drivers/power.c b/firmware/drivers/power.c
index d05d0ce97f..35aceb50e9 100644
--- a/firmware/drivers/power.c
+++ b/firmware/drivers/power.c
@@ -28,6 +28,32 @@
28bool charger_enabled; 28bool charger_enabled;
29#endif 29#endif
30 30
31
32#ifdef CONFIG_TUNER
33
34static int fmstatus = 0;
35
36void radio_set_status(int status)
37{
38 fmstatus = status;
39#ifdef HAVE_TUNER_PWR_CTRL
40 if (status)
41 {
42 and_b(~0x04, &PADR); /* drive PA2 low for tuner enable */
43 sleep(1); /* let the voltage settle */
44 }
45 else
46 or_b(0x04, &PADR); /* drive PA2 high for tuner disable */
47#endif
48}
49
50int radio_get_status(void)
51{
52 return fmstatus;
53}
54
55#endif /* #ifdef CONFIG_TUNER */
56
31#ifndef SIMULATOR 57#ifndef SIMULATOR
32 58
33void power_init(void) 59void power_init(void)
@@ -36,6 +62,11 @@ void power_init(void)
36 or_b(0x20, &PBIORL); /* Set charging control bit to output */ 62 or_b(0x20, &PBIORL); /* Set charging control bit to output */
37 charger_enable(false); /* Default to charger OFF */ 63 charger_enable(false); /* Default to charger OFF */
38#endif 64#endif
65#ifdef HAVE_TUNER_PWR_CTRL
66 and_b(~0x30, &PACR2); /* GPIO for PA2 */
67 or_b(0x04, &PADR); /* drive PA2 high for tuner disable */
68 or_b(0x04, &PAIOR); /* output for PA2 */
69#endif
39} 70}
40 71
41bool charger_inserted(void) 72bool charger_inserted(void)