aboutsummaryrefslogtreecommitdiffstats
path: root/sound/usb/mixer.h
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2014-11-18 05:47:04 -0500
committerTakashi Iwai <tiwai@suse.de>2014-11-21 05:56:58 -0500
commit3360b84b8ed1f08bfb39743465b858a04492fcc3 (patch)
treefc05e8cf624adf9cd9e25fdca04793c830ff9365 /sound/usb/mixer.h
parent5aeee3424fa5926a53885b9defb593971e446d77 (diff)
ALSA: usb-audio: Allow quirks to handle own resume and proc dump
So far, we blindly assumed that the all usb-audio mixer elements follow the standard and apply the standard resume method for the registered elements in the id_elems[] list. However, some quirks really need the own resume and it's incomplete for now. This patch enhances the resume handling in two folds: - split some fields in struct usb_mixer_elem_info into a smaller header struct (usb_mixer_elem_list) for keeping the minimal information in the linked-list; the usb_mixer_elem_info embeds this header struct instead - add resume and dump callbacks to usb_mixer_elem_list struct to allow quirks providing the own methods For the standard mixer elements, these new callbacks are set to the standard ones as default, thus there is no functional change by this patch yet. The dump and resume callbacks are typedef'ed for ease of later patches using arrays of such function pointers. Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/usb/mixer.h')
-rw-r--r--sound/usb/mixer.h26
1 files changed, 21 insertions, 5 deletions
diff --git a/sound/usb/mixer.h b/sound/usb/mixer.h
index 2478a844a322..0fe87b7c7f00 100644
--- a/sound/usb/mixer.h
+++ b/sound/usb/mixer.h
@@ -1,6 +1,8 @@
1#ifndef __USBMIXER_H 1#ifndef __USBMIXER_H
2#define __USBMIXER_H 2#define __USBMIXER_H
3 3
4#include <sound/info.h>
5
4struct usb_mixer_interface { 6struct usb_mixer_interface {
5 struct snd_usb_audio *chip; 7 struct snd_usb_audio *chip;
6 struct usb_host_interface *hostif; 8 struct usb_host_interface *hostif;
@@ -8,7 +10,7 @@ struct usb_mixer_interface {
8 unsigned int ignore_ctl_error; 10 unsigned int ignore_ctl_error;
9 struct urb *urb; 11 struct urb *urb;
10 /* array[MAX_ID_ELEMS], indexed by unit id */ 12 /* array[MAX_ID_ELEMS], indexed by unit id */
11 struct usb_mixer_elem_info **id_elems; 13 struct usb_mixer_elem_list **id_elems;
12 14
13 /* the usb audio specification version this interface complies to */ 15 /* the usb audio specification version this interface complies to */
14 int protocol; 16 int protocol;
@@ -36,11 +38,21 @@ enum {
36 USB_MIXER_U16, 38 USB_MIXER_U16,
37}; 39};
38 40
39struct usb_mixer_elem_info { 41typedef void (*usb_mixer_elem_dump_func_t)(struct snd_info_buffer *buffer,
42 struct usb_mixer_elem_list *list);
43typedef int (*usb_mixer_elem_resume_func_t)(struct usb_mixer_elem_list *elem);
44
45struct usb_mixer_elem_list {
40 struct usb_mixer_interface *mixer; 46 struct usb_mixer_interface *mixer;
41 struct usb_mixer_elem_info *next_id_elem; /* list of controls with same id */ 47 struct usb_mixer_elem_list *next_id_elem; /* list of controls with same id */
42 struct snd_ctl_elem_id *elem_id; 48 struct snd_kcontrol *kctl;
43 unsigned int id; 49 unsigned int id;
50 usb_mixer_elem_dump_func_t dump;
51 usb_mixer_elem_resume_func_t resume;
52};
53
54struct usb_mixer_elem_info {
55 struct usb_mixer_elem_list head;
44 unsigned int control; /* CS or ICN (high byte) */ 56 unsigned int control; /* CS or ICN (high byte) */
45 unsigned int cmask; /* channel mask bitmap: 0 = master */ 57 unsigned int cmask; /* channel mask bitmap: 0 = master */
46 unsigned int idx_off; /* Control index offset */ 58 unsigned int idx_off; /* Control index offset */
@@ -65,9 +77,13 @@ void snd_usb_mixer_notify_id(struct usb_mixer_interface *mixer, int unitid);
65int snd_usb_mixer_set_ctl_value(struct usb_mixer_elem_info *cval, 77int snd_usb_mixer_set_ctl_value(struct usb_mixer_elem_info *cval,
66 int request, int validx, int value_set); 78 int request, int validx, int value_set);
67 79
68int snd_usb_mixer_add_control(struct usb_mixer_interface *mixer, 80int snd_usb_mixer_add_control(struct usb_mixer_elem_list *list,
69 struct snd_kcontrol *kctl); 81 struct snd_kcontrol *kctl);
70 82
83void snd_usb_mixer_elem_init_std(struct usb_mixer_elem_list *list,
84 struct usb_mixer_interface *mixer,
85 int unitid);
86
71int snd_usb_mixer_vol_tlv(struct snd_kcontrol *kcontrol, int op_flag, 87int snd_usb_mixer_vol_tlv(struct snd_kcontrol *kcontrol, int op_flag,
72 unsigned int size, unsigned int __user *_tlv); 88 unsigned int size, unsigned int __user *_tlv);
73 89