[alsa-devel] How to specify data format if playback/capture were different ?
Hi Mark, and ALSA ML
Now, I'm creating ak4554 AD/DA. My question is about data format.
If my understand is correct, we can specify cpu/codec deivce data format by using
snd_soc_dai_set_fmt(dai, SND_SOC_DAIFMT_xxx);
But, ak4554 case, data formats are playback : SND_SOC_DAIFMT_RIGHT_J capture : SND_SOC_DAIFMT_LEFT_J and, it can't exchange this data format.
CPU driver should set these information for ak4554 when playback/capture.
Then, how to specify these data format on ALSA SoC ?
Best regards --- Kuninori Morimoto
On 05/21/2013 04:47 AM, Kuninori Morimoto wrote:
Hi Mark, and ALSA ML
Now, I'm creating ak4554 AD/DA. My question is about data format.
If my understand is correct, we can specify cpu/codec deivce data format by using
snd_soc_dai_set_fmt(dai, SND_SOC_DAIFMT_xxx);
But, ak4554 case, data formats are playback : SND_SOC_DAIFMT_RIGHT_J capture : SND_SOC_DAIFMT_LEFT_J and, it can't exchange this data format.
CPU driver should set these information for ak4554 when playback/capture.
Then, how to specify these data format on ALSA SoC ?
You can add two different DAIs one for playback one for capture. Then you can specify the format for each.
- Lars
Hi Lars
Thank you for your comment
But, ak4554 case, data formats are playback : SND_SOC_DAIFMT_RIGHT_J capture : SND_SOC_DAIFMT_LEFT_J and, it can't exchange this data format.
CPU driver should set these information for ak4554 when playback/capture.
Then, how to specify these data format on ALSA SoC ?
You can add two different DAIs one for playback one for capture. Then you can specify the format for each.
I understand, but still 50%.
I'm creating new "cpu" driver now too. And, fortunately, my current "cpu" can do it as flexibility. But, my old cpu driver ${LINUX}/sound/soc/sh/fsi.c was this
static struct snd_soc_dai_driver fsi_soc_dai[] = { { .name = "fsia-dai", .playback = { ... }, .capture = { ... }, ...
This means, "fsia-dai" is already including "playback" and "capture". Sould fsi driver be below if "fsi" and "ak4554" are connected ? Is it normal ?
static struct snd_soc_dai_driver fsi_soc_dai[] = { { .name = "fsia-dai", .playback = { ... }, .capture = { ... }, }, { .name = "fsia-playback-dai", .playback = { .... } }, { .name = "fsia-captrue-dai", .capture = { .... } }
Best regards --- Kuninori Morimoto
Hi again
But, ak4554 case, data formats are playback : SND_SOC_DAIFMT_RIGHT_J capture : SND_SOC_DAIFMT_LEFT_J and, it can't exchange this data format.
CPU driver should set these information for ak4554 when playback/capture.
Then, how to specify these data format on ALSA SoC ?
You can add two different DAIs one for playback one for capture. Then you can specify the format for each.
1 more question.
On ak4554 side driver, I guess, it will be
struct snd_soc_dai_driver ak4554_playback_dai = { .name = "ak4554-playback", .playback = { ... }, }
struct snd_soc_dai_driver ak4554_captrure_dai = { .name = "ak4554-captrure", .capture = { ... }, };
But, ak4554 needs .symmetric_rates between playback <--> capture. Is it possible ? Or, am I misunderstanding ?
Best regards --- Kuninori Morimoto
On 05/22/2013 03:12 AM, Kuninori Morimoto wrote:
Hi again
But, ak4554 case, data formats are playback : SND_SOC_DAIFMT_RIGHT_J capture : SND_SOC_DAIFMT_LEFT_J and, it can't exchange this data format.
CPU driver should set these information for ak4554 when playback/capture.
Then, how to specify these data format on ALSA SoC ?
You can add two different DAIs one for playback one for capture. Then you can specify the format for each.
1 more question.
On ak4554 side driver, I guess, it will be
struct snd_soc_dai_driver ak4554_playback_dai = { .name = "ak4554-playback", .playback = { ... }, }
struct snd_soc_dai_driver ak4554_captrure_dai = { .name = "ak4554-captrure", .capture = { ... }, };
You'll want to put both DAIs into an array which you can pass to snd_soc_register_codec, but otherwise it looks ok.
But, ak4554 needs .symmetric_rates between playback <--> capture. Is it possible ? Or, am I misunderstanding ?
Yes, that won't work, you'd have to implement this by hand.
- Lars
Hi Lars
struct snd_soc_dai_driver ak4554_playback_dai = { .name = "ak4554-playback", .playback = { ... }, }
struct snd_soc_dai_driver ak4554_captrure_dai = { .name = "ak4554-captrure", .capture = { ... }, };
You'll want to put both DAIs into an array which you can pass to snd_soc_register_codec, but otherwise it looks ok.
But, ak4554 needs .symmetric_rates between playback <--> capture. Is it possible ? Or, am I misunderstanding ?
Yes, that won't work, you'd have to implement this by hand.
OK, I understand, thank you.
But do you know why snd_soc_dai_set_fmt() doesn't support "setting for playback/capture only" ? Historical reason or system reason ? Can I try it ?
Best regards --- Kuninori Morimoto
On 05/22/2013 10:54 AM, Kuninori Morimoto wrote:
Hi Lars
struct snd_soc_dai_driver ak4554_playback_dai = { .name = "ak4554-playback", .playback = { ... }, }
struct snd_soc_dai_driver ak4554_captrure_dai = { .name = "ak4554-captrure", .capture = { ... }, };
You'll want to put both DAIs into an array which you can pass to snd_soc_register_codec, but otherwise it looks ok.
But, ak4554 needs .symmetric_rates between playback <--> capture. Is it possible ? Or, am I misunderstanding ?
Yes, that won't work, you'd have to implement this by hand.
OK, I understand, thank you.
But do you know why snd_soc_dai_set_fmt() doesn't support "setting for playback/capture only" ? Historical reason or system reason ?
I think it is rather unusual that you want or need to set different formats for capture and playback. Especially when BCLK and LRCLK are shared. That's probably why it isn't supported yet.
- Lars
Hi Lars
Thank you for your comments
But do you know why snd_soc_dai_set_fmt() doesn't support "setting for playback/capture only" ? Historical reason or system reason ?
I think it is rather unusual that you want or need to set different formats for capture and playback. Especially when BCLK and LRCLK are shared. That's probably why it isn't supported yet.
This (playback and capture wer different format) is first case for me. Maybe ak4554 is very special. OK, I understand, thank you very much
Best regards --- Kuninori Morimoto
On Thu, May 23, 2013 at 08:18:09PM -0700, Kuninori Morimoto wrote:
I think it is rather unusual that you want or need to set different formats for capture and playback. Especially when BCLK and LRCLK are shared. That's probably why it isn't supported yet.
This (playback and capture wer different format) is first case for me. Maybe ak4554 is very special. OK, I understand, thank you very much
The reason this is only supported is that there's an assumption that the DAI will have the same clocks for both directions - if the clocks can be formatted differently then it looks a lot like two separate interfaces.
It's also a bit odd to want to use different formats, there's rarely any reason to do that.
participants (3)
-
Kuninori Morimoto
-
Lars-Peter Clausen
-
Mark Brown