From 2220a4b695f2f5ac9fe212de4bcfa5365318136f Mon Sep 17 00:00:00 2001 From: Michael Sevakis Date: Sat, 28 Jan 2017 14:43:35 -0500 Subject: Improve imx31 interrupt code for PMIC and GPIO Fix stuff that was bugging me about the way I did it at first. While messing around I found RDS code wasn't masking its GPIO ISR as it should, which might lead to two different interrupts messing with the static data. Change-Id: I54626809ea3039a842af0cc9e3e42853326c4193 --- firmware/target/arm/imx31/gigabeat-s/gpio-target.h | 51 +++++++++++----------- 1 file changed, 25 insertions(+), 26 deletions(-) (limited to 'firmware/target/arm/imx31/gigabeat-s/gpio-target.h') diff --git a/firmware/target/arm/imx31/gigabeat-s/gpio-target.h b/firmware/target/arm/imx31/gigabeat-s/gpio-target.h index 4903d0f631..543b25f244 100644 --- a/firmware/target/arm/imx31/gigabeat-s/gpio-target.h +++ b/firmware/target/arm/imx31/gigabeat-s/gpio-target.h @@ -23,34 +23,33 @@ #ifndef GPIO_TARGET_H #define GPIO_TARGET_H -/* MC13783 GPIO pin info for this target */ -#define MC13783_GPIO_IMR GPIO1_IMR -#define MC13783_GPIO_NUM GPIO1_NUM -#define MC13783_GPIO_ISR GPIO1_ISR -#define MC13783_GPIO_LINE 31 - -/* SI4700 GPIO STC/RDS pin info for this target */ -#define SI4700_GPIO_STC_RDS_IMR GPIO1_IMR -#define SI4700_GPIO_STC_RDS_NUM GPIO1_NUM -#define SI4700_GPIO_STC_RDS_ISR GPIO1_ISR -#define SI4700_GPIO_STC_RDS_LINE 27 +/* Gigabeat S definitions for static GPIO event registration */ +#include "gpio-imx31.h" + +#ifdef DEFINE_GPIO_VECTOR_TABLE + +GPIO_VECTOR_TBL_START() + /* mc13783 keeps the PRIINT high (no low pulse) if other unmasked + * interrupts become active when clearing them or if a source being + * cleared becomes active at that time. Edge-detection will not get + * a rising edge in that case so use high-level sense. */ + GPIO_EVENT_VECTOR(GPIO1_31, GPIO_SENSE_HIGH_LEVEL) +#if CONFIG_TUNER + /* Generates a 5ms low pulse on the line - detect the falling edge */ + GPIO_EVENT_VECTOR(GPIO1_27, GPIO_SENSE_FALLING) +#endif /* CONFIG_TUNER */ +GPIO_VECTOR_TBL_END() #define GPIO1_INT_PRIO INT_PRIO_DEFAULT -/* Declare event indexes in priority order in a packed array */ -enum gpio_event_ids -{ - /* GPIO1 event IDs */ - MC13783_EVENT_ID = GPIO1_EVENT_FIRST, - SI4700_STC_RDS_EVENT_ID, - GPIO1_NUM_EVENTS = 2, - /* GPIO2 event IDs */ - /* none defined */ - /* GPIO3 event IDs */ - /* none defined */ -}; - -void mc13783_event(void); -void si4700_stc_rds_event(void); +#endif /* DEFINE_GPIO_VECTOR_TABLE */ + +#define INT_MC13783 GPIO1_31_EVENT_CB +#define MC13783_EVENT_ID GPIO1_31_ID + +#if CONFIG_TUNER +#define INT_SI4700_RDS GPIO1_27_EVENT_CB +#define SI4700_EVENT_ID GPIO1_27_ID +#endif /* CONFIG_TUNER */ #endif /* GPIO_TARGET_H */ -- cgit v1.2.3