Changeset 71
- Timestamp:
- Jan 14, 2006, 7:00:01 PM (20 years ago)
- Location:
- GPL/trunk/alsa-kernel/include/sound
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
GPL/trunk/alsa-kernel/include/sound/ac97_codec.h
r36 r71 26 26 */ 27 27 28 #include <linux/bitops.h> 29 //#include <linux/device.h> 30 #include "pcm.h" 28 31 #include "control.h" 29 #include "pcm.h"30 32 #include "info.h" 31 33 … … 52 54 #define AC97_GENERAL_PURPOSE 0x20 /* General Purpose (optional) */ 53 55 #define AC97_3D_CONTROL 0x22 /* 3D Control (optional) */ 54 #define AC97_INT_PAGING 0x24/* Audio Interrupt & Paging (AC'97 2.3) */56 #define AC97_INT_PAGING 0x24 /* Audio Interrupt & Paging (AC'97 2.3) */ 55 57 #define AC97_POWERDOWN 0x26 /* Powerdown control / status */ 56 58 /* range 0x28-0x3a - AUDIO AC'97 2.0 extensions */ … … 84 86 #define AC97_VENDOR_ID2 0x7e /* Vendor ID2 / revision */ 85 87 /* range 0x60-0x6f (page 1) - extended codec registers */ 86 #define AC97_CODEC_CLASS_REV 0x60/* Codec Class/Revision */87 #define AC97_PCI_SVID 0x62/* PCI Subsystem Vendor ID */88 #define AC97_PCI_SID 0x64/* PCI Subsystem ID */89 #define AC97_FUNC_SELECT 0x66/* Function Select */90 #define AC97_FUNC_INFO 0x68/* Function Information */91 #define AC97_SENSE_INFO 0x6a/* Sense Details */88 #define AC97_CODEC_CLASS_REV 0x60 /* Codec Class/Revision */ 89 #define AC97_PCI_SVID 0x62 /* PCI Subsystem Vendor ID */ 90 #define AC97_PCI_SID 0x64 /* PCI Subsystem ID */ 91 #define AC97_FUNC_SELECT 0x66 /* Function Select */ 92 #define AC97_FUNC_INFO 0x68 /* Function Information */ 93 #define AC97_SENSE_INFO 0x6a /* Sense Details */ 92 94 93 95 /* slot allocation */ … … 135 137 136 138 /* general purpose */ 137 #define AC97_GP_DRSS_MASK 0x0c00/* double rate slot select */138 #define AC97_GP_DRSS_1011 0x0000/* LR(C) 10+11(+12) */139 #define AC97_GP_DRSS_78 0x0400/* LR 7+8 */139 #define AC97_GP_DRSS_MASK 0x0c00 /* double rate slot select */ 140 #define AC97_GP_DRSS_1011 0x0000 /* LR(C) 10+11(+12) */ 141 #define AC97_GP_DRSS_78 0x0400 /* LR 7+8 */ 140 142 141 143 /* extended audio ID bit defines */ … … 152 154 #define AC97_EI_REV_MASK 0x0c00 /* AC'97 revision mask */ 153 155 #define AC97_EI_REV_22 0x0400 /* AC'97 revision 2.2 */ 154 #define AC97_EI_REV_23 0x0800/* AC'97 revision 2.3 */156 #define AC97_EI_REV_23 0x0800 /* AC'97 revision 2.3 */ 155 157 #define AC97_EI_REV_SHIFT 10 156 158 #define AC97_EI_ADDR_MASK 0xc000 /* physical codec ID (address) */ … … 195 197 196 198 /* Interrupt and Paging bit defines (AC'97 2.3) */ 197 #define AC97_PAGE_MASK 0x000f/* Page Selector */198 #define AC97_PAGE_VENDOR 0/* Vendor-specific registers */199 #define AC97_PAGE_1 1/* Extended Codec Registers page 1 */200 #define AC97_INT_ENABLE 0x0800/* Interrupt Enable */201 #define AC97_INT_SENSE 0x1000/* Sense Cycle */202 #define AC97_INT_CAUSE_SENSE 0x2000/* Sense Cycle Completed (RO) */203 #define AC97_INT_CAUSE_GPIO 0x4000/* GPIO bits changed (RO) */204 #define AC97_INT_STATUS 0x8000/* Interrupt Status */199 #define AC97_PAGE_MASK 0x000f /* Page Selector */ 200 #define AC97_PAGE_VENDOR 0 /* Vendor-specific registers */ 201 #define AC97_PAGE_1 1 /* Extended Codec Registers page 1 */ 202 #define AC97_INT_ENABLE 0x0800 /* Interrupt Enable */ 203 #define AC97_INT_SENSE 0x1000 /* Sense Cycle */ 204 #define AC97_INT_CAUSE_SENSE 0x2000 /* Sense Cycle Completed (RO) */ 205 #define AC97_INT_CAUSE_GPIO 0x4000 /* GPIO bits changed (RO) */ 206 #define AC97_INT_STATUS 0x8000 /* Interrupt Status */ 205 207 206 208 /* extended modem ID bit defines */ … … 250 252 251 253 /* specific - SigmaTel */ 252 #define AC97_SIGMATEL_OUTSEL 0x64/* Output Select, STAC9758 */253 #define AC97_SIGMATEL_INSEL 0x66/* Input Select, STAC9758 */254 #define AC97_SIGMATEL_IOMISC 0x68/* STAC9758 */254 #define AC97_SIGMATEL_OUTSEL 0x64 /* Output Select, STAC9758 */ 255 #define AC97_SIGMATEL_INSEL 0x66 /* Input Select, STAC9758 */ 256 #define AC97_SIGMATEL_IOMISC 0x68 /* STAC9758 */ 255 257 #define AC97_SIGMATEL_ANALOG 0x6c /* Analog Special */ 256 258 #define AC97_SIGMATEL_DAC2INVERT 0x6e 257 259 #define AC97_SIGMATEL_BIAS1 0x70 258 260 #define AC97_SIGMATEL_BIAS2 0x72 259 #define AC97_SIGMATEL_VARIOUS 0x72/* STAC9758 */261 #define AC97_SIGMATEL_VARIOUS 0x72 /* STAC9758 */ 260 262 #define AC97_SIGMATEL_MULTICHN 0x74 /* Multi-Channel programming */ 261 263 #define AC97_SIGMATEL_CIC1 0x76 … … 304 306 #define AC97_ALC650_SOUCE_MASK 0x000f /* Source number */ 305 307 #define AC97_ALC650_CHANNEL_MASK 0x00f0 /* Channel number */ 306 #define AC97_ALC650_CHANNEL_SHIFT 4 308 #define AC97_ALC650_CHANNEL_SHIFT 4 307 309 #define AC97_ALC650_SPSR_MASK 0x0f00 /* S/PDIF Sample Rate bits */ 308 310 #define AC97_ALC650_SPSR_SHIFT 8 … … 318 320 #define AC97_ALC650_LFE_DAC_VOL 0x66 319 321 #define AC97_ALC650_UNKNOWN1 0x68 320 #define AC97_ALC650_MULTICH 0x6a322 #define AC97_ALC650_MULTICH 0x6a 321 323 #define AC97_ALC650_UNKNOWN2 0x6c 322 #define AC97_ALC650_REVISION 324 #define AC97_ALC650_REVISION 0x6e 323 325 #define AC97_ALC650_UNKNOWN3 0x70 324 326 #define AC97_ALC650_UNKNOWN4 0x72 … … 326 328 #define AC97_ALC650_GPIO_SETUP 0x76 327 329 #define AC97_ALC650_GPIO_STATUS 0x78 328 #define AC97_ALC650_CLOCK 0x7a330 #define AC97_ALC650_CLOCK 0x7a 329 331 330 332 /* specific - Yamaha YMF753 */ … … 354 356 #define AC97_SCAP_SKIP_MODEM (1<<5) /* skip modem part of codec */ 355 357 #define AC97_SCAP_INDEP_SDIN (1<<6) /* independent SDIN */ 356 #define AC97_SCAP_INV_EAPD (1<<7)/* inverted EAPD */358 #define AC97_SCAP_INV_EAPD (1<<7) /* inverted EAPD */ 357 359 #define AC97_SCAP_DETECT_BY_VENDOR (1<<8) /* use vendor registers for read tests */ 358 #define AC97_SCAP_NO_SPDIF (1<<9)/* don't build SPDIF controls */360 #define AC97_SCAP_NO_SPDIF (1<<9) /* don't build SPDIF controls */ 359 361 360 362 /* ac97->flags */ … … 364 366 #define AC97_CX_SPDIF (1<<3) /* Conexant's spdif interface */ 365 367 #define AC97_STEREO_MUTES (1<<4) /* has stereo mute bits */ 366 #define AC97_DOUBLE_RATE (1<<5) /* supports double rate playback */ 367 #define AC97_HAS_NO_MASTER_VOL (1<<6) /* no Master volume */ 368 #define AC97_HAS_NO_PCM_VOL (1<<7) /* no PCM volume */ 369 370 #define AC97_DEFAULT_POWER_OFF (1<<8) /* no RESET write */ 371 #define AC97_MODEM_PATCH (1<<9) /* modem patch */ 372 #define AC97_HAS_NO_REC_GAIN (1<<10) /* no Record gain */ 373 #define AC97_HAS_NO_PHONE (1<<11) /* no PHONE volume */ 374 #define AC97_HAS_NO_PC_BEEP (1<<12) /* no PC Beep volume */ 375 #define AC97_HAS_NO_VIDEO (1<<13) /* no Video volume */ 376 #define AC97_HAS_NO_CD (1<<14) /* no CD volume */ 377 #define AC97_HAS_NO_MIC (1<<15) /* no MIC volume */ 378 #define AC97_HAS_NO_TONE (1<<16) /* no Tone volume */ 379 #define AC97_HAS_NO_STD_PCM (1<<17) /* no standard AC97 PCM volume and mute */ 368 #define AC97_DOUBLE_RATE (1<<5) /* supports double rate playback */ 369 #define AC97_HAS_NO_MASTER_VOL (1<<6) /* no Master volume */ 370 #define AC97_HAS_NO_PCM_VOL (1<<7) /* no PCM volume */ 371 #define AC97_DEFAULT_POWER_OFF (1<<8) /* no RESET write */ 372 #define AC97_MODEM_PATCH (1<<9) /* modem patch */ 373 #define AC97_HAS_NO_REC_GAIN (1<<10) /* no Record gain */ 374 #define AC97_HAS_NO_PHONE (1<<11) /* no PHONE volume */ 375 #define AC97_HAS_NO_PC_BEEP (1<<12) /* no PC Beep volume */ 376 #define AC97_HAS_NO_VIDEO (1<<13) /* no Video volume */ 377 #define AC97_HAS_NO_CD (1<<14) /* no CD volume */ 378 #define AC97_HAS_NO_MIC (1<<15) /* no MIC volume */ 379 #define AC97_HAS_NO_TONE (1<<16) /* no Tone volume */ 380 #define AC97_HAS_NO_STD_PCM (1<<17) /* no standard AC97 PCM volume and mute */ 380 381 381 382 /* rates indexes */ … … 386 387 #define AC97_RATES_MIC_ADC 4 387 388 #define AC97_RATES_SPDIF 5 388 /* shared controllers */389 enum {390 AC97_SHARED_TYPE_NONE,391 AC97_SHARED_TYPE_ICH,392 AC97_SHARED_TYPE_ATIIXP,393 AC97_SHARED_TYPE_VIA,394 AC97_SHARED_TYPES395 };396 389 397 390 /* … … 399 392 */ 400 393 394 struct snd_ac97; 395 396 struct snd_ac97_build_ops { 397 int (*build_3d) (struct snd_ac97 *ac97); 398 int (*build_specific) (struct snd_ac97 *ac97); 399 int (*build_spdif) (struct snd_ac97 *ac97); 400 int (*build_post_spdif) (struct snd_ac97 *ac97); 401 #ifdef CONFIG_PM 402 void (*suspend) (struct snd_ac97 *ac97); 403 void (*resume) (struct snd_ac97 *ac97); 404 #endif 405 void (*update_jacks) (struct snd_ac97 *ac97); /* for jack-sharing */ 406 }; 407 408 struct snd_ac97_bus_ops { 409 void (*reset) (struct snd_ac97 *ac97); 410 void (*write) (struct snd_ac97 *ac97, unsigned short reg, unsigned short val); 411 unsigned short (*read) (struct snd_ac97 *ac97, unsigned short reg); 412 void (*wait) (struct snd_ac97 *ac97); 413 void (*init) (struct snd_ac97 *ac97); 414 }; 415 416 struct snd_ac97_bus { 417 /* -- lowlevel (hardware) driver specific -- */ 418 struct snd_ac97_bus_ops *ops; 419 void *private_data; 420 void (*private_free) (struct snd_ac97_bus *bus); 421 /* --- */ 422 struct snd_card *card; 423 unsigned short num; /* bus number */ 424 unsigned short no_vra: 1, /* bridge doesn't support VRA */ 425 dra: 1, /* bridge supports double rate */ 426 isdin: 1;/* independent SDIN */ 427 unsigned int clock; /* AC'97 base clock (usually 48000Hz) */ 428 spinlock_t bus_lock; /* used mainly for slot allocation */ 429 unsigned short used_slots[2][4]; /* actually used PCM slots */ 430 unsigned short pcms_count; /* count of PCMs */ 431 struct ac97_pcm *pcms; 432 struct snd_ac97 *codec[4]; 433 struct snd_info_entry *proc; 434 }; 435 436 struct snd_ac97_template { 437 void *private_data; 438 void (*private_free) (struct snd_ac97 *ac97); 439 struct pci_dev *pci; /* assigned PCI device - used for quirks */ 440 unsigned short num; /* number of codec: 0 = primary, 1 = secondary */ 441 unsigned short addr; /* physical address of codec [0-3] */ 442 unsigned int scaps; /* driver capabilities */ 443 unsigned int limited_regs; /* allow limited registers only */ 444 DECLARE_BITMAP(reg_accessed, 0x80); /* bit flags */ 445 }; 446 447 struct snd_ac97 { 448 /* -- lowlevel (hardware) driver specific -- */ 449 struct snd_ac97_build_ops * build_ops; 450 void *private_data; 451 void (*private_free) (struct snd_ac97 *ac97); 452 /* --- */ 453 struct snd_ac97_bus *bus; 454 struct pci_dev *pci; /* assigned PCI device - used for quirks */ 455 struct snd_info_entry *proc; 456 struct snd_info_entry *proc_regs; 457 unsigned short subsystem_vendor; 458 unsigned short subsystem_device; 459 struct semaphore reg_mutex; 460 struct semaphore page_mutex; /* mutex for AD18xx multi-codecs and paging (2.3) */ 461 unsigned short num; /* number of codec: 0 = primary, 1 = secondary */ 462 unsigned short addr; /* physical address of codec [0-3] */ 463 unsigned int id; /* identification of codec */ 464 unsigned short caps; /* capabilities (register 0) */ 465 unsigned short ext_id; /* extended feature identification (register 28) */ 466 unsigned short ext_mid; /* extended modem ID (register 3C) */ 467 unsigned int scaps; /* driver capabilities */ 468 unsigned int flags; /* specific code */ 469 unsigned int rates[6]; /* see AC97_RATES_* defines */ 470 unsigned int spdif_status; 471 unsigned short regs[0x80]; /* register cache */ 472 unsigned int limited_regs; /* allow limited registers only */ 473 DECLARE_BITMAP(reg_accessed, 0x80); /* bit flags */ 474 union { /* vendor specific code */ 475 struct { 476 unsigned short unchained[3]; // 0 = C34, 1 = C79, 2 = C69 477 unsigned short chained[3]; // 0 = C34, 1 = C79, 2 = C69 478 unsigned short id[3]; // codec IDs (lower 16-bit word) 479 unsigned short pcmreg[3]; // PCM registers 480 unsigned short codec_cfg[3]; // CODEC_CFG bits 481 } ad18xx; 482 unsigned int dev_flags; /* device specific */ 483 } spec; 484 /* jack-sharing info */ 485 unsigned char indep_surround; 486 unsigned char channel_mode; 487 struct device dev; 488 }; 489 490 #define to_ac97_t(d) container_of(d, struct snd_ac97, dev) 491 492 /* conditions */ 493 static inline int ac97_is_audio(struct snd_ac97 * ac97) 494 { 495 return (ac97->scaps & AC97_SCAP_AUDIO); 496 } 497 static inline int ac97_is_modem(struct snd_ac97 * ac97) 498 { 499 return (ac97->scaps & AC97_SCAP_MODEM); 500 } 501 static inline int ac97_is_rev22(struct snd_ac97 * ac97) 502 { 503 return (ac97->ext_id & AC97_EI_REV_MASK) >= AC97_EI_REV_22; 504 } 505 static inline int ac97_can_amap(struct snd_ac97 * ac97) 506 { 507 return (ac97->ext_id & AC97_EI_AMAP) != 0; 508 } 509 static inline int ac97_can_spdif(struct snd_ac97 * ac97) 510 { 511 return (ac97->ext_id & AC97_EI_SPDIF) != 0; 512 } 513 514 /* functions */ 515 /* create new AC97 bus */ 516 int snd_ac97_bus(struct snd_card *card, int num, struct snd_ac97_bus_ops *ops, 517 void *private_data, struct snd_ac97_bus **rbus); 518 /* create mixer controls */ 519 int snd_ac97_mixer(struct snd_ac97_bus *bus, struct snd_ac97_template *template, 520 struct snd_ac97 **rac97); 521 const char *snd_ac97_get_short_name(struct snd_ac97 *ac97); 522 523 void snd_ac97_write(struct snd_ac97 *ac97, unsigned short reg, unsigned short value); 524 unsigned short snd_ac97_read(struct snd_ac97 *ac97, unsigned short reg); 525 void snd_ac97_write_cache(struct snd_ac97 *ac97, unsigned short reg, unsigned short value); 526 int snd_ac97_update(struct snd_ac97 *ac97, unsigned short reg, unsigned short value); 527 int snd_ac97_update_bits(struct snd_ac97 *ac97, unsigned short reg, unsigned short mask, unsigned short value); 528 #ifdef CONFIG_PM 529 void snd_ac97_suspend(struct snd_ac97 *ac97); 530 void snd_ac97_resume(struct snd_ac97 *ac97); 531 #endif 532 533 /* quirk types */ 534 enum { 535 AC97_TUNE_DEFAULT = -1, /* use default from quirk list (not valid in list) */ 536 AC97_TUNE_NONE = 0, /* nothing extra to do */ 537 AC97_TUNE_HP_ONLY, /* headphone (true line-out) control as master only */ 538 AC97_TUNE_SWAP_HP, /* swap headphone and master controls */ 539 AC97_TUNE_SWAP_SURROUND, /* swap master and surround controls */ 540 AC97_TUNE_AD_SHARING, /* for AD1985, turn on OMS bit and use headphone */ 541 AC97_TUNE_ALC_JACK, /* for Realtek, enable JACK detection */ 542 AC97_TUNE_INV_EAPD, /* inverted EAPD implementation */ 543 AC97_TUNE_MUTE_LED, /* EAPD bit works as mute LED */ 544 AC97_TUNE_HP_MUTE_LED, /* EAPD bit works as mute LED, use headphone control as master */ 545 }; 546 547 struct ac97_quirk { 548 unsigned short subvendor; /* PCI subsystem vendor id */ 549 unsigned short subdevice; /* PCI sybsystem device id */ 550 unsigned short mask; /* device id bit mask, 0 = accept all */ 551 unsigned int codec_id; /* codec id (if any), 0 = accept all */ 552 const char *name; /* name shown as info */ 553 int type; /* quirk type above */ 554 }; 555 556 int snd_ac97_tune_hardware(struct snd_ac97 *ac97, struct ac97_quirk *quirk, const char *override); 557 int snd_ac97_set_rate(struct snd_ac97 *ac97, int reg, unsigned int rate); 558 559 /* 560 * PCM allocation 561 */ 562 401 563 enum ac97_pcm_cfg { 402 AC97_PCM_CFG_FRONT = 2, 403 AC97_PCM_CFG_REAR = 10, /* alias surround */ 404 AC97_PCM_CFG_LFE = 11, /* center + lfe */ 405 AC97_PCM_CFG_40 = 4, /* front + rear */ 406 AC97_PCM_CFG_51 = 6, /* front + rear + center/lfe */ 407 AC97_PCM_CFG_SPDIF = 20 408 }; 409 410 /* PCM allocation */ 564 AC97_PCM_CFG_FRONT = 2, 565 AC97_PCM_CFG_REAR = 10, /* alias surround */ 566 AC97_PCM_CFG_LFE = 11, /* center + lfe */ 567 AC97_PCM_CFG_40 = 4, /* front + rear */ 568 AC97_PCM_CFG_51 = 6, /* front + rear + center/lfe */ 569 AC97_PCM_CFG_SPDIF = 20 570 }; 571 411 572 struct ac97_pcm { 412 ac97_bus_t*bus;573 struct snd_ac97_bus *bus; 413 574 #if 0 414 415 exclusive: 1, /* exclusive mode, don't override with other pcms */416 copy_flag: 1, /* lowlevel driver must fill all entries */575 unsigned int stream: 1, /* stream type: 1 = capture */ 576 exclusive: 1, /* exclusive mode, don't override with other pcms */ 577 copy_flag: 1, /* lowlevel driver must fill all entries */ 417 578 spdif: 1; /* spdif pcm */ 418 579 #else … … 422 583 unsigned int spdif; /* spdif pcm */ 423 584 #endif 424 unsigned short aslots; /* active slots */ 425 unsigned int rates; /* available rates */ 426 struct { 427 unsigned short slots; /* driver input: requested AC97 slot numbers */ 428 unsigned short rslots[4]; /* allocated slots per codecs */ 429 unsigned char rate_table[4]; 430 ac97_t *codec[4]; /* allocated codecs */ 431 } r[2]; /* 0 = standard rates, 1 = double rates */ 432 unsigned long private_value; /* used by the hardware driver */ 433 }; 434 435 struct snd_ac97_build_ops { 436 int (*build_3d) (ac97_t *ac97); 437 int (*build_specific) (ac97_t *ac97); 438 int (*build_spdif) (ac97_t *ac97); 439 int (*build_post_spdif) (ac97_t *ac97); 440 void (*suspend) (ac97_t *ac97); 441 void (*resume) (ac97_t *ac97); 442 void (*update_jacks) (ac97_t *ac97); /* for jack-sharing */ 443 }; 444 445 struct snd_ac97_bus_ops { 446 void (*reset) (ac97_t *ac97); 447 void (*write) (ac97_t *ac97, unsigned short reg, unsigned short val); 448 unsigned short (*read) (ac97_t *ac97, unsigned short reg); 449 void (*wait) (ac97_t *ac97); 450 void (*init) (ac97_t *ac97); 451 }; 452 453 struct snd_ac97_bus { 454 /* -- lowlevel (hardware) driver specific -- */ 455 ac97_bus_ops_t *ops; 456 void *private_data; 457 void (*private_free) (ac97_bus_t *bus); 458 /* --- */ 459 snd_card_t *card; 460 unsigned short num; /* bus number */ 461 unsigned short no_vra: 1, /* bridge doesn't support VRA */ 462 dra: 1, /* bridge supports double rate */ 463 isdin: 1;/* independent SDIN */ 464 unsigned int clock; /* AC'97 base clock (usually 48000Hz) */ 465 spinlock_t bus_lock; /* used mainly for slot allocation */ 466 unsigned short used_slots[2][4]; /* actually used PCM slots */ 467 unsigned short pcms_count; /* count of PCMs */ 468 struct ac97_pcm *pcms; 469 unsigned int shared_type; /* type of shared controller betwen audio and modem */ 470 ac97_t *codec[4]; 471 snd_info_entry_t *proc; 472 }; 473 474 struct snd_ac97_template { 475 void *private_data; 476 void (*private_free) (ac97_t *ac97); 477 struct pci_dev *pci; /* assigned PCI device - used for quirks */ 478 unsigned short num; /* number of codec: 0 = primary, 1 = secondary */ 479 unsigned short addr; /* physical address of codec [0-3] */ 480 unsigned int scaps; /* driver capabilities */ 481 unsigned int limited_regs; /* allow limited registers only */ 482 bitmap_member(reg_accessed,0x80); /* bit flags */ 483 }; 484 485 struct snd_ac97 { 486 /* -- lowlevel (hardware) driver specific -- */ 487 struct snd_ac97_build_ops * build_ops; 488 void *private_data; 489 void (*private_free) (ac97_t *ac97); 490 /* --- */ 491 ac97_bus_t *bus; 492 struct pci_dev *pci; /* assigned PCI device - used for quirks */ 493 snd_info_entry_t *proc; 494 snd_info_entry_t *proc_regs; 495 unsigned short subsystem_vendor; 496 unsigned short subsystem_device; 497 struct semaphore reg_mutex; 498 struct semaphore page_mutex; /* mutex for AD18xx multi-codecs and paging (2.3) */ 499 unsigned short num; /* number of codec: 0 = primary, 1 = secondary */ 500 unsigned short addr; /* physical address of codec [0-3] */ 501 unsigned int id; /* identification of codec */ 502 unsigned short caps; /* capabilities (register 0) */ 503 unsigned short ext_id; /* extended feature identification (register 28) */ 504 unsigned short ext_mid; /* extended modem ID (register 3C) */ 505 unsigned int scaps; /* driver capabilities */ 506 unsigned int flags; /* specific code */ 507 unsigned int rates[6]; /* see AC97_RATES_* defines */ 508 unsigned int spdif_status; 509 unsigned short regs[0x80]; /* register cache */ 510 unsigned int limited_regs; /* allow limited registers only */ 511 bitmap_member(reg_accessed,0x80); /* bit flags */ 512 union { /* vendor specific code */ 513 struct { 514 unsigned short unchained[3]; // 0 = C34, 1 = C79, 2 = C69 515 unsigned short chained[3]; // 0 = C34, 1 = C79, 2 = C69 516 unsigned short id[3]; // codec IDs (lower 16-bit word) 517 unsigned short pcmreg[3]; // PCM registers 518 unsigned short codec_cfg[3]; // CODEC_CFG bits 519 } ad18xx; 520 unsigned int dev_flags; /* device specific */ 521 } spec; 522 /* jack-sharing info */ 523 unsigned char indep_surround; 524 unsigned char channel_mode; 525 struct device dev; 526 }; 527 528 #define to_ac97_t(d) container_of(d, struct _snd_ac97, dev) 529 530 /* conditions */ 531 static inline int ac97_is_audio(ac97_t * ac97) 532 { 533 return (ac97->scaps & AC97_SCAP_AUDIO); 534 } 535 static inline int ac97_is_modem(ac97_t * ac97) 536 { 537 return (ac97->scaps & AC97_SCAP_MODEM); 538 } 539 static inline int ac97_is_rev22(ac97_t * ac97) 540 { 541 return (ac97->ext_id & AC97_EI_REV_MASK) >= AC97_EI_REV_22; 542 } 543 static inline int ac97_can_amap(ac97_t * ac97) 544 { 545 return (ac97->ext_id & AC97_EI_AMAP) != 0; 546 } 547 548 static inline int ac97_can_spdif(ac97_t * ac97) 549 { 550 return (ac97->ext_id & AC97_EI_SPDIF) != 0; 551 } 552 553 /* functions */ 554 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 */ 555 int snd_ac97_mixer(ac97_bus_t *bus, ac97_template_t *template, ac97_t **rac97); /* create mixer controls */ 556 const char *snd_ac97_get_short_name(ac97_t *ac97); 557 558 void snd_ac97_write(ac97_t *ac97, unsigned short reg, unsigned short value); 559 unsigned short snd_ac97_read(ac97_t *ac97, unsigned short reg); 560 void snd_ac97_write_cache(ac97_t *ac97, unsigned short reg, unsigned short value); 561 int snd_ac97_update(ac97_t *ac97, unsigned short reg, unsigned short value); 562 int snd_ac97_update_bits(ac97_t *ac97, unsigned short reg, unsigned short mask, unsigned short value); 563 #ifdef CONFIG_PM 564 void snd_ac97_suspend(ac97_t *ac97); 565 void snd_ac97_resume(ac97_t *ac97); 566 #endif 567 568 /* quirk types */ 569 enum { 570 AC97_TUNE_DEFAULT = -1, /* use default from quirk list (not valid in list) */ 571 AC97_TUNE_NONE = 0, /* nothing extra to do */ 572 AC97_TUNE_HP_ONLY, /* headphone (true line-out) control as master only */ 573 AC97_TUNE_SWAP_HP, /* swap headphone and master controls */ 574 AC97_TUNE_SWAP_SURROUND, /* swap master and surround controls */ 575 AC97_TUNE_AD_SHARING, /* for AD1985, turn on OMS bit and use headphone */ 576 AC97_TUNE_ALC_JACK, /* for Realtek, enable JACK detection */ 577 AC97_TUNE_INV_EAPD, /* inverted EAPD implementation */ 578 AC97_TUNE_MUTE_LED, /* EAPD bit works as mute LED */ 579 AC97_TUNE_HP_MUTE_LED, /* EAPD bit works as mute LED, use headphone control as master */ 580 }; 581 582 583 struct ac97_quirk { 584 unsigned short subvendor; /* PCI subsystem vendor id */ 585 unsigned short subdevice; /* PCI sybsystem device id */ 586 unsigned short mask; /* device id bit mask, 0 = accept all */ 587 unsigned int codec_id; /* codec id (if any), 0 = accept all */ 588 const char *name; /* name shown as info */ 589 int type; /* quirk type above */ 590 }; 591 592 int snd_ac97_tune_hardware(ac97_t *ac97, struct ac97_quirk *quirk, const char *override); 593 int snd_ac97_set_rate(ac97_t *ac97, int reg, unsigned int rate); 594 595 int snd_ac97_pcm_assign(ac97_bus_t *ac97, 596 unsigned short pcms_count, 597 const struct ac97_pcm *pcms); 585 unsigned short aslots; /* active slots */ 586 unsigned int rates; /* available rates */ 587 struct { 588 unsigned short slots; /* driver input: requested AC97 slot numbers */ 589 unsigned short rslots[4]; /* allocated slots per codecs */ 590 unsigned char rate_table[4]; 591 struct snd_ac97 *codec[4]; /* allocated codecs */ 592 } r[2]; /* 0 = standard rates, 1 = double rates */ 593 unsigned long private_value; /* used by the hardware driver */ 594 }; 595 596 int snd_ac97_pcm_assign(struct snd_ac97_bus *ac97, 597 unsigned short pcms_count, 598 const struct ac97_pcm *pcms); 598 599 int snd_ac97_pcm_open(struct ac97_pcm *pcm, unsigned int rate, 599 600 enum ac97_pcm_cfg cfg, unsigned short slots); 600 601 int snd_ac97_pcm_close(struct ac97_pcm *pcm); 601 int snd_ac97_pcm_double_rate_rules(snd_pcm_runtime_t *runtime); 602 603 struct ac97_enum { 604 unsigned char reg; 605 unsigned char shift_l; 606 unsigned char shift_r; 607 unsigned short mask; 608 const char **texts; 609 }; 602 int snd_ac97_pcm_double_rate_rules(struct snd_pcm_runtime *runtime); 610 603 611 604 /* ad hoc AC97 device driver access */ -
GPL/trunk/alsa-kernel/include/sound/driver.h
r63 r71 737 737 typedef u32 /*__bitwise*/ pm_message_t; 738 738 739 #ifndef __devexit_p 740 #define __devexit_p(x) x 741 #endif 742 743 typedef unsigned gfp_t; 744 745 char *kstrdup(const char *s, gfp_t gfp_flags); 746 739 747 #endif /* __DRIVER_H */
Note:
See TracChangeset
for help on using the changeset viewer.