summaryrefslogtreecommitdiffstats
path: root/firmware/target/arm/imx31/gigabeat-s/power-imx31.c
diff options
context:
space:
mode:
authorMichael Sevakis <jethead71@rockbox.org>2008-12-27 19:18:50 +0000
committerMichael Sevakis <jethead71@rockbox.org>2008-12-27 19:18:50 +0000
commit1fea6f6b22af74e904d918fff4cebec345529f4b (patch)
tree1cdddb0ab125099b7439fd80984517d4a1880341 /firmware/target/arm/imx31/gigabeat-s/power-imx31.c
parentd6bae6c858413544ff0671910654f709d195e427 (diff)
downloadrockbox-1fea6f6b22af74e904d918fff4cebec345529f4b.tar.gz
rockbox-1fea6f6b22af74e904d918fff4cebec345529f4b.zip
Make si4700 tuner driver more sane with bit and field defines and entirely hide strange i2c interface from code with write/set/clear/masked functionality. On Gigabeat S use by-the-book busmode selection and GPIO lines. Implement some primitive station detection, debug registers in screen, and misc. changes to tie things together.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@19600 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/target/arm/imx31/gigabeat-s/power-imx31.c')
-rw-r--r--firmware/target/arm/imx31/gigabeat-s/power-imx31.c43
1 files changed, 17 insertions, 26 deletions
diff --git a/firmware/target/arm/imx31/gigabeat-s/power-imx31.c b/firmware/target/arm/imx31/gigabeat-s/power-imx31.c
index 727b38bd96..b29d3cd0fb 100644
--- a/firmware/target/arm/imx31/gigabeat-s/power-imx31.c
+++ b/firmware/target/arm/imx31/gigabeat-s/power-imx31.c
@@ -98,37 +98,24 @@ bool ide_powered(void)
}
#if CONFIG_TUNER
+static bool tuner_on = false;
+
bool tuner_power(bool status)
{
- static bool tuner_powered = false;
-
- if (status == tuner_powered)
- return status;
-
- tuner_powered = status;
-
- if (status)
- {
- /* the si4700 is the only thing connected to i2c2 so
- we can diable the i2c module when not in use */
- fmradio_i2c_enable(true);
- /* enable the fm chip */
- imx31_regset32(&GPIO1_DR, (1 << 26));
- /* enable CLK32KMCU clock */
- mc13783_set(MC13783_POWER_CONTROL0, MC13783_CLK32KMCUEN);
- }
- else
+ if (status != tuner_on)
{
- /* the si4700 is the only thing connected to i2c2 so
- we can diable the i2c module when not in use */
- fmradio_i2c_enable(false);
- /* disable the fm chip */
- imx31_regclr32(&GPIO1_DR, (1 << 26));
- /* disable CLK32KMCU clock */
- mc13783_clear(MC13783_POWER_CONTROL0, MC13783_CLK32KMCUEN);
+ tuner_on = status;
+ /* Handle power and pin setup */
+ fmradio_i2c_enable(status);
+ status = !status;
}
- return !status;
+ return status;
+}
+
+bool tuner_powered(void)
+{
+ return tuner_on;
}
#endif /* #if CONFIG_TUNER */
@@ -151,6 +138,10 @@ void power_off(void)
void power_init(void)
{
+#if CONFIG_TUNER
+ fmradio_i2c_init();
+#endif
+
/* Poll initial state */
charger_main_detect_event();