forked from len0rd/rockbox
D2: Add the tuner_power() function which was missing from the previous FM commit.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@17999 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
34216463be
commit
0eb51e8a73
1 changed files with 49 additions and 0 deletions
|
|
@ -99,6 +99,55 @@ bool charger_inserted(void)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if CONFIG_TUNER
|
||||||
|
|
||||||
|
/** Tuner **/
|
||||||
|
static bool powered = false;
|
||||||
|
|
||||||
|
bool tuner_power(bool status)
|
||||||
|
{
|
||||||
|
bool old_status;
|
||||||
|
lv24020lp_lock();
|
||||||
|
|
||||||
|
old_status = powered;
|
||||||
|
|
||||||
|
if (status != old_status)
|
||||||
|
{
|
||||||
|
if (status)
|
||||||
|
{
|
||||||
|
/* When power up, host should initialize the 3-wire bus
|
||||||
|
in host read mode: */
|
||||||
|
|
||||||
|
/* 1. Set direction of the DATA-line to input-mode. */
|
||||||
|
GPIOC_DIR &= ~(1 << 30);
|
||||||
|
|
||||||
|
/* 2. Drive NR_W low */
|
||||||
|
GPIOC_CLEAR = (1 << 31);
|
||||||
|
GPIOC_DIR |= (1 << 31);
|
||||||
|
|
||||||
|
/* 3. Drive CLOCK high */
|
||||||
|
GPIOC_SET = (1 << 29);
|
||||||
|
GPIOC_DIR |= (1 << 29);
|
||||||
|
|
||||||
|
lv24020lp_power(true);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
lv24020lp_power(false);
|
||||||
|
|
||||||
|
/* set all as inputs */
|
||||||
|
GPIOC_DIR &= ~((1 << 29) | (1 << 30) | (1 << 31));
|
||||||
|
}
|
||||||
|
|
||||||
|
powered = status;
|
||||||
|
}
|
||||||
|
|
||||||
|
lv24020lp_unlock();
|
||||||
|
return old_status;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif /* CONFIG_TUNER */
|
||||||
|
|
||||||
#else /* SIMULATOR */
|
#else /* SIMULATOR */
|
||||||
|
|
||||||
bool charger_inserted(void)
|
bool charger_inserted(void)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue