aboutsummaryrefslogtreecommitdiffstats
path: root/sound/usb/caiaq/caiaq-control.c
diff options
context:
space:
mode:
authorIngo Molnar <mingo@elte.hu>2009-04-06 03:02:57 -0400
committerIngo Molnar <mingo@elte.hu>2009-04-06 03:02:57 -0400
commitf541ae326fa120fa5c57433e4d9a133df212ce41 (patch)
treebdbd94ec72cfc601118051cb35e8617d55510177 /sound/usb/caiaq/caiaq-control.c
parente255357764f92afcafafbd4879b222b8c752065a (diff)
parent0221c81b1b8eb0cbb6b30a0ced52ead32d2b4e4c (diff)
Merge branch 'linus' into perfcounters/core-v2
Merge reason: we have gathered quite a few conflicts, need to merge upstream Conflicts: arch/powerpc/kernel/Makefile arch/x86/ia32/ia32entry.S arch/x86/include/asm/hardirq.h arch/x86/include/asm/unistd_32.h arch/x86/include/asm/unistd_64.h arch/x86/kernel/cpu/common.c arch/x86/kernel/irq.c arch/x86/kernel/syscall_table_32.S arch/x86/mm/iomap_32.c include/linux/sched.h kernel/Makefile Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'sound/usb/caiaq/caiaq-control.c')
-rw-r--r--sound/usb/caiaq/caiaq-control.c42
1 files changed, 38 insertions, 4 deletions
diff --git a/sound/usb/caiaq/caiaq-control.c b/sound/usb/caiaq/caiaq-control.c
index ccd763dd7167..e92c2bbf4fe9 100644
--- a/sound/usb/caiaq/caiaq-control.c
+++ b/sound/usb/caiaq/caiaq-control.c
@@ -39,12 +39,12 @@ static int control_info(struct snd_kcontrol *kcontrol,
39 struct snd_usb_caiaqdev *dev = caiaqdev(chip->card); 39 struct snd_usb_caiaqdev *dev = caiaqdev(chip->card);
40 int pos = kcontrol->private_value; 40 int pos = kcontrol->private_value;
41 int is_intval = pos & CNT_INTVAL; 41 int is_intval = pos & CNT_INTVAL;
42 unsigned int id = dev->chip.usb_id;
42 43
43 uinfo->count = 1; 44 uinfo->count = 1;
44 pos &= ~CNT_INTVAL; 45 pos &= ~CNT_INTVAL;
45 46
46 if (dev->chip.usb_id == 47 if (id == USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_AUDIO8DJ)
47 USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_AUDIO8DJ)
48 && (pos == 0)) { 48 && (pos == 0)) {
49 /* current input mode of A8DJ */ 49 /* current input mode of A8DJ */
50 uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; 50 uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER;
@@ -53,6 +53,15 @@ static int control_info(struct snd_kcontrol *kcontrol,
53 return 0; 53 return 0;
54 } 54 }
55 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
56 if (is_intval) { 65 if (is_intval) {
57 uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; 66 uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER;
58 uinfo->value.integer.min = 0; 67 uinfo->value.integer.min = 0;
@@ -73,6 +82,14 @@ static int control_get(struct snd_kcontrol *kcontrol,
73 struct snd_usb_caiaqdev *dev = caiaqdev(chip->card); 82 struct snd_usb_caiaqdev *dev = caiaqdev(chip->card);
74 int pos = kcontrol->private_value; 83 int pos = kcontrol->private_value;
75 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
76 if (pos & CNT_INTVAL) 93 if (pos & CNT_INTVAL)
77 ucontrol->value.integer.value[0] 94 ucontrol->value.integer.value[0]
78 = dev->control_state[pos & ~CNT_INTVAL]; 95 = dev->control_state[pos & ~CNT_INTVAL];
@@ -90,10 +107,20 @@ static int control_put(struct snd_kcontrol *kcontrol,
90 struct snd_usb_caiaqdev *dev = caiaqdev(chip->card); 107 struct snd_usb_caiaqdev *dev = caiaqdev(chip->card);
91 int pos = kcontrol->private_value; 108 int pos = kcontrol->private_value;
92 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
93 if (pos & CNT_INTVAL) { 120 if (pos & CNT_INTVAL) {
94 dev->control_state[pos & ~CNT_INTVAL] 121 dev->control_state[pos & ~CNT_INTVAL]
95 = ucontrol->value.integer.value[0]; 122 = ucontrol->value.integer.value[0];
96 snd_usb_caiaq_send_command(dev, EP1_CMD_DIMM_LEDS, 123 snd_usb_caiaq_send_command(dev, EP1_CMD_WRITE_IO,
97 dev->control_state, sizeof(dev->control_state)); 124 dev->control_state, sizeof(dev->control_state));
98 } else { 125 } else {
99 if (ucontrol->value.integer.value[0]) 126 if (ucontrol->value.integer.value[0])
@@ -243,10 +270,13 @@ static struct caiaq_controller a8dj_controller[] = {
243 { "GND lift for TC Vinyl mode", 24 + 0 }, 270 { "GND lift for TC Vinyl mode", 24 + 0 },
244 { "GND lift for TC CD/Line mode", 24 + 1 }, 271 { "GND lift for TC CD/Line mode", 24 + 1 },
245 { "GND lift for phono mode", 24 + 2 }, 272 { "GND lift for phono mode", 24 + 2 },
246 { "GND lift for TC Vinyl mode", 24 + 3 },
247 { "Software lock", 40 } 273 { "Software lock", 40 }
248}; 274};
249 275
276static struct caiaq_controller a4dj_controller[] = {
277 { "Current input mode", 0 | CNT_INTVAL }
278};
279
250static int __devinit add_controls(struct caiaq_controller *c, int num, 280static int __devinit add_controls(struct caiaq_controller *c, int num,
251 struct snd_usb_caiaqdev *dev) 281 struct snd_usb_caiaqdev *dev)
252{ 282{
@@ -295,6 +325,10 @@ int __devinit snd_usb_caiaq_control_init(struct snd_usb_caiaqdev *dev)
295 ret = add_controls(a8dj_controller, 325 ret = add_controls(a8dj_controller,
296 ARRAY_SIZE(a8dj_controller), dev); 326 ARRAY_SIZE(a8dj_controller), dev);
297 break; 327 break;
328 case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_AUDIO4DJ):
329 ret = add_controls(a4dj_controller,
330 ARRAY_SIZE(a4dj_controller), dev);
331 break;
298 } 332 }
299 333
300 return ret; 334 return ret;