Blame view

sound/ac97_bus.c 1.64 KB
0ca06a00e   Liam Girdwood   [ALSA] AC97 bus i...
1
2
3
4
5
6
7
8
9
10
11
12
  /*
   * Linux driver model AC97 bus interface
   *
   * Author:	Nicolas Pitre
   * Created:	Jan 14, 2005
   * Copyright:	(C) MontaVista Software Inc.
   *
   * This program is free software; you can redistribute it and/or modify
   * it under the terms of the GNU General Public License as published by
   * the Free Software Foundation; either version 2 of the License, or
   * (at your option) any later version.
   */
5049c35b1   Jaroslav Kysela   [ALSA] ac97_bus -...
13
  #include <linux/module.h>
0ca06a00e   Liam Girdwood   [ALSA] AC97 bus i...
14
15
16
  #include <linux/init.h>
  #include <linux/device.h>
  #include <linux/string.h>
96841bae6   Mark Brown   ALSA: ac97 - Incl...
17
  #include <sound/ac97_codec.h>
0ca06a00e   Liam Girdwood   [ALSA] AC97 bus i...
18
19
  
  /*
3a91e9596   Nicolas Pitre   [ALSA] remove bog...
20
   * Let drivers decide whether they want to support given codec from their
d0359c6fa   Jeffrin Jose   sound: Fixed line...
21
22
   * probe method. Drivers have direct access to the struct snd_ac97
   * structure and may  decide based on the id field amongst other things.
0ca06a00e   Liam Girdwood   [ALSA] AC97 bus i...
23
24
25
   */
  static int ac97_bus_match(struct device *dev, struct device_driver *drv)
  {
3a91e9596   Nicolas Pitre   [ALSA] remove bog...
26
  	return 1;
0ca06a00e   Liam Girdwood   [ALSA] AC97 bus i...
27
  }
66e27788a   Martin Langer   [ALSA] ac97_bus p...
28
  #ifdef CONFIG_PM
0ca06a00e   Liam Girdwood   [ALSA] AC97 bus i...
29
30
31
  static int ac97_bus_suspend(struct device *dev, pm_message_t state)
  {
  	int ret = 0;
90b66e833   Nicolas Pitre   [ALSA] clean susp...
32
  	if (dev->driver && dev->driver->suspend)
9480e307c   Russell King   [PATCH] DRIVER MO...
33
  		ret = dev->driver->suspend(dev, state);
0ca06a00e   Liam Girdwood   [ALSA] AC97 bus i...
34
35
36
37
38
39
  	return ret;
  }
  
  static int ac97_bus_resume(struct device *dev)
  {
  	int ret = 0;
90b66e833   Nicolas Pitre   [ALSA] clean susp...
40
  	if (dev->driver && dev->driver->resume)
9480e307c   Russell King   [PATCH] DRIVER MO...
41
  		ret = dev->driver->resume(dev);
0ca06a00e   Liam Girdwood   [ALSA] AC97 bus i...
42
43
  	return ret;
  }
66e27788a   Martin Langer   [ALSA] ac97_bus p...
44
  #endif /* CONFIG_PM */
0ca06a00e   Liam Girdwood   [ALSA] AC97 bus i...
45
46
47
48
  
  struct bus_type ac97_bus_type = {
  	.name		= "ac97",
  	.match		= ac97_bus_match,
66e27788a   Martin Langer   [ALSA] ac97_bus p...
49
  #ifdef CONFIG_PM
0ca06a00e   Liam Girdwood   [ALSA] AC97 bus i...
50
51
  	.suspend	= ac97_bus_suspend,
  	.resume		= ac97_bus_resume,
66e27788a   Martin Langer   [ALSA] ac97_bus p...
52
  #endif /* CONFIG_PM */
0ca06a00e   Liam Girdwood   [ALSA] AC97 bus i...
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
  };
  
  static int __init ac97_bus_init(void)
  {
  	return bus_register(&ac97_bus_type);
  }
  
  subsys_initcall(ac97_bus_init);
  
  static void __exit ac97_bus_exit(void)
  {
  	bus_unregister(&ac97_bus_type);
  }
  
  module_exit(ac97_bus_exit);
  
  EXPORT_SYMBOL(ac97_bus_type);
  
  MODULE_LICENSE("GPL");