diff options
author | Takashi Iwai <tiwai@suse.de> | 2014-10-31 04:31:06 -0400 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2014-10-31 04:31:06 -0400 |
commit | 4c41421657a3760056976fd517e7e6b3615febb3 (patch) | |
tree | d6643e311b01758c6e610cba95326d0d079057f6 | |
parent | ce40a6d3ad2a2b1da619db850b00940181e3f188 (diff) | |
parent | 67faa6ebd7fc0a811f6c1f3e3c113571953489ee (diff) |
Merge branch 'topic/kerneldoc' into for-next
-rw-r--r-- | Documentation/DocBook/alsa-driver-api.tmpl | 21 | ||||
-rw-r--r-- | include/sound/pcm.h | 250 | ||||
-rw-r--r-- | sound/core/control.c | 64 | ||||
-rw-r--r-- | sound/core/init.c | 33 | ||||
-rw-r--r-- | sound/core/pcm.c | 15 | ||||
-rw-r--r-- | sound/core/pcm_native.c | 53 | ||||
-rw-r--r-- | sound/core/sound.c | 9 | ||||
-rw-r--r-- | sound/pci/hda/hda_generic.c | 164 |
8 files changed, 517 insertions, 92 deletions
diff --git a/Documentation/DocBook/alsa-driver-api.tmpl b/Documentation/DocBook/alsa-driver-api.tmpl index 7bec270e2494..71f9246127ec 100644 --- a/Documentation/DocBook/alsa-driver-api.tmpl +++ b/Documentation/DocBook/alsa-driver-api.tmpl | |||
@@ -57,7 +57,7 @@ | |||
57 | !Esound/core/pcm.c | 57 | !Esound/core/pcm.c |
58 | !Esound/core/pcm_lib.c | 58 | !Esound/core/pcm_lib.c |
59 | !Esound/core/pcm_native.c | 59 | !Esound/core/pcm_native.c |
60 | !include/sound/pcm.h | 60 | !Iinclude/sound/pcm.h |
61 | </sect1> | 61 | </sect1> |
62 | <sect1><title>PCM Format Helpers</title> | 62 | <sect1><title>PCM Format Helpers</title> |
63 | !Esound/core/pcm_misc.c | 63 | !Esound/core/pcm_misc.c |
@@ -104,13 +104,30 @@ | |||
104 | !Iinclude/sound/compress_driver.h | 104 | !Iinclude/sound/compress_driver.h |
105 | </sect1> | 105 | </sect1> |
106 | </chapter> | 106 | </chapter> |
107 | <chapter><title>ASoC</title> | ||
108 | <sect1><title>ASoC Core API</title> | ||
109 | !Iinclude/sound/soc.h | ||
110 | !Esound/soc/soc-core.c | ||
111 | !Esound/soc/soc-cache.c | ||
112 | !Esound/soc/soc-devres.c | ||
113 | !Esound/soc/soc-io.c | ||
114 | !Esound/soc/soc-pcm.c | ||
115 | </sect1> | ||
116 | <sect1><title>ASoC DAPM API</title> | ||
117 | !Esound/soc/soc-dapm.c | ||
118 | </sect1> | ||
119 | <sect1><title>ASoC DMA Engine API</title> | ||
120 | !Esound/soc/soc-generic-dmaengine-pcm.c | ||
121 | </sect1> | ||
122 | </chapter> | ||
107 | <chapter><title>Miscellaneous Functions</title> | 123 | <chapter><title>Miscellaneous Functions</title> |
108 | <sect1><title>Hardware-Dependent Devices API</title> | 124 | <sect1><title>Hardware-Dependent Devices API</title> |
109 | !Esound/core/hwdep.c | 125 | !Esound/core/hwdep.c |
110 | </sect1> | 126 | </sect1> |
111 | <sect1><title>Jack Abstraction Layer API</title> | 127 | <sect1><title>Jack Abstraction Layer API</title> |
112 | !Esound/core/jack.c | ||
113 | !Iinclude/sound/jack.h | 128 | !Iinclude/sound/jack.h |
129 | !Esound/core/jack.c | ||
130 | !Esound/soc/soc-jack.c | ||
114 | </sect1> | 131 | </sect1> |
115 | <sect1><title>ISA DMA Helpers</title> | 132 | <sect1><title>ISA DMA Helpers</title> |
116 | !Esound/core/isadma.c | 133 | !Esound/core/isadma.c |
diff --git a/include/sound/pcm.h b/include/sound/pcm.h index e862497f7556..29eb09ef2969 100644 --- a/include/sound/pcm.h +++ b/include/sound/pcm.h | |||
@@ -533,6 +533,12 @@ snd_pcm_debug_name(struct snd_pcm_substream *substream, char *buf, size_t size) | |||
533 | * PCM library | 533 | * PCM library |
534 | */ | 534 | */ |
535 | 535 | ||
536 | /** | ||
537 | * snd_pcm_stream_linked - Check whether the substream is linked with others | ||
538 | * @substream: substream to check | ||
539 | * | ||
540 | * Returns true if the given substream is being linked with others. | ||
541 | */ | ||
536 | static inline int snd_pcm_stream_linked(struct snd_pcm_substream *substream) | 542 | static inline int snd_pcm_stream_linked(struct snd_pcm_substream *substream) |
537 | { | 543 | { |
538 | return substream->group != &substream->self_group; | 544 | return substream->group != &substream->self_group; |
@@ -543,6 +549,16 @@ void snd_pcm_stream_unlock(struct snd_pcm_substream *substream); | |||
543 | void snd_pcm_stream_lock_irq(struct snd_pcm_substream *substream); | 549 | void snd_pcm_stream_lock_irq(struct snd_pcm_substream *substream); |
544 | void snd_pcm_stream_unlock_irq(struct snd_pcm_substream *substream); | 550 | void snd_pcm_stream_unlock_irq(struct snd_pcm_substream *substream); |
545 | unsigned long _snd_pcm_stream_lock_irqsave(struct snd_pcm_substream *substream); | 551 | unsigned long _snd_pcm_stream_lock_irqsave(struct snd_pcm_substream *substream); |
552 | |||
553 | /** | ||
554 | * snd_pcm_stream_lock_irqsave - Lock the PCM stream | ||
555 | * @substream: PCM substream | ||
556 | * @flags: irq flags | ||
557 | * | ||
558 | * This locks the PCM stream like snd_pcm_stream_lock() but with the local | ||
559 | * IRQ (only when nonatomic is false). In nonatomic case, this is identical | ||
560 | * as snd_pcm_stream_lock(). | ||
561 | */ | ||
546 | #define snd_pcm_stream_lock_irqsave(substream, flags) \ | 562 | #define snd_pcm_stream_lock_irqsave(substream, flags) \ |
547 | do { \ | 563 | do { \ |
548 | typecheck(unsigned long, flags); \ | 564 | typecheck(unsigned long, flags); \ |
@@ -551,9 +567,25 @@ unsigned long _snd_pcm_stream_lock_irqsave(struct snd_pcm_substream *substream); | |||
551 | void snd_pcm_stream_unlock_irqrestore(struct snd_pcm_substream *substream, | 567 | void snd_pcm_stream_unlock_irqrestore(struct snd_pcm_substream *substream, |
552 | unsigned long flags); | 568 | unsigned long flags); |
553 | 569 | ||
570 | /** | ||
571 | * snd_pcm_group_for_each_entry - iterate over the linked substreams | ||
572 | * @s: the iterator | ||
573 | * @substream: the substream | ||
574 | * | ||
575 | * Iterate over the all linked substreams to the given @substream. | ||
576 | * When @substream isn't linked with any others, this gives returns @substream | ||
577 | * itself once. | ||
578 | */ | ||
554 | #define snd_pcm_group_for_each_entry(s, substream) \ | 579 | #define snd_pcm_group_for_each_entry(s, substream) \ |
555 | list_for_each_entry(s, &substream->group->substreams, link_list) | 580 | list_for_each_entry(s, &substream->group->substreams, link_list) |
556 | 581 | ||
582 | /** | ||
583 | * snd_pcm_running - Check whether the substream is in a running state | ||
584 | * @substream: substream to check | ||
585 | * | ||
586 | * Returns true if the given substream is in the state RUNNING, or in the | ||
587 | * state DRAINING for playback. | ||
588 | */ | ||
557 | static inline int snd_pcm_running(struct snd_pcm_substream *substream) | 589 | static inline int snd_pcm_running(struct snd_pcm_substream *substream) |
558 | { | 590 | { |
559 | return (substream->runtime->status->state == SNDRV_PCM_STATE_RUNNING || | 591 | return (substream->runtime->status->state == SNDRV_PCM_STATE_RUNNING || |
@@ -561,45 +593,81 @@ static inline int snd_pcm_running(struct snd_pcm_substream *substream) | |||
561 | substream->stream == SNDRV_PCM_STREAM_PLAYBACK)); | 593 | substream->stream == SNDRV_PCM_STREAM_PLAYBACK)); |
562 | } | 594 | } |
563 | 595 | ||
596 | /** | ||
597 | * bytes_to_samples - Unit conversion of the size from bytes to samples | ||
598 | * @runtime: PCM runtime instance | ||
599 | * @size: size in bytes | ||
600 | */ | ||
564 | static inline ssize_t bytes_to_samples(struct snd_pcm_runtime *runtime, ssize_t size) | 601 | static inline ssize_t bytes_to_samples(struct snd_pcm_runtime *runtime, ssize_t size) |
565 | { | 602 | { |
566 | return size * 8 / runtime->sample_bits; | 603 | return size * 8 / runtime->sample_bits; |
567 | } | 604 | } |
568 | 605 | ||
606 | /** | ||
607 | * bytes_to_frames - Unit conversion of the size from bytes to frames | ||
608 | * @runtime: PCM runtime instance | ||
609 | * @size: size in bytes | ||
610 | */ | ||
569 | static inline snd_pcm_sframes_t bytes_to_frames(struct snd_pcm_runtime *runtime, ssize_t size) | 611 | static inline snd_pcm_sframes_t bytes_to_frames(struct snd_pcm_runtime *runtime, ssize_t size) |
570 | { | 612 | { |
571 | return size * 8 / runtime->frame_bits; | 613 | return size * 8 / runtime->frame_bits; |
572 | } | 614 | } |
573 | 615 | ||
616 | /** | ||
617 | * samples_to_bytes - Unit conversion of the size from samples to bytes | ||
618 | * @runtime: PCM runtime instance | ||
619 | * @size: size in samples | ||
620 | */ | ||
574 | static inline ssize_t samples_to_bytes(struct snd_pcm_runtime *runtime, ssize_t size) | 621 | static inline ssize_t samples_to_bytes(struct snd_pcm_runtime *runtime, ssize_t size) |
575 | { | 622 | { |
576 | return size * runtime->sample_bits / 8; | 623 | return size * runtime->sample_bits / 8; |
577 | } | 624 | } |
578 | 625 | ||
626 | /** | ||
627 | * frames_to_bytes - Unit conversion of the size from frames to bytes | ||
628 | * @runtime: PCM runtime instance | ||
629 | * @size: size in frames | ||
630 | */ | ||
579 | static inline ssize_t frames_to_bytes(struct snd_pcm_runtime *runtime, snd_pcm_sframes_t size) | 631 | static inline ssize_t frames_to_bytes(struct snd_pcm_runtime *runtime, snd_pcm_sframes_t size) |
580 | { | 632 | { |
581 | return size * runtime->frame_bits / 8; | 633 | return size * runtime->frame_bits / 8; |
582 | } | 634 | } |
583 | 635 | ||
636 | /** | ||
637 | * frame_aligned - Check whether the byte size is aligned to frames | ||
638 | * @runtime: PCM runtime instance | ||
639 | * @bytes: size in bytes | ||
640 | */ | ||
584 | static inline int frame_aligned(struct snd_pcm_runtime *runtime, ssize_t bytes) | 641 | static inline int frame_aligned(struct snd_pcm_runtime *runtime, ssize_t bytes) |
585 | { | 642 | { |
586 | return bytes % runtime->byte_align == 0; | 643 | return bytes % runtime->byte_align == 0; |
587 | } | 644 | } |
588 | 645 | ||
646 | /** | ||
647 | * snd_pcm_lib_buffer_bytes - Get the buffer size of the current PCM in bytes | ||
648 | * @substream: PCM substream | ||
649 | */ | ||
589 | static inline size_t snd_pcm_lib_buffer_bytes(struct snd_pcm_substream *substream) | 650 | static inline size_t snd_pcm_lib_buffer_bytes(struct snd_pcm_substream *substream) |
590 | { | 651 | { |
591 | struct snd_pcm_runtime *runtime = substream->runtime; | 652 | struct snd_pcm_runtime *runtime = substream->runtime; |
592 | return frames_to_bytes(runtime, runtime->buffer_size); | 653 | return frames_to_bytes(runtime, runtime->buffer_size); |
593 | } | 654 | } |
594 | 655 | ||
656 | /** | ||
657 | * snd_pcm_lib_period_bytes - Get the period size of the current PCM in bytes | ||
658 | * @substream: PCM substream | ||
659 | */ | ||
595 | static inline size_t snd_pcm_lib_period_bytes(struct snd_pcm_substream *substream) | 660 | static inline size_t snd_pcm_lib_period_bytes(struct snd_pcm_substream *substream) |
596 | { | 661 | { |
597 | struct snd_pcm_runtime *runtime = substream->runtime; | 662 | struct snd_pcm_runtime *runtime = substream->runtime; |
598 | return frames_to_bytes(runtime, runtime->period_size); | 663 | return frames_to_bytes(runtime, runtime->period_size); |
599 | } | 664 | } |
600 | 665 | ||
601 | /* | 666 | /** |
602 | * result is: 0 ... (boundary - 1) | 667 | * snd_pcm_playback_avail - Get the available (writable) space for playback |
668 | * @runtime: PCM runtime instance | ||
669 | * | ||
670 | * Result is between 0 ... (boundary - 1) | ||
603 | */ | 671 | */ |
604 | static inline snd_pcm_uframes_t snd_pcm_playback_avail(struct snd_pcm_runtime *runtime) | 672 | static inline snd_pcm_uframes_t snd_pcm_playback_avail(struct snd_pcm_runtime *runtime) |
605 | { | 673 | { |
@@ -611,8 +679,11 @@ static inline snd_pcm_uframes_t snd_pcm_playback_avail(struct snd_pcm_runtime *r | |||
611 | return avail; | 679 | return avail; |
612 | } | 680 | } |
613 | 681 | ||
614 | /* | 682 | /** |
615 | * result is: 0 ... (boundary - 1) | 683 | * snd_pcm_playback_avail - Get the available (readable) space for capture |
684 | * @runtime: PCM runtime instance | ||
685 | * | ||
686 | * Result is between 0 ... (boundary - 1) | ||
616 | */ | 687 | */ |
617 | static inline snd_pcm_uframes_t snd_pcm_capture_avail(struct snd_pcm_runtime *runtime) | 688 | static inline snd_pcm_uframes_t snd_pcm_capture_avail(struct snd_pcm_runtime *runtime) |
618 | { | 689 | { |
@@ -622,11 +693,19 @@ static inline snd_pcm_uframes_t snd_pcm_capture_avail(struct snd_pcm_runtime *ru | |||
622 | return avail; | 693 | return avail; |
623 | } | 694 | } |
624 | 695 | ||
696 | /** | ||
697 | * snd_pcm_playback_hw_avail - Get the queued space for playback | ||
698 | * @runtime: PCM runtime instance | ||
699 | */ | ||
625 | static inline snd_pcm_sframes_t snd_pcm_playback_hw_avail(struct snd_pcm_runtime *runtime) | 700 | static inline snd_pcm_sframes_t snd_pcm_playback_hw_avail(struct snd_pcm_runtime *runtime) |
626 | { | 701 | { |
627 | return runtime->buffer_size - snd_pcm_playback_avail(runtime); | 702 | return runtime->buffer_size - snd_pcm_playback_avail(runtime); |
628 | } | 703 | } |
629 | 704 | ||
705 | /** | ||
706 | * snd_pcm_capture_hw_avail - Get the free space for capture | ||
707 | * @runtime: PCM runtime instance | ||
708 | */ | ||
630 | static inline snd_pcm_sframes_t snd_pcm_capture_hw_avail(struct snd_pcm_runtime *runtime) | 709 | static inline snd_pcm_sframes_t snd_pcm_capture_hw_avail(struct snd_pcm_runtime *runtime) |
631 | { | 710 | { |
632 | return runtime->buffer_size - snd_pcm_capture_avail(runtime); | 711 | return runtime->buffer_size - snd_pcm_capture_avail(runtime); |
@@ -706,6 +785,20 @@ static inline int snd_pcm_capture_empty(struct snd_pcm_substream *substream) | |||
706 | return snd_pcm_capture_avail(runtime) == 0; | 785 | return snd_pcm_capture_avail(runtime) == 0; |
707 | } | 786 | } |
708 | 787 | ||
788 | /** | ||
789 | * snd_pcm_trigger_done - Mark the master substream | ||
790 | * @substream: the pcm substream instance | ||
791 | * @master: the linked master substream | ||
792 | * | ||
793 | * When multiple substreams of the same card are linked and the hardware | ||
794 | * supports the single-shot operation, the driver calls this in the loop | ||
795 | * in snd_pcm_group_for_each_entry() for marking the substream as "done". | ||
796 | * Then most of trigger operations are performed only to the given master | ||
797 | * substream. | ||
798 | * | ||
799 | * The trigger_master mark is cleared at timestamp updates at the end | ||
800 | * of trigger operations. | ||
801 | */ | ||
709 | static inline void snd_pcm_trigger_done(struct snd_pcm_substream *substream, | 802 | static inline void snd_pcm_trigger_done(struct snd_pcm_substream *substream, |
710 | struct snd_pcm_substream *master) | 803 | struct snd_pcm_substream *master) |
711 | { | 804 | { |
@@ -748,18 +841,59 @@ static inline const struct snd_interval *hw_param_interval_c(const struct snd_pc | |||
748 | return ¶ms->intervals[var - SNDRV_PCM_HW_PARAM_FIRST_INTERVAL]; | 841 | return ¶ms->intervals[var - SNDRV_PCM_HW_PARAM_FIRST_INTERVAL]; |
749 | } | 842 | } |
750 | 843 | ||
751 | #define params_channels(p) \ | 844 | /** |
752 | (hw_param_interval_c((p), SNDRV_PCM_HW_PARAM_CHANNELS)->min) | 845 | * params_channels - Get the number of channels from the hw params |
753 | #define params_rate(p) \ | 846 | * @p: hw params |
754 | (hw_param_interval_c((p), SNDRV_PCM_HW_PARAM_RATE)->min) | 847 | */ |
755 | #define params_period_size(p) \ | 848 | static inline unsigned int params_channels(const struct snd_pcm_hw_params *p) |
756 | (hw_param_interval_c((p), SNDRV_PCM_HW_PARAM_PERIOD_SIZE)->min) | 849 | { |
757 | #define params_periods(p) \ | 850 | return hw_param_interval_c(p, SNDRV_PCM_HW_PARAM_CHANNELS)->min; |
758 | (hw_param_interval_c((p), SNDRV_PCM_HW_PARAM_PERIODS)->min) | 851 | } |
759 | #define params_buffer_size(p) \ | 852 | |
760 | (hw_param_interval_c((p), SNDRV_PCM_HW_PARAM_BUFFER_SIZE)->min) | 853 | /** |
761 | #define params_buffer_bytes(p) \ | 854 | * params_channels - Get the sample rate from the hw params |
762 | (hw_param_interval_c((p), SNDRV_PCM_HW_PARAM_BUFFER_BYTES)->min) | 855 | * @p: hw params |
856 | */ | ||
857 | static inline unsigned int params_rate(const struct snd_pcm_hw_params *p) | ||
858 | { | ||
859 | return hw_param_interval_c(p, SNDRV_PCM_HW_PARAM_RATE)->min; | ||
860 | } | ||
861 | |||
862 | /** | ||
863 | * params_channels - Get the period size (in frames) from the hw params | ||
864 | * @p: hw params | ||
865 | */ | ||
866 | static inline unsigned int params_period_size(const struct snd_pcm_hw_params *p) | ||
867 | { | ||
868 | return hw_param_interval_c(p, SNDRV_PCM_HW_PARAM_PERIOD_SIZE)->min; | ||
869 | } | ||
870 | |||
871 | /** | ||
872 | * params_channels - Get the number of periods from the hw params | ||
873 | * @p: hw params | ||
874 | */ | ||
875 | static inline unsigned int params_periods(const struct snd_pcm_hw_params *p) | ||
876 | { | ||
877 | return hw_param_interval_c(p, SNDRV_PCM_HW_PARAM_PERIODS)->min; | ||
878 | } | ||
879 | |||
880 | /** | ||
881 | * params_channels - Get the buffer size (in frames) from the hw params | ||
882 | * @p: hw params | ||
883 | */ | ||
884 | static inline unsigned int params_buffer_size(const struct snd_pcm_hw_params *p) | ||
885 | { | ||
886 | return hw_param_interval_c(p, SNDRV_PCM_HW_PARAM_BUFFER_SIZE)->min; | ||
887 | } | ||
888 | |||
889 | /** | ||
890 | * params_channels - Get the buffer size (in bytes) from the hw params | ||
891 | * @p: hw params | ||
892 | */ | ||
893 | static inline unsigned int params_buffer_bytes(const struct snd_pcm_hw_params *p) | ||
894 | { | ||
895 | return hw_param_interval_c(p, SNDRV_PCM_HW_PARAM_BUFFER_BYTES)->min; | ||
896 | } | ||
763 | 897 | ||
764 | int snd_interval_refine(struct snd_interval *i, const struct snd_interval *v); | 898 | int snd_interval_refine(struct snd_interval *i, const struct snd_interval *v); |
765 | void snd_interval_mul(const struct snd_interval *a, const struct snd_interval *b, struct snd_interval *c); | 899 | void snd_interval_mul(const struct snd_interval *a, const struct snd_interval *b, struct snd_interval *c); |
@@ -881,6 +1015,14 @@ unsigned int snd_pcm_rate_bit_to_rate(unsigned int rate_bit); | |||
881 | unsigned int snd_pcm_rate_mask_intersect(unsigned int rates_a, | 1015 | unsigned int snd_pcm_rate_mask_intersect(unsigned int rates_a, |
882 | unsigned int rates_b); | 1016 | unsigned int rates_b); |
883 | 1017 | ||
1018 | /** | ||
1019 | * snd_pcm_set_runtime_buffer - Set the PCM runtime buffer | ||
1020 | * @substream: PCM substream to set | ||
1021 | * @bufp: the buffer information, NULL to clear | ||
1022 | * | ||
1023 | * Copy the buffer information to runtime->dma_buffer when @bufp is non-NULL. | ||
1024 | * Otherwise it clears the current buffer information. | ||
1025 | */ | ||
884 | static inline void snd_pcm_set_runtime_buffer(struct snd_pcm_substream *substream, | 1026 | static inline void snd_pcm_set_runtime_buffer(struct snd_pcm_substream *substream, |
885 | struct snd_dma_buffer *bufp) | 1027 | struct snd_dma_buffer *bufp) |
886 | { | 1028 | { |
@@ -906,6 +1048,11 @@ void snd_pcm_timer_resolution_change(struct snd_pcm_substream *substream); | |||
906 | void snd_pcm_timer_init(struct snd_pcm_substream *substream); | 1048 | void snd_pcm_timer_init(struct snd_pcm_substream *substream); |
907 | void snd_pcm_timer_done(struct snd_pcm_substream *substream); | 1049 | void snd_pcm_timer_done(struct snd_pcm_substream *substream); |
908 | 1050 | ||
1051 | /** | ||
1052 | * snd_pcm_gettime - Fill the timespec depending on the timestamp mode | ||
1053 | * @runtime: PCM runtime instance | ||
1054 | * @tv: timespec to fill | ||
1055 | */ | ||
909 | static inline void snd_pcm_gettime(struct snd_pcm_runtime *runtime, | 1056 | static inline void snd_pcm_gettime(struct snd_pcm_runtime *runtime, |
910 | struct timespec *tv) | 1057 | struct timespec *tv) |
911 | { | 1058 | { |
@@ -942,7 +1089,6 @@ int _snd_pcm_lib_alloc_vmalloc_buffer(struct snd_pcm_substream *substream, | |||
942 | int snd_pcm_lib_free_vmalloc_buffer(struct snd_pcm_substream *substream); | 1089 | int snd_pcm_lib_free_vmalloc_buffer(struct snd_pcm_substream *substream); |
943 | struct page *snd_pcm_lib_get_vmalloc_page(struct snd_pcm_substream *substream, | 1090 | struct page *snd_pcm_lib_get_vmalloc_page(struct snd_pcm_substream *substream, |
944 | unsigned long offset); | 1091 | unsigned long offset); |
945 | #if 0 /* for kernel-doc */ | ||
946 | /** | 1092 | /** |
947 | * snd_pcm_lib_alloc_vmalloc_buffer - allocate virtual DMA buffer | 1093 | * snd_pcm_lib_alloc_vmalloc_buffer - allocate virtual DMA buffer |
948 | * @substream: the substream to allocate the buffer to | 1094 | * @substream: the substream to allocate the buffer to |
@@ -955,8 +1101,13 @@ struct page *snd_pcm_lib_get_vmalloc_page(struct snd_pcm_substream *substream, | |||
955 | * Return: 1 if the buffer was changed, 0 if not changed, or a negative error | 1101 | * Return: 1 if the buffer was changed, 0 if not changed, or a negative error |
956 | * code. | 1102 | * code. |
957 | */ | 1103 | */ |
958 | static int snd_pcm_lib_alloc_vmalloc_buffer | 1104 | static inline int snd_pcm_lib_alloc_vmalloc_buffer |
959 | (struct snd_pcm_substream *substream, size_t size); | 1105 | (struct snd_pcm_substream *substream, size_t size) |
1106 | { | ||
1107 | return _snd_pcm_lib_alloc_vmalloc_buffer(substream, size, | ||
1108 | GFP_KERNEL | __GFP_HIGHMEM | __GFP_ZERO); | ||
1109 | } | ||
1110 | |||
960 | /** | 1111 | /** |
961 | * snd_pcm_lib_alloc_vmalloc_32_buffer - allocate 32-bit-addressable buffer | 1112 | * snd_pcm_lib_alloc_vmalloc_32_buffer - allocate 32-bit-addressable buffer |
962 | * @substream: the substream to allocate the buffer to | 1113 | * @substream: the substream to allocate the buffer to |
@@ -968,15 +1119,12 @@ static int snd_pcm_lib_alloc_vmalloc_buffer | |||
968 | * Return: 1 if the buffer was changed, 0 if not changed, or a negative error | 1119 | * Return: 1 if the buffer was changed, 0 if not changed, or a negative error |
969 | * code. | 1120 | * code. |
970 | */ | 1121 | */ |
971 | static int snd_pcm_lib_alloc_vmalloc_32_buffer | 1122 | static inline int snd_pcm_lib_alloc_vmalloc_32_buffer |
972 | (struct snd_pcm_substream *substream, size_t size); | 1123 | (struct snd_pcm_substream *substream, size_t size) |
973 | #endif | 1124 | { |
974 | #define snd_pcm_lib_alloc_vmalloc_buffer(subs, size) \ | 1125 | return _snd_pcm_lib_alloc_vmalloc_buffer(substream, size, |
975 | _snd_pcm_lib_alloc_vmalloc_buffer \ | 1126 | GFP_KERNEL | GFP_DMA32 | __GFP_ZERO); |
976 | (subs, size, GFP_KERNEL | __GFP_HIGHMEM | __GFP_ZERO) | 1127 | } |
977 | #define snd_pcm_lib_alloc_vmalloc_32_buffer(subs, size) \ | ||
978 | _snd_pcm_lib_alloc_vmalloc_buffer \ | ||
979 | (subs, size, GFP_KERNEL | GFP_DMA32 | __GFP_ZERO) | ||
980 | 1128 | ||
981 | #define snd_pcm_get_dma_buf(substream) ((substream)->runtime->dma_buffer_p) | 1129 | #define snd_pcm_get_dma_buf(substream) ((substream)->runtime->dma_buffer_p) |
982 | 1130 | ||
@@ -996,18 +1144,35 @@ struct page *snd_pcm_sgbuf_ops_page(struct snd_pcm_substream *substream, | |||
996 | #define snd_pcm_sgbuf_ops_page NULL | 1144 | #define snd_pcm_sgbuf_ops_page NULL |
997 | #endif /* SND_DMA_SGBUF */ | 1145 | #endif /* SND_DMA_SGBUF */ |
998 | 1146 | ||
1147 | /** | ||
1148 | * snd_pcm_sgbuf_get_addr - Get the DMA address at the corresponding offset | ||
1149 | * @substream: PCM substream | ||
1150 | * @ofs: byte offset | ||
1151 | */ | ||
999 | static inline dma_addr_t | 1152 | static inline dma_addr_t |
1000 | snd_pcm_sgbuf_get_addr(struct snd_pcm_substream *substream, unsigned int ofs) | 1153 | snd_pcm_sgbuf_get_addr(struct snd_pcm_substream *substream, unsigned int ofs) |
1001 | { | 1154 | { |
1002 | return snd_sgbuf_get_addr(snd_pcm_get_dma_buf(substream), ofs); | 1155 | return snd_sgbuf_get_addr(snd_pcm_get_dma_buf(substream), ofs); |
1003 | } | 1156 | } |
1004 | 1157 | ||
1158 | /** | ||
1159 | * snd_pcm_sgbuf_get_ptr - Get the virtual address at the corresponding offset | ||
1160 | * @substream: PCM substream | ||
1161 | * @ofs: byte offset | ||
1162 | */ | ||
1005 | static inline void * | 1163 | static inline void * |
1006 | snd_pcm_sgbuf_get_ptr(struct snd_pcm_substream *substream, unsigned int ofs) | 1164 | snd_pcm_sgbuf_get_ptr(struct snd_pcm_substream *substream, unsigned int ofs) |
1007 | { | 1165 | { |
1008 | return snd_sgbuf_get_ptr(snd_pcm_get_dma_buf(substream), ofs); | 1166 | return snd_sgbuf_get_ptr(snd_pcm_get_dma_buf(substream), ofs); |
1009 | } | 1167 | } |
1010 | 1168 | ||
1169 | /** | ||
1170 | * snd_pcm_sgbuf_chunk_size - Compute the max size that fits within the contig. | ||
1171 | * page from the given size | ||
1172 | * @substream: PCM substream | ||
1173 | * @ofs: byte offset | ||
1174 | * @size: byte size to examine | ||
1175 | */ | ||
1011 | static inline unsigned int | 1176 | static inline unsigned int |
1012 | snd_pcm_sgbuf_get_chunk_size(struct snd_pcm_substream *substream, | 1177 | snd_pcm_sgbuf_get_chunk_size(struct snd_pcm_substream *substream, |
1013 | unsigned int ofs, unsigned int size) | 1178 | unsigned int ofs, unsigned int size) |
@@ -1015,13 +1180,24 @@ snd_pcm_sgbuf_get_chunk_size(struct snd_pcm_substream *substream, | |||
1015 | return snd_sgbuf_get_chunk_size(snd_pcm_get_dma_buf(substream), ofs, size); | 1180 | return snd_sgbuf_get_chunk_size(snd_pcm_get_dma_buf(substream), ofs, size); |
1016 | } | 1181 | } |
1017 | 1182 | ||
1018 | /* handle mmap counter - PCM mmap callback should handle this counter properly */ | 1183 | /** |
1184 | * snd_pcm_mmap_data_open - increase the mmap counter | ||
1185 | * @area: VMA | ||
1186 | * | ||
1187 | * PCM mmap callback should handle this counter properly | ||
1188 | */ | ||
1019 | static inline void snd_pcm_mmap_data_open(struct vm_area_struct *area) | 1189 | static inline void snd_pcm_mmap_data_open(struct vm_area_struct *area) |
1020 | { | 1190 | { |
1021 | struct snd_pcm_substream *substream = (struct snd_pcm_substream *)area->vm_private_data; | 1191 | struct snd_pcm_substream *substream = (struct snd_pcm_substream *)area->vm_private_data; |
1022 | atomic_inc(&substream->mmap_count); | 1192 | atomic_inc(&substream->mmap_count); |
1023 | } | 1193 | } |
1024 | 1194 | ||
1195 | /** | ||
1196 | * snd_pcm_mmap_data_close - decrease the mmap counter | ||
1197 | * @area: VMA | ||
1198 | * | ||
1199 | * PCM mmap callback should handle this counter properly | ||
1200 | */ | ||
1025 | static inline void snd_pcm_mmap_data_close(struct vm_area_struct *area) | 1201 | static inline void snd_pcm_mmap_data_close(struct vm_area_struct *area) |
1026 | { | 1202 | { |
1027 | struct snd_pcm_substream *substream = (struct snd_pcm_substream *)area->vm_private_data; | 1203 | struct snd_pcm_substream *substream = (struct snd_pcm_substream *)area->vm_private_data; |
@@ -1041,6 +1217,11 @@ int snd_pcm_lib_mmap_iomem(struct snd_pcm_substream *substream, struct vm_area_s | |||
1041 | 1217 | ||
1042 | #define snd_pcm_lib_mmap_vmalloc NULL | 1218 | #define snd_pcm_lib_mmap_vmalloc NULL |
1043 | 1219 | ||
1220 | /** | ||
1221 | * snd_pcm_limit_isa_dma_size - Get the max size fitting with ISA DMA transfer | ||
1222 | * @dma: DMA number | ||
1223 | * @max: pointer to store the max size | ||
1224 | */ | ||
1044 | static inline void snd_pcm_limit_isa_dma_size(int dma, size_t *max) | 1225 | static inline void snd_pcm_limit_isa_dma_size(int dma, size_t *max) |
1045 | { | 1226 | { |
1046 | *max = dma < 4 ? 64 * 1024 : 128 * 1024; | 1227 | *max = dma < 4 ? 64 * 1024 : 128 * 1024; |
@@ -1093,7 +1274,11 @@ struct snd_pcm_chmap { | |||
1093 | void *private_data; /* optional: private data pointer */ | 1274 | void *private_data; /* optional: private data pointer */ |
1094 | }; | 1275 | }; |
1095 | 1276 | ||
1096 | /* get the PCM substream assigned to the given chmap info */ | 1277 | /** |
1278 | * snd_pcm_chmap_substream - get the PCM substream assigned to the given chmap info | ||
1279 | * @info: chmap information | ||
1280 | * @idx: the substream number index | ||
1281 | */ | ||
1097 | static inline struct snd_pcm_substream * | 1282 | static inline struct snd_pcm_substream * |
1098 | snd_pcm_chmap_substream(struct snd_pcm_chmap *info, unsigned int idx) | 1283 | snd_pcm_chmap_substream(struct snd_pcm_chmap *info, unsigned int idx) |
1099 | { | 1284 | { |
@@ -1120,7 +1305,10 @@ int snd_pcm_add_chmap_ctls(struct snd_pcm *pcm, int stream, | |||
1120 | unsigned long private_value, | 1305 | unsigned long private_value, |
1121 | struct snd_pcm_chmap **info_ret); | 1306 | struct snd_pcm_chmap **info_ret); |
1122 | 1307 | ||
1123 | /* Strong-typed conversion of pcm_format to bitwise */ | 1308 | /** |
1309 | * pcm_format_to_bits - Strong-typed conversion of pcm_format to bitwise | ||
1310 | * @pcm_format: PCM format | ||
1311 | */ | ||
1124 | static inline u64 pcm_format_to_bits(snd_pcm_format_t pcm_format) | 1312 | static inline u64 pcm_format_to_bits(snd_pcm_format_t pcm_format) |
1125 | { | 1313 | { |
1126 | return 1ULL << (__force int) pcm_format; | 1314 | return 1ULL << (__force int) pcm_format; |
diff --git a/sound/core/control.c b/sound/core/control.c index 5c35bbaf881e..99aa3aa157ba 100644 --- a/sound/core/control.c +++ b/sound/core/control.c | |||
@@ -141,6 +141,16 @@ static int snd_ctl_release(struct inode *inode, struct file *file) | |||
141 | return 0; | 141 | return 0; |
142 | } | 142 | } |
143 | 143 | ||
144 | /** | ||
145 | * snd_ctl_notify - Send notification to user-space for a control change | ||
146 | * @card: the card to send notification | ||
147 | * @mask: the event mask, SNDRV_CTL_EVENT_* | ||
148 | * @id: the ctl element id to send notification | ||
149 | * | ||
150 | * This function adds an event record with the given id and mask, appends | ||
151 | * to the list and wakes up the user-space for notification. This can be | ||
152 | * called in the atomic context. | ||
153 | */ | ||
144 | void snd_ctl_notify(struct snd_card *card, unsigned int mask, | 154 | void snd_ctl_notify(struct snd_card *card, unsigned int mask, |
145 | struct snd_ctl_elem_id *id) | 155 | struct snd_ctl_elem_id *id) |
146 | { | 156 | { |
@@ -179,7 +189,6 @@ void snd_ctl_notify(struct snd_card *card, unsigned int mask, | |||
179 | } | 189 | } |
180 | read_unlock(&card->ctl_files_rwlock); | 190 | read_unlock(&card->ctl_files_rwlock); |
181 | } | 191 | } |
182 | |||
183 | EXPORT_SYMBOL(snd_ctl_notify); | 192 | EXPORT_SYMBOL(snd_ctl_notify); |
184 | 193 | ||
185 | /** | 194 | /** |
@@ -261,7 +270,6 @@ struct snd_kcontrol *snd_ctl_new1(const struct snd_kcontrol_new *ncontrol, | |||
261 | kctl.private_data = private_data; | 270 | kctl.private_data = private_data; |
262 | return snd_ctl_new(&kctl, access); | 271 | return snd_ctl_new(&kctl, access); |
263 | } | 272 | } |
264 | |||
265 | EXPORT_SYMBOL(snd_ctl_new1); | 273 | EXPORT_SYMBOL(snd_ctl_new1); |
266 | 274 | ||
267 | /** | 275 | /** |
@@ -280,7 +288,6 @@ void snd_ctl_free_one(struct snd_kcontrol *kcontrol) | |||
280 | kfree(kcontrol); | 288 | kfree(kcontrol); |
281 | } | 289 | } |
282 | } | 290 | } |
283 | |||
284 | EXPORT_SYMBOL(snd_ctl_free_one); | 291 | EXPORT_SYMBOL(snd_ctl_free_one); |
285 | 292 | ||
286 | static bool snd_ctl_remove_numid_conflict(struct snd_card *card, | 293 | static bool snd_ctl_remove_numid_conflict(struct snd_card *card, |
@@ -376,7 +383,6 @@ int snd_ctl_add(struct snd_card *card, struct snd_kcontrol *kcontrol) | |||
376 | snd_ctl_free_one(kcontrol); | 383 | snd_ctl_free_one(kcontrol); |
377 | return err; | 384 | return err; |
378 | } | 385 | } |
379 | |||
380 | EXPORT_SYMBOL(snd_ctl_add); | 386 | EXPORT_SYMBOL(snd_ctl_add); |
381 | 387 | ||
382 | /** | 388 | /** |
@@ -471,7 +477,6 @@ int snd_ctl_remove(struct snd_card *card, struct snd_kcontrol *kcontrol) | |||
471 | snd_ctl_free_one(kcontrol); | 477 | snd_ctl_free_one(kcontrol); |
472 | return 0; | 478 | return 0; |
473 | } | 479 | } |
474 | |||
475 | EXPORT_SYMBOL(snd_ctl_remove); | 480 | EXPORT_SYMBOL(snd_ctl_remove); |
476 | 481 | ||
477 | /** | 482 | /** |
@@ -499,7 +504,6 @@ int snd_ctl_remove_id(struct snd_card *card, struct snd_ctl_elem_id *id) | |||
499 | up_write(&card->controls_rwsem); | 504 | up_write(&card->controls_rwsem); |
500 | return ret; | 505 | return ret; |
501 | } | 506 | } |
502 | |||
503 | EXPORT_SYMBOL(snd_ctl_remove_id); | 507 | EXPORT_SYMBOL(snd_ctl_remove_id); |
504 | 508 | ||
505 | /** | 509 | /** |
@@ -617,7 +621,6 @@ int snd_ctl_rename_id(struct snd_card *card, struct snd_ctl_elem_id *src_id, | |||
617 | up_write(&card->controls_rwsem); | 621 | up_write(&card->controls_rwsem); |
618 | return 0; | 622 | return 0; |
619 | } | 623 | } |
620 | |||
621 | EXPORT_SYMBOL(snd_ctl_rename_id); | 624 | EXPORT_SYMBOL(snd_ctl_rename_id); |
622 | 625 | ||
623 | /** | 626 | /** |
@@ -645,7 +648,6 @@ struct snd_kcontrol *snd_ctl_find_numid(struct snd_card *card, unsigned int numi | |||
645 | } | 648 | } |
646 | return NULL; | 649 | return NULL; |
647 | } | 650 | } |
648 | |||
649 | EXPORT_SYMBOL(snd_ctl_find_numid); | 651 | EXPORT_SYMBOL(snd_ctl_find_numid); |
650 | 652 | ||
651 | /** | 653 | /** |
@@ -687,7 +689,6 @@ struct snd_kcontrol *snd_ctl_find_id(struct snd_card *card, | |||
687 | } | 689 | } |
688 | return NULL; | 690 | return NULL; |
689 | } | 691 | } |
690 | |||
691 | EXPORT_SYMBOL(snd_ctl_find_id); | 692 | EXPORT_SYMBOL(snd_ctl_find_id); |
692 | 693 | ||
693 | static int snd_ctl_card_info(struct snd_card *card, struct snd_ctl_file * ctl, | 694 | static int snd_ctl_card_info(struct snd_card *card, struct snd_ctl_file * ctl, |
@@ -1526,19 +1527,28 @@ static int _snd_ctl_register_ioctl(snd_kctl_ioctl_func_t fcn, struct list_head * | |||
1526 | return 0; | 1527 | return 0; |
1527 | } | 1528 | } |
1528 | 1529 | ||
1530 | /** | ||
1531 | * snd_ctl_register_ioctl - register the device-specific control-ioctls | ||
1532 | * @fcn: ioctl callback function | ||
1533 | * | ||
1534 | * called from each device manager like pcm.c, hwdep.c, etc. | ||
1535 | */ | ||
1529 | int snd_ctl_register_ioctl(snd_kctl_ioctl_func_t fcn) | 1536 | int snd_ctl_register_ioctl(snd_kctl_ioctl_func_t fcn) |
1530 | { | 1537 | { |
1531 | return _snd_ctl_register_ioctl(fcn, &snd_control_ioctls); | 1538 | return _snd_ctl_register_ioctl(fcn, &snd_control_ioctls); |
1532 | } | 1539 | } |
1533 | |||
1534 | EXPORT_SYMBOL(snd_ctl_register_ioctl); | 1540 | EXPORT_SYMBOL(snd_ctl_register_ioctl); |
1535 | 1541 | ||
1536 | #ifdef CONFIG_COMPAT | 1542 | #ifdef CONFIG_COMPAT |
1543 | /** | ||
1544 | * snd_ctl_register_ioctl_compat - register the device-specific 32bit compat | ||
1545 | * control-ioctls | ||
1546 | * @fcn: ioctl callback function | ||
1547 | */ | ||
1537 | int snd_ctl_register_ioctl_compat(snd_kctl_ioctl_func_t fcn) | 1548 | int snd_ctl_register_ioctl_compat(snd_kctl_ioctl_func_t fcn) |
1538 | { | 1549 | { |
1539 | return _snd_ctl_register_ioctl(fcn, &snd_control_compat_ioctls); | 1550 | return _snd_ctl_register_ioctl(fcn, &snd_control_compat_ioctls); |
1540 | } | 1551 | } |
1541 | |||
1542 | EXPORT_SYMBOL(snd_ctl_register_ioctl_compat); | 1552 | EXPORT_SYMBOL(snd_ctl_register_ioctl_compat); |
1543 | #endif | 1553 | #endif |
1544 | 1554 | ||
@@ -1566,19 +1576,26 @@ static int _snd_ctl_unregister_ioctl(snd_kctl_ioctl_func_t fcn, | |||
1566 | return -EINVAL; | 1576 | return -EINVAL; |
1567 | } | 1577 | } |
1568 | 1578 | ||
1579 | /** | ||
1580 | * snd_ctl_unregister_ioctl - de-register the device-specific control-ioctls | ||
1581 | * @fcn: ioctl callback function to unregister | ||
1582 | */ | ||
1569 | int snd_ctl_unregister_ioctl(snd_kctl_ioctl_func_t fcn) | 1583 | int snd_ctl_unregister_ioctl(snd_kctl_ioctl_func_t fcn) |
1570 | { | 1584 | { |
1571 | return _snd_ctl_unregister_ioctl(fcn, &snd_control_ioctls); | 1585 | return _snd_ctl_unregister_ioctl(fcn, &snd_control_ioctls); |
1572 | } | 1586 | } |
1573 | |||
1574 | EXPORT_SYMBOL(snd_ctl_unregister_ioctl); | 1587 | EXPORT_SYMBOL(snd_ctl_unregister_ioctl); |
1575 | 1588 | ||
1576 | #ifdef CONFIG_COMPAT | 1589 | #ifdef CONFIG_COMPAT |
1590 | /** | ||
1591 | * snd_ctl_unregister_ioctl - de-register the device-specific compat 32bit | ||
1592 | * control-ioctls | ||
1593 | * @fcn: ioctl callback function to unregister | ||
1594 | */ | ||
1577 | int snd_ctl_unregister_ioctl_compat(snd_kctl_ioctl_func_t fcn) | 1595 | int snd_ctl_unregister_ioctl_compat(snd_kctl_ioctl_func_t fcn) |
1578 | { | 1596 | { |
1579 | return _snd_ctl_unregister_ioctl(fcn, &snd_control_compat_ioctls); | 1597 | return _snd_ctl_unregister_ioctl(fcn, &snd_control_compat_ioctls); |
1580 | } | 1598 | } |
1581 | |||
1582 | EXPORT_SYMBOL(snd_ctl_unregister_ioctl_compat); | 1599 | EXPORT_SYMBOL(snd_ctl_unregister_ioctl_compat); |
1583 | #endif | 1600 | #endif |
1584 | 1601 | ||
@@ -1702,6 +1719,16 @@ int snd_ctl_create(struct snd_card *card) | |||
1702 | /* | 1719 | /* |
1703 | * Frequently used control callbacks/helpers | 1720 | * Frequently used control callbacks/helpers |
1704 | */ | 1721 | */ |
1722 | |||
1723 | /** | ||
1724 | * snd_ctl_boolean_mono_info - Helper function for a standard boolean info | ||
1725 | * callback with a mono channel | ||
1726 | * @kcontrol: the kcontrol instance | ||
1727 | * @uinfo: info to store | ||
1728 | * | ||
1729 | * This is a function that can be used as info callback for a standard | ||
1730 | * boolean control with a single mono channel. | ||
1731 | */ | ||
1705 | int snd_ctl_boolean_mono_info(struct snd_kcontrol *kcontrol, | 1732 | int snd_ctl_boolean_mono_info(struct snd_kcontrol *kcontrol, |
1706 | struct snd_ctl_elem_info *uinfo) | 1733 | struct snd_ctl_elem_info *uinfo) |
1707 | { | 1734 | { |
@@ -1711,9 +1738,17 @@ int snd_ctl_boolean_mono_info(struct snd_kcontrol *kcontrol, | |||
1711 | uinfo->value.integer.max = 1; | 1738 | uinfo->value.integer.max = 1; |
1712 | return 0; | 1739 | return 0; |
1713 | } | 1740 | } |
1714 | |||
1715 | EXPORT_SYMBOL(snd_ctl_boolean_mono_info); | 1741 | EXPORT_SYMBOL(snd_ctl_boolean_mono_info); |
1716 | 1742 | ||
1743 | /** | ||
1744 | * snd_ctl_boolean_stereo_info - Helper function for a standard boolean info | ||
1745 | * callback with stereo two channels | ||
1746 | * @kcontrol: the kcontrol instance | ||
1747 | * @uinfo: info to store | ||
1748 | * | ||
1749 | * This is a function that can be used as info callback for a standard | ||
1750 | * boolean control with stereo two channels. | ||
1751 | */ | ||
1717 | int snd_ctl_boolean_stereo_info(struct snd_kcontrol *kcontrol, | 1752 | int snd_ctl_boolean_stereo_info(struct snd_kcontrol *kcontrol, |
1718 | struct snd_ctl_elem_info *uinfo) | 1753 | struct snd_ctl_elem_info *uinfo) |
1719 | { | 1754 | { |
@@ -1723,7 +1758,6 @@ int snd_ctl_boolean_stereo_info(struct snd_kcontrol *kcontrol, | |||
1723 | uinfo->value.integer.max = 1; | 1758 | uinfo->value.integer.max = 1; |
1724 | return 0; | 1759 | return 0; |
1725 | } | 1760 | } |
1726 | |||
1727 | EXPORT_SYMBOL(snd_ctl_boolean_stereo_info); | 1761 | EXPORT_SYMBOL(snd_ctl_boolean_stereo_info); |
1728 | 1762 | ||
1729 | /** | 1763 | /** |
diff --git a/sound/core/init.c b/sound/core/init.c index 7bdfd19e24a8..074875d68c15 100644 --- a/sound/core/init.c +++ b/sound/core/init.c | |||
@@ -438,17 +438,6 @@ int snd_card_disconnect(struct snd_card *card) | |||
438 | 438 | ||
439 | EXPORT_SYMBOL(snd_card_disconnect); | 439 | EXPORT_SYMBOL(snd_card_disconnect); |
440 | 440 | ||
441 | /** | ||
442 | * snd_card_free - frees given soundcard structure | ||
443 | * @card: soundcard structure | ||
444 | * | ||
445 | * This function releases the soundcard structure and the all assigned | ||
446 | * devices automatically. That is, you don't have to release the devices | ||
447 | * by yourself. | ||
448 | * | ||
449 | * Return: Zero. Frees all associated devices and frees the control | ||
450 | * interface associated to given soundcard. | ||
451 | */ | ||
452 | static int snd_card_do_free(struct snd_card *card) | 441 | static int snd_card_do_free(struct snd_card *card) |
453 | { | 442 | { |
454 | #if IS_ENABLED(CONFIG_SND_MIXER_OSS) | 443 | #if IS_ENABLED(CONFIG_SND_MIXER_OSS) |
@@ -469,6 +458,15 @@ static int snd_card_do_free(struct snd_card *card) | |||
469 | return 0; | 458 | return 0; |
470 | } | 459 | } |
471 | 460 | ||
461 | /** | ||
462 | * snd_card_free_when_closed - Disconnect the card, free it later eventually | ||
463 | * @card: soundcard structure | ||
464 | * | ||
465 | * Unlike snd_card_free(), this function doesn't try to release the card | ||
466 | * resource immediately, but tries to disconnect at first. When the card | ||
467 | * is still in use, the function returns before freeing the resources. | ||
468 | * The card resources will be freed when the refcount gets to zero. | ||
469 | */ | ||
472 | int snd_card_free_when_closed(struct snd_card *card) | 470 | int snd_card_free_when_closed(struct snd_card *card) |
473 | { | 471 | { |
474 | int ret = snd_card_disconnect(card); | 472 | int ret = snd_card_disconnect(card); |
@@ -479,6 +477,19 @@ int snd_card_free_when_closed(struct snd_card *card) | |||
479 | } | 477 | } |
480 | EXPORT_SYMBOL(snd_card_free_when_closed); | 478 | EXPORT_SYMBOL(snd_card_free_when_closed); |
481 | 479 | ||
480 | /** | ||
481 | * snd_card_free - frees given soundcard structure | ||
482 | * @card: soundcard structure | ||
483 | * | ||
484 | * This function releases the soundcard structure and the all assigned | ||
485 | * devices automatically. That is, you don't have to release the devices | ||
486 | * by yourself. | ||
487 | * | ||
488 | * This function waits until the all resources are properly released. | ||
489 | * | ||
490 | * Return: Zero. Frees all associated devices and frees the control | ||
491 | * interface associated to given soundcard. | ||
492 | */ | ||
482 | int snd_card_free(struct snd_card *card) | 493 | int snd_card_free(struct snd_card *card) |
483 | { | 494 | { |
484 | struct completion released; | 495 | struct completion released; |
diff --git a/sound/core/pcm.c b/sound/core/pcm.c index 42ded997b223..31acc3df62cd 100644 --- a/sound/core/pcm.c +++ b/sound/core/pcm.c | |||
@@ -218,6 +218,10 @@ static char *snd_pcm_format_names[] = { | |||
218 | FORMAT(DSD_U32_LE), | 218 | FORMAT(DSD_U32_LE), |
219 | }; | 219 | }; |
220 | 220 | ||
221 | /** | ||
222 | * snd_pcm_format_name - Return a name string for the given PCM format | ||
223 | * @format: PCM format | ||
224 | */ | ||
221 | const char *snd_pcm_format_name(snd_pcm_format_t format) | 225 | const char *snd_pcm_format_name(snd_pcm_format_t format) |
222 | { | 226 | { |
223 | if ((__force unsigned int)format >= ARRAY_SIZE(snd_pcm_format_names)) | 227 | if ((__force unsigned int)format >= ARRAY_SIZE(snd_pcm_format_names)) |
@@ -707,7 +711,6 @@ int snd_pcm_new_stream(struct snd_pcm *pcm, int stream, int substream_count) | |||
707 | } | 711 | } |
708 | return 0; | 712 | return 0; |
709 | } | 713 | } |
710 | |||
711 | EXPORT_SYMBOL(snd_pcm_new_stream); | 714 | EXPORT_SYMBOL(snd_pcm_new_stream); |
712 | 715 | ||
713 | static int _snd_pcm_new(struct snd_card *card, const char *id, int device, | 716 | static int _snd_pcm_new(struct snd_card *card, const char *id, int device, |
@@ -1155,6 +1158,15 @@ static int snd_pcm_dev_disconnect(struct snd_device *device) | |||
1155 | return 0; | 1158 | return 0; |
1156 | } | 1159 | } |
1157 | 1160 | ||
1161 | /** | ||
1162 | * snd_pcm_notify - Add/remove the notify list | ||
1163 | * @notify: PCM notify list | ||
1164 | * @nfree: 0 = register, 1 = unregister | ||
1165 | * | ||
1166 | * This adds the given notifier to the global list so that the callback is | ||
1167 | * called for each registered PCM devices. This exists only for PCM OSS | ||
1168 | * emulation, so far. | ||
1169 | */ | ||
1158 | int snd_pcm_notify(struct snd_pcm_notify *notify, int nfree) | 1170 | int snd_pcm_notify(struct snd_pcm_notify *notify, int nfree) |
1159 | { | 1171 | { |
1160 | struct snd_pcm *pcm; | 1172 | struct snd_pcm *pcm; |
@@ -1177,7 +1189,6 @@ int snd_pcm_notify(struct snd_pcm_notify *notify, int nfree) | |||
1177 | mutex_unlock(®ister_mutex); | 1189 | mutex_unlock(®ister_mutex); |
1178 | return 0; | 1190 | return 0; |
1179 | } | 1191 | } |
1180 | |||
1181 | EXPORT_SYMBOL(snd_pcm_notify); | 1192 | EXPORT_SYMBOL(snd_pcm_notify); |
1182 | 1193 | ||
1183 | #ifdef CONFIG_PROC_FS | 1194 | #ifdef CONFIG_PROC_FS |
diff --git a/sound/core/pcm_native.c b/sound/core/pcm_native.c index 2f7ad10ee7c3..4d5795d8b9f7 100644 --- a/sound/core/pcm_native.c +++ b/sound/core/pcm_native.c | |||
@@ -74,6 +74,14 @@ static int snd_pcm_open(struct file *file, struct snd_pcm *pcm, int stream); | |||
74 | static DEFINE_RWLOCK(snd_pcm_link_rwlock); | 74 | static DEFINE_RWLOCK(snd_pcm_link_rwlock); |
75 | static DECLARE_RWSEM(snd_pcm_link_rwsem); | 75 | static DECLARE_RWSEM(snd_pcm_link_rwsem); |
76 | 76 | ||
77 | /** | ||
78 | * snd_pcm_stream_lock - Lock the PCM stream | ||
79 | * @substream: PCM substream | ||
80 | * | ||
81 | * This locks the PCM stream's spinlock or mutex depending on the nonatomic | ||
82 | * flag of the given substream. This also takes the global link rw lock | ||
83 | * (or rw sem), too, for avoiding the race with linked streams. | ||
84 | */ | ||
77 | void snd_pcm_stream_lock(struct snd_pcm_substream *substream) | 85 | void snd_pcm_stream_lock(struct snd_pcm_substream *substream) |
78 | { | 86 | { |
79 | if (substream->pcm->nonatomic) { | 87 | if (substream->pcm->nonatomic) { |
@@ -86,6 +94,12 @@ void snd_pcm_stream_lock(struct snd_pcm_substream *substream) | |||
86 | } | 94 | } |
87 | EXPORT_SYMBOL_GPL(snd_pcm_stream_lock); | 95 | EXPORT_SYMBOL_GPL(snd_pcm_stream_lock); |
88 | 96 | ||
97 | /** | ||
98 | * snd_pcm_stream_lock - Unlock the PCM stream | ||
99 | * @substream: PCM substream | ||
100 | * | ||
101 | * This unlocks the PCM stream that has been locked via snd_pcm_stream_lock(). | ||
102 | */ | ||
89 | void snd_pcm_stream_unlock(struct snd_pcm_substream *substream) | 103 | void snd_pcm_stream_unlock(struct snd_pcm_substream *substream) |
90 | { | 104 | { |
91 | if (substream->pcm->nonatomic) { | 105 | if (substream->pcm->nonatomic) { |
@@ -98,6 +112,14 @@ void snd_pcm_stream_unlock(struct snd_pcm_substream *substream) | |||
98 | } | 112 | } |
99 | EXPORT_SYMBOL_GPL(snd_pcm_stream_unlock); | 113 | EXPORT_SYMBOL_GPL(snd_pcm_stream_unlock); |
100 | 114 | ||
115 | /** | ||
116 | * snd_pcm_stream_lock_irq - Lock the PCM stream | ||
117 | * @substream: PCM substream | ||
118 | * | ||
119 | * This locks the PCM stream like snd_pcm_stream_lock() and disables the local | ||
120 | * IRQ (only when nonatomic is false). In nonatomic case, this is identical | ||
121 | * as snd_pcm_stream_lock(). | ||
122 | */ | ||
101 | void snd_pcm_stream_lock_irq(struct snd_pcm_substream *substream) | 123 | void snd_pcm_stream_lock_irq(struct snd_pcm_substream *substream) |
102 | { | 124 | { |
103 | if (!substream->pcm->nonatomic) | 125 | if (!substream->pcm->nonatomic) |
@@ -106,6 +128,12 @@ void snd_pcm_stream_lock_irq(struct snd_pcm_substream *substream) | |||
106 | } | 128 | } |
107 | EXPORT_SYMBOL_GPL(snd_pcm_stream_lock_irq); | 129 | EXPORT_SYMBOL_GPL(snd_pcm_stream_lock_irq); |
108 | 130 | ||
131 | /** | ||
132 | * snd_pcm_stream_unlock_irq - Unlock the PCM stream | ||
133 | * @substream: PCM substream | ||
134 | * | ||
135 | * This is a counter-part of snd_pcm_stream_lock_irq(). | ||
136 | */ | ||
109 | void snd_pcm_stream_unlock_irq(struct snd_pcm_substream *substream) | 137 | void snd_pcm_stream_unlock_irq(struct snd_pcm_substream *substream) |
110 | { | 138 | { |
111 | snd_pcm_stream_unlock(substream); | 139 | snd_pcm_stream_unlock(substream); |
@@ -124,6 +152,13 @@ unsigned long _snd_pcm_stream_lock_irqsave(struct snd_pcm_substream *substream) | |||
124 | } | 152 | } |
125 | EXPORT_SYMBOL_GPL(_snd_pcm_stream_lock_irqsave); | 153 | EXPORT_SYMBOL_GPL(_snd_pcm_stream_lock_irqsave); |
126 | 154 | ||
155 | /** | ||
156 | * snd_pcm_stream_unlock_irqrestore - Unlock the PCM stream | ||
157 | * @substream: PCM substream | ||
158 | * @flags: irq flags | ||
159 | * | ||
160 | * This is a counter-part of snd_pcm_stream_lock_irqsave(). | ||
161 | */ | ||
127 | void snd_pcm_stream_unlock_irqrestore(struct snd_pcm_substream *substream, | 162 | void snd_pcm_stream_unlock_irqrestore(struct snd_pcm_substream *substream, |
128 | unsigned long flags) | 163 | unsigned long flags) |
129 | { | 164 | { |
@@ -3312,6 +3347,15 @@ static const struct vm_operations_struct snd_pcm_vm_ops_data_fault = { | |||
3312 | /* | 3347 | /* |
3313 | * mmap the DMA buffer on RAM | 3348 | * mmap the DMA buffer on RAM |
3314 | */ | 3349 | */ |
3350 | |||
3351 | /** | ||
3352 | * snd_pcm_lib_default_mmap - Default PCM data mmap function | ||
3353 | * @substream: PCM substream | ||
3354 | * @area: VMA | ||
3355 | * | ||
3356 | * This is the default mmap handler for PCM data. When mmap pcm_ops is NULL, | ||
3357 | * this function is invoked implicitly. | ||
3358 | */ | ||
3315 | int snd_pcm_lib_default_mmap(struct snd_pcm_substream *substream, | 3359 | int snd_pcm_lib_default_mmap(struct snd_pcm_substream *substream, |
3316 | struct vm_area_struct *area) | 3360 | struct vm_area_struct *area) |
3317 | { | 3361 | { |
@@ -3343,6 +3387,15 @@ EXPORT_SYMBOL_GPL(snd_pcm_lib_default_mmap); | |||
3343 | * mmap the DMA buffer on I/O memory area | 3387 | * mmap the DMA buffer on I/O memory area |
3344 | */ | 3388 | */ |
3345 | #if SNDRV_PCM_INFO_MMAP_IOMEM | 3389 | #if SNDRV_PCM_INFO_MMAP_IOMEM |
3390 | /** | ||
3391 | * snd_pcm_lib_mmap_iomem - Default PCM data mmap function for I/O mem | ||
3392 | * @substream: PCM substream | ||
3393 | * @area: VMA | ||
3394 | * | ||
3395 | * When your hardware uses the iomapped pages as the hardware buffer and | ||
3396 | * wants to mmap it, pass this function as mmap pcm_ops. Note that this | ||
3397 | * is supposed to work only on limited architectures. | ||
3398 | */ | ||
3346 | int snd_pcm_lib_mmap_iomem(struct snd_pcm_substream *substream, | 3399 | int snd_pcm_lib_mmap_iomem(struct snd_pcm_substream *substream, |
3347 | struct vm_area_struct *area) | 3400 | struct vm_area_struct *area) |
3348 | { | 3401 | { |
diff --git a/sound/core/sound.c b/sound/core/sound.c index 38ad1a0dd3f7..f1333060bf1c 100644 --- a/sound/core/sound.c +++ b/sound/core/sound.c | |||
@@ -355,8 +355,13 @@ int snd_unregister_device(int type, struct snd_card *card, int dev) | |||
355 | 355 | ||
356 | EXPORT_SYMBOL(snd_unregister_device); | 356 | EXPORT_SYMBOL(snd_unregister_device); |
357 | 357 | ||
358 | /* get the assigned device to the given type and device number; | 358 | /** |
359 | * the caller needs to release it via put_device() after using it | 359 | * snd_get_device - get the assigned device to the given type and device number |
360 | * @type: the device type, SNDRV_DEVICE_TYPE_XXX | ||
361 | * @card:the card instance | ||
362 | * @dev: the device index | ||
363 | * | ||
364 | * The caller needs to release it via put_device() after using it. | ||
360 | */ | 365 | */ |
361 | struct device *snd_get_device(int type, struct snd_card *card, int dev) | 366 | struct device *snd_get_device(int type, struct snd_card *card, int dev) |
362 | { | 367 | { |
diff --git a/sound/pci/hda/hda_generic.c b/sound/pci/hda/hda_generic.c index 06d721085e72..63b69f750d8e 100644 --- a/sound/pci/hda/hda_generic.c +++ b/sound/pci/hda/hda_generic.c | |||
@@ -40,7 +40,12 @@ | |||
40 | #include "hda_generic.h" | 40 | #include "hda_generic.h" |
41 | 41 | ||
42 | 42 | ||
43 | /* initialize hda_gen_spec struct */ | 43 | /** |
44 | * snd_hda_gen_spec_init - initialize hda_gen_spec struct | ||
45 | * @spec: hda_gen_spec object to initialize | ||
46 | * | ||
47 | * Initialize the given hda_gen_spec object. | ||
48 | */ | ||
44 | int snd_hda_gen_spec_init(struct hda_gen_spec *spec) | 49 | int snd_hda_gen_spec_init(struct hda_gen_spec *spec) |
45 | { | 50 | { |
46 | snd_array_init(&spec->kctls, sizeof(struct snd_kcontrol_new), 32); | 51 | snd_array_init(&spec->kctls, sizeof(struct snd_kcontrol_new), 32); |
@@ -51,6 +56,17 @@ int snd_hda_gen_spec_init(struct hda_gen_spec *spec) | |||
51 | } | 56 | } |
52 | EXPORT_SYMBOL_GPL(snd_hda_gen_spec_init); | 57 | EXPORT_SYMBOL_GPL(snd_hda_gen_spec_init); |
53 | 58 | ||
59 | /** | ||
60 | * snd_hda_gen_add_kctl - Add a new kctl_new struct from the template | ||
61 | * @spec: hda_gen_spec object | ||
62 | * @name: name string to override the template, NULL if unchanged | ||
63 | * @temp: template for the new kctl | ||
64 | * | ||
65 | * Add a new kctl (actually snd_kcontrol_new to be instantiated later) | ||
66 | * element based on the given snd_kcontrol_new template @temp and the | ||
67 | * name string @name to the list in @spec. | ||
68 | * Returns the newly created object or NULL as error. | ||
69 | */ | ||
54 | struct snd_kcontrol_new * | 70 | struct snd_kcontrol_new * |
55 | snd_hda_gen_add_kctl(struct hda_gen_spec *spec, const char *name, | 71 | snd_hda_gen_add_kctl(struct hda_gen_spec *spec, const char *name, |
56 | const struct snd_kcontrol_new *temp) | 72 | const struct snd_kcontrol_new *temp) |
@@ -259,8 +275,14 @@ static struct nid_path *get_nid_path(struct hda_codec *codec, | |||
259 | return NULL; | 275 | return NULL; |
260 | } | 276 | } |
261 | 277 | ||
262 | /* get the path between the given NIDs; | 278 | /** |
263 | * passing 0 to either @pin or @dac behaves as a wildcard | 279 | * snd_hda_get_nid_path - get the path between the given NIDs |
280 | * @codec: the HDA codec | ||
281 | * @from_nid: the NID where the path start from | ||
282 | * @to_nid: the NID where the path ends at | ||
283 | * | ||
284 | * Return the found nid_path object or NULL for error. | ||
285 | * Passing 0 to either @from_nid or @to_nid behaves as a wildcard. | ||
264 | */ | 286 | */ |
265 | struct nid_path *snd_hda_get_nid_path(struct hda_codec *codec, | 287 | struct nid_path *snd_hda_get_nid_path(struct hda_codec *codec, |
266 | hda_nid_t from_nid, hda_nid_t to_nid) | 288 | hda_nid_t from_nid, hda_nid_t to_nid) |
@@ -269,8 +291,14 @@ struct nid_path *snd_hda_get_nid_path(struct hda_codec *codec, | |||
269 | } | 291 | } |
270 | EXPORT_SYMBOL_GPL(snd_hda_get_nid_path); | 292 | EXPORT_SYMBOL_GPL(snd_hda_get_nid_path); |
271 | 293 | ||
272 | /* get the index number corresponding to the path instance; | 294 | /** |
273 | * the index starts from 1, for easier checking the invalid value | 295 | * snd_hda_get_path_idx - get the index number corresponding to the path |
296 | * instance | ||
297 | * @codec: the HDA codec | ||
298 | * @path: nid_path object | ||
299 | * | ||
300 | * The returned index starts from 1, i.e. the actual array index with offset 1, | ||
301 | * and zero is handled as an invalid path | ||
274 | */ | 302 | */ |
275 | int snd_hda_get_path_idx(struct hda_codec *codec, struct nid_path *path) | 303 | int snd_hda_get_path_idx(struct hda_codec *codec, struct nid_path *path) |
276 | { | 304 | { |
@@ -287,7 +315,12 @@ int snd_hda_get_path_idx(struct hda_codec *codec, struct nid_path *path) | |||
287 | } | 315 | } |
288 | EXPORT_SYMBOL_GPL(snd_hda_get_path_idx); | 316 | EXPORT_SYMBOL_GPL(snd_hda_get_path_idx); |
289 | 317 | ||
290 | /* get the path instance corresponding to the given index number */ | 318 | /** |
319 | * snd_hda_get_path_from_idx - get the path instance corresponding to the | ||
320 | * given index number | ||
321 | * @codec: the HDA codec | ||
322 | * @idx: the path index | ||
323 | */ | ||
291 | struct nid_path *snd_hda_get_path_from_idx(struct hda_codec *codec, int idx) | 324 | struct nid_path *snd_hda_get_path_from_idx(struct hda_codec *codec, int idx) |
292 | { | 325 | { |
293 | struct hda_gen_spec *spec = codec->spec; | 326 | struct hda_gen_spec *spec = codec->spec; |
@@ -415,7 +448,18 @@ static bool __parse_nid_path(struct hda_codec *codec, | |||
415 | return true; | 448 | return true; |
416 | } | 449 | } |
417 | 450 | ||
418 | /* parse the widget path from the given nid to the target nid; | 451 | /** |
452 | * snd_hda_parse_nid_path - parse the widget path from the given nid to | ||
453 | * the target nid | ||
454 | * @codec: the HDA codec | ||
455 | * @from_nid: the NID where the path start from | ||
456 | * @to_nid: the NID where the path ends at | ||
457 | * @anchor_nid: the anchor indication | ||
458 | * @path: the path object to store the result | ||
459 | * | ||
460 | * Returns true if a matching path is found. | ||
461 | * | ||
462 | * The parsing behavior depends on parameters: | ||
419 | * when @from_nid is 0, try to find an empty DAC; | 463 | * when @from_nid is 0, try to find an empty DAC; |
420 | * when @anchor_nid is set to a positive value, only paths through the widget | 464 | * when @anchor_nid is set to a positive value, only paths through the widget |
421 | * with the given value are evaluated. | 465 | * with the given value are evaluated. |
@@ -436,9 +480,15 @@ bool snd_hda_parse_nid_path(struct hda_codec *codec, hda_nid_t from_nid, | |||
436 | } | 480 | } |
437 | EXPORT_SYMBOL_GPL(snd_hda_parse_nid_path); | 481 | EXPORT_SYMBOL_GPL(snd_hda_parse_nid_path); |
438 | 482 | ||
439 | /* | 483 | /** |
440 | * parse the path between the given NIDs and add to the path list. | 484 | * snd_hda_add_new_path - parse the path between the given NIDs and |
441 | * if no valid path is found, return NULL | 485 | * add to the path list |
486 | * @codec: the HDA codec | ||
487 | * @from_nid: the NID where the path start from | ||
488 | * @to_nid: the NID where the path ends at | ||
489 | * @anchor_nid: the anchor indication, see snd_hda_parse_nid_path() | ||
490 | * | ||
491 | * If no valid path is found, returns NULL. | ||
442 | */ | 492 | */ |
443 | struct nid_path * | 493 | struct nid_path * |
444 | snd_hda_add_new_path(struct hda_codec *codec, hda_nid_t from_nid, | 494 | snd_hda_add_new_path(struct hda_codec *codec, hda_nid_t from_nid, |
@@ -724,8 +774,14 @@ static void activate_amp_in(struct hda_codec *codec, struct nid_path *path, | |||
724 | } | 774 | } |
725 | } | 775 | } |
726 | 776 | ||
727 | /* activate or deactivate the given path | 777 | /** |
728 | * if @add_aamix is set, enable the input from aa-mix NID as well (if any) | 778 | * snd_hda_activate_path - activate or deactivate the given path |
779 | * @codec: the HDA codec | ||
780 | * @path: the path to activate/deactivate | ||
781 | * @enable: flag to activate or not | ||
782 | * @add_aamix: enable the input from aamix NID | ||
783 | * | ||
784 | * If @add_aamix is set, enable the input from aa-mix NID as well (if any). | ||
729 | */ | 785 | */ |
730 | void snd_hda_activate_path(struct hda_codec *codec, struct nid_path *path, | 786 | void snd_hda_activate_path(struct hda_codec *codec, struct nid_path *path, |
731 | bool enable, bool add_aamix) | 787 | bool enable, bool add_aamix) |
@@ -3883,7 +3939,12 @@ static void do_automute(struct hda_codec *codec, int num_pins, hda_nid_t *pins, | |||
3883 | } | 3939 | } |
3884 | } | 3940 | } |
3885 | 3941 | ||
3886 | /* Toggle outputs muting */ | 3942 | /** |
3943 | * snd_hda_gen_update_outputs - Toggle outputs muting | ||
3944 | * @codec: the HDA codec | ||
3945 | * | ||
3946 | * Update the mute status of all outputs based on the current jack states. | ||
3947 | */ | ||
3887 | void snd_hda_gen_update_outputs(struct hda_codec *codec) | 3948 | void snd_hda_gen_update_outputs(struct hda_codec *codec) |
3888 | { | 3949 | { |
3889 | struct hda_gen_spec *spec = codec->spec; | 3950 | struct hda_gen_spec *spec = codec->spec; |
@@ -3944,7 +4005,11 @@ static void call_update_outputs(struct hda_codec *codec) | |||
3944 | snd_ctl_sync_vmaster(spec->vmaster_mute.sw_kctl, false); | 4005 | snd_ctl_sync_vmaster(spec->vmaster_mute.sw_kctl, false); |
3945 | } | 4006 | } |
3946 | 4007 | ||
3947 | /* standard HP-automute helper */ | 4008 | /** |
4009 | * snd_hda_gen_hp_automute - standard HP-automute helper | ||
4010 | * @codec: the HDA codec | ||
4011 | * @jack: jack object, NULL for the whole | ||
4012 | */ | ||
3948 | void snd_hda_gen_hp_automute(struct hda_codec *codec, | 4013 | void snd_hda_gen_hp_automute(struct hda_codec *codec, |
3949 | struct hda_jack_callback *jack) | 4014 | struct hda_jack_callback *jack) |
3950 | { | 4015 | { |
@@ -3965,7 +4030,11 @@ void snd_hda_gen_hp_automute(struct hda_codec *codec, | |||
3965 | } | 4030 | } |
3966 | EXPORT_SYMBOL_GPL(snd_hda_gen_hp_automute); | 4031 | EXPORT_SYMBOL_GPL(snd_hda_gen_hp_automute); |
3967 | 4032 | ||
3968 | /* standard line-out-automute helper */ | 4033 | /** |
4034 | * snd_hda_gen_line_automute - standard line-out-automute helper | ||
4035 | * @codec: the HDA codec | ||
4036 | * @jack: jack object, NULL for the whole | ||
4037 | */ | ||
3969 | void snd_hda_gen_line_automute(struct hda_codec *codec, | 4038 | void snd_hda_gen_line_automute(struct hda_codec *codec, |
3970 | struct hda_jack_callback *jack) | 4039 | struct hda_jack_callback *jack) |
3971 | { | 4040 | { |
@@ -3986,7 +4055,11 @@ void snd_hda_gen_line_automute(struct hda_codec *codec, | |||
3986 | } | 4055 | } |
3987 | EXPORT_SYMBOL_GPL(snd_hda_gen_line_automute); | 4056 | EXPORT_SYMBOL_GPL(snd_hda_gen_line_automute); |
3988 | 4057 | ||
3989 | /* standard mic auto-switch helper */ | 4058 | /** |
4059 | * snd_hda_gen_mic_autoswitch - standard mic auto-switch helper | ||
4060 | * @codec: the HDA codec | ||
4061 | * @jack: jack object, NULL for the whole | ||
4062 | */ | ||
3990 | void snd_hda_gen_mic_autoswitch(struct hda_codec *codec, | 4063 | void snd_hda_gen_mic_autoswitch(struct hda_codec *codec, |
3991 | struct hda_jack_callback *jack) | 4064 | struct hda_jack_callback *jack) |
3992 | { | 4065 | { |
@@ -4318,7 +4391,13 @@ static int check_auto_mic_availability(struct hda_codec *codec) | |||
4318 | return 0; | 4391 | return 0; |
4319 | } | 4392 | } |
4320 | 4393 | ||
4321 | /* power_filter hook; make inactive widgets into power down */ | 4394 | /** |
4395 | * snd_hda_gen_path_power_filter - power_filter hook to make inactive widgets | ||
4396 | * into power down | ||
4397 | * @codec: the HDA codec | ||
4398 | * @nid: NID to evalute | ||
4399 | * @power_state: target power state | ||
4400 | */ | ||
4322 | unsigned int snd_hda_gen_path_power_filter(struct hda_codec *codec, | 4401 | unsigned int snd_hda_gen_path_power_filter(struct hda_codec *codec, |
4323 | hda_nid_t nid, | 4402 | hda_nid_t nid, |
4324 | unsigned int power_state) | 4403 | unsigned int power_state) |
@@ -4354,8 +4433,11 @@ static void mute_all_mixer_nid(struct hda_codec *codec, hda_nid_t mix) | |||
4354 | } | 4433 | } |
4355 | } | 4434 | } |
4356 | 4435 | ||
4357 | /* | 4436 | /** |
4358 | * Parse the given BIOS configuration and set up the hda_gen_spec | 4437 | * snd_hda_gen_parse_auto_config - Parse the given BIOS configuration and |
4438 | * set up the hda_gen_spec | ||
4439 | * @codec: the HDA codec | ||
4440 | * @cfg: Parsed pin configuration | ||
4359 | * | 4441 | * |
4360 | * return 1 if successful, 0 if the proper config is not found, | 4442 | * return 1 if successful, 0 if the proper config is not found, |
4361 | * or a negative error code | 4443 | * or a negative error code |
@@ -4541,6 +4623,12 @@ static const char * const slave_pfxs[] = { | |||
4541 | NULL, | 4623 | NULL, |
4542 | }; | 4624 | }; |
4543 | 4625 | ||
4626 | /** | ||
4627 | * snd_hda_gen_build_controls - Build controls from the parsed results | ||
4628 | * @codec: the HDA codec | ||
4629 | * | ||
4630 | * Pass this to build_controls patch_ops. | ||
4631 | */ | ||
4544 | int snd_hda_gen_build_controls(struct hda_codec *codec) | 4632 | int snd_hda_gen_build_controls(struct hda_codec *codec) |
4545 | { | 4633 | { |
4546 | struct hda_gen_spec *spec = codec->spec; | 4634 | struct hda_gen_spec *spec = codec->spec; |
@@ -5018,7 +5106,12 @@ static void fill_pcm_stream_name(char *str, size_t len, const char *sfx, | |||
5018 | strlcat(str, sfx, len); | 5106 | strlcat(str, sfx, len); |
5019 | } | 5107 | } |
5020 | 5108 | ||
5021 | /* build PCM streams based on the parsed results */ | 5109 | /** |
5110 | * snd_hda_gen_build_pcms - build PCM streams based on the parsed results | ||
5111 | * @codec: the HDA codec | ||
5112 | * | ||
5113 | * Pass this to build_pcms patch_ops. | ||
5114 | */ | ||
5022 | int snd_hda_gen_build_pcms(struct hda_codec *codec) | 5115 | int snd_hda_gen_build_pcms(struct hda_codec *codec) |
5023 | { | 5116 | { |
5024 | struct hda_gen_spec *spec = codec->spec; | 5117 | struct hda_gen_spec *spec = codec->spec; |
@@ -5313,9 +5406,11 @@ static void clear_unsol_on_unused_pins(struct hda_codec *codec) | |||
5313 | } | 5406 | } |
5314 | } | 5407 | } |
5315 | 5408 | ||
5316 | /* | 5409 | /** |
5317 | * initialize the generic spec; | 5410 | * snd_hda_gen_init - initialize the generic spec |
5318 | * this can be put as patch_ops.init function | 5411 | * @codec: the HDA codec |
5412 | * | ||
5413 | * This can be put as patch_ops init function. | ||
5319 | */ | 5414 | */ |
5320 | int snd_hda_gen_init(struct hda_codec *codec) | 5415 | int snd_hda_gen_init(struct hda_codec *codec) |
5321 | { | 5416 | { |
@@ -5351,9 +5446,11 @@ int snd_hda_gen_init(struct hda_codec *codec) | |||
5351 | } | 5446 | } |
5352 | EXPORT_SYMBOL_GPL(snd_hda_gen_init); | 5447 | EXPORT_SYMBOL_GPL(snd_hda_gen_init); |
5353 | 5448 | ||
5354 | /* | 5449 | /** |
5355 | * free the generic spec; | 5450 | * snd_hda_gen_free - free the generic spec |
5356 | * this can be put as patch_ops.free function | 5451 | * @codec: the HDA codec |
5452 | * | ||
5453 | * This can be put as patch_ops free function. | ||
5357 | */ | 5454 | */ |
5358 | void snd_hda_gen_free(struct hda_codec *codec) | 5455 | void snd_hda_gen_free(struct hda_codec *codec) |
5359 | { | 5456 | { |
@@ -5365,9 +5462,12 @@ void snd_hda_gen_free(struct hda_codec *codec) | |||
5365 | EXPORT_SYMBOL_GPL(snd_hda_gen_free); | 5462 | EXPORT_SYMBOL_GPL(snd_hda_gen_free); |
5366 | 5463 | ||
5367 | #ifdef CONFIG_PM | 5464 | #ifdef CONFIG_PM |
5368 | /* | 5465 | /** |
5369 | * check the loopback power save state; | 5466 | * snd_hda_gen_check_power_status - check the loopback power save state |
5370 | * this can be put as patch_ops.check_power_status function | 5467 | * @codec: the HDA codec |
5468 | * @nid: NID to inspect | ||
5469 | * | ||
5470 | * This can be put as patch_ops check_power_status function. | ||
5371 | */ | 5471 | */ |
5372 | int snd_hda_gen_check_power_status(struct hda_codec *codec, hda_nid_t nid) | 5472 | int snd_hda_gen_check_power_status(struct hda_codec *codec, hda_nid_t nid) |
5373 | { | 5473 | { |
@@ -5393,6 +5493,12 @@ static const struct hda_codec_ops generic_patch_ops = { | |||
5393 | #endif | 5493 | #endif |
5394 | }; | 5494 | }; |
5395 | 5495 | ||
5496 | /** | ||
5497 | * snd_hda_parse_generic_codec - Generic codec parser | ||
5498 | * @codec: the HDA codec | ||
5499 | * | ||
5500 | * This should be called from the HDA codec core. | ||
5501 | */ | ||
5396 | int snd_hda_parse_generic_codec(struct hda_codec *codec) | 5502 | int snd_hda_parse_generic_codec(struct hda_codec *codec) |
5397 | { | 5503 | { |
5398 | struct hda_gen_spec *spec; | 5504 | struct hda_gen_spec *spec; |