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
35 struct rsnd_kctrl_cfg_s sen; /* sync convert enable */
36 struct rsnd_kctrl_cfg_s sync; /* sync convert */
43 #define rsnd_src_get(priv, id) ((struct rsnd_src *)(priv->src) + id)
44 #define rsnd_src_nr(priv) ((priv)->src_nr)
45 #define rsnd_src_sync_is_enabled(mod) (rsnd_mod_to_src(mod)->sen.val)
53 ((pos) = (struct rsnd_src *)(priv)->src + i); \
58 * image of SRC (Sampling Rate Converter)
60 * 96kHz <-> +-----+ 48kHz +-----+ 48kHz +-------+
61 * 48kHz <-> | SRC | <------> | SSI | <-----> | codec |
62 * 44.1kHz <-> +-----+ +-----+ +-------+
103 convert_rate = src->current_sync_rate;
109 convert_rate = runtime->rate;
120 unsigned int rate = 0;
125 * runtime_rate -> [SRC] -> convert_rate
128 * convert_rate -> [SRC] -> runtime_rate
132 return runtime->rate;
135 * return convert rate if SRC is used,
136 * otherwise, return runtime->rate as usual
139 rate = rsnd_src_convert_rate(io, src_mod);
141 if (!rate)
142 rate = runtime->rate;
144 return rate;
148 0x01800000, /* 6 - 1/6 */
149 0x01000000, /* 6 - 1/4 */
150 0x00c00000, /* 6 - 1/3 */
151 0x00800000, /* 6 - 1/2 */
152 0x00600000, /* 6 - 2/3 */
153 0x00400000, /* 6 - 1 */
157 0x02400000, /* 6 - 1/6 */
158 0x01800000, /* 6 - 1/4 */
159 0x01200000, /* 6 - 1/3 */
160 0x00c00000, /* 6 - 1/2 */
161 0x00900000, /* 6 - 2/3 */
162 0x00600000, /* 6 - 1 */
166 0x00100060, /* 6 - 1/6 */
167 0x00100040, /* 6 - 1/4 */
168 0x00100030, /* 6 - 1/3 */
169 0x00100020, /* 6 - 1/2 */
170 0x00100020, /* 6 - 2/3 */
171 0x00100020, /* 6 - 1 */
208 int inc, cnt, rate;
220 new_rate = src->sync.val;
226 if (new_rate == src->current_sync_rate)
235 cnt = abs(new_rate - fout) / inc;
237 inc *= -1;
244 rate = fout;
247 rate += inc;
248 do_div(val, rate);
258 src->current_sync_rate = new_rate;
287 /* 6 - 1/6 are very enough ratio for SRC_BSDSR */
415 int irq = src->irq;
423 * IRQ is not supported on non-DT
494 * Enable SRC output if you want to use sync convert together with DVC
521 src->sync.val =
522 src->current_sync_rate = 0;
548 src->sync.val =
549 src->current_sync_rate = 0;
560 spin_lock(&priv->lock);
572 spin_unlock(&priv->lock);
575 snd_pcm_stop_xrun(io->substream);
595 dev_warn(dev, "\"SRC Out Rate\" can use during running\n");
609 int irq = src->irq;
614 * IRQ is not supported on non-DT
626 ret = rsnd_dma_attach(io, mod, &src->dma);
639 * enable SRC sync convert if possible
643 * It can't use SRC Synchronous convert
650 * enable sync convert
654 "SRC Out Rate Switch" :
655 "SRC In Rate Switch",
658 &src->sen, 1);
664 "SRC Out Rate" :
665 "SRC In Rate",
668 &src->sync, 192000);
734 ret = -EINVAL;
740 ret = -ENOMEM;
744 priv->src_nr = nr;
745 priv->src = src;
754 ret = -EINVAL;
764 src->irq = irq_of_parse_and_map(np, 0);
765 if (!src->irq) {
766 ret = -EINVAL;