]> pilppa.org Git - familiar-h63xx-build.git/blob - org.handhelds.familiar/packages/linux/openzaurus-pxa-2.4.18-rmk7-pxa3-embedix20031107/tosa_ts.patch
OE tree imported from monotone branch org.openembedded.oz354fam083 at revision 8b12e3...
[familiar-h63xx-build.git] / org.handhelds.familiar / packages / linux / openzaurus-pxa-2.4.18-rmk7-pxa3-embedix20031107 / tosa_ts.patch
1
2 #
3 # Patch managed by http://www.holgerschurig.de/patcher.html
4 #
5
6 --- linux/drivers/char/tosa_ts.c~tosa_ts.patch
7 +++ linux/drivers/char/tosa_ts.c
8 @@ -102,6 +102,8 @@
9  static int head = 0, tail = 0;
10  
11  #ifdef CONFIG_PM
12 +#include <linux/pm.h>
13 +static struct pm_dev* tosa_ts_pm_dev;
14  static int tp_suspend = 0;
15  #endif /* CONFIG_PM */
16  
17 @@ -495,25 +497,6 @@
18         ioctl:          ts_ioctl,
19  };
20  
21 -static void ts_exit(void)
22 -{
23 -  ts_timer_clear();
24 -  ts_clear();
25 -  free_irq(IRQ_GPIO_TP_INT, NULL);
26 -  wm9712_power_mode_ts(WM9712_PWR_OFF);
27 -  
28 -  pxa_ac97_put(&ac97_on);
29 -}
30 -
31 -#ifdef MODULE
32 -static void __exit ac97_ts_cleanup(void)
33 -{
34 -  ts_exit();
35 -  unregister_chrdev(TS_MAJOR, "ts");
36 -}
37 -module_exit(ac97_ts_cleanup);
38 -#endif /* MODULE */
39 -
40  extern int tc6393fb_lcdMode;
41  
42  int ac97_ad_input(int ch, unsigned short *dat)
43 @@ -608,7 +591,7 @@
44  #endif
45  }
46  
47 -static int ts_init(void)
48 +static int tosa_ts_hardware_start(void)
49  {
50    pxa_ac97_get(&codec, &ac97_on);
51  
52 @@ -625,7 +608,6 @@
53    /* GPIO3/PENDOWN wakeup */
54    ac97_bit_set(AC97_GPIO_WAKE_UP, CODEC_PENDOWN);
55  
56 -  ts_clear();
57  
58    /* Init queue */
59   //X   kernel_thread(ts_pendown, NULL, CLONE_FS | CLONE_FILES | CLONE_SIGHAND | SIGCHLD);
60 @@ -639,12 +621,39 @@
61      return -EBUSY;
62    }
63  
64 -  //  printk(KERN_INFO "Tosa Touch Screen driver initialized\n");
65 -
66    return 0;
67  }
68  
69 -static int __init ac97_ts_init(void)
70 +static void tosa_ts_hardware_stop(void)
71 +{
72 +  ts_timer_clear();
73 +  ts_clear();
74 +  free_irq(IRQ_GPIO_TP_INT, NULL);
75 +  wm9712_power_mode_ts(WM9712_PWR_OFF);
76 +  
77 +  pxa_ac97_put(&ac97_on);
78 +}
79 +
80 +#ifdef CONFIG_PM
81 +static int tosa_ts_pm_callback(struct pm_dev *pm_dev,
82 +                                  pm_request_t req, void *data)
83 +{
84 +        switch (req) {
85 +        case PM_SUSPEND:
86 +                tp_suspend = 1;
87 +                tosa_ts_hardware_stop();
88 +               break;
89 +        case PM_RESUME:
90 +                tp_suspend = 0;
91 +                tosa_ts_hardware_start();
92 +                break;
93 +        }
94 +        return 0;
95 +}
96 +#endif
97 +
98 +
99 +static int __init tosa_ts_init(void)
100  {
101    ac97_on = 0;
102  
103 @@ -663,28 +672,37 @@
104    
105    if( register_chrdev(TS_MAJOR,DEV_NAME, &ts_fops) ) {
106      printk("unable to get major %d for touch screen\n", TS_MAJOR);
107 -    ts_exit();
108    }
109  
110    init_procinfo();
111  
112 +  tosa_ts_hardware_start();
113 +
114 +#ifdef CONFIG_PM
115 +  tosa_ts_pm_dev = pm_register(PM_SYS_DEV, 0, tosa_ts_pm_callback);
116 +#endif
117 +
118    kernel_thread(ts_pendown, NULL, CLONE_FS | CLONE_FILES | CLONE_SIGHAND | SIGCHLD);
119  
120    return 0;
121  }
122  
123 -module_init(ac97_ts_init);
124 +static int __exit tosa_ts_cleanup()
125 +{
126 +  tosa_hardware_stop();
127 +  pm_unregister(tosa_ts_pm_dev);
128 +  unregister_chrdev(TS_MAJOR, "ts");
129 +}
130 +
131 +module_init(tosa_ts_init);
132 +module_exit(tosa_ts_cleanup);
133  
134  /*
135   * Driver functions
136   */
137  static int ts_open(struct inode *inode, struct file *file)
138  {
139 -  if( ts_init() < 0 ) {
140 -    ts_exit();
141 -    return -EINVAL;
142 -  }
143 -
144 +  ts_clear();
145    MOD_INC_USE_COUNT;
146    return 0;
147  }
148 @@ -692,7 +710,6 @@
149  
150  static int ts_release(struct inode *inode, struct file *file)
151  {
152 -  ts_exit();
153  
154    MOD_DEC_USE_COUNT;
155    return 0;
156 @@ -788,20 +805,3 @@
157    return 0;
158  }
159  
160 -#ifdef CONFIG_PM
161 -void tosa_ts_suspend(void)
162 -{
163 -  DEBUG(DBG_L1, "in\n");
164 -  tp_suspend = 1;
165 -  ts_exit();
166 -  DEBUG(DBG_L1, "out\n");
167 -}
168 -
169 -void tosa_ts_resume(void)
170 -{
171 -  DEBUG(DBG_L1, "in\n");
172 -  tp_suspend = 0;
173 -  ts_init();
174 -  DEBUG(DBG_L1, "out\n");
175 -}
176 -#endif /* CONFIG_PM */
177 --- linux/drivers/sound/pxa-ac97_tosa.c~tosa_ts.patch
178 +++ linux/drivers/sound/pxa-ac97_tosa.c
179 @@ -90,8 +90,6 @@
180  #include <linux/pm.h>
181  static struct pm_dev* pxa_sound_pm_dev;
182  static int tosa_pm_callback(struct pm_dev *,pm_request_t, void *);
183 -extern void tosa_ts_suspend(void);
184 -extern void tosa_ts_resume(void);
185  #endif /* CONFIG_PM */
186  
187  /************************************************************
188 @@ -2195,9 +2193,6 @@
189    case PM_SUSPEND:
190      DEBUG(DBG_L1, "PM_SUSPEND: start\n");
191      wm9712_suspend();
192 -#ifdef CONFIG_TOSA_TS
193 -    tosa_ts_suspend();
194 -#endif /* CONFIG_TOSA_TS */
195      if ( ac97_audio_state.rd_ref != 0 ) {
196        audio_clear_buf(ac97_audio_state.input_stream);
197        *ac97_audio_state.input_stream->drcmr = 0;
198 @@ -2239,9 +2234,6 @@
199        ac97_audio_state.input_stream->dma_ch = err;
200      }
201      wm9712_resume();
202 -#ifdef CONFIG_TOSA_TS
203 -    tosa_ts_resume();
204 -#endif /* CONFIG_TOSA_TS */
205      DEBUG(DBG_L1, "PM_RESUME: done\n");
206      break;
207    }