summaryrefslogtreecommitdiffstats
path: root/firmware/target/arm/imx233/lradc-imx233.h
diff options
context:
space:
mode:
authorAmaury Pouly <amaury.pouly@gmail.com>2013-06-16 20:59:36 +0200
committerAmaury Pouly <amaury.pouly@gmail.com>2013-06-17 00:29:25 +0200
commitf4fdf1ffe2189dafd1ebbbbf50f1a4626364ead3 (patch)
tree03a43c6fd5d20fd9354e34903840f7d7baffa117 /firmware/target/arm/imx233/lradc-imx233.h
parent239219ee70aa02a324fb94b6e463781c5c77beea (diff)
downloadrockbox-f4fdf1ffe2189dafd1ebbbbf50f1a4626364ead3.tar.gz
rockbox-f4fdf1ffe2189dafd1ebbbbf50f1a4626364ead3.tar.bz2
rockbox-f4fdf1ffe2189dafd1ebbbbf50f1a4626364ead3.zip
imx233: fix lradc/adc for stmp3600 and stmp3700
The lradc architecture of the stmp3600 is rather different: only channels 6 and 7 have configurable source and we need to take care when allocating channels so that we can actually measure the right channel! Delegate die temperature sensing to the power block on stmp3600. Change-Id: I0860eb4ea98240facc3d4a19d61684eca5f630cc
Diffstat (limited to 'firmware/target/arm/imx233/lradc-imx233.h')
-rw-r--r--firmware/target/arm/imx233/lradc-imx233.h11
1 files changed, 9 insertions, 2 deletions
diff --git a/firmware/target/arm/imx233/lradc-imx233.h b/firmware/target/arm/imx233/lradc-imx233.h
index d1529f4266..f274db3520 100644
--- a/firmware/target/arm/imx233/lradc-imx233.h
+++ b/firmware/target/arm/imx233/lradc-imx233.h
@@ -55,10 +55,12 @@
#define LRADC_SRC_NMOS_THICK LRADC_SRC(10)
#define LRADC_SRC_PMOS_THICK LRADC_SRC(11)
#define LRADC_SRC_PMOS_THICK LRADC_SRC(11)
+#if IMX233_SUBTARGET >= 3700
#define LRADC_SRC_USB_DP LRADC_SRC(12)
#define LRADC_SRC_USB_DN LRADC_SRC(13)
#define LRADC_SRC_VBG LRADC_SRC(14)
#define LRADC_SRC_5V LRADC_SRC(15)
+#endif
/* frequency of the delay counter */
#define LRADC_DELAY_FREQ 2000
@@ -72,14 +74,17 @@ void imx233_lradc_setup_delay(int dchan, int trigger_lradc, int trigger_delays,
void imx233_lradc_clear_channel_irq(int channel);
bool imx233_lradc_read_channel_irq(int channel);
void imx233_lradc_enable_channel_irq(int channel, bool enable);
+/* a non-null cb will enable the icoll interrupt, a null one will disable it
+ * NOTE the channel irq is automatically cleared */
void imx233_lradc_set_channel_irq_callback(int channel, lradc_irq_fn_t cb);
void imx233_lradc_kick_channel(int channel);
void imx233_lradc_kick_delay(int dchan);
void imx233_lradc_wait_channel(int channel);
int imx233_lradc_read_channel(int channel);
void imx233_lradc_clear_channel(int channel);
-// acquire a virtual channel, returns -1 on timeout, channel otherwise */
-int imx233_lradc_acquire_channel(int timeout);
+/* acquire a channel, returns -1 on timeout, channel otherwise
+ * the returned channel is garanteed to be able measure source src */
+int imx233_lradc_acquire_channel(int src, int timeout);
void imx233_lradc_release_channel(int chan);
// doesn't check that channel is in use!
void imx233_lradc_reserve_channel(int channel);
@@ -96,9 +101,11 @@ void imx233_lradc_enable_touch_detect_irq(bool enable);
void imx233_lradc_clear_touch_detect_irq(void);
bool imx233_lradc_read_touch_detect(void);
+#if IMX233_SUBTARGET >= 3700
/* enable sensing and return temperature in kelvin,
* channels needs not to be configured */
int imx233_lradc_sense_die_temperature(int nmos_chan, int pmos_chan);
+#endif
/* return *raw* external temperature, might need some transformation
* channel needs not to be configured */
int imx233_lradc_sense_ext_temperature(int chan, int sensor);