All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ASoC: fsl_sai: Use physical format width
@ 2023-03-30  8:30 Emil Abildgaard Svendsen
  2023-03-31  2:55   ` Shengjiu Wang
  0 siblings, 1 reply; 10+ messages in thread
From: Emil Abildgaard Svendsen @ 2023-03-30  8:30 UTC (permalink / raw)
  To: Shengjiu Wang, Xiubo Li, Fabio Estevam, Nicolin Chen,
	Liam Girdwood, Mark Brown, Jaroslav Kysela, Takashi Iwai
  Cc: alsa-devel, linuxppc-dev, Emil Abildgaard Svendsen

Slot width should follow the physical width of the format instead of the
data width.

This is needed for formats like SNDRV_PCM_FMTBIT_S24_LE where physical
width is 32 and data width is 24. By using the physical width, data
won't get misaligned.

Signed-off-by: Emil Svendsen <emas@bang-olufsen.dk>
---
 sound/soc/fsl/fsl_sai.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sound/soc/fsl/fsl_sai.c b/sound/soc/fsl/fsl_sai.c
index 939c6bdd22c4..213e2d462076 100644
--- a/sound/soc/fsl/fsl_sai.c
+++ b/sound/soc/fsl/fsl_sai.c
@@ -519,13 +519,13 @@ static int fsl_sai_hw_params(struct snd_pcm_substream *substream,
 	unsigned int channels = params_channels(params);
 	struct snd_dmaengine_dai_dma_data *dma_params;
 	struct fsl_sai_dl_cfg *dl_cfg = sai->dl_cfg;
+	u32 slot_width = params_physical_width(params);
 	u32 word_width = params_width(params);
 	int trce_mask = 0, dl_cfg_idx = 0;
 	int dl_cfg_cnt = sai->dl_cfg_cnt;
 	u32 dl_type = FSL_SAI_DL_I2S;
 	u32 val_cr4 = 0, val_cr5 = 0;
 	u32 slots = (channels == 1) ? 2 : channels;
-	u32 slot_width = word_width;
 	int adir = tx ? RX : TX;
 	u32 pins, bclk;
 	u32 watermark;
-- 
2.34.1

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

* Re: [PATCH] ASoC: fsl_sai: Use physical format width
  2023-03-30  8:30 [PATCH] ASoC: fsl_sai: Use physical format width Emil Abildgaard Svendsen
@ 2023-03-31  2:55   ` Shengjiu Wang
  0 siblings, 0 replies; 10+ messages in thread
From: Shengjiu Wang @ 2023-03-31  2:55 UTC (permalink / raw)
  To: Emil Abildgaard Svendsen
  Cc: Xiubo Li, Fabio Estevam, Nicolin Chen, Liam Girdwood, Mark Brown,
	Takashi Iwai, alsa-devel, linuxppc-dev

On Thu, Mar 30, 2023 at 4:30 PM Emil Abildgaard Svendsen <
EMAS@bang-olufsen.dk> wrote:

> Slot width should follow the physical width of the format instead of the
> data width.
>
> This is needed for formats like SNDRV_PCM_FMTBIT_S24_LE where physical
> width is 32 and data width is 24. By using the physical width, data
> won't get misaligned.


There are different requirements for this slot width. Some need physical
width,
Some need format width. We need to be careful about change here.

Actually there is .set_tdm_slot API for slot specific setting, please use
this API.

best regards
wang shengjiu

>
> Signed-off-by: Emil Svendsen <emas@bang-olufsen.dk>
> ---
>  sound/soc/fsl/fsl_sai.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/sound/soc/fsl/fsl_sai.c b/sound/soc/fsl/fsl_sai.c
> index 939c6bdd22c4..213e2d462076 100644
> --- a/sound/soc/fsl/fsl_sai.c
> +++ b/sound/soc/fsl/fsl_sai.c
> @@ -519,13 +519,13 @@ static int fsl_sai_hw_params(struct
> snd_pcm_substream *substream,
>         unsigned int channels = params_channels(params);
>         struct snd_dmaengine_dai_dma_data *dma_params;
>         struct fsl_sai_dl_cfg *dl_cfg = sai->dl_cfg;
> +       u32 slot_width = params_physical_width(params);
>         u32 word_width = params_width(params);
>         int trce_mask = 0, dl_cfg_idx = 0;
>         int dl_cfg_cnt = sai->dl_cfg_cnt;
>         u32 dl_type = FSL_SAI_DL_I2S;
>         u32 val_cr4 = 0, val_cr5 = 0;
>         u32 slots = (channels == 1) ? 2 : channels;
> -       u32 slot_width = word_width;
>         int adir = tx ? RX : TX;
>         u32 pins, bclk;
>         u32 watermark;
> --
> 2.34.1
>

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

* Re: [PATCH] ASoC: fsl_sai: Use physical format width
@ 2023-03-31  2:55   ` Shengjiu Wang
  0 siblings, 0 replies; 10+ messages in thread
From: Shengjiu Wang @ 2023-03-31  2:55 UTC (permalink / raw)
  To: Emil Abildgaard Svendsen
  Cc: alsa-devel, Xiubo Li, linuxppc-dev, Takashi Iwai, Liam Girdwood,
	Jaroslav Kysela, Nicolin Chen, Mark Brown, Fabio Estevam

[-- Attachment #1: Type: text/plain, Size: 1712 bytes --]

On Thu, Mar 30, 2023 at 4:30 PM Emil Abildgaard Svendsen <
EMAS@bang-olufsen.dk> wrote:

> Slot width should follow the physical width of the format instead of the
> data width.
>
> This is needed for formats like SNDRV_PCM_FMTBIT_S24_LE where physical
> width is 32 and data width is 24. By using the physical width, data
> won't get misaligned.


There are different requirements for this slot width. Some need physical
width,
Some need format width. We need to be careful about change here.

Actually there is .set_tdm_slot API for slot specific setting, please use
this API.

best regards
wang shengjiu

>
> Signed-off-by: Emil Svendsen <emas@bang-olufsen.dk>
> ---
>  sound/soc/fsl/fsl_sai.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/sound/soc/fsl/fsl_sai.c b/sound/soc/fsl/fsl_sai.c
> index 939c6bdd22c4..213e2d462076 100644
> --- a/sound/soc/fsl/fsl_sai.c
> +++ b/sound/soc/fsl/fsl_sai.c
> @@ -519,13 +519,13 @@ static int fsl_sai_hw_params(struct
> snd_pcm_substream *substream,
>         unsigned int channels = params_channels(params);
>         struct snd_dmaengine_dai_dma_data *dma_params;
>         struct fsl_sai_dl_cfg *dl_cfg = sai->dl_cfg;
> +       u32 slot_width = params_physical_width(params);
>         u32 word_width = params_width(params);
>         int trce_mask = 0, dl_cfg_idx = 0;
>         int dl_cfg_cnt = sai->dl_cfg_cnt;
>         u32 dl_type = FSL_SAI_DL_I2S;
>         u32 val_cr4 = 0, val_cr5 = 0;
>         u32 slots = (channels == 1) ? 2 : channels;
> -       u32 slot_width = word_width;
>         int adir = tx ? RX : TX;
>         u32 pins, bclk;
>         u32 watermark;
> --
> 2.34.1
>

[-- Attachment #2: Type: text/html, Size: 2423 bytes --]

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

* Re: [PATCH] ASoC: fsl_sai: Use physical format width
  2023-03-31  2:55   ` Shengjiu Wang
  (?)
  (?)
@ 2023-03-31 14:26   ` Emil Abildgaard Svendsen
  2023-03-31 14:34       ` Mark Brown
  -1 siblings, 1 reply; 10+ messages in thread
From: Emil Abildgaard Svendsen @ 2023-03-31 14:26 UTC (permalink / raw)
  To: shengjiu.wang
  Cc: alsa-devel, Xiubo.Lee, linuxppc-dev, lgirdwood, tiwai,
	nicoleotsuka, broonie, festevam, Emil Abildgaard Svendsen

On 3/31/23 04:55, Shengjiu Wang wrote:
> On Thu, Mar 30, 2023 at 4:30 PM Emil Abildgaard Svendsen <
> EMAS@bang-olufsen.dk> wrote:
> 
>> Slot width should follow the physical width of the format instead of the
>> data width.
>>
>> This is needed for formats like SNDRV_PCM_FMTBIT_S24_LE where physical
>> width is 32 and data width is 24. By using the physical width, data
>> won't get misaligned.
> 
> 
> There are different requirements for this slot width. Some need physical
> width,
> Some need format width. We need to be careful about change here.

I might be wrong but shouldn't physical width always correspond to what
can be physically measured. If you need the slot width, the same as
format width you use a format with matching widths like
SNDRV_PCM_FORMAT_S24_3LE?

> 
> Actually there is .set_tdm_slot API for slot specific setting, please use
> this API.

But if you're using the generic sound cards. You need to add it to the
DTS. Thus, if you want a static TDM slot width, all is fine. But if you
want to change slot width runtime then it isn't enough.
Unless I missed something.

Kind regards,
Emil Svendsen 

> 
> best regards
> wang shengjiu
> 
>>
>> Signed-off-by: Emil Svendsen <emas@bang-olufsen.dk>
>> ---
>>  sound/soc/fsl/fsl_sai.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/sound/soc/fsl/fsl_sai.c b/sound/soc/fsl/fsl_sai.c
>> index 939c6bdd22c4..213e2d462076 100644
>> --- a/sound/soc/fsl/fsl_sai.c
>> +++ b/sound/soc/fsl/fsl_sai.c
>> @@ -519,13 +519,13 @@ static int fsl_sai_hw_params(struct
>> snd_pcm_substream *substream,
>>         unsigned int channels = params_channels(params);
>>         struct snd_dmaengine_dai_dma_data *dma_params;
>>         struct fsl_sai_dl_cfg *dl_cfg = sai->dl_cfg;
>> +       u32 slot_width = params_physical_width(params);
>>         u32 word_width = params_width(params);
>>         int trce_mask = 0, dl_cfg_idx = 0;
>>         int dl_cfg_cnt = sai->dl_cfg_cnt;
>>         u32 dl_type = FSL_SAI_DL_I2S;
>>         u32 val_cr4 = 0, val_cr5 = 0;
>>         u32 slots = (channels == 1) ? 2 : channels;
>> -       u32 slot_width = word_width;
>>         int adir = tx ? RX : TX;
>>         u32 pins, bclk;
>>         u32 watermark;
>> --
>> 2.34.1
>>
> 


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

* Re: [PATCH] ASoC: fsl_sai: Use physical format width
  2023-03-31  2:55   ` Shengjiu Wang
  (?)
@ 2023-03-31 14:26   ` Emil Abildgaard Svendsen via Alsa-devel
  -1 siblings, 0 replies; 10+ messages in thread
From: Emil Abildgaard Svendsen via Alsa-devel @ 2023-03-31 14:26 UTC (permalink / raw)
  To: shengjiu.wang
  Cc: Emil Abildgaard Svendsen, Xiubo.Lee, alsa-devel, broonie,
	festevam, lgirdwood, linuxppc-dev, nicoleotsuka, tiwai


[-- Attachment #0: Type: message/rfc822, Size: 13891 bytes --]

From: Emil Abildgaard Svendsen <EMAS@bang-olufsen.dk>
To: "shengjiu.wang@gmail.com" <shengjiu.wang@gmail.com>
Cc: Emil Abildgaard Svendsen <EMAS@bang-olufsen.dk>, "Xiubo.Lee@gmail.com" <Xiubo.Lee@gmail.com>, "alsa-devel@alsa-project.org" <alsa-devel@alsa-project.org>, "broonie@kernel.org" <broonie@kernel.org>, "festevam@gmail.com" <festevam@gmail.com>, "lgirdwood@gmail.com" <lgirdwood@gmail.com>, "linuxppc-dev@lists.ozlabs.org" <linuxppc-dev@lists.ozlabs.org>, "nicoleotsuka@gmail.com" <nicoleotsuka@gmail.com>, "tiwai@suse.com" <tiwai@suse.com>
Subject: Re: [PATCH] ASoC: fsl_sai: Use physical format width
Date: Fri, 31 Mar 2023 14:26:33 +0000
Message-ID: <20230331142537.1399524-1-emas@bang-olufsen.dk>

On 3/31/23 04:55, Shengjiu Wang wrote:
> On Thu, Mar 30, 2023 at 4:30 PM Emil Abildgaard Svendsen <
> EMAS@bang-olufsen.dk> wrote:
> 
>> Slot width should follow the physical width of the format instead of the
>> data width.
>>
>> This is needed for formats like SNDRV_PCM_FMTBIT_S24_LE where physical
>> width is 32 and data width is 24. By using the physical width, data
>> won't get misaligned.
> 
> 
> There are different requirements for this slot width. Some need physical
> width,
> Some need format width. We need to be careful about change here.

I might be wrong but shouldn't physical width always correspond to what
can be physically measured. If you need the slot width, the same as
format width you use a format with matching widths like
SNDRV_PCM_FORMAT_S24_3LE?

> 
> Actually there is .set_tdm_slot API for slot specific setting, please use
> this API.

But if you're using the generic sound cards. You need to add it to the
DTS. Thus, if you want a static TDM slot width, all is fine. But if you
want to change slot width runtime then it isn't enough.
Unless I missed something.

Kind regards,
Emil Svendsen 

> 
> best regards
> wang shengjiu
> 
>>
>> Signed-off-by: Emil Svendsen <emas@bang-olufsen.dk>
>> ---
>>  sound/soc/fsl/fsl_sai.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/sound/soc/fsl/fsl_sai.c b/sound/soc/fsl/fsl_sai.c
>> index 939c6bdd22c4..213e2d462076 100644
>> --- a/sound/soc/fsl/fsl_sai.c
>> +++ b/sound/soc/fsl/fsl_sai.c
>> @@ -519,13 +519,13 @@ static int fsl_sai_hw_params(struct
>> snd_pcm_substream *substream,
>>         unsigned int channels = params_channels(params);
>>         struct snd_dmaengine_dai_dma_data *dma_params;
>>         struct fsl_sai_dl_cfg *dl_cfg = sai->dl_cfg;
>> +       u32 slot_width = params_physical_width(params);
>>         u32 word_width = params_width(params);
>>         int trce_mask = 0, dl_cfg_idx = 0;
>>         int dl_cfg_cnt = sai->dl_cfg_cnt;
>>         u32 dl_type = FSL_SAI_DL_I2S;
>>         u32 val_cr4 = 0, val_cr5 = 0;
>>         u32 slots = (channels == 1) ? 2 : channels;
>> -       u32 slot_width = word_width;
>>         int adir = tx ? RX : TX;
>>         u32 pins, bclk;
>>         u32 watermark;
>> --
>> 2.34.1
>>
> 


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

* Re: [PATCH] ASoC: fsl_sai: Use physical format width
  2023-03-31 14:26   ` Emil Abildgaard Svendsen
@ 2023-03-31 14:34       ` Mark Brown
  0 siblings, 0 replies; 10+ messages in thread
From: Mark Brown @ 2023-03-31 14:34 UTC (permalink / raw)
  To: Emil Abildgaard Svendsen
  Cc: shengjiu.wang, Xiubo.Lee, alsa-devel, festevam, lgirdwood,
	linuxppc-dev, nicoleotsuka, tiwai

[-- Attachment #1: Type: text/plain, Size: 883 bytes --]

On Fri, Mar 31, 2023 at 02:26:33PM +0000, Emil Abildgaard Svendsen wrote:
> On 3/31/23 04:55, Shengjiu Wang wrote:

> > There are different requirements for this slot width. Some need physical
> > width,
> > Some need format width. We need to be careful about change here.

> I might be wrong but shouldn't physical width always correspond to what
> can be physically measured. If you need the slot width, the same as
> format width you use a format with matching widths like
> SNDRV_PCM_FORMAT_S24_3LE?

The point is more that things are likely to be relying on the
current behaviour, for example CODECs that don't actually support
24 bit audio due to a power of two requirement but cope fine when
you play 24 bit audio in a 32 bit timeslot.  This creates issues
changing things even if the new behaviour is in some sense
better.  This is one of the unfortunate consequences of DT.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

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

* Re: [PATCH] ASoC: fsl_sai: Use physical format width
@ 2023-03-31 14:34       ` Mark Brown
  0 siblings, 0 replies; 10+ messages in thread
From: Mark Brown @ 2023-03-31 14:34 UTC (permalink / raw)
  To: Emil Abildgaard Svendsen
  Cc: alsa-devel, Xiubo.Lee, linuxppc-dev, shengjiu.wang, lgirdwood,
	tiwai, nicoleotsuka, festevam

[-- Attachment #1: Type: text/plain, Size: 883 bytes --]

On Fri, Mar 31, 2023 at 02:26:33PM +0000, Emil Abildgaard Svendsen wrote:
> On 3/31/23 04:55, Shengjiu Wang wrote:

> > There are different requirements for this slot width. Some need physical
> > width,
> > Some need format width. We need to be careful about change here.

> I might be wrong but shouldn't physical width always correspond to what
> can be physically measured. If you need the slot width, the same as
> format width you use a format with matching widths like
> SNDRV_PCM_FORMAT_S24_3LE?

The point is more that things are likely to be relying on the
current behaviour, for example CODECs that don't actually support
24 bit audio due to a power of two requirement but cope fine when
you play 24 bit audio in a 32 bit timeslot.  This creates issues
changing things even if the new behaviour is in some sense
better.  This is one of the unfortunate consequences of DT.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

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

* Re: [PATCH] ASoC: fsl_sai: Use physical format width
  2023-03-31 14:34       ` Mark Brown
  (?)
  (?)
@ 2023-04-03  7:26       ` Emil Abildgaard Svendsen
  -1 siblings, 0 replies; 10+ messages in thread
From: Emil Abildgaard Svendsen @ 2023-04-03  7:26 UTC (permalink / raw)
  To: broonie
  Cc: alsa-devel, Xiubo.Lee, festevam, shengjiu.wang, lgirdwood, tiwai,
	nicoleotsuka, linuxppc-dev, Emil Abildgaard Svendsen

On 3/31/23 16:34, Mark Brown wrote:
> On Fri, Mar 31, 2023 at 02:26:33PM +0000, Emil Abildgaard Svendsen wrote:
>> On 3/31/23 04:55, Shengjiu Wang wrote:
> 
>>> There are different requirements for this slot width. Some need physical
>>> width,
>>> Some need format width. We need to be careful about change here.
> 
>> I might be wrong but shouldn't physical width always correspond to what
>> can be physically measured. If you need the slot width, the same as
>> format width you use a format with matching widths like
>> SNDRV_PCM_FORMAT_S24_3LE?
> 
> The point is more that things are likely to be relying on the
> current behaviour, for example CODECs that don't actually support
> 24 bit audio due to a power of two requirement but cope fine when
> you play 24 bit audio in a 32 bit timeslot.  This creates issues
> changing things even if the new behaviour is in some sense
> better.  This is one of the unfortunate consequences of DT.

I guess if you want to do it runtime you have to create an audio card
that will do it for you. I would have preferred it to be handled as
close to hardware as possible. But that's a good enough compromise for
not breaking current behavior.

Thanks!

Kind regards,
Emil Svendsen


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

* Re: [PATCH] ASoC: fsl_sai: Use physical format width
  2023-03-31 14:34       ` Mark Brown
  (?)
@ 2023-04-03  7:26       ` Emil Abildgaard Svendsen via Alsa-devel
  -1 siblings, 0 replies; 10+ messages in thread
From: Emil Abildgaard Svendsen via Alsa-devel @ 2023-04-03  7:26 UTC (permalink / raw)
  To: broonie
  Cc: Emil Abildgaard Svendsen, Xiubo.Lee, alsa-devel, festevam,
	lgirdwood, linuxppc-dev, nicoleotsuka, shengjiu.wang, tiwai


[-- Attachment #0: Type: message/rfc822, Size: 11315 bytes --]

From: Emil Abildgaard Svendsen <EMAS@bang-olufsen.dk>
To: "broonie@kernel.org" <broonie@kernel.org>
Cc: Emil Abildgaard Svendsen <EMAS@bang-olufsen.dk>, "Xiubo.Lee@gmail.com" <Xiubo.Lee@gmail.com>, "alsa-devel@alsa-project.org" <alsa-devel@alsa-project.org>, "festevam@gmail.com" <festevam@gmail.com>, "lgirdwood@gmail.com" <lgirdwood@gmail.com>, "linuxppc-dev@lists.ozlabs.org" <linuxppc-dev@lists.ozlabs.org>, "nicoleotsuka@gmail.com" <nicoleotsuka@gmail.com>, "shengjiu.wang@gmail.com" <shengjiu.wang@gmail.com>, "tiwai@suse.com" <tiwai@suse.com>
Subject: Re: [PATCH] ASoC: fsl_sai: Use physical format width
Date: Mon, 3 Apr 2023 07:26:58 +0000
Message-ID: <20230403072655.1556366-1-emas@bang-olufsen.dk>

On 3/31/23 16:34, Mark Brown wrote:
> On Fri, Mar 31, 2023 at 02:26:33PM +0000, Emil Abildgaard Svendsen wrote:
>> On 3/31/23 04:55, Shengjiu Wang wrote:
> 
>>> There are different requirements for this slot width. Some need physical
>>> width,
>>> Some need format width. We need to be careful about change here.
> 
>> I might be wrong but shouldn't physical width always correspond to what
>> can be physically measured. If you need the slot width, the same as
>> format width you use a format with matching widths like
>> SNDRV_PCM_FORMAT_S24_3LE?
> 
> The point is more that things are likely to be relying on the
> current behaviour, for example CODECs that don't actually support
> 24 bit audio due to a power of two requirement but cope fine when
> you play 24 bit audio in a 32 bit timeslot.  This creates issues
> changing things even if the new behaviour is in some sense
> better.  This is one of the unfortunate consequences of DT.

I guess if you want to do it runtime you have to create an audio card
that will do it for you. I would have preferred it to be handled as
close to hardware as possible. But that's a good enough compromise for
not breaking current behavior.

Thanks!

Kind regards,
Emil Svendsen


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

* [PATCH] ASoC: fsl_sai: Use physical format width
@ 2023-03-30  8:30 Emil Abildgaard Svendsen via Alsa-devel
  0 siblings, 0 replies; 10+ messages in thread
From: Emil Abildgaard Svendsen via Alsa-devel @ 2023-03-30  8:30 UTC (permalink / raw)
  To: Shengjiu Wang, Xiubo Li, Fabio Estevam, Nicolin Chen,
	Liam Girdwood, Mark Brown, Jaroslav Kysela, Takashi Iwai
  Cc: Emil Abildgaard Svendsen, alsa-devel, linuxppc-dev


[-- Attachment #0: Type: message/rfc822, Size: 11145 bytes --]

From: Emil Abildgaard Svendsen <EMAS@bang-olufsen.dk>
To: Shengjiu Wang <shengjiu.wang@gmail.com>, Xiubo Li <Xiubo.Lee@gmail.com>, Fabio Estevam <festevam@gmail.com>, Nicolin Chen <nicoleotsuka@gmail.com>, Liam Girdwood <lgirdwood@gmail.com>, Mark Brown <broonie@kernel.org>, Jaroslav Kysela <perex@perex.cz>, Takashi Iwai <tiwai@suse.com>
Cc: Emil Abildgaard Svendsen <EMAS@bang-olufsen.dk>, "alsa-devel@alsa-project.org" <alsa-devel@alsa-project.org>, "linuxppc-dev@lists.ozlabs.org" <linuxppc-dev@lists.ozlabs.org>
Subject: [PATCH] ASoC: fsl_sai: Use physical format width
Date: Thu, 30 Mar 2023 08:30:55 +0000
Message-ID: <20230330083040.77085-1-emas@bang-olufsen.dk>

Slot width should follow the physical width of the format instead of the
data width.

This is needed for formats like SNDRV_PCM_FMTBIT_S24_LE where physical
width is 32 and data width is 24. By using the physical width, data
won't get misaligned.

Signed-off-by: Emil Svendsen <emas@bang-olufsen.dk>
---
 sound/soc/fsl/fsl_sai.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sound/soc/fsl/fsl_sai.c b/sound/soc/fsl/fsl_sai.c
index 939c6bdd22c4..213e2d462076 100644
--- a/sound/soc/fsl/fsl_sai.c
+++ b/sound/soc/fsl/fsl_sai.c
@@ -519,13 +519,13 @@ static int fsl_sai_hw_params(struct snd_pcm_substream *substream,
 	unsigned int channels = params_channels(params);
 	struct snd_dmaengine_dai_dma_data *dma_params;
 	struct fsl_sai_dl_cfg *dl_cfg = sai->dl_cfg;
+	u32 slot_width = params_physical_width(params);
 	u32 word_width = params_width(params);
 	int trce_mask = 0, dl_cfg_idx = 0;
 	int dl_cfg_cnt = sai->dl_cfg_cnt;
 	u32 dl_type = FSL_SAI_DL_I2S;
 	u32 val_cr4 = 0, val_cr5 = 0;
 	u32 slots = (channels == 1) ? 2 : channels;
-	u32 slot_width = word_width;
 	int adir = tx ? RX : TX;
 	u32 pins, bclk;
 	u32 watermark;
-- 
2.34.1

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

end of thread, other threads:[~2023-04-03 15:37 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-30  8:30 [PATCH] ASoC: fsl_sai: Use physical format width Emil Abildgaard Svendsen
2023-03-31  2:55 ` Shengjiu Wang
2023-03-31  2:55   ` Shengjiu Wang
2023-03-31 14:26   ` Emil Abildgaard Svendsen via Alsa-devel
2023-03-31 14:26   ` Emil Abildgaard Svendsen
2023-03-31 14:34     ` Mark Brown
2023-03-31 14:34       ` Mark Brown
2023-04-03  7:26       ` Emil Abildgaard Svendsen via Alsa-devel
2023-04-03  7:26       ` Emil Abildgaard Svendsen
2023-03-30  8:30 Emil Abildgaard Svendsen via Alsa-devel

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.