forked from len0rd/rockbox
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
This commit is contained in:
parent
568baaf81a
commit
23b0fdaca1
4 changed files with 25 additions and 12 deletions
|
|
@ -69,7 +69,8 @@ bool radio_screen(void)
|
||||||
lcd_clear_display();
|
lcd_clear_display();
|
||||||
lcd_setmargins(0, 8);
|
lcd_setmargins(0, 8);
|
||||||
status_draw(false);
|
status_draw(false);
|
||||||
|
fmradio_set_status(FMRADIO_PLAYING);
|
||||||
|
|
||||||
/* Enable the Left and right A/D Converter */
|
/* Enable the Left and right A/D Converter */
|
||||||
mas_codec_writereg(0x0, 0xccc7);
|
mas_codec_writereg(0x0, 0xccc7);
|
||||||
|
|
||||||
|
|
@ -182,6 +183,8 @@ bool radio_screen(void)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fmradio_set_status(0);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -50,17 +50,7 @@
|
||||||
/* delay loop */
|
/* delay loop */
|
||||||
#define DELAY do { int _x; for(_x=0;_x<10;_x++);} while (0)
|
#define DELAY do { int _x; for(_x=0;_x<10;_x++);} while (0)
|
||||||
|
|
||||||
static struct mutex fmradio_mtx;
|
static int fmstatus = 0;
|
||||||
|
|
||||||
void fmradio_begin(void)
|
|
||||||
{
|
|
||||||
mutex_lock(&fmradio_mtx);
|
|
||||||
}
|
|
||||||
|
|
||||||
void fmradio_end(void)
|
|
||||||
{
|
|
||||||
mutex_unlock(&fmradio_mtx);
|
|
||||||
}
|
|
||||||
|
|
||||||
int fmradio_read(int addr)
|
int fmradio_read(int addr)
|
||||||
{
|
{
|
||||||
|
|
@ -130,4 +120,14 @@ void fmradio_set(int addr, int data)
|
||||||
CE_LO;
|
CE_LO;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void fmradio_set_status(int status)
|
||||||
|
{
|
||||||
|
fmstatus = status;
|
||||||
|
}
|
||||||
|
|
||||||
|
int fmradio_get_status(void)
|
||||||
|
{
|
||||||
|
return fmstatus;
|
||||||
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -21,5 +21,9 @@
|
||||||
|
|
||||||
extern int fmradio_read(int addr);
|
extern int fmradio_read(int addr);
|
||||||
extern void fmradio_set(int addr, int data);
|
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
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -34,6 +34,9 @@
|
||||||
#include "usb.h"
|
#include "usb.h"
|
||||||
#include "powermgmt.h"
|
#include "powermgmt.h"
|
||||||
#include "backlight.h"
|
#include "backlight.h"
|
||||||
|
#ifdef HAVE_FMRADIO
|
||||||
|
#include "fmradio.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef SIMULATOR
|
#ifdef SIMULATOR
|
||||||
|
|
||||||
|
|
@ -299,6 +302,9 @@ static void handle_auto_poweroff(void)
|
||||||
charger_was_inserted = charger_is_inserted;
|
charger_was_inserted = charger_is_inserted;
|
||||||
|
|
||||||
if(timeout &&
|
if(timeout &&
|
||||||
|
#ifdef HAVE_FMRADIO
|
||||||
|
!fmradio_get_status() &&
|
||||||
|
#endif
|
||||||
!usb_inserted() &&
|
!usb_inserted() &&
|
||||||
(mpeg_stat == 0 ||
|
(mpeg_stat == 0 ||
|
||||||
mpeg_stat == (MPEG_STATUS_PLAY | MPEG_STATUS_PAUSE)))
|
mpeg_stat == (MPEG_STATUS_PLAY | MPEG_STATUS_PAUSE)))
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue