diff options
author | Rafaël Carré <rafael.carre@gmail.com> | 2010-05-05 04:06:44 +0000 |
---|---|---|
committer | Rafaël Carré <rafael.carre@gmail.com> | 2010-05-05 04:06:44 +0000 |
commit | a69e1c4a4425a69a920f7a85c45b1ac6de717a07 (patch) | |
tree | ce44706ae84100064aaeabb7df422280cb5b7853 | |
parent | aec0af541335731031d879ca491cd46d5ea7ba16 (diff) | |
download | rockbox-a69e1c4a4425a69a920f7a85c45b1ac6de717a07.tar.gz rockbox-a69e1c4a4425a69a920f7a85c45b1ac6de717a07.zip |
Fuzev2: FM - tested on 2 different models
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@25818 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r-- | firmware/export/config/sansafuzev2.h | 4 | ||||
-rw-r--r-- | firmware/target/arm/as3525/fmradio-i2c-as3525.c | 34 | ||||
-rw-r--r-- | firmware/target/arm/as3525/sansa-fuzev2/button-fuzev2.c | 7 |
3 files changed, 38 insertions, 7 deletions
diff --git a/firmware/export/config/sansafuzev2.h b/firmware/export/config/sansafuzev2.h index 4caab8464a..b920e4153b 100644 --- a/firmware/export/config/sansafuzev2.h +++ b/firmware/export/config/sansafuzev2.h | |||
@@ -21,7 +21,7 @@ | |||
21 | 21 | ||
22 | /* Define bitmask of input sources - recordable bitmask can be defined | 22 | /* Define bitmask of input sources - recordable bitmask can be defined |
23 | explicitly if different */ | 23 | explicitly if different */ |
24 | #define INPUT_SRC_CAPS (SRC_CAP_MIC /*| SRC_CAP_FMRADIO*/) | 24 | #define INPUT_SRC_CAPS (SRC_CAP_MIC | SRC_CAP_FMRADIO) |
25 | 25 | ||
26 | /* define this if you have a bitmap LCD display */ | 26 | /* define this if you have a bitmap LCD display */ |
27 | #define HAVE_LCD_BITMAP | 27 | #define HAVE_LCD_BITMAP |
@@ -117,7 +117,7 @@ | |||
117 | #define AB_REPEAT_ENABLE 1 | 117 | #define AB_REPEAT_ENABLE 1 |
118 | 118 | ||
119 | /* FM Tuner - suspected to be the SI4702 */ | 119 | /* FM Tuner - suspected to be the SI4702 */ |
120 | //#define CONFIG_TUNER SI4700 | 120 | #define CONFIG_TUNER SI4700 |
121 | /* #define HAVE_TUNER_PWR_CTRL */ | 121 | /* #define HAVE_TUNER_PWR_CTRL */ |
122 | 122 | ||
123 | /* Define this for LCD backlight available */ | 123 | /* Define this for LCD backlight available */ |
diff --git a/firmware/target/arm/as3525/fmradio-i2c-as3525.c b/firmware/target/arm/as3525/fmradio-i2c-as3525.c index c86e3f53ab..31d701dc6d 100644 --- a/firmware/target/arm/as3525/fmradio-i2c-as3525.c +++ b/firmware/target/arm/as3525/fmradio-i2c-as3525.c | |||
@@ -30,6 +30,7 @@ | |||
30 | #include "as3525.h" | 30 | #include "as3525.h" |
31 | #include "generic_i2c.h" | 31 | #include "generic_i2c.h" |
32 | #include "fmradio_i2c.h" | 32 | #include "fmradio_i2c.h" |
33 | #include "system.h" | ||
33 | 34 | ||
34 | #if defined(SANSA_CLIP) || defined(SANSA_C200V2) | 35 | #if defined(SANSA_CLIP) || defined(SANSA_C200V2) |
35 | #define I2C_SCL_GPIO(x) GPIOB_PIN(x) | 36 | #define I2C_SCL_GPIO(x) GPIOB_PIN(x) |
@@ -63,6 +64,14 @@ | |||
63 | #define I2C_SCL_PIN 6 | 64 | #define I2C_SCL_PIN 6 |
64 | #define I2C_SDA_PIN 7 | 65 | #define I2C_SDA_PIN 7 |
65 | 66 | ||
67 | #elif defined(SANSA_FUZEV2) | ||
68 | #define I2C_SCL_GPIO(x) GPIOB_PIN(x) | ||
69 | #define I2C_SDA_GPIO(x) GPIOA_PIN(x) | ||
70 | #define I2C_SCL_GPIO_DIR GPIOB_DIR | ||
71 | #define I2C_SDA_GPIO_DIR GPIOA_DIR | ||
72 | #define I2C_SCL_PIN 1 | ||
73 | #define I2C_SDA_PIN 0 | ||
74 | |||
66 | #else | 75 | #else |
67 | #error no FM I2C GPIOPIN defines | 76 | #error no FM I2C GPIOPIN defines |
68 | #endif | 77 | #endif |
@@ -158,13 +167,28 @@ void fmradio_i2c_init(void) | |||
158 | 167 | ||
159 | int fmradio_i2c_write(unsigned char address, const unsigned char* buf, int count) | 168 | int fmradio_i2c_write(unsigned char address, const unsigned char* buf, int count) |
160 | { | 169 | { |
161 | return i2c_write_data(fm_i2c_bus, address, -1, buf, count); | 170 | #ifdef SANSA_FUZEV2 |
171 | int s = disable_irq_save(); | ||
172 | CCU_IO &= ~(1<<12); | ||
173 | #endif | ||
174 | int ret = i2c_write_data(fm_i2c_bus, address, -1, buf, count); | ||
175 | #ifdef SANSA_FUZEV2 | ||
176 | CCU_IO |= 1<<12; | ||
177 | restore_irq(s); | ||
178 | #endif | ||
179 | return ret; | ||
162 | } | 180 | } |
163 | 181 | ||
164 | int fmradio_i2c_read(unsigned char address, unsigned char* buf, int count) | 182 | int fmradio_i2c_read(unsigned char address, unsigned char* buf, int count) |
165 | { | 183 | { |
166 | return i2c_read_data(fm_i2c_bus, address, -1, buf, count); | 184 | #ifdef SANSA_FUZEV2 |
185 | int s = disable_irq_save(); | ||
186 | CCU_IO &= ~(1<<12); | ||
187 | #endif | ||
188 | int ret = i2c_read_data(fm_i2c_bus, address, -1, buf, count); | ||
189 | #ifdef SANSA_FUZEV2 | ||
190 | CCU_IO |= 1<<12; | ||
191 | restore_irq(s); | ||
192 | #endif | ||
193 | return ret; | ||
167 | } | 194 | } |
168 | |||
169 | |||
170 | |||
diff --git a/firmware/target/arm/as3525/sansa-fuzev2/button-fuzev2.c b/firmware/target/arm/as3525/sansa-fuzev2/button-fuzev2.c index d23fb432d6..fcda5226ca 100644 --- a/firmware/target/arm/as3525/sansa-fuzev2/button-fuzev2.c +++ b/firmware/target/arm/as3525/sansa-fuzev2/button-fuzev2.c | |||
@@ -232,6 +232,10 @@ int button_read_device(void) | |||
232 | 232 | ||
233 | CCU_IO &= ~(1<<12); | 233 | CCU_IO &= ~(1<<12); |
234 | 234 | ||
235 | /* B1 is shared with FM i2c */ | ||
236 | bool gpiob_pin0_dir = GPIOB_DIR & (1<<1); | ||
237 | GPIOB_DIR &= ~(1<<1); | ||
238 | |||
235 | GPIOB_PIN(0) = 1<<0; | 239 | GPIOB_PIN(0) = 1<<0; |
236 | udelay(4); | 240 | udelay(4); |
237 | 241 | ||
@@ -266,6 +270,9 @@ int button_read_device(void) | |||
266 | } | 270 | } |
267 | } | 271 | } |
268 | 272 | ||
273 | if(gpiob_pin0_dir) | ||
274 | GPIOB_DIR |= 1<<1; | ||
275 | |||
269 | CCU_IO |= 1<<12; | 276 | CCU_IO |= 1<<12; |
270 | 277 | ||
271 | #ifdef HAS_BUTTON_HOLD | 278 | #ifdef HAS_BUTTON_HOLD |