add support for target 3c24xx (more known as Openmoko GTA02 "Freerunner") and merge...
[openwrt.git] / target / linux / s3c24xx / patches / 0107-fix-gsm-download-irq-balance-issue.patch.patch
1 From 95f161a3dc8b50ee354f5d9cd3785d3522bc1bb5 Mon Sep 17 00:00:00 2001
2 From: Andy Green <andy@openmoko.com>
3 Date: Fri, 25 Jul 2008 23:06:04 +0100
4 Subject: [PATCH] fix-gsm-download-irq-balance-issue.patch
5
6 Only enable or disable the interrupt if we see we are in the opposing state.
7 Also force that damn GSM download signal deasserted on probe at the time we
8 set the logical state for it to deasserted.
9
10 Signed-off-by: Andy Green <andy@openmoko.com>
11 ---
12  arch/arm/plat-s3c24xx/neo1973_pm_gsm.c |   28 +++++++++++++++++++++-------
13  1 files changed, 21 insertions(+), 7 deletions(-)
14
15 diff --git a/arch/arm/plat-s3c24xx/neo1973_pm_gsm.c b/arch/arm/plat-s3c24xx/neo1973_pm_gsm.c
16 index b4ea8ba..c3292b8 100644
17 --- a/arch/arm/plat-s3c24xx/neo1973_pm_gsm.c
18 +++ b/arch/arm/plat-s3c24xx/neo1973_pm_gsm.c
19 @@ -146,13 +146,24 @@ static ssize_t gsm_write(struct device *dev, struct device_attribute *attr,
20  #endif
21  #ifdef CONFIG_MACH_NEO1973_GTA02
22                 if (machine_is_neo1973_gta02()) {
23 -                       /* FIXME: Layering violation, we know how this relates to
24 -                        * the Jack-IRQ. And we assume the keyboard driver to be
25 -                        * around. */
26 -                       if (on)
27 -                           disable_irq(gpio_to_irq(GTA02_GPIO_JACK_INSERT));
28 -                       else
29 -                           enable_irq(gpio_to_irq(GTA02_GPIO_JACK_INSERT));
30 +                       /*
31 +                        * the keyboard / buttons driver requests and enables
32 +                        * the JACK_INSERT IRQ.  We have to take care about
33 +                        * not enabling and disabling the IRQ when it was
34 +                        * already in that state or we get "unblanaced IRQ"
35 +                        * kernel warnings and stack dumps.  So we use the
36 +                        * copy of the ndl_gsm state to figure out if we should
37 +                        * enable or disable the jack interrupt
38 +                        */
39 +                       if (on) {
40 +                               if (gta01_gsm.gpio_ndl_gsm)
41 +                                       disable_irq(gpio_to_irq(
42 +                                                      GTA02_GPIO_JACK_INSERT));
43 +                       } else {
44 +                               if (!gta01_gsm.gpio_ndl_gsm)
45 +                                       enable_irq(gpio_to_irq(
46 +                                                      GTA02_GPIO_JACK_INSERT));
47 +                       }
48  
49                         gta01_gsm.gpio_ndl_gsm = !on;
50                         s3c2410_gpio_setpin(GTA02_GPIO_nDL_GSM, !on);
51 @@ -263,7 +274,10 @@ static int __init gta01_gsm_probe(struct platform_device *pdev)
52         } else
53                 gta01_gsm.con = NULL;
54  
55 +       /* note that download initially disabled, and enforce that */
56         gta01_gsm.gpio_ndl_gsm = 1;
57 +       if (machine_is_neo1973_gta02())
58 +               s3c2410_gpio_setpin(GTA02_GPIO_nDL_GSM, 1);
59  
60         return sysfs_create_group(&pdev->dev.kobj, &gta01_gsm_attr_group);
61  }
62 -- 
63 1.5.6.3
64