diff mbox

[v2,03/12] ASoC: sun8i-codec-analog: split out mbias

Message ID 20170305133709.6288-4-icenowy@aosc.xyz (mailing list archive)
State New, archived
Headers show

Commit Message

Icenowy Zheng March 5, 2017, 1:37 p.m. UTC
Allwinner V3s features an analog codec without MBIAS pin.

Split out this part, in order to prepare for the V3s analog codec.

Signed-off-by: Icenowy Zheng <icenowy@aosc.xyz>
---
 sound/soc/sunxi/sun8i-codec-analog.c | 34 +++++++++++++++++++++++++++++-----
 1 file changed, 29 insertions(+), 5 deletions(-)

Comments

kernel test robot March 7, 2017, 12:15 a.m. UTC | #1
Hi Icenowy,

[auto build test ERROR on linus/master]
[also build test ERROR on v4.11-rc1 next-20170306]
[cannot apply to robh/for-next asoc/for-next]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Icenowy-Zheng/ASoC-sun8i-codec-analog-split-out-mic2/20170307-064313
config: i386-allmodconfig (attached as .config)
compiler: gcc-6 (Debian 6.2.0-3) 6.2.0 20160901
reproduce:
        # save the attached .config to linux build tree
        make ARCH=i386 

All errors (new ones prefixed by >>):

>> sound/soc/sunxi/sun8i-codec-analog.c:705:2: error: unknown field 'has_mbias' specified in initializer
     .has_mbias = true,
     ^
   sound/soc/sunxi/sun8i-codec-analog.c:712:2: error: unknown field 'has_mbias' specified in initializer
     .has_mbias = true,
     ^
   sound/soc/sunxi/sun8i-codec-analog.c: In function 'sun8i_codec_analog_cmpnt_probe':
>> sound/soc/sunxi/sun8i-codec-analog.c:755:12: error: 'const struct sun8i_codec_analog_quirks' has no member named 'has_mbias'; did you mean 'has_mic2'?
     if (quirks->has_mbias) {
               ^~

vim +/has_mbias +705 sound/soc/sunxi/sun8i-codec-analog.c

   699	};
   700	
   701	static const struct sun8i_codec_analog_quirks sun8i_a23_quirks = {
   702		.has_headphone	= true,
   703		.has_hmic	= true,
   704		.has_linein	= true,
 > 705		.has_mbias	= true,
   706		.has_mic2	= true,
   707	};
   708	
   709	static const struct sun8i_codec_analog_quirks sun8i_h3_quirks = {
   710		.has_linein	= true,
   711		.has_lineout	= true,
   712		.has_mbias	= true,
   713		.has_mic2	= true,
   714	};
   715	
   716	static int sun8i_codec_analog_cmpnt_probe(struct snd_soc_component *cmpnt)
   717	{
   718		struct device *dev = cmpnt->dev;
   719		const struct sun8i_codec_analog_quirks *quirks;
   720		int ret;
   721	
   722		/*
   723		 * This would never return NULL unless someone directly registers a
   724		 * platform device matching this driver's name, without specifying a
   725		 * device tree node.
   726		 */
   727		quirks = of_device_get_match_data(dev);
   728	
   729		/* Add controls, widgets, and routes for individual features */
   730	
   731		if (quirks->has_headphone) {
   732			ret = sun8i_codec_add_headphone(cmpnt);
   733			if (ret)
   734				return ret;
   735		}
   736	
   737		if (quirks->has_hmic) {
   738			ret = sun8i_codec_add_hmic(cmpnt);
   739			if (ret)
   740				return ret;
   741		}
   742	
   743		if (quirks->has_linein) {
   744			ret = sun8i_codec_add_linein(cmpnt);
   745			if (ret)
   746				return ret;
   747		}
   748	
   749		if (quirks->has_lineout) {
   750			ret = sun8i_codec_add_lineout(cmpnt);
   751			if (ret)
   752				return ret;
   753		}
   754	
 > 755		if (quirks->has_mbias) {
   756			ret = sun8i_codec_add_mbias(cmpnt);
   757			if (ret)
   758				return ret;

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation
diff mbox

Patch

diff --git a/sound/soc/sunxi/sun8i-codec-analog.c b/sound/soc/sunxi/sun8i-codec-analog.c
index 6c17c99c2c8d..af56afe5c403 100644
--- a/sound/soc/sunxi/sun8i-codec-analog.c
+++ b/sound/soc/sunxi/sun8i-codec-analog.c
@@ -289,11 +289,6 @@  static const struct snd_soc_dapm_widget sun8i_codec_common_widgets[] = {
 	/* Microphone input */
 	SND_SOC_DAPM_INPUT("MIC1"),
 
-	/* Microphone Bias */
-	SND_SOC_DAPM_SUPPLY("MBIAS", SUN8I_ADDA_MIC1G_MICBIAS_CTRL,
-			    SUN8I_ADDA_MIC1G_MICBIAS_CTRL_MMICBIASEN,
-			    0, NULL, 0),
-
 	/* Mic input path */
 	SND_SOC_DAPM_PGA("Mic1 Amplifier", SUN8I_ADDA_MIC1G_MICBIAS_CTRL,
 			 SUN8I_ADDA_MIC1G_MICBIAS_CTRL_MIC1AMPEN, 0, NULL, 0),
@@ -453,6 +448,27 @@  static int sun8i_codec_add_headphone(struct snd_soc_component *cmpnt)
 	return 0;
 }
 
+/* mbias specific widget */
+static const struct snd_soc_dapm_widget sun8i_codec_mbias_widgets[] = {
+	SND_SOC_DAPM_SUPPLY("MBIAS", SUN8I_ADDA_MIC1G_MICBIAS_CTRL,
+			    SUN8I_ADDA_MIC1G_MICBIAS_CTRL_MMICBIASEN,
+			    0, NULL, 0),
+};
+
+static int sun8i_codec_add_mbias(struct snd_soc_component *cmpnt)
+{
+	struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(cmpnt);
+	struct device *dev = cmpnt->dev;
+	int ret;
+
+	ret = snd_soc_dapm_new_controls(dapm, sun8i_codec_mbias_widgets,
+					ARRAY_SIZE(sun8i_codec_mbias_widgets));
+	if (ret)
+		dev_err(dev, "Failed to add MBIAS DAPM widgets: %d\n", ret);
+
+	return ret;
+}
+
 /* hmic specific widget */
 static const struct snd_soc_dapm_widget sun8i_codec_hmic_widgets[] = {
 	SND_SOC_DAPM_SUPPLY("HBIAS", SUN8I_ADDA_MIC1G_MICBIAS_CTRL,
@@ -686,12 +702,14 @@  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,
 };
 
 static const struct sun8i_codec_analog_quirks sun8i_h3_quirks = {
 	.has_linein	= true,
 	.has_lineout	= true,
+	.has_mbias	= true,
 	.has_mic2	= true,
 };
 
@@ -734,6 +752,12 @@  static int sun8i_codec_analog_cmpnt_probe(struct snd_soc_component *cmpnt)
 			return ret;
 	}
 
+	if (quirks->has_mbias) {
+		ret = sun8i_codec_add_mbias(cmpnt);
+		if (ret)
+			return ret;
+	}
+
 	if (quirks->has_mic2) {
 		ret = sun8i_codec_add_mic2(cmpnt);
 		if (ret)