From: Dong Aisheng <aisheng.dong@freescale.com>
To: Shawn Guo <shawn.guo@linaro.org>
Cc: "alsa-devel@alsa-project.org" <alsa-devel@alsa-project.org>,
Mark Brown <broonie@opensource.wolfsonmicro.com>,
Dong Aisheng-B29396 <B29396@freescale.com>,
"linux-arm-kernel@lists.infradead.org"
<linux-arm-kernel@lists.infradead.org>,
Dong Aisheng <dong.aisheng@linaro.org>
Subject: Re: [PATCH 5/6] ASoC: mxs: add device tree support for mxs-sgtl5000
Date: Fri, 11 May 2012 10:33:03 +0800 [thread overview]
Message-ID: <20120511023302.GN6622@shlinux2.ap.freescale.net> (raw)
In-Reply-To: <20120510122001.GM17875@S2101-09.ap.freescale.net>
On Thu, May 10, 2012 at 08:20:04PM +0800, Shawn Guo wrote:
> On Thu, May 10, 2012 at 07:16:46PM +0800, Dong Aisheng wrote:
> > > +static int __devinit mxs_sgtl5000_probe_dt(struct platform_device *pdev)
> > > +{
> > > + struct device_node *np = pdev->dev.of_node;
> > > + struct device_node *saif_np[2], *codec_np;
> > > + struct platform_device *saif_pdev[2];
> > > + int i, ret = 0;
> > > +
> > > + if (!np)
> > > + return 1; /* no device tree */
> > > +
> > > + saif_np[0] = of_parse_phandle(np, "saif-controllers", 0);
> > > + saif_np[1] = of_parse_phandle(np, "saif-controllers", 1);
> > > + codec_np = of_parse_phandle(np, "audio-codec", 0);
> > > + if (!saif_np[0] || !saif_np[1] || !codec_np) {
> > > + dev_err(&pdev->dev, "phandle missing or invalid\n");
> > > + return -EINVAL;
> > > + }
> > ...
> >
> > > +
> > > + saif_pdev[0] = of_find_device_by_node(saif_np[0]);
> > > + saif_pdev[1] = of_find_device_by_node(saif_np[1]);
> > > + if (!saif_pdev[0] || !saif_pdev[1]) {
> > > + dev_err(&pdev->dev, "failed to find saif platform device\n");
> > > + ret = -EINVAL;
> > > + goto out;
> > > + }
> > Do we really need this checking?
> >
> Hmm, why not? We need to ensure that the phandles are correctly
> represented in device tree.
>
Hmm, even we need to do sanity check, i guess this could be done in
core since the core will take these nodes as parameter.
However, after checking the core a bit, i guess the core has already
done this:
/* no, then find CPU DAI from registered DAIs*/
list_for_each_entry(cpu_dai, &dai_list, list) {
if (dai_link->cpu_dai_of_node) {
if (cpu_dai->dev->of_node != dai_link->cpu_dai_of_node)
continue;
} else {
if (strcmp(cpu_dai->name, dai_link->cpu_dai_name))
continue;
}
rtd->cpu_dai = cpu_dai;
goto find_codec;
}
It looks if the phandles are not correctly represented, the dai binding
will fail, right?
Regards
Dong Aisheng
next prev parent reply other threads:[~2012-05-11 2:26 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-05-10 8:42 [PATCH 0/6] Add device tree support for mxs audio Shawn Guo
2012-05-10 8:42 ` [PATCH 1/6] ASoC: mxs: add __devinit for mxs_saif_probe Shawn Guo
2012-05-10 8:58 ` Dong Aisheng
2012-05-10 9:32 ` Mark Brown
2012-05-10 8:42 ` [PATCH 2/6] ASoC: mxs: use devm_clk_get " Shawn Guo
2012-05-10 9:12 ` Dong Aisheng
2012-05-10 9:11 ` Shawn Guo
2012-05-10 9:13 ` Mark Brown
2012-05-10 9:17 ` Shawn Guo
2012-05-10 9:30 ` Mark Brown
2012-05-10 12:01 ` Shawn Guo
2012-05-10 8:42 ` [PATCH 3/6] ASoC: mxs: mxs-pcm does not need to be a plaform_driver Shawn Guo
2012-05-10 9:25 ` Dong Aisheng
2012-05-10 12:13 ` Shawn Guo
2012-05-10 8:42 ` [PATCH 4/6] ASoC: mxs: add device tree support for mxs-saif Shawn Guo
2012-05-10 9:45 ` Dong Aisheng
2012-05-10 12:14 ` Shawn Guo
2012-05-10 8:42 ` [PATCH 5/6] ASoC: mxs: add device tree support for mxs-sgtl5000 Shawn Guo
2012-05-10 11:16 ` Dong Aisheng
2012-05-10 12:20 ` Shawn Guo
2012-05-11 2:33 ` Dong Aisheng [this message]
2012-05-11 2:49 ` Shawn Guo
2012-05-11 14:14 ` Shawn Guo
2012-05-10 8:42 ` [PATCH 6/6] ARM: dts: enable audio support for imx28-evk Shawn Guo
2012-05-10 11:22 ` Dong Aisheng
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=20120511023302.GN6622@shlinux2.ap.freescale.net \
--to=aisheng.dong@freescale.com \
--cc=B29396@freescale.com \
--cc=alsa-devel@alsa-project.org \
--cc=broonie@opensource.wolfsonmicro.com \
--cc=dong.aisheng@linaro.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=shawn.guo@linaro.org \
/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).