summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex Gonzalez <alex.gonzalez@digi.com>2012-02-21 12:05:20 +0100
committerAlex Gonzalez <alex.gonzalez@digi.com>2012-02-21 12:14:09 +0100
commit813a95ac0757995ae76d873ce14e41fc60a61965 (patch)
tree5b00b2c93c9c9dc991705344945dd0dd8002428a
parentdac0169edb4a0f3043038f54c4c4cbab35b95af9 (diff)
mc13892: Mask not relevant events on ADC suspend.
The ADC suspend happens early in the suspend process and it is the best place to suspend not wanted events that may abort the suspend. This fixes Vantive 42007. Signed-off-by: Alex Gonzalez <alex.gonzalez@digi.com>
-rw-r--r--arch/arm/mach-mx5/mx51_ccwmx51js_pmic_mc13892.c43
-rw-r--r--drivers/mxc/pmic/mc13892/pmic_adc.c6
2 files changed, 49 insertions, 0 deletions
diff --git a/arch/arm/mach-mx5/mx51_ccwmx51js_pmic_mc13892.c b/arch/arm/mach-mx5/mx51_ccwmx51js_pmic_mc13892.c
index 9050e3586cae..fbf097528041 100644
--- a/arch/arm/mach-mx5/mx51_ccwmx51js_pmic_mc13892.c
+++ b/arch/arm/mach-mx5/mx51_ccwmx51js_pmic_mc13892.c
@@ -26,6 +26,8 @@
#include <mach/irqs.h>
#include "mx51_pins.h"
+static unsigned int irqmasks[2];
+
/*
* Convenience conversion.
* Here atm, maybe there is somewhere better for this.
@@ -335,6 +337,47 @@ static void power_on_evt_handler(void)
}
#endif
+int ccxmx51_pm_mc13892_mask_irqs( void )
+{
+ int ev;
+
+ // Store current masks
+ pmic_get_enabled_events(irqmasks);
+
+ // Mask all events except power button and RTC
+ for( ev=0 ; ev < EVENT_NB ; ev++ ){
+ if( ev == EVENT_PWRONI || ev == EVENT_TODAI )
+ continue;
+ if( !pmic_is_event_masked(irqmasks,ev) )
+ pmic_event_mask(ev);
+ }
+ return 0;
+}
+
+int ccxmx51_pm_mc13892_unmask_irqs( void )
+{
+ int ev;
+ unsigned int current_irqmasks[2];
+
+ // Fetch current event mask
+ pmic_get_enabled_events(current_irqmasks);
+
+ // For all events
+ for( ev=0 ; ev < EVENT_NB ; ev++ ){
+ if( pmic_is_event_masked(irqmasks,ev) ){
+ if( !pmic_is_event_masked(current_irqmasks,ev) ){
+ pmic_event_mask(ev);
+ }
+ }
+ else{
+ if( pmic_is_event_masked(current_irqmasks,ev) ){
+ pmic_event_unmask(ev);
+ }
+ }
+ }
+ return 0;
+}
+
static int mc13892_regulator_init(struct mc13892 *mc13892)
{
unsigned int value, register_mask;
diff --git a/drivers/mxc/pmic/mc13892/pmic_adc.c b/drivers/mxc/pmic/mc13892/pmic_adc.c
index 3e17f3d8f714..998334361c2a 100644
--- a/drivers/mxc/pmic/mc13892/pmic_adc.c
+++ b/drivers/mxc/pmic/mc13892/pmic_adc.c
@@ -43,6 +43,9 @@
static int mc13892_adc_major;
static struct class *mc13892_adc_class;
+extern int ccxmx51_pm_mc13892_mask_irqs( void );
+extern int ccxmx51_pm_mc13892_unmask_irqs( void );
+
/*
* Maximun allowed variation in the three X/Y co-ordinates acquired from
* touch-screen
@@ -254,6 +257,7 @@ static int pmic_adc_suspend(struct platform_device *pdev, pm_message_t state)
CHECK_ERROR(pmic_write_reg(REG_ADC3, DEF_ADC_3, PMIC_ALL_BITS));
CHECK_ERROR(pmic_write_reg(REG_ADC4, 0, PMIC_ALL_BITS));
+ ccxmx51_pm_mc13892_mask_irqs();
return 0;
};
@@ -270,6 +274,8 @@ static int pmic_adc_resume(struct platform_device *pdev)
adc_1_reg = ADC_WAIT_TSI_1 | (ADC_BIS * adc_ts);
CHECK_ERROR(pmic_write_reg(REG_ADC1, adc_1_reg, PMIC_ALL_BITS));
+ ccxmx51_pm_mc13892_unmask_irqs();
+
while (swait > 0) {
swait--;
wake_up_interruptible(&suspendq);