diff options
Diffstat (limited to 'include/sound/ac97_codec.h')
-rw-r--r-- | include/sound/ac97_codec.h | 169 |
1 files changed, 83 insertions, 86 deletions
diff --git a/include/sound/ac97_codec.h b/include/sound/ac97_codec.h index 7f0ca79d6c98..b0b3ea7b365e 100644 --- a/include/sound/ac97_codec.h +++ b/include/sound/ac97_codec.h | |||
@@ -391,65 +391,35 @@ | |||
391 | * | 391 | * |
392 | */ | 392 | */ |
393 | 393 | ||
394 | typedef struct _snd_ac97_bus ac97_bus_t; | 394 | struct snd_ac97; |
395 | typedef struct _snd_ac97_bus_ops ac97_bus_ops_t; | ||
396 | typedef struct _snd_ac97_template ac97_template_t; | ||
397 | typedef struct _snd_ac97 ac97_t; | ||
398 | |||
399 | enum ac97_pcm_cfg { | ||
400 | AC97_PCM_CFG_FRONT = 2, | ||
401 | AC97_PCM_CFG_REAR = 10, /* alias surround */ | ||
402 | AC97_PCM_CFG_LFE = 11, /* center + lfe */ | ||
403 | AC97_PCM_CFG_40 = 4, /* front + rear */ | ||
404 | AC97_PCM_CFG_51 = 6, /* front + rear + center/lfe */ | ||
405 | AC97_PCM_CFG_SPDIF = 20 | ||
406 | }; | ||
407 | |||
408 | /* PCM allocation */ | ||
409 | struct ac97_pcm { | ||
410 | ac97_bus_t *bus; | ||
411 | unsigned int stream: 1, /* stream type: 1 = capture */ | ||
412 | exclusive: 1, /* exclusive mode, don't override with other pcms */ | ||
413 | copy_flag: 1, /* lowlevel driver must fill all entries */ | ||
414 | spdif: 1; /* spdif pcm */ | ||
415 | unsigned short aslots; /* active slots */ | ||
416 | unsigned int rates; /* available rates */ | ||
417 | struct { | ||
418 | unsigned short slots; /* driver input: requested AC97 slot numbers */ | ||
419 | unsigned short rslots[4]; /* allocated slots per codecs */ | ||
420 | unsigned char rate_table[4]; | ||
421 | ac97_t *codec[4]; /* allocated codecs */ | ||
422 | } r[2]; /* 0 = standard rates, 1 = double rates */ | ||
423 | unsigned long private_value; /* used by the hardware driver */ | ||
424 | }; | ||
425 | 395 | ||
426 | struct snd_ac97_build_ops { | 396 | struct snd_ac97_build_ops { |
427 | int (*build_3d) (ac97_t *ac97); | 397 | int (*build_3d) (struct snd_ac97 *ac97); |
428 | int (*build_specific) (ac97_t *ac97); | 398 | int (*build_specific) (struct snd_ac97 *ac97); |
429 | int (*build_spdif) (ac97_t *ac97); | 399 | int (*build_spdif) (struct snd_ac97 *ac97); |
430 | int (*build_post_spdif) (ac97_t *ac97); | 400 | int (*build_post_spdif) (struct snd_ac97 *ac97); |
431 | #ifdef CONFIG_PM | 401 | #ifdef CONFIG_PM |
432 | void (*suspend) (ac97_t *ac97); | 402 | void (*suspend) (struct snd_ac97 *ac97); |
433 | void (*resume) (ac97_t *ac97); | 403 | void (*resume) (struct snd_ac97 *ac97); |
434 | #endif | 404 | #endif |
435 | void (*update_jacks) (ac97_t *ac97); /* for jack-sharing */ | 405 | void (*update_jacks) (struct snd_ac97 *ac97); /* for jack-sharing */ |
436 | }; | 406 | }; |
437 | 407 | ||
438 | struct _snd_ac97_bus_ops { | 408 | struct snd_ac97_bus_ops { |
439 | void (*reset) (ac97_t *ac97); | 409 | void (*reset) (struct snd_ac97 *ac97); |
440 | void (*write) (ac97_t *ac97, unsigned short reg, unsigned short val); | 410 | void (*write) (struct snd_ac97 *ac97, unsigned short reg, unsigned short val); |
441 | unsigned short (*read) (ac97_t *ac97, unsigned short reg); | 411 | unsigned short (*read) (struct snd_ac97 *ac97, unsigned short reg); |
442 | void (*wait) (ac97_t *ac97); | 412 | void (*wait) (struct snd_ac97 *ac97); |
443 | void (*init) (ac97_t *ac97); | 413 | void (*init) (struct snd_ac97 *ac97); |
444 | }; | 414 | }; |
445 | 415 | ||
446 | struct _snd_ac97_bus { | 416 | struct snd_ac97_bus { |
447 | /* -- lowlevel (hardware) driver specific -- */ | 417 | /* -- lowlevel (hardware) driver specific -- */ |
448 | ac97_bus_ops_t *ops; | 418 | struct snd_ac97_bus_ops *ops; |
449 | void *private_data; | 419 | void *private_data; |
450 | void (*private_free) (ac97_bus_t *bus); | 420 | void (*private_free) (struct snd_ac97_bus *bus); |
451 | /* --- */ | 421 | /* --- */ |
452 | snd_card_t *card; | 422 | struct snd_card *card; |
453 | unsigned short num; /* bus number */ | 423 | unsigned short num; /* bus number */ |
454 | unsigned short no_vra: 1, /* bridge doesn't support VRA */ | 424 | unsigned short no_vra: 1, /* bridge doesn't support VRA */ |
455 | dra: 1, /* bridge supports double rate */ | 425 | dra: 1, /* bridge supports double rate */ |
@@ -459,13 +429,13 @@ struct _snd_ac97_bus { | |||
459 | unsigned short used_slots[2][4]; /* actually used PCM slots */ | 429 | unsigned short used_slots[2][4]; /* actually used PCM slots */ |
460 | unsigned short pcms_count; /* count of PCMs */ | 430 | unsigned short pcms_count; /* count of PCMs */ |
461 | struct ac97_pcm *pcms; | 431 | struct ac97_pcm *pcms; |
462 | ac97_t *codec[4]; | 432 | struct snd_ac97 *codec[4]; |
463 | snd_info_entry_t *proc; | 433 | struct snd_info_entry *proc; |
464 | }; | 434 | }; |
465 | 435 | ||
466 | struct _snd_ac97_template { | 436 | struct snd_ac97_template { |
467 | void *private_data; | 437 | void *private_data; |
468 | void (*private_free) (ac97_t *ac97); | 438 | void (*private_free) (struct snd_ac97 *ac97); |
469 | struct pci_dev *pci; /* assigned PCI device - used for quirks */ | 439 | struct pci_dev *pci; /* assigned PCI device - used for quirks */ |
470 | unsigned short num; /* number of codec: 0 = primary, 1 = secondary */ | 440 | unsigned short num; /* number of codec: 0 = primary, 1 = secondary */ |
471 | unsigned short addr; /* physical address of codec [0-3] */ | 441 | unsigned short addr; /* physical address of codec [0-3] */ |
@@ -474,16 +444,16 @@ struct _snd_ac97_template { | |||
474 | DECLARE_BITMAP(reg_accessed, 0x80); /* bit flags */ | 444 | DECLARE_BITMAP(reg_accessed, 0x80); /* bit flags */ |
475 | }; | 445 | }; |
476 | 446 | ||
477 | struct _snd_ac97 { | 447 | struct snd_ac97 { |
478 | /* -- lowlevel (hardware) driver specific -- */ | 448 | /* -- lowlevel (hardware) driver specific -- */ |
479 | struct snd_ac97_build_ops * build_ops; | 449 | struct snd_ac97_build_ops * build_ops; |
480 | void *private_data; | 450 | void *private_data; |
481 | void (*private_free) (ac97_t *ac97); | 451 | void (*private_free) (struct snd_ac97 *ac97); |
482 | /* --- */ | 452 | /* --- */ |
483 | ac97_bus_t *bus; | 453 | struct snd_ac97_bus *bus; |
484 | struct pci_dev *pci; /* assigned PCI device - used for quirks */ | 454 | struct pci_dev *pci; /* assigned PCI device - used for quirks */ |
485 | snd_info_entry_t *proc; | 455 | struct snd_info_entry *proc; |
486 | snd_info_entry_t *proc_regs; | 456 | struct snd_info_entry *proc_regs; |
487 | unsigned short subsystem_vendor; | 457 | unsigned short subsystem_vendor; |
488 | unsigned short subsystem_device; | 458 | unsigned short subsystem_device; |
489 | struct semaphore reg_mutex; | 459 | struct semaphore reg_mutex; |
@@ -517,43 +487,47 @@ struct _snd_ac97 { | |||
517 | struct device dev; | 487 | struct device dev; |
518 | }; | 488 | }; |
519 | 489 | ||
520 | #define to_ac97_t(d) container_of(d, struct _snd_ac97, dev) | 490 | #define to_ac97_t(d) container_of(d, struct snd_ac97, dev) |
521 | 491 | ||
522 | /* conditions */ | 492 | /* conditions */ |
523 | static inline int ac97_is_audio(ac97_t * ac97) | 493 | static inline int ac97_is_audio(struct snd_ac97 * ac97) |
524 | { | 494 | { |
525 | return (ac97->scaps & AC97_SCAP_AUDIO); | 495 | return (ac97->scaps & AC97_SCAP_AUDIO); |
526 | } | 496 | } |
527 | static inline int ac97_is_modem(ac97_t * ac97) | 497 | static inline int ac97_is_modem(struct snd_ac97 * ac97) |
528 | { | 498 | { |
529 | return (ac97->scaps & AC97_SCAP_MODEM); | 499 | return (ac97->scaps & AC97_SCAP_MODEM); |
530 | } | 500 | } |
531 | static inline int ac97_is_rev22(ac97_t * ac97) | 501 | static inline int ac97_is_rev22(struct snd_ac97 * ac97) |
532 | { | 502 | { |
533 | return (ac97->ext_id & AC97_EI_REV_MASK) >= AC97_EI_REV_22; | 503 | return (ac97->ext_id & AC97_EI_REV_MASK) >= AC97_EI_REV_22; |
534 | } | 504 | } |
535 | static inline int ac97_can_amap(ac97_t * ac97) | 505 | static inline int ac97_can_amap(struct snd_ac97 * ac97) |
536 | { | 506 | { |
537 | return (ac97->ext_id & AC97_EI_AMAP) != 0; | 507 | return (ac97->ext_id & AC97_EI_AMAP) != 0; |
538 | } | 508 | } |
539 | static inline int ac97_can_spdif(ac97_t * ac97) | 509 | static inline int ac97_can_spdif(struct snd_ac97 * ac97) |
540 | { | 510 | { |
541 | return (ac97->ext_id & AC97_EI_SPDIF) != 0; | 511 | return (ac97->ext_id & AC97_EI_SPDIF) != 0; |
542 | } | 512 | } |
543 | 513 | ||
544 | /* functions */ | 514 | /* functions */ |
545 | 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 */ | 515 | /* create new AC97 bus */ |
546 | int snd_ac97_mixer(ac97_bus_t *bus, ac97_template_t *template, ac97_t **rac97); /* create mixer controls */ | 516 | int snd_ac97_bus(struct snd_card *card, int num, struct snd_ac97_bus_ops *ops, |
547 | const char *snd_ac97_get_short_name(ac97_t *ac97); | 517 | void *private_data, struct snd_ac97_bus **rbus); |
548 | 518 | /* create mixer controls */ | |
549 | void snd_ac97_write(ac97_t *ac97, unsigned short reg, unsigned short value); | 519 | int snd_ac97_mixer(struct snd_ac97_bus *bus, struct snd_ac97_template *template, |
550 | unsigned short snd_ac97_read(ac97_t *ac97, unsigned short reg); | 520 | struct snd_ac97 **rac97); |
551 | void snd_ac97_write_cache(ac97_t *ac97, unsigned short reg, unsigned short value); | 521 | const char *snd_ac97_get_short_name(struct snd_ac97 *ac97); |
552 | int snd_ac97_update(ac97_t *ac97, unsigned short reg, unsigned short value); | 522 | |
553 | int snd_ac97_update_bits(ac97_t *ac97, unsigned short reg, unsigned short mask, unsigned short value); | 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); | ||
554 | #ifdef CONFIG_PM | 528 | #ifdef CONFIG_PM |
555 | void snd_ac97_suspend(ac97_t *ac97); | 529 | void snd_ac97_suspend(struct snd_ac97 *ac97); |
556 | void snd_ac97_resume(ac97_t *ac97); | 530 | void snd_ac97_resume(struct snd_ac97 *ac97); |
557 | #endif | 531 | #endif |
558 | 532 | ||
559 | /* quirk types */ | 533 | /* quirk types */ |
@@ -567,6 +541,7 @@ enum { | |||
567 | AC97_TUNE_ALC_JACK, /* for Realtek, enable JACK detection */ | 541 | AC97_TUNE_ALC_JACK, /* for Realtek, enable JACK detection */ |
568 | AC97_TUNE_INV_EAPD, /* inverted EAPD implementation */ | 542 | AC97_TUNE_INV_EAPD, /* inverted EAPD implementation */ |
569 | AC97_TUNE_MUTE_LED, /* EAPD bit works as mute LED */ | 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 */ | ||
570 | }; | 545 | }; |
571 | 546 | ||
572 | struct ac97_quirk { | 547 | struct ac97_quirk { |
@@ -578,24 +553,46 @@ struct ac97_quirk { | |||
578 | int type; /* quirk type above */ | 553 | int type; /* quirk type above */ |
579 | }; | 554 | }; |
580 | 555 | ||
581 | int snd_ac97_tune_hardware(ac97_t *ac97, struct ac97_quirk *quirk, const char *override); | 556 | int snd_ac97_tune_hardware(struct snd_ac97 *ac97, struct ac97_quirk *quirk, const char *override); |
582 | int snd_ac97_set_rate(ac97_t *ac97, int reg, unsigned int rate); | 557 | int snd_ac97_set_rate(struct snd_ac97 *ac97, int reg, unsigned int rate); |
558 | |||
559 | /* | ||
560 | * PCM allocation | ||
561 | */ | ||
562 | |||
563 | enum ac97_pcm_cfg { | ||
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 | |||
572 | struct ac97_pcm { | ||
573 | struct snd_ac97_bus *bus; | ||
574 | unsigned int stream: 1, /* stream type: 1 = capture */ | ||
575 | exclusive: 1, /* exclusive mode, don't override with other pcms */ | ||
576 | copy_flag: 1, /* lowlevel driver must fill all entries */ | ||
577 | spdif: 1; /* spdif pcm */ | ||
578 | unsigned short aslots; /* active slots */ | ||
579 | unsigned int rates; /* available rates */ | ||
580 | struct { | ||
581 | unsigned short slots; /* driver input: requested AC97 slot numbers */ | ||
582 | unsigned short rslots[4]; /* allocated slots per codecs */ | ||
583 | unsigned char rate_table[4]; | ||
584 | struct snd_ac97 *codec[4]; /* allocated codecs */ | ||
585 | } r[2]; /* 0 = standard rates, 1 = double rates */ | ||
586 | unsigned long private_value; /* used by the hardware driver */ | ||
587 | }; | ||
583 | 588 | ||
584 | int snd_ac97_pcm_assign(ac97_bus_t *ac97, | 589 | int snd_ac97_pcm_assign(struct snd_ac97_bus *ac97, |
585 | unsigned short pcms_count, | 590 | unsigned short pcms_count, |
586 | const struct ac97_pcm *pcms); | 591 | const struct ac97_pcm *pcms); |
587 | int snd_ac97_pcm_open(struct ac97_pcm *pcm, unsigned int rate, | 592 | int snd_ac97_pcm_open(struct ac97_pcm *pcm, unsigned int rate, |
588 | enum ac97_pcm_cfg cfg, unsigned short slots); | 593 | enum ac97_pcm_cfg cfg, unsigned short slots); |
589 | int snd_ac97_pcm_close(struct ac97_pcm *pcm); | 594 | int snd_ac97_pcm_close(struct ac97_pcm *pcm); |
590 | int snd_ac97_pcm_double_rate_rules(snd_pcm_runtime_t *runtime); | 595 | int snd_ac97_pcm_double_rate_rules(struct snd_pcm_runtime *runtime); |
591 | |||
592 | struct ac97_enum { | ||
593 | unsigned char reg; | ||
594 | unsigned char shift_l; | ||
595 | unsigned char shift_r; | ||
596 | unsigned short mask; | ||
597 | const char **texts; | ||
598 | }; | ||
599 | 596 | ||
600 | /* ad hoc AC97 device driver access */ | 597 | /* ad hoc AC97 device driver access */ |
601 | extern struct bus_type ac97_bus_type; | 598 | extern struct bus_type ac97_bus_type; |