From 7d759f6b9ca96a4a64c71ac301eb59cb9702e74c Mon Sep 17 00:00:00 2001 From: Michael Sevakis Date: Sat, 14 Jul 2007 11:20:31 +0000 Subject: 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 --- .../target/arm/sandisk/sansa-e200/power-e200.c | 58 ++++++++++++++++++++++ 1 file changed, 58 insertions(+) (limited to 'firmware/target/arm/sandisk/sansa-e200/power-e200.c') diff --git a/firmware/target/arm/sandisk/sansa-e200/power-e200.c b/firmware/target/arm/sandisk/sansa-e200/power-e200.c index dfa4211a91..002dcb8407 100644 --- a/firmware/target/arm/sandisk/sansa-e200/power-e200.c +++ b/firmware/target/arm/sandisk/sansa-e200/power-e200.c @@ -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; +} -- cgit v1.2.3