All of lore.kernel.org
 help / color / mirror / Atom feed
* How to specify data format if playback/capture were different ?
@ 2013-05-21  2:47 Kuninori Morimoto
  2013-05-21 11:58 ` Lars-Peter Clausen
  0 siblings, 1 reply; 9+ messages in thread
From: Kuninori Morimoto @ 2013-05-21  2:47 UTC (permalink / raw)
  To: Mark Brown; +Cc: Linux-ALSA, Simon, Liam Girdwood, Kuninori Morimoto


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

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

* Re: How to specify data format if playback/capture were different ?
  2013-05-21  2:47 How to specify data format if playback/capture were different ? Kuninori Morimoto
@ 2013-05-21 11:58 ` Lars-Peter Clausen
  2013-05-22  1:02   ` Kuninori Morimoto
  0 siblings, 1 reply; 9+ messages in thread
From: Lars-Peter Clausen @ 2013-05-21 11:58 UTC (permalink / raw)
  To: Kuninori Morimoto
  Cc: Linux-ALSA, Mark Brown, Liam Girdwood, Simon, 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

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

* Re: How to specify data format if playback/capture were different ?
  2013-05-21 11:58 ` Lars-Peter Clausen
@ 2013-05-22  1:02   ` Kuninori Morimoto
  2013-05-22  1:12     ` Kuninori Morimoto
  0 siblings, 1 reply; 9+ messages in thread
From: Kuninori Morimoto @ 2013-05-22  1:02 UTC (permalink / raw)
  To: Lars-Peter Clausen
  Cc: Linux-ALSA, Mark Brown, Liam Girdwood, Simon, Kuninori Morimoto


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

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

* Re: How to specify data format if playback/capture were different ?
  2013-05-22  1:02   ` Kuninori Morimoto
@ 2013-05-22  1:12     ` Kuninori Morimoto
  2013-05-22  8:43       ` Lars-Peter Clausen
  0 siblings, 1 reply; 9+ messages in thread
From: Kuninori Morimoto @ 2013-05-22  1:12 UTC (permalink / raw)
  To: Lars-Peter Clausen, Mark Brown
  Cc: Linux-ALSA, Simon, Liam Girdwood, 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

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

* Re: How to specify data format if playback/capture were different ?
  2013-05-22  1:12     ` Kuninori Morimoto
@ 2013-05-22  8:43       ` Lars-Peter Clausen
  2013-05-22  8:54         ` Kuninori Morimoto
  0 siblings, 1 reply; 9+ messages in thread
From: Lars-Peter Clausen @ 2013-05-22  8:43 UTC (permalink / raw)
  To: Kuninori Morimoto
  Cc: Linux-ALSA, Mark Brown, Liam Girdwood, Simon, 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

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

* Re: How to specify data format if playback/capture were different ?
  2013-05-22  8:43       ` Lars-Peter Clausen
@ 2013-05-22  8:54         ` Kuninori Morimoto
  2013-05-22 11:41           ` Lars-Peter Clausen
  0 siblings, 1 reply; 9+ messages in thread
From: Kuninori Morimoto @ 2013-05-22  8:54 UTC (permalink / raw)
  To: Lars-Peter Clausen
  Cc: Linux-ALSA, Mark Brown, Liam Girdwood, Simon, Kuninori Morimoto


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

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

* Re: How to specify data format if playback/capture were different ?
  2013-05-22  8:54         ` Kuninori Morimoto
@ 2013-05-22 11:41           ` Lars-Peter Clausen
  2013-05-24  3:18             ` Kuninori Morimoto
  0 siblings, 1 reply; 9+ messages in thread
From: Lars-Peter Clausen @ 2013-05-22 11:41 UTC (permalink / raw)
  To: Kuninori Morimoto
  Cc: Linux-ALSA, Mark Brown, Liam Girdwood, Simon, 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

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

* Re: How to specify data format if playback/capture were different ?
  2013-05-22 11:41           ` Lars-Peter Clausen
@ 2013-05-24  3:18             ` Kuninori Morimoto
  2013-05-25 20:03               ` Mark Brown
  0 siblings, 1 reply; 9+ messages in thread
From: Kuninori Morimoto @ 2013-05-24  3:18 UTC (permalink / raw)
  To: Lars-Peter Clausen
  Cc: Linux-ALSA, Mark Brown, Liam Girdwood, Simon, Kuninori Morimoto


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

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

* Re: How to specify data format if playback/capture were different ?
  2013-05-24  3:18             ` Kuninori Morimoto
@ 2013-05-25 20:03               ` Mark Brown
  0 siblings, 0 replies; 9+ messages in thread
From: Mark Brown @ 2013-05-25 20:03 UTC (permalink / raw)
  To: Kuninori Morimoto
  Cc: Linux-ALSA, Lars-Peter Clausen, Liam Girdwood, Simon, Kuninori Morimoto


[-- Attachment #1.1: Type: text/plain, Size: 727 bytes --]

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.

[-- Attachment #1.2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

[-- Attachment #2: Type: text/plain, Size: 0 bytes --]



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

end of thread, other threads:[~2013-05-26 20:37 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-05-21  2:47 How to specify data format if playback/capture were different ? Kuninori Morimoto
2013-05-21 11:58 ` Lars-Peter Clausen
2013-05-22  1:02   ` Kuninori Morimoto
2013-05-22  1:12     ` Kuninori Morimoto
2013-05-22  8:43       ` Lars-Peter Clausen
2013-05-22  8:54         ` Kuninori Morimoto
2013-05-22 11:41           ` Lars-Peter Clausen
2013-05-24  3:18             ` Kuninori Morimoto
2013-05-25 20:03               ` Mark Brown

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.