28 static char *opt_coax_texts[2] = {
"Optical",
"Coax" };
29 static char *line_phono_texts[2] = {
"Line",
"Phono" };
41 { 0x22, 0x00, 0x00 }, { 0x20, 0x00, 0x08 }, { 0x22, 0x01, 0x01 },
42 { 0x20, 0x01, 0x08 }, { 0x22, 0x02, 0x00 }, { 0x20, 0x02, 0x08 },
43 { 0x22, 0x03, 0x00 }, { 0x20, 0x03, 0x08 }, { 0x22, 0x04, 0x00 },
44 { 0x20, 0x04, 0x08 }, { 0x22, 0x05, 0x01 }, { 0x20, 0x05, 0x08 },
45 { 0x22, 0x04, 0x01 }, { 0x12, 0x04, 0x00 }, { 0x12, 0x05, 0x00 },
46 { 0x12, 0x0d, 0x38 }, { 0x12, 0x21, 0x82 }, { 0x12, 0x22, 0x80 },
47 { 0x12, 0x23, 0x00 }, { 0x12, 0x06, 0x02 }, { 0x12, 0x03, 0x00 },
48 { 0x12, 0x02, 0x00 }, { 0x22, 0x03, 0x01 },
52 static const int rates_altsetting[] = { 1, 1, 2, 2, 3, 3 };
54 static const u16 rates_6fire_vl[] = {0x00, 0x01, 0x00, 0x01, 0x00, 0x01};
55 static const u16 rates_6fire_vh[] = {0x11, 0x11, 0x10, 0x10, 0x00, 0x00};
64 static void usb6fire_control_output_vol_update(
struct control_runtime *rt)
70 for (i = 0; i < 6; i++)
72 comm_rt->
write8(comm_rt, 0x12, 0x0f + i,
78 static void usb6fire_control_output_mute_update(
struct control_runtime *rt)
86 static void usb6fire_control_input_vol_update(
struct control_runtime *rt)
92 for (i = 0; i < 2; i++)
94 comm_rt->
write8(comm_rt, 0x12, 0x1c + i,
100 static void usb6fire_control_line_phono_update(
struct control_runtime *rt)
109 static void usb6fire_control_opt_coax_update(
struct control_runtime *rt)
132 ret = comm_rt->
write16(comm_rt, 0x02, 0x01, rates_6fire_vl[rate],
133 rates_6fire_vh[rate]);
140 static int usb6fire_control_set_channels(
142 int n_analog_in,
bool spdif_out,
bool spdif_in)
149 ret = comm_rt->
write16(comm_rt, 0x02, 0x02,
150 (1 << (n_analog_out / 2)) - 1,
151 (1 << (n_analog_in / 2)) - 1);
157 ret = comm_rt->
write16(comm_rt, 0x02, 0x03, 0x00, 0x00);
164 static int usb6fire_control_streaming_update(
struct control_runtime *rt)
170 usb6fire_control_set_rate(rt,
172 return comm_rt->
write16(comm_rt, 0x02, 0x00, 0x00,
179 static int usb6fire_control_output_vol_info(
struct snd_kcontrol *kcontrol,
189 static int usb6fire_control_output_vol_put(
struct snd_kcontrol *kcontrol,
213 usb6fire_control_output_vol_update(rt);
218 static int usb6fire_control_output_vol_get(
struct snd_kcontrol *kcontrol,
234 static int usb6fire_control_output_mute_put(
struct snd_kcontrol *kcontrol,
248 if (ucontrol->
value.integer.value[0])
250 if (ucontrol->
value.integer.value[1])
255 usb6fire_control_output_mute_update(rt);
260 static int usb6fire_control_output_mute_get(
struct snd_kcontrol *kcontrol,
279 static int usb6fire_control_input_vol_info(
struct snd_kcontrol *kcontrol,
289 static int usb6fire_control_input_vol_put(
struct snd_kcontrol *kcontrol,
307 usb6fire_control_input_vol_update(rt);
312 static int usb6fire_control_input_vol_get(
struct snd_kcontrol *kcontrol,
323 static int usb6fire_control_line_phono_info(
struct snd_kcontrol *kcontrol,
336 static int usb6fire_control_line_phono_put(
struct snd_kcontrol *kcontrol,
343 usb6fire_control_line_phono_update(rt);
349 static int usb6fire_control_line_phono_get(
struct snd_kcontrol *kcontrol,
357 static int usb6fire_control_opt_coax_info(
struct snd_kcontrol *kcontrol,
370 static int usb6fire_control_opt_coax_put(
struct snd_kcontrol *kcontrol,
378 usb6fire_control_opt_coax_update(rt);
384 static int usb6fire_control_opt_coax_get(
struct snd_kcontrol *kcontrol,
392 static int usb6fire_control_digital_thru_put(
struct snd_kcontrol *kcontrol,
400 usb6fire_control_streaming_update(rt);
406 static int usb6fire_control_digital_thru_get(
struct snd_kcontrol *kcontrol,
417 .name =
"Analog Playback Volume",
422 .info = usb6fire_control_output_vol_info,
423 .get = usb6fire_control_output_vol_get,
424 .put = usb6fire_control_output_vol_put,
425 .tlv = { .p = tlv_output }
429 .name =
"Analog Playback Volume",
434 .info = usb6fire_control_output_vol_info,
435 .get = usb6fire_control_output_vol_get,
436 .put = usb6fire_control_output_vol_put,
437 .tlv = { .p = tlv_output }
441 .name =
"Analog Playback Volume",
446 .info = usb6fire_control_output_vol_info,
447 .get = usb6fire_control_output_vol_get,
448 .put = usb6fire_control_output_vol_put,
449 .tlv = { .p = tlv_output }
457 .name =
"Analog Playback Switch",
462 .get = usb6fire_control_output_mute_get,
463 .put = usb6fire_control_output_mute_put,
467 .name =
"Analog Playback Switch",
472 .get = usb6fire_control_output_mute_get,
473 .put = usb6fire_control_output_mute_put,
477 .name =
"Analog Playback Switch",
482 .get = usb6fire_control_output_mute_get,
483 .put = usb6fire_control_output_mute_put,
491 .name =
"Line/Phono Capture Route",
494 .info = usb6fire_control_line_phono_info,
495 .get = usb6fire_control_line_phono_get,
496 .put = usb6fire_control_line_phono_put
500 .name =
"Opt/Coax Capture Route",
503 .info = usb6fire_control_opt_coax_info,
504 .get = usb6fire_control_opt_coax_get,
505 .put = usb6fire_control_opt_coax_put
509 .name =
"Digital Thru Playback Route",
513 .get = usb6fire_control_digital_thru_get,
514 .put = usb6fire_control_digital_thru_put
518 .name =
"Analog Capture Volume",
522 .info = usb6fire_control_input_vol_info,
523 .get = usb6fire_control_input_vol_get,
524 .put = usb6fire_control_input_vol_put,
525 .tlv = { .p = tlv_input }
530 static int usb6fire_control_add_virtual(
549 while (elems[i].name) {
556 ret = snd_ctl_add_slave(vmaster, control);
577 rt->
set_rate = usb6fire_control_set_rate;
581 while (init_data[i].
type) {
582 comm_rt->
write8(comm_rt, init_data[i].type, init_data[i].
reg,
587 usb6fire_control_opt_coax_update(rt);
588 usb6fire_control_line_phono_update(rt);
589 usb6fire_control_output_vol_update(rt);
590 usb6fire_control_output_mute_update(rt);
591 usb6fire_control_input_vol_update(rt);
592 usb6fire_control_streaming_update(rt);
594 ret = usb6fire_control_add_virtual(rt, chip->
card,
595 "Master Playback Volume", vol_elements);
601 ret = usb6fire_control_add_virtual(rt, chip->
card,
602 "Master Playback Switch", mute_elements);
610 while (elements[i].name) {