This source file includes following definitions.
- to_ac97_device
- to_ac97_driver
- snd_ac97_codec_driver_register
- snd_ac97_codec_driver_unregister
- ac97_codec_dev2dev
- ac97_get_drvdata
- ac97_set_drvdata
1
2
3
4
5
6 #ifndef __SOUND_AC97_CODEC2_H
7 #define __SOUND_AC97_CODEC2_H
8
9 #include <linux/device.h>
10
11 #define AC97_ID(vendor_id1, vendor_id2) \
12 ((((vendor_id1) & 0xffff) << 16) | ((vendor_id2) & 0xffff))
13 #define AC97_DRIVER_ID(vendor_id1, vendor_id2, mask_id1, mask_id2, _data) \
14 { .id = (((vendor_id1) & 0xffff) << 16) | ((vendor_id2) & 0xffff), \
15 .mask = (((mask_id1) & 0xffff) << 16) | ((mask_id2) & 0xffff), \
16 .data = (_data) }
17
18 struct ac97_controller;
19 struct clk;
20
21
22
23
24
25
26
27
28
29 struct ac97_id {
30 unsigned int id;
31 unsigned int mask;
32 void *data;
33 };
34
35
36
37
38
39
40
41
42
43
44
45
46
47 struct ac97_codec_device {
48 struct device dev;
49 unsigned int vendor_id;
50 unsigned int num;
51 struct clk *clk;
52 struct ac97_controller *ac97_ctrl;
53 };
54
55
56
57
58
59
60
61
62
63 struct ac97_codec_driver {
64 struct device_driver driver;
65 int (*probe)(struct ac97_codec_device *);
66 int (*remove)(struct ac97_codec_device *);
67 void (*shutdown)(struct ac97_codec_device *);
68 const struct ac97_id *id_table;
69 };
70
71 static inline struct ac97_codec_device *to_ac97_device(struct device *d)
72 {
73 return container_of(d, struct ac97_codec_device, dev);
74 }
75
76 static inline struct ac97_codec_driver *to_ac97_driver(struct device_driver *d)
77 {
78 return container_of(d, struct ac97_codec_driver, driver);
79 }
80
81 #if IS_ENABLED(CONFIG_AC97_BUS_NEW)
82 int snd_ac97_codec_driver_register(struct ac97_codec_driver *drv);
83 void snd_ac97_codec_driver_unregister(struct ac97_codec_driver *drv);
84 #else
85 static inline int
86 snd_ac97_codec_driver_register(struct ac97_codec_driver *drv)
87 {
88 return 0;
89 }
90 static inline void
91 snd_ac97_codec_driver_unregister(struct ac97_codec_driver *drv)
92 {
93 }
94 #endif
95
96
97 static inline struct device *
98 ac97_codec_dev2dev(struct ac97_codec_device *adev)
99 {
100 return &adev->dev;
101 }
102
103 static inline void *ac97_get_drvdata(struct ac97_codec_device *adev)
104 {
105 return dev_get_drvdata(ac97_codec_dev2dev(adev));
106 }
107
108 static inline void ac97_set_drvdata(struct ac97_codec_device *adev,
109 void *data)
110 {
111 dev_set_drvdata(ac97_codec_dev2dev(adev), data);
112 }
113
114 void *snd_ac97_codec_get_platdata(const struct ac97_codec_device *adev);
115
116 #endif