X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=include%2Fsound%2Fac97_codec.h;h=bcdda71ac3a59cbd96bede0c4be3969267c14f1e;hb=c7b5ebbddf7bcd3651947760f423e3783bbe6573;hp=3629059ad262b6e16e5498d155e1ccd21bc82241;hpb=a2c21200f1c81b08cb55e417b68150bba439b646;p=linux-2.6.git diff --git a/include/sound/ac97_codec.h b/include/sound/ac97_codec.h index 3629059ad..bcdda71ac 100644 --- a/include/sound/ac97_codec.h +++ b/include/sound/ac97_codec.h @@ -364,11 +364,21 @@ #define AC97_RATES_MIC_ADC 4 #define AC97_RATES_SPDIF 5 +/* shared controllers */ +enum { + AC97_SHARED_TYPE_NONE, + AC97_SHARED_TYPE_ICH, + AC97_SHARED_TYPE_ATIIXP, + AC97_SHARED_TYPES +}; + /* * */ typedef struct _snd_ac97_bus ac97_bus_t; +typedef struct _snd_ac97_bus_ops ac97_bus_ops_t; +typedef struct _snd_ac97_template ac97_template_t; typedef struct _snd_ac97 ac97_t; enum ac97_pcm_cfg { @@ -405,29 +415,45 @@ struct snd_ac97_build_ops { int (*build_post_spdif) (ac97_t *ac97); }; -struct _snd_ac97_bus { - /* -- lowlevel (hardware) driver specific -- */ +struct _snd_ac97_bus_ops { void (*reset) (ac97_t *ac97); void (*write) (ac97_t *ac97, unsigned short reg, unsigned short val); unsigned short (*read) (ac97_t *ac97, unsigned short reg); void (*wait) (ac97_t *ac97); void (*init) (ac97_t *ac97); +}; + +struct _snd_ac97_bus { + /* -- lowlevel (hardware) driver specific -- */ + ac97_bus_ops_t *ops; void *private_data; void (*private_free) (ac97_bus_t *bus); /* --- */ snd_card_t *card; unsigned short num; /* bus number */ - unsigned short vra: 1, /* bridge supports VRA */ + unsigned short no_vra: 1, /* bridge doesn't support VRA */ isdin: 1;/* independent SDIN */ unsigned int clock; /* AC'97 base clock (usually 48000Hz) */ spinlock_t bus_lock; /* used mainly for slot allocation */ unsigned short used_slots[2][4]; /* actually used PCM slots */ unsigned short pcms_count; /* count of PCMs */ struct ac97_pcm *pcms; + unsigned int shared_type; /* type of shared controller betwen audio and modem */ ac97_t *codec[4]; snd_info_entry_t *proc; }; +struct _snd_ac97_template { + void *private_data; + void (*private_free) (ac97_t *ac97); + struct pci_dev *pci; /* assigned PCI device - used for quirks */ + unsigned short num; /* number of codec: 0 = primary, 1 = secondary */ + unsigned short addr; /* physical address of codec [0-3] */ + unsigned int scaps; /* driver capabilities */ + unsigned int limited_regs; /* allow limited registers only */ + DECLARE_BITMAP(reg_accessed, 0x80); /* bit flags */ +}; + struct _snd_ac97 { /* -- lowlevel (hardware) driver specific -- */ struct snd_ac97_build_ops * build_ops; @@ -441,6 +467,7 @@ struct _snd_ac97 { unsigned short subsystem_vendor; unsigned short subsystem_device; spinlock_t reg_lock; + struct semaphore mutex; /* mutex for AD18xx multi-codecs and paging (2.3) */ unsigned short num; /* number of codec: 0 = primary, 1 = secondary */ unsigned short addr; /* physical address of codec [0-3] */ unsigned int id; /* identification of codec */ @@ -461,7 +488,6 @@ struct _snd_ac97 { unsigned short id[3]; // codec IDs (lower 16-bit word) unsigned short pcmreg[3]; // PCM registers unsigned short codec_cfg[3]; // CODEC_CFG bits - struct semaphore mutex; } ad18xx; unsigned int dev_flags; /* device specific */ } spec; @@ -484,10 +510,14 @@ static inline int ac97_can_amap(ac97_t * ac97) { return (ac97->ext_id & AC97_EI_AMAP) != 0; } +static inline int ac97_can_spdif(ac97_t * ac97) +{ + return (ac97->ext_id & AC97_EI_SPDIF) != 0; +} /* functions */ -int snd_ac97_bus(snd_card_t * card, ac97_bus_t * _bus, ac97_bus_t ** rbus); /* create new AC97 bus */ -int snd_ac97_mixer(ac97_bus_t * bus, ac97_t * _ac97, ac97_t ** rac97); /* create mixer controls */ +int snd_ac97_bus(snd_card_t *card, int num, ac97_bus_ops_t *ops, void *private_data, ac97_bus_t **rbus); /* create new AC97 bus */ +int snd_ac97_mixer(ac97_bus_t *bus, ac97_template_t *template, ac97_t **rac97); /* create mixer controls */ void snd_ac97_write(ac97_t *ac97, unsigned short reg, unsigned short value); unsigned short snd_ac97_read(ac97_t *ac97, unsigned short reg);