summaryrefslogtreecommitdiffstats
path: root/firmware/target/arm/imx233/creative-zen
diff options
context:
space:
mode:
authorAmaury Pouly <amaury.pouly@gmail.com>2013-11-19 20:39:10 +0000
committerAmaury Pouly <amaury.pouly@gmail.com>2013-11-19 20:39:10 +0000
commit446f352abda2dbc9de90c35a02100ed5e9aad77c (patch)
tree7ee2b4dae98376e0380b0b8bc44e1e688d10ede2 /firmware/target/arm/imx233/creative-zen
parentc2c2274e0adacc1a0c5bdb57fa1367badb7b047f (diff)
downloadrockbox-446f352abda2dbc9de90c35a02100ed5e9aad77c.tar.gz
rockbox-446f352abda2dbc9de90c35a02100ed5e9aad77c.zip
imx233: factor fmradio i2c and tuner power code
Choices are limited for those: i2c is either generic software or imx233 hardware and power is either none or with a gpio. So factor ever possible combination in a single common file and use fmradio-target.h to supply the required parameters. This will remove a bunch of duplicate code. Change-Id: If12faeb2e371631cd39cc18a4c1d859812007934
Diffstat (limited to 'firmware/target/arm/imx233/creative-zen')
-rw-r--r--firmware/target/arm/imx233/creative-zen/fmradio-target.h (renamed from firmware/target/arm/imx233/creative-zen/fmradio-i2c-zen.c)30
-rw-r--r--firmware/target/arm/imx233/creative-zen/power-zen.c38
2 files changed, 13 insertions, 55 deletions
diff --git a/firmware/target/arm/imx233/creative-zen/fmradio-i2c-zen.c b/firmware/target/arm/imx233/creative-zen/fmradio-target.h
index a1377ce1f2..c2b75b3ed4 100644
--- a/firmware/target/arm/imx233/creative-zen/fmradio-i2c-zen.c
+++ b/firmware/target/arm/imx233/creative-zen/fmradio-target.h
@@ -18,23 +18,19 @@
* KIND, either express or implied.
*
****************************************************************************/
+#ifndef _FMRADIO_TARGET_H_
+#define _FMRADIO_TARGET_H_
-#include "config.h"
-#include "system.h"
-#include "fmradio_i2c.h"
-#include "pinctrl-imx233.h"
-#include "i2c.h"
+#define IMX233_FMRADIO_I2C FMI_HW
-void fmradio_i2c_init(void)
-{
-}
+#ifdef CREATIVE_ZENMOZAIC
+#define IMX233_FMRADIO_POWER FMP_GPIO
+#define FMP_GPIO_BANK 2
+#define FMP_GPIO_PIN 15
+#define FMP_GPIO_DELAY (HZ / 5)
+#else
+#define IMX233_FMRADIO_POWER FMP_NONE
+#endif
-int fmradio_i2c_write(unsigned char address, const unsigned char* buf, int count)
-{
- return i2c_write(address, buf, count);
-}
-
-int fmradio_i2c_read(unsigned char address, unsigned char* buf, int count)
-{
- return i2c_read(address, buf, count);
-}
+#endif /* _FMRADIO_TARGET_H_ */
+ \ No newline at end of file
diff --git a/firmware/target/arm/imx233/creative-zen/power-zen.c b/firmware/target/arm/imx233/creative-zen/power-zen.c
index c1ad5989c0..15da6ab201 100644
--- a/firmware/target/arm/imx233/creative-zen/power-zen.c
+++ b/firmware/target/arm/imx233/creative-zen/power-zen.c
@@ -21,44 +21,6 @@
#include "system.h"
#include "power.h"
-#include "tuner.h"
-#include "fmradio_i2c.h"
-#include "pinctrl-imx233.h"
-#include "power-imx233.h"
-
-static bool tuner_enable = false;
-static bool initialised = false;
-
-static void init(void)
-{
-#ifdef CREATIVE_ZENMOZAIC
- /* CE is B2P15 (active high) */
- imx233_pinctrl_acquire(2, 15, "tuner power");
- imx233_pinctrl_set_function(2, 15, PINCTRL_FUNCTION_GPIO);
- imx233_pinctrl_enable_gpio(2, 15, true);
-#endif
- initialised = true;
-}
-
-bool tuner_power(bool enable)
-{
- if(!initialised)
- init();
- if(tuner_enable != enable)
- {
-#ifdef CREATIVE_ZENMOZAIC
- imx233_pinctrl_set_gpio(2, 15, enable);
- sleep(HZ / 5);
-#endif
- tuner_enable = enable;
- }
- return tuner_enable;
-}
-
-bool tuner_powered(void)
-{
- return tuner_enable;
-}
void ide_power_enable(bool on)
{