From patchwork Thu Sep 18 18:03:31 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Nazzareno Trimarchi X-Patchwork-Id: 4933111 Return-Path: X-Original-To: patchwork-alsa-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 0E5C79F350 for ; Thu, 18 Sep 2014 18:03:28 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 4512E2017D for ; Thu, 18 Sep 2014 18:03:58 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id 78B4620179 for ; Thu, 18 Sep 2014 18:03:56 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id 0FC622655AB; Thu, 18 Sep 2014 20:03:55 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 Received: from alsa0.perex.cz (localhost [IPv6:::1]) by alsa0.perex.cz (Postfix) with ESMTP id EA76026556A; Thu, 18 Sep 2014 20:03:45 +0200 (CEST) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa0.perex.cz (Postfix, from userid 1000) id 2C1AE265586; Thu, 18 Sep 2014 20:03:44 +0200 (CEST) Received: from mail-wg0-f50.google.com (mail-wg0-f50.google.com [74.125.82.50]) by alsa0.perex.cz (Postfix) with ESMTP id B5D9826551B for ; Thu, 18 Sep 2014 20:03:37 +0200 (CEST) Received: by mail-wg0-f50.google.com with SMTP id x13so1287196wgg.33 for ; Thu, 18 Sep 2014 11:03:37 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-type:content-disposition:in-reply-to :user-agent; bh=Yl2p7FrXp/qe5Lxta24Dj6AuCMRT5PP92sheY6Y0fgA=; b=ADXG9POORlmmIxBEqLXwHN2jUZ/Ies4rtV1FM6YogYddoi+PGZv4SJKCHw4Lh6PnhW tjMdmh6hagfr5dsIuklfo+XSTVkdWyEOC0FChrEFun0ogkXliTIBLpJn5Aked7kFgNWh RbnExgsBlri2B5mcqpccPU9sf97YXD6a8mSAoB+CtYKCCVsZOgs73azQ/fMfSi8ZuLi9 M+2JnqoZ2PfSfTfeApYdiLDGW47uszECttr4Vd5+b1Bfahz4ZnXw2MBdt8uww9QcLK+T 6NWvajSuUfajb3AeGZBjEudwnlqDVAdqH+TxbiEux22ZzOhvLRJNEiH6H1lIrfBPT1gr 9p8g== X-Gm-Message-State: ALoCoQlZHe0CpvR1LBr/ssQNuefOsnoshM04CeWbgAiW8GAFZIaw6IjVTDLP0ps5eIjySndtUhb7 X-Received: by 10.194.81.230 with SMTP id d6mr6694159wjy.49.1411063417346; Thu, 18 Sep 2014 11:03:37 -0700 (PDT) Received: from panicking ([91.252.77.34]) by mx.google.com with ESMTPSA id q13sm3855500wik.8.2014.09.18.11.03.35 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Thu, 18 Sep 2014 11:03:36 -0700 (PDT) Date: Thu, 18 Sep 2014 20:03:31 +0200 From: Michael Trimarchi To: Nicolin Chen Message-ID: <20140918180331.GA19033@panicking> References: <20140918170524.GA6080@Asurada> <20140918172611.GA17048@panicking> <20140918174526.GA6432@Asurada> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20140918174526.GA6432@Asurada> User-Agent: Mutt/1.5.21 (2010-09-15) Cc: "alsa-devel@alsa-project.org" , Lars-Peter Clausen , Shengjiu Wang , Markus Pargmann , Jean-Michel Hautbois , Fabio Estevam , Shawn Guo Subject: Re: [alsa-devel] =?iso-8859-1?q?No_sound_captured_with_SGTL5000_on_i?= =?iso-8859-1?q?=2EMX6_in_I=B2S_master_mode?= X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP 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? > Nicolin 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;