* [PATCH v2] ASoC: atmel_ssc_dai: Match the CMR divider only in full duplex.
@ 2014-10-22 15:13 Peter Rosin
2014-10-24 3:15 ` Bo Shen
0 siblings, 1 reply; 10+ messages in thread
From: Peter Rosin @ 2014-10-22 15:13 UTC (permalink / raw)
To: Bo Shen
Cc: 'alsa-devel@alsa-project.org',
Takashi Iwai, linux-kernel, Liam Girdwood, Mark Brown
>From 86be84c4de4e7b21cfda9656a02a902c543210af Mon Sep 17 00:00:00 2001
From: Peter Rosin <peda@axentia.se>
Date: Wed, 22 Oct 2014 16:45:29 +0200
Subject: [PATCH v2] ASoC: atmel_ssc_dai: Match the CMR divider only in full
duplex.
The CMR divider register is shared by playback and capture. The SSC driver
therefore tries to enforce rules so that the needed register content do
not conflict during simultaneous playback/capture. However, the
implementation also prevents changing the register content in
half-duplex scenarios, which is needed when using the OSS API.
Thus, only lock the divider if there is a stream in the other direction.
Fixes the below program to not fail with the atmel ssc dai in master mode.
#include <sys/ioctl.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/soundcard.h>
int
main(void)
{
int fd;
int format;
int channels;
int speed;
if ((fd = open("/dev/dsp", O_WRONLY, 0)) == -1) {
perror("open");
return 1;
}
format = AFMT_S16_LE;
if (ioctl(fd, SNDCTL_DSP_SETFMT, &format) == -1) {
perror("SNDCTL_DSP_SETFMT");
return 1;
}
channels = 2;
if (ioctl(fd, SNDCTL_DSP_CHANNELS, &channels) == -1) {
perror("SNDCTL_DSP_CHANNELS");
return 1;
}
speed = 22025;
if (ioctl(fd, SNDCTL_DSP_SPEED, &speed) == -1) {
perror("SNDCTL_DSP_SPEED");
return 1;
}
return 0;
}
Signed-off-by: Peter Rosin <peda@axentia.se>
---
sound/soc/atmel/atmel_ssc_dai.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/sound/soc/atmel/atmel_ssc_dai.c b/sound/soc/atmel/atmel_ssc_dai.c
index de433cfd..9ae8475 100644
--- a/sound/soc/atmel/atmel_ssc_dai.c
+++ b/sound/soc/atmel/atmel_ssc_dai.c
@@ -310,7 +310,10 @@ static int atmel_ssc_set_dai_clkdiv(struct snd_soc_dai *cpu_dai,
* transmit and receive, so if a value has already
* been set, it must match this value.
*/
- if (ssc_p->cmr_div == 0)
+ if (ssc_p->dir_mask !=
+ (SSC_DIR_MASK_PLAYBACK | SSC_DIR_MASK_CAPTURE))
+ ssc_p->cmr_div = div;
+ else if (ssc_p->cmr_div == 0)
ssc_p->cmr_div = div;
else
if (div != ssc_p->cmr_div)
--
1.7.10.4
^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [PATCH v2] ASoC: atmel_ssc_dai: Match the CMR divider only in full duplex.
2014-10-22 15:13 [PATCH v2] ASoC: atmel_ssc_dai: Match the CMR divider only in full duplex Peter Rosin
@ 2014-10-24 3:15 ` Bo Shen
2014-10-24 7:13 ` Peter Rosin
0 siblings, 1 reply; 10+ messages in thread
From: Bo Shen @ 2014-10-24 3:15 UTC (permalink / raw)
To: Peter Rosin, Mark Brown
Cc: 'alsa-devel@alsa-project.org',
Takashi Iwai, linux-kernel, Liam Girdwood
Hi Peter,
Thanks for your patch.
Btw, do you use "git send-email" command to send the patch?
On 10/22/2014 11:13 PM, Peter Rosin wrote:
> From 86be84c4de4e7b21cfda9656a02a902c543210af Mon Sep 17 00:00:00 2001
> From: Peter Rosin <peda@axentia.se>
> Date: Wed, 22 Oct 2014 16:45:29 +0200
> Subject: [PATCH v2] ASoC: atmel_ssc_dai: Match the CMR divider only in full
> duplex.
>
> The CMR divider register is shared by playback and capture. The SSC driver
> therefore tries to enforce rules so that the needed register content do
> not conflict during simultaneous playback/capture. However, the
> implementation also prevents changing the register content in
> half-duplex scenarios, which is needed when using the OSS API.
>
> Thus, only lock the divider if there is a stream in the other direction.
>
> Fixes the below program to not fail with the atmel ssc dai in master mode.
>
> #include <sys/ioctl.h>
> #include <unistd.h>
> #include <fcntl.h>
> #include <sys/soundcard.h>
>
> int
> main(void)
> {
> int fd;
> int format;
> int channels;
> int speed;
>
> if ((fd = open("/dev/dsp", O_WRONLY, 0)) == -1) {
> perror("open");
> return 1;
> }
> format = AFMT_S16_LE;
> if (ioctl(fd, SNDCTL_DSP_SETFMT, &format) == -1) {
> perror("SNDCTL_DSP_SETFMT");
> return 1;
> }
> channels = 2;
> if (ioctl(fd, SNDCTL_DSP_CHANNELS, &channels) == -1) {
> perror("SNDCTL_DSP_CHANNELS");
> return 1;
> }
> speed = 22025;
> if (ioctl(fd, SNDCTL_DSP_SPEED, &speed) == -1) {
> perror("SNDCTL_DSP_SPEED");
> return 1;
> }
> return 0;
> }
>
> Signed-off-by: Peter Rosin <peda@axentia.se>
Acked-by: Bo Shen <voice.shen@atmel.com>
> ---
> sound/soc/atmel/atmel_ssc_dai.c | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/sound/soc/atmel/atmel_ssc_dai.c b/sound/soc/atmel/atmel_ssc_dai.c
> index de433cfd..9ae8475 100644
> --- a/sound/soc/atmel/atmel_ssc_dai.c
> +++ b/sound/soc/atmel/atmel_ssc_dai.c
> @@ -310,7 +310,10 @@ static int atmel_ssc_set_dai_clkdiv(struct snd_soc_dai *cpu_dai,
> * transmit and receive, so if a value has already
> * been set, it must match this value.
> */
> - if (ssc_p->cmr_div == 0)
> + if (ssc_p->dir_mask !=
> + (SSC_DIR_MASK_PLAYBACK | SSC_DIR_MASK_CAPTURE))
> + ssc_p->cmr_div = div;
> + else if (ssc_p->cmr_div == 0)
> ssc_p->cmr_div = div;
> else
> if (div != ssc_p->cmr_div)
>
Best Regards,
Bo Shen
^ permalink raw reply [flat|nested] 10+ messages in thread
* RE: [PATCH v2] ASoC: atmel_ssc_dai: Match the CMR divider only in full duplex.
2014-10-24 3:15 ` Bo Shen
@ 2014-10-24 7:13 ` Peter Rosin
2014-10-24 8:43 ` Bo Shen
2014-10-24 8:46 ` [PATCH v2] " Bo Shen
0 siblings, 2 replies; 10+ messages in thread
From: Peter Rosin @ 2014-10-24 7:13 UTC (permalink / raw)
To: Bo Shen
Cc: 'alsa-devel@alsa-project.org',
Takashi Iwai, linux-kernel, Liam Girdwood, Mark Brown
> Hi Peter,
> Thanks for your patch.
And thanks for the Ack!
> Btw, do you use "git send-email" command to send the patch?
No, I didn't, "git format-patch" and paste into the mail body. Was there some
whitespace issues with the patch?
Cheers,
Peter
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH v2] ASoC: atmel_ssc_dai: Match the CMR divider only in full duplex.
2014-10-24 7:13 ` Peter Rosin
@ 2014-10-24 8:43 ` Bo Shen
2014-10-24 19:25 ` Peter Rosin
2014-10-24 8:46 ` [PATCH v2] " Bo Shen
1 sibling, 1 reply; 10+ messages in thread
From: Bo Shen @ 2014-10-24 8:43 UTC (permalink / raw)
To: Peter Rosin
Cc: 'alsa-devel@alsa-project.org',
Takashi Iwai, linux-kernel, Liam Girdwood, Mark Brown
Hi Peter,
On 10/24/2014 03:13 PM, Peter Rosin wrote:
>> Hi Peter,
>> Thanks for your patch.
>
> And thanks for the Ack!
>
>> Btw, do you use "git send-email" command to send the patch?
>
> No, I didn't, "git format-patch" and paste into the mail body. Was there some
> whitespace issues with the patch?
If you paste the patch in mail body, after apply your patch, git log
will show information look like:
--->8---
commit bfb9419839caeca07aa3e99c141fc7c1ac4f37af
Author: Peter Rosin <peda@axentia.se>
Date: Wed Oct 22 15:13:55 2014 +0000
ASoC: atmel_ssc_dai: Match the CMR divider only in full duplex.
From 86be84c4de4e7b21cfda9656a02a902c543210af Mon Sep 17 00:00:00 2001
From: Peter Rosin <peda@axentia.se>
Date: Wed, 22 Oct 2014 16:45:29 +0200
Subject: [PATCH v2] ASoC: atmel_ssc_dai: Match the CMR divider only
in full
duplex.
The CMR divider register is shared by playback and capture. The SSC
driver
therefore tries to enforce rules so that the needed register content do
not conflict during simultaneous playback/capture. However, the
implementation also prevents changing the register content in
half-duplex scenarios, which is needed when using the OSS API.
---8<---
If you send patch use "git send-email", after apply your patch, git log
will show information look like
--->8---
commit bfb9419839caeca07aa3e99c141fc7c1ac4f37af
Author: Peter Rosin <peda@axentia.se>
Date: Wed Oct 22 15:13:55 2014 +0000
The CMR divider register is shared by playback and capture. The SSC
driver
therefore tries to enforce rules so that the needed register content do
not conflict during simultaneous playback/capture. However, the
implementation also prevents changing the register content in
half-duplex scenarios, which is needed when using the OSS API.
---8<---
> Cheers,
> Peter
>
Best Regards,
Bo Shen
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH v2] ASoC: atmel_ssc_dai: Match the CMR divider only in full duplex.
2014-10-24 7:13 ` Peter Rosin
2014-10-24 8:43 ` Bo Shen
@ 2014-10-24 8:46 ` Bo Shen
1 sibling, 0 replies; 10+ messages in thread
From: Bo Shen @ 2014-10-24 8:46 UTC (permalink / raw)
To: Peter Rosin
Cc: 'alsa-devel@alsa-project.org',
Takashi Iwai, linux-kernel, Liam Girdwood, Mark Brown
Hi Peter,
On 10/24/2014 03:13 PM, Peter Rosin wrote:
>> Hi Peter,
>> Thanks for your patch.
>
> And thanks for the Ack!
>
>> Btw, do you use "git send-email" command to send the patch?
>
> No, I didn't, "git format-patch" and paste into the mail body. Was there some
> whitespace issues with the patch?
If you paste patch into the mail body, after using "git am" to apply
your patch, git log will show like:
--->8---
commit bfb9419839caeca07aa3e99c141fc7c1ac4f37af
Author: Peter Rosin <peda@axentia.se>
Date: Wed Oct 22 15:13:55 2014 +0000
ASoC: atmel_ssc_dai: Match the CMR divider only in full duplex.
From 86be84c4de4e7b21cfda9656a02a902c543210af Mon Sep 17 00:00:00 2001
From: Peter Rosin <peda@axentia.se>
Date: Wed, 22 Oct 2014 16:45:29 +0200
Subject: [PATCH v2] ASoC: atmel_ssc_dai: Match the CMR divider only
in full
duplex.
The CMR divider register is shared by playback and capture. The SSC
driver
therefore tries to enforce rules so that the needed register content do
not conflict during simultaneous playback/capture. However, the
implementation also prevents changing the register content in
half-duplex scenarios, which is needed when using the OSS API.
---8<---
If you use "git send-email", after using "git am" to apply your patch,
git log will show like:
--->8---
commit bfb9419839caeca07aa3e99c141fc7c1ac4f37af
Author: Peter Rosin <peda@axentia.se>
Date: Wed Oct 22 15:13:55 2014 +0000
ASoC: atmel_ssc_dai: Match the CMR divider only in full duplex.
The CMR divider register is shared by playback and capture. The SSC
driver
therefore tries to enforce rules so that the needed register content do
not conflict during simultaneous playback/capture. However, the
implementation also prevents changing the register content in
half-duplex scenarios, which is needed when using the OSS API.
---8<---
> Cheers,
> Peter
>
Best Regards,
Bo Shen
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH v2] ASoC: atmel_ssc_dai: Match the CMR divider only in full duplex.
2014-10-24 8:43 ` Bo Shen
@ 2014-10-24 19:25 ` Peter Rosin
2014-10-24 19:25 ` [PATCH] " Peter Rosin
0 siblings, 1 reply; 10+ messages in thread
From: Peter Rosin @ 2014-10-24 19:25 UTC (permalink / raw)
To: Bo Shen
Cc: Liam Girdwood, Mark Brown, Jaroslav Kysela, Takashi Iwai,
alsa-devel, linux-kernel
Ok, I'm trying with git send-email, sorry for the inconvenience.
Cheers,
Peter
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH] ASoC: atmel_ssc_dai: Match the CMR divider only in full duplex.
2014-10-24 19:25 ` Peter Rosin
@ 2014-10-24 19:25 ` Peter Rosin
2014-10-31 18:12 ` Mark Brown
2014-11-03 12:45 ` Mark Brown
0 siblings, 2 replies; 10+ messages in thread
From: Peter Rosin @ 2014-10-24 19:25 UTC (permalink / raw)
To: Bo Shen
Cc: Liam Girdwood, Mark Brown, Jaroslav Kysela, Takashi Iwai,
alsa-devel, linux-kernel, Peter Rosin
The CMR divider register is shared by playback and capture. The SSC driver
therefore tries to enforce rules so that the needed register content do
not conflict during simultaneous playback/capture. However, the
implementation also prevents changing the register content in
half-duplex scenarios, which is needed when using the OSS API.
Thus, only lock the divider if there is a stream in the other direction.
Fixes the below program to not fail with the atmel ssc dai in master mode.
#include <sys/ioctl.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/soundcard.h>
int
main(void)
{
int fd;
int format;
int channels;
int speed;
if ((fd = open("/dev/dsp", O_WRONLY, 0)) == -1) {
perror("open");
return 1;
}
format = AFMT_S16_LE;
if (ioctl(fd, SNDCTL_DSP_SETFMT, &format) == -1) {
perror("SNDCTL_DSP_SETFMT");
return 1;
}
channels = 2;
if (ioctl(fd, SNDCTL_DSP_CHANNELS, &channels) == -1) {
perror("SNDCTL_DSP_CHANNELS");
return 1;
}
speed = 22025;
if (ioctl(fd, SNDCTL_DSP_SPEED, &speed) == -1) {
perror("SNDCTL_DSP_SPEED");
return 1;
}
return 0;
}
Signed-off-by: Peter Rosin <peda@axentia.se>
---
sound/soc/atmel/atmel_ssc_dai.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/sound/soc/atmel/atmel_ssc_dai.c b/sound/soc/atmel/atmel_ssc_dai.c
index f403f39..b1cc2a4 100644
--- a/sound/soc/atmel/atmel_ssc_dai.c
+++ b/sound/soc/atmel/atmel_ssc_dai.c
@@ -310,7 +310,10 @@ static int atmel_ssc_set_dai_clkdiv(struct snd_soc_dai *cpu_dai,
* transmit and receive, so if a value has already
* been set, it must match this value.
*/
- if (ssc_p->cmr_div == 0)
+ if (ssc_p->dir_mask !=
+ (SSC_DIR_MASK_PLAYBACK | SSC_DIR_MASK_CAPTURE))
+ ssc_p->cmr_div = div;
+ else if (ssc_p->cmr_div == 0)
ssc_p->cmr_div = div;
else
if (div != ssc_p->cmr_div)
--
2.1.1
^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [PATCH] ASoC: atmel_ssc_dai: Match the CMR divider only in full duplex.
2014-10-24 19:25 ` [PATCH] " Peter Rosin
@ 2014-10-31 18:12 ` Mark Brown
2014-11-03 1:25 ` Bo Shen
2014-11-03 12:45 ` Mark Brown
1 sibling, 1 reply; 10+ messages in thread
From: Mark Brown @ 2014-10-31 18:12 UTC (permalink / raw)
To: Peter Rosin
Cc: Bo Shen, Liam Girdwood, Jaroslav Kysela, Takashi Iwai,
alsa-devel, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 424 bytes --]
On Fri, Oct 24, 2014 at 09:25:59PM +0200, Peter Rosin wrote:
> The CMR divider register is shared by playback and capture. The SSC driver
> therefore tries to enforce rules so that the needed register content do
> not conflict during simultaneous playback/capture. However, the
> implementation also prevents changing the register content in
> half-duplex scenarios, which is needed when using the OSS API.
Bo, is this OK?
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 473 bytes --]
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] ASoC: atmel_ssc_dai: Match the CMR divider only in full duplex.
2014-10-31 18:12 ` Mark Brown
@ 2014-11-03 1:25 ` Bo Shen
0 siblings, 0 replies; 10+ messages in thread
From: Bo Shen @ 2014-11-03 1:25 UTC (permalink / raw)
To: Mark Brown, Peter Rosin
Cc: Liam Girdwood, Jaroslav Kysela, Takashi Iwai, alsa-devel, linux-kernel
Hi Mark,
On 11/01/2014 02:12 AM, Mark Brown wrote:
> On Fri, Oct 24, 2014 at 09:25:59PM +0200, Peter Rosin wrote:
>> The CMR divider register is shared by playback and capture. The SSC driver
>> therefore tries to enforce rules so that the needed register content do
>> not conflict during simultaneous playback/capture. However, the
>> implementation also prevents changing the register content in
>> half-duplex scenarios, which is needed when using the OSS API.
>
> Bo, is this OK?
I have acked this patch. However Peter resend with "git send-email"
command while not add Acked-by tag. Anyway:
Acked-by: Bo Shen <voice.shen@atmel.com>
Best Regards,
Bo Shen
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] ASoC: atmel_ssc_dai: Match the CMR divider only in full duplex.
2014-10-24 19:25 ` [PATCH] " Peter Rosin
2014-10-31 18:12 ` Mark Brown
@ 2014-11-03 12:45 ` Mark Brown
1 sibling, 0 replies; 10+ messages in thread
From: Mark Brown @ 2014-11-03 12:45 UTC (permalink / raw)
To: Peter Rosin
Cc: Bo Shen, Liam Girdwood, Jaroslav Kysela, Takashi Iwai,
alsa-devel, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 425 bytes --]
On Fri, Oct 24, 2014 at 09:25:59PM +0200, Peter Rosin wrote:
> The CMR divider register is shared by playback and capture. The SSC driver
> therefore tries to enforce rules so that the needed register content do
> not conflict during simultaneous playback/capture. However, the
> implementation also prevents changing the register content in
> half-duplex scenarios, which is needed when using the OSS API.
Applied, thanks.
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 473 bytes --]
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2014-11-03 12:47 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-10-22 15:13 [PATCH v2] ASoC: atmel_ssc_dai: Match the CMR divider only in full duplex Peter Rosin
2014-10-24 3:15 ` Bo Shen
2014-10-24 7:13 ` Peter Rosin
2014-10-24 8:43 ` Bo Shen
2014-10-24 19:25 ` Peter Rosin
2014-10-24 19:25 ` [PATCH] " Peter Rosin
2014-10-31 18:12 ` Mark Brown
2014-11-03 1:25 ` Bo Shen
2014-11-03 12:45 ` Mark Brown
2014-10-24 8:46 ` [PATCH v2] " Bo Shen
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).