Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1713536 > unrolled thread

[PATCH v3 1/9] ASoC: rt5514: Switch to snd_soc_register_codec

Started byJeffy Chen <jeffy.chen@rock-chips.com>
First post2017-08-17 06:50 +0200
Last post2017-08-18 04:50 +0200
Articles 3 — 3 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH v3 1/9] ASoC: rt5514: Switch to snd_soc_register_codec Jeffy Chen <jeffy.chen@rock-chips.com> - 2017-08-17 06:50 +0200
    Re: [PATCH v3 1/9] ASoC: rt5514: Switch to snd_soc_register_codec Mark Brown <broonie@kernel.org> - 2017-08-17 19:20 +0200
      Re: [PATCH v3 1/9] ASoC: rt5514: Switch to snd_soc_register_codec jeffy <jeffy.chen@rock-chips.com> - 2017-08-18 04:50 +0200

#1713536 — [PATCH v3 1/9] ASoC: rt5514: Switch to snd_soc_register_codec

FromJeffy Chen <jeffy.chen@rock-chips.com>
Date2017-08-17 06:50 +0200
Subject[PATCH v3 1/9] ASoC: rt5514: Switch to snd_soc_register_codec
Message-ID<ufkUO-8bv-23@gated-at.bofh.it>
Currently we are using devm_snd_soc_register_component, which would
use legacy dai name.

Switch to snd_soc_register_codec to use dai driver name.

Signed-off-by: Jeffy Chen <jeffy.chen@rock-chips.com>
---

Changes in v3: None
Changes in v2: None

 sound/soc/codecs/rt5514-spi.c | 19 ++++++++++++++-----
 1 file changed, 14 insertions(+), 5 deletions(-)

diff --git a/sound/soc/codecs/rt5514-spi.c b/sound/soc/codecs/rt5514-spi.c
index 640193d845be..ad6bc51dd82a 100644
--- a/sound/soc/codecs/rt5514-spi.c
+++ b/sound/soc/codecs/rt5514-spi.c
@@ -277,8 +277,10 @@ static struct snd_soc_platform_driver rt5514_spi_platform = {
 	.ops = &rt5514_spi_pcm_ops,
 };
 
-static const struct snd_soc_component_driver rt5514_spi_dai_component = {
-	.name		= "rt5514-spi-dai",
+static const struct snd_soc_codec_driver rt5514_spi_dai_codec = {
+	.component_driver = {
+		.name = "rt5514-spi-dai",
+	},
 };
 
 /**
@@ -426,9 +428,8 @@ static int rt5514_spi_probe(struct spi_device *spi)
 		return ret;
 	}
 
-	ret = devm_snd_soc_register_component(&spi->dev,
-					      &rt5514_spi_dai_component,
-					      &rt5514_spi_dai, 1);
+	ret = snd_soc_register_codec(&spi->dev, &rt5514_spi_dai_codec,
+				     &rt5514_spi_dai, 1);
 	if (ret < 0) {
 		dev_err(&spi->dev, "Failed to register component.\n");
 		return ret;
@@ -437,6 +438,13 @@ static int rt5514_spi_probe(struct spi_device *spi)
 	return 0;
 }
 
+static int rt5514_spi_remove(struct spi_device *spi)
+{
+	snd_soc_unregister_codec(&spi->dev);
+
+	return 0;
+}
+
 static const struct of_device_id rt5514_of_match[] = {
 	{ .compatible = "realtek,rt5514", },
 	{},
@@ -449,6 +457,7 @@ static struct spi_driver rt5514_spi_driver = {
 		.of_match_table = of_match_ptr(rt5514_of_match),
 	},
 	.probe = rt5514_spi_probe,
+	.remove = rt5514_spi_remove,
 };
 module_spi_driver(rt5514_spi_driver);
 
-- 
2.11.0

[toc] | [next] | [standalone]


#1714221

FromMark Brown <broonie@kernel.org>
Date2017-08-17 19:20 +0200
Message-ID<ufwCB-7Vp-11@gated-at.bofh.it>
In reply to#1713536

[Multipart message — attachments visible in raw view] — view raw

On Thu, Aug 17, 2017 at 12:44:09PM +0800, Jeffy Chen wrote:
> Currently we are using devm_snd_soc_register_component, which would
> use legacy dai name.

> Switch to snd_soc_register_codec to use dai driver name.

This is the wrong direction to be going in, we are trying to move all
drivers to use component.  Whatever you want to do make components use
it.

[toc] | [prev] | [next] | [standalone]


#1714526

Fromjeffy <jeffy.chen@rock-chips.com>
Date2017-08-18 04:50 +0200
Message-ID<ufFwd-5tP-5@gated-at.bofh.it>
In reply to#1714221
Hi Mark,

On 08/18/2017 01:11 AM, Mark Brown wrote:
> On Thu, Aug 17, 2017 at 12:44:09PM +0800, Jeffy Chen wrote:
>> Currently we are using devm_snd_soc_register_component, which would
>> use legacy dai name.
>
>> Switch to snd_soc_register_codec to use dai driver name.
>
> This is the wrong direction to be going in, we are trying to move all
> drivers to use component.  Whatever you want to do make components use
> it.
>

i was trying to make dai name use dai driver name:

         /*
          * Back in the old days when we still had component-less DAIs,
          * instead of having a static name, component-less DAIs would
          * inherit the name of the parent device so it is possible to
          * register multiple instances of the DAI. We still need to keep
          * the same naming style even though those DAIs are not
          * component-less anymore.
          */
         if (legacy_dai_naming &&
            (dai_drv->id == 0 || dai_drv->name == NULL)) {
                 dai->name = fmt_single_name(dev, &dai->id);
         } else {
                 dai->name = fmt_multiple_name(dev, dai_drv);


specify an non-zero id for dai driver works too, i'll do it in new 
patches :)

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web