2 * wm97xx-core.c -- Touch screen driver core for Wolfson WM9705, WM9712
3 * and WM9713 AC97 Codecs.
5 * Copyright 2003, 2004, 2005, 2006, 2007, 2008 Wolfson Microelectronics PLC.
6 * Author: Liam Girdwood <lrg@slimlogic.co.uk>
7 * Parts Copyright : Ian Molton <spyro@f2s.com>
8 * Andrew Zabolotny <zap@homelink.ru>
9 * Russell King <rmk@arm.linux.org.uk>
11 * This program is free software; you can redistribute it and/or modify it
12 * under the terms of the GNU General Public License as published by the
13 * Free Software Foundation; either version 2 of the License, or (at your
14 * option) any later version.
19 * - supports WM9705, WM9712, WM9713
21 * - continuous mode (arch-dependent)
22 * - adjustable rpu/dpp settings
23 * - adjustable pressure current
24 * - adjustable sample settle delay
25 * - 4 and 5 wire touchscreens (5 wire is WM9712 only)
26 * - pen down detection
31 * - codec event notification
33 * - Support for async sampling control for noisy LCDs.
37 #include <linux/module.h>
38 #include <linux/moduleparam.h>
39 #include <linux/kernel.h>
40 #include <linux/init.h>
41 #include <linux/delay.h>
42 #include <linux/string.h>
43 #include <linux/proc_fs.h>
45 #include <linux/interrupt.h>
46 #include <linux/bitops.h>
47 #include <linux/workqueue.h>
48 #include <linux/wm97xx.h>
49 #include <linux/uaccess.h>
52 #define TS_NAME "wm97xx"
53 #define WM_CORE_VERSION "1.00"
54 #define DEFAULT_PRESSURE 0xb0c0
58 * Touchscreen absolute values
60 * These parameters are used to help the input layer discard out of
61 * range readings and reduce jitter etc.
63 * o min, max:- indicate the min and max values your touch screen returns
64 * o fuzz:- use a higher number to reduce jitter
66 * The default values correspond to Mainstone II in QVGA mode
69 * Documentation/input/input-programming.txt for more details.
72 static int abs_x[3] = {350, 3900, 5};
73 module_param_array(abs_x, int, NULL, 0);
74 MODULE_PARM_DESC(abs_x, "Touchscreen absolute X min, max, fuzz");
76 static int abs_y[3] = {320, 3750, 40};
77 module_param_array(abs_y, int, NULL, 0);
78 MODULE_PARM_DESC(abs_y, "Touchscreen absolute Y min, max, fuzz");
80 static int abs_p[3] = {0, 150, 4};
81 module_param_array(abs_p, int, NULL, 0);
82 MODULE_PARM_DESC(abs_p, "Touchscreen absolute Pressure min, max, fuzz");
85 * wm97xx IO access, all IO locking done by AC97 layer
87 int wm97xx_reg_read(struct wm97xx *wm, u16 reg)
90 return wm->ac97->bus->ops->read(wm->ac97, reg);
94 EXPORT_SYMBOL_GPL(wm97xx_reg_read);
96 void wm97xx_reg_write(struct wm97xx *wm, u16 reg, u16 val)
98 /* cache digitiser registers */
99 if (reg >= AC97_WM9713_DIG1 && reg <= AC97_WM9713_DIG3)
100 wm->dig[(reg - AC97_WM9713_DIG1) >> 1] = val;
102 /* cache gpio regs */
103 if (reg >= AC97_GPIO_CFG && reg <= AC97_MISC_AFE)
104 wm->gpio[(reg - AC97_GPIO_CFG) >> 1] = val;
111 wm->ac97->bus->ops->write(wm->ac97, reg, val);
113 EXPORT_SYMBOL_GPL(wm97xx_reg_write);
116 * wm97xx_read_aux_adc - Read the aux adc.
117 * @wm: wm97xx device.
118 * @adcsel: codec ADC to be read
120 * Reads the selected AUX ADC.
123 int wm97xx_read_aux_adc(struct wm97xx *wm, u16 adcsel)
125 int power_adc = 0, auxval;
129 mutex_lock(&wm->codec_mutex);
131 /* When the touchscreen is not in use, we may have to power up
132 * the AUX ADC before we can use sample the AUX inputs->
134 if (wm->id == WM9713_ID2 &&
135 (power = wm97xx_reg_read(wm, AC97_EXTENDED_MID)) & 0x8000) {
137 wm97xx_reg_write(wm, AC97_EXTENDED_MID, power & 0x7fff);
140 /* Prepare the codec for AUX reading */
141 wm->codec->aux_prepare(wm);
143 /* Turn polling mode on to read AUX ADC */
144 wm->pen_probably_down = 1;
145 wm->codec->poll_sample(wm, adcsel, &auxval);
148 wm97xx_reg_write(wm, AC97_EXTENDED_MID, power | 0x8000);
150 wm->codec->dig_restore(wm);
152 wm->pen_probably_down = 0;
154 mutex_unlock(&wm->codec_mutex);
155 return auxval & 0xfff;
157 EXPORT_SYMBOL_GPL(wm97xx_read_aux_adc);
160 * wm97xx_get_gpio - Get the status of a codec GPIO.
161 * @wm: wm97xx device.
164 * Get the status of a codec GPIO pin
167 enum wm97xx_gpio_status wm97xx_get_gpio(struct wm97xx *wm, u32 gpio)
170 enum wm97xx_gpio_status ret;
172 mutex_lock(&wm->codec_mutex);
173 status = wm97xx_reg_read(wm, AC97_GPIO_STATUS);
176 ret = WM97XX_GPIO_HIGH;
178 ret = WM97XX_GPIO_LOW;
180 mutex_unlock(&wm->codec_mutex);
183 EXPORT_SYMBOL_GPL(wm97xx_get_gpio);
186 * wm97xx_set_gpio - Set the status of a codec GPIO.
187 * @wm: wm97xx device.
191 * Set the status of a codec GPIO pin
194 void wm97xx_set_gpio(struct wm97xx *wm, u32 gpio,
195 enum wm97xx_gpio_status status)
199 mutex_lock(&wm->codec_mutex);
200 reg = wm97xx_reg_read(wm, AC97_GPIO_STATUS);
202 if (status & WM97XX_GPIO_HIGH)
207 if (wm->id == WM9712_ID2)
208 wm97xx_reg_write(wm, AC97_GPIO_STATUS, reg << 1);
210 wm97xx_reg_write(wm, AC97_GPIO_STATUS, reg);
211 mutex_unlock(&wm->codec_mutex);
213 EXPORT_SYMBOL_GPL(wm97xx_set_gpio);
216 * Codec GPIO pin configuration, this sets pin direction, polarity,
217 * stickyness and wake up.
219 void wm97xx_config_gpio(struct wm97xx *wm, u32 gpio, enum wm97xx_gpio_dir dir,
220 enum wm97xx_gpio_pol pol, enum wm97xx_gpio_sticky sticky,
221 enum wm97xx_gpio_wake wake)
225 mutex_lock(&wm->codec_mutex);
226 reg = wm97xx_reg_read(wm, AC97_GPIO_POLARITY);
228 if (pol == WM97XX_GPIO_POL_HIGH)
233 wm97xx_reg_write(wm, AC97_GPIO_POLARITY, reg);
234 reg = wm97xx_reg_read(wm, AC97_GPIO_STICKY);
236 if (sticky == WM97XX_GPIO_STICKY)
241 wm97xx_reg_write(wm, AC97_GPIO_STICKY, reg);
242 reg = wm97xx_reg_read(wm, AC97_GPIO_WAKEUP);
244 if (wake == WM97XX_GPIO_WAKE)
249 wm97xx_reg_write(wm, AC97_GPIO_WAKEUP, reg);
250 reg = wm97xx_reg_read(wm, AC97_GPIO_CFG);
252 if (dir == WM97XX_GPIO_IN)
257 wm97xx_reg_write(wm, AC97_GPIO_CFG, reg);
258 mutex_unlock(&wm->codec_mutex);
260 EXPORT_SYMBOL_GPL(wm97xx_config_gpio);
263 * Configure the WM97XX_PRP value to use while system is suspended.
264 * If a value other than 0 is set then WM97xx pen detection will be
265 * left enabled in the configured mode while the system is in suspend,
266 * the device has users and suspend has not been disabled via the
267 * wakeup sysfs entries.
269 * @wm: WM97xx device to configure
270 * @mode: WM97XX_PRP value to configure while suspended
272 void wm97xx_set_suspend_mode(struct wm97xx *wm, u16 mode)
274 wm->suspend_mode = mode;
275 device_init_wakeup(&wm->input_dev->dev, mode != 0);
277 EXPORT_SYMBOL_GPL(wm97xx_set_suspend_mode);
280 * Handle a pen down interrupt.
282 static void wm97xx_pen_irq_worker(struct work_struct *work)
284 struct wm97xx *wm = container_of(work, struct wm97xx, pen_event_work);
285 int pen_was_down = wm->pen_is_down;
287 /* do we need to enable the touch panel reader */
288 if (wm->id == WM9705_ID2) {
289 if (wm97xx_reg_read(wm, AC97_WM97XX_DIGITISER_RD) &
296 mutex_lock(&wm->codec_mutex);
297 status = wm97xx_reg_read(wm, AC97_GPIO_STATUS);
298 pol = wm97xx_reg_read(wm, AC97_GPIO_POLARITY);
300 if (WM97XX_GPIO_13 & pol & status) {
302 wm97xx_reg_write(wm, AC97_GPIO_POLARITY, pol &
306 wm97xx_reg_write(wm, AC97_GPIO_POLARITY, pol |
310 if (wm->id == WM9712_ID2)
311 wm97xx_reg_write(wm, AC97_GPIO_STATUS, (status &
312 ~WM97XX_GPIO_13) << 1);
314 wm97xx_reg_write(wm, AC97_GPIO_STATUS, status &
316 mutex_unlock(&wm->codec_mutex);
319 /* If the system is not using continuous mode or it provides a
320 * pen down operation then we need to schedule polls while the
321 * pen is down. Otherwise the machine driver is responsible
322 * for scheduling reads.
324 if (!wm->mach_ops->acc_enabled || wm->mach_ops->acc_pen_down) {
325 if (wm->pen_is_down && !pen_was_down) {
326 /* Data is not availiable immediately on pen down */
327 queue_delayed_work(wm->ts_workq, &wm->ts_reader, 1);
330 /* Let ts_reader report the pen up for debounce. */
331 if (!wm->pen_is_down && pen_was_down)
335 if (!wm->pen_is_down && wm->mach_ops->acc_enabled)
336 wm->mach_ops->acc_pen_up(wm);
338 wm->mach_ops->irq_enable(wm, 1);
342 * Codec PENDOWN irq handler
344 * We have to disable the codec interrupt in the handler because it
345 * can take upto 1ms to clear the interrupt source. We schedule a task
346 * in a work queue to do the actual interaction with the chip. The
347 * interrupt is then enabled again in the slow handler when the source
350 static irqreturn_t wm97xx_pen_interrupt(int irq, void *dev_id)
352 struct wm97xx *wm = dev_id;
354 if (!work_pending(&wm->pen_event_work)) {
355 wm->mach_ops->irq_enable(wm, 0);
356 queue_work(wm->ts_workq, &wm->pen_event_work);
363 * initialise pen IRQ handler and workqueue
365 static int wm97xx_init_pen_irq(struct wm97xx *wm)
369 /* If an interrupt is supplied an IRQ enable operation must also be
371 BUG_ON(!wm->mach_ops->irq_enable);
373 if (request_irq(wm->pen_irq, wm97xx_pen_interrupt,
374 IRQF_SHARED | IRQF_SAMPLE_RANDOM,
377 "Failed to register pen down interrupt, polling");
382 /* Configure GPIO as interrupt source on WM971x */
383 if (wm->id != WM9705_ID2) {
384 BUG_ON(!wm->mach_ops->irq_gpio);
385 reg = wm97xx_reg_read(wm, AC97_MISC_AFE);
386 wm97xx_reg_write(wm, AC97_MISC_AFE,
387 reg & ~(wm->mach_ops->irq_gpio));
388 reg = wm97xx_reg_read(wm, 0x5a);
389 wm97xx_reg_write(wm, 0x5a, reg & ~0x0001);
395 static int wm97xx_read_samples(struct wm97xx *wm)
397 struct wm97xx_data data;
400 mutex_lock(&wm->codec_mutex);
402 if (wm->mach_ops && wm->mach_ops->acc_enabled)
403 rc = wm->mach_ops->acc_pen_down(wm);
405 rc = wm->codec->poll_touch(wm, &data);
408 if (wm->pen_is_down) {
410 dev_dbg(wm->dev, "pen up\n");
411 input_report_abs(wm->input_dev, ABS_PRESSURE, 0);
412 input_sync(wm->input_dev);
413 } else if (!(rc & RC_AGAIN)) {
414 /* We need high frequency updates only while
415 * pen is down, the user never will be able to
416 * touch screen faster than a few times per
417 * second... On the other hand, when the user
418 * is actively working with the touchscreen we
419 * don't want to lose the quick response. So we
420 * will slowly increase sleep time after the
421 * pen is up and quicky restore it to ~one task
422 * switch when pen is down again.
424 if (wm->ts_reader_interval < HZ / 10)
425 wm->ts_reader_interval++;
428 } else if (rc & RC_VALID) {
430 "pen down: x=%x:%d, y=%x:%d, pressure=%x:%d\n",
431 data.x >> 12, data.x & 0xfff, data.y >> 12,
432 data.y & 0xfff, data.p >> 12, data.p & 0xfff);
433 input_report_abs(wm->input_dev, ABS_X, data.x & 0xfff);
434 input_report_abs(wm->input_dev, ABS_Y, data.y & 0xfff);
435 input_report_abs(wm->input_dev, ABS_PRESSURE, data.p & 0xfff);
436 input_sync(wm->input_dev);
438 wm->ts_reader_interval = wm->ts_reader_min_interval;
439 } else if (rc & RC_PENDOWN) {
440 dev_dbg(wm->dev, "pen down\n");
442 wm->ts_reader_interval = wm->ts_reader_min_interval;
445 mutex_unlock(&wm->codec_mutex);
450 * The touchscreen sample reader.
452 static void wm97xx_ts_reader(struct work_struct *work)
455 struct wm97xx *wm = container_of(work, struct wm97xx, ts_reader.work);
460 rc = wm97xx_read_samples(wm);
461 } while (rc & RC_AGAIN);
463 if (wm->pen_is_down || !wm->pen_irq)
464 queue_delayed_work(wm->ts_workq, &wm->ts_reader,
465 wm->ts_reader_interval);
469 * wm97xx_ts_input_open - Open the touch screen input device.
470 * @idev: Input device to be opened.
472 * Called by the input sub system to open a wm97xx touchscreen device.
473 * Starts the touchscreen thread and touch digitiser.
475 static int wm97xx_ts_input_open(struct input_dev *idev)
477 struct wm97xx *wm = input_get_drvdata(idev);
479 wm->ts_workq = create_singlethread_workqueue("kwm97xx");
480 if (wm->ts_workq == NULL) {
482 "Failed to create workqueue\n");
486 /* start digitiser */
487 if (wm->mach_ops && wm->mach_ops->acc_enabled)
488 wm->codec->acc_enable(wm, 1);
489 wm->codec->dig_enable(wm, 1);
491 INIT_DELAYED_WORK(&wm->ts_reader, wm97xx_ts_reader);
492 INIT_WORK(&wm->pen_event_work, wm97xx_pen_irq_worker);
494 wm->ts_reader_min_interval = HZ >= 100 ? HZ / 100 : 1;
495 if (wm->ts_reader_min_interval < 1)
496 wm->ts_reader_min_interval = 1;
497 wm->ts_reader_interval = wm->ts_reader_min_interval;
501 wm97xx_init_pen_irq(wm);
503 dev_err(wm->dev, "No IRQ specified\n");
505 /* If we either don't have an interrupt for pen down events or
506 * failed to acquire it then we need to poll.
508 if (wm->pen_irq == 0)
509 queue_delayed_work(wm->ts_workq, &wm->ts_reader,
510 wm->ts_reader_interval);
516 * wm97xx_ts_input_close - Close the touch screen input device.
517 * @idev: Input device to be closed.
519 * Called by the input sub system to close a wm97xx touchscreen
520 * device. Kills the touchscreen thread and stops the touch
524 static void wm97xx_ts_input_close(struct input_dev *idev)
526 struct wm97xx *wm = input_get_drvdata(idev);
530 /* Return the interrupt to GPIO usage (disabling it) */
531 if (wm->id != WM9705_ID2) {
532 BUG_ON(!wm->mach_ops->irq_gpio);
533 reg = wm97xx_reg_read(wm, AC97_MISC_AFE);
534 wm97xx_reg_write(wm, AC97_MISC_AFE,
535 reg | wm->mach_ops->irq_gpio);
538 free_irq(wm->pen_irq, wm);
543 /* Balance out interrupt disables/enables */
544 if (cancel_work_sync(&wm->pen_event_work))
545 wm->mach_ops->irq_enable(wm, 1);
547 /* ts_reader rearms itself so we need to explicitly stop it
548 * before we destroy the workqueue.
550 cancel_delayed_work_sync(&wm->ts_reader);
552 destroy_workqueue(wm->ts_workq);
555 wm->codec->dig_enable(wm, 0);
556 if (wm->mach_ops && wm->mach_ops->acc_enabled)
557 wm->codec->acc_enable(wm, 0);
560 static int wm97xx_probe(struct device *dev)
565 wm = kzalloc(sizeof(struct wm97xx), GFP_KERNEL);
568 mutex_init(&wm->codec_mutex);
571 dev->driver_data = wm;
572 wm->ac97 = to_ac97_t(dev);
574 /* check that we have a supported codec */
575 id = wm97xx_reg_read(wm, AC97_VENDOR_ID1);
576 if (id != WM97XX_ID1) {
577 dev_err(dev, "Device with vendor %04x is not a wm97xx\n", id);
582 wm->id = wm97xx_reg_read(wm, AC97_VENDOR_ID2);
584 dev_info(wm->dev, "detected a wm97%02x codec\n", wm->id & 0xff);
586 switch (wm->id & 0xff) {
587 #ifdef CONFIG_TOUCHSCREEN_WM9705
589 wm->codec = &wm9705_codec;
592 #ifdef CONFIG_TOUCHSCREEN_WM9712
594 wm->codec = &wm9712_codec;
597 #ifdef CONFIG_TOUCHSCREEN_WM9713
599 wm->codec = &wm9713_codec;
603 dev_err(wm->dev, "Support for wm97%02x not compiled in.\n",
609 /* set up physical characteristics */
610 wm->codec->phy_init(wm);
612 /* load gpio cache */
613 wm->gpio[0] = wm97xx_reg_read(wm, AC97_GPIO_CFG);
614 wm->gpio[1] = wm97xx_reg_read(wm, AC97_GPIO_POLARITY);
615 wm->gpio[2] = wm97xx_reg_read(wm, AC97_GPIO_STICKY);
616 wm->gpio[3] = wm97xx_reg_read(wm, AC97_GPIO_WAKEUP);
617 wm->gpio[4] = wm97xx_reg_read(wm, AC97_GPIO_STATUS);
618 wm->gpio[5] = wm97xx_reg_read(wm, AC97_MISC_AFE);
620 wm->input_dev = input_allocate_device();
621 if (wm->input_dev == NULL) {
626 /* set up touch configuration */
627 wm->input_dev->name = "wm97xx touchscreen";
628 wm->input_dev->phys = "wm97xx";
629 wm->input_dev->open = wm97xx_ts_input_open;
630 wm->input_dev->close = wm97xx_ts_input_close;
631 set_bit(EV_ABS, wm->input_dev->evbit);
632 set_bit(ABS_X, wm->input_dev->absbit);
633 set_bit(ABS_Y, wm->input_dev->absbit);
634 set_bit(ABS_PRESSURE, wm->input_dev->absbit);
635 input_set_abs_params(wm->input_dev, ABS_X, abs_x[0], abs_x[1],
637 input_set_abs_params(wm->input_dev, ABS_Y, abs_y[0], abs_y[1],
639 input_set_abs_params(wm->input_dev, ABS_PRESSURE, abs_p[0], abs_p[1],
641 input_set_drvdata(wm->input_dev, wm);
642 wm->input_dev->dev.parent = dev;
643 ret = input_register_device(wm->input_dev);
647 /* register our battery device */
648 wm->battery_dev = platform_device_alloc("wm97xx-battery", -1);
649 if (!wm->battery_dev) {
653 platform_set_drvdata(wm->battery_dev, wm);
654 wm->battery_dev->dev.parent = dev;
655 ret = platform_device_add(wm->battery_dev);
659 /* register our extended touch device (for machine specific
661 wm->touch_dev = platform_device_alloc("wm97xx-touch", -1);
662 if (!wm->touch_dev) {
666 platform_set_drvdata(wm->touch_dev, wm);
667 wm->touch_dev->dev.parent = dev;
668 ret = platform_device_add(wm->touch_dev);
675 platform_device_put(wm->touch_dev);
677 platform_device_unregister(wm->battery_dev);
678 wm->battery_dev = NULL;
680 platform_device_put(wm->battery_dev);
682 input_unregister_device(wm->input_dev);
683 wm->input_dev = NULL;
685 input_free_device(wm->input_dev);
692 static int wm97xx_remove(struct device *dev)
694 struct wm97xx *wm = dev_get_drvdata(dev);
696 platform_device_unregister(wm->battery_dev);
697 platform_device_unregister(wm->touch_dev);
698 input_unregister_device(wm->input_dev);
705 static int wm97xx_suspend(struct device *dev, pm_message_t state)
707 struct wm97xx *wm = dev_get_drvdata(dev);
711 if (device_may_wakeup(&wm->input_dev->dev))
712 suspend_mode = wm->suspend_mode;
716 if (wm->input_dev->users)
717 cancel_delayed_work_sync(&wm->ts_reader);
719 /* Power down the digitiser (bypassing the cache for resume) */
720 reg = wm97xx_reg_read(wm, AC97_WM97XX_DIGITISER2);
721 reg &= ~WM97XX_PRP_DET_DIG;
722 if (wm->input_dev->users)
724 wm->ac97->bus->ops->write(wm->ac97, AC97_WM97XX_DIGITISER2, reg);
726 /* WM9713 has an additional power bit - turn it off if there
727 * are no users or if suspend mode is zero. */
728 if (wm->id == WM9713_ID2 &&
729 (!wm->input_dev->users || !suspend_mode)) {
730 reg = wm97xx_reg_read(wm, AC97_EXTENDED_MID) | 0x8000;
731 wm97xx_reg_write(wm, AC97_EXTENDED_MID, reg);
737 static int wm97xx_resume(struct device *dev)
739 struct wm97xx *wm = dev_get_drvdata(dev);
741 /* restore digitiser and gpios */
742 if (wm->id == WM9713_ID2) {
743 wm97xx_reg_write(wm, AC97_WM9713_DIG1, wm->dig[0]);
744 wm97xx_reg_write(wm, 0x5a, wm->misc);
745 if (wm->input_dev->users) {
747 reg = wm97xx_reg_read(wm, AC97_EXTENDED_MID) & 0x7fff;
748 wm97xx_reg_write(wm, AC97_EXTENDED_MID, reg);
752 wm97xx_reg_write(wm, AC97_WM9713_DIG2, wm->dig[1]);
753 wm97xx_reg_write(wm, AC97_WM9713_DIG3, wm->dig[2]);
755 wm97xx_reg_write(wm, AC97_GPIO_CFG, wm->gpio[0]);
756 wm97xx_reg_write(wm, AC97_GPIO_POLARITY, wm->gpio[1]);
757 wm97xx_reg_write(wm, AC97_GPIO_STICKY, wm->gpio[2]);
758 wm97xx_reg_write(wm, AC97_GPIO_WAKEUP, wm->gpio[3]);
759 wm97xx_reg_write(wm, AC97_GPIO_STATUS, wm->gpio[4]);
760 wm97xx_reg_write(wm, AC97_MISC_AFE, wm->gpio[5]);
762 if (wm->input_dev->users && !wm->pen_irq) {
763 wm->ts_reader_interval = wm->ts_reader_min_interval;
764 queue_delayed_work(wm->ts_workq, &wm->ts_reader,
765 wm->ts_reader_interval);
772 #define wm97xx_suspend NULL
773 #define wm97xx_resume NULL
777 * Machine specific operations
779 int wm97xx_register_mach_ops(struct wm97xx *wm,
780 struct wm97xx_mach_ops *mach_ops)
782 mutex_lock(&wm->codec_mutex);
784 mutex_unlock(&wm->codec_mutex);
787 wm->mach_ops = mach_ops;
788 mutex_unlock(&wm->codec_mutex);
792 EXPORT_SYMBOL_GPL(wm97xx_register_mach_ops);
794 void wm97xx_unregister_mach_ops(struct wm97xx *wm)
796 mutex_lock(&wm->codec_mutex);
798 mutex_unlock(&wm->codec_mutex);
800 EXPORT_SYMBOL_GPL(wm97xx_unregister_mach_ops);
802 static struct device_driver wm97xx_driver = {
804 .bus = &ac97_bus_type,
805 .owner = THIS_MODULE,
806 .probe = wm97xx_probe,
807 .remove = wm97xx_remove,
808 .suspend = wm97xx_suspend,
809 .resume = wm97xx_resume,
812 static int __init wm97xx_init(void)
814 return driver_register(&wm97xx_driver);
817 static void __exit wm97xx_exit(void)
819 driver_unregister(&wm97xx_driver);
822 module_init(wm97xx_init);
823 module_exit(wm97xx_exit);
825 /* Module information */
826 MODULE_AUTHOR("Liam Girdwood <lrg@slimlogic.co.uk>");
827 MODULE_DESCRIPTION("WM97xx Core - Touch Screen / AUX ADC / GPIO Driver");
828 MODULE_LICENSE("GPL");