alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
* ASoc: soc_core.c stream direction from snd_soc_dai
@ 2020-03-11 22:54 Matt Flax
  2020-03-12 22:55 ` Pierre-Louis Bossart
  0 siblings, 1 reply; 9+ messages in thread
From: Matt Flax @ 2020-03-11 22:54 UTC (permalink / raw)
  To: alsa-devel

Hi there,

A large number of audio codecs allow different formats for playback and 
capture. This becomes very useful when there are different latencies 
between playback and capture hardware data lines. For example digital 
isolation chips typically have a 1 bit delay in propagation as the bit 
clock rate gets faster for higher sample rates. By setting the capture 
and playback formats to differ by one or two bit clock cycles, the delay 
problem is solved.

There doesn't seem to be a simple way to detect stream direction in the 
codec driver's set_fmt function.

The snd_soc_runtime_set_dai_fmt function :

https://github.com/torvalds/linux/blob/master/sound/soc/soc-core.c#L1480

calls the snd_soc_dai_set_fmt function :

https://github.com/torvalds/linux/blob/master/sound/soc/soc-dai.c#L101

which calls the set_fmt function :

https://github.com/torvalds/linux/blob/master/include/sound/soc-dai.h#L189


The snd_soc_dai_ops set_fmt function is defined as :

     int (*set_fmt)(struct snd_soc_dai *dai, unsigned int fmt);


Is there a simple way to find the stream direction from a snd_soc_dai ?

If the stream direction can be detected then the playback and capture 
formats can be set independently for the codec.

It there a different way to set the playback and capture formats for the 
codec independently at runtime, depending on the sample rate ?

Matt


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2021-02-26 17:08 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-11 22:54 ASoc: soc_core.c stream direction from snd_soc_dai Matt Flax
2020-03-12 22:55 ` Pierre-Louis Bossart
2020-03-12 23:19   ` Matt Flax
2020-03-13  3:56     ` Matt Flax
2020-03-13  9:59       ` Lars-Peter Clausen
2021-02-20  9:29         ` Shengjiu Wang
2021-02-23 13:57           ` Mark Brown
2021-02-26  5:58             ` Shengjiu Wang
2021-02-26 17:06               ` Mark Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).