summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Nielsen Feltzing <linus@haxx.se>2003-05-03 15:39:40 +0000
committerLinus Nielsen Feltzing <linus@haxx.se>2003-05-03 15:39:40 +0000
commit23b0fdaca1061c86b2d8e71a9f281d5c3e13736b (patch)
tree981168cd3cf72507b39dec55be94b57d5a0a43f9
parent568baaf81a2bcb01fedd22cc88092c6e83cbdd04 (diff)
downloadrockbox-23b0fdaca1061c86b2d8e71a9f281d5c3e13736b.tar.gz
rockbox-23b0fdaca1061c86b2d8e71a9f281d5c3e13736b.zip
Idle poweroff fix for FM radio, as suggested by Mike Holden
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@3645 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--apps/recorder/radio.c5
-rw-r--r--firmware/drivers/fmradio.c22
-rw-r--r--firmware/export/fmradio.h4
-rw-r--r--firmware/powermgmt.c6
4 files changed, 25 insertions, 12 deletions
diff --git a/apps/recorder/radio.c b/apps/recorder/radio.c
index dc286fb222..4f6fca4fa3 100644
--- a/apps/recorder/radio.c
+++ b/apps/recorder/radio.c
@@ -69,7 +69,8 @@ bool radio_screen(void)
lcd_clear_display();
lcd_setmargins(0, 8);
status_draw(false);
-
+ fmradio_set_status(FMRADIO_PLAYING);
+
/* Enable the Left and right A/D Converter */
mas_codec_writereg(0x0, 0xccc7);
@@ -182,6 +183,8 @@ bool radio_screen(void)
break;
}
}
+
+ fmradio_set_status(0);
return false;
}
#endif
diff --git a/firmware/drivers/fmradio.c b/firmware/drivers/fmradio.c
index 0d947f4480..14abb8e2b0 100644
--- a/firmware/drivers/fmradio.c
+++ b/firmware/drivers/fmradio.c
@@ -50,17 +50,7 @@
/* delay loop */
#define DELAY do { int _x; for(_x=0;_x<10;_x++);} while (0)
-static struct mutex fmradio_mtx;
-
-void fmradio_begin(void)
-{
- mutex_lock(&fmradio_mtx);
-}
-
-void fmradio_end(void)
-{
- mutex_unlock(&fmradio_mtx);
-}
+static int fmstatus = 0;
int fmradio_read(int addr)
{
@@ -130,4 +120,14 @@ void fmradio_set(int addr, int data)
CE_LO;
}
+void fmradio_set_status(int status)
+{
+ fmstatus = status;
+}
+
+int fmradio_get_status(void)
+{
+ return fmstatus;
+}
+
#endif
diff --git a/firmware/export/fmradio.h b/firmware/export/fmradio.h
index 2877501361..b5b239bde1 100644
--- a/firmware/export/fmradio.h
+++ b/firmware/export/fmradio.h
@@ -21,5 +21,9 @@
extern int fmradio_read(int addr);
extern void fmradio_set(int addr, int data);
+extern void fmradio_set_status(int status);
+extern int fmradio_get_status(void);
+
+#define FMRADIO_PLAYING 1
#endif
diff --git a/firmware/powermgmt.c b/firmware/powermgmt.c
index e04e520ad1..00492bbcc6 100644
--- a/firmware/powermgmt.c
+++ b/firmware/powermgmt.c
@@ -34,6 +34,9 @@
#include "usb.h"
#include "powermgmt.h"
#include "backlight.h"
+#ifdef HAVE_FMRADIO
+#include "fmradio.h"
+#endif
#ifdef SIMULATOR
@@ -299,6 +302,9 @@ static void handle_auto_poweroff(void)
charger_was_inserted = charger_is_inserted;
if(timeout &&
+#ifdef HAVE_FMRADIO
+ !fmradio_get_status() &&
+#endif
!usb_inserted() &&
(mpeg_stat == 0 ||
mpeg_stat == (MPEG_STATUS_PLAY | MPEG_STATUS_PAUSE)))