mixer_s1810c.c 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595
  1. // SPDX-License-Identifier: GPL-2.0
  2. /*
  3. * Presonus Studio 1810c driver for ALSA
  4. * Copyright (C) 2019 Nick Kossifidis <[email protected]>
  5. *
  6. * Based on reverse engineering of the communication protocol
  7. * between the windows driver / Univeral Control (UC) program
  8. * and the device, through usbmon.
  9. *
  10. * For now this bypasses the mixer, with all channels split,
  11. * so that the software can mix with greater flexibility.
  12. * It also adds controls for the 4 buttons on the front of
  13. * the device.
  14. */
  15. #include <linux/usb.h>
  16. #include <linux/usb/audio-v2.h>
  17. #include <linux/slab.h>
  18. #include <sound/core.h>
  19. #include <sound/control.h>
  20. #include "usbaudio.h"
  21. #include "mixer.h"
  22. #include "mixer_quirks.h"
  23. #include "helper.h"
  24. #include "mixer_s1810c.h"
  25. #define SC1810C_CMD_REQ 160
  26. #define SC1810C_CMD_REQTYPE \
  27. (USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_OUT)
  28. #define SC1810C_CMD_F1 0x50617269
  29. #define SC1810C_CMD_F2 0x14
  30. /*
  31. * DISCLAIMER: These are just guesses based on the
  32. * dumps I got.
  33. *
  34. * It seems like a selects between
  35. * device (0), mixer (0x64) and output (0x65)
  36. *
  37. * For mixer (0x64):
  38. * * b selects an input channel (see below).
  39. * * c selects an output channel pair (see below).
  40. * * d selects left (0) or right (1) of that pair.
  41. * * e 0-> disconnect, 0x01000000-> connect,
  42. * 0x0109-> used for stereo-linking channels,
  43. * e is also used for setting volume levels
  44. * in which case b is also set so I guess
  45. * this way it is possible to set the volume
  46. * level from the specified input to the
  47. * specified output.
  48. *
  49. * IN Channels:
  50. * 0 - 7 Mic/Inst/Line (Analog inputs)
  51. * 8 - 9 S/PDIF
  52. * 10 - 17 ADAT
  53. * 18 - 35 DAW (Inputs from the host)
  54. *
  55. * OUT Channels (pairs):
  56. * 0 -> Main out
  57. * 1 -> Line1/2
  58. * 2 -> Line3/4
  59. * 3 -> S/PDIF
  60. * 4 -> ADAT?
  61. *
  62. * For device (0):
  63. * * b and c are not used, at least not on the
  64. * dumps I got.
  65. * * d sets the control id to be modified
  66. * (see below).
  67. * * e sets the setting for that control.
  68. * (so for the switches I was interested
  69. * in it's 0/1)
  70. *
  71. * For output (0x65):
  72. * * b is the output channel (see above).
  73. * * c is zero.
  74. * * e I guess the same as with mixer except 0x0109
  75. * which I didn't see in my dumps.
  76. *
  77. * The two fixed fields have the same values for
  78. * mixer and output but a different set for device.
  79. */
  80. struct s1810c_ctl_packet {
  81. u32 a;
  82. u32 b;
  83. u32 fixed1;
  84. u32 fixed2;
  85. u32 c;
  86. u32 d;
  87. u32 e;
  88. };
  89. #define SC1810C_CTL_LINE_SW 0
  90. #define SC1810C_CTL_MUTE_SW 1
  91. #define SC1810C_CTL_AB_SW 3
  92. #define SC1810C_CTL_48V_SW 4
  93. #define SC1810C_SET_STATE_REQ 161
  94. #define SC1810C_SET_STATE_REQTYPE SC1810C_CMD_REQTYPE
  95. #define SC1810C_SET_STATE_F1 0x64656D73
  96. #define SC1810C_SET_STATE_F2 0xF4
  97. #define SC1810C_GET_STATE_REQ 162
  98. #define SC1810C_GET_STATE_REQTYPE \
  99. (USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_IN)
  100. #define SC1810C_GET_STATE_F1 SC1810C_SET_STATE_F1
  101. #define SC1810C_GET_STATE_F2 SC1810C_SET_STATE_F2
  102. #define SC1810C_STATE_F1_IDX 2
  103. #define SC1810C_STATE_F2_IDX 3
  104. /*
  105. * This packet includes mixer volumes and
  106. * various other fields, it's an extended
  107. * version of ctl_packet, with a and b
  108. * being zero and different f1/f2.
  109. */
  110. struct s1810c_state_packet {
  111. u32 fields[63];
  112. };
  113. #define SC1810C_STATE_48V_SW 58
  114. #define SC1810C_STATE_LINE_SW 59
  115. #define SC1810C_STATE_MUTE_SW 60
  116. #define SC1810C_STATE_AB_SW 62
  117. struct s1810_mixer_state {
  118. uint16_t seqnum;
  119. struct mutex usb_mutex;
  120. struct mutex data_mutex;
  121. };
  122. static int
  123. snd_s1810c_send_ctl_packet(struct usb_device *dev, u32 a,
  124. u32 b, u32 c, u32 d, u32 e)
  125. {
  126. struct s1810c_ctl_packet pkt = { 0 };
  127. int ret = 0;
  128. pkt.fixed1 = SC1810C_CMD_F1;
  129. pkt.fixed2 = SC1810C_CMD_F2;
  130. pkt.a = a;
  131. pkt.b = b;
  132. pkt.c = c;
  133. pkt.d = d;
  134. /*
  135. * Value for settings 0/1 for this
  136. * output channel is always 0 (probably because
  137. * there is no ADAT output on 1810c)
  138. */
  139. pkt.e = (c == 4) ? 0 : e;
  140. ret = snd_usb_ctl_msg(dev, usb_sndctrlpipe(dev, 0),
  141. SC1810C_CMD_REQ,
  142. SC1810C_CMD_REQTYPE, 0, 0, &pkt, sizeof(pkt));
  143. if (ret < 0) {
  144. dev_warn(&dev->dev, "could not send ctl packet\n");
  145. return ret;
  146. }
  147. return 0;
  148. }
  149. /*
  150. * When opening Universal Control the program periodically
  151. * sends and receives state packets for syncinc state between
  152. * the device and the host.
  153. *
  154. * Note that if we send only the request to get data back we'll
  155. * get an error, we need to first send an empty state packet and
  156. * then ask to receive a filled. Their seqnumbers must also match.
  157. */
  158. static int
  159. snd_sc1810c_get_status_field(struct usb_device *dev,
  160. u32 *field, int field_idx, uint16_t *seqnum)
  161. {
  162. struct s1810c_state_packet pkt_out = { { 0 } };
  163. struct s1810c_state_packet pkt_in = { { 0 } };
  164. int ret = 0;
  165. pkt_out.fields[SC1810C_STATE_F1_IDX] = SC1810C_SET_STATE_F1;
  166. pkt_out.fields[SC1810C_STATE_F2_IDX] = SC1810C_SET_STATE_F2;
  167. ret = snd_usb_ctl_msg(dev, usb_rcvctrlpipe(dev, 0),
  168. SC1810C_SET_STATE_REQ,
  169. SC1810C_SET_STATE_REQTYPE,
  170. (*seqnum), 0, &pkt_out, sizeof(pkt_out));
  171. if (ret < 0) {
  172. dev_warn(&dev->dev, "could not send state packet (%d)\n", ret);
  173. return ret;
  174. }
  175. ret = snd_usb_ctl_msg(dev, usb_rcvctrlpipe(dev, 0),
  176. SC1810C_GET_STATE_REQ,
  177. SC1810C_GET_STATE_REQTYPE,
  178. (*seqnum), 0, &pkt_in, sizeof(pkt_in));
  179. if (ret < 0) {
  180. dev_warn(&dev->dev, "could not get state field %u (%d)\n",
  181. field_idx, ret);
  182. return ret;
  183. }
  184. (*field) = pkt_in.fields[field_idx];
  185. (*seqnum)++;
  186. return 0;
  187. }
  188. /*
  189. * This is what I got when bypassing the mixer with
  190. * all channels split. I'm not 100% sure of what's going
  191. * on, I could probably clean this up based on my observations
  192. * but I prefer to keep the same behavior as the windows driver.
  193. */
  194. static int snd_s1810c_init_mixer_maps(struct snd_usb_audio *chip)
  195. {
  196. u32 a, b, c, e, n, off;
  197. struct usb_device *dev = chip->dev;
  198. /* Set initial volume levels ? */
  199. a = 0x64;
  200. e = 0xbc;
  201. for (n = 0; n < 2; n++) {
  202. off = n * 18;
  203. for (b = off; b < 18 + off; b++) {
  204. /* This channel to all outputs ? */
  205. for (c = 0; c <= 8; c++) {
  206. snd_s1810c_send_ctl_packet(dev, a, b, c, 0, e);
  207. snd_s1810c_send_ctl_packet(dev, a, b, c, 1, e);
  208. }
  209. /* This channel to main output (again) */
  210. snd_s1810c_send_ctl_packet(dev, a, b, 0, 0, e);
  211. snd_s1810c_send_ctl_packet(dev, a, b, 0, 1, e);
  212. }
  213. /*
  214. * I noticed on UC that DAW channels have different
  215. * initial volumes, so this makes sense.
  216. */
  217. e = 0xb53bf0;
  218. }
  219. /* Connect analog outputs ? */
  220. a = 0x65;
  221. e = 0x01000000;
  222. for (b = 1; b < 3; b++) {
  223. snd_s1810c_send_ctl_packet(dev, a, b, 0, 0, e);
  224. snd_s1810c_send_ctl_packet(dev, a, b, 0, 1, e);
  225. }
  226. snd_s1810c_send_ctl_packet(dev, a, 0, 0, 0, e);
  227. snd_s1810c_send_ctl_packet(dev, a, 0, 0, 1, e);
  228. /* Set initial volume levels for S/PDIF mappings ? */
  229. a = 0x64;
  230. e = 0xbc;
  231. c = 3;
  232. for (n = 0; n < 2; n++) {
  233. off = n * 18;
  234. for (b = off; b < 18 + off; b++) {
  235. snd_s1810c_send_ctl_packet(dev, a, b, c, 0, e);
  236. snd_s1810c_send_ctl_packet(dev, a, b, c, 1, e);
  237. }
  238. e = 0xb53bf0;
  239. }
  240. /* Connect S/PDIF output ? */
  241. a = 0x65;
  242. e = 0x01000000;
  243. snd_s1810c_send_ctl_packet(dev, a, 3, 0, 0, e);
  244. snd_s1810c_send_ctl_packet(dev, a, 3, 0, 1, e);
  245. /* Connect all outputs (again) ? */
  246. a = 0x65;
  247. e = 0x01000000;
  248. for (b = 0; b < 4; b++) {
  249. snd_s1810c_send_ctl_packet(dev, a, b, 0, 0, e);
  250. snd_s1810c_send_ctl_packet(dev, a, b, 0, 1, e);
  251. }
  252. /* Basic routing to get sound out of the device */
  253. a = 0x64;
  254. e = 0x01000000;
  255. for (c = 0; c < 4; c++) {
  256. for (b = 0; b < 36; b++) {
  257. if ((c == 0 && b == 18) || /* DAW1/2 -> Main */
  258. (c == 1 && b == 20) || /* DAW3/4 -> Line3/4 */
  259. (c == 2 && b == 22) || /* DAW4/5 -> Line5/6 */
  260. (c == 3 && b == 24)) { /* DAW5/6 -> S/PDIF */
  261. /* Left */
  262. snd_s1810c_send_ctl_packet(dev, a, b, c, 0, e);
  263. snd_s1810c_send_ctl_packet(dev, a, b, c, 1, 0);
  264. b++;
  265. /* Right */
  266. snd_s1810c_send_ctl_packet(dev, a, b, c, 0, 0);
  267. snd_s1810c_send_ctl_packet(dev, a, b, c, 1, e);
  268. } else {
  269. /* Leave the rest disconnected */
  270. snd_s1810c_send_ctl_packet(dev, a, b, c, 0, 0);
  271. snd_s1810c_send_ctl_packet(dev, a, b, c, 1, 0);
  272. }
  273. }
  274. }
  275. /* Set initial volume levels for S/PDIF (again) ? */
  276. a = 0x64;
  277. e = 0xbc;
  278. c = 3;
  279. for (n = 0; n < 2; n++) {
  280. off = n * 18;
  281. for (b = off; b < 18 + off; b++) {
  282. snd_s1810c_send_ctl_packet(dev, a, b, c, 0, e);
  283. snd_s1810c_send_ctl_packet(dev, a, b, c, 1, e);
  284. }
  285. e = 0xb53bf0;
  286. }
  287. /* Connect S/PDIF outputs (again) ? */
  288. a = 0x65;
  289. e = 0x01000000;
  290. snd_s1810c_send_ctl_packet(dev, a, 3, 0, 0, e);
  291. snd_s1810c_send_ctl_packet(dev, a, 3, 0, 1, e);
  292. /* Again ? */
  293. snd_s1810c_send_ctl_packet(dev, a, 3, 0, 0, e);
  294. snd_s1810c_send_ctl_packet(dev, a, 3, 0, 1, e);
  295. return 0;
  296. }
  297. /*
  298. * Sync state with the device and retrieve the requested field,
  299. * whose index is specified in (kctl->private_value & 0xFF),
  300. * from the received fields array.
  301. */
  302. static int
  303. snd_s1810c_get_switch_state(struct usb_mixer_interface *mixer,
  304. struct snd_kcontrol *kctl, u32 *state)
  305. {
  306. struct snd_usb_audio *chip = mixer->chip;
  307. struct s1810_mixer_state *private = mixer->private_data;
  308. u32 field = 0;
  309. u32 ctl_idx = (u32) (kctl->private_value & 0xFF);
  310. int ret = 0;
  311. mutex_lock(&private->usb_mutex);
  312. ret = snd_sc1810c_get_status_field(chip->dev, &field,
  313. ctl_idx, &private->seqnum);
  314. if (ret < 0)
  315. goto unlock;
  316. *state = field;
  317. unlock:
  318. mutex_unlock(&private->usb_mutex);
  319. return ret ? ret : 0;
  320. }
  321. /*
  322. * Send a control packet to the device for the control id
  323. * specified in (kctl->private_value >> 8) with value
  324. * specified in (kctl->private_value >> 16).
  325. */
  326. static int
  327. snd_s1810c_set_switch_state(struct usb_mixer_interface *mixer,
  328. struct snd_kcontrol *kctl)
  329. {
  330. struct snd_usb_audio *chip = mixer->chip;
  331. struct s1810_mixer_state *private = mixer->private_data;
  332. u32 pval = (u32) kctl->private_value;
  333. u32 ctl_id = (pval >> 8) & 0xFF;
  334. u32 ctl_val = (pval >> 16) & 0x1;
  335. int ret = 0;
  336. mutex_lock(&private->usb_mutex);
  337. ret = snd_s1810c_send_ctl_packet(chip->dev, 0, 0, 0, ctl_id, ctl_val);
  338. mutex_unlock(&private->usb_mutex);
  339. return ret;
  340. }
  341. /* Generic get/set/init functions for switch controls */
  342. static int
  343. snd_s1810c_switch_get(struct snd_kcontrol *kctl,
  344. struct snd_ctl_elem_value *ctl_elem)
  345. {
  346. struct usb_mixer_elem_list *list = snd_kcontrol_chip(kctl);
  347. struct usb_mixer_interface *mixer = list->mixer;
  348. struct s1810_mixer_state *private = mixer->private_data;
  349. u32 pval = (u32) kctl->private_value;
  350. u32 ctl_idx = pval & 0xFF;
  351. u32 state = 0;
  352. int ret = 0;
  353. mutex_lock(&private->data_mutex);
  354. ret = snd_s1810c_get_switch_state(mixer, kctl, &state);
  355. if (ret < 0)
  356. goto unlock;
  357. switch (ctl_idx) {
  358. case SC1810C_STATE_LINE_SW:
  359. case SC1810C_STATE_AB_SW:
  360. ctl_elem->value.enumerated.item[0] = (int)state;
  361. break;
  362. default:
  363. ctl_elem->value.integer.value[0] = (long)state;
  364. }
  365. unlock:
  366. mutex_unlock(&private->data_mutex);
  367. return (ret < 0) ? ret : 0;
  368. }
  369. static int
  370. snd_s1810c_switch_set(struct snd_kcontrol *kctl,
  371. struct snd_ctl_elem_value *ctl_elem)
  372. {
  373. struct usb_mixer_elem_list *list = snd_kcontrol_chip(kctl);
  374. struct usb_mixer_interface *mixer = list->mixer;
  375. struct s1810_mixer_state *private = mixer->private_data;
  376. u32 pval = (u32) kctl->private_value;
  377. u32 ctl_idx = pval & 0xFF;
  378. u32 curval = 0;
  379. u32 newval = 0;
  380. int ret = 0;
  381. mutex_lock(&private->data_mutex);
  382. ret = snd_s1810c_get_switch_state(mixer, kctl, &curval);
  383. if (ret < 0)
  384. goto unlock;
  385. switch (ctl_idx) {
  386. case SC1810C_STATE_LINE_SW:
  387. case SC1810C_STATE_AB_SW:
  388. newval = (u32) ctl_elem->value.enumerated.item[0];
  389. break;
  390. default:
  391. newval = (u32) ctl_elem->value.integer.value[0];
  392. }
  393. if (curval == newval)
  394. goto unlock;
  395. kctl->private_value &= ~(0x1 << 16);
  396. kctl->private_value |= (unsigned int)(newval & 0x1) << 16;
  397. ret = snd_s1810c_set_switch_state(mixer, kctl);
  398. unlock:
  399. mutex_unlock(&private->data_mutex);
  400. return (ret < 0) ? 0 : 1;
  401. }
  402. static int
  403. snd_s1810c_switch_init(struct usb_mixer_interface *mixer,
  404. const struct snd_kcontrol_new *new_kctl)
  405. {
  406. struct snd_kcontrol *kctl;
  407. struct usb_mixer_elem_info *elem;
  408. elem = kzalloc(sizeof(struct usb_mixer_elem_info), GFP_KERNEL);
  409. if (!elem)
  410. return -ENOMEM;
  411. elem->head.mixer = mixer;
  412. elem->control = 0;
  413. elem->head.id = 0;
  414. elem->channels = 1;
  415. kctl = snd_ctl_new1(new_kctl, elem);
  416. if (!kctl) {
  417. kfree(elem);
  418. return -ENOMEM;
  419. }
  420. kctl->private_free = snd_usb_mixer_elem_free;
  421. return snd_usb_mixer_add_control(&elem->head, kctl);
  422. }
  423. static int
  424. snd_s1810c_line_sw_info(struct snd_kcontrol *kctl,
  425. struct snd_ctl_elem_info *uinfo)
  426. {
  427. static const char *const texts[2] = {
  428. "Preamp On (Mic/Inst)",
  429. "Preamp Off (Line in)"
  430. };
  431. return snd_ctl_enum_info(uinfo, 1, ARRAY_SIZE(texts), texts);
  432. }
  433. static const struct snd_kcontrol_new snd_s1810c_line_sw = {
  434. .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
  435. .name = "Line 1/2 Source Type",
  436. .info = snd_s1810c_line_sw_info,
  437. .get = snd_s1810c_switch_get,
  438. .put = snd_s1810c_switch_set,
  439. .private_value = (SC1810C_STATE_LINE_SW | SC1810C_CTL_LINE_SW << 8)
  440. };
  441. static const struct snd_kcontrol_new snd_s1810c_mute_sw = {
  442. .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
  443. .name = "Mute Main Out Switch",
  444. .info = snd_ctl_boolean_mono_info,
  445. .get = snd_s1810c_switch_get,
  446. .put = snd_s1810c_switch_set,
  447. .private_value = (SC1810C_STATE_MUTE_SW | SC1810C_CTL_MUTE_SW << 8)
  448. };
  449. static const struct snd_kcontrol_new snd_s1810c_48v_sw = {
  450. .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
  451. .name = "48V Phantom Power On Mic Inputs Switch",
  452. .info = snd_ctl_boolean_mono_info,
  453. .get = snd_s1810c_switch_get,
  454. .put = snd_s1810c_switch_set,
  455. .private_value = (SC1810C_STATE_48V_SW | SC1810C_CTL_48V_SW << 8)
  456. };
  457. static int
  458. snd_s1810c_ab_sw_info(struct snd_kcontrol *kctl,
  459. struct snd_ctl_elem_info *uinfo)
  460. {
  461. static const char *const texts[2] = {
  462. "1/2",
  463. "3/4"
  464. };
  465. return snd_ctl_enum_info(uinfo, 1, ARRAY_SIZE(texts), texts);
  466. }
  467. static const struct snd_kcontrol_new snd_s1810c_ab_sw = {
  468. .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
  469. .name = "Headphone 1 Source Route",
  470. .info = snd_s1810c_ab_sw_info,
  471. .get = snd_s1810c_switch_get,
  472. .put = snd_s1810c_switch_set,
  473. .private_value = (SC1810C_STATE_AB_SW | SC1810C_CTL_AB_SW << 8)
  474. };
  475. static void snd_sc1810_mixer_state_free(struct usb_mixer_interface *mixer)
  476. {
  477. struct s1810_mixer_state *private = mixer->private_data;
  478. kfree(private);
  479. mixer->private_data = NULL;
  480. }
  481. /* Entry point, called from mixer_quirks.c */
  482. int snd_sc1810_init_mixer(struct usb_mixer_interface *mixer)
  483. {
  484. struct s1810_mixer_state *private = NULL;
  485. struct snd_usb_audio *chip = mixer->chip;
  486. struct usb_device *dev = chip->dev;
  487. int ret = 0;
  488. /* Run this only once */
  489. if (!list_empty(&chip->mixer_list))
  490. return 0;
  491. dev_info(&dev->dev,
  492. "Presonus Studio 1810c, device_setup: %u\n", chip->setup);
  493. if (chip->setup == 1)
  494. dev_info(&dev->dev, "(8out/18in @ 48kHz)\n");
  495. else if (chip->setup == 2)
  496. dev_info(&dev->dev, "(6out/8in @ 192kHz)\n");
  497. else
  498. dev_info(&dev->dev, "(8out/14in @ 96kHz)\n");
  499. ret = snd_s1810c_init_mixer_maps(chip);
  500. if (ret < 0)
  501. return ret;
  502. private = kzalloc(sizeof(struct s1810_mixer_state), GFP_KERNEL);
  503. if (!private)
  504. return -ENOMEM;
  505. mutex_init(&private->usb_mutex);
  506. mutex_init(&private->data_mutex);
  507. mixer->private_data = private;
  508. mixer->private_free = snd_sc1810_mixer_state_free;
  509. private->seqnum = 1;
  510. ret = snd_s1810c_switch_init(mixer, &snd_s1810c_line_sw);
  511. if (ret < 0)
  512. return ret;
  513. ret = snd_s1810c_switch_init(mixer, &snd_s1810c_mute_sw);
  514. if (ret < 0)
  515. return ret;
  516. ret = snd_s1810c_switch_init(mixer, &snd_s1810c_48v_sw);
  517. if (ret < 0)
  518. return ret;
  519. ret = snd_s1810c_switch_init(mixer, &snd_s1810c_ab_sw);
  520. if (ret < 0)
  521. return ret;
  522. return ret;
  523. }