diff options
-rw-r--r-- | firmware/target/arm/imx233/i2c-imx233.c | 6 | ||||
-rw-r--r-- | firmware/target/arm/imx233/i2c-imx233.h | 2 | ||||
-rw-r--r-- | firmware/target/arm/imx233/power-imx233.c | 1 | ||||
-rw-r--r-- | firmware/target/arm/imx233/sansa-fuzeplus/fmradio-i2c-fuzeplus.c | 10 | ||||
-rw-r--r-- | firmware/target/arm/imx233/sansa-fuzeplus/power-fuzeplus.c | 2 | ||||
-rw-r--r-- | firmware/target/arm/imx233/system-imx233.c | 5 |
6 files changed, 15 insertions, 11 deletions
diff --git a/firmware/target/arm/imx233/i2c-imx233.c b/firmware/target/arm/imx233/i2c-imx233.c index d502d3b2b4..21b66bcde8 100644 --- a/firmware/target/arm/imx233/i2c-imx233.c +++ b/firmware/target/arm/imx233/i2c-imx233.c | |||
@@ -53,7 +53,7 @@ void INT_I2C_DMA(void) | |||
53 | semaphore_release(&i2c_sema); | 53 | semaphore_release(&i2c_sema); |
54 | } | 54 | } |
55 | 55 | ||
56 | void i2c_init(void) | 56 | void imx233_i2c_init(void) |
57 | { | 57 | { |
58 | imx233_reset_block(&HW_I2C_CTRL0); | 58 | imx233_reset_block(&HW_I2C_CTRL0); |
59 | /* setup pins (must be done when shutdown) */ | 59 | /* setup pins (must be done when shutdown) */ |
@@ -147,6 +147,10 @@ enum imx233_i2c_error_t imx233_i2c_end(unsigned timeout) | |||
147 | return ret; | 147 | return ret; |
148 | } | 148 | } |
149 | 149 | ||
150 | void i2c_init(void) | ||
151 | { | ||
152 | } | ||
153 | |||
150 | int i2c_write(int device, const unsigned char* buf, int count) | 154 | int i2c_write(int device, const unsigned char* buf, int count) |
151 | { | 155 | { |
152 | uint8_t addr = device; | 156 | uint8_t addr = device; |
diff --git a/firmware/target/arm/imx233/i2c-imx233.h b/firmware/target/arm/imx233/i2c-imx233.h index de90e168f2..5ee22efd2a 100644 --- a/firmware/target/arm/imx233/i2c-imx233.h +++ b/firmware/target/arm/imx233/i2c-imx233.h | |||
@@ -126,7 +126,7 @@ enum imx233_i2c_error_t | |||
126 | I2C_SLAVE_NAK = -5 | 126 | I2C_SLAVE_NAK = -5 |
127 | }; | 127 | }; |
128 | 128 | ||
129 | void i2c_init(void); | 129 | void imx233_i2c_init(void); |
130 | /* start building a transfer, will acquire an exclusive lock */ | 130 | /* start building a transfer, will acquire an exclusive lock */ |
131 | void imx233_i2c_begin(void); | 131 | void imx233_i2c_begin(void); |
132 | /* add stage */ | 132 | /* add stage */ |
diff --git a/firmware/target/arm/imx233/power-imx233.c b/firmware/target/arm/imx233/power-imx233.c index 0b395b3246..2ae7ff653c 100644 --- a/firmware/target/arm/imx233/power-imx233.c +++ b/firmware/target/arm/imx233/power-imx233.c | |||
@@ -27,6 +27,7 @@ | |||
27 | #include "system-target.h" | 27 | #include "system-target.h" |
28 | #include "power-imx233.h" | 28 | #include "power-imx233.h" |
29 | #include "pinctrl-imx233.h" | 29 | #include "pinctrl-imx233.h" |
30 | #include "fmradio_i2c.h" | ||
30 | 31 | ||
31 | struct current_step_bit_t | 32 | struct current_step_bit_t |
32 | { | 33 | { |
diff --git a/firmware/target/arm/imx233/sansa-fuzeplus/fmradio-i2c-fuzeplus.c b/firmware/target/arm/imx233/sansa-fuzeplus/fmradio-i2c-fuzeplus.c index d4113332ac..417f70e406 100644 --- a/firmware/target/arm/imx233/sansa-fuzeplus/fmradio-i2c-fuzeplus.c +++ b/firmware/target/arm/imx233/sansa-fuzeplus/fmradio-i2c-fuzeplus.c | |||
@@ -85,17 +85,11 @@ struct i2c_interface fmradio_i2c = | |||
85 | .delay_thigh = 4 | 85 | .delay_thigh = 4 |
86 | }; | 86 | }; |
87 | 87 | ||
88 | void fmradio_i2c_enable(bool enable) | 88 | void fmradio_i2c_init(void) |
89 | { | 89 | { |
90 | if(fmradio_i2c_bus == -1) | ||
91 | fmradio_i2c_bus = i2c_add_node(&fmradio_i2c); | ||
92 | imx233_set_pin_function(0, 29, PINCTRL_FUNCTION_GPIO); | ||
93 | imx233_set_pin_function(1, 24, PINCTRL_FUNCTION_GPIO); | 90 | imx233_set_pin_function(1, 24, PINCTRL_FUNCTION_GPIO); |
94 | imx233_set_pin_function(1, 22, PINCTRL_FUNCTION_GPIO); | 91 | imx233_set_pin_function(1, 22, PINCTRL_FUNCTION_GPIO); |
95 | imx233_enable_gpio_output(1, 22, enable); | 92 | fmradio_i2c_bus = i2c_add_node(&fmradio_i2c); |
96 | imx233_enable_gpio_output(1, 24, enable); | ||
97 | imx233_set_gpio_output(1, 22, enable); | ||
98 | imx233_set_gpio_output(1, 24, enable); | ||
99 | } | 93 | } |
100 | 94 | ||
101 | int fmradio_i2c_write(unsigned char address, const unsigned char* buf, int count) | 95 | int fmradio_i2c_write(unsigned char address, const unsigned char* buf, int count) |
diff --git a/firmware/target/arm/imx233/sansa-fuzeplus/power-fuzeplus.c b/firmware/target/arm/imx233/sansa-fuzeplus/power-fuzeplus.c index 63ca90d47f..71c45b0676 100644 --- a/firmware/target/arm/imx233/sansa-fuzeplus/power-fuzeplus.c +++ b/firmware/target/arm/imx233/sansa-fuzeplus/power-fuzeplus.c | |||
@@ -32,8 +32,8 @@ bool tuner_power(bool enable) | |||
32 | { | 32 | { |
33 | if(enable != tuner_enable) | 33 | if(enable != tuner_enable) |
34 | { | 34 | { |
35 | fmradio_i2c_enable(enable); | ||
36 | /* CE is B029 (active high) */ | 35 | /* CE is B029 (active high) */ |
36 | imx233_set_pin_function(0, 29, PINCTRL_FUNCTION_GPIO); | ||
37 | imx233_set_pin_drive_strength(0, 29, PINCTRL_DRIVE_4mA); | 37 | imx233_set_pin_drive_strength(0, 29, PINCTRL_DRIVE_4mA); |
38 | imx233_enable_gpio_output(0, 29, enable); | 38 | imx233_enable_gpio_output(0, 29, enable); |
39 | imx233_set_gpio_output(0, 29, enable); | 39 | imx233_set_gpio_output(0, 29, enable); |
diff --git a/firmware/target/arm/imx233/system-imx233.c b/firmware/target/arm/imx233/system-imx233.c index 36b67674c2..63bd91998d 100644 --- a/firmware/target/arm/imx233/system-imx233.c +++ b/firmware/target/arm/imx233/system-imx233.c | |||
@@ -34,6 +34,7 @@ | |||
34 | #include "lcd.h" | 34 | #include "lcd.h" |
35 | #include "backlight-target.h" | 35 | #include "backlight-target.h" |
36 | #include "button.h" | 36 | #include "button.h" |
37 | #include "fmradio_i2c.h" | ||
37 | 38 | ||
38 | #define default_interrupt(name) \ | 39 | #define default_interrupt(name) \ |
39 | extern __attribute__((weak, alias("UIRQ"))) void name(void) | 40 | extern __attribute__((weak, alias("UIRQ"))) void name(void) |
@@ -213,6 +214,10 @@ void system_init(void) | |||
213 | imx233_dma_init(); | 214 | imx233_dma_init(); |
214 | imx233_ssp_init(); | 215 | imx233_ssp_init(); |
215 | imx233_dcp_init(); | 216 | imx233_dcp_init(); |
217 | imx233_i2c_init(); | ||
218 | #if defined(SANSA_FUZEPLUS) && !defined(BOOTLOADER) | ||
219 | fmradio_i2c_init(); | ||
220 | #endif | ||
216 | } | 221 | } |
217 | 222 | ||
218 | bool imx233_us_elapsed(uint32_t ref, unsigned us_delay) | 223 | bool imx233_us_elapsed(uint32_t ref, unsigned us_delay) |