From 0eb51e8a73be0713579dfade63447fd5e7858160 Mon Sep 17 00:00:00 2001 From: Rob Purchase Date: Wed, 9 Jul 2008 20:42:47 +0000 Subject: 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 --- .../target/arm/tcc780x/cowond2/power-cowond2.c | 49 ++++++++++++++++++++++ 1 file changed, 49 insertions(+) diff --git a/firmware/target/arm/tcc780x/cowond2/power-cowond2.c b/firmware/target/arm/tcc780x/cowond2/power-cowond2.c index 5b09cc1c17..9eb0871c6e 100644 --- a/firmware/target/arm/tcc780x/cowond2/power-cowond2.c +++ b/firmware/target/arm/tcc780x/cowond2/power-cowond2.c @@ -99,6 +99,55 @@ bool charger_inserted(void) } #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 */ bool charger_inserted(void) -- cgit v1.2.3