mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-15 08:14:15 +08:00
ASoC: fix widget name comparisons (consider DAI name
Merge series from Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>: Some codec drivers compare widget names with strcmp, ignoring the component name prefix. If prefix is used, the comparisons start failing. Except Qualcomm lpass-rx-macro, none of the patches were tested on hardware.
This commit is contained in:
commit
11817547b7
@ -400,9 +400,9 @@ static int pm860x_dac_event(struct snd_soc_dapm_widget *w,
|
||||
unsigned int dac = 0;
|
||||
int data;
|
||||
|
||||
if (!strcmp(w->name, "Left DAC"))
|
||||
if (!snd_soc_dapm_widget_name_cmp(w, "Left DAC"))
|
||||
dac = DAC_LEFT;
|
||||
if (!strcmp(w->name, "Right DAC"))
|
||||
if (!snd_soc_dapm_widget_name_cmp(w, "Right DAC"))
|
||||
dac = DAC_RIGHT;
|
||||
switch (event) {
|
||||
case SND_SOC_DAPM_PRE_PMU:
|
||||
|
@ -834,7 +834,7 @@ static int adau1373_check_aif_clk(struct snd_soc_dapm_widget *source,
|
||||
else
|
||||
clk = "SYSCLK2";
|
||||
|
||||
return strcmp(source->name, clk) == 0;
|
||||
return snd_soc_dapm_widget_name_cmp(source, clk) == 0;
|
||||
}
|
||||
|
||||
static int adau1373_check_src(struct snd_soc_dapm_widget *source,
|
||||
|
@ -229,7 +229,7 @@ static int adav80x_dapm_sysclk_check(struct snd_soc_dapm_widget *source,
|
||||
return 0;
|
||||
}
|
||||
|
||||
return strcmp(source->name, clk) == 0;
|
||||
return snd_soc_dapm_widget_name_cmp(source, clk) == 0;
|
||||
}
|
||||
|
||||
static int adav80x_dapm_pll_check(struct snd_soc_dapm_widget *source,
|
||||
|
@ -2906,14 +2906,14 @@ static int rx_macro_enable_echo(struct snd_soc_dapm_widget *w,
|
||||
|
||||
val = snd_soc_component_read(component,
|
||||
CDC_RX_INP_MUX_RX_MIX_CFG4);
|
||||
if (!(strcmp(w->name, "RX MIX TX0 MUX")))
|
||||
if (!(snd_soc_dapm_widget_name_cmp(w, "RX MIX TX0 MUX")))
|
||||
ec_tx = ((val & 0xf0) >> 0x4) - 1;
|
||||
else if (!(strcmp(w->name, "RX MIX TX1 MUX")))
|
||||
else if (!(snd_soc_dapm_widget_name_cmp(w, "RX MIX TX1 MUX")))
|
||||
ec_tx = (val & 0x0f) - 1;
|
||||
|
||||
val = snd_soc_component_read(component,
|
||||
CDC_RX_INP_MUX_RX_MIX_CFG5);
|
||||
if (!(strcmp(w->name, "RX MIX TX2 MUX")))
|
||||
if (!(snd_soc_dapm_widget_name_cmp(w, "RX MIX TX2 MUX")))
|
||||
ec_tx = (val & 0x0f) - 1;
|
||||
|
||||
if (ec_tx < 0 || (ec_tx >= RX_MACRO_EC_MUX_MAX)) {
|
||||
|
@ -56,13 +56,13 @@ static int max9867_adc_dac_event(struct snd_soc_dapm_widget *w,
|
||||
struct max9867_priv *max9867 = snd_soc_component_get_drvdata(component);
|
||||
enum max9867_adc_dac adc_dac;
|
||||
|
||||
if (!strcmp(w->name, "ADCL"))
|
||||
if (!snd_soc_dapm_widget_name_cmp(w, "ADCL"))
|
||||
adc_dac = MAX9867_ADC_LEFT;
|
||||
else if (!strcmp(w->name, "ADCR"))
|
||||
else if (!snd_soc_dapm_widget_name_cmp(w, "ADCR"))
|
||||
adc_dac = MAX9867_ADC_RIGHT;
|
||||
else if (!strcmp(w->name, "DACL"))
|
||||
else if (!snd_soc_dapm_widget_name_cmp(w, "DACL"))
|
||||
adc_dac = MAX9867_DAC_LEFT;
|
||||
else if (!strcmp(w->name, "DACR"))
|
||||
else if (!snd_soc_dapm_widget_name_cmp(w, "DACR"))
|
||||
adc_dac = MAX9867_DAC_RIGHT;
|
||||
else
|
||||
return 0;
|
||||
|
@ -1323,9 +1323,9 @@ static int set_i2s_event(struct snd_soc_dapm_widget *w,
|
||||
if (SND_SOC_DAPM_EVENT_ON(event))
|
||||
on = 1;
|
||||
|
||||
if (!strcmp(w->name, "I2S1") && !rt5682s->wclk_enabled)
|
||||
if (!snd_soc_dapm_widget_name_cmp(w, "I2S1") && !rt5682s->wclk_enabled)
|
||||
rt5682s_set_i2s(rt5682s, RT5682S_AIF1, on);
|
||||
else if (!strcmp(w->name, "I2S2"))
|
||||
else if (!snd_soc_dapm_widget_name_cmp(w, "I2S2"))
|
||||
rt5682s_set_i2s(rt5682s, RT5682S_AIF2, on);
|
||||
|
||||
return 0;
|
||||
|
@ -291,11 +291,11 @@ static int rtq9128_dac_power_event(struct snd_soc_dapm_widget *w, struct snd_kco
|
||||
|
||||
dev_dbg(comp->dev, "%s: %s event %d\n", __func__, w->name, event);
|
||||
|
||||
if (strcmp(w->name, "DAC1") == 0)
|
||||
if (snd_soc_dapm_widget_name_cmp(w, "DAC1") == 0)
|
||||
shift = 6;
|
||||
else if (strcmp(w->name, "DAC2") == 0)
|
||||
else if (snd_soc_dapm_widget_name_cmp(w, "DAC2") == 0)
|
||||
shift = 4;
|
||||
else if (strcmp(w->name, "DAC3") == 0)
|
||||
else if (snd_soc_dapm_widget_name_cmp(w, "DAC3") == 0)
|
||||
shift = 2;
|
||||
else
|
||||
shift = 0;
|
||||
|
@ -3296,31 +3296,31 @@ static int wcd9335_codec_enable_interpolator(struct snd_soc_dapm_widget *w,
|
||||
int val;
|
||||
int offset_val = 0;
|
||||
|
||||
if (!(strcmp(w->name, "RX INT0 INTERP"))) {
|
||||
if (!(snd_soc_dapm_widget_name_cmp(w, "RX INT0 INTERP"))) {
|
||||
reg = WCD9335_CDC_RX0_RX_PATH_CTL;
|
||||
gain_reg = WCD9335_CDC_RX0_RX_VOL_CTL;
|
||||
} else if (!(strcmp(w->name, "RX INT1 INTERP"))) {
|
||||
} else if (!(snd_soc_dapm_widget_name_cmp(w, "RX INT1 INTERP"))) {
|
||||
reg = WCD9335_CDC_RX1_RX_PATH_CTL;
|
||||
gain_reg = WCD9335_CDC_RX1_RX_VOL_CTL;
|
||||
} else if (!(strcmp(w->name, "RX INT2 INTERP"))) {
|
||||
} else if (!(snd_soc_dapm_widget_name_cmp(w, "RX INT2 INTERP"))) {
|
||||
reg = WCD9335_CDC_RX2_RX_PATH_CTL;
|
||||
gain_reg = WCD9335_CDC_RX2_RX_VOL_CTL;
|
||||
} else if (!(strcmp(w->name, "RX INT3 INTERP"))) {
|
||||
} else if (!(snd_soc_dapm_widget_name_cmp(w, "RX INT3 INTERP"))) {
|
||||
reg = WCD9335_CDC_RX3_RX_PATH_CTL;
|
||||
gain_reg = WCD9335_CDC_RX3_RX_VOL_CTL;
|
||||
} else if (!(strcmp(w->name, "RX INT4 INTERP"))) {
|
||||
} else if (!(snd_soc_dapm_widget_name_cmp(w, "RX INT4 INTERP"))) {
|
||||
reg = WCD9335_CDC_RX4_RX_PATH_CTL;
|
||||
gain_reg = WCD9335_CDC_RX4_RX_VOL_CTL;
|
||||
} else if (!(strcmp(w->name, "RX INT5 INTERP"))) {
|
||||
} else if (!(snd_soc_dapm_widget_name_cmp(w, "RX INT5 INTERP"))) {
|
||||
reg = WCD9335_CDC_RX5_RX_PATH_CTL;
|
||||
gain_reg = WCD9335_CDC_RX5_RX_VOL_CTL;
|
||||
} else if (!(strcmp(w->name, "RX INT6 INTERP"))) {
|
||||
} else if (!(snd_soc_dapm_widget_name_cmp(w, "RX INT6 INTERP"))) {
|
||||
reg = WCD9335_CDC_RX6_RX_PATH_CTL;
|
||||
gain_reg = WCD9335_CDC_RX6_RX_VOL_CTL;
|
||||
} else if (!(strcmp(w->name, "RX INT7 INTERP"))) {
|
||||
} else if (!(snd_soc_dapm_widget_name_cmp(w, "RX INT7 INTERP"))) {
|
||||
reg = WCD9335_CDC_RX7_RX_PATH_CTL;
|
||||
gain_reg = WCD9335_CDC_RX7_RX_VOL_CTL;
|
||||
} else if (!(strcmp(w->name, "RX INT8 INTERP"))) {
|
||||
} else if (!(snd_soc_dapm_widget_name_cmp(w, "RX INT8 INTERP"))) {
|
||||
reg = WCD9335_CDC_RX8_RX_PATH_CTL;
|
||||
gain_reg = WCD9335_CDC_RX8_RX_VOL_CTL;
|
||||
} else {
|
||||
|
@ -1854,10 +1854,10 @@ static int tp_event(struct snd_soc_dapm_widget *w,
|
||||
|
||||
reg = WM8962_ADDITIONAL_CONTROL_4;
|
||||
|
||||
if (!strcmp(w->name, "TEMP_HP")) {
|
||||
if (!snd_soc_dapm_widget_name_cmp(w, "TEMP_HP")) {
|
||||
mask = WM8962_TEMP_ENA_HP_MASK;
|
||||
val = WM8962_TEMP_ENA_HP;
|
||||
} else if (!strcmp(w->name, "TEMP_SPK")) {
|
||||
} else if (!snd_soc_dapm_widget_name_cmp(w, "TEMP_SPK")) {
|
||||
mask = WM8962_TEMP_ENA_SPK_MASK;
|
||||
val = WM8962_TEMP_ENA_SPK;
|
||||
} else {
|
||||
|
@ -262,7 +262,7 @@ static int check_clk_sys(struct snd_soc_dapm_widget *source,
|
||||
else
|
||||
clk = "AIF1CLK";
|
||||
|
||||
return strcmp(source->name, clk) == 0;
|
||||
return snd_soc_dapm_widget_name_cmp(source, clk) == 0;
|
||||
}
|
||||
|
||||
static const char *sidetone_hpf_text[] = {
|
||||
|
@ -541,7 +541,7 @@ static int check_clk_sys(struct snd_soc_dapm_widget *source,
|
||||
clk = "AIF2CLK";
|
||||
else
|
||||
clk = "AIF1CLK";
|
||||
return !strcmp(source->name, clk);
|
||||
return !snd_soc_dapm_widget_name_cmp(source, clk);
|
||||
}
|
||||
|
||||
static int wm8995_put_class_w(struct snd_kcontrol *kcontrol,
|
||||
|
@ -276,13 +276,13 @@ static int mtk_apll_event(struct snd_soc_dapm_widget *w,
|
||||
|
||||
switch (event) {
|
||||
case SND_SOC_DAPM_PRE_PMU:
|
||||
if (strcmp(w->name, APLL1_W_NAME) == 0)
|
||||
if (snd_soc_dapm_widget_name_cmp(w, APLL1_W_NAME) == 0)
|
||||
mt8183_apll1_enable(afe);
|
||||
else
|
||||
mt8183_apll2_enable(afe);
|
||||
break;
|
||||
case SND_SOC_DAPM_POST_PMD:
|
||||
if (strcmp(w->name, APLL1_W_NAME) == 0)
|
||||
if (snd_soc_dapm_widget_name_cmp(w, APLL1_W_NAME) == 0)
|
||||
mt8183_apll1_disable(afe);
|
||||
else
|
||||
mt8183_apll2_disable(afe);
|
||||
|
@ -321,7 +321,7 @@ static int mtk_adda_mtkaif_cfg_event(struct snd_soc_dapm_widget *w,
|
||||
MTKAIF_RXIF_CLKINV_ADC_MASK_SFT,
|
||||
BIT(MTKAIF_RXIF_CLKINV_ADC_SFT));
|
||||
|
||||
if (strcmp(w->name, "ADDA_MTKAIF_CFG") == 0) {
|
||||
if (snd_soc_dapm_widget_name_cmp(w, "ADDA_MTKAIF_CFG") == 0) {
|
||||
if (afe_priv->mtkaif_chosen_phase[0] < 0 &&
|
||||
afe_priv->mtkaif_chosen_phase[1] < 0) {
|
||||
dev_err(afe->dev,
|
||||
|
@ -47,7 +47,7 @@ static int mtk_hw_gain_event(struct snd_soc_dapm_widget *w,
|
||||
|
||||
switch (event) {
|
||||
case SND_SOC_DAPM_PRE_PMU:
|
||||
if (strcmp(w->name, HW_GAIN_1_EN_W_NAME) == 0) {
|
||||
if (snd_soc_dapm_widget_name_cmp(w, HW_GAIN_1_EN_W_NAME) == 0) {
|
||||
gain_cur = AFE_GAIN1_CUR;
|
||||
gain_con1 = AFE_GAIN1_CON1;
|
||||
} else {
|
||||
|
@ -393,13 +393,13 @@ static int mtk_apll_event(struct snd_soc_dapm_widget *w,
|
||||
|
||||
switch (event) {
|
||||
case SND_SOC_DAPM_PRE_PMU:
|
||||
if (strcmp(w->name, APLL1_W_NAME) == 0)
|
||||
if (snd_soc_dapm_widget_name_cmp(w, APLL1_W_NAME) == 0)
|
||||
mt8186_apll1_enable(afe);
|
||||
else
|
||||
mt8186_apll2_enable(afe);
|
||||
break;
|
||||
case SND_SOC_DAPM_POST_PMD:
|
||||
if (strcmp(w->name, APLL1_W_NAME) == 0)
|
||||
if (snd_soc_dapm_widget_name_cmp(w, APLL1_W_NAME) == 0)
|
||||
mt8186_apll1_disable(afe);
|
||||
else
|
||||
mt8186_apll2_disable(afe);
|
||||
|
@ -322,7 +322,7 @@ static int mtk_hw_src_event(struct snd_soc_dapm_widget *w,
|
||||
struct mtk_afe_src_priv *src_priv;
|
||||
unsigned int reg;
|
||||
|
||||
if (strcmp(w->name, HW_SRC_1_EN_W_NAME) == 0)
|
||||
if (snd_soc_dapm_widget_name_cmp(w, HW_SRC_1_EN_W_NAME) == 0)
|
||||
id = MT8186_DAI_SRC_1;
|
||||
else
|
||||
id = MT8186_DAI_SRC_2;
|
||||
@ -487,7 +487,7 @@ static int mtk_afe_src_en_connect(struct snd_soc_dapm_widget *source,
|
||||
struct mt8186_afe_private *afe_priv = afe->platform_priv;
|
||||
struct mtk_afe_src_priv *src_priv;
|
||||
|
||||
if (strcmp(w->name, HW_SRC_1_EN_W_NAME) == 0)
|
||||
if (snd_soc_dapm_widget_name_cmp(w, HW_SRC_1_EN_W_NAME) == 0)
|
||||
src_priv = afe_priv->dai_priv[MT8186_DAI_SRC_1];
|
||||
else
|
||||
src_priv = afe_priv->dai_priv[MT8186_DAI_SRC_2];
|
||||
|
@ -576,13 +576,13 @@ static int mtk_apll_event(struct snd_soc_dapm_widget *w,
|
||||
|
||||
switch (event) {
|
||||
case SND_SOC_DAPM_PRE_PMU:
|
||||
if (strcmp(w->name, APLL1_W_NAME) == 0)
|
||||
if (snd_soc_dapm_widget_name_cmp(w, APLL1_W_NAME) == 0)
|
||||
mt8188_apll1_enable(afe);
|
||||
else
|
||||
mt8188_apll2_enable(afe);
|
||||
break;
|
||||
case SND_SOC_DAPM_POST_PMD:
|
||||
if (strcmp(w->name, APLL1_W_NAME) == 0)
|
||||
if (snd_soc_dapm_widget_name_cmp(w, APLL1_W_NAME) == 0)
|
||||
mt8188_apll1_disable(afe);
|
||||
else
|
||||
mt8188_apll2_disable(afe);
|
||||
|
@ -435,7 +435,7 @@ static int mtk_adda_mtkaif_cfg_event(struct snd_soc_dapm_widget *w,
|
||||
regmap_write(afe->regmap, AFE_ADDA6_MTKAIF_CFG0,
|
||||
0x00010000);
|
||||
|
||||
if (strcmp(w->name, "ADDA_MTKAIF_CFG") == 0 &&
|
||||
if (snd_soc_dapm_widget_name_cmp(w, "ADDA_MTKAIF_CFG") == 0 &&
|
||||
(afe_priv->mtkaif_chosen_phase[0] < 0 ||
|
||||
afe_priv->mtkaif_chosen_phase[1] < 0)) {
|
||||
dev_warn(afe->dev,
|
||||
@ -444,7 +444,7 @@ static int mtk_adda_mtkaif_cfg_event(struct snd_soc_dapm_widget *w,
|
||||
afe_priv->mtkaif_chosen_phase[0],
|
||||
afe_priv->mtkaif_chosen_phase[1]);
|
||||
break;
|
||||
} else if (strcmp(w->name, "ADDA6_MTKAIF_CFG") == 0 &&
|
||||
} else if (snd_soc_dapm_widget_name_cmp(w, "ADDA6_MTKAIF_CFG") == 0 &&
|
||||
afe_priv->mtkaif_chosen_phase[2] < 0) {
|
||||
dev_warn(afe->dev,
|
||||
"%s(), mtkaif_chosen_phase[2]:%d\n",
|
||||
|
@ -623,13 +623,13 @@ static int mtk_apll_event(struct snd_soc_dapm_widget *w,
|
||||
|
||||
switch (event) {
|
||||
case SND_SOC_DAPM_PRE_PMU:
|
||||
if (strcmp(w->name, APLL1_W_NAME) == 0)
|
||||
if (snd_soc_dapm_widget_name_cmp(w, APLL1_W_NAME) == 0)
|
||||
mt8192_apll1_enable(afe);
|
||||
else
|
||||
mt8192_apll2_enable(afe);
|
||||
break;
|
||||
case SND_SOC_DAPM_POST_PMD:
|
||||
if (strcmp(w->name, APLL1_W_NAME) == 0)
|
||||
if (snd_soc_dapm_widget_name_cmp(w, APLL1_W_NAME) == 0)
|
||||
mt8192_apll1_disable(afe);
|
||||
else
|
||||
mt8192_apll2_disable(afe);
|
||||
|
@ -111,9 +111,9 @@ static int speyside_jack_polarity;
|
||||
static int speyside_get_micbias(struct snd_soc_dapm_widget *source,
|
||||
struct snd_soc_dapm_widget *sink)
|
||||
{
|
||||
if (speyside_jack_polarity && (strcmp(source->name, "MICB1") == 0))
|
||||
if (speyside_jack_polarity && (snd_soc_dapm_widget_name_cmp(source, "MICB1") == 0))
|
||||
return 1;
|
||||
if (!speyside_jack_polarity && (strcmp(source->name, "MICB2") == 0))
|
||||
if (!speyside_jack_polarity && (snd_soc_dapm_widget_name_cmp(source, "MICB2") == 0))
|
||||
return 1;
|
||||
|
||||
return 0;
|
||||
|
@ -81,19 +81,23 @@ static int tegra_machine_event(struct snd_soc_dapm_widget *w,
|
||||
struct snd_soc_dapm_context *dapm = w->dapm;
|
||||
struct tegra_machine *machine = snd_soc_card_get_drvdata(dapm->card);
|
||||
|
||||
if (!strcmp(w->name, "Int Spk") || !strcmp(w->name, "Speakers"))
|
||||
if (!snd_soc_dapm_widget_name_cmp(w, "Int Spk") ||
|
||||
!snd_soc_dapm_widget_name_cmp(w, "Speakers"))
|
||||
gpiod_set_value_cansleep(machine->gpiod_spkr_en,
|
||||
SND_SOC_DAPM_EVENT_ON(event));
|
||||
|
||||
if (!strcmp(w->name, "Mic Jack") || !strcmp(w->name, "Headset Mic"))
|
||||
if (!snd_soc_dapm_widget_name_cmp(w, "Mic Jack") ||
|
||||
!snd_soc_dapm_widget_name_cmp(w, "Headset Mic"))
|
||||
gpiod_set_value_cansleep(machine->gpiod_ext_mic_en,
|
||||
SND_SOC_DAPM_EVENT_ON(event));
|
||||
|
||||
if (!strcmp(w->name, "Int Mic") || !strcmp(w->name, "Internal Mic 2"))
|
||||
if (!snd_soc_dapm_widget_name_cmp(w, "Int Mic") ||
|
||||
!snd_soc_dapm_widget_name_cmp(w, "Internal Mic 2"))
|
||||
gpiod_set_value_cansleep(machine->gpiod_int_mic_en,
|
||||
SND_SOC_DAPM_EVENT_ON(event));
|
||||
|
||||
if (!strcmp(w->name, "Headphone") || !strcmp(w->name, "Headphone Jack"))
|
||||
if (!snd_soc_dapm_widget_name_cmp(w, "Headphone") ||
|
||||
!snd_soc_dapm_widget_name_cmp(w, "Headphone Jack"))
|
||||
gpiod_set_value_cansleep(machine->gpiod_hp_mute,
|
||||
!SND_SOC_DAPM_EVENT_ON(event));
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user