Lines Matching +full:src +full:- +full:2

1 // SPDX-License-Identifier: GPL-2.0
3 // Renesas R-Car SRC support
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
28 #define SRC_NAME "src"
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 <-> +-----+ +-----+ +-------+
95 struct rsnd_src *src = rsnd_mod_to_src(mod);
104 convert_rate = src->current_sync_rate;
110 convert_rate = runtime->rate;
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
143 rate = runtime->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 */
176 0x00000006, /* 1 to 2 */
185 0x00000006, /* 1 to 2 */
194 0x00000006, /* 1 to 2 */
195 0x00000006, /* 1 to 2 */
196 0x00000006, /* 1 to 2 */
197 0x00000006, /* 1 to 2 */
198 0x00000006, /* 1 to 2 */
199 0x00000006, /* 1 to 2 */
207 struct rsnd_src *src = rsnd_mod_to_src(mod);
221 new_rate = src->sync.val;
227 if (new_rate == src->current_sync_rate)
236 cnt = abs(new_rate - fout) / inc;
238 inc *= -1;
241 * After start running SRC, we can update only SRC_IFSVR
259 src->current_sync_rate = new_rate;
288 /* 6 - 1/6 are very enough ratio for SRC_BSDSR */
344 case 2:
414 struct rsnd_src *src = rsnd_mod_to_src(mod);
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
518 struct rsnd_src *src = rsnd_mod_to_src(mod);
522 src->sync.val =
523 src->current_sync_rate = 0;
542 struct rsnd_src *src = rsnd_mod_to_src(mod);
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");
605 struct rsnd_src *src = rsnd_mod_to_src(mod);
607 int irq = src->irq;
612 * IRQ is not supported on non-DT
624 ret = rsnd_dma_attach(io, mod, &src->dma);
633 struct rsnd_src *src = rsnd_mod_to_src(mod);
637 * enable SRC sync convert if possible
641 * It can't use SRC Synchronous 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);
716 struct rsnd_src *src;
727 ret = -EINVAL;
731 src = devm_kcalloc(dev, nr, sizeof(*src), GFP_KERNEL);
732 if (!src) {
733 ret = -ENOMEM;
737 priv->src_nr = nr;
738 priv->src = src;
747 ret = -EINVAL;
751 src = rsnd_src_get(priv, i);
756 src->irq = irq_of_parse_and_map(np, 0);
757 if (!src->irq) {
758 ret = -EINVAL;
768 ret = rsnd_mod_init(priv, rsnd_mod_get(src),
787 struct rsnd_src *src;
790 for_each_rsnd_src(src, priv, i) {
791 rsnd_mod_quit(rsnd_mod_get(src));