summaryrefslogtreecommitdiffstats
path: root/firmware/target/arm/imx233/lradc-imx233.h
diff options
context:
space:
mode:
authorAmaury Pouly <amaury.pouly@gmail.com>2012-05-19 13:36:23 +0200
committerAmaury Pouly <amaury.pouly@gmail.com>2012-05-19 16:10:52 +0200
commit55e01b8de46555929f62a9eb762d7791786ccc58 (patch)
tree71c657f38d4d5c461803caf8bda362728284fa01 /firmware/target/arm/imx233/lradc-imx233.h
parent01216c5ad3f2996d16cd7279387d2df859ec019b (diff)
downloadrockbox-55e01b8de46555929f62a9eb762d7791786ccc58.tar.gz
rockbox-55e01b8de46555929f62a9eb762d7791786ccc58.tar.bz2
rockbox-55e01b8de46555929f62a9eb762d7791786ccc58.zip
imx233: enhance lradc driver with touchscreen specific stuff
Change-Id: I83759a00257274c0cbde5a78306256abd2c83800
Diffstat (limited to 'firmware/target/arm/imx233/lradc-imx233.h')
-rw-r--r--firmware/target/arm/imx233/lradc-imx233.h29
1 files changed, 27 insertions, 2 deletions
diff --git a/firmware/target/arm/imx233/lradc-imx233.h b/firmware/target/arm/imx233/lradc-imx233.h
index b661fa8aa4..f71843b3db 100644
--- a/firmware/target/arm/imx233/lradc-imx233.h
+++ b/firmware/target/arm/imx233/lradc-imx233.h
@@ -31,12 +31,19 @@
#define HW_LRADC_BASE 0x80050000
#define HW_LRADC_CTRL0 (*(volatile uint32_t *)(HW_LRADC_BASE + 0x0))
+#define HW_LRADC_CTRL0__XPLUS_ENABLE (1 << 16)
+#define HW_LRADC_CTRL0__YPLUS_ENABLE (1 << 17)
+#define HW_LRADC_CTRL0__XMINUS_ENABLE (1 << 18)
+#define HW_LRADC_CTRL0__YMINUS_ENABLE (1 << 19)
+#define HW_LRADC_CTRL0__TOUCH_DETECT_ENABLE (1 << 20)
#define HW_LRADC_CTRL0__ONCHIP_GROUNDREF (1 << 21)
#define HW_LRADC_CTRL0__SCHEDULE(x) (1 << (x))
#define HW_LRADC_CTRL1 (*(volatile uint32_t *)(HW_LRADC_BASE + 0x10))
-#define HW_LRADC_CTRL1__LRADCx_IRQ(x) (1 << (x))
-#define HW_LRADC_CTRL1__LRADCx_IRQ_EN(x) (1 << ((x) + 16))
+#define HW_LRADC_CTRL1__LRADCx_IRQ(x) (1 << (x))
+#define HW_LRADC_CTRL1__TOUCH_DETECT_IRQ (1 << 8)
+#define HW_LRADC_CTRL1__LRADCx_IRQ_EN(x) (1 << ((x) + 16))
+#define HW_LRADC_CTRL1__TOUCH_DETECT_IRQ_EN (1 << 24)
#define HW_LRADC_CTRL2 (*(volatile uint32_t *)(HW_LRADC_BASE + 0x20))
#define HW_LRADC_CTRL2__TEMP_ISRC1_BP 4
@@ -63,6 +70,7 @@
#define HW_LRADC_CTRL3__CYCLE_TIME__2MHz (3 << 8)
#define HW_LRADC_STATUS (*(volatile uint32_t *)(HW_LRADC_BASE + 0x40))
+#define HW_LRADC_STATUS__TOUCH_DETECT_RAW (1 << 0)
#define HW_LRADC_CHx(x) (*(volatile uint32_t *)(HW_LRADC_BASE + 0x50 + (x) * 0x10))
#define HW_LRADC_CHx__NUM_SAMPLES_BM (0x1f << 24)
@@ -100,6 +108,10 @@
#define HW_LRADC_NUM_DELAYS 4
#define HW_LRADC_CHANNEL(x) (x)
+#define HW_LRADC_CHANNEL_XPLUS HW_LRADC_CHANNEL(2)
+#define HW_LRADC_CHANNEL_YPLUS HW_LRADC_CHANNEL(3)
+#define HW_LRADC_CHANNEL_XMINUS HW_LRADC_CHANNEL(4)
+#define HW_LRADC_CHANNEL_YMINUS HW_LRADC_CHANNEL(5)
#define HW_LRADC_CHANNEL_VDDIO HW_LRADC_CHANNEL(6)
#define HW_LRADC_CHANNEL_BATTERY HW_LRADC_CHANNEL(7)
#define HW_LRADC_CHANNEL_PMOS_THIN HW_LRADC_CHANNEL(8)
@@ -112,10 +124,16 @@
#define HW_LRADC_CHANNEL_VBG HW_LRADC_CHANNEL(14)
#define HW_LRADC_CHANNEL_5V HW_LRADC_CHANNEL(15)
+typedef void (*lradc_irq_fn_t)(int chan);
+
void imx233_lradc_init(void);
void imx233_lradc_setup_channel(int channel, bool div2, bool acc, int nr_samples, int src);
void imx233_lradc_setup_delay(int dchan, int trigger_lradc, int trigger_delays,
int loop_count, int delay);
+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);
+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);
@@ -132,6 +150,13 @@ int imx233_lradc_acquire_delay(int timeout);
void imx233_lradc_reserve_delay(int dchannel);
void imx233_lradc_release_delay(int dchan);
+/* Setup touch x/yminus pull donws and x/yplus pull ups */
+void imx233_lradc_setup_touch(bool xminus_enable, bool yminus_enable,
+ bool xplus_enable, bool yplus_enable, bool touch_detect);
+void imx233_lradc_enable_touch_detect_irq(bool enable);
+void imx233_lradc_clear_touch_detect_irq(void);
+bool imx233_lradc_read_touch_detect(void);
+
/* 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);