Alsa-Devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Vasily Khoruzhick <anarsoul@gmail.com>
To: "Liam Girdwood" <lgirdwood@gmail.com>,
	"Mark Brown" <broonie@kernel.org>,
	"Maxime Ripard" <maxime.ripard@free-electrons.com>,
	"Chen-Yu Tsai" <wens@csie.org>,
	"Marcus Cooper" <codekipper@gmail.com>,
	"Mylène Josserand" <mylene.josserand@free-electrons.com>,
	alsa-devel@alsa-project.org,
	linux-arm-kernel@lists.infradead.org
Cc: Vasily Khoruzhick <anarsoul@gmail.com>
Subject: [PATCH 6/9] ASoC: sun8i-codec-analog: Add component driver field to quirks structure
Date: Sun,  3 Dec 2017 12:41:54 -0800	[thread overview]
Message-ID: <20171203204157.20829-7-anarsoul@gmail.com> (raw)
In-Reply-To: <20171203204157.20829-1-anarsoul@gmail.com>

This is necessary for upcoming addition of A64 support. A64 uses
the same DAPM routes, but slightly different widgets. Use approach from
sun4i-codec driver and pass appropriate component driver through quirks.

Signed-off-by: Vasily Khoruzhick <anarsoul@gmail.com>
---
 sound/soc/sunxi/sun8i-codec-analog.c | 57 +++++++++++++++++++++---------------
 1 file changed, 33 insertions(+), 24 deletions(-)

diff --git a/sound/soc/sunxi/sun8i-codec-analog.c b/sound/soc/sunxi/sun8i-codec-analog.c
index 384f582b6f69..4e39d2668286 100644
--- a/sound/soc/sunxi/sun8i-codec-analog.c
+++ b/sound/soc/sunxi/sun8i-codec-analog.c
@@ -759,24 +759,6 @@ struct sun8i_codec_analog_quirks {
 	int (*add_lineout)(struct snd_soc_component *cmpnt);
 };
 
-static const struct sun8i_codec_analog_quirks sun8i_a23_quirks = {
-	.has_headphone	= true,
-	.has_hmic	= true,
-	.has_linein	= true,
-	.has_mbias	= true,
-	.has_mic2	= true,
-	.add_headphone	= sun8i_a23_codec_add_headphone,
-};
-
-static const struct sun8i_codec_analog_quirks sun8i_h3_quirks = {
-	.has_linein	= true,
-	.has_lineout	= true,
-	.has_mbias	= true,
-	.has_mic2	= true,
-	.add_lineout	= sun8i_h3_codec_add_lineout,
-};
-
-
 static int sun8i_codec_analog_add_mixer(struct snd_soc_component *cmpnt,
 					const struct sun8i_codec_analog_quirks *quirks)
 {
@@ -819,11 +801,6 @@ static int sun8i_codec_analog_add_mixer(struct snd_soc_component *cmpnt,
 	return 0;
 }
 
-static const struct sun8i_codec_analog_quirks sun8i_v3s_quirks = {
-	.has_headphone	= true,
-	.has_hmic	= true,
-};
-
 static int sun8i_codec_analog_cmpnt_probe(struct snd_soc_component *cmpnt)
 {
 	struct device *dev = cmpnt->dev;
@@ -891,6 +868,31 @@ static const struct snd_soc_component_driver sun8i_codec_analog_cmpnt_drv = {
 	.probe			= sun8i_codec_analog_cmpnt_probe,
 };
 
+static const struct sun8i_codec_analog_quirks sun8i_a23_quirks = {
+	.has_headphone	= true,
+	.has_hmic	= true,
+	.has_linein	= true,
+	.has_mbias	= true,
+	.has_mic2	= true,
+	.add_headphone	= sun8i_a23_codec_add_headphone,
+	.cmpnt_drv	= &sun8i_codec_analog_cmpnt_drv,
+};
+
+static const struct sun8i_codec_analog_quirks sun8i_h3_quirks = {
+	.has_linein	= true,
+	.has_lineout	= true,
+	.has_mbias	= true,
+	.has_mic2	= true,
+	.add_lineout	= sun8i_h3_codec_add_lineout,
+	.cmpnt_drv	= &sun8i_codec_analog_cmpnt_drv,
+};
+
+static const struct sun8i_codec_analog_quirks sun8i_v3s_quirks = {
+	.has_headphone	= true,
+	.has_hmic	= true,
+	.cmpnt_drv	= &sun8i_codec_analog_cmpnt_drv,
+};
+
 static const struct of_device_id sun8i_codec_analog_of_match[] = {
 	{
 		.compatible = "allwinner,sun8i-a23-codec-analog",
@@ -913,6 +915,13 @@ static int sun8i_codec_analog_probe(struct platform_device *pdev)
 	struct resource *res;
 	struct regmap *regmap;
 	void __iomem *base;
+	const struct sun8i_codec_analog_quirks *quirks;
+
+	quirks = of_device_get_match_data(&pdev->dev);
+	if (quirks == NULL) {
+		dev_err(&pdev->dev, "Failed to determine the quirks to use\n");
+		return -ENODEV;
+	}
 
 	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
 	base = devm_ioremap_resource(&pdev->dev, res);
@@ -928,7 +937,7 @@ static int sun8i_codec_analog_probe(struct platform_device *pdev)
 	}
 
 	return devm_snd_soc_register_component(&pdev->dev,
-					       &sun8i_codec_analog_cmpnt_drv,
+					       quirks->cmpnt_drv,
 					       NULL, 0);
 }
 
-- 
2.15.0

  parent reply	other threads:[~2017-12-03 20:41 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-03 20:41 [PATCH 0/9] Add audiocodec support for A64 SoC Vasily Khoruzhick
2017-12-03 20:41 ` [PATCH 1/9] ASoC: sun4i-i2s: Add quirk to handle fixed WSS Vasily Khoruzhick
2017-12-04  0:43   ` Chen-Yu Tsai
2017-12-03 20:41 ` [PATCH 2/9] ASoC: sun4i-i2s: Add compatibility with A64 codec I2S Vasily Khoruzhick
2017-12-04  6:42   ` Code Kipper
2017-12-04  7:34     ` Vasily Khoruzhick
2017-12-05  8:01       ` Maxime Ripard
2017-12-05 23:04         ` Vasily Khoruzhick
2017-12-06 15:27           ` Maxime Ripard
2017-12-07  9:21       ` Code Kipper
2017-12-07  9:30         ` Chen-Yu Tsai
2017-12-07 22:48         ` Vasily Khoruzhick
2017-12-08  6:40           ` Code Kipper
2017-12-08 22:16             ` Vasily Khoruzhick
2017-12-03 20:41 ` [PATCH 3/9] ASoC: sun8i-codec: Add quirk to specify aif1_lrck_div value Vasily Khoruzhick
2017-12-04  7:23   ` Code Kipper
2017-12-04  7:38   ` Chen-Yu Tsai
2017-12-04  8:26     ` Chen-Yu Tsai
2017-12-03 20:41 ` [PATCH 4/9] ASoC: sun8i-codec: Add support for A64 SoC Vasily Khoruzhick
2017-12-05  8:04   ` Maxime Ripard
2017-12-05 23:17     ` Vasily Khoruzhick
2017-12-06 15:32       ` Maxime Ripard
2017-12-06 15:48         ` Mark Brown
2017-12-06 18:53           ` Maxime Ripard
2017-12-06 19:13             ` Mark Brown
2017-12-03 20:41 ` [PATCH 5/9] ASoC: sun8i-codec-analog: Use callbacks to add headphones and lineout outputs Vasily Khoruzhick
2017-12-03 20:41 ` Vasily Khoruzhick [this message]
2017-12-03 20:41 ` [PATCH 7/9] ASoC: sun8i-codec-analog: Add support for A64 SoC Vasily Khoruzhick
2017-12-03 20:41 ` [PATCH 8/9] arm64: dts: allwinner: a64: Add nodes necessary for analog sound support Vasily Khoruzhick
2017-12-03 20:41 ` [PATCH 9/9] arm64: dts: allwinner: a64: Enable sound on Pine64 and SoPine Vasily Khoruzhick
2017-12-05  3:24   ` Chen-Yu Tsai
2017-12-09 19:54     ` Vasily Khoruzhick

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=20171203204157.20829-7-anarsoul@gmail.com \
    --to=anarsoul@gmail.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --cc=codekipper@gmail.com \
    --cc=lgirdwood@gmail.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=maxime.ripard@free-electrons.com \
    --cc=mylene.josserand@free-electrons.com \
    --cc=wens@csie.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