0001
0002
0003
0004
0005
0006 #ifndef AC97_CONTROLLER_H
0007 #define AC97_CONTROLLER_H
0008
0009 #include <linux/device.h>
0010 #include <linux/list.h>
0011
0012 #define AC97_BUS_MAX_CODECS 4
0013 #define AC97_SLOTS_AVAILABLE_ALL 0xf
0014
0015 struct ac97_controller_ops;
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031 struct ac97_controller {
0032 const struct ac97_controller_ops *ops;
0033 struct list_head controllers;
0034 struct device adap;
0035 int nr;
0036 unsigned short slots_available;
0037 struct device *parent;
0038 struct ac97_codec_device *codecs[AC97_BUS_MAX_CODECS];
0039 void *codecs_pdata[AC97_BUS_MAX_CODECS];
0040 };
0041
0042
0043
0044
0045
0046
0047
0048
0049
0050
0051
0052
0053
0054 struct ac97_controller_ops {
0055 void (*reset)(struct ac97_controller *adrv);
0056 void (*warm_reset)(struct ac97_controller *adrv);
0057 int (*write)(struct ac97_controller *adrv, int slot,
0058 unsigned short reg, unsigned short val);
0059 int (*read)(struct ac97_controller *adrv, int slot, unsigned short reg);
0060 };
0061
0062 #if IS_ENABLED(CONFIG_AC97_BUS_NEW)
0063 struct ac97_controller *snd_ac97_controller_register(
0064 const struct ac97_controller_ops *ops, struct device *dev,
0065 unsigned short slots_available, void **codecs_pdata);
0066 void snd_ac97_controller_unregister(struct ac97_controller *ac97_ctrl);
0067 #else
0068 static inline struct ac97_controller *
0069 snd_ac97_controller_register(const struct ac97_controller_ops *ops,
0070 struct device *dev,
0071 unsigned short slots_available,
0072 void **codecs_pdata)
0073 {
0074 return ERR_PTR(-ENODEV);
0075 }
0076
0077 static inline void
0078 snd_ac97_controller_unregister(struct ac97_controller *ac97_ctrl)
0079 {
0080 }
0081 #endif
0082
0083 #endif