[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <33772eab-74c6-c5c3-fa25-3a643a2f9c57@quicinc.com>
Date: Tue, 11 Jun 2024 10:09:52 +0530
From: Mohammad Rafi Shaik <quic_mohs@...cinc.com>
To: Srinivas Kandagatla <srinivas.kandagatla@...aro.org>,
Banajit Goswami
<bgoswami@...cinc.com>,
Liam Girdwood <lgirdwood@...il.com>, Mark Brown
<broonie@...nel.org>,
Rob Herring <robh@...nel.org>,
Krzysztof Kozlowski
<krzk+dt@...nel.org>,
Conor Dooley <conor+dt@...nel.org>, Jaroslav Kysela
<perex@...ex.cz>,
Takashi Iwai <tiwai@...e.com>
CC: <alsa-devel@...a-project.org>, <linux-arm-msm@...r.kernel.org>,
<linux-sound@...r.kernel.org>, <devicetree@...r.kernel.org>,
<linux-kernel@...r.kernel.org>, <quic_rohkumar@...cinc.com>,
<quic_pkumpatl@...cinc.com>, Konrad Dybcio <konrad.dybcio@...aro.org>
Subject: Re: [RESEND v5 6/7] ASoC: codecs: wcd937x: add capture dapm widgets
On 6/10/2024 12:35 PM, Srinivas Kandagatla wrote:
>
>
> On 27/05/2024 12:19, Mohammad Rafi Shaik wrote:
>> +static int __wcd937x_codec_enable_micbias(struct snd_soc_dapm_widget *w,
>> + int event)
>> +{
>> + struct snd_soc_component *component =
>> snd_soc_dapm_to_component(w->dapm);
>> + int micb_num;
>> +
>> + if (strnstr(w->name, "MIC BIAS1", sizeof("MIC BIAS1")))
>> + micb_num = MIC_BIAS_1;
>> + else if (strnstr(w->name, "MIC BIAS2", sizeof("MIC BIAS2")))
>> + micb_num = MIC_BIAS_2;
>> + else if (strnstr(w->name, "MIC BIAS3", sizeof("MIC BIAS3")))
>> + micb_num = MIC_BIAS_3;
>> + else
>> + return -EINVAL;
>> +
> See last comment..
>
>> + switch (event) {
>> + case SND_SOC_DAPM_PRE_PMU:
>> + wcd937x_micbias_control(component, micb_num,
>> + MICB_ENABLE, true);
>> + break;
>> + case SND_SOC_DAPM_POST_PMU:
>> + usleep_range(1000, 1100);
>> + break;
>> + case SND_SOC_DAPM_POST_PMD:
>> + wcd937x_micbias_control(component, micb_num,
>> + MICB_DISABLE, true);
>> + break;
>> + }
>> +
>> + return 0;
>> +}
>> +
>> +static int wcd937x_codec_enable_micbias(struct snd_soc_dapm_widget *w,
>> + struct snd_kcontrol *kcontrol,
>> + int event)
>> +{
>> + return __wcd937x_codec_enable_micbias(w, event);
>> +}
>> +
>> +static int __wcd937x_codec_enable_micbias_pullup(struct
>> snd_soc_dapm_widget *w,
>> + int event)
>> +{
>> + struct snd_soc_component *component =
>> snd_soc_dapm_to_component(w->dapm);
>> + int micb_num;
>> +
>> + if (strnstr(w->name, "VA MIC BIAS1", sizeof("VA MIC BIAS1")))
>> + micb_num = MIC_BIAS_1;
>> + else if (strnstr(w->name, "VA MIC BIAS2", sizeof("VA MIC BIAS2")))
>> + micb_num = MIC_BIAS_2;
>> + else if (strnstr(w->name, "VA MIC BIAS3", sizeof("VA MIC BIAS3")))
>> + micb_num = MIC_BIAS_3;
>> + else
>> + return -EINVAL;
>> +
> same..
>> + switch (event) {
>> + case SND_SOC_DAPM_PRE_PMU:
>> + wcd937x_micbias_control(component, micb_num,
>> MICB_PULLUP_ENABLE, true);
>> + break;
>> + case SND_SOC_DAPM_POST_PMU:
>> + usleep_range(1000, 1100);
>> + break;
>> + case SND_SOC_DAPM_POST_PMD:
>> + wcd937x_micbias_control(component, micb_num,
>> MICB_PULLUP_DISABLE, true);
>> + break;
>> + }
>> +
>> + return 0;
>> +}
>> +
>
> ...
>
>> static const struct snd_soc_dapm_widget wcd937x_dapm_widgets[] = {
> ...> + /* MIC_BIAS widgets */
>> + SND_SOC_DAPM_SUPPLY("MIC BIAS1", SND_SOC_NOPM, 0, 0,
> Please use shift here like
> SND_SOC_DAPM_SUPPLY("MIC BIAS1", SND_SOC_NOPM, MIC_BIAS_1, 0,
> SND_SOC_DAPM_SUPPLY("MIC BIAS2", SND_SOC_NOPM, MIC_BIAS_2, 0,
>
> to avoid doing a string compares on wideget name.
>
> --srini
>
ACK
Will remove the string compares on widget name and will use the shift here.
Thanks & Regards,
Rafi.
>> + wcd937x_codec_enable_micbias,
>> + SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMU |
>> + SND_SOC_DAPM_POST_PMD),
>> + SND_SOC_DAPM_SUPPLY("MIC BIAS2", SND_SOC_NOPM, 0, 0,
>> + wcd937x_codec_enable_micbias,
>> + SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMU |
>> + SND_SOC_DAPM_POST_PMD),
>> + SND_SOC_DAPM_SUPPLY("MIC BIAS3", SND_SOC_NOPM, 0, 0,
>> + wcd937x_codec_enable_micbias,
>> + SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMU |
>> + SND_SOC_DAPM_POST_PMD),
>> +
>> SND_SOC_DAPM_SUPPLY("VDD_BUCK", SND_SOC_NOPM, 0, 0,
>> wcd937x_codec_enable_vdd_buck,
>> SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMD),
>> @@ -2007,11 +2312,101 @@ static const struct snd_soc_dapm_widget
>> wcd937x_dapm_widgets[] = {
>> SND_SOC_DAPM_MIXER("HPHR_RDAC", SND_SOC_NOPM, 0, 0,
>> hphr_rdac_switch, ARRAY_SIZE(hphr_rdac_switch)),
>> + /* TX output widgets */
>> + SND_SOC_DAPM_OUTPUT("ADC1_OUTPUT"),
>> + SND_SOC_DAPM_OUTPUT("ADC2_OUTPUT"),
>> + SND_SOC_DAPM_OUTPUT("ADC3_OUTPUT"),
>> + SND_SOC_DAPM_OUTPUT("WCD_TX_OUTPUT"),
>> +
>> /* RX output widgets */
>> SND_SOC_DAPM_OUTPUT("EAR"),
>> SND_SOC_DAPM_OUTPUT("AUX"),
>> SND_SOC_DAPM_OUTPUT("HPHL"),
>> SND_SOC_DAPM_OUTPUT("HPHR"),
>> +
>> + /* MIC_BIAS pull up widgets */
>> + SND_SOC_DAPM_SUPPLY("VA MIC BIAS1", SND_SOC_NOPM, 0, 0,
>> + wcd937x_codec_enable_micbias_pullup,
>> + SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMU |
>> + SND_SOC_DAPM_POST_PMD),
>> + SND_SOC_DAPM_SUPPLY("VA MIC BIAS2", SND_SOC_NOPM, 0, 0,
>> + wcd937x_codec_enable_micbias_pullup,
>> + SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMU |
>> + SND_SOC_DAPM_POST_PMD),
>> + SND_SOC_DAPM_SUPPLY("VA MIC BIAS3", SND_SOC_NOPM, 0, 0,
>> + wcd937x_codec_enable_micbias_pullup,
>> + SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMU |
>> + SND_SOC_DAPM_POST_PMD),
Powered by blists - more mailing lists