1
2
3
4
5
6#ifndef AC97_CONTROLLER_H
7#define AC97_CONTROLLER_H
8
9#include <linux/device.h>
10#include <linux/list.h>
11
12#define AC97_BUS_MAX_CODECS 4
13#define AC97_SLOTS_AVAILABLE_ALL 0xf
14
15struct ac97_controller_ops;
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31struct ac97_controller {
32 const struct ac97_controller_ops *ops;
33 struct list_head controllers;
34 struct device adap;
35 int nr;
36 unsigned short slots_available;
37 struct device *parent;
38 struct ac97_codec_device *codecs[AC97_BUS_MAX_CODECS];
39 void *codecs_pdata[AC97_BUS_MAX_CODECS];
40};
41
42
43
44
45
46
47
48
49
50
51
52
53
54struct ac97_controller_ops {
55 void (*reset)(struct ac97_controller *adrv);
56 void (*warm_reset)(struct ac97_controller *adrv);
57 int (*write)(struct ac97_controller *adrv, int slot,
58 unsigned short reg, unsigned short val);
59 int (*read)(struct ac97_controller *adrv, int slot, unsigned short reg);
60};
61
62#if IS_ENABLED(CONFIG_AC97_BUS_NEW)
63struct ac97_controller *snd_ac97_controller_register(
64 const struct ac97_controller_ops *ops, struct device *dev,
65 unsigned short slots_available, void **codecs_pdata);
66void snd_ac97_controller_unregister(struct ac97_controller *ac97_ctrl);
67#else
68static inline struct ac97_controller *
69snd_ac97_controller_register(const struct ac97_controller_ops *ops,
70 struct device *dev,
71 unsigned short slots_available,
72 void **codecs_pdata)
73{
74 return ERR_PTR(-ENODEV);
75}
76
77static inline void
78snd_ac97_controller_unregister(struct ac97_controller *ac97_ctrl)
79{
80}
81#endif
82
83#endif
84