alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ALSA: ASoC: davinci-mcasp: clean ip davinci_hw_common_param()
@ 2013-03-08 13:19 Daniel Mack
  2013-03-08 15:17 ` Michal Bachraty
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Daniel Mack @ 2013-03-08 13:19 UTC (permalink / raw)
  To: alsa-devel; +Cc: broonie, Michal Bachraty, Vaibhav Bedia, Daniel Mack

As pointed of by Vaibhav, commit 2952b27e2 ("ASoC: davinci-mcasp:
Add support for multichannel playback") duplicated the logic of
counting the active serializers. That can be avoided by shifting
the code around a bit.

Also, drop two unused defines introduced by the same commit.

Signed-off-by: Daniel Mack <zonque@gmail.com>
Cc: Michal Bachraty <michal.bachraty@streamunlimited.com>
Cc: Vaibhav Bedia <vaibhav.bedia@ti.com>
---
 sound/soc/davinci/davinci-mcasp.c | 34 +++++++++++-----------------------
 1 file changed, 11 insertions(+), 23 deletions(-)

diff --git a/sound/soc/davinci/davinci-mcasp.c b/sound/soc/davinci/davinci-mcasp.c
index b386cad..8a9c0ee 100644
--- a/sound/soc/davinci/davinci-mcasp.c
+++ b/sound/soc/davinci/davinci-mcasp.c
@@ -237,8 +237,6 @@
 #define RXSTATE		BIT(5)
 #define SRMOD_MASK	3
 #define SRMOD_INACTIVE	0
-#define SRMOD_TX	1
-#define SRMOD_RX	2
 
 /*
  * DAVINCI_MCASP_LBCTL_REG - Loop Back Control Register Bits
@@ -691,27 +689,6 @@ static int davinci_hw_common_param(struct davinci_audio_dev *dev, int stream,
 	}
 
 	for (i = 0; i < dev->num_serializer; i++) {
-		if (dev->serial_dir[i] == TX_MODE)
-			tx_ser++;
-		if (dev->serial_dir[i] == RX_MODE)
-			rx_ser++;
-	}
-
-	if (stream == SNDRV_PCM_STREAM_PLAYBACK)
-		ser = tx_ser;
-	else
-		ser = rx_ser;
-
-	if (ser < max_active_serializers) {
-		dev_warn(dev->dev, "stream has more channels (%d) than are "
-			"enabled in mcasp (%d)\n", channels, ser * slots);
-		return -EINVAL;
-	}
-
-	tx_ser = 0;
-	rx_ser = 0;
-
-	for (i = 0; i < dev->num_serializer; i++) {
 		mcasp_set_bits(dev->base + DAVINCI_MCASP_XRSRCTL_REG(i),
 					dev->serial_dir[i]);
 		if (dev->serial_dir[i] == TX_MODE &&
@@ -730,6 +707,17 @@ static int davinci_hw_common_param(struct davinci_audio_dev *dev, int stream,
 		}
 	}
 
+	if (stream == SNDRV_PCM_STREAM_PLAYBACK)
+		ser = tx_ser;
+	else
+		ser = rx_ser;
+
+	if (ser < max_active_serializers) {
+		dev_warn(dev->dev, "stream has more channels (%d) than are "
+			"enabled in mcasp (%d)\n", channels, ser * slots);
+		return -EINVAL;
+	}
+
 	if (dev->txnumevt && stream == SNDRV_PCM_STREAM_PLAYBACK) {
 		if (dev->txnumevt * tx_ser > 64)
 			dev->txnumevt = 1;
-- 
1.8.1.4

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

* Re: [PATCH] ALSA: ASoC: davinci-mcasp: clean ip davinci_hw_common_param()
  2013-03-08 13:19 [PATCH] ALSA: ASoC: davinci-mcasp: clean ip davinci_hw_common_param() Daniel Mack
@ 2013-03-08 15:17 ` Michal Bachraty
  2013-03-11  7:09 ` Bedia, Vaibhav
  2013-03-12 19:04 ` Mark Brown
  2 siblings, 0 replies; 5+ messages in thread
From: Michal Bachraty @ 2013-03-08 15:17 UTC (permalink / raw)
  To: Daniel Mack; +Cc: alsa-devel, broonie, Vaibhav Bedia

On Friday, March 08, 2013 14:19:38 Daniel Mack wrote:
> As pointed of by Vaibhav, commit 2952b27e2 ("ASoC: davinci-mcasp:
> Add support for multichannel playback") duplicated the logic of
> counting the active serializers. That can be avoided by shifting
> the code around a bit.
> 
> Also, drop two unused defines introduced by the same commit.
> 
> Signed-off-by: Daniel Mack <zonque@gmail.com>
> Cc: Michal Bachraty <michal.bachraty@streamunlimited.com>
> Cc: Vaibhav Bedia <vaibhav.bedia@ti.com>
> ---
>  sound/soc/davinci/davinci-mcasp.c | 34 +++++++++++-----------------------
>  1 file changed, 11 insertions(+), 23 deletions(-)
> 
> diff --git a/sound/soc/davinci/davinci-mcasp.c
> b/sound/soc/davinci/davinci-mcasp.c index b386cad..8a9c0ee 100644
> --- a/sound/soc/davinci/davinci-mcasp.c
> +++ b/sound/soc/davinci/davinci-mcasp.c
> @@ -237,8 +237,6 @@
>  #define RXSTATE		BIT(5)
>  #define SRMOD_MASK	3
>  #define SRMOD_INACTIVE	0
> -#define SRMOD_TX	1
> -#define SRMOD_RX	2
> 
>  /*
>   * DAVINCI_MCASP_LBCTL_REG - Loop Back Control Register Bits
> @@ -691,27 +689,6 @@ static int davinci_hw_common_param(struct
> davinci_audio_dev *dev, int stream, }
> 
>  	for (i = 0; i < dev->num_serializer; i++) {
> -		if (dev->serial_dir[i] == TX_MODE)
> -			tx_ser++;
> -		if (dev->serial_dir[i] == RX_MODE)
> -			rx_ser++;
> -	}
> -
> -	if (stream == SNDRV_PCM_STREAM_PLAYBACK)
> -		ser = tx_ser;
> -	else
> -		ser = rx_ser;
> -
> -	if (ser < max_active_serializers) {
> -		dev_warn(dev->dev, "stream has more channels (%d) than are "
> -			"enabled in mcasp (%d)\n", channels, ser * slots);
> -		return -EINVAL;
> -	}
> -
> -	tx_ser = 0;
> -	rx_ser = 0;
> -
> -	for (i = 0; i < dev->num_serializer; i++) {
>  		mcasp_set_bits(dev->base + DAVINCI_MCASP_XRSRCTL_REG(i),
>  					dev->serial_dir[i]);
>  		if (dev->serial_dir[i] == TX_MODE &&
> @@ -730,6 +707,17 @@ static int davinci_hw_common_param(struct
> davinci_audio_dev *dev, int stream, }
>  	}
> 
> +	if (stream == SNDRV_PCM_STREAM_PLAYBACK)
> +		ser = tx_ser;
> +	else
> +		ser = rx_ser;
> +
> +	if (ser < max_active_serializers) {
> +		dev_warn(dev->dev, "stream has more channels (%d) than are "
> +			"enabled in mcasp (%d)\n", channels, ser * slots);
> +		return -EINVAL;
> +	}
> +
>  	if (dev->txnumevt && stream == SNDRV_PCM_STREAM_PLAYBACK) {
>  		if (dev->txnumevt * tx_ser > 64)
>  			dev->txnumevt = 1;

It works fine. Code is also ok.

Michal

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

* Re: [PATCH] ALSA: ASoC: davinci-mcasp: clean ip davinci_hw_common_param()
  2013-03-08 13:19 [PATCH] ALSA: ASoC: davinci-mcasp: clean ip davinci_hw_common_param() Daniel Mack
  2013-03-08 15:17 ` Michal Bachraty
@ 2013-03-11  7:09 ` Bedia, Vaibhav
  2013-03-11  8:49   ` Daniel Mack
  2013-03-12 19:04 ` Mark Brown
  2 siblings, 1 reply; 5+ messages in thread
From: Bedia, Vaibhav @ 2013-03-11  7:09 UTC (permalink / raw)
  To: Daniel Mack, alsa-devel@alsa-project.org
  Cc: broonie@opensource.wolfsonmicro.com, Michal Bachraty

On Fri, Mar 08, 2013 at 18:49:38, Daniel Mack wrote:
> As pointed of by Vaibhav, commit 2952b27e2 ("ASoC: davinci-mcasp:
> Add support for multichannel playback") duplicated the logic of
> counting the active serializers. That can be avoided by shifting
> the code around a bit.
> 
> Also, drop two unused defines introduced by the same commit.
> 

s/clean ip/clean up/ in the $subject.

Other than that, this looks fine to me.

Acked-by: Vaibhav Bedia <vaibhav.bedia@ti.com>

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

* Re: [PATCH] ALSA: ASoC: davinci-mcasp: clean ip davinci_hw_common_param()
  2013-03-11  7:09 ` Bedia, Vaibhav
@ 2013-03-11  8:49   ` Daniel Mack
  0 siblings, 0 replies; 5+ messages in thread
From: Daniel Mack @ 2013-03-11  8:49 UTC (permalink / raw)
  To: Bedia, Vaibhav
  Cc: alsa-devel@alsa-project.org, broonie@opensource.wolfsonmicro.com,
	Michal Bachraty

On 11.03.2013 08:09, Bedia, Vaibhav wrote:
> On Fri, Mar 08, 2013 at 18:49:38, Daniel Mack wrote:
>> As pointed of by Vaibhav, commit 2952b27e2 ("ASoC: davinci-mcasp:
>> Add support for multichannel playback") duplicated the logic of
>> counting the active serializers. That can be avoided by shifting
>> the code around a bit.
>>
>> Also, drop two unused defines introduced by the same commit.
>>
> 
> s/clean ip/clean up/ in the $subject.
>
> Other than that, this looks fine to me.
> 
> Acked-by: Vaibhav Bedia <vaibhav.bedia@ti.com>
>

Thanks! Mark - you want me to resend with the fixed subject line or can
you do it when commiting?


Daniel

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

* Re: [PATCH] ALSA: ASoC: davinci-mcasp: clean ip davinci_hw_common_param()
  2013-03-08 13:19 [PATCH] ALSA: ASoC: davinci-mcasp: clean ip davinci_hw_common_param() Daniel Mack
  2013-03-08 15:17 ` Michal Bachraty
  2013-03-11  7:09 ` Bedia, Vaibhav
@ 2013-03-12 19:04 ` Mark Brown
  2 siblings, 0 replies; 5+ messages in thread
From: Mark Brown @ 2013-03-12 19:04 UTC (permalink / raw)
  To: Daniel Mack; +Cc: alsa-devel, Michal Bachraty, Vaibhav Bedia


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

On Fri, Mar 08, 2013 at 02:19:38PM +0100, Daniel Mack wrote:
> As pointed of by Vaibhav, commit 2952b27e2 ("ASoC: davinci-mcasp:
> Add support for multichannel playback") duplicated the logic of
> counting the active serializers. That can be avoided by shifting
> the code around a bit.

Applied, thanks.

[-- 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] 5+ messages in thread

end of thread, other threads:[~2013-03-12 19:04 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-03-08 13:19 [PATCH] ALSA: ASoC: davinci-mcasp: clean ip davinci_hw_common_param() Daniel Mack
2013-03-08 15:17 ` Michal Bachraty
2013-03-11  7:09 ` Bedia, Vaibhav
2013-03-11  8:49   ` Daniel Mack
2013-03-12 19:04 ` Mark Brown

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).