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.c19
1 files changed, 14 insertions, 5 deletions
diff --git a/firmware/target/arm/imx31/gigabeat-s/power-imx31.c b/firmware/target/arm/imx31/gigabeat-s/power-imx31.c
index 39724c7b75..727b38bd96 100644
--- a/firmware/target/arm/imx31/gigabeat-s/power-imx31.c
+++ b/firmware/target/arm/imx31/gigabeat-s/power-imx31.c
@@ -28,9 +28,10 @@
28#include "backlight-target.h" 28#include "backlight-target.h"
29#include "avic-imx31.h" 29#include "avic-imx31.h"
30#include "mc13783.h" 30#include "mc13783.h"
31#include "i2c-imx31.h" 31#if CONFIG_TUNER
32#include "fmradio_i2c.h"
33#endif
32 34
33extern struct i2c_node si4700_i2c_node;
34static unsigned int power_status = POWER_INPUT_NONE; 35static unsigned int power_status = POWER_INPUT_NONE;
35 36
36/* Detect which power sources are present. */ 37/* Detect which power sources are present. */
@@ -99,11 +100,18 @@ bool ide_powered(void)
99#if CONFIG_TUNER 100#if CONFIG_TUNER
100bool tuner_power(bool status) 101bool tuner_power(bool status)
101{ 102{
103 static bool tuner_powered = false;
104
105 if (status == tuner_powered)
106 return status;
107
108 tuner_powered = status;
109
102 if (status) 110 if (status)
103 { 111 {
104 /* the si4700 is the only thing connected to i2c2 so 112 /* the si4700 is the only thing connected to i2c2 so
105 we can diable the i2c module when not in use */ 113 we can diable the i2c module when not in use */
106 i2c_enable_node(&si4700_i2c_node, true); 114 fmradio_i2c_enable(true);
107 /* enable the fm chip */ 115 /* enable the fm chip */
108 imx31_regset32(&GPIO1_DR, (1 << 26)); 116 imx31_regset32(&GPIO1_DR, (1 << 26));
109 /* enable CLK32KMCU clock */ 117 /* enable CLK32KMCU clock */
@@ -113,13 +121,14 @@ bool tuner_power(bool status)
113 { 121 {
114 /* the si4700 is the only thing connected to i2c2 so 122 /* the si4700 is the only thing connected to i2c2 so
115 we can diable the i2c module when not in use */ 123 we can diable the i2c module when not in use */
116 i2c_enable_node(&si4700_i2c_node, false); 124 fmradio_i2c_enable(false);
117 /* disable the fm chip */ 125 /* disable the fm chip */
118 imx31_regclr32(&GPIO1_DR, (1 << 26)); 126 imx31_regclr32(&GPIO1_DR, (1 << 26));
119 /* disable CLK32KMCU clock */ 127 /* disable CLK32KMCU clock */
120 mc13783_clear(MC13783_POWER_CONTROL0, MC13783_CLK32KMCUEN); 128 mc13783_clear(MC13783_POWER_CONTROL0, MC13783_CLK32KMCUEN);
121 } 129 }
122 return true; 130
131 return !status;
123} 132}
124#endif /* #if CONFIG_TUNER */ 133#endif /* #if CONFIG_TUNER */
125 134