summaryrefslogtreecommitdiffstats
path: root/firmware/target/arm/imx233/fmradio-imx233.h
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/fmradio-imx233.h
parentc2c2274e0adacc1a0c5bdb57fa1367badb7b047f (diff)
downloadrockbox-446f352abda2dbc9de90c35a02100ed5e9aad77c.tar.gz
rockbox-446f352abda2dbc9de90c35a02100ed5e9aad77c.tar.bz2
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/fmradio-imx233.h')
-rw-r--r--firmware/target/arm/imx233/fmradio-imx233.h64
1 files changed, 64 insertions, 0 deletions
diff --git a/firmware/target/arm/imx233/fmradio-imx233.h b/firmware/target/arm/imx233/fmradio-imx233.h
new file mode 100644
index 0000000000..d53336dd40
--- /dev/null
+++ b/firmware/target/arm/imx233/fmradio-imx233.h
@@ -0,0 +1,64 @@
+/***************************************************************************
+ * __________ __ ___.
+ * Open \______ \ ____ ____ | | _\_ |__ _______ ___
+ * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
+ * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
+ * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
+ * \/ \/ \/ \/ \/
+ * $Id$
+ *
+ * Copyright (C) 2013 by Amaury Pouly
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
+ * KIND, either express or implied.
+ *
+ ****************************************************************************/
+#ifndef __fmradio_imx233__
+#define __fmradio_imx233__
+
+#include "config.h"
+#include "tuner.h"
+#include "fmradio_i2c.h"
+#include "tuner.h"
+
+/** This driver implements fmradio i2c and tuner power in a generic way. It
+ * currently provides two possible implementation of i2c:
+ * - hardware using i2c-imx233 driver
+ * - software using generic-i2c driver
+ * And it provides tuner power by toggling an optional GPIO.
+ * It can be tweaked using the following defines
+ * and variables:
+ * - IMX233_FMRADIO_I2C
+ * - IMX233_FMRADIO_POWER
+ *
+ * The available values of IMX233_FMRADIO_I2C are:
+ * - FMI_HW: use hardware i2c driver
+ * - FMI_SW: use software i2c driver, needs additional defines:
+ * + FMI_SW_SDA_BANK: the SDA pin bank
+ * + FMI_SW_SDA_PIN: the SDA pin within bank
+ * + FMI_SW_SCL_BANK: the SCL pin bank
+ * + FMI_SW_SCL_PIN: the SCL pin bank
+ * The available values of IMX233_FMRADIO_POWER are:
+ * - FMP_NONE: tuner has no power control
+ * - FMP_GPIO: tuner power is controlled by a GPIO, needs additional defines:
+ * + FMP_GPIO_BANK: pin bank
+ * + FMP_GPIO_PIN: pin within bank
+ * + FMP_GPIO_INVERTED: define if inverted, default is active high
+ * + FMP_GPIO_DELAY: delay to power up/down (in ticks)
+ */
+
+/* i2c method */
+#define FMI_HW 0
+#define FMI_SW 1
+
+/* power method */
+#define FMP_NONE 0
+#define FMP_GPIO 1
+
+#endif /* __fmradio_imx233__ */
+