alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ASoC: codecs: Replace instances of rtd->codec with dai->codec
@ 2014-03-13 20:24 Lars-Peter Clausen
  2014-03-14  9:11 ` Charles Keepax
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Lars-Peter Clausen @ 2014-03-13 20:24 UTC (permalink / raw)
  To: Mark Brown, Liam Girdwood
  Cc: alsa-devel, Rajeev Kumar, patches, Jyri Sarha,
	Vishwas A Deshpande, Lars-Peter Clausen, M R Swami Reddy,
	Bard Liao, Charles Keepax

With CODEC to CODEC links rtd->codec does not necessarily point to the driver's
CODEC. CODEC drivers should always use dai->codec and never even look at the PCM
runtime.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
---
 sound/soc/codecs/isabelle.c      | 3 +--
 sound/soc/codecs/mc13783.c       | 6 ++----
 sound/soc/codecs/rt5640.c        | 3 +--
 sound/soc/codecs/sta529.c        | 3 +--
 sound/soc/codecs/tlv320aic31xx.c | 5 ++---
 sound/soc/codecs/uda134x.c       | 3 +--
 sound/soc/codecs/uda1380.c       | 3 +--
 sound/soc/codecs/wm8580.c        | 3 +--
 8 files changed, 10 insertions(+), 19 deletions(-)

diff --git a/sound/soc/codecs/isabelle.c b/sound/soc/codecs/isabelle.c
index 3e264a7..3a89ce6 100644
--- a/sound/soc/codecs/isabelle.c
+++ b/sound/soc/codecs/isabelle.c
@@ -918,8 +918,7 @@ static int isabelle_hw_params(struct snd_pcm_substream *substream,
 			      struct snd_pcm_hw_params *params,
 			      struct snd_soc_dai *dai)
 {
-	struct snd_soc_pcm_runtime *rtd = substream->private_data;
-	struct snd_soc_codec *codec = rtd->codec;
+	struct snd_soc_codec *codec = dai->codec;
 	u16 aif = 0;
 	unsigned int fs_val = 0;
 
diff --git a/sound/soc/codecs/mc13783.c b/sound/soc/codecs/mc13783.c
index 37d737e..2c59b1f 100644
--- a/sound/soc/codecs/mc13783.c
+++ b/sound/soc/codecs/mc13783.c
@@ -106,8 +106,7 @@ static int mc13783_pcm_hw_params_dac(struct snd_pcm_substream *substream,
 				struct snd_pcm_hw_params *params,
 				struct snd_soc_dai *dai)
 {
-	struct snd_soc_pcm_runtime *rtd = substream->private_data;
-	struct snd_soc_codec *codec = rtd->codec;
+	struct snd_soc_codec *codec = dai->codec;
 	unsigned int rate = params_rate(params);
 	int i;
 
@@ -126,8 +125,7 @@ static int mc13783_pcm_hw_params_codec(struct snd_pcm_substream *substream,
 				struct snd_pcm_hw_params *params,
 				struct snd_soc_dai *dai)
 {
-	struct snd_soc_pcm_runtime *rtd = substream->private_data;
-	struct snd_soc_codec *codec = rtd->codec;
+	struct snd_soc_codec *codec = dai->codec;
 	unsigned int rate = params_rate(params);
 	unsigned int val;
 
diff --git a/sound/soc/codecs/rt5640.c b/sound/soc/codecs/rt5640.c
index 13ccee4..0061ae6 100644
--- a/sound/soc/codecs/rt5640.c
+++ b/sound/soc/codecs/rt5640.c
@@ -1594,8 +1594,7 @@ static int get_clk_info(int sclk, int rate)
 static int rt5640_hw_params(struct snd_pcm_substream *substream,
 	struct snd_pcm_hw_params *params, struct snd_soc_dai *dai)
 {
-	struct snd_soc_pcm_runtime *rtd = substream->private_data;
-	struct snd_soc_codec *codec = rtd->codec;
+	struct snd_soc_codec *codec = dai->codec;
 	struct rt5640_priv *rt5640 = snd_soc_codec_get_drvdata(codec);
 	unsigned int val_len = 0, val_clk, mask_clk;
 	int dai_sel, pre_div, bclk_ms, frame_size;
diff --git a/sound/soc/codecs/sta529.c b/sound/soc/codecs/sta529.c
index a3c61d3..a40c4b0 100644
--- a/sound/soc/codecs/sta529.c
+++ b/sound/soc/codecs/sta529.c
@@ -193,8 +193,7 @@ static int sta529_hw_params(struct snd_pcm_substream *substream,
 		struct snd_pcm_hw_params *params,
 		struct snd_soc_dai *dai)
 {
-	struct snd_soc_pcm_runtime *rtd = substream->private_data;
-	struct snd_soc_codec *codec = rtd->codec;
+	struct snd_soc_codec *codec = dai->codec;
 	int pdata, play_freq_val, record_freq_val;
 	int bclk_to_fs_ratio;
 
diff --git a/sound/soc/codecs/tlv320aic31xx.c b/sound/soc/codecs/tlv320aic31xx.c
index d3517a9..cc1c9c2 100644
--- a/sound/soc/codecs/tlv320aic31xx.c
+++ b/sound/soc/codecs/tlv320aic31xx.c
@@ -753,10 +753,9 @@ static int aic31xx_setup_pll(struct snd_soc_codec *codec,
 
 static int aic31xx_hw_params(struct snd_pcm_substream *substream,
 			     struct snd_pcm_hw_params *params,
-			     struct snd_soc_dai *tmp)
+			     struct snd_soc_dai *dai)
 {
-	struct snd_soc_pcm_runtime *rtd = substream->private_data;
-	struct snd_soc_codec *codec = rtd->codec;
+	struct snd_soc_codec *codec = dai->codec;
 	u8 data = 0;
 
 	dev_dbg(codec->dev, "## %s: format %d width %d rate %d\n",
diff --git a/sound/soc/codecs/uda134x.c b/sound/soc/codecs/uda134x.c
index c94d4c1..edf27ac 100644
--- a/sound/soc/codecs/uda134x.c
+++ b/sound/soc/codecs/uda134x.c
@@ -203,8 +203,7 @@ static int uda134x_hw_params(struct snd_pcm_substream *substream,
 	struct snd_pcm_hw_params *params,
 	struct snd_soc_dai *dai)
 {
-	struct snd_soc_pcm_runtime *rtd = substream->private_data;
-	struct snd_soc_codec *codec = rtd->codec;
+	struct snd_soc_codec *codec = dai->codec;
 	struct uda134x_priv *uda134x = snd_soc_codec_get_drvdata(codec);
 	u8 hw_params;
 
diff --git a/sound/soc/codecs/uda1380.c b/sound/soc/codecs/uda1380.c
index 4dadaa8..e62e707 100644
--- a/sound/soc/codecs/uda1380.c
+++ b/sound/soc/codecs/uda1380.c
@@ -566,8 +566,7 @@ static int uda1380_pcm_hw_params(struct snd_pcm_substream *substream,
 static void uda1380_pcm_shutdown(struct snd_pcm_substream *substream,
 				 struct snd_soc_dai *dai)
 {
-	struct snd_soc_pcm_runtime *rtd = substream->private_data;
-	struct snd_soc_codec *codec = rtd->codec;
+	struct snd_soc_codec *codec = dai->codec;
 	u16 clk = uda1380_read_reg_cache(codec, UDA1380_CLK);
 
 	/* shut down WSPLL power if running from this clock */
diff --git a/sound/soc/codecs/wm8580.c b/sound/soc/codecs/wm8580.c
index 7558c83..af7ed8b 100644
--- a/sound/soc/codecs/wm8580.c
+++ b/sound/soc/codecs/wm8580.c
@@ -504,8 +504,7 @@ static int wm8580_paif_hw_params(struct snd_pcm_substream *substream,
 				 struct snd_pcm_hw_params *params,
 				 struct snd_soc_dai *dai)
 {
-	struct snd_soc_pcm_runtime *rtd = substream->private_data;
-	struct snd_soc_codec *codec = rtd->codec;
+	struct snd_soc_codec *codec = dai->codec;
 	struct wm8580_priv *wm8580 = snd_soc_codec_get_drvdata(codec);
 	u16 paifa = 0;
 	u16 paifb = 0;
-- 
1.8.0

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

* Re: [PATCH] ASoC: codecs: Replace instances of rtd->codec with dai->codec
  2014-03-13 20:24 [PATCH] ASoC: codecs: Replace instances of rtd->codec with dai->codec Lars-Peter Clausen
@ 2014-03-14  9:11 ` Charles Keepax
  2014-03-14 10:15 ` Jyri Sarha
  2014-03-18 12:46 ` Mark Brown
  2 siblings, 0 replies; 4+ messages in thread
From: Charles Keepax @ 2014-03-14  9:11 UTC (permalink / raw)
  To: Lars-Peter Clausen
  Cc: alsa-devel, Rajeev Kumar, patches, Liam Girdwood, Jyri Sarha,
	Vishwas A Deshpande, Mark Brown, M R Swami Reddy, Bard Liao

On Thu, Mar 13, 2014 at 09:24:54PM +0100, Lars-Peter Clausen wrote:
> With CODEC to CODEC links rtd->codec does not necessarily point to the driver's
> CODEC. CODEC drivers should always use dai->codec and never even look at the PCM
> runtime.
> 
> Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>

For the Wolfson bit:

Acked-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>

Thanks,
Charles

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

* Re: [PATCH] ASoC: codecs: Replace instances of rtd->codec with dai->codec
  2014-03-13 20:24 [PATCH] ASoC: codecs: Replace instances of rtd->codec with dai->codec Lars-Peter Clausen
  2014-03-14  9:11 ` Charles Keepax
@ 2014-03-14 10:15 ` Jyri Sarha
  2014-03-18 12:46 ` Mark Brown
  2 siblings, 0 replies; 4+ messages in thread
From: Jyri Sarha @ 2014-03-14 10:15 UTC (permalink / raw)
  To: Lars-Peter Clausen, Mark Brown, Liam Girdwood
  Cc: alsa-devel, Rajeev Kumar, patches, Vishwas A Deshpande,
	M R Swami Reddy, Bard Liao, Charles Keepax

On 03/13/2014 10:24 PM, Lars-Peter Clausen wrote:
> With CODEC to CODEC links rtd->codec does not necessarily point to the driver's
> CODEC. CODEC drivers should always use dai->codec and never even look at the PCM
> runtime.
>
> Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
> ---
[...]
> diff --git a/sound/soc/codecs/tlv320aic31xx.c b/sound/soc/codecs/tlv320aic31xx.c
> index d3517a9..cc1c9c2 100644
> --- a/sound/soc/codecs/tlv320aic31xx.c
> +++ b/sound/soc/codecs/tlv320aic31xx.c
> @@ -753,10 +753,9 @@ static int aic31xx_setup_pll(struct snd_soc_codec *codec,
>
>   static int aic31xx_hw_params(struct snd_pcm_substream *substream,
>   			     struct snd_pcm_hw_params *params,
> -			     struct snd_soc_dai *tmp)
> +			     struct snd_soc_dai *dai)
>   {
> -	struct snd_soc_pcm_runtime *rtd = substream->private_data;
> -	struct snd_soc_codec *codec = rtd->codec;
> +	struct snd_soc_codec *codec = dai->codec;
>   	u8 data = 0;
>
>   	dev_dbg(codec->dev, "## %s: format %d width %d rate %d\n",
[...]

Concerning the part above.

Acked-by: Jyri Sarha <jsarha@ti.com>

Best regards,
Jyri

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

* Re: [PATCH] ASoC: codecs: Replace instances of rtd->codec with dai->codec
  2014-03-13 20:24 [PATCH] ASoC: codecs: Replace instances of rtd->codec with dai->codec Lars-Peter Clausen
  2014-03-14  9:11 ` Charles Keepax
  2014-03-14 10:15 ` Jyri Sarha
@ 2014-03-18 12:46 ` Mark Brown
  2 siblings, 0 replies; 4+ messages in thread
From: Mark Brown @ 2014-03-18 12:46 UTC (permalink / raw)
  To: Lars-Peter Clausen
  Cc: alsa-devel, Rajeev Kumar, patches, Liam Girdwood, Jyri Sarha,
	Vishwas A Deshpande, M R Swami Reddy, Bard Liao, Charles Keepax


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

On Thu, Mar 13, 2014 at 09:24:54PM +0100, Lars-Peter Clausen wrote:
> With CODEC to CODEC links rtd->codec does not necessarily point to the driver's
> CODEC. CODEC drivers should always use dai->codec and never even look at the PCM
> runtime.

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

end of thread, other threads:[~2014-03-18 12:46 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-03-13 20:24 [PATCH] ASoC: codecs: Replace instances of rtd->codec with dai->codec Lars-Peter Clausen
2014-03-14  9:11 ` Charles Keepax
2014-03-14 10:15 ` Jyri Sarha
2014-03-18 12:46 ` 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).