Lines Matching +full:convert +full:- +full:rate

1 // SPDX-License-Identifier: GPL-2.0
3 // Renesas R-Car SRC support
9 * You can use Synchronous Sampling Rate Convert (if no DVC)
11 * amixer set "SRC Out Rate" on
13 * amixer set "SRC Out Rate" 96000 // convert rate to 96000Hz
14 * amixer set "SRC Out Rate" 22050 // convert rate to 22050Hz
36 struct rsnd_kctrl_cfg_s sen; /* sync convert enable */
37 struct rsnd_kctrl_cfg_s sync; /* sync convert */
44 #define rsnd_src_get(priv, id) ((struct rsnd_src *)(priv->src) + id)
45 #define rsnd_src_nr(priv) ((priv)->src_nr)
46 #define rsnd_src_sync_is_enabled(mod) (rsnd_mod_to_src(mod)->sen.val)
54 ((pos) = (struct rsnd_src *)(priv)->src + i); \
59 * image of SRC (Sampling Rate Converter)
61 * 96kHz <-> +-----+ 48kHz +-----+ 48kHz +-------+
62 * 48kHz <-> | SRC | <------> | SSI | <-----> | codec |
63 * 44.1kHz <-> +-----+ +-----+ +-------+
104 convert_rate = src->current_sync_rate;
110 convert_rate = runtime->rate;
121 unsigned int rate = 0;
126 * runtime_rate -> [SRC] -> convert_rate
129 * convert_rate -> [SRC] -> runtime_rate
133 return runtime->rate;
136 * return convert rate if SRC is used,
137 * otherwise, return runtime->rate as usual
140 rate = rsnd_src_convert_rate(io, src_mod);
142 if (!rate)
143 rate = runtime->rate;
145 return rate;
149 0x01800000, /* 6 - 1/6 */
150 0x01000000, /* 6 - 1/4 */
151 0x00c00000, /* 6 - 1/3 */
152 0x00800000, /* 6 - 1/2 */
153 0x00600000, /* 6 - 2/3 */
154 0x00400000, /* 6 - 1 */
158 0x02400000, /* 6 - 1/6 */
159 0x01800000, /* 6 - 1/4 */
160 0x01200000, /* 6 - 1/3 */
161 0x00c00000, /* 6 - 1/2 */
162 0x00900000, /* 6 - 2/3 */
163 0x00600000, /* 6 - 1 */
167 0x00100060, /* 6 - 1/6 */
168 0x00100040, /* 6 - 1/4 */
169 0x00100030, /* 6 - 1/3 */
170 0x00100020, /* 6 - 1/2 */
171 0x00100020, /* 6 - 2/3 */
172 0x00100020, /* 6 - 1 */
209 int inc, cnt, rate;
221 new_rate = src->sync.val;
227 if (new_rate == src->current_sync_rate)
236 cnt = abs(new_rate - fout) / inc;
238 inc *= -1;
245 rate = fout;
248 rate += inc;
249 do_div(val, rate);
259 src->current_sync_rate = new_rate;
288 /* 6 - 1/6 are very enough ratio for SRC_BSDSR */
416 int irq = src->irq;
424 * IRQ is not supported on non-DT
495 * Enable SRC output if you want to use sync convert together with DVC
522 src->sync.val =
523 src->current_sync_rate = 0;
549 src->sync.val =
550 src->current_sync_rate = 0;
561 scoped_guard(spinlock, &priv->lock) {
573 snd_pcm_stop_xrun(io->substream);
593 dev_warn(dev, "\"SRC Out Rate\" can use during running\n");
607 int irq = src->irq;
612 * IRQ is not supported on non-DT
624 ret = rsnd_dma_attach(io, mod, &src->dma);
637 * enable SRC sync convert if possible
641 * It can't use SRC Synchronous convert
648 * enable sync convert
652 "SRC Out Rate Switch" :
653 "SRC In Rate Switch",
656 &src->sen, 1);
662 "SRC Out Rate" :
663 "SRC In Rate",
666 &src->sync, 192000);
727 ret = -EINVAL;
733 ret = -ENOMEM;
737 priv->src_nr = nr;
738 priv->src = src;
747 ret = -EINVAL;
756 src->irq = irq_of_parse_and_map(np, 0);
757 if (!src->irq) {
758 ret = -EINVAL;