pcxhr_mixer.c 30 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021
  1. #define __NO_VERSION__
  2. /*
  3. * Driver for Digigram pcxhr compatible soundcards
  4. *
  5. * mixer callbacks
  6. *
  7. * Copyright (c) 2004 by Digigram <alsa@digigram.com>
  8. *
  9. * This program is free software; you can redistribute it and/or modify
  10. * it under the terms of the GNU General Public License as published by
  11. * the Free Software Foundation; either version 2 of the License, or
  12. * (at your option) any later version.
  13. *
  14. * This program is distributed in the hope that it will be useful,
  15. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  17. * GNU General Public License for more details.
  18. *
  19. * You should have received a copy of the GNU General Public License
  20. * along with this program; if not, write to the Free Software
  21. * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  22. */
  23. #include <sound/driver.h>
  24. #include <linux/time.h>
  25. #include <linux/interrupt.h>
  26. #include <linux/init.h>
  27. #include <linux/mutex.h>
  28. #include <sound/core.h>
  29. #include "pcxhr.h"
  30. #include "pcxhr_hwdep.h"
  31. #include "pcxhr_core.h"
  32. #include <sound/control.h>
  33. #include <sound/asoundef.h>
  34. #include "pcxhr_mixer.h"
  35. #define PCXHR_ANALOG_CAPTURE_LEVEL_MIN 0 /* -96.0 dB */
  36. #define PCXHR_ANALOG_CAPTURE_LEVEL_MAX 255 /* +31.5 dB */
  37. #define PCXHR_ANALOG_CAPTURE_ZERO_LEVEL 224 /* +16.0 dB ( +31.5 dB - fix level +15.5 dB ) */
  38. #define PCXHR_ANALOG_PLAYBACK_LEVEL_MIN 0 /* -128.0 dB */
  39. #define PCXHR_ANALOG_PLAYBACK_LEVEL_MAX 128 /* 0.0 dB */
  40. #define PCXHR_ANALOG_PLAYBACK_ZERO_LEVEL 104 /* -24.0 dB ( 0.0 dB - fix level +24.0 dB ) */
  41. static int pcxhr_update_analog_audio_level(struct snd_pcxhr *chip, int is_capture, int channel)
  42. {
  43. int err, vol;
  44. struct pcxhr_rmh rmh;
  45. pcxhr_init_rmh(&rmh, CMD_ACCESS_IO_WRITE);
  46. if (is_capture) {
  47. rmh.cmd[0] |= IO_NUM_REG_IN_ANA_LEVEL;
  48. rmh.cmd[2] = chip->analog_capture_volume[channel];
  49. } else {
  50. rmh.cmd[0] |= IO_NUM_REG_OUT_ANA_LEVEL;
  51. if (chip->analog_playback_active[channel])
  52. vol = chip->analog_playback_volume[channel];
  53. else
  54. vol = PCXHR_ANALOG_PLAYBACK_LEVEL_MIN;
  55. rmh.cmd[2] = PCXHR_ANALOG_PLAYBACK_LEVEL_MAX - vol; /* playback analog levels are inversed */
  56. }
  57. rmh.cmd[1] = 1 << ((2 * chip->chip_idx) + channel); /* audio mask */
  58. rmh.cmd_len = 3;
  59. err = pcxhr_send_msg(chip->mgr, &rmh);
  60. if (err < 0) {
  61. snd_printk(KERN_DEBUG "error update_analog_audio_level card(%d) "
  62. "is_capture(%d) err(%x)\n", chip->chip_idx, is_capture, err);
  63. return -EINVAL;
  64. }
  65. return 0;
  66. }
  67. /*
  68. * analog level control
  69. */
  70. static int pcxhr_analog_vol_info(struct snd_kcontrol *kcontrol,
  71. struct snd_ctl_elem_info *uinfo)
  72. {
  73. uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER;
  74. uinfo->count = 2;
  75. if (kcontrol->private_value == 0) { /* playback */
  76. uinfo->value.integer.min = PCXHR_ANALOG_PLAYBACK_LEVEL_MIN; /* -128 dB */
  77. uinfo->value.integer.max = PCXHR_ANALOG_PLAYBACK_LEVEL_MAX; /* 0 dB */
  78. } else { /* capture */
  79. uinfo->value.integer.min = PCXHR_ANALOG_CAPTURE_LEVEL_MIN; /* -96 dB */
  80. uinfo->value.integer.max = PCXHR_ANALOG_CAPTURE_LEVEL_MAX; /* 31.5 dB */
  81. }
  82. return 0;
  83. }
  84. static int pcxhr_analog_vol_get(struct snd_kcontrol *kcontrol,
  85. struct snd_ctl_elem_value *ucontrol)
  86. {
  87. struct snd_pcxhr *chip = snd_kcontrol_chip(kcontrol);
  88. mutex_lock(&chip->mgr->mixer_mutex);
  89. if (kcontrol->private_value == 0) { /* playback */
  90. ucontrol->value.integer.value[0] = chip->analog_playback_volume[0];
  91. ucontrol->value.integer.value[1] = chip->analog_playback_volume[1];
  92. } else { /* capture */
  93. ucontrol->value.integer.value[0] = chip->analog_capture_volume[0];
  94. ucontrol->value.integer.value[1] = chip->analog_capture_volume[1];
  95. }
  96. mutex_unlock(&chip->mgr->mixer_mutex);
  97. return 0;
  98. }
  99. static int pcxhr_analog_vol_put(struct snd_kcontrol *kcontrol,
  100. struct snd_ctl_elem_value *ucontrol)
  101. {
  102. struct snd_pcxhr *chip = snd_kcontrol_chip(kcontrol);
  103. int changed = 0;
  104. int is_capture, i;
  105. mutex_lock(&chip->mgr->mixer_mutex);
  106. is_capture = (kcontrol->private_value != 0);
  107. for (i = 0; i < 2; i++) {
  108. int new_volume = ucontrol->value.integer.value[i];
  109. int* stored_volume = is_capture ? &chip->analog_capture_volume[i] :
  110. &chip->analog_playback_volume[i];
  111. if (*stored_volume != new_volume) {
  112. *stored_volume = new_volume;
  113. changed = 1;
  114. pcxhr_update_analog_audio_level(chip, is_capture, i);
  115. }
  116. }
  117. mutex_unlock(&chip->mgr->mixer_mutex);
  118. return changed;
  119. }
  120. static struct snd_kcontrol_new pcxhr_control_analog_level = {
  121. .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
  122. /* name will be filled later */
  123. .info = pcxhr_analog_vol_info,
  124. .get = pcxhr_analog_vol_get,
  125. .put = pcxhr_analog_vol_put,
  126. };
  127. /* shared */
  128. static int pcxhr_sw_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo)
  129. {
  130. uinfo->type = SNDRV_CTL_ELEM_TYPE_BOOLEAN;
  131. uinfo->count = 2;
  132. uinfo->value.integer.min = 0;
  133. uinfo->value.integer.max = 1;
  134. return 0;
  135. }
  136. static int pcxhr_audio_sw_get(struct snd_kcontrol *kcontrol,
  137. struct snd_ctl_elem_value *ucontrol)
  138. {
  139. struct snd_pcxhr *chip = snd_kcontrol_chip(kcontrol);
  140. mutex_lock(&chip->mgr->mixer_mutex);
  141. ucontrol->value.integer.value[0] = chip->analog_playback_active[0];
  142. ucontrol->value.integer.value[1] = chip->analog_playback_active[1];
  143. mutex_unlock(&chip->mgr->mixer_mutex);
  144. return 0;
  145. }
  146. static int pcxhr_audio_sw_put(struct snd_kcontrol *kcontrol,
  147. struct snd_ctl_elem_value *ucontrol)
  148. {
  149. struct snd_pcxhr *chip = snd_kcontrol_chip(kcontrol);
  150. int i, changed = 0;
  151. mutex_lock(&chip->mgr->mixer_mutex);
  152. for(i = 0; i < 2; i++) {
  153. if (chip->analog_playback_active[i] != ucontrol->value.integer.value[i]) {
  154. chip->analog_playback_active[i] = ucontrol->value.integer.value[i];
  155. changed = 1;
  156. pcxhr_update_analog_audio_level(chip, 0, i); /* update playback levels */
  157. }
  158. }
  159. mutex_unlock(&chip->mgr->mixer_mutex);
  160. return changed;
  161. }
  162. static struct snd_kcontrol_new pcxhr_control_output_switch = {
  163. .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
  164. .name = "Master Playback Switch",
  165. .info = pcxhr_sw_info, /* shared */
  166. .get = pcxhr_audio_sw_get,
  167. .put = pcxhr_audio_sw_put
  168. };
  169. #define PCXHR_DIGITAL_LEVEL_MIN 0x000 /* -110 dB */
  170. #define PCXHR_DIGITAL_LEVEL_MAX 0x1ff /* +18 dB */
  171. #define PCXHR_DIGITAL_ZERO_LEVEL 0x1b7 /* 0 dB */
  172. #define MORE_THAN_ONE_STREAM_LEVEL 0x000001
  173. #define VALID_STREAM_PAN_LEVEL_MASK 0x800000
  174. #define VALID_STREAM_LEVEL_MASK 0x400000
  175. #define VALID_STREAM_LEVEL_1_MASK 0x200000
  176. #define VALID_STREAM_LEVEL_2_MASK 0x100000
  177. static int pcxhr_update_playback_stream_level(struct snd_pcxhr* chip, int idx)
  178. {
  179. int err;
  180. struct pcxhr_rmh rmh;
  181. struct pcxhr_pipe *pipe = &chip->playback_pipe;
  182. int left, right;
  183. if (chip->digital_playback_active[idx][0])
  184. left = chip->digital_playback_volume[idx][0];
  185. else
  186. left = PCXHR_DIGITAL_LEVEL_MIN;
  187. if (chip->digital_playback_active[idx][1])
  188. right = chip->digital_playback_volume[idx][1];
  189. else
  190. right = PCXHR_DIGITAL_LEVEL_MIN;
  191. pcxhr_init_rmh(&rmh, CMD_STREAM_OUT_LEVEL_ADJUST);
  192. /* add pipe and stream mask */
  193. pcxhr_set_pipe_cmd_params(&rmh, 0, pipe->first_audio, 0, 1<<idx);
  194. /* volume left->left / right->right panoramic level */
  195. rmh.cmd[0] |= MORE_THAN_ONE_STREAM_LEVEL;
  196. rmh.cmd[2] = VALID_STREAM_PAN_LEVEL_MASK | VALID_STREAM_LEVEL_1_MASK;
  197. rmh.cmd[2] |= (left << 10);
  198. rmh.cmd[3] = VALID_STREAM_PAN_LEVEL_MASK | VALID_STREAM_LEVEL_2_MASK;
  199. rmh.cmd[3] |= right;
  200. rmh.cmd_len = 4;
  201. err = pcxhr_send_msg(chip->mgr, &rmh);
  202. if (err < 0) {
  203. snd_printk(KERN_DEBUG "error update_playback_stream_level "
  204. "card(%d) err(%x)\n", chip->chip_idx, err);
  205. return -EINVAL;
  206. }
  207. return 0;
  208. }
  209. #define AUDIO_IO_HAS_MUTE_LEVEL 0x400000
  210. #define AUDIO_IO_HAS_MUTE_MONITOR_1 0x200000
  211. #define VALID_AUDIO_IO_DIGITAL_LEVEL 0x000001
  212. #define VALID_AUDIO_IO_MONITOR_LEVEL 0x000002
  213. #define VALID_AUDIO_IO_MUTE_LEVEL 0x000004
  214. #define VALID_AUDIO_IO_MUTE_MONITOR_1 0x000008
  215. static int pcxhr_update_audio_pipe_level(struct snd_pcxhr* chip, int capture, int channel)
  216. {
  217. int err;
  218. struct pcxhr_rmh rmh;
  219. struct pcxhr_pipe *pipe;
  220. if (capture)
  221. pipe = &chip->capture_pipe[0];
  222. else
  223. pipe = &chip->playback_pipe;
  224. pcxhr_init_rmh(&rmh, CMD_AUDIO_LEVEL_ADJUST);
  225. /* add channel mask */
  226. pcxhr_set_pipe_cmd_params(&rmh, capture, 0, 0, 1 << (channel + pipe->first_audio));
  227. /* TODO : if mask (3 << pipe->first_audio) is used, left and right channel
  228. * will be programmed to the same params
  229. */
  230. if (capture) {
  231. rmh.cmd[0] |= VALID_AUDIO_IO_DIGITAL_LEVEL;
  232. /* VALID_AUDIO_IO_MUTE_LEVEL not yet handled (capture pipe level) */
  233. rmh.cmd[2] = chip->digital_capture_volume[channel];
  234. } else {
  235. rmh.cmd[0] |= VALID_AUDIO_IO_MONITOR_LEVEL | VALID_AUDIO_IO_MUTE_MONITOR_1;
  236. /* VALID_AUDIO_IO_DIGITAL_LEVEL and VALID_AUDIO_IO_MUTE_LEVEL not yet
  237. * handled (playback pipe level)
  238. */
  239. rmh.cmd[2] = chip->monitoring_volume[channel] << 10;
  240. if (chip->monitoring_active[channel] == 0)
  241. rmh.cmd[2] |= AUDIO_IO_HAS_MUTE_MONITOR_1;
  242. }
  243. rmh.cmd_len = 3;
  244. err = pcxhr_send_msg(chip->mgr, &rmh);
  245. if(err<0) {
  246. snd_printk(KERN_DEBUG "error update_audio_level card(%d) err(%x)\n",
  247. chip->chip_idx, err);
  248. return -EINVAL;
  249. }
  250. return 0;
  251. }
  252. /* shared */
  253. static int pcxhr_digital_vol_info(struct snd_kcontrol *kcontrol,
  254. struct snd_ctl_elem_info *uinfo)
  255. {
  256. uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER;
  257. uinfo->count = 2;
  258. uinfo->value.integer.min = PCXHR_DIGITAL_LEVEL_MIN; /* -109.5 dB */
  259. uinfo->value.integer.max = PCXHR_DIGITAL_LEVEL_MAX; /* 18.0 dB */
  260. return 0;
  261. }
  262. static int pcxhr_pcm_vol_get(struct snd_kcontrol *kcontrol,
  263. struct snd_ctl_elem_value *ucontrol)
  264. {
  265. struct snd_pcxhr *chip = snd_kcontrol_chip(kcontrol);
  266. int idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); /* index */
  267. int *stored_volume;
  268. int is_capture = kcontrol->private_value;
  269. mutex_lock(&chip->mgr->mixer_mutex);
  270. if (is_capture)
  271. stored_volume = chip->digital_capture_volume; /* digital capture */
  272. else
  273. stored_volume = chip->digital_playback_volume[idx]; /* digital playback */
  274. ucontrol->value.integer.value[0] = stored_volume[0];
  275. ucontrol->value.integer.value[1] = stored_volume[1];
  276. mutex_unlock(&chip->mgr->mixer_mutex);
  277. return 0;
  278. }
  279. static int pcxhr_pcm_vol_put(struct snd_kcontrol *kcontrol,
  280. struct snd_ctl_elem_value *ucontrol)
  281. {
  282. struct snd_pcxhr *chip = snd_kcontrol_chip(kcontrol);
  283. int idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); /* index */
  284. int changed = 0;
  285. int is_capture = kcontrol->private_value;
  286. int *stored_volume;
  287. int i;
  288. mutex_lock(&chip->mgr->mixer_mutex);
  289. if (is_capture)
  290. stored_volume = chip->digital_capture_volume; /* digital capture */
  291. else
  292. stored_volume = chip->digital_playback_volume[idx]; /* digital playback */
  293. for (i = 0; i < 2; i++) {
  294. if (stored_volume[i] != ucontrol->value.integer.value[i]) {
  295. stored_volume[i] = ucontrol->value.integer.value[i];
  296. changed = 1;
  297. if (is_capture) /* update capture volume */
  298. pcxhr_update_audio_pipe_level(chip, 1, i);
  299. }
  300. }
  301. if (! is_capture && changed)
  302. pcxhr_update_playback_stream_level(chip, idx); /* update playback volume */
  303. mutex_unlock(&chip->mgr->mixer_mutex);
  304. return changed;
  305. }
  306. static struct snd_kcontrol_new snd_pcxhr_pcm_vol =
  307. {
  308. .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
  309. /* name will be filled later */
  310. /* count will be filled later */
  311. .info = pcxhr_digital_vol_info, /* shared */
  312. .get = pcxhr_pcm_vol_get,
  313. .put = pcxhr_pcm_vol_put,
  314. };
  315. static int pcxhr_pcm_sw_get(struct snd_kcontrol *kcontrol,
  316. struct snd_ctl_elem_value *ucontrol)
  317. {
  318. struct snd_pcxhr *chip = snd_kcontrol_chip(kcontrol);
  319. int idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); /* index */
  320. mutex_lock(&chip->mgr->mixer_mutex);
  321. ucontrol->value.integer.value[0] = chip->digital_playback_active[idx][0];
  322. ucontrol->value.integer.value[1] = chip->digital_playback_active[idx][1];
  323. mutex_unlock(&chip->mgr->mixer_mutex);
  324. return 0;
  325. }
  326. static int pcxhr_pcm_sw_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
  327. {
  328. struct snd_pcxhr *chip = snd_kcontrol_chip(kcontrol);
  329. int changed = 0;
  330. int idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); /* index */
  331. int i, j;
  332. mutex_lock(&chip->mgr->mixer_mutex);
  333. j = idx;
  334. for (i = 0; i < 2; i++) {
  335. if (chip->digital_playback_active[j][i] != ucontrol->value.integer.value[i]) {
  336. chip->digital_playback_active[j][i] = ucontrol->value.integer.value[i];
  337. changed = 1;
  338. }
  339. }
  340. if (changed)
  341. pcxhr_update_playback_stream_level(chip, idx);
  342. mutex_unlock(&chip->mgr->mixer_mutex);
  343. return changed;
  344. }
  345. static struct snd_kcontrol_new pcxhr_control_pcm_switch = {
  346. .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
  347. .name = "PCM Playback Switch",
  348. .count = PCXHR_PLAYBACK_STREAMS,
  349. .info = pcxhr_sw_info, /* shared */
  350. .get = pcxhr_pcm_sw_get,
  351. .put = pcxhr_pcm_sw_put
  352. };
  353. /*
  354. * monitoring level control
  355. */
  356. static int pcxhr_monitor_vol_get(struct snd_kcontrol *kcontrol,
  357. struct snd_ctl_elem_value *ucontrol)
  358. {
  359. struct snd_pcxhr *chip = snd_kcontrol_chip(kcontrol);
  360. mutex_lock(&chip->mgr->mixer_mutex);
  361. ucontrol->value.integer.value[0] = chip->monitoring_volume[0];
  362. ucontrol->value.integer.value[1] = chip->monitoring_volume[1];
  363. mutex_unlock(&chip->mgr->mixer_mutex);
  364. return 0;
  365. }
  366. static int pcxhr_monitor_vol_put(struct snd_kcontrol *kcontrol,
  367. struct snd_ctl_elem_value *ucontrol)
  368. {
  369. struct snd_pcxhr *chip = snd_kcontrol_chip(kcontrol);
  370. int changed = 0;
  371. int i;
  372. mutex_lock(&chip->mgr->mixer_mutex);
  373. for (i = 0; i < 2; i++) {
  374. if (chip->monitoring_volume[i] != ucontrol->value.integer.value[i]) {
  375. chip->monitoring_volume[i] = ucontrol->value.integer.value[i];
  376. if(chip->monitoring_active[i]) /* do only when monitoring is unmuted */
  377. /* update monitoring volume and mute */
  378. pcxhr_update_audio_pipe_level(chip, 0, i);
  379. changed = 1;
  380. }
  381. }
  382. mutex_unlock(&chip->mgr->mixer_mutex);
  383. return changed;
  384. }
  385. static struct snd_kcontrol_new pcxhr_control_monitor_vol = {
  386. .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
  387. .name = "Monitoring Volume",
  388. .info = pcxhr_digital_vol_info, /* shared */
  389. .get = pcxhr_monitor_vol_get,
  390. .put = pcxhr_monitor_vol_put,
  391. };
  392. /*
  393. * monitoring switch control
  394. */
  395. static int pcxhr_monitor_sw_get(struct snd_kcontrol *kcontrol,
  396. struct snd_ctl_elem_value *ucontrol)
  397. {
  398. struct snd_pcxhr *chip = snd_kcontrol_chip(kcontrol);
  399. mutex_lock(&chip->mgr->mixer_mutex);
  400. ucontrol->value.integer.value[0] = chip->monitoring_active[0];
  401. ucontrol->value.integer.value[1] = chip->monitoring_active[1];
  402. mutex_unlock(&chip->mgr->mixer_mutex);
  403. return 0;
  404. }
  405. static int pcxhr_monitor_sw_put(struct snd_kcontrol *kcontrol,
  406. struct snd_ctl_elem_value *ucontrol)
  407. {
  408. struct snd_pcxhr *chip = snd_kcontrol_chip(kcontrol);
  409. int changed = 0;
  410. int i;
  411. mutex_lock(&chip->mgr->mixer_mutex);
  412. for (i = 0; i < 2; i++) {
  413. if (chip->monitoring_active[i] != ucontrol->value.integer.value[i]) {
  414. chip->monitoring_active[i] = ucontrol->value.integer.value[i];
  415. changed |= (1<<i); /* mask 0x01 and 0x02 */
  416. }
  417. }
  418. if(changed & 0x01)
  419. /* update left monitoring volume and mute */
  420. pcxhr_update_audio_pipe_level(chip, 0, 0);
  421. if(changed & 0x02)
  422. /* update right monitoring volume and mute */
  423. pcxhr_update_audio_pipe_level(chip, 0, 1);
  424. mutex_unlock(&chip->mgr->mixer_mutex);
  425. return (changed != 0);
  426. }
  427. static struct snd_kcontrol_new pcxhr_control_monitor_sw = {
  428. .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
  429. .name = "Monitoring Switch",
  430. .info = pcxhr_sw_info, /* shared */
  431. .get = pcxhr_monitor_sw_get,
  432. .put = pcxhr_monitor_sw_put
  433. };
  434. /*
  435. * audio source select
  436. */
  437. #define PCXHR_SOURCE_AUDIO01_UER 0x000100
  438. #define PCXHR_SOURCE_AUDIO01_SYNC 0x000200
  439. #define PCXHR_SOURCE_AUDIO23_UER 0x000400
  440. #define PCXHR_SOURCE_AUDIO45_UER 0x001000
  441. #define PCXHR_SOURCE_AUDIO67_UER 0x040000
  442. static int pcxhr_set_audio_source(struct snd_pcxhr* chip)
  443. {
  444. struct pcxhr_rmh rmh;
  445. unsigned int mask, reg;
  446. unsigned int codec;
  447. int err, use_src, changed;
  448. switch (chip->chip_idx) {
  449. case 0 : mask = PCXHR_SOURCE_AUDIO01_UER; codec = CS8420_01_CS; break;
  450. case 1 : mask = PCXHR_SOURCE_AUDIO23_UER; codec = CS8420_23_CS; break;
  451. case 2 : mask = PCXHR_SOURCE_AUDIO45_UER; codec = CS8420_45_CS; break;
  452. case 3 : mask = PCXHR_SOURCE_AUDIO67_UER; codec = CS8420_67_CS; break;
  453. default: return -EINVAL;
  454. }
  455. reg = 0; /* audio source from analog plug */
  456. use_src = 0; /* do not activate codec SRC */
  457. if (chip->audio_capture_source != 0) {
  458. reg = mask; /* audio source from digital plug */
  459. if (chip->audio_capture_source == 2)
  460. use_src = 1;
  461. }
  462. /* set the input source */
  463. pcxhr_write_io_num_reg_cont(chip->mgr, mask, reg, &changed);
  464. /* resync them (otherwise channel inversion possible) */
  465. if (changed) {
  466. pcxhr_init_rmh(&rmh, CMD_RESYNC_AUDIO_INPUTS);
  467. rmh.cmd[0] |= (1 << chip->chip_idx);
  468. err = pcxhr_send_msg(chip->mgr, &rmh);
  469. if (err)
  470. return err;
  471. }
  472. pcxhr_init_rmh(&rmh, CMD_ACCESS_IO_WRITE); /* set codec SRC on off */
  473. rmh.cmd_len = 3;
  474. rmh.cmd[0] |= IO_NUM_UER_CHIP_REG;
  475. rmh.cmd[1] = codec;
  476. rmh.cmd[2] = (CS8420_DATA_FLOW_CTL & CHIP_SIG_AND_MAP_SPI) | (use_src ? 0x41 : 0x54);
  477. err = pcxhr_send_msg(chip->mgr, &rmh);
  478. if(err)
  479. return err;
  480. rmh.cmd[2] = (CS8420_CLOCK_SRC_CTL & CHIP_SIG_AND_MAP_SPI) | (use_src ? 0x41 : 0x49);
  481. err = pcxhr_send_msg(chip->mgr, &rmh);
  482. return err;
  483. }
  484. static int pcxhr_audio_src_info(struct snd_kcontrol *kcontrol,
  485. struct snd_ctl_elem_info *uinfo)
  486. {
  487. static char *texts[3] = {"Analog", "Digital", "Digi+SRC"};
  488. uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
  489. uinfo->count = 1;
  490. uinfo->value.enumerated.items = 3;
  491. if (uinfo->value.enumerated.item > 2)
  492. uinfo->value.enumerated.item = 2;
  493. strcpy(uinfo->value.enumerated.name,
  494. texts[uinfo->value.enumerated.item]);
  495. return 0;
  496. }
  497. static int pcxhr_audio_src_get(struct snd_kcontrol *kcontrol,
  498. struct snd_ctl_elem_value *ucontrol)
  499. {
  500. struct snd_pcxhr *chip = snd_kcontrol_chip(kcontrol);
  501. ucontrol->value.enumerated.item[0] = chip->audio_capture_source;
  502. return 0;
  503. }
  504. static int pcxhr_audio_src_put(struct snd_kcontrol *kcontrol,
  505. struct snd_ctl_elem_value *ucontrol)
  506. {
  507. struct snd_pcxhr *chip = snd_kcontrol_chip(kcontrol);
  508. int ret = 0;
  509. mutex_lock(&chip->mgr->mixer_mutex);
  510. if (chip->audio_capture_source != ucontrol->value.enumerated.item[0]) {
  511. chip->audio_capture_source = ucontrol->value.enumerated.item[0];
  512. pcxhr_set_audio_source(chip);
  513. ret = 1;
  514. }
  515. mutex_unlock(&chip->mgr->mixer_mutex);
  516. return ret;
  517. }
  518. static struct snd_kcontrol_new pcxhr_control_audio_src = {
  519. .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
  520. .name = "Capture Source",
  521. .info = pcxhr_audio_src_info,
  522. .get = pcxhr_audio_src_get,
  523. .put = pcxhr_audio_src_put,
  524. };
  525. /*
  526. * clock type selection
  527. * enum pcxhr_clock_type {
  528. * PCXHR_CLOCK_TYPE_INTERNAL = 0,
  529. * PCXHR_CLOCK_TYPE_WORD_CLOCK,
  530. * PCXHR_CLOCK_TYPE_AES_SYNC,
  531. * PCXHR_CLOCK_TYPE_AES_1,
  532. * PCXHR_CLOCK_TYPE_AES_2,
  533. * PCXHR_CLOCK_TYPE_AES_3,
  534. * PCXHR_CLOCK_TYPE_AES_4,
  535. * };
  536. */
  537. static int pcxhr_clock_type_info(struct snd_kcontrol *kcontrol,
  538. struct snd_ctl_elem_info *uinfo)
  539. {
  540. static char *texts[7] = {
  541. "Internal", "WordClock", "AES Sync", "AES 1", "AES 2", "AES 3", "AES 4"
  542. };
  543. struct pcxhr_mgr *mgr = snd_kcontrol_chip(kcontrol);
  544. int clock_items = 3 + mgr->capture_chips;
  545. uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
  546. uinfo->count = 1;
  547. uinfo->value.enumerated.items = clock_items;
  548. if (uinfo->value.enumerated.item >= clock_items)
  549. uinfo->value.enumerated.item = clock_items-1;
  550. strcpy(uinfo->value.enumerated.name,
  551. texts[uinfo->value.enumerated.item]);
  552. return 0;
  553. }
  554. static int pcxhr_clock_type_get(struct snd_kcontrol *kcontrol,
  555. struct snd_ctl_elem_value *ucontrol)
  556. {
  557. struct pcxhr_mgr *mgr = snd_kcontrol_chip(kcontrol);
  558. ucontrol->value.enumerated.item[0] = mgr->use_clock_type;
  559. return 0;
  560. }
  561. static int pcxhr_clock_type_put(struct snd_kcontrol *kcontrol,
  562. struct snd_ctl_elem_value *ucontrol)
  563. {
  564. struct pcxhr_mgr *mgr = snd_kcontrol_chip(kcontrol);
  565. int rate, ret = 0;
  566. mutex_lock(&mgr->mixer_mutex);
  567. if (mgr->use_clock_type != ucontrol->value.enumerated.item[0]) {
  568. mutex_lock(&mgr->setup_mutex);
  569. mgr->use_clock_type = ucontrol->value.enumerated.item[0];
  570. if (mgr->use_clock_type)
  571. pcxhr_get_external_clock(mgr, mgr->use_clock_type, &rate);
  572. else
  573. rate = mgr->sample_rate;
  574. if (rate) {
  575. pcxhr_set_clock(mgr, rate);
  576. if (mgr->sample_rate)
  577. mgr->sample_rate = rate;
  578. }
  579. mutex_unlock(&mgr->setup_mutex);
  580. ret = 1; /* return 1 even if the set was not done. ok ? */
  581. }
  582. mutex_unlock(&mgr->mixer_mutex);
  583. return ret;
  584. }
  585. static struct snd_kcontrol_new pcxhr_control_clock_type = {
  586. .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
  587. .name = "Clock Mode",
  588. .info = pcxhr_clock_type_info,
  589. .get = pcxhr_clock_type_get,
  590. .put = pcxhr_clock_type_put,
  591. };
  592. /*
  593. * clock rate control
  594. * specific control that scans the sample rates on the external plugs
  595. */
  596. static int pcxhr_clock_rate_info(struct snd_kcontrol *kcontrol,
  597. struct snd_ctl_elem_info *uinfo)
  598. {
  599. struct pcxhr_mgr *mgr = snd_kcontrol_chip(kcontrol);
  600. uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER;
  601. uinfo->count = 3 + mgr->capture_chips;
  602. uinfo->value.integer.min = 0; /* clock not present */
  603. uinfo->value.integer.max = 192000; /* max sample rate 192 kHz */
  604. return 0;
  605. }
  606. static int pcxhr_clock_rate_get(struct snd_kcontrol *kcontrol,
  607. struct snd_ctl_elem_value *ucontrol)
  608. {
  609. struct pcxhr_mgr *mgr = snd_kcontrol_chip(kcontrol);
  610. int i, err, rate;
  611. mutex_lock(&mgr->mixer_mutex);
  612. for(i = 0; i < 3 + mgr->capture_chips; i++) {
  613. if (i == PCXHR_CLOCK_TYPE_INTERNAL)
  614. rate = mgr->sample_rate_real;
  615. else {
  616. err = pcxhr_get_external_clock(mgr, i, &rate);
  617. if (err)
  618. break;
  619. }
  620. ucontrol->value.integer.value[i] = rate;
  621. }
  622. mutex_unlock(&mgr->mixer_mutex);
  623. return 0;
  624. }
  625. static struct snd_kcontrol_new pcxhr_control_clock_rate = {
  626. .access = SNDRV_CTL_ELEM_ACCESS_READ,
  627. .iface = SNDRV_CTL_ELEM_IFACE_CARD,
  628. .name = "Clock Rates",
  629. .info = pcxhr_clock_rate_info,
  630. .get = pcxhr_clock_rate_get,
  631. };
  632. /*
  633. * IEC958 status bits
  634. */
  635. static int pcxhr_iec958_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo)
  636. {
  637. uinfo->type = SNDRV_CTL_ELEM_TYPE_IEC958;
  638. uinfo->count = 1;
  639. return 0;
  640. }
  641. static int pcxhr_iec958_capture_byte(struct snd_pcxhr *chip, int aes_idx, unsigned char* aes_bits)
  642. {
  643. int i, err;
  644. unsigned char temp;
  645. struct pcxhr_rmh rmh;
  646. pcxhr_init_rmh(&rmh, CMD_ACCESS_IO_READ);
  647. rmh.cmd[0] |= IO_NUM_UER_CHIP_REG;
  648. switch (chip->chip_idx) {
  649. case 0: rmh.cmd[1] = CS8420_01_CS; break; /* use CS8416_01_CS for AES SYNC plug */
  650. case 1: rmh.cmd[1] = CS8420_23_CS; break;
  651. case 2: rmh.cmd[1] = CS8420_45_CS; break;
  652. case 3: rmh.cmd[1] = CS8420_67_CS; break;
  653. default: return -EINVAL;
  654. }
  655. switch (aes_idx) {
  656. case 0: rmh.cmd[2] = CS8420_CSB0; break; /* use CS8416_CSBx for AES SYNC plug */
  657. case 1: rmh.cmd[2] = CS8420_CSB1; break;
  658. case 2: rmh.cmd[2] = CS8420_CSB2; break;
  659. case 3: rmh.cmd[2] = CS8420_CSB3; break;
  660. case 4: rmh.cmd[2] = CS8420_CSB4; break;
  661. default: return -EINVAL;
  662. }
  663. rmh.cmd[1] &= 0x0fffff; /* size and code the chip id for the fpga */
  664. rmh.cmd[2] &= CHIP_SIG_AND_MAP_SPI; /* chip signature + map for spi read */
  665. rmh.cmd_len = 3;
  666. err = pcxhr_send_msg(chip->mgr, &rmh);
  667. if (err)
  668. return err;
  669. temp = 0;
  670. for (i = 0; i < 8; i++) {
  671. /* attention : reversed bit order (not with CS8416_01_CS) */
  672. temp <<= 1;
  673. if (rmh.stat[1] & (1 << i))
  674. temp |= 1;
  675. }
  676. snd_printdd("read iec958 AES %d byte %d = 0x%x\n", chip->chip_idx, aes_idx, temp);
  677. *aes_bits = temp;
  678. return 0;
  679. }
  680. static int pcxhr_iec958_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
  681. {
  682. struct snd_pcxhr *chip = snd_kcontrol_chip(kcontrol);
  683. unsigned char aes_bits;
  684. int i, err;
  685. mutex_lock(&chip->mgr->mixer_mutex);
  686. for(i = 0; i < 5; i++) {
  687. if (kcontrol->private_value == 0) /* playback */
  688. aes_bits = chip->aes_bits[i];
  689. else { /* capture */
  690. err = pcxhr_iec958_capture_byte(chip, i, &aes_bits);
  691. if (err)
  692. break;
  693. }
  694. ucontrol->value.iec958.status[i] = aes_bits;
  695. }
  696. mutex_unlock(&chip->mgr->mixer_mutex);
  697. return 0;
  698. }
  699. static int pcxhr_iec958_mask_get(struct snd_kcontrol *kcontrol,
  700. struct snd_ctl_elem_value *ucontrol)
  701. {
  702. int i;
  703. for (i = 0; i < 5; i++)
  704. ucontrol->value.iec958.status[i] = 0xff;
  705. return 0;
  706. }
  707. static int pcxhr_iec958_update_byte(struct snd_pcxhr *chip, int aes_idx, unsigned char aes_bits)
  708. {
  709. int i, err, cmd;
  710. unsigned char new_bits = aes_bits;
  711. unsigned char old_bits = chip->aes_bits[aes_idx];
  712. struct pcxhr_rmh rmh;
  713. for (i = 0; i < 8; i++) {
  714. if ((old_bits & 0x01) != (new_bits & 0x01)) {
  715. cmd = chip->chip_idx & 0x03; /* chip index 0..3 */
  716. if(chip->chip_idx > 3)
  717. /* new bit used if chip_idx>3 (PCX1222HR) */
  718. cmd |= 1 << 22;
  719. cmd |= ((aes_idx << 3) + i) << 2; /* add bit offset */
  720. cmd |= (new_bits & 0x01) << 23; /* add bit value */
  721. pcxhr_init_rmh(&rmh, CMD_ACCESS_IO_WRITE);
  722. rmh.cmd[0] |= IO_NUM_REG_CUER;
  723. rmh.cmd[1] = cmd;
  724. rmh.cmd_len = 2;
  725. snd_printdd("write iec958 AES %d byte %d bit %d (cmd %x)\n",
  726. chip->chip_idx, aes_idx, i, cmd);
  727. err = pcxhr_send_msg(chip->mgr, &rmh);
  728. if (err)
  729. return err;
  730. }
  731. old_bits >>= 1;
  732. new_bits >>= 1;
  733. }
  734. chip->aes_bits[aes_idx] = aes_bits;
  735. return 0;
  736. }
  737. static int pcxhr_iec958_put(struct snd_kcontrol *kcontrol,
  738. struct snd_ctl_elem_value *ucontrol)
  739. {
  740. struct snd_pcxhr *chip = snd_kcontrol_chip(kcontrol);
  741. int i, changed = 0;
  742. /* playback */
  743. mutex_lock(&chip->mgr->mixer_mutex);
  744. for (i = 0; i < 5; i++) {
  745. if (ucontrol->value.iec958.status[i] != chip->aes_bits[i]) {
  746. pcxhr_iec958_update_byte(chip, i, ucontrol->value.iec958.status[i]);
  747. changed = 1;
  748. }
  749. }
  750. mutex_unlock(&chip->mgr->mixer_mutex);
  751. return changed;
  752. }
  753. static struct snd_kcontrol_new pcxhr_control_playback_iec958_mask = {
  754. .access = SNDRV_CTL_ELEM_ACCESS_READ,
  755. .iface = SNDRV_CTL_ELEM_IFACE_PCM,
  756. .name = SNDRV_CTL_NAME_IEC958("",PLAYBACK,MASK),
  757. .info = pcxhr_iec958_info,
  758. .get = pcxhr_iec958_mask_get
  759. };
  760. static struct snd_kcontrol_new pcxhr_control_playback_iec958 = {
  761. .iface = SNDRV_CTL_ELEM_IFACE_PCM,
  762. .name = SNDRV_CTL_NAME_IEC958("",PLAYBACK,DEFAULT),
  763. .info = pcxhr_iec958_info,
  764. .get = pcxhr_iec958_get,
  765. .put = pcxhr_iec958_put,
  766. .private_value = 0 /* playback */
  767. };
  768. static struct snd_kcontrol_new pcxhr_control_capture_iec958_mask = {
  769. .access = SNDRV_CTL_ELEM_ACCESS_READ,
  770. .iface = SNDRV_CTL_ELEM_IFACE_PCM,
  771. .name = SNDRV_CTL_NAME_IEC958("",CAPTURE,MASK),
  772. .info = pcxhr_iec958_info,
  773. .get = pcxhr_iec958_mask_get
  774. };
  775. static struct snd_kcontrol_new pcxhr_control_capture_iec958 = {
  776. .access = SNDRV_CTL_ELEM_ACCESS_READ,
  777. .iface = SNDRV_CTL_ELEM_IFACE_PCM,
  778. .name = SNDRV_CTL_NAME_IEC958("",CAPTURE,DEFAULT),
  779. .info = pcxhr_iec958_info,
  780. .get = pcxhr_iec958_get,
  781. .private_value = 1 /* capture */
  782. };
  783. static void pcxhr_init_audio_levels(struct snd_pcxhr *chip)
  784. {
  785. int i;
  786. for (i = 0; i < 2; i++) {
  787. if (chip->nb_streams_play) {
  788. int j;
  789. /* at boot time the digital volumes are unmuted 0dB */
  790. for (j = 0; j < PCXHR_PLAYBACK_STREAMS; j++) {
  791. chip->digital_playback_active[j][i] = 1;
  792. chip->digital_playback_volume[j][i] = PCXHR_DIGITAL_ZERO_LEVEL;
  793. }
  794. /* after boot, only two bits are set on the uer interface */
  795. chip->aes_bits[0] = IEC958_AES0_PROFESSIONAL | IEC958_AES0_PRO_FS_48000;
  796. /* only for test purpose, remove later */
  797. #ifdef CONFIG_SND_DEBUG
  798. /* analog volumes for playback (is LEVEL_MIN after boot) */
  799. chip->analog_playback_active[i] = 1;
  800. chip->analog_playback_volume[i] = PCXHR_ANALOG_PLAYBACK_ZERO_LEVEL;
  801. pcxhr_update_analog_audio_level(chip, 0, i);
  802. #endif
  803. /* test end */
  804. }
  805. if (chip->nb_streams_capt) {
  806. /* at boot time the digital volumes are unmuted 0dB */
  807. chip->digital_capture_volume[i] = PCXHR_DIGITAL_ZERO_LEVEL;
  808. /* only for test purpose, remove later */
  809. #ifdef CONFIG_SND_DEBUG
  810. /* analog volumes for playback (is LEVEL_MIN after boot) */
  811. chip->analog_capture_volume[i] = PCXHR_ANALOG_CAPTURE_ZERO_LEVEL;
  812. pcxhr_update_analog_audio_level(chip, 1, i);
  813. #endif
  814. /* test end */
  815. }
  816. }
  817. return;
  818. }
  819. int pcxhr_create_mixer(struct pcxhr_mgr *mgr)
  820. {
  821. struct snd_pcxhr *chip;
  822. int err, i;
  823. mutex_init(&mgr->mixer_mutex); /* can be in another place */
  824. for (i = 0; i < mgr->num_cards; i++) {
  825. struct snd_kcontrol_new temp;
  826. chip = mgr->chip[i];
  827. if (chip->nb_streams_play) {
  828. /* analog output level control */
  829. temp = pcxhr_control_analog_level;
  830. temp.name = "Master Playback Volume";
  831. temp.private_value = 0; /* playback */
  832. if ((err = snd_ctl_add(chip->card, snd_ctl_new1(&temp, chip))) < 0)
  833. return err;
  834. /* output mute controls */
  835. if ((err = snd_ctl_add(chip->card,
  836. snd_ctl_new1(&pcxhr_control_output_switch,
  837. chip))) < 0)
  838. return err;
  839. temp = snd_pcxhr_pcm_vol;
  840. temp.name = "PCM Playback Volume";
  841. temp.count = PCXHR_PLAYBACK_STREAMS;
  842. temp.private_value = 0; /* playback */
  843. if ((err = snd_ctl_add(chip->card, snd_ctl_new1(&temp, chip))) < 0)
  844. return err;
  845. if ((err = snd_ctl_add(chip->card,
  846. snd_ctl_new1(&pcxhr_control_pcm_switch,
  847. chip))) < 0)
  848. return err;
  849. /* IEC958 controls */
  850. if ((err = snd_ctl_add(chip->card,
  851. snd_ctl_new1(&pcxhr_control_playback_iec958_mask,
  852. chip))) < 0)
  853. return err;
  854. if ((err = snd_ctl_add(chip->card,
  855. snd_ctl_new1(&pcxhr_control_playback_iec958,
  856. chip))) < 0)
  857. return err;
  858. }
  859. if (chip->nb_streams_capt) {
  860. /* analog input level control only on first two chips !*/
  861. temp = pcxhr_control_analog_level;
  862. temp.name = "Master Capture Volume";
  863. temp.private_value = 1; /* capture */
  864. if ((err = snd_ctl_add(chip->card, snd_ctl_new1(&temp, chip))) < 0)
  865. return err;
  866. temp = snd_pcxhr_pcm_vol;
  867. temp.name = "PCM Capture Volume";
  868. temp.count = 1;
  869. temp.private_value = 1; /* capture */
  870. if ((err = snd_ctl_add(chip->card, snd_ctl_new1(&temp, chip))) < 0)
  871. return err;
  872. /* Audio source */
  873. if ((err = snd_ctl_add(chip->card,
  874. snd_ctl_new1(&pcxhr_control_audio_src,
  875. chip))) < 0)
  876. return err;
  877. /* IEC958 controls */
  878. if ((err = snd_ctl_add(chip->card,
  879. snd_ctl_new1(&pcxhr_control_capture_iec958_mask,
  880. chip))) < 0)
  881. return err;
  882. if ((err = snd_ctl_add(chip->card,
  883. snd_ctl_new1(&pcxhr_control_capture_iec958,
  884. chip))) < 0)
  885. return err;
  886. }
  887. /* monitoring only if playback and capture device available */
  888. if (chip->nb_streams_capt > 0 && chip->nb_streams_play > 0) {
  889. /* monitoring */
  890. if ((err = snd_ctl_add(chip->card,
  891. snd_ctl_new1(&pcxhr_control_monitor_vol,
  892. chip))) < 0)
  893. return err;
  894. if ((err = snd_ctl_add(chip->card,
  895. snd_ctl_new1(&pcxhr_control_monitor_sw,
  896. chip))) < 0)
  897. return err;
  898. }
  899. if (i == 0) {
  900. /* clock mode only one control per pcxhr */
  901. if ((err = snd_ctl_add(chip->card,
  902. snd_ctl_new1(&pcxhr_control_clock_type,
  903. mgr))) < 0)
  904. return err;
  905. /* non standard control used to scan the external clock presence/frequencies */
  906. if ((err = snd_ctl_add(chip->card,
  907. snd_ctl_new1(&pcxhr_control_clock_rate,
  908. mgr))) < 0)
  909. return err;
  910. }
  911. /* init values for the mixer data */
  912. pcxhr_init_audio_levels(chip);
  913. }
  914. return 0;
  915. }