summaryrefslogtreecommitdiff
path: root/firmware/target/arm/imx31/gigabeat-s/power-imx31.c
diff options
context:
space:
mode:
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)
98} 98}
99 99
100#if CONFIG_TUNER 100#if CONFIG_TUNER
101static bool tuner_on = false;
102
101bool tuner_power(bool status) 103bool tuner_power(bool status)
102{ 104{
103 static bool tuner_powered = false; 105 if (status != tuner_on)
104
105 if (status == tuner_powered)
106 return status;
107
108 tuner_powered = status;
109
110 if (status)
111 {
112 /* the si4700 is the only thing connected to i2c2 so
113 we can diable the i2c module when not in use */
114 fmradio_i2c_enable(true);
115 /* enable the fm chip */
116 imx31_regset32(&GPIO1_DR, (1 << 26));
117 /* enable CLK32KMCU clock */
118 mc13783_set(MC13783_POWER_CONTROL0, MC13783_CLK32KMCUEN);
119 }
120 else
121 { 106 {
122 /* the si4700 is the only thing connected to i2c2 so 107 tuner_on = status;
123 we can diable the i2c module when not in use */ 108 /* Handle power and pin setup */
124 fmradio_i2c_enable(false); 109 fmradio_i2c_enable(status);
125 /* disable the fm chip */ 110 status = !status;
126 imx31_regclr32(&GPIO1_DR, (1 << 26));
127 /* disable CLK32KMCU clock */
128 mc13783_clear(MC13783_POWER_CONTROL0, MC13783_CLK32KMCUEN);
129 } 111 }
130 112
131 return !status; 113 return status;
114}
115
116bool tuner_powered(void)
117{
118 return tuner_on;
132} 119}
133#endif /* #if CONFIG_TUNER */ 120#endif /* #if CONFIG_TUNER */
134 121
@@ -151,6 +138,10 @@ void power_off(void)
151 138
152void power_init(void) 139void power_init(void)
153{ 140{
141#if CONFIG_TUNER
142 fmradio_i2c_init();
143#endif
144
154 /* Poll initial state */ 145 /* Poll initial state */
155 charger_main_detect_event(); 146 charger_main_detect_event();
156 147