alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
From: Michael Trimarchi <michael@amarulasolutions.com>
To: Nicolin Chen <nicoleotsuka@gmail.com>
Cc: "alsa-devel@alsa-project.org" <alsa-devel@alsa-project.org>,
	Lars-Peter Clausen <lars@metafoo.de>,
	Shengjiu Wang <shengjiu.wang@freescale.com>,
	Markus Pargmann <mpa@pengutronix.de>,
	Jean-Michel Hautbois <jean-michel.hautbois@vodalys.com>,
	Fabio Estevam <festevam@gmail.com>,
	Shawn Guo <shawn.guo@freescale.com>
Subject: Re: No sound captured with SGTL5000 on i.MX6 in I²S master mode
Date: Thu, 18 Sep 2014 20:03:31 +0200	[thread overview]
Message-ID: <20140918180331.GA19033@panicking> (raw)
In-Reply-To: <20140918174526.GA6432@Asurada>

Hi

On Thu, Sep 18, 2014 at 10:45:27AM -0700, Nicolin Chen wrote:
> On Thu, Sep 18, 2014 at 07:26:11PM +0200, Michael Trimarchi wrote:
> > bug was reported by Jean-Michel. I don't know if it works because I can not
> > test but seems ok. Do we need this _set_dai_fmt in probe function?
> 
> I think yes. The AC97 part might need this _set_dai_fmt call in the
> probe().
> 
> > code is a bit broken just because panic on probe path if pdev is null
> > [...]
> > 	/*
> > 	 * If codec-handle property is missing from SSI node, we assume
> > 	 * that the machine driver uses new binding which does not require
> > 	 * SSI driver to trigger machine driver's probe.
> > 	 */
> > 	if (!of_get_property(np, "codec-handle", NULL))
> > 		goto done;
> > [...]
> > 	ssi_private->pdev =
> > 		platform_device_register_data(&pdev->dev, name, 0, NULL, 0);
> > [...]
> > done:
> > 	if (ssi_private->dai_fmt)
> > 		_fsl_ssi_set_dai_fmt(ssi_private, ssi_private->dai_fmt);
> > 
> > 
> > diff --git a/sound/soc/fsl/fsl_ssi.c b/sound/soc/fsl/fsl_ssi.c
> > index 87eb577..f63bc02 100644
> > --- a/sound/soc/fsl/fsl_ssi.c
> > +++ b/sound/soc/fsl/fsl_ssi.c
> > @@ -758,7 +758,8 @@ static int _fsl_ssi_set_dai_fmt(struct fsl_ssi_private *ssi_private,
> >  	ssi_private->dai_fmt = fmt;
> >  
> >  	if (fsl_ssi_is_i2s_master(ssi_private) && IS_ERR(ssi_private->baudclk)) {
> > -		dev_err(&ssi_private->pdev->dev, "baudclk is missing which is necessary for master mode\n");
> > +		pr_err("baudclk is missing which is necessary"
> > +			" for master mode\n");
> 
> Ah, this is a problem. We should not use ssi_private->pdev->dev here.
> I think it'll be better if adding a new parameter of *dev pointer to
> this _set_dai_fmt() -- passing pdev->dev in probe() and cpu_dai->dev
> in fsl_ssi_set_dai_fmt().
> 

Somenthing like this?

diff --git a/sound/soc/fsl/fsl_ssi.c b/sound/soc/fsl/fsl_ssi.c
index 87eb577..de6ab06 100644
--- a/sound/soc/fsl/fsl_ssi.c
+++ b/sound/soc/fsl/fsl_ssi.c
@@ -748,8 +748,9 @@ static int fsl_ssi_hw_free(struct snd_pcm_substream *substream,
 	return 0;
 }
 
-static int _fsl_ssi_set_dai_fmt(struct fsl_ssi_private *ssi_private,
-		unsigned int fmt)
+static int _fsl_ssi_set_dai_fmt(struct device *dev,
+				struct fsl_ssi_private *ssi_private,
+				unsigned int fmt)
 {
 	struct regmap *regs = ssi_private->regs;
 	u32 strcr = 0, stcr, srcr, scr, mask;
@@ -758,7 +759,7 @@ static int _fsl_ssi_set_dai_fmt(struct fsl_ssi_private *ssi_private,
 	ssi_private->dai_fmt = fmt;
 
 	if (fsl_ssi_is_i2s_master(ssi_private) && IS_ERR(ssi_private->baudclk)) {
-		dev_err(&ssi_private->pdev->dev, "baudclk is missing which is necessary for master mode\n");
+		dev_err(dev, "baudclk is missing which is necessary for master mode\n");
 		return -EINVAL;
 	}
 
@@ -913,7 +914,7 @@ static int fsl_ssi_set_dai_fmt(struct snd_soc_dai *cpu_dai, unsigned int fmt)
 {
 	struct fsl_ssi_private *ssi_private = snd_soc_dai_get_drvdata(cpu_dai);
 
-	return _fsl_ssi_set_dai_fmt(ssi_private, fmt);
+	return _fsl_ssi_set_dai_fmt(cpu_dai->dev, ssi_private, fmt);
 }
 
 /**
@@ -1387,7 +1388,8 @@ static int fsl_ssi_probe(struct platform_device *pdev)
 
 done:
 	if (ssi_private->dai_fmt)
-		_fsl_ssi_set_dai_fmt(ssi_private, ssi_private->dai_fmt);
+		_fsl_ssi_set_dai_fmt(&pdev->dev, ssi_private,
+				     ssi_private->dai_fmt);
 
 	return 0;
 
> Nicolin

-- 
| Michael Nazzareno Trimarchi                     Amarula Solutions BV |
| COO  -  Founder                                      Cruquiuskade 47 |
| +31(0)851119172                                 Amsterdam 1018 AM NL |
|                  [`as] http://www.amarulasolutions.com               |

  reply	other threads:[~2014-09-18 18:03 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-18 12:56 No sound captured with SGTL5000 on i.MX6 in I²S master mode Jean-Michel Hautbois
2014-09-18 13:30 ` Fabio Estevam
2014-09-18 13:35   ` Michael Trimarchi
2014-09-18 13:45     ` Jean-Michel Hautbois
2014-09-18 13:55       ` Michael Trimarchi
2014-09-18 14:09         ` Jean-Michel Hautbois
2014-09-18 16:09           ` Jean-Michel Hautbois
2014-09-18 17:05             ` Nicolin Chen
2014-09-18 17:26               ` Michael Trimarchi
2014-09-18 17:45                 ` Nicolin Chen
2014-09-18 18:03                   ` Michael Trimarchi [this message]
2014-09-18 18:13                     ` Nicolin Chen
2014-09-18 18:18                       ` Michael Trimarchi
2014-09-18 17:28               ` Fabio Estevam
2014-09-18 17:49                 ` Nicolin Chen
2014-09-18 17:58                   ` Fabio Estevam
2014-09-18 18:07                     ` Nicolin Chen
2014-09-18 18:14                       ` Fabio Estevam
2014-09-18 18:39                         ` Nicolin Chen
2014-09-18 23:35                           ` Fabio Estevam
2014-09-18 23:50                             ` Nicolin Chen
2014-09-19  7:42                               ` Jean-Michel Hautbois
2014-09-19  7:52                                 ` Nicolin Chen
2014-09-19  9:18                                   ` Jean-Michel Hautbois
2014-09-19 12:53                                     ` Jean-Michel Hautbois
2014-10-09 14:02                                       ` Jean-Michel Hautbois
2014-10-09 14:18                                         ` Fabio Estevam
2014-10-09 14:26                                           ` Jean-Michel Hautbois
2014-10-09 15:06                                             ` Fabio Estevam
2014-10-09 15:14                                               ` Jean-Michel Hautbois
2014-10-09 15:19                                                 ` Fabio Estevam
2014-10-10 15:49                                                   ` Jean-Michel Hautbois
2014-10-10 15:54                                                     ` Fabio Estevam
2014-09-22  3:26                       ` Fabio Estevam
2014-09-22  3:41                         ` Nicolin Chen
2014-09-18 17:19   ` Nicolin Chen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20140918180331.GA19033@panicking \
    --to=michael@amarulasolutions.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=festevam@gmail.com \
    --cc=jean-michel.hautbois@vodalys.com \
    --cc=lars@metafoo.de \
    --cc=mpa@pengutronix.de \
    --cc=nicoleotsuka@gmail.com \
    --cc=shawn.guo@freescale.com \
    --cc=shengjiu.wang@freescale.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).