Add mixer and control interface media entities
Subsystems (2)
cover Add mixer and control interface media entities
This patch series adds the following:
Add support for creating MEDIA_ENT_F_AUDIO_MIXER entity for each mixer and a MEDIA_INTF_T_ALSA_CONTROL control interface entity that links to mixer entities. MEDIA_INTF_T_ALSA_CONTROL entity corresponds to the control device for the card.
Change au0828_create_media_graph() to create pad link between MEDIA_ENT_F_AUDIO_MIXER entity and decoder's AU8522_PAD_AUDIO_OUT.
This patch series is dependent on an earlier patch series:
Update ALSA, and au0828 drivers to use Managed Media Controller API:
https://www.mail-archive.com/[email protected]/msg92752.html
Please find the media graph with mixer and control interface nodes:
https://drive.google.com/folderview?id=0B0NIL0BQg-Alb3JFb2diMXRoQlU&usp=sharing
New file:
graph_mixer.png
Shuah Khan (2):
sound/usb: Create media mixer function and control interface entities
media: au0828 create link between ALSA Mixer and decoder
drivers/media/usb/au0828/au0828-core.c | 12 +++++ drivers/media/usb/au0828/au0828.h | 1 + sound/usb/card.c | 5 ++ sound/usb/media.c | 85 ++++++++++++++++++++++++++++++++++ sound/usb/media.h | 4 ++ sound/usb/mixer.h | 1 + sound/usb/usbaudio.h | 1 + 7 files changed, 109 insertions(+)
Signature · 1 line
2.1.4
PATCH 1/2 sound/usb: Create media mixer function and control interface entities
Add support for creating MEDIA_ENT_F_AUDIO_MIXER entity for each mixer and a MEDIA_INTF_T_ALSA_CONTROL control interface entity that links to mixer entities. MEDIA_INTF_T_ALSA_CONTROL entity corresponds to the control device for the card.
--- sound/usb/card.c | 5 ++++ sound/usb/media.c | 85 ++++++++++++++++++++++++++++++++++++++++++++++++++++ sound/usb/media.h | 4 +++ sound/usb/mixer.h | 1 + sound/usb/usbaudio.h | 1 + 5 files changed, 96 insertions(+)
sound/usb/card.c +5 -0
@@ -560,6 +560,9 @@ static int usb_audio_probe(struct usb_interface *intf,if (err <0 ) goto __error; +/* Create media entities for mixer and control dev */ +media_mixer_init (chip); + usb_chip[chip->index] = chip; chip->num_interfaces++; chip->probing =0 ;
@@ -616,6 +619,8 @@ static void usb_audio_disconnect(struct usb_interface *intf)list_for_each (p, &chip->midi_list) {snd_usbmidi_disconnect (p); } +/* delete mixer media resources */ +media_mixer_delete (chip);/* release mixer resources */ list_for_each_entry (mixer, &chip->mixer_list, list) {snd_usb_mixer_disconnect (mixer);
sound/usb/media.c +85 -0
89 lines not on this page · raw message
sound/usb/media.h +4 -0
@@ -37,6 +37,8 @@ int media_stream_init(struct snd_usb_substream *subs, struct snd_pcm *pcm,void media_stream_delete (struct snd_usb_substream *subs);int media_start_pipeline (struct snd_usb_substream *subs);void media_stop_pipeline (struct snd_usb_substream *subs); +int media_mixer_init (struct snd_usb_audio *chip); +void media_mixer_delete (struct snd_usb_audio *chip);#else static inline int media_device_init (struct snd_usb_audio *chip,struct usb_interface *iface)
@@ -49,5 +51,7 @@ static inline void media_stream_delete(struct snd_usb_substream *subs) { }static inline int media_start_pipeline (struct snd_usb_substream *subs) {return 0 ; }static inline void media_stop_pipeline (struct snd_usb_substream *subs) { } +static int media_mixer_init (struct snd_usb_audio *chip) {return 0 ; } +static void media_mixer_delete (struct snd_usb_audio *chip) { }#endif #endif /* __MEDIA_H */
sound/usb/mixer.h +1 -0
@@ -22,6 +22,7 @@ struct usb_mixer_interface {struct urb *rc_urb;struct usb_ctrlrequest *rc_setup_packet;u8 rc_buffer[6 ]; +void *media_ctl; };#define MAX_CHANNELS 16/* max logical channels */
sound/usb/usbaudio.h +1 -0
@@ -59,6 +59,7 @@ struct snd_usb_audio {bool autoclock;/* from the 'autoclock' module param */ struct usb_host_interface *ctrl_intf;/* the audio control interface */ +void *ctl_intf_media_devnode; }; #define usb_audio_err(chip, fmt, args...) \
Signature · 1 line
2.1.4
PATCH 2/2 media: au0828 create link between ALSA Mixer and decoder
In reply to Shuah KhanChange au0828_create_media_graph() to create pad link between MEDIA_ENT_F_AUDIO_MIXER entity and decoder's AU8522_PAD_AUDIO_OUT.
--- drivers/media/usb/au0828/au0828-core.c | 12 ++++++++++++ drivers/media/usb/au0828/au0828.h | 1 + 2 files changed, 13 insertions(+)
drivers/media/usb/au0828/au0828-core.c +12 -0
@@ -225,6 +225,7 @@ void au0828_create_media_graph(struct media_entity *new, void *notify_data)struct media_entity *entity;struct media_entity *tuner =NULL , *decoder =NULL ;struct media_entity *audio_capture =NULL ; +struct media_entity *mixer =NULL ;int i, ret;if (!mdev)
@@ -245,6 +246,9 @@ void au0828_create_media_graph(struct media_entity *new, void *notify_data)case MEDIA_ENT_F_AUDIO_CAPTURE : audio_capture = entity;break ; +case MEDIA_ENT_F_AUDIO_MIXER : + mixer = entity; +break ; } }
@@ -316,6 +320,14 @@ void au0828_create_media_graph(struct media_entity *new, void *notify_data)if (ret ==0 ) dev->audio_capture_linked = 1; } + +if (mixer && !dev->mixer_linked) { + ret =media_create_pad_link (decoder,AU8522_PAD_AUDIO_OUT , + mixer,0 , +MEDIA_LNK_FL_ENABLED ); +if (ret ==0 ) + dev->mixer_linked =1 ; + }#endif }
drivers/media/usb/au0828/au0828.h +1 -0
@@ -288,6 +288,7 @@ struct au0828_dev {bool vdev_linked;bool vbi_linked;bool audio_capture_linked; +bool mixer_linked;struct media_link *active_link;struct media_entity *active_link_owner;#endif
Signature · 1 line
2.1.4