[PATCH v3 2/5] ASoC: tda998x: add a codec driver for the TDA998x (original) (raw)
Jean-Francois Moine moinejf at free.fr
Tue Feb 4 09:16:05 PST 2014
- Previous message: [Bug 69901] intel ivy bridge/radeonsi PRIME hang since 3.14
- Next message: [PATCH v3 2/5] ASoC: tda998x: add a codec driver for the TDA998x
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Tue, 4 Feb 2014 13:30:14 +0000 Mark Brown <broonie at kernel.org> wrote:
On Sun, Jan 26, 2014 at 07:45:36PM +0100, Jean-Francois Moine wrote:
> + /* load the optional CODEC */ > + ofplatformpopulate(np, NULL, NULL, &client->dev); > + Why is this using ofplatformpopulate()? That's a very odd way of doing things.
The i2c does not populate the subnodes in the DT. I did not find why, but, what is sure is that if of_platform_populate() is not called, the tda CODEC module is not loaded.
You may find an other example in drivers/mfd/twl-core.c.
> +config SNDSOCTDA998X > + tristate > + depends on OF > + default y if DRMI2CNXPTDA998X=y > + default m if DRMI2CNXPTDA998X=m > +
Make this visible if it can be selected from DT so it can be used with generic cards.
I don't understand. The tda CODEC can only be used with the TDA998x I2C driver. It might have been included in the tda998x source as well.
> +static int tdagetencoder(struct tdapriv *priv) > +{ > + struct sndsoccodec *codec = priv->codec; > + struct devicenode *np; > + > + /* get the parent tda998x device */ > + np = ofgetparent(codec->dev->ofnode); > + if (!np || !ofdeviceiscompatible(np, "nxp,tda998x")) { > + deverr(codec->dev, "no or bad parent!\n"); > + return -EINVAL; > + } > + priv->i2cclient = offindi2cdevicebynode(np); > + ofnodeput(np); > + return 0; > +}
Why does this need to be checked like this? We don't normally have this sort of code to check that the parent is correct.
In my previous submit, the tda CODEC was not declared inside the tda998x I2c device, so, its location was searched from phandle.
Now, the CODEC is declared inside the tda998x as a node child. But, in a bad DT, the tda CODEC could be declared anywhere, even inside a other DRM I2C slave encoder, in which case, bad things would happen...
> +static int tdastartstop(struct tdapriv *priv) > +{ > + int port; > + > + /* give the audio parameters to the HDMI encoder */ > + if (priv->daiid == AFMTI2S) > + port = priv->ports[0]; > + else > + port = priv->ports[1]; > + tda998xaudioupdate(priv->i2cclient, priv->daiid, port); > + return 0; > +}
What does this actually do? No information is being passed in to the core function here, not even any information on if it's starting or stopping. Looking at the rest of the code I can't help thinking it might be clearer to inline this possibly with a lookup helper, the code is very small and the lack of parameters makes it hard to follow.
I thought it was simple enough. The function tda_start_stop() is called from 2 places:
on audio start in tda_startup with the audio type (DAI id) priv->dai_id = dai->id;
on audio stop with a null audio type priv->dai_id = 0; /* streaming stop */
On stream start, the DAI id is never null, as explained in the patch 1:
The audio format values in the encoder configuration interface are
changed to non null values so that the value 0 is used in the audio
function to indicate that audio streaming is stopped.
and on streaming stop the port is not meaningful.
I will add a null item in the enum (AFMT_NO_AUDIO).
> +static const struct sndsocdapmroute tdaroutes[] = { > + { "hdmi-out", NULL, "HDMI I2S Playback" }, > + { "hdmi-out", NULL, "HDMI SPDIF Playback" }, > +};
S/PDIF.
Did you ever try that with debugfs?
BTW, this patch series may be delayed for some time: the tda998x driver has to be reworked for DT support.
-- Ken ar c'hentaƱ | ** Breizh ha Linux atav! ** Jef | http://moinejf.free.fr/
- Previous message: [Bug 69901] intel ivy bridge/radeonsi PRIME hang since 3.14
- Next message: [PATCH v3 2/5] ASoC: tda998x: add a codec driver for the TDA998x
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]