All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mark Brown <broonie@kernel.org>
To: Jean-Francois Moine <moinejf@free.fr>
Cc: alsa-devel@alsa-project.org, Dave Airlie <airlied@gmail.com>,
	dri-devel@lists.freedesktop.org,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org, Rob Clark <robdclark@gmail.com>,
	Russell King - ARM Linux <linux@arm.linux.org.uk>
Subject: Re: [PATCH v3 2/5] ASoC: tda998x: add a codec driver for the TDA998x
Date: Tue, 4 Feb 2014 13:30:14 +0000	[thread overview]
Message-ID: <20140204133014.GA22609@sirena.org.uk> (raw)
In-Reply-To: <ae68394f080f0ea5acaf3377cb1d18f29e42c646.1391274628.git.moinejf@free.fr>

[-- Attachment #1: Type: text/plain, Size: 1884 bytes --]

On Sun, Jan 26, 2014 at 07:45:36PM +0100, Jean-Francois Moine wrote:

> +	/* load the optional CODEC */
> +	of_platform_populate(np, NULL, NULL, &client->dev);
> +

Why is this using of_platform_populate()?  That's a very odd way of
doing things.

> +config SND_SOC_TDA998X
> +	tristate
> +	depends on OF
> +	default y if DRM_I2C_NXP_TDA998X=y
> +	default m if DRM_I2C_NXP_TDA998X=m
> +

Make this visible if it can be selected from DT so it can be used with
generic cards.

> +static int tda_get_encoder(struct tda_priv *priv)
> +{
> +	struct snd_soc_codec *codec = priv->codec;
> +	struct device_node *np;
> +
> +	/* get the parent tda998x device */
> +	np = of_get_parent(codec->dev->of_node);
> +	if (!np || !of_device_is_compatible(np, "nxp,tda998x")) {
> +		dev_err(codec->dev, "no or bad parent!\n");
> +		return -EINVAL;
> +	}
> +	priv->i2c_client = of_find_i2c_device_by_node(np);
> +	of_node_put(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.

> +static int tda_start_stop(struct tda_priv *priv)
> +{
> +	int port;
> +
> +	/* give the audio parameters to the HDMI encoder */
> +	if (priv->dai_id == AFMT_I2S)
> +		port = priv->ports[0];
> +	else
> +		port = priv->ports[1];
> +	tda998x_audio_update(priv->i2c_client, priv->dai_id, 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.

> +static const struct snd_soc_dapm_route tda_routes[] = {
> +	{ "hdmi-out", NULL, "HDMI I2S Playback" },
> +	{ "hdmi-out", NULL, "HDMI SPDIF Playback" },
> +};

S/PDIF.

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

WARNING: multiple messages have this Message-ID (diff)
From: broonie@kernel.org (Mark Brown)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v3 2/5] ASoC: tda998x: add a codec driver for the TDA998x
Date: Tue, 4 Feb 2014 13:30:14 +0000	[thread overview]
Message-ID: <20140204133014.GA22609@sirena.org.uk> (raw)
In-Reply-To: <ae68394f080f0ea5acaf3377cb1d18f29e42c646.1391274628.git.moinejf@free.fr>

On Sun, Jan 26, 2014 at 07:45:36PM +0100, Jean-Francois Moine wrote:

> +	/* load the optional CODEC */
> +	of_platform_populate(np, NULL, NULL, &client->dev);
> +

Why is this using of_platform_populate()?  That's a very odd way of
doing things.

> +config SND_SOC_TDA998X
> +	tristate
> +	depends on OF
> +	default y if DRM_I2C_NXP_TDA998X=y
> +	default m if DRM_I2C_NXP_TDA998X=m
> +

Make this visible if it can be selected from DT so it can be used with
generic cards.

> +static int tda_get_encoder(struct tda_priv *priv)
> +{
> +	struct snd_soc_codec *codec = priv->codec;
> +	struct device_node *np;
> +
> +	/* get the parent tda998x device */
> +	np = of_get_parent(codec->dev->of_node);
> +	if (!np || !of_device_is_compatible(np, "nxp,tda998x")) {
> +		dev_err(codec->dev, "no or bad parent!\n");
> +		return -EINVAL;
> +	}
> +	priv->i2c_client = of_find_i2c_device_by_node(np);
> +	of_node_put(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.

> +static int tda_start_stop(struct tda_priv *priv)
> +{
> +	int port;
> +
> +	/* give the audio parameters to the HDMI encoder */
> +	if (priv->dai_id == AFMT_I2S)
> +		port = priv->ports[0];
> +	else
> +		port = priv->ports[1];
> +	tda998x_audio_update(priv->i2c_client, priv->dai_id, 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.

> +static const struct snd_soc_dapm_route tda_routes[] = {
> +	{ "hdmi-out", NULL, "HDMI I2S Playback" },
> +	{ "hdmi-out", NULL, "HDMI SPDIF Playback" },
> +};

S/PDIF.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20140204/c0356e5e/attachment-0001.sig>

  reply	other threads:[~2014-02-04 13:30 UTC|newest]

Thread overview: 70+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-01 17:10 [PATCH v3 0/5] add a TDA998x CODEC Jean-Francois Moine
2014-02-01 17:10 ` Jean-Francois Moine
2014-02-01 17:10 ` Jean-Francois Moine
2014-01-26 18:02 ` [PATCH v3 1/5] drm/i2c: tda998x: add a function for dynamic audio input switch Jean-Francois Moine
2014-01-26 18:02   ` Jean-Francois Moine
2014-01-26 18:02   ` Jean-Francois Moine
2014-01-26 18:45 ` [PATCH v3 2/5] ASoC: tda998x: add a codec driver for the TDA998x Jean-Francois Moine
2014-01-26 18:45   ` Jean-Francois Moine
2014-01-26 18:45   ` Jean-Francois Moine
2014-02-04 13:30   ` Mark Brown [this message]
2014-02-04 13:30     ` Mark Brown
2014-02-04 13:36     ` [alsa-devel] " Lars-Peter Clausen
2014-02-04 13:36       ` Lars-Peter Clausen
2014-02-04 17:46       ` Mark Brown
2014-02-04 17:46         ` Mark Brown
2014-02-04 17:16     ` Jean-Francois Moine
2014-02-04 17:16       ` Jean-Francois Moine
2014-02-04 17:16       ` Jean-Francois Moine
2014-02-04 17:54       ` Mark Brown
2014-02-04 17:54         ` Mark Brown
2014-02-04 17:54         ` Mark Brown
2014-02-04 18:59         ` Jean-Francois Moine
2014-02-04 18:59           ` Jean-Francois Moine
2014-02-04 18:59           ` Jean-Francois Moine
2014-02-04 19:40           ` Mark Brown
2014-02-04 19:40             ` Mark Brown
2014-01-27  8:48 ` [PATCH v3 4/5] ASoC: tda998x: adjust the audio hw parameters from EDID Jean-Francois Moine
2014-01-27  8:48   ` Jean-Francois Moine
2014-01-27  8:48   ` Jean-Francois Moine
2014-02-04 18:06   ` Mark Brown
2014-02-04 18:06     ` Mark Brown
2014-02-04 18:06     ` Mark Brown
2014-02-05  9:11     ` Jean-Francois Moine
2014-02-05  9:11       ` Jean-Francois Moine
2014-02-05  9:11       ` Jean-Francois Moine
2014-02-05  9:19       ` [alsa-devel] " Lars-Peter Clausen
2014-02-05  9:19         ` Lars-Peter Clausen
2014-02-05  9:19         ` Lars-Peter Clausen
2014-02-05 11:18         ` Mark Brown
2014-02-05 11:18           ` Mark Brown
2014-02-05 13:31           ` Lars-Peter Clausen
2014-02-05 13:31             ` Lars-Peter Clausen
2014-02-05 13:31             ` Lars-Peter Clausen
2014-02-05 14:08             ` Mark Brown
2014-02-05 14:08               ` Mark Brown
2014-02-05 18:07         ` Jean-Francois Moine
2014-02-05 18:07           ` Jean-Francois Moine
2014-02-05 18:07           ` Jean-Francois Moine
2014-02-05 18:21           ` Lars-Peter Clausen
2014-02-05 18:21             ` Lars-Peter Clausen
2014-02-05 18:21             ` Lars-Peter Clausen
2014-01-30 11:08 ` [PATCH v3 5/5] ASoC: tda998x: adjust the audio CTS_N pre-divider from audio format Jean-Francois Moine
2014-01-30 11:08   ` Jean-Francois Moine
2014-02-04 18:09   ` Mark Brown
2014-02-04 18:09     ` Mark Brown
2014-02-04 18:09     ` Mark Brown
2014-02-01 16:48 ` [PATCH v3 3/5] ASoC: tda998x: add DT documentation of the tda998x CODEC Jean-Francois Moine
2014-02-01 16:48   ` Jean-Francois Moine
2014-02-01 16:48   ` Jean-Francois Moine
     [not found]   ` <8e4231b7a55802f58a14dd07ac5cd8b0babb1dce.1391274628.git.moinejf-GANU6spQydw@public.gmane.org>
2014-02-01 18:30     ` Sergei Shtylyov
2014-02-01 18:30       ` Sergei Shtylyov
2014-02-01 18:30       ` Sergei Shtylyov
2014-02-04 18:12     ` Mark Brown
2014-02-04 18:12       ` Mark Brown
2014-02-04 18:12       ` Mark Brown
2014-02-04 19:02       ` Jean-Francois Moine
2014-02-04 19:02         ` Jean-Francois Moine
2014-02-04 19:02         ` Jean-Francois Moine
2014-02-04 19:54         ` Mark Brown
2014-02-04 19:54           ` Mark Brown

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=20140204133014.GA22609@sirena.org.uk \
    --to=broonie@kernel.org \
    --cc=airlied@gmail.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@arm.linux.org.uk \
    --cc=moinejf@free.fr \
    --cc=robdclark@gmail.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.