aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--sound/usb/caiaq/caiaq-control.c32
1 files changed, 29 insertions, 3 deletions
diff --git a/sound/usb/caiaq/caiaq-control.c b/sound/usb/caiaq/caiaq-control.c
index 1f9531d0fce4..136ef34300d1 100644
--- a/sound/usb/caiaq/caiaq-control.c
+++ b/sound/usb/caiaq/caiaq-control.c
@@ -44,16 +44,24 @@ static int control_info(struct snd_kcontrol *kcontrol,
44 uinfo->count = 1; 44 uinfo->count = 1;
45 pos &= ~CNT_INTVAL; 45 pos &= ~CNT_INTVAL;
46 46
47 if (((id == USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_AUDIO8DJ)) || 47 if (id == USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_AUDIO8DJ)
48 (id == USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_AUDIO4DJ)))
49 && (pos == 0)) { 48 && (pos == 0)) {
50 /* current input mode of A8DJ and A4DJ */ 49 /* current input mode of A8DJ */
51 uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; 50 uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER;
52 uinfo->value.integer.min = 0; 51 uinfo->value.integer.min = 0;
53 uinfo->value.integer.max = 2; 52 uinfo->value.integer.max = 2;
54 return 0; 53 return 0;
55 } 54 }
56 55
56 if (id == USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_AUDIO4DJ)
57 && (pos == 0)) {
58 /* current input mode of A4DJ */
59 uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER;
60 uinfo->value.integer.min = 0;
61 uinfo->value.integer.max = 1;
62 return 0;
63 }
64
57 if (is_intval) { 65 if (is_intval) {
58 uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; 66 uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER;
59 uinfo->value.integer.min = 0; 67 uinfo->value.integer.min = 0;
@@ -74,6 +82,14 @@ static int control_get(struct snd_kcontrol *kcontrol,
74 struct snd_usb_caiaqdev *dev = caiaqdev(chip->card); 82 struct snd_usb_caiaqdev *dev = caiaqdev(chip->card);
75 int pos = kcontrol->private_value; 83 int pos = kcontrol->private_value;
76 84
85 if (dev->chip.usb_id ==
86 USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_AUDIO4DJ)) {
87 /* A4DJ has only one control */
88 /* do not expose hardware input mode 0 */
89 ucontrol->value.integer.value[0] = dev->control_state[0] - 1;
90 return 0;
91 }
92
77 if (pos & CNT_INTVAL) 93 if (pos & CNT_INTVAL)
78 ucontrol->value.integer.value[0] 94 ucontrol->value.integer.value[0]
79 = dev->control_state[pos & ~CNT_INTVAL]; 95 = dev->control_state[pos & ~CNT_INTVAL];
@@ -91,6 +107,16 @@ static int control_put(struct snd_kcontrol *kcontrol,
91 struct snd_usb_caiaqdev *dev = caiaqdev(chip->card); 107 struct snd_usb_caiaqdev *dev = caiaqdev(chip->card);
92 int pos = kcontrol->private_value; 108 int pos = kcontrol->private_value;
93 109
110 if (dev->chip.usb_id ==
111 USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_AUDIO4DJ)) {
112 /* A4DJ has only one control */
113 /* do not expose hardware input mode 0 */
114 dev->control_state[0] = ucontrol->value.integer.value[0] + 1;
115 snd_usb_caiaq_send_command(dev, EP1_CMD_WRITE_IO,
116 dev->control_state, sizeof(dev->control_state));
117 return 1;
118 }
119
94 if (pos & CNT_INTVAL) { 120 if (pos & CNT_INTVAL) {
95 dev->control_state[pos & ~CNT_INTVAL] 121 dev->control_state[pos & ~CNT_INTVAL]
96 = ucontrol->value.integer.value[0]; 122 = ucontrol->value.integer.value[0];