All of lore.kernel.org
 help / color / mirror / Atom feed
* What is exact definition of "normal/inverted" FSYNC signal polarity?
@ 2015-08-31 16:40 Anatol Pomozov
  2015-08-31 18:02 ` Mark Brown
  0 siblings, 1 reply; 7+ messages in thread
From: Anatol Pomozov @ 2015-08-31 16:40 UTC (permalink / raw)
  To: alsa-devel
  Cc: 陳立峰, Mark Brown, Lars-Peter Clausen, lengo

Hi

I am trying to configure TegraX1 SoC and Realtek5677 codec. These two
drivers have different meaning of FSYNC polarity in TDM mode A format.

* TegraX1 driver thinks that "normal" polarity is when a frame starts
with FSYNC falling edge. TegraX1 applies it to all formats (I2S,
PCM/TDM mode A). And inverted FSYNC means that frame starts with
rising edge of FSYNC.

* RT5677 thinks that "normal" for I2S is "frame starts with falling
edge". And for TMD mode A "normal" means "frame starts with rising
FSYNC edge".

Thus normal/inverted FSYNC in TDM mode A are opposite at these 2
chips. Which one is correct? What is exact definition of
SND_SOC_DAIFMT_xB_yF constants in soc-dai.h?

I tried to google if I2S spec [1] defines FSYNC polarity but no luck.

It worth to clarify definition of BCLK polarity as well. I believe
"normal" BCLK is "line sensing happens at rising edge", "inverted"
BCLK - "line sensing happens at falling edge". Is it correct?

[1] https://web.archive.org/web/20060821114007/http://www.semiconductors.philips.com/acrobat_download/various/I2SBUS.pdf

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

* Re: What is exact definition of "normal/inverted" FSYNC signal polarity?
  2015-08-31 16:40 What is exact definition of "normal/inverted" FSYNC signal polarity? Anatol Pomozov
@ 2015-08-31 18:02 ` Mark Brown
  2015-08-31 19:05   ` Anatol Pomozov
  0 siblings, 1 reply; 7+ messages in thread
From: Mark Brown @ 2015-08-31 18:02 UTC (permalink / raw)
  To: Anatol Pomozov
  Cc: 陳立峰, alsa-devel, Lars-Peter Clausen, lengo


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

On Mon, Aug 31, 2015 at 09:40:04AM -0700, Anatol Pomozov wrote:

> I am trying to configure TegraX1 SoC and Realtek5677 codec. These two
> drivers have different meaning of FSYNC polarity in TDM mode A format.

The simplest thing to do is look at the datasheets for Wolfson parts
like the wm8731, they have some very clear diagrams of all the data
modes we support.

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

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



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

* Re: What is exact definition of "normal/inverted" FSYNC signal polarity?
  2015-08-31 18:02 ` Mark Brown
@ 2015-08-31 19:05   ` Anatol Pomozov
  2015-08-31 19:17     ` Lars-Peter Clausen
  2015-09-01 12:14     ` Mark Brown
  0 siblings, 2 replies; 7+ messages in thread
From: Anatol Pomozov @ 2015-08-31 19:05 UTC (permalink / raw)
  To: Mark Brown
  Cc: alsa-devel, Lars-Peter Clausen, Ben Zhang,
	陳立峰,
	lengo, Dylan Reid

Hi

Thanks.

On Mon, Aug 31, 2015 at 11:02 AM, Mark Brown <broonie@kernel.org> wrote:
> The simplest thing to do is look at the datasheets for Wolfson parts
> like the wm8731, they have some very clear diagrams of all the data
> modes we support.

I looked at http://www.rockbox.org/wiki/pub/Main/DataSheets/WM8731_8731L.pdf
spec and it is what I see

"normal" bitclock means data sensing happens at rising edge of BCLK.
It is the same as TegraX1 and rt5677 examples above.

As of FSYNC - the wm8731 driver uses Reg0x7[4] to set FSYNC polarity.
If FSYNC is inverted then bit set to 1. According to the spec:

DACLRC phase control (in left, right or I2S modes)
1 = Right Channel DAC data when DACLRC high
0 = Right Channel DAC data when DACLRC low
(opposite phasing in I2S mode)
or
DSP mode A/B select (in DSP mode only)
1 = MSB is available on 2nd BCLK rising edge after DACLRC rising edge
0 = MSB is available on 1st BCLK rising edge after DACLRC rising edge


Thus "normal" FSYNC for this driver means that the frame (L channel)
starts at rising edge of FSYNC (wm8731 datasheet calls it DACLRC).
"inverted" means frame starts at the falling edge. It differs both
from TegraX1 and rt5677 above.

For TDM mode A the chip seems always expect to see "normal" polarity
FSYNC (frame starts at rising edge of FSYNC).




It looks like each driver uses its own definition of FSYNC polarity.
To avoid compatibility problems between different codecs/socs there
should be a clean definition of what is FSYNC polarity is. I would
propose something simple like:
    ****  "normal" FSYNC means frame starts at rising edge of FSYNC,
and "inverted" frame starts at falling FSYNC edge ****
i.e. the same as for 8731.

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

* Re: What is exact definition of "normal/inverted" FSYNC signal polarity?
  2015-08-31 19:05   ` Anatol Pomozov
@ 2015-08-31 19:17     ` Lars-Peter Clausen
  2015-09-01 12:14     ` Mark Brown
  1 sibling, 0 replies; 7+ messages in thread
From: Lars-Peter Clausen @ 2015-08-31 19:17 UTC (permalink / raw)
  To: Anatol Pomozov, Mark Brown
  Cc: 陳立峰, alsa-devel, Ben Zhang, Dylan Reid, lengo

On 08/31/2015 09:05 PM, Anatol Pomozov wrote:
> Hi
> 
> Thanks.
> 
> On Mon, Aug 31, 2015 at 11:02 AM, Mark Brown <broonie@kernel.org> wrote:
>> The simplest thing to do is look at the datasheets for Wolfson parts
>> like the wm8731, they have some very clear diagrams of all the data
>> modes we support.
> 
> I looked at http://www.rockbox.org/wiki/pub/Main/DataSheets/WM8731_8731L.pdf
> spec and it is what I see
> 
> "normal" bitclock means data sensing happens at rising edge of BCLK.
> It is the same as TegraX1 and rt5677 examples above.
> 
> As of FSYNC - the wm8731 driver uses Reg0x7[4] to set FSYNC polarity.
> If FSYNC is inverted then bit set to 1. According to the spec:
> 
> DACLRC phase control (in left, right or I2S modes)
> 1 = Right Channel DAC data when DACLRC high
> 0 = Right Channel DAC data when DACLRC low
> (opposite phasing in I2S mode)
> or
> DSP mode A/B select (in DSP mode only)
> 1 = MSB is available on 2nd BCLK rising edge after DACLRC rising edge
> 0 = MSB is available on 1st BCLK rising edge after DACLRC rising edge
> 
> 
> Thus "normal" FSYNC for this driver means that the frame (L channel)
> starts at rising edge of FSYNC (wm8731 datasheet calls it DACLRC).
> "inverted" means frame starts at the falling edge. It differs both
> from TegraX1 and rt5677 above.
> 
> For TDM mode A the chip seems always expect to see "normal" polarity
> FSYNC (frame starts at rising edge of FSYNC).
> 
> 
> 
> 
> It looks like each driver uses its own definition of FSYNC polarity.
> To avoid compatibility problems between different codecs/socs there
> should be a clean definition of what is FSYNC polarity is. I would
> propose something simple like:
>     ****  "normal" FSYNC means frame starts at rising edge of FSYNC,
> and "inverted" frame starts at falling FSYNC edge ****
> i.e. the same as for 8731.

The modes supported by the wm8731 is DSP A (framesync precedes first data by
1 bit clock cycle) and DSP B(framesync happens during the first bit clock
cycle).

But otherwise agreed rising edge = normal framesync, falling edge = inverted
framesync

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

* Re: What is exact definition of "normal/inverted" FSYNC signal polarity?
  2015-08-31 19:05   ` Anatol Pomozov
  2015-08-31 19:17     ` Lars-Peter Clausen
@ 2015-09-01 12:14     ` Mark Brown
  2015-09-12  5:48       ` Anatol Pomozov
  1 sibling, 1 reply; 7+ messages in thread
From: Mark Brown @ 2015-09-01 12:14 UTC (permalink / raw)
  To: Anatol Pomozov
  Cc: alsa-devel, Lars-Peter Clausen, Ben Zhang,
	陳立峰,
	lengo, Dylan Reid


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

On Mon, Aug 31, 2015 at 12:05:51PM -0700, Anatol Pomozov wrote:

> Thus "normal" FSYNC for this driver means that the frame (L channel)
> starts at rising edge of FSYNC (wm8731 datasheet calls it DACLRC).
> "inverted" means frame starts at the falling edge. It differs both
> from TegraX1 and rt5677 above.

> It looks like each driver uses its own definition of FSYNC polarity.
> To avoid compatibility problems between different codecs/socs there
> should be a clean definition of what is FSYNC polarity is. I would
> propose something simple like:
>     ****  "normal" FSYNC means frame starts at rising edge of FSYNC,
> and "inverted" frame starts at falling FSYNC edge ****
> i.e. the same as for 8731.

Right, the Tegra and Realtek drivers are buggy here - the wm8731
definition is the one that essentially everything is using.

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

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



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

* Re: What is exact definition of "normal/inverted" FSYNC signal polarity?
  2015-09-01 12:14     ` Mark Brown
@ 2015-09-12  5:48       ` Anatol Pomozov
  2015-09-12 10:18         ` Mark Brown
  0 siblings, 1 reply; 7+ messages in thread
From: Anatol Pomozov @ 2015-09-12  5:48 UTC (permalink / raw)
  To: Mark Brown
  Cc: alsa-devel, Lars-Peter Clausen, Ben Zhang,
	陳立峰,
	Leng Ooi, Dylan Reid

Hi Mark

On Tue, Sep 1, 2015 at 5:14 AM, Mark Brown <broonie@kernel.org> wrote:

> On Mon, Aug 31, 2015 at 12:05:51PM -0700, Anatol Pomozov wrote:
>
> > Thus "normal" FSYNC for this driver means that the frame (L channel)
> > starts at rising edge of FSYNC (wm8731 datasheet calls it DACLRC).
> > "inverted" means frame starts at the falling edge. It differs both
> > from TegraX1 and rt5677 above.
>
> > It looks like each driver uses its own definition of FSYNC polarity.
> > To avoid compatibility problems between different codecs/socs there
> > should be a clean definition of what is FSYNC polarity is. I would
> > propose something simple like:
> >     ****  "normal" FSYNC means frame starts at rising edge of FSYNC,
> > and "inverted" frame starts at falling FSYNC edge ****
> > i.e. the same as for 8731.
>
> Right, the Tegra and Realtek drivers are buggy here - the wm8731
> definition is the one that essentially everything is using.
>

Are you OK to accept the patch
http://mailman.alsa-project.org/pipermail/alsa-devel/2015-August/097126.html
 ?

If yes then I will work with NVidia/Realtek on updating their drivers.

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

* Re: What is exact definition of "normal/inverted" FSYNC signal polarity?
  2015-09-12  5:48       ` Anatol Pomozov
@ 2015-09-12 10:18         ` Mark Brown
  0 siblings, 0 replies; 7+ messages in thread
From: Mark Brown @ 2015-09-12 10:18 UTC (permalink / raw)
  To: Anatol Pomozov
  Cc: alsa-devel, Lars-Peter Clausen, Ben Zhang,
	陳立峰,
	Leng Ooi, Dylan Reid


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

On Fri, Sep 11, 2015 at 10:48:05PM -0700, Anatol Pomozov wrote:

> Are you OK to accept the patch
> http://mailman.alsa-project.org/pipermail/alsa-devel/2015-August/097126.html
>  ?

> If yes then I will work with NVidia/Realtek on updating their drivers.

Please allow a reasonable time for review, especially during times like
the merge window.

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

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



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

end of thread, other threads:[~2015-09-12 10:18 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-08-31 16:40 What is exact definition of "normal/inverted" FSYNC signal polarity? Anatol Pomozov
2015-08-31 18:02 ` Mark Brown
2015-08-31 19:05   ` Anatol Pomozov
2015-08-31 19:17     ` Lars-Peter Clausen
2015-09-01 12:14     ` Mark Brown
2015-09-12  5:48       ` Anatol Pomozov
2015-09-12 10:18         ` 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.