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; in rsnd_src_convert_rate()
110 convert_rate = runtime->rate; in rsnd_src_convert_rate()
121 unsigned int rate = 0; in rsnd_src_get_rate() local
126 * runtime_rate -> [SRC] -> convert_rate in rsnd_src_get_rate()
129 * convert_rate -> [SRC] -> runtime_rate in rsnd_src_get_rate()
133 return runtime->rate; in rsnd_src_get_rate()
136 * return convert rate if SRC is used, in rsnd_src_get_rate()
137 * otherwise, return runtime->rate as usual in rsnd_src_get_rate()
140 rate = rsnd_src_convert_rate(io, src_mod); in rsnd_src_get_rate()
142 if (!rate) in rsnd_src_get_rate()
143 rate = runtime->rate; in rsnd_src_get_rate()
145 return rate; in rsnd_src_get_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; in rsnd_src_set_convert_rate() local
221 new_rate = src->sync.val; in rsnd_src_set_convert_rate()
227 if (new_rate == src->current_sync_rate) in rsnd_src_set_convert_rate()
236 cnt = abs(new_rate - fout) / inc; in rsnd_src_set_convert_rate()
238 inc *= -1; in rsnd_src_set_convert_rate()
245 rate = fout; in rsnd_src_set_convert_rate()
248 rate += inc; in rsnd_src_set_convert_rate()
249 do_div(val, rate); in rsnd_src_set_convert_rate()
259 src->current_sync_rate = new_rate; in rsnd_src_set_convert_rate()
288 /* 6 - 1/6 are very enough ratio for SRC_BSDSR */ in rsnd_src_init_convert_rate()
416 int irq = src->irq; in rsnd_src_irq()
424 * IRQ is not supported on non-DT in rsnd_src_irq()
495 * Enable SRC output if you want to use sync convert together with DVC in rsnd_src_start()
522 src->sync.val = in rsnd_src_init()
523 src->current_sync_rate = 0; in rsnd_src_init()
549 src->sync.val = in rsnd_src_quit()
550 src->current_sync_rate = 0; in rsnd_src_quit()
561 spin_lock(&priv->lock); in __rsnd_src_interrupt()
573 spin_unlock(&priv->lock); in __rsnd_src_interrupt()
576 snd_pcm_stop_xrun(io->substream); in __rsnd_src_interrupt()
596 dev_warn(dev, "\"SRC Out Rate\" can use during running\n"); in rsnd_src_kctrl_accept_runtime()
610 int irq = src->irq; in rsnd_src_probe_()
615 * IRQ is not supported on non-DT in rsnd_src_probe_()
627 ret = rsnd_dma_attach(io, mod, &src->dma); in rsnd_src_probe_()
640 * enable SRC sync convert if possible in rsnd_src_pcm_new()
644 * It can't use SRC Synchronous convert in rsnd_src_pcm_new()
651 * enable sync convert in rsnd_src_pcm_new()
655 "SRC Out Rate Switch" : in rsnd_src_pcm_new()
656 "SRC In Rate Switch", in rsnd_src_pcm_new()
659 &src->sen, 1); in rsnd_src_pcm_new()
665 "SRC Out Rate" : in rsnd_src_pcm_new()
666 "SRC In Rate", in rsnd_src_pcm_new()
669 &src->sync, 192000); in rsnd_src_pcm_new()
731 ret = -EINVAL; in rsnd_src_probe()
737 ret = -ENOMEM; in rsnd_src_probe()
741 priv->src_nr = nr; in rsnd_src_probe()
742 priv->src = src; in rsnd_src_probe()
751 ret = -EINVAL; in rsnd_src_probe()
761 src->irq = irq_of_parse_and_map(np, 0); in rsnd_src_probe()
762 if (!src->irq) { in rsnd_src_probe()
763 ret = -EINVAL; in rsnd_src_probe()