ASoC: atmel_ssc_dai: Match the CMR divider only in full duplex.
PATCH v2 1/1 ASoC: atmel_ssc_dai: Match the CMR divider only in full duplex.
Quoted 1 line
From
86be84c4de4e7b21cfda9656a02a902c543210afMon Sep 17 00:00:00 2001
From: Peter Rosin <[email protected]>
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;
}--- sound/soc/atmel/atmel_ssc_dai.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
sound/soc/atmel/atmel_ssc_dai.c +4 -1
@@ -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)
Signature · 1 line
1.7.10.4
Hi Peter,
Thanks for your patch.
Btw, do you use "git send-email" command to send the patch?
Quoted 51 lines · Peter Rosin
From
86be84c4de4e7b21cfda9656a02a902c543210afMon Sep 17 00:00:00 2001
From: Peter Rosin <[email protected]>
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; }
Quoted 1 line
Signed-off-by Peter Rosin <[email protected]>
Quoted 11 lines
--- sound/soc/atmel/atmel_ssc_dai.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)sound/soc/atmel/atmel_ssc_dai.c +0
-0@@ -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
sound/soc/atmel/atmel_ssc_dai.c static int atmel_ssc_set_dai_clkdiv(struct snd_soc_dai *cpu_dai, · line 319
Quoted 10 lines
sound/soc/atmel/atmel_ssc_dai.c +4
-1* 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
Quoted 2 lines
Hi Peter,
Thanks for your patch.
And thanks for the Ack!
Quoted 1 line
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
Hi Peter,
Quoted 9 lines · Peter Rosin
Quoted 2 lines
Hi Peter,
Thanks for your patch.And thanks for the Ack!
Quoted 1 line
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 <[email protected]> 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 <[email protected]>
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 <[email protected]> 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<---
Quoted 3 lines
Cheers,
Peter
Best Regards,
Bo Shen
Ok, I'm trying with git send-email, sorry for the inconvenience.
Cheers,
Peter
PATCH 1/1 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;
}--- sound/soc/atmel/atmel_ssc_dai.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
sound/soc/atmel/atmel_ssc_dai.c +4 -1
@@ -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)
Signature · 1 line
2.1.1
Mark Brown
maintainerQuoted 5 lines · 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.
Bo, is this OK?
Bo Shen
Acked-byHi Mark,
Quoted 8 lines · Mark Brown
Quoted 5 lines · 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.
Bo, is this OK?
I have acked this patch. However Peter resend with "git send-email" command while not add Acked-by tag. Anyway:
Best Regards,
Bo Shen
Quoted 5 lines · 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.
Applied, thanks.
Hi Peter,
Quoted 9 lines · Peter Rosin
Quoted 2 lines
Hi Peter,
Thanks for your patch.And thanks for the Ack!
Quoted 1 line
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 <[email protected]> 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 <[email protected]>
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 <[email protected]> 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<---
Quoted 3 lines
Cheers,
Peter
Best Regards,
Bo Shen