All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ASoC: qcom: SC7280: Add support for external DMIC bias supply
@ 2022-07-28  7:10 Srinivasa Rao Mandadapu
  2022-07-28 10:49   ` Mark Brown
  2022-07-28 12:57 ` kernel test robot
  0 siblings, 2 replies; 6+ messages in thread
From: Srinivasa Rao Mandadapu @ 2022-07-28  7:10 UTC (permalink / raw)
  To: agross, bjorn.andersson, lgirdwood, broonie, robh+dt, quic_plai,
	bgoswami, perex, tiwai, srinivas.kandagatla, quic_rohkumar,
	linux-arm-msm, alsa-devel, linux-kernel, swboyd, judyhsiao,
	devicetree
  Cc: Srinivasa Rao Mandadapu

Update SC7280 machine driver for enabling external mic bias supply,
Which is required for villager rev boards.

Signed-off-by: Srinivasa Rao Mandadapu <quic_srivasam@quicinc.com>
---
 sound/soc/qcom/sc7280.c | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)

diff --git a/sound/soc/qcom/sc7280.c b/sound/soc/qcom/sc7280.c
index da7469a..6404e94 100644
--- a/sound/soc/qcom/sc7280.c
+++ b/sound/soc/qcom/sc7280.c
@@ -33,6 +33,7 @@ struct sc7280_snd_data {
 	struct snd_soc_jack hdmi_jack;
 	bool jack_setup;
 	bool stream_prepared[LPASS_MAX_PORTS];
+	struct regulator *vdd_supply;
 };
 
 static void sc7280_jack_free(struct snd_jack *jack)
@@ -345,6 +346,24 @@ static int sc7280_snd_startup(struct snd_pcm_substream *substream)
 	return ret;
 }
 
+static int sc7280_dmic_micbias(struct snd_soc_dapm_widget *w,
+				struct snd_kcontrol *kcontrol, int event)
+{
+	struct snd_soc_card *card = w->dapm->card;
+	struct sc7280_snd_data *data = snd_soc_card_get_drvdata(card);
+	int ret = 0;
+
+	switch (event) {
+	case SND_SOC_DAPM_PRE_PMU:
+		ret = regulator_enable(data->vdd_supply);
+		break;
+	case SND_SOC_DAPM_POST_PMD:
+		ret = regulator_disable(data->vdd_supply);
+		break;
+	}
+	return ret;
+}
+
 static const struct snd_soc_ops sc7280_ops = {
 	.startup = sc7280_snd_startup,
 	.hw_params = sc7280_snd_hw_params,
@@ -356,6 +375,7 @@ static const struct snd_soc_ops sc7280_ops = {
 static const struct snd_soc_dapm_widget sc7280_snd_widgets[] = {
 	SND_SOC_DAPM_HP("Headphone Jack", NULL),
 	SND_SOC_DAPM_MIC("Headset Mic", NULL),
+	SND_SOC_DAPM_MIC("PMIC BIAS", sc7280_dmic_micbias),
 };
 
 static int sc7280_snd_platform_probe(struct platform_device *pdev)
@@ -389,6 +409,10 @@ static int sc7280_snd_platform_probe(struct platform_device *pdev)
 		link->ops = &sc7280_ops;
 	}
 
+	data->vdd_supply = devm_regulator_get(dev, "vdd-dmic-bias");
+	if (IS_ERR(data->vdd_supply)
+		return PTR_ERR(data->vdd_supply);
+
 	return devm_snd_soc_register_card(dev, card);
 }
 
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH] ASoC: qcom: SC7280: Add support for external DMIC bias supply
  2022-07-28  7:10 [PATCH] ASoC: qcom: SC7280: Add support for external DMIC bias supply Srinivasa Rao Mandadapu
@ 2022-07-28 10:49   ` Mark Brown
  2022-07-28 12:57 ` kernel test robot
  1 sibling, 0 replies; 6+ messages in thread
From: Mark Brown @ 2022-07-28 10:49 UTC (permalink / raw)
  To: Srinivasa Rao Mandadapu
  Cc: agross, bjorn.andersson, lgirdwood, robh+dt, quic_plai, bgoswami,
	perex, tiwai, srinivas.kandagatla, quic_rohkumar, linux-arm-msm,
	alsa-devel, linux-kernel, swboyd, judyhsiao, devicetree

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

On Thu, Jul 28, 2022 at 12:40:33PM +0530, Srinivasa Rao Mandadapu wrote:

> +static int sc7280_dmic_micbias(struct snd_soc_dapm_widget *w,

> +				struct snd_kcontrol *kcontrol, int event)
> +{
> +	struct snd_soc_card *card = w->dapm->card;
> +	struct sc7280_snd_data *data = snd_soc_card_get_drvdata(card);
> +	int ret = 0;
> +

This is open coding SND_SOC_DAPM_REGULATOR_SUPPLY() isn't it?

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] ASoC: qcom: SC7280: Add support for external DMIC bias supply
@ 2022-07-28 10:49   ` Mark Brown
  0 siblings, 0 replies; 6+ messages in thread
From: Mark Brown @ 2022-07-28 10:49 UTC (permalink / raw)
  To: Srinivasa Rao Mandadapu
  Cc: devicetree, alsa-devel, quic_rohkumar, linux-arm-msm, swboyd,
	tiwai, lgirdwood, robh+dt, bjorn.andersson, agross,
	srinivas.kandagatla, bgoswami, quic_plai, judyhsiao,
	linux-kernel

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

On Thu, Jul 28, 2022 at 12:40:33PM +0530, Srinivasa Rao Mandadapu wrote:

> +static int sc7280_dmic_micbias(struct snd_soc_dapm_widget *w,

> +				struct snd_kcontrol *kcontrol, int event)
> +{
> +	struct snd_soc_card *card = w->dapm->card;
> +	struct sc7280_snd_data *data = snd_soc_card_get_drvdata(card);
> +	int ret = 0;
> +

This is open coding SND_SOC_DAPM_REGULATOR_SUPPLY() isn't it?

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] ASoC: qcom: SC7280: Add support for external DMIC bias supply
  2022-07-28  7:10 [PATCH] ASoC: qcom: SC7280: Add support for external DMIC bias supply Srinivasa Rao Mandadapu
  2022-07-28 10:49   ` Mark Brown
@ 2022-07-28 12:57 ` kernel test robot
  1 sibling, 0 replies; 6+ messages in thread
From: kernel test robot @ 2022-07-28 12:57 UTC (permalink / raw)
  To: Srinivasa Rao Mandadapu, agross, bjorn.andersson, lgirdwood,
	broonie, robh+dt, quic_plai, bgoswami, perex, tiwai,
	srinivas.kandagatla, quic_rohkumar, linux-arm-msm, alsa-devel,
	linux-kernel, swboyd, judyhsiao, devicetree
  Cc: kbuild-all, Srinivasa Rao Mandadapu

Hi Srinivasa,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on broonie-sound/for-next]
[also build test ERROR on linus/master v5.19-rc8 next-20220728]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Srinivasa-Rao-Mandadapu/ASoC-qcom-SC7280-Add-support-for-external-DMIC-bias-supply/20220728-151249
base:   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next
config: powerpc-allmodconfig (https://download.01.org/0day-ci/archive/20220728/202207282036.84w516Y3-lkp@intel.com/config)
compiler: powerpc-linux-gcc (GCC) 12.1.0
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # https://github.com/intel-lab-lkp/linux/commit/d59fc8cd6dd22df37f41309d1d18a7853929e2f8
        git remote add linux-review https://github.com/intel-lab-lkp/linux
        git fetch --no-tags linux-review Srinivasa-Rao-Mandadapu/ASoC-qcom-SC7280-Add-support-for-external-DMIC-bias-supply/20220728-151249
        git checkout d59fc8cd6dd22df37f41309d1d18a7853929e2f8
        # save the config file
        mkdir build_dir && cp config build_dir/.config
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=powerpc SHELL=/bin/bash sound/soc/qcom/

If you fix the issue, kindly add following tag where applicable
Reported-by: kernel test robot <lkp@intel.com>

All errors (new ones prefixed by >>):

   sound/soc/qcom/sc7280.c: In function 'sc7280_snd_platform_probe':
>> sound/soc/qcom/sc7280.c:413:37: error: expected ')' before 'return'
     413 |         if (IS_ERR(data->vdd_supply)
         |            ~                        ^
         |                                     )
     414 |                 return PTR_ERR(data->vdd_supply);
         |                 ~~~~~~               
>> sound/soc/qcom/sc7280.c:417:1: error: expected expression before '}' token
     417 | }
         | ^
   sound/soc/qcom/sc7280.c:417:1: error: control reaches end of non-void function [-Werror=return-type]
     417 | }
         | ^
   cc1: some warnings being treated as errors


vim +413 sound/soc/qcom/sc7280.c

   380	
   381	static int sc7280_snd_platform_probe(struct platform_device *pdev)
   382	{
   383		struct snd_soc_card *card;
   384		struct sc7280_snd_data *data;
   385		struct device *dev = &pdev->dev;
   386		struct snd_soc_dai_link *link;
   387		int ret, i;
   388	
   389		data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL);
   390		if (!data)
   391			return -ENOMEM;
   392	
   393		card = &data->card;
   394		snd_soc_card_set_drvdata(card, data);
   395	
   396		card->owner = THIS_MODULE;
   397		card->driver_name = "SC7280";
   398		card->dev = dev;
   399	
   400		card->dapm_widgets = sc7280_snd_widgets;
   401		card->num_dapm_widgets = ARRAY_SIZE(sc7280_snd_widgets);
   402	
   403		ret = qcom_snd_parse_of(card);
   404		if (ret)
   405			return ret;
   406	
   407		for_each_card_prelinks(card, i, link) {
   408			link->init = sc7280_init;
   409			link->ops = &sc7280_ops;
   410		}
   411	
   412		data->vdd_supply = devm_regulator_get(dev, "vdd-dmic-bias");
 > 413		if (IS_ERR(data->vdd_supply)
   414			return PTR_ERR(data->vdd_supply);
   415	
   416		return devm_snd_soc_register_card(dev, card);
 > 417	}
   418	

-- 
0-DAY CI Kernel Test Service
https://01.org/lkp

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] ASoC: qcom: SC7280: Add support for external DMIC bias supply
  2022-07-28 10:49   ` Mark Brown
@ 2022-07-28 13:06     ` Srinivasa Rao Mandadapu
  -1 siblings, 0 replies; 6+ messages in thread
From: Srinivasa Rao Mandadapu @ 2022-07-28 13:06 UTC (permalink / raw)
  To: Mark Brown
  Cc: agross, bjorn.andersson, lgirdwood, robh+dt, quic_plai, bgoswami,
	perex, tiwai, srinivas.kandagatla, quic_rohkumar, linux-arm-msm,
	alsa-devel, linux-kernel, swboyd, judyhsiao, devicetree


On 7/28/2022 4:19 PM, Mark Brown wrote:
Thanks for your time Mark!!!
> On Thu, Jul 28, 2022 at 12:40:33PM +0530, Srinivasa Rao Mandadapu wrote:
>
>> +static int sc7280_dmic_micbias(struct snd_soc_dapm_widget *w,
>> +				struct snd_kcontrol *kcontrol, int event)
>> +{
>> +	struct snd_soc_card *card = w->dapm->card;
>> +	struct sc7280_snd_data *data = snd_soc_card_get_drvdata(card);
>> +	int ret = 0;
>> +
> This is open coding SND_SOC_DAPM_REGULATOR_SUPPLY() isn't it?

Yes, agree that SND_SOC_DAPM_REGULATOR_SUPPLY can be used here. As I was 
using two different names for

VDD supply property and widget name, got confused. I will re post the 
patch, with single name for both and replace with above macro .


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] ASoC: qcom: SC7280: Add support for external DMIC bias supply
@ 2022-07-28 13:06     ` Srinivasa Rao Mandadapu
  0 siblings, 0 replies; 6+ messages in thread
From: Srinivasa Rao Mandadapu @ 2022-07-28 13:06 UTC (permalink / raw)
  To: Mark Brown
  Cc: devicetree, alsa-devel, quic_rohkumar, linux-arm-msm, swboyd,
	tiwai, lgirdwood, robh+dt, bjorn.andersson, agross,
	srinivas.kandagatla, bgoswami, quic_plai, judyhsiao,
	linux-kernel


On 7/28/2022 4:19 PM, Mark Brown wrote:
Thanks for your time Mark!!!
> On Thu, Jul 28, 2022 at 12:40:33PM +0530, Srinivasa Rao Mandadapu wrote:
>
>> +static int sc7280_dmic_micbias(struct snd_soc_dapm_widget *w,
>> +				struct snd_kcontrol *kcontrol, int event)
>> +{
>> +	struct snd_soc_card *card = w->dapm->card;
>> +	struct sc7280_snd_data *data = snd_soc_card_get_drvdata(card);
>> +	int ret = 0;
>> +
> This is open coding SND_SOC_DAPM_REGULATOR_SUPPLY() isn't it?

Yes, agree that SND_SOC_DAPM_REGULATOR_SUPPLY can be used here. As I was 
using two different names for

VDD supply property and widget name, got confused. I will re post the 
patch, with single name for both and replace with above macro .


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2022-07-28 13:07 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-28  7:10 [PATCH] ASoC: qcom: SC7280: Add support for external DMIC bias supply Srinivasa Rao Mandadapu
2022-07-28 10:49 ` Mark Brown
2022-07-28 10:49   ` Mark Brown
2022-07-28 13:06   ` Srinivasa Rao Mandadapu
2022-07-28 13:06     ` Srinivasa Rao Mandadapu
2022-07-28 12:57 ` kernel test robot

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.