Alsa-Devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ASoC: DaVinci: Updates to EVM hardware params callback
@ 2010-01-20 11:32 Chaithrika U S
  2010-01-26 11:14 ` Mark Brown
  0 siblings, 1 reply; 2+ messages in thread
From: Chaithrika U S @ 2010-01-20 11:32 UTC (permalink / raw)
  To: alsa-devel; +Cc: khilman, Chaithrika U S, davinci-linux-open-source, broonie

For S/PDIF transciever codec to work on TI DM6467 EVM,
the codec ops pointer should be checked for in the params callback.
This dummy codec has no set_fmt or set_sysclk implementations.

Tested on TI DM6467 EVM.

Signed-off-by: Chaithrika U S <chaithrika@ti.com>
Tested-by: Anuj Aggarwal <anuj.aggarwal@ti.com>
---
Applies to ALSA GIT tree on branch topic/asoc at
http://git.kernel.org/?p=linux/kernel/git/tiwai/sound-2.6.git;a=shortlog;
h=topic/asoc

 sound/soc/davinci/davinci-evm.c |   17 +++++++++++------
 1 files changed, 11 insertions(+), 6 deletions(-)

diff --git a/sound/soc/davinci/davinci-evm.c b/sound/soc/davinci/davinci-evm.c
index 7ccbe66..1760354 100644
--- a/sound/soc/davinci/davinci-evm.c
+++ b/sound/soc/davinci/davinci-evm.c
@@ -64,9 +64,11 @@ static int evm_hw_params(struct snd_pcm_substream *substream,
 		return -EINVAL;
 
 	/* set codec DAI configuration */
-	ret = snd_soc_dai_set_fmt(codec_dai, AUDIO_FORMAT);
-	if (ret < 0)
-		return ret;
+	if (codec_dai->ops->set_fmt) {
+		ret = snd_soc_dai_set_fmt(codec_dai, AUDIO_FORMAT);
+		if (ret < 0)
+			return ret;
+	}
 
 	/* set cpu DAI configuration */
 	ret = snd_soc_dai_set_fmt(cpu_dai, AUDIO_FORMAT);
@@ -74,9 +76,12 @@ static int evm_hw_params(struct snd_pcm_substream *substream,
 		return ret;
 
 	/* set the codec system clock */
-	ret = snd_soc_dai_set_sysclk(codec_dai, 0, sysclk, SND_SOC_CLOCK_OUT);
-	if (ret < 0)
-		return ret;
+	if (codec_dai->ops->set_sysclk) {
+		ret = snd_soc_dai_set_sysclk(codec_dai, 0, sysclk,
+							SND_SOC_CLOCK_OUT);
+		if (ret < 0)
+			return ret;
+	}
 
 	return 0;
 }
-- 
1.5.6

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

* Re: [PATCH] ASoC: DaVinci: Updates to EVM hardware params callback
  2010-01-20 11:32 [PATCH] ASoC: DaVinci: Updates to EVM hardware params callback Chaithrika U S
@ 2010-01-26 11:14 ` Mark Brown
  0 siblings, 0 replies; 2+ messages in thread
From: Mark Brown @ 2010-01-26 11:14 UTC (permalink / raw)
  To: Chaithrika U S; +Cc: khilman, alsa-devel, davinci-linux-open-source

On Wed, Jan 20, 2010 at 05:02:41PM +0530, Chaithrika U S wrote:

> @@ -64,9 +64,11 @@ static int evm_hw_params(struct snd_pcm_substream *substream,
>  		return -EINVAL;
>  
>  	/* set codec DAI configuration */
> -	ret = snd_soc_dai_set_fmt(codec_dai, AUDIO_FORMAT);
> -	if (ret < 0)
> -		return ret;
> +	if (codec_dai->ops->set_fmt) {
> +		ret = snd_soc_dai_set_fmt(codec_dai, AUDIO_FORMAT);
> +		if (ret < 0)
> +			return ret;
> +	}

It would be better to have separate hw_params() functions for separate
links rather than do things like this.  There's a strong expectation
that the board driver knows exactly what CODEC it's talking to and how
to configure it so code like this looks odd.

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

end of thread, other threads:[~2010-01-26 11:14 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-01-20 11:32 [PATCH] ASoC: DaVinci: Updates to EVM hardware params callback Chaithrika U S
2010-01-26 11:14 ` Mark Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox