alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
From: Sebastian Reichel <sre@kernel.org>
To: Helen Koike <helen.koike@collabora.co.uk>
Cc: lgirdwood@gmail.com, broonie@kernel.org, peter.ujfalusi@ti.com,
	jarkko.nikula@bitmer.com, lars@metafoo.de,
	k.kozlowski@samsung.com, alsa-devel@alsa-project.org,
	linux-kernel@vger.kernel.org, linux-omap@vger.kernel.org,
	perex@perex.cz, tiwai@suse.com
Subject: Re: [PATCH 1/4] ASoC: tpa6130a2: Register component
Date: Sun, 19 Jun 2016 00:28:36 +0200	[thread overview]
Message-ID: <20160618222836.GC5510@earth> (raw)
In-Reply-To: <ab4a503a44da58b65c3d56bf86e8e2949a4d3cab.1466218805.git.helen.koike@collabora.co.uk>

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

Hi Helen,

On Sat, Jun 18, 2016 at 12:26:28AM -0300, Helen Koike wrote:
> Add tpa6130a2 controls by the component API and update rx51 accordingly
> 
> Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
> [koike: port for upstream]
> Signed-off-by: Helen Koike <helen.koike@collabora.co.uk>
> ---
>  sound/soc/codecs/tpa6130a2.c | 26 +++++++++++++-------------
>  sound/soc/codecs/tpa6130a2.h |  1 -
>  sound/soc/omap/rx51.c        | 23 ++++++++++++-----------
>  3 files changed, 25 insertions(+), 25 deletions(-)
> 
> diff --git a/sound/soc/codecs/tpa6130a2.c b/sound/soc/codecs/tpa6130a2.c
> index 11d85c5..f700d92 100644
> --- a/sound/soc/codecs/tpa6130a2.c
> +++ b/sound/soc/codecs/tpa6130a2.c
> @@ -348,23 +348,22 @@ int tpa6130a2_stereo_enable(struct snd_soc_codec *codec, int enable)
>  }
>  EXPORT_SYMBOL_GPL(tpa6130a2_stereo_enable);
>  
> -int tpa6130a2_add_controls(struct snd_soc_codec *codec)
> +static int tpa6130a2_component_probe(struct snd_soc_component *component)
>  {
> -	struct	tpa6130a2_data *data;
> -
> -	if (tpa6130a2_client == NULL)
> -		return -ENODEV;
> -
> -	data = i2c_get_clientdata(tpa6130a2_client);
> +	struct tpa6130a2_data *data = snd_soc_component_get_drvdata(component);
>  
>  	if (data->id == TPA6140A2)
> -		return snd_soc_add_codec_controls(codec, tpa6140a2_controls,
> -						ARRAY_SIZE(tpa6140a2_controls));
> +		return snd_soc_add_component_controls(component,
> +			tpa6140a2_controls, ARRAY_SIZE(tpa6140a2_controls));
>  	else
> -		return snd_soc_add_codec_controls(codec, tpa6130a2_controls,
> -						ARRAY_SIZE(tpa6130a2_controls));
> +		return snd_soc_add_component_controls(component,
> +			tpa6130a2_controls, ARRAY_SIZE(tpa6130a2_controls));
>  }
> -EXPORT_SYMBOL_GPL(tpa6130a2_add_controls);
> +
> +struct snd_soc_component_driver tpa6130a2_component_driver = {
> +	.name = "tpa6130a2",
> +	.probe = tpa6130a2_component_probe,
> +};
>  
>  static int tpa6130a2_probe(struct i2c_client *client,
>  			   const struct i2c_device_id *id)
> @@ -451,7 +450,8 @@ static int tpa6130a2_probe(struct i2c_client *client,
>  	if (ret != 0)
>  		goto err_gpio;
>  
> -	return 0;
> +	return devm_snd_soc_register_component(&client->dev,
> +			&tpa6130a2_component_driver, NULL, 0);
>  
>  err_gpio:
>  	tpa6130a2_client = NULL;
> diff --git a/sound/soc/codecs/tpa6130a2.h b/sound/soc/codecs/tpa6130a2.h
> index 4174440..78ee723 100644
> --- a/sound/soc/codecs/tpa6130a2.h
> +++ b/sound/soc/codecs/tpa6130a2.h
> @@ -56,7 +56,6 @@
>  /* TPA6130A2_REG_VERSION (0x04) */
>  #define TPA6130A2_VERSION_MASK		(0x0f)
>  
> -extern int tpa6130a2_add_controls(struct snd_soc_codec *codec);
>  extern int tpa6130a2_stereo_enable(struct snd_soc_codec *codec, int enable);
>  
>  #endif /* __TPA6130A2_H__ */
> diff --git a/sound/soc/omap/rx51.c b/sound/soc/omap/rx51.c
> index 5494924..b59cf89 100644
> --- a/sound/soc/omap/rx51.c
> +++ b/sound/soc/omap/rx51.c
> @@ -286,16 +286,10 @@ static const struct snd_kcontrol_new aic34_rx51_controls[] = {
>  
>  static int rx51_aic34_init(struct snd_soc_pcm_runtime *rtd)
>  {
> -	struct snd_soc_codec *codec = rtd->codec;
>  	struct snd_soc_card *card = rtd->card;
>  	struct rx51_audio_pdata *pdata = snd_soc_card_get_drvdata(card);
>  	int err;
>  
> -	err = tpa6130a2_add_controls(codec);
> -	if (err < 0) {
> -		dev_err(card->dev, "Failed to add TPA6130A2 controls\n");
> -		return err;
> -	}
>  	snd_soc_limit_volume(card, "TPA6130A2 Headphone Playback Volume", 42);
>  
>  	err = omap_mcbsp_st_add_controls(rtd, 2);
> @@ -357,6 +351,10 @@ static struct snd_soc_aux_dev rx51_aux_dev[] = {
>  		.name = "TLV320AIC34b",
>  		.codec_name = "tlv320aic3x-codec.2-0019",
>  	},
> +	{
> +		.name = "TPA61320A2",
> +		.codec_name = "tpa6130a2.2-0060",
> +	},
>  };
>  
>  static struct snd_soc_codec_conf rx51_codec_conf[] = {
> @@ -364,6 +362,10 @@ static struct snd_soc_codec_conf rx51_codec_conf[] = {
>  		.dev_name = "tlv320aic3x-codec.2-0019",
>  		.name_prefix = "b",
>  	},
> +	{
> +		.dev_name = "tpa6130a2.2-0060",
> +		.name_prefix = "TPA6130A2",

This results in the control being named "TPA6130A2 TPA6130A2
Headphone Playback Volume", which is too long, so its shortened to
"TPA6130A2 TPA6130A2 Headphone Playback Volu".  That in turn results
in incorrect detection making it playback + capture and the
snd_soc_limit_volume() from above does not work.

I suggest to keep the name_prefix here and remove it in the codec
instead, so that other boards (esp. those with more than one TPA)
can choose another prefix.

> +	},
>  };
>  
>  /* Audio card */
> @@ -435,11 +437,10 @@ static int rx51_soc_probe(struct platform_device *pdev)
>  			dev_err(&pdev->dev, "Headphone amplifier node is not provided\n");
>  			return -EINVAL;
>  		}
> -
> -		/* TODO: tpa6130a2a driver supports only a single instance, so
> -		 * this driver ignores the headphone-amplifier node for now.
> -		 * It's already mandatory in the DT binding to be future proof.
> -		 */
> +		rx51_aux_dev[1].codec_name = NULL;
> +		rx51_aux_dev[1].codec_of_node = dai_node;
> +		rx51_codec_conf[1].dev_name = NULL;
> +		rx51_codec_conf[1].of_node = dai_node;
>  	}
>  
>  	pdata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL);

If you fix the double prefix the patch is

Tested-By: Sebastian Reichel <sre@kernel.org>
Reviewed-By: Sebastian Reichel <sre@kernel.org>

-- Sebastian

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

  reply	other threads:[~2016-06-18 22:28 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-18  3:26 [PATCH 0/4] ASoC: tpa6130a2: Add support for multiple instances Helen Koike
2016-06-18  3:26 ` [PATCH 1/4] ASoC: tpa6130a2: Register component Helen Koike
2016-06-18 22:28   ` Sebastian Reichel [this message]
2016-06-18  3:26 ` [PATCH 2/4] ASoC: tap6130a2: Use regmap Helen Koike
2016-06-18 22:33   ` Sebastian Reichel
2016-06-23 14:38   ` Applied "ASoC: tap6130a2: Use regmap" to the asoc tree Mark Brown
2016-06-18  3:26 ` [PATCH 3/4] ASoC: tpa6130a2: Use snd soc volsw functions Helen Koike
2016-06-18 22:34   ` Sebastian Reichel
2016-06-18  3:26 ` [PATCH 4/4] ASoC: tpa6130a2: Add DAPM support Helen Koike
2016-06-18 23:21   ` Sebastian Reichel
2016-06-19  9:39     ` Lars-Peter Clausen
2016-06-19 20:03       ` Sebastian Reichel
2016-06-20  8:34   ` Peter Ujfalusi
2016-06-18 10:40 ` [PATCH 0/4] ASoC: tpa6130a2: Add support for multiple instances Sebastian Reichel
2016-06-18 21:33   ` Sebastian Reichel
2016-06-20 17:12   ` [PATCH v2 0/5] " Helen Koike
2016-06-20 17:12     ` [PATCH v2 1/5] ASoC: tpa6130a2: Register component Helen Koike
2016-06-23 14:38       ` Applied "ASoC: tpa6130a2: Register component" to the asoc tree Mark Brown
2016-06-20 17:12     ` [PATCH v2 2/5] ASoC: tap6130a2: Use regmap Helen Koike
2016-06-21  1:41       ` Sebastian Reichel
2016-06-20 17:12     ` [PATCH v2 3/5] ASoC: tpa6130a2: Use snd soc volsw functions Helen Koike
2016-06-21  1:41       ` Sebastian Reichel
2016-06-23 14:38       ` Applied "ASoC: tpa6130a2: Use snd soc volsw functions" to the asoc tree Mark Brown
2016-06-20 17:12     ` [PATCH v2 4/5] ASoC: tpa6130a2: Add DAPM support Helen Koike
2016-06-20 19:06       ` Helen Koike
2016-06-21  1:45         ` Sebastian Reichel
2016-06-20 19:44       ` Lars-Peter Clausen
2016-06-20 20:12         ` Helen Koike
2016-06-20 17:12     ` [PATCH v2 5/5] ASoC: tpa6130a2: Remove goto err_gpio Helen Koike
2016-06-21  1:42       ` Sebastian Reichel
2016-06-26 12:02       ` Applied "ASoC: tpa6130a2: Remove goto err_gpio" to the asoc tree Mark Brown
2016-06-23 19:23     ` [PATCH v3 0/2] ASoC: tpa6130a2: Add support for multiple instances Helen Koike
2016-06-23 19:23       ` [PATCH v3 1/2] ASoC: tpa6130a2: Add DAPM support Helen Koike
2016-06-26 12:02         ` Applied "ASoC: tpa6130a2: Add DAPM support" to the asoc tree Mark Brown
2016-06-23 19:23       ` [PATCH v3 2/2] ASoC: tpa6130a2: Remove goto err_gpio Helen Koike
2016-06-19 20:14 ` [PATCH 0/4] ASoC: tpa6130a2: Add support for multiple instances Sebastian Reichel

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=20160618222836.GC5510@earth \
    --to=sre@kernel.org \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --cc=helen.koike@collabora.co.uk \
    --cc=jarkko.nikula@bitmer.com \
    --cc=k.kozlowski@samsung.com \
    --cc=lars@metafoo.de \
    --cc=lgirdwood@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=perex@perex.cz \
    --cc=peter.ujfalusi@ti.com \
    --cc=tiwai@suse.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).