Lines Matching +full:ssiu +full:-

1 // SPDX-License-Identifier: GPL-2.0
3 // Renesas R-Car SSIU/SSI support
107 ((pos) = ((struct rsnd_ssi *)(priv)->ssi + i)); \
110 #define rsnd_ssi_get(priv, id) ((struct rsnd_ssi *)(priv->ssi) + id)
111 #define rsnd_ssi_nr(priv) ((priv)->ssi_nr)
292 if (ssi->usrcnt > 0) {
293 if (ssi->rate != rate) {
295 return -EINVAL;
298 if (ssi->chan != chan) {
300 return -EINVAL;
306 ret = -EIO;
325 ssi->cr_clk = FORCE | rsnd_rdai_width_to_swl(rdai) |
327 ssi->wsr = CONT;
328 ssi->rate = rate;
329 ssi->chan = chan;
354 if (ssi->usrcnt > 1)
357 ssi->cr_clk = 0;
358 ssi->rate = 0;
359 ssi->chan = 0;
372 u32 cr_own = ssi->cr_own;
373 u32 cr_mode = ssi->cr_mode;
374 u32 wsr = ssi->wsr;
388 if (rdai->bit_clk_inv)
390 if (rdai->frm_clk_inv && !is_tdm)
392 if (rdai->data_alignment)
394 if (rdai->sys_delay)
418 width = snd_pcm_format_width(runtime->format);
421 * The SWL and DWL bits in SSICR should be fixed at 32-bit
452 ssi->cr_own = cr_own;
453 ssi->cr_mode = cr_mode;
454 ssi->wsr = wsr;
461 rsnd_mod_write(mod, SSIWSR, ssi->wsr);
462 rsnd_mod_write(mod, SSICR, ssi->cr_own |
463 ssi->cr_clk |
464 ssi->cr_mode |
465 ssi->cr_en);
485 ssi->usrcnt++;
511 if (!ssi->usrcnt) {
513 return -EIO;
520 ssi->usrcnt--;
522 if (!ssi->usrcnt) {
523 ssi->cr_own = 0;
524 ssi->cr_mode = 0;
525 ssi->wsr = 0;
539 if (fmt_width > rdai->chan_width) {
543 dev_err(dev, "invalid combination of slot-width and format-data-width\n");
544 return -EINVAL;
560 * EN will be set via SSIU :: SSI_CONTROL
573 ssi->cr_en = EN;
575 rsnd_mod_write(mod, SSICR, ssi->cr_own |
576 ssi->cr_clk |
577 ssi->cr_mode |
578 ssi->cr_en);
596 cr = ssi->cr_own |
597 ssi->cr_clk;
605 rsnd_mod_write(mod, SSICR, cr | ssi->cr_en);
609 /* In multi-SSI mode, stop is performed by setting ssi0129 in
622 ssi->cr_en = 0;
681 spin_lock(&priv->lock);
705 spin_unlock(&priv->lock);
711 snd_pcm_stop_xrun(io->substream);
738 * 1) start Capture -> SSI0/SSI1 are started.
739 * 2) start Playback -> SSI0 doesn't work, because it is already
745 * IO-0: SRC0 -> CTU1 -+-> MUX -> DVC -> SSIU -> SSI0
747 * IO-1: SRC1 -> CTU2 -+
749 * 1) start IO-0 -> start SSI0
750 * 2) start IO-1 -> SSI0 doesn't need to start, because it is
754 return &io->parent_ssi_status;
815 * SSIP/SSIU/IRQ are not needed on
833 * mod->status.
838 ret = request_irq(ssi->irq,
862 free_irq(ssi->irq, mod);
878 u32 *buf = (u32 *)(runtime->dma_area + ssi->byte_pos);
883 if (snd_pcm_format_width(runtime->format) == 24)
896 byte_pos = ssi->byte_pos + sizeof(*buf);
898 if (byte_pos >= ssi->next_period_byte) {
899 int period_pos = byte_pos / ssi->byte_per_period;
901 if (period_pos >= runtime->periods) {
906 ssi->next_period_byte = (period_pos + 1) * ssi->byte_per_period;
911 WRITE_ONCE(ssi->byte_pos, byte_pos);
924 ssi->byte_pos = 0;
925 ssi->byte_per_period = runtime->period_size *
926 runtime->channels *
928 ssi->next_period_byte = ssi->byte_per_period;
941 *pointer = bytes_to_frames(runtime, READ_ONCE(ssi->byte_pos));
968 * SSIP/SSIU/IRQ/DMA are not needed on
979 ret = rsnd_dma_attach(io, mod, &io->dma);
997 mod->ops = &rsnd_ssi_pio_ops;
1012 * It should use "rcar_sound,ssiu" on DT.
1015 * If it has "rcar_sound.ssiu", it will be used.
1041 seq_printf(m, "bit_clk_inv: %d\n", rdai->bit_clk_inv);
1042 seq_printf(m, "frm_clk_inv: %d\n", rdai->frm_clk_inv);
1048 seq_printf(m, "chan: %d\n", ssi->chan);
1049 seq_printf(m, "user: %d\n", ssi->usrcnt);
1078 return mod->ops == &rsnd_ssi_dma_ops;
1097 /* try SSI -> SSIM1 -> SSIM2 -> SSIM3 */
1136 rsnd_ssi_connect(mod, &rdai->playback);
1138 rsnd_ssi_connect(mod, &rdai->capture);
1174 return -EINVAL;
1178 ret = -EINVAL;
1184 ret = -ENOMEM;
1188 priv->ssi = ssi;
1189 priv->ssi_nr = nr;
1198 ret = -EINVAL;
1215 if (of_property_read_bool(np, "shared-pin"))
1218 if (of_property_read_bool(np, "no-busif"))
1221 ssi->irq = irq_of_parse_and_map(np, 0);
1222 if (!ssi->irq) {
1223 ret = -EINVAL;
1228 if (of_property_read_bool(np, "pio-transfer"))