This source file includes following definitions.
- snd_ac97_check_id
- snd_ac97_reset
- ac97_bus_match
- ac97_bus_init
- ac97_bus_exit
1
2
3
4
5
6
7
8
9
10 #include <linux/module.h>
11 #include <linux/init.h>
12 #include <linux/device.h>
13 #include <linux/string.h>
14 #include <sound/ac97_codec.h>
15
16
17
18
19
20
21
22
23
24
25
26 static bool snd_ac97_check_id(struct snd_ac97 *ac97, unsigned int id,
27 unsigned int id_mask)
28 {
29 ac97->id = ac97->bus->ops->read(ac97, AC97_VENDOR_ID1) << 16;
30 ac97->id |= ac97->bus->ops->read(ac97, AC97_VENDOR_ID2);
31
32 if (ac97->id == 0x0 || ac97->id == 0xffffffff)
33 return false;
34
35 if (id != 0 && id != (ac97->id & id_mask))
36 return false;
37
38 return true;
39 }
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55 int snd_ac97_reset(struct snd_ac97 *ac97, bool try_warm, unsigned int id,
56 unsigned int id_mask)
57 {
58 struct snd_ac97_bus_ops *ops = ac97->bus->ops;
59
60 if (try_warm && ops->warm_reset) {
61 ops->warm_reset(ac97);
62 if (snd_ac97_check_id(ac97, id, id_mask))
63 return 1;
64 }
65
66 if (ops->reset)
67 ops->reset(ac97);
68 if (ops->warm_reset)
69 ops->warm_reset(ac97);
70
71 if (snd_ac97_check_id(ac97, id, id_mask))
72 return 0;
73
74 return -ENODEV;
75 }
76 EXPORT_SYMBOL_GPL(snd_ac97_reset);
77
78
79
80
81
82
83 static int ac97_bus_match(struct device *dev, struct device_driver *drv)
84 {
85 return 1;
86 }
87
88 struct bus_type ac97_bus_type = {
89 .name = "ac97",
90 .match = ac97_bus_match,
91 };
92
93 static int __init ac97_bus_init(void)
94 {
95 return bus_register(&ac97_bus_type);
96 }
97
98 subsys_initcall(ac97_bus_init);
99
100 static void __exit ac97_bus_exit(void)
101 {
102 bus_unregister(&ac97_bus_type);
103 }
104
105 module_exit(ac97_bus_exit);
106
107 EXPORT_SYMBOL(ac97_bus_type);
108
109 MODULE_LICENSE("GPL");