Do some planned radio interface cleanup since adding in the LV24020LP.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@13880 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Michael Sevakis 2007-07-14 11:20:31 +00:00
parent b51a20fb9b
commit 7d759f6b9c
23 changed files with 563 additions and 402 deletions

View file

@ -84,12 +84,12 @@ void ide_power_enable(bool on)
static bool powered = false;
bool radio_powered()
bool tuner_powered()
{
return powered;
}
bool radio_power(bool status)
bool tuner_power(bool status)
{
bool old_status = powered;
powered = status;

View file

@ -40,12 +40,12 @@ bool charger_enabled;
static bool powered = false;
bool radio_powered()
bool tuner_powered()
{
return powered;
}
bool radio_power(bool status)
bool tuner_power(bool status)
{
bool old_status = powered;
powered = status;

View file

@ -30,12 +30,12 @@
static bool powered = false;
bool radio_powered(void)
bool tuner_powered(void)
{
return powered;
}
bool radio_power(bool status)
bool tuner_power(bool status)
{
bool old_status = powered;
powered = status;

View file

@ -21,6 +21,7 @@
#include "system.h"
#include "cpu.h"
#include "i2c-pp.h"
#include "tuner.h"
void power_init(void)
{
@ -61,3 +62,60 @@ void ide_power_enable(bool on)
{
(void)on;
}
/** Tuner **/
static bool powered = false;
bool tuner_power(bool status)
{
bool old_status = powered;
if (status != old_status)
{
if (status)
{
/* init mystery amplification device */
outl(inl(0x70000084) | 0x1, 0x70000084);
udelay(5);
/* When power up, host should initialize the 3-wire bus
in host read mode: */
/* 1. Set direction of the DATA-line to input-mode. */
GPIOH_OUTPUT_EN &= ~(1 << 5);
GPIOH_ENABLE |= (1 << 5);
/* 2. Drive NR_W low */
GPIOH_OUTPUT_VAL &= ~(1 << 3);
GPIOH_OUTPUT_EN |= (1 << 3);
GPIOH_ENABLE |= (1 << 3);
/* 3. Drive CLOCK high */
GPIOH_OUTPUT_VAL |= (1 << 4);
GPIOH_OUTPUT_EN |= (1 << 4);
GPIOH_ENABLE |= (1 << 4);
lv24020lp_power(true);
}
else
{
lv24020lp_power(false);
/* set all as inputs */
GPIOH_OUTPUT_EN &= ~((1 << 5) | (1 << 3) | (1 << 4));
GPIOH_ENABLE &= ~((1 << 5) | (1 << 3) | (1 << 4));
/* turn off mystery amplification device */
outl(inl(0x70000084) & ~0x1, 0x70000084);
}
powered = status;
}
return old_status;
}
bool tuner_powered(void)
{
return powered;
}