1 // SPDX-License-Identifier: GPL-2.0-or-later
6 * Vortex PCM ALSA driver.
8 * Supports ADB and WT DMA. Unfortunately, WT channels do not run yet.
9 * It remains stuck,and DMA transfers do not happen.
11 #include <sound/asoundef.h>
12 #include <linux/time.h>
13 #include <sound/core.h>
14 #include <sound/pcm.h>
15 #include <sound/pcm_params.h>
18 #define VORTEX_PCM_TYPE(x) (x->name[40])
20 /* hardware definition */
21 static const struct snd_pcm_hardware snd_vortex_playback_hw_adb
= {
23 (SNDRV_PCM_INFO_MMAP
| /* SNDRV_PCM_INFO_RESUME | */
24 SNDRV_PCM_INFO_PAUSE
| SNDRV_PCM_INFO_INTERLEAVED
|
25 SNDRV_PCM_INFO_MMAP_VALID
),
27 SNDRV_PCM_FMTBIT_S16_LE
| SNDRV_PCM_FMTBIT_U8
|
28 SNDRV_PCM_FMTBIT_MU_LAW
| SNDRV_PCM_FMTBIT_A_LAW
,
29 .rates
= SNDRV_PCM_RATE_CONTINUOUS
,
34 .buffer_bytes_max
= 0x10000,
35 .period_bytes_min
= 0x20,
36 .period_bytes_max
= 0x1000,
42 static const struct snd_pcm_hardware snd_vortex_playback_hw_a3d
= {
44 (SNDRV_PCM_INFO_MMAP
| /* SNDRV_PCM_INFO_RESUME | */
45 SNDRV_PCM_INFO_PAUSE
| SNDRV_PCM_INFO_INTERLEAVED
|
46 SNDRV_PCM_INFO_MMAP_VALID
),
48 SNDRV_PCM_FMTBIT_S16_LE
| SNDRV_PCM_FMTBIT_U8
|
49 SNDRV_PCM_FMTBIT_MU_LAW
| SNDRV_PCM_FMTBIT_A_LAW
,
50 .rates
= SNDRV_PCM_RATE_CONTINUOUS
,
55 .buffer_bytes_max
= 0x10000,
56 .period_bytes_min
= 0x100,
57 .period_bytes_max
= 0x1000,
62 static const struct snd_pcm_hardware snd_vortex_playback_hw_spdif
= {
64 (SNDRV_PCM_INFO_MMAP
| /* SNDRV_PCM_INFO_RESUME | */
65 SNDRV_PCM_INFO_PAUSE
| SNDRV_PCM_INFO_INTERLEAVED
|
66 SNDRV_PCM_INFO_MMAP_VALID
),
68 SNDRV_PCM_FMTBIT_S16_LE
| SNDRV_PCM_FMTBIT_U8
|
69 SNDRV_PCM_FMTBIT_IEC958_SUBFRAME_LE
| SNDRV_PCM_FMTBIT_MU_LAW
|
70 SNDRV_PCM_FMTBIT_A_LAW
,
72 SNDRV_PCM_RATE_32000
| SNDRV_PCM_RATE_44100
| SNDRV_PCM_RATE_48000
,
77 .buffer_bytes_max
= 0x10000,
78 .period_bytes_min
= 0x100,
79 .period_bytes_max
= 0x1000,
85 static const struct snd_pcm_hardware snd_vortex_playback_hw_wt
= {
86 .info
= (SNDRV_PCM_INFO_MMAP
|
87 SNDRV_PCM_INFO_INTERLEAVED
|
88 SNDRV_PCM_INFO_BLOCK_TRANSFER
| SNDRV_PCM_INFO_MMAP_VALID
),
89 .formats
= SNDRV_PCM_FMTBIT_S16_LE
,
90 .rates
= SNDRV_PCM_RATE_8000_48000
| SNDRV_PCM_RATE_CONTINUOUS
, // SNDRV_PCM_RATE_48000,
95 .buffer_bytes_max
= 0x10000,
96 .period_bytes_min
= 0x0400,
97 .period_bytes_max
= 0x1000,
103 static const unsigned int au8830_channels
[3] = {
107 static const struct snd_pcm_hw_constraint_list hw_constraints_au8830_channels
= {
108 .count
= ARRAY_SIZE(au8830_channels
),
109 .list
= au8830_channels
,
114 static void vortex_notify_pcm_vol_change(struct snd_card
*card
,
115 struct snd_kcontrol
*kctl
, int activate
)
118 kctl
->vd
[0].access
&= ~SNDRV_CTL_ELEM_ACCESS_INACTIVE
;
120 kctl
->vd
[0].access
|= SNDRV_CTL_ELEM_ACCESS_INACTIVE
;
121 snd_ctl_notify(card
, SNDRV_CTL_EVENT_MASK_VALUE
|
122 SNDRV_CTL_EVENT_MASK_INFO
, &(kctl
->id
));
126 static int snd_vortex_pcm_open(struct snd_pcm_substream
*substream
)
128 vortex_t
*vortex
= snd_pcm_substream_chip(substream
);
129 struct snd_pcm_runtime
*runtime
= substream
->runtime
;
132 /* Force equal size periods */
133 err
= snd_pcm_hw_constraint_integer(runtime
,
134 SNDRV_PCM_HW_PARAM_PERIODS
);
137 /* Avoid PAGE_SIZE boundary to fall inside of a period. */
138 err
= snd_pcm_hw_constraint_pow2(runtime
, 0,
139 SNDRV_PCM_HW_PARAM_PERIOD_BYTES
);
143 snd_pcm_hw_constraint_step(runtime
, 0,
144 SNDRV_PCM_HW_PARAM_BUFFER_BYTES
, 64);
146 if (VORTEX_PCM_TYPE(substream
->pcm
) != VORTEX_PCM_WT
) {
148 if (VORTEX_PCM_TYPE(substream
->pcm
) == VORTEX_PCM_A3D
) {
149 runtime
->hw
= snd_vortex_playback_hw_a3d
;
152 if (VORTEX_PCM_TYPE(substream
->pcm
) == VORTEX_PCM_SPDIF
) {
153 runtime
->hw
= snd_vortex_playback_hw_spdif
;
154 switch (vortex
->spdif_sr
) {
156 runtime
->hw
.rates
= SNDRV_PCM_RATE_32000
;
159 runtime
->hw
.rates
= SNDRV_PCM_RATE_44100
;
162 runtime
->hw
.rates
= SNDRV_PCM_RATE_48000
;
166 if (VORTEX_PCM_TYPE(substream
->pcm
) == VORTEX_PCM_ADB
167 || VORTEX_PCM_TYPE(substream
->pcm
) == VORTEX_PCM_I2S
)
168 runtime
->hw
= snd_vortex_playback_hw_adb
;
170 if (substream
->stream
== SNDRV_PCM_STREAM_PLAYBACK
&&
171 VORTEX_IS_QUAD(vortex
) &&
172 VORTEX_PCM_TYPE(substream
->pcm
) == VORTEX_PCM_ADB
) {
173 runtime
->hw
.channels_max
= 4;
174 snd_pcm_hw_constraint_list(runtime
, 0,
175 SNDRV_PCM_HW_PARAM_CHANNELS
,
176 &hw_constraints_au8830_channels
);
179 substream
->runtime
->private_data
= NULL
;
183 runtime
->hw
= snd_vortex_playback_hw_wt
;
184 substream
->runtime
->private_data
= NULL
;
191 static int snd_vortex_pcm_close(struct snd_pcm_substream
*substream
)
193 //vortex_t *chip = snd_pcm_substream_chip(substream);
194 stream_t
*stream
= (stream_t
*) substream
->runtime
->private_data
;
196 // the hardware-specific codes will be here
197 if (stream
!= NULL
) {
198 stream
->substream
= NULL
;
201 substream
->runtime
->private_data
= NULL
;
205 /* hw_params callback */
207 snd_vortex_pcm_hw_params(struct snd_pcm_substream
*substream
,
208 struct snd_pcm_hw_params
*hw_params
)
210 vortex_t
*chip
= snd_pcm_substream_chip(substream
);
211 stream_t
*stream
= (stream_t
*) (substream
->runtime
->private_data
);
214 pr_info( "Vortex: periods %d, period_bytes %d, channels = %d\n", params_periods(hw_params),
215 params_period_bytes(hw_params), params_channels(hw_params));
217 spin_lock_irq(&chip
->lock
);
218 // Make audio routes and config buffer DMA.
219 if (VORTEX_PCM_TYPE(substream
->pcm
) != VORTEX_PCM_WT
) {
220 int dma
, type
= VORTEX_PCM_TYPE(substream
->pcm
);
221 /* Dealloc any routes. */
223 vortex_adb_allocroute(chip
, stream
->dma
,
224 stream
->nr_ch
, stream
->dir
,
229 vortex_adb_allocroute(chip
, -1,
230 params_channels(hw_params
),
231 substream
->stream
, type
,
234 spin_unlock_irq(&chip
->lock
);
237 stream
= substream
->runtime
->private_data
= &chip
->dma_adb
[dma
];
238 stream
->substream
= substream
;
240 vortex_adbdma_setbuffers(chip
, dma
,
241 params_period_bytes(hw_params
),
242 params_periods(hw_params
));
243 if (VORTEX_PCM_TYPE(substream
->pcm
) == VORTEX_PCM_ADB
) {
244 chip
->pcm_vol
[substream
->number
].active
= 1;
245 vortex_notify_pcm_vol_change(chip
->card
,
246 chip
->pcm_vol
[substream
->number
].kctl
, 1);
251 /* if (stream != NULL)
252 vortex_wt_allocroute(chip, substream->number, 0); */
253 vortex_wt_allocroute(chip
, substream
->number
,
254 params_channels(hw_params
));
255 stream
= substream
->runtime
->private_data
=
256 &chip
->dma_wt
[substream
->number
];
257 stream
->dma
= substream
->number
;
258 stream
->substream
= substream
;
259 vortex_wtdma_setbuffers(chip
, substream
->number
,
260 params_period_bytes(hw_params
),
261 params_periods(hw_params
));
264 spin_unlock_irq(&chip
->lock
);
268 /* hw_free callback */
269 static int snd_vortex_pcm_hw_free(struct snd_pcm_substream
*substream
)
271 vortex_t
*chip
= snd_pcm_substream_chip(substream
);
272 stream_t
*stream
= (stream_t
*) (substream
->runtime
->private_data
);
274 spin_lock_irq(&chip
->lock
);
275 // Delete audio routes.
276 if (VORTEX_PCM_TYPE(substream
->pcm
) != VORTEX_PCM_WT
) {
277 if (stream
!= NULL
) {
278 if (VORTEX_PCM_TYPE(substream
->pcm
) == VORTEX_PCM_ADB
) {
279 chip
->pcm_vol
[substream
->number
].active
= 0;
280 vortex_notify_pcm_vol_change(chip
->card
,
281 chip
->pcm_vol
[substream
->number
].kctl
,
284 vortex_adb_allocroute(chip
, stream
->dma
,
285 stream
->nr_ch
, stream
->dir
,
293 vortex_wt_allocroute(chip
, stream
->dma
, 0);
296 substream
->runtime
->private_data
= NULL
;
297 spin_unlock_irq(&chip
->lock
);
302 /* prepare callback */
303 static int snd_vortex_pcm_prepare(struct snd_pcm_substream
*substream
)
305 vortex_t
*chip
= snd_pcm_substream_chip(substream
);
306 struct snd_pcm_runtime
*runtime
= substream
->runtime
;
307 stream_t
*stream
= (stream_t
*) substream
->runtime
->private_data
;
308 int dma
= stream
->dma
, fmt
, dir
;
310 // set up the hardware with the current configuration.
311 if (substream
->stream
== SNDRV_PCM_STREAM_PLAYBACK
)
315 fmt
= vortex_alsafmt_aspfmt(runtime
->format
, chip
);
316 spin_lock_irq(&chip
->lock
);
317 if (VORTEX_PCM_TYPE(substream
->pcm
) != VORTEX_PCM_WT
) {
318 vortex_adbdma_setmode(chip
, dma
, 1, dir
, fmt
,
319 runtime
->channels
== 1 ? 0 : 1, 0);
320 vortex_adbdma_setstartbuffer(chip
, dma
, 0);
321 if (VORTEX_PCM_TYPE(substream
->pcm
) != VORTEX_PCM_SPDIF
)
322 vortex_adb_setsrc(chip
, dma
, runtime
->rate
, dir
);
326 vortex_wtdma_setmode(chip
, dma
, 1, fmt
, 0, 0);
327 // FIXME: Set rate (i guess using vortex_wt_writereg() somehow).
328 vortex_wtdma_setstartbuffer(chip
, dma
, 0);
331 spin_unlock_irq(&chip
->lock
);
335 /* trigger callback */
336 static int snd_vortex_pcm_trigger(struct snd_pcm_substream
*substream
, int cmd
)
338 vortex_t
*chip
= snd_pcm_substream_chip(substream
);
339 stream_t
*stream
= (stream_t
*) substream
->runtime
->private_data
;
340 int dma
= stream
->dma
;
342 spin_lock(&chip
->lock
);
344 case SNDRV_PCM_TRIGGER_START
:
345 // do something to start the PCM engine
346 //printk(KERN_INFO "vortex: start %d\n", dma);
347 stream
->fifo_enabled
= 1;
348 if (VORTEX_PCM_TYPE(substream
->pcm
) != VORTEX_PCM_WT
) {
349 vortex_adbdma_resetup(chip
, dma
);
350 vortex_adbdma_startfifo(chip
, dma
);
354 dev_info(chip
->card
->dev
, "wt start %d\n", dma
);
355 vortex_wtdma_startfifo(chip
, dma
);
359 case SNDRV_PCM_TRIGGER_STOP
:
360 // do something to stop the PCM engine
361 //printk(KERN_INFO "vortex: stop %d\n", dma);
362 stream
->fifo_enabled
= 0;
363 if (VORTEX_PCM_TYPE(substream
->pcm
) != VORTEX_PCM_WT
)
364 vortex_adbdma_stopfifo(chip
, dma
);
367 dev_info(chip
->card
->dev
, "wt stop %d\n", dma
);
368 vortex_wtdma_stopfifo(chip
, dma
);
372 case SNDRV_PCM_TRIGGER_PAUSE_PUSH
:
373 //printk(KERN_INFO "vortex: pause %d\n", dma);
374 if (VORTEX_PCM_TYPE(substream
->pcm
) != VORTEX_PCM_WT
)
375 vortex_adbdma_pausefifo(chip
, dma
);
378 vortex_wtdma_pausefifo(chip
, dma
);
381 case SNDRV_PCM_TRIGGER_PAUSE_RELEASE
:
382 //printk(KERN_INFO "vortex: resume %d\n", dma);
383 if (VORTEX_PCM_TYPE(substream
->pcm
) != VORTEX_PCM_WT
)
384 vortex_adbdma_resumefifo(chip
, dma
);
387 vortex_wtdma_resumefifo(chip
, dma
);
391 spin_unlock(&chip
->lock
);
394 spin_unlock(&chip
->lock
);
398 /* pointer callback */
399 static snd_pcm_uframes_t
snd_vortex_pcm_pointer(struct snd_pcm_substream
*substream
)
401 vortex_t
*chip
= snd_pcm_substream_chip(substream
);
402 stream_t
*stream
= (stream_t
*) substream
->runtime
->private_data
;
403 int dma
= stream
->dma
;
404 snd_pcm_uframes_t current_ptr
= 0;
406 spin_lock(&chip
->lock
);
407 if (VORTEX_PCM_TYPE(substream
->pcm
) != VORTEX_PCM_WT
)
408 current_ptr
= vortex_adbdma_getlinearpos(chip
, dma
);
411 current_ptr
= vortex_wtdma_getlinearpos(chip
, dma
);
413 //printk(KERN_INFO "vortex: pointer = 0x%x\n", current_ptr);
414 spin_unlock(&chip
->lock
);
415 current_ptr
= bytes_to_frames(substream
->runtime
, current_ptr
);
416 if (current_ptr
>= substream
->runtime
->buffer_size
)
422 static const struct snd_pcm_ops snd_vortex_playback_ops
= {
423 .open
= snd_vortex_pcm_open
,
424 .close
= snd_vortex_pcm_close
,
425 .hw_params
= snd_vortex_pcm_hw_params
,
426 .hw_free
= snd_vortex_pcm_hw_free
,
427 .prepare
= snd_vortex_pcm_prepare
,
428 .trigger
= snd_vortex_pcm_trigger
,
429 .pointer
= snd_vortex_pcm_pointer
,
433 * definitions of capture are omitted here...
436 static const char * const vortex_pcm_prettyname
[VORTEX_PCM_LAST
] = {
443 static const char * const vortex_pcm_name
[VORTEX_PCM_LAST
] = {
453 static int snd_vortex_spdif_info(struct snd_kcontrol
*kcontrol
, struct snd_ctl_elem_info
*uinfo
)
455 uinfo
->type
= SNDRV_CTL_ELEM_TYPE_IEC958
;
460 static int snd_vortex_spdif_mask_get(struct snd_kcontrol
*kcontrol
, struct snd_ctl_elem_value
*ucontrol
)
462 ucontrol
->value
.iec958
.status
[0] = 0xff;
463 ucontrol
->value
.iec958
.status
[1] = 0xff;
464 ucontrol
->value
.iec958
.status
[2] = 0xff;
465 ucontrol
->value
.iec958
.status
[3] = IEC958_AES3_CON_FS
;
469 static int snd_vortex_spdif_get(struct snd_kcontrol
*kcontrol
, struct snd_ctl_elem_value
*ucontrol
)
471 vortex_t
*vortex
= snd_kcontrol_chip(kcontrol
);
472 ucontrol
->value
.iec958
.status
[0] = 0x00;
473 ucontrol
->value
.iec958
.status
[1] = IEC958_AES1_CON_ORIGINAL
|IEC958_AES1_CON_DIGDIGCONV_ID
;
474 ucontrol
->value
.iec958
.status
[2] = 0x00;
475 switch (vortex
->spdif_sr
) {
476 case 32000: ucontrol
->value
.iec958
.status
[3] = IEC958_AES3_CON_FS_32000
; break;
477 case 44100: ucontrol
->value
.iec958
.status
[3] = IEC958_AES3_CON_FS_44100
; break;
478 case 48000: ucontrol
->value
.iec958
.status
[3] = IEC958_AES3_CON_FS_48000
; break;
483 static int snd_vortex_spdif_put(struct snd_kcontrol
*kcontrol
, struct snd_ctl_elem_value
*ucontrol
)
485 vortex_t
*vortex
= snd_kcontrol_chip(kcontrol
);
486 int spdif_sr
= 48000;
487 switch (ucontrol
->value
.iec958
.status
[3] & IEC958_AES3_CON_FS
) {
488 case IEC958_AES3_CON_FS_32000
: spdif_sr
= 32000; break;
489 case IEC958_AES3_CON_FS_44100
: spdif_sr
= 44100; break;
490 case IEC958_AES3_CON_FS_48000
: spdif_sr
= 48000; break;
492 if (spdif_sr
== vortex
->spdif_sr
)
494 vortex
->spdif_sr
= spdif_sr
;
495 vortex_spdif_init(vortex
, vortex
->spdif_sr
, 1);
500 static const struct snd_kcontrol_new snd_vortex_mixer_spdif
[] = {
502 .iface
= SNDRV_CTL_ELEM_IFACE_PCM
,
503 .name
= SNDRV_CTL_NAME_IEC958("",PLAYBACK
,DEFAULT
),
504 .info
= snd_vortex_spdif_info
,
505 .get
= snd_vortex_spdif_get
,
506 .put
= snd_vortex_spdif_put
,
509 .access
= SNDRV_CTL_ELEM_ACCESS_READ
,
510 .iface
= SNDRV_CTL_ELEM_IFACE_PCM
,
511 .name
= SNDRV_CTL_NAME_IEC958("",PLAYBACK
,CON_MASK
),
512 .info
= snd_vortex_spdif_info
,
513 .get
= snd_vortex_spdif_mask_get
517 /* subdevice PCM Volume control */
519 static int snd_vortex_pcm_vol_info(struct snd_kcontrol
*kcontrol
,
520 struct snd_ctl_elem_info
*uinfo
)
522 vortex_t
*vortex
= snd_kcontrol_chip(kcontrol
);
523 uinfo
->type
= SNDRV_CTL_ELEM_TYPE_INTEGER
;
524 uinfo
->count
= (VORTEX_IS_QUAD(vortex
) ? 4 : 2);
525 uinfo
->value
.integer
.min
= -128;
526 uinfo
->value
.integer
.max
= 32;
530 static int snd_vortex_pcm_vol_get(struct snd_kcontrol
*kcontrol
,
531 struct snd_ctl_elem_value
*ucontrol
)
534 vortex_t
*vortex
= snd_kcontrol_chip(kcontrol
);
535 int subdev
= kcontrol
->id
.subdevice
;
536 struct pcm_vol
*p
= &vortex
->pcm_vol
[subdev
];
537 int max_chn
= (VORTEX_IS_QUAD(vortex
) ? 4 : 2);
538 for (i
= 0; i
< max_chn
; i
++)
539 ucontrol
->value
.integer
.value
[i
] = p
->vol
[i
];
543 static int snd_vortex_pcm_vol_put(struct snd_kcontrol
*kcontrol
,
544 struct snd_ctl_elem_value
*ucontrol
)
550 vortex_t
*vortex
= snd_kcontrol_chip(kcontrol
);
551 int subdev
= kcontrol
->id
.subdevice
;
552 struct pcm_vol
*p
= &vortex
->pcm_vol
[subdev
];
553 int max_chn
= (VORTEX_IS_QUAD(vortex
) ? 4 : 2);
554 for (i
= 0; i
< max_chn
; i
++) {
555 if (p
->vol
[i
] != ucontrol
->value
.integer
.value
[i
]) {
556 p
->vol
[i
] = ucontrol
->value
.integer
.value
[i
];
558 switch (vortex
->dma_adb
[p
->dma
].nr_ch
) {
564 mixin
= p
->mixin
[(i
< 2) ? i
: (i
- 2)];
571 vortex_mix_setinputvolumebyte(vortex
,
572 vortex
->mixplayb
[i
], mixin
, vol
);
580 static const DECLARE_TLV_DB_MINMAX(vortex_pcm_vol_db_scale
, -9600, 2400);
582 static const struct snd_kcontrol_new snd_vortex_pcm_vol
= {
583 .iface
= SNDRV_CTL_ELEM_IFACE_PCM
,
584 .name
= "PCM Playback Volume",
585 .access
= SNDRV_CTL_ELEM_ACCESS_READWRITE
|
586 SNDRV_CTL_ELEM_ACCESS_TLV_READ
|
587 SNDRV_CTL_ELEM_ACCESS_INACTIVE
,
588 .info
= snd_vortex_pcm_vol_info
,
589 .get
= snd_vortex_pcm_vol_get
,
590 .put
= snd_vortex_pcm_vol_put
,
591 .tlv
= { .p
= vortex_pcm_vol_db_scale
},
594 /* create a pcm device */
595 static int snd_vortex_new_pcm(vortex_t
*chip
, int idx
, int nr
)
598 struct snd_kcontrol
*kctl
;
602 if (!chip
|| idx
< 0 || idx
>= VORTEX_PCM_LAST
)
605 /* idx indicates which kind of PCM device. ADB, SPDIF, I2S and A3D share the
606 * same dma engine. WT uses it own separate dma engine which can't capture. */
607 if (idx
== VORTEX_PCM_ADB
)
611 err
= snd_pcm_new(chip
->card
, vortex_pcm_prettyname
[idx
], idx
, nr
,
615 snprintf(pcm
->name
, sizeof(pcm
->name
),
616 "%s %s", CARD_NAME_SHORT
, vortex_pcm_name
[idx
]);
617 chip
->pcm
[idx
] = pcm
;
618 // This is an evil hack, but it saves a lot of duplicated code.
619 VORTEX_PCM_TYPE(pcm
) = idx
;
620 pcm
->private_data
= chip
;
622 snd_pcm_set_ops(pcm
, SNDRV_PCM_STREAM_PLAYBACK
,
623 &snd_vortex_playback_ops
);
624 if (idx
== VORTEX_PCM_ADB
)
625 snd_pcm_set_ops(pcm
, SNDRV_PCM_STREAM_CAPTURE
,
626 &snd_vortex_playback_ops
);
628 /* pre-allocation of Scatter-Gather buffers */
630 snd_pcm_set_managed_buffer_all(pcm
, SNDRV_DMA_TYPE_DEV_SG
,
631 &chip
->pci_dev
->dev
, 0x10000, 0x10000);
633 switch (VORTEX_PCM_TYPE(pcm
)) {
635 err
= snd_pcm_add_chmap_ctls(pcm
, SNDRV_PCM_STREAM_PLAYBACK
,
637 VORTEX_IS_QUAD(chip
) ? 4 : 2,
641 err
= snd_pcm_add_chmap_ctls(pcm
, SNDRV_PCM_STREAM_CAPTURE
,
642 snd_pcm_std_chmaps
, 2, 0, NULL
);
648 err
= snd_pcm_add_chmap_ctls(pcm
, SNDRV_PCM_STREAM_PLAYBACK
,
649 snd_pcm_std_chmaps
, 1, 0, NULL
);
656 if (VORTEX_PCM_TYPE(pcm
) == VORTEX_PCM_SPDIF
) {
657 for (i
= 0; i
< ARRAY_SIZE(snd_vortex_mixer_spdif
); i
++) {
658 kctl
= snd_ctl_new1(&snd_vortex_mixer_spdif
[i
], chip
);
661 err
= snd_ctl_add(chip
->card
, kctl
);
666 if (VORTEX_PCM_TYPE(pcm
) == VORTEX_PCM_ADB
) {
667 for (i
= 0; i
< NR_PCM
; i
++) {
668 chip
->pcm_vol
[i
].active
= 0;
669 chip
->pcm_vol
[i
].dma
= -1;
670 kctl
= snd_ctl_new1(&snd_vortex_pcm_vol
, chip
);
673 chip
->pcm_vol
[i
].kctl
= kctl
;
675 kctl
->id
.subdevice
= i
;
676 err
= snd_ctl_add(chip
->card
, kctl
);