summaryrefslogtreecommitdiffstats
path: root/firmware/target/arm/imx233/pinctrl-imx233.c
diff options
context:
space:
mode:
authorAmaury Pouly <amaury.pouly@gmail.com>2013-06-16 19:32:21 +0200
committerAmaury Pouly <amaury.pouly@gmail.com>2013-06-17 00:29:24 +0200
commit8f351d6e212e3b726a9d9020ed8a4119bb68e77e (patch)
treed4ab979baf0c6e56b90a3df5c2ace9cfb924cc47 /firmware/target/arm/imx233/pinctrl-imx233.c
parent918a06a12ad633a29634f3249990ba04ce9fb00b (diff)
downloadrockbox-8f351d6e212e3b726a9d9020ed8a4119bb68e77e.tar.gz
rockbox-8f351d6e212e3b726a9d9020ed8a4119bb68e77e.tar.bz2
rockbox-8f351d6e212e3b726a9d9020ed8a4119bb68e77e.zip
imx233: enhance pinctrl irq with user pointer
Change-Id: I191704299487598a853af4df5aebbbf8a7134a34
Diffstat (limited to 'firmware/target/arm/imx233/pinctrl-imx233.c')
-rw-r--r--firmware/target/arm/imx233/pinctrl-imx233.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/firmware/target/arm/imx233/pinctrl-imx233.c b/firmware/target/arm/imx233/pinctrl-imx233.c
index 5dc25031b1..ab59532543 100644
--- a/firmware/target/arm/imx233/pinctrl-imx233.c
+++ b/firmware/target/arm/imx233/pinctrl-imx233.c
@@ -63,6 +63,7 @@ const char *imx233_pinctrl_blame(unsigned bank, unsigned pin)
#endif
static pin_irq_cb_t pin_cb[3][32]; /* 3 banks, 32 pins/bank */
+static intptr_t pin_cb_user[3][32];
static void INT_GPIO(int bank)
{
@@ -71,9 +72,12 @@ static void INT_GPIO(int bank)
if(fire & (1 << pin))
{
pin_irq_cb_t cb = pin_cb[bank][pin];
- imx233_pinctrl_setup_irq(bank, pin, false, false, false, NULL);
+ intptr_t arg = pin_cb_user[bank][pin];
+ /* WARNING: this call will modify pin_cb and pin_cb_user, that's
+ * why we copy the data before ! */
+ imx233_pinctrl_setup_irq(bank, pin, false, false, false, NULL, 0);
if(cb)
- cb(bank, pin);
+ cb(bank, pin, arg);
}
}
@@ -92,13 +96,14 @@ void INT_GPIO2(void)
INT_GPIO(2);
}
-void imx233_pinctrl_setup_irq(int bank, int pin, bool enable_int,
- bool level, bool polarity, pin_irq_cb_t cb)
+void imx233_pinctrl_setup_irq(unsigned bank, unsigned pin, bool enable_int,
+ bool level, bool polarity, pin_irq_cb_t cb, intptr_t user)
{
HW_PINCTRL_PIN2IRQn_CLR(bank) = 1 << pin;
HW_PINCTRL_IRQENn_CLR(bank) = 1 << pin;
HW_PINCTRL_IRQSTATn_CLR(bank) = 1 << pin;
pin_cb[bank][pin] = cb;
+ pin_cb_user[bank][pin] = user;
if(enable_int)
{
if(level)