📄 ac97_codec.h
字号:
#define AC97_EXTID_CDAC 0x0040#define AC97_EXTID_SDAC 0x0080#define AC97_EXTID_LDAC 0x0100#define AC97_EXTID_AMAP 0x0200#define AC97_EXTID_REV0 0x0400#define AC97_EXTID_REV1 0x0800#define AC97_EXTID_ID0 0x4000#define AC97_EXTID_ID1 0x8000/* extended status register bit defines */#define AC97_EXTSTAT_VRA 0x0001#define AC97_EXTSTAT_DRA 0x0002#define AC97_EXTSTAT_SPDIF 0x0004#define AC97_EXTSTAT_VRM 0x0008#define AC97_EXTSTAT_SPSA0 0x0010#define AC97_EXTSTAT_SPSA1 0x0020#define AC97_EXTSTAT_CDAC 0x0040#define AC97_EXTSTAT_SDAC 0x0080#define AC97_EXTSTAT_LDAC 0x0100#define AC97_EXTSTAT_MADC 0x0200#define AC97_EXTSTAT_SPCV 0x0400#define AC97_EXTSTAT_PRI 0x0800#define AC97_EXTSTAT_PRJ 0x1000#define AC97_EXTSTAT_PRK 0x2000#define AC97_EXTSTAT_PRL 0x4000/* useful power states */#define AC97_PWR_D0 0x0000 /* everything on */#define AC97_PWR_D1 AC97_PWR_PR0|AC97_PWR_PR1|AC97_PWR_PR4#define AC97_PWR_D2 AC97_PWR_PR0|AC97_PWR_PR1|AC97_PWR_PR2|AC97_PWR_PR3|AC97_PWR_PR4#define AC97_PWR_D3 AC97_PWR_PR0|AC97_PWR_PR1|AC97_PWR_PR2|AC97_PWR_PR3|AC97_PWR_PR4#define AC97_PWR_ANLOFF AC97_PWR_PR2|AC97_PWR_PR3 /* analog section off *//* Total number of defined registers. */#define AC97_REG_CNT 64/* OSS interface to the ac97s.. */#define AC97_STEREO_MASK (SOUND_MASK_VOLUME|SOUND_MASK_PCM|\ SOUND_MASK_LINE|SOUND_MASK_CD|\ SOUND_MASK_ALTPCM|SOUND_MASK_IGAIN|\ SOUND_MASK_LINE1|SOUND_MASK_VIDEO)#define AC97_SUPPORTED_MASK (AC97_STEREO_MASK | \ SOUND_MASK_BASS|SOUND_MASK_TREBLE|\ SOUND_MASK_SPEAKER|SOUND_MASK_MIC|\ SOUND_MASK_PHONEIN|SOUND_MASK_PHONEOUT)#define AC97_RECORD_MASK (SOUND_MASK_MIC|\ SOUND_MASK_CD|SOUND_MASK_IGAIN|SOUND_MASK_VIDEO|\ SOUND_MASK_LINE1| SOUND_MASK_LINE|\ SOUND_MASK_PHONEIN)/* original check is not good enough in case FOO is greater than * SOUND_MIXER_NRDEVICES because the supported_mixers has exactly * SOUND_MIXER_NRDEVICES elements. * before matching the given mixer against the bitmask in supported_mixers we * check if mixer number exceeds maximum allowed size which is as mentioned * above SOUND_MIXER_NRDEVICES */#define supported_mixer(CODEC,FOO) ((FOO >= 0) && \ (FOO < SOUND_MIXER_NRDEVICES) && \ (CODEC)->supported_mixers & (1<<FOO) )struct ac97_codec { /* Linked list of codecs */ struct list_head list; /* AC97 controller connected with */ void *private_data; char *name; int id; int dev_mixer; int type; u32 model; unsigned int modem:1; struct ac97_ops *codec_ops; /* controller specific lower leverl ac97 accessing routines. must be re-entrant safe */ u16 (*codec_read) (struct ac97_codec *codec, u8 reg); void (*codec_write) (struct ac97_codec *codec, u8 reg, u16 val); /* Wait for codec-ready. Ok to sleep here. */ void (*codec_wait) (struct ac97_codec *codec); /* callback used by helper drivers for interesting ac97 setups */ void (*codec_unregister) (struct ac97_codec *codec); struct ac97_driver *driver; void *driver_private; /* Private data for the driver */ spinlock_t lock; /* OSS mixer masks */ int modcnt; int supported_mixers; int stereo_mixers; int record_sources; /* Property flags */ int flags; int bit_resolution; /* OSS mixer interface */ int (*read_mixer) (struct ac97_codec *codec, int oss_channel); void (*write_mixer)(struct ac97_codec *codec, int oss_channel, unsigned int left, unsigned int right); int (*recmask_io) (struct ac97_codec *codec, int rw, int mask); int (*mixer_ioctl)(struct ac97_codec *codec, unsigned int cmd, unsigned long arg); /* saved OSS mixer states */ unsigned int mixer_state[SOUND_MIXER_NRDEVICES]; /* Software Modem interface */ int (*modem_ioctl)(struct ac97_codec *codec, unsigned int cmd, unsigned long arg);};/* * Operation structures for each known AC97 chip */ struct ac97_ops{ /* Initialise */ int (*init)(struct ac97_codec *c); /* Amplifier control */ int (*amplifier)(struct ac97_codec *codec, int on); /* Digital mode control */ int (*digital)(struct ac97_codec *codec, int slots, int rate, int mode);#define AUDIO_DIGITAL 0x8000#define AUDIO_PRO 0x4000#define AUDIO_DRS 0x2000#define AUDIO_CCMASK 0x003F #define AC97_DELUDED_MODEM 1 /* Audio codec reports its a modem */#define AC97_NO_PCM_VOLUME 2 /* Volume control is missing */#define AC97_DEFAULT_POWER_OFF 4 /* Needs warm reset to power up */};extern int ac97_read_proc (char *page_out, char **start, off_t off, int count, int *eof, void *data);extern int ac97_probe_codec(struct ac97_codec *);extern unsigned int ac97_set_adc_rate(struct ac97_codec *codec, unsigned int rate);extern unsigned int ac97_set_dac_rate(struct ac97_codec *codec, unsigned int rate);extern struct ac97_codec *ac97_alloc_codec(void);extern void ac97_release_codec(struct ac97_codec *codec);struct ac97_driver { struct list_head list; char *name; u32 codec_id; u32 codec_mask; int (*probe) (struct ac97_codec *codec, struct ac97_driver *driver); void (*remove) (struct ac97_codec *codec, struct ac97_driver *driver);};/* quirk types */enum { AC97_TUNE_DEFAULT = -1, /* use default from quirk list (not valid in list) */ AC97_TUNE_NONE = 0, /* nothing extra to do */ AC97_TUNE_HP_ONLY, /* headphone (true line-out) control as master only */ AC97_TUNE_SWAP_HP, /* swap headphone and master controls */ AC97_TUNE_SWAP_SURROUND, /* swap master and surround controls */ AC97_TUNE_AD_SHARING, /* for AD1985, turn on OMS bit and use headphone */ AC97_TUNE_ALC_JACK, /* for Realtek, enable JACK detection */};struct ac97_quirk { unsigned short vendor; /* PCI vendor id */ unsigned short device; /* PCI device id */ unsigned short mask; /* device id bit mask, 0 = accept all */ const char *name; /* name shown as info */ int type; /* quirk type above */};struct pci_dev;extern int ac97_tune_hardware(struct pci_dev *pdev, struct ac97_quirk *quirk, int override);#endif /* _AC97_CODEC_H_ */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -