Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ASoC: Merge fixes

So we can send to Linus.

+157 -77
+4
sound/soc/codecs/rt5682.c
··· 929 929 unsigned int val, count; 930 930 931 931 if (jack_insert) { 932 + snd_soc_dapm_mutex_lock(dapm); 933 + 932 934 snd_soc_component_update_bits(component, RT5682_PWR_ANLG_1, 933 935 RT5682_PWR_VREF2 | RT5682_PWR_MB, 934 936 RT5682_PWR_VREF2 | RT5682_PWR_MB); ··· 981 979 snd_soc_component_update_bits(component, RT5682_MICBIAS_2, 982 980 RT5682_PWR_CLK25M_MASK | RT5682_PWR_CLK1M_MASK, 983 981 RT5682_PWR_CLK25M_PU | RT5682_PWR_CLK1M_PU); 982 + 983 + snd_soc_dapm_mutex_unlock(dapm); 984 984 } else { 985 985 rt5682_enable_push_button_irq(component, false); 986 986 snd_soc_component_update_bits(component, RT5682_CBJ_CTRL_1,
+2 -2
sound/soc/codecs/tas2770.c
··· 291 291 ramp_rate_val = TAS2770_TDM_CFG_REG0_SMP_44_1KHZ | 292 292 TAS2770_TDM_CFG_REG0_31_88_2_96KHZ; 293 293 break; 294 - case 19200: 294 + case 192000: 295 295 ramp_rate_val = TAS2770_TDM_CFG_REG0_SMP_48KHZ | 296 296 TAS2770_TDM_CFG_REG0_31_176_4_192KHZ; 297 297 break; 298 - case 17640: 298 + case 176400: 299 299 ramp_rate_val = TAS2770_TDM_CFG_REG0_SMP_44_1KHZ | 300 300 TAS2770_TDM_CFG_REG0_31_176_4_192KHZ; 301 301 break;
+93 -33
sound/soc/codecs/wcd934x.c
··· 3256 3256 int value = ucontrol->value.integer.value[0]; 3257 3257 int sel; 3258 3258 3259 + if (wcd->comp_enabled[comp] == value) 3260 + return 0; 3261 + 3259 3262 wcd->comp_enabled[comp] = value; 3260 3263 sel = value ? WCD934X_HPH_GAIN_SRC_SEL_COMPANDER : 3261 3264 WCD934X_HPH_GAIN_SRC_SEL_REGISTER; ··· 3282 3279 case COMPANDER_8: 3283 3280 break; 3284 3281 default: 3285 - break; 3282 + return 0; 3286 3283 } 3287 3284 3288 - return 0; 3285 + return 1; 3289 3286 } 3290 3287 3291 3288 static int wcd934x_rx_hph_mode_get(struct snd_kcontrol *kc, ··· 3329 3326 return 0; 3330 3327 } 3331 3328 3329 + static int slim_rx_mux_to_dai_id(int mux) 3330 + { 3331 + int aif_id; 3332 + 3333 + switch (mux) { 3334 + case 1: 3335 + aif_id = AIF1_PB; 3336 + break; 3337 + case 2: 3338 + aif_id = AIF2_PB; 3339 + break; 3340 + case 3: 3341 + aif_id = AIF3_PB; 3342 + break; 3343 + case 4: 3344 + aif_id = AIF4_PB; 3345 + break; 3346 + default: 3347 + aif_id = -1; 3348 + break; 3349 + } 3350 + 3351 + return aif_id; 3352 + } 3353 + 3332 3354 static int slim_rx_mux_put(struct snd_kcontrol *kc, 3333 3355 struct snd_ctl_elem_value *ucontrol) 3334 3356 { ··· 3361 3333 struct wcd934x_codec *wcd = dev_get_drvdata(w->dapm->dev); 3362 3334 struct soc_enum *e = (struct soc_enum *)kc->private_value; 3363 3335 struct snd_soc_dapm_update *update = NULL; 3336 + struct wcd934x_slim_ch *ch, *c; 3364 3337 u32 port_id = w->shift; 3338 + bool found = false; 3339 + int mux_idx; 3340 + int prev_mux_idx = wcd->rx_port_value[port_id]; 3341 + int aif_id; 3365 3342 3366 - if (wcd->rx_port_value[port_id] == ucontrol->value.enumerated.item[0]) 3343 + mux_idx = ucontrol->value.enumerated.item[0]; 3344 + 3345 + if (mux_idx == prev_mux_idx) 3367 3346 return 0; 3368 3347 3369 - wcd->rx_port_value[port_id] = ucontrol->value.enumerated.item[0]; 3370 - 3371 - switch (wcd->rx_port_value[port_id]) { 3348 + switch(mux_idx) { 3372 3349 case 0: 3373 - list_del_init(&wcd->rx_chs[port_id].list); 3350 + aif_id = slim_rx_mux_to_dai_id(prev_mux_idx); 3351 + if (aif_id < 0) 3352 + return 0; 3353 + 3354 + list_for_each_entry_safe(ch, c, &wcd->dai[aif_id].slim_ch_list, list) { 3355 + if (ch->port == port_id + WCD934X_RX_START) { 3356 + found = true; 3357 + list_del_init(&ch->list); 3358 + break; 3359 + } 3360 + } 3361 + if (!found) 3362 + return 0; 3363 + 3374 3364 break; 3375 - case 1: 3376 - list_add_tail(&wcd->rx_chs[port_id].list, 3377 - &wcd->dai[AIF1_PB].slim_ch_list); 3365 + case 1 ... 4: 3366 + aif_id = slim_rx_mux_to_dai_id(mux_idx); 3367 + if (aif_id < 0) 3368 + return 0; 3369 + 3370 + if (list_empty(&wcd->rx_chs[port_id].list)) { 3371 + list_add_tail(&wcd->rx_chs[port_id].list, 3372 + &wcd->dai[aif_id].slim_ch_list); 3373 + } else { 3374 + dev_err(wcd->dev ,"SLIM_RX%d PORT is busy\n", port_id); 3375 + return 0; 3376 + } 3378 3377 break; 3379 - case 2: 3380 - list_add_tail(&wcd->rx_chs[port_id].list, 3381 - &wcd->dai[AIF2_PB].slim_ch_list); 3382 - break; 3383 - case 3: 3384 - list_add_tail(&wcd->rx_chs[port_id].list, 3385 - &wcd->dai[AIF3_PB].slim_ch_list); 3386 - break; 3387 - case 4: 3388 - list_add_tail(&wcd->rx_chs[port_id].list, 3389 - &wcd->dai[AIF4_PB].slim_ch_list); 3390 - break; 3378 + 3391 3379 default: 3392 - dev_err(wcd->dev, "Unknown AIF %d\n", 3393 - wcd->rx_port_value[port_id]); 3380 + dev_err(wcd->dev, "Unknown AIF %d\n", mux_idx); 3394 3381 goto err; 3395 3382 } 3396 3383 3384 + wcd->rx_port_value[port_id] = mux_idx; 3397 3385 snd_soc_dapm_mux_update_power(w->dapm, kc, wcd->rx_port_value[port_id], 3398 3386 e, update); 3399 3387 3400 - return 0; 3388 + return 1; 3401 3389 err: 3402 3390 return -EINVAL; 3403 3391 } ··· 3857 3813 struct soc_mixer_control *mixer = 3858 3814 (struct soc_mixer_control *)kc->private_value; 3859 3815 int enable = ucontrol->value.integer.value[0]; 3816 + struct wcd934x_slim_ch *ch, *c; 3860 3817 int dai_id = widget->shift; 3861 3818 int port_id = mixer->shift; 3862 3819 ··· 3865 3820 if (enable == wcd->tx_port_value[port_id]) 3866 3821 return 0; 3867 3822 3823 + if (enable) { 3824 + if (list_empty(&wcd->tx_chs[port_id].list)) { 3825 + list_add_tail(&wcd->tx_chs[port_id].list, 3826 + &wcd->dai[dai_id].slim_ch_list); 3827 + } else { 3828 + dev_err(wcd->dev ,"SLIM_TX%d PORT is busy\n", port_id); 3829 + return 0; 3830 + } 3831 + } else { 3832 + bool found = false; 3833 + 3834 + list_for_each_entry_safe(ch, c, &wcd->dai[dai_id].slim_ch_list, list) { 3835 + if (ch->port == port_id) { 3836 + found = true; 3837 + list_del_init(&wcd->tx_chs[port_id].list); 3838 + break; 3839 + } 3840 + } 3841 + if (!found) 3842 + return 0; 3843 + } 3844 + 3868 3845 wcd->tx_port_value[port_id] = enable; 3869 - 3870 - if (enable) 3871 - list_add_tail(&wcd->tx_chs[port_id].list, 3872 - &wcd->dai[dai_id].slim_ch_list); 3873 - else 3874 - list_del_init(&wcd->tx_chs[port_id].list); 3875 - 3876 3846 snd_soc_dapm_mixer_update_power(widget->dapm, kc, enable, update); 3877 3847 3878 - return 0; 3848 + return 1; 3879 3849 } 3880 3850 3881 3851 static const struct snd_kcontrol_new aif1_slim_cap_mixer[] = {
+12 -4
sound/soc/codecs/wsa881x.c
··· 772 772 773 773 usleep_range(1000, 1010); 774 774 } 775 - return 0; 775 + 776 + return 1; 776 777 } 777 778 778 779 static int wsa881x_get_port(struct snd_kcontrol *kcontrol, ··· 817 816 (struct soc_mixer_control *)kcontrol->private_value; 818 817 int portidx = mixer->reg; 819 818 820 - if (ucontrol->value.integer.value[0]) 819 + if (ucontrol->value.integer.value[0]) { 820 + if (data->port_enable[portidx]) 821 + return 0; 822 + 821 823 data->port_enable[portidx] = true; 822 - else 824 + } else { 825 + if (!data->port_enable[portidx]) 826 + return 0; 827 + 823 828 data->port_enable[portidx] = false; 829 + } 824 830 825 831 if (portidx == WSA881X_PORT_BOOST) /* Boost Switch */ 826 832 wsa881x_boost_ctrl(comp, data->port_enable[portidx]); 827 833 828 - return 0; 834 + return 1; 829 835 } 830 836 831 837 static const char * const smart_boost_lvl_text[] = {
+1 -1
sound/soc/mediatek/mt8195/mt8195-afe-pcm.c
··· 3029 3029 3030 3030 static const struct reg_sequence mt8195_cg_patch[] = { 3031 3031 { AUDIO_TOP_CON0, 0xfffffffb }, 3032 - { AUDIO_TOP_CON1, 0xfffffffa }, 3032 + { AUDIO_TOP_CON1, 0xfffffff8 }, 3033 3033 }; 3034 3034 3035 3035 static int mt8195_afe_init_registers(struct mtk_base_afe *afe)
-33
sound/soc/meson/aiu-encoder-i2s.c
··· 18 18 #define AIU_RST_SOFT_I2S_FAST BIT(0) 19 19 20 20 #define AIU_I2S_DAC_CFG_MSB_FIRST BIT(2) 21 - #define AIU_I2S_MISC_HOLD_EN BIT(2) 22 21 #define AIU_CLK_CTRL_I2S_DIV_EN BIT(0) 23 22 #define AIU_CLK_CTRL_I2S_DIV GENMASK(3, 2) 24 23 #define AIU_CLK_CTRL_AOCLK_INVERT BIT(6) ··· 33 34 snd_soc_component_update_bits(component, AIU_CLK_CTRL, 34 35 AIU_CLK_CTRL_I2S_DIV_EN, 35 36 enable ? AIU_CLK_CTRL_I2S_DIV_EN : 0); 36 - } 37 - 38 - static void aiu_encoder_i2s_hold(struct snd_soc_component *component, 39 - bool enable) 40 - { 41 - snd_soc_component_update_bits(component, AIU_I2S_MISC, 42 - AIU_I2S_MISC_HOLD_EN, 43 - enable ? AIU_I2S_MISC_HOLD_EN : 0); 44 - } 45 - 46 - static int aiu_encoder_i2s_trigger(struct snd_pcm_substream *substream, int cmd, 47 - struct snd_soc_dai *dai) 48 - { 49 - struct snd_soc_component *component = dai->component; 50 - 51 - switch (cmd) { 52 - case SNDRV_PCM_TRIGGER_START: 53 - case SNDRV_PCM_TRIGGER_RESUME: 54 - case SNDRV_PCM_TRIGGER_PAUSE_RELEASE: 55 - aiu_encoder_i2s_hold(component, false); 56 - return 0; 57 - 58 - case SNDRV_PCM_TRIGGER_STOP: 59 - case SNDRV_PCM_TRIGGER_SUSPEND: 60 - case SNDRV_PCM_TRIGGER_PAUSE_PUSH: 61 - aiu_encoder_i2s_hold(component, true); 62 - return 0; 63 - 64 - default: 65 - return -EINVAL; 66 - } 67 37 } 68 38 69 39 static int aiu_encoder_i2s_setup_desc(struct snd_soc_component *component, ··· 321 353 } 322 354 323 355 const struct snd_soc_dai_ops aiu_encoder_i2s_dai_ops = { 324 - .trigger = aiu_encoder_i2s_trigger, 325 356 .hw_params = aiu_encoder_i2s_hw_params, 326 357 .hw_free = aiu_encoder_i2s_hw_free, 327 358 .set_fmt = aiu_encoder_i2s_set_fmt,
+19
sound/soc/meson/aiu-fifo-i2s.c
··· 20 20 #define AIU_MEM_I2S_CONTROL_MODE_16BIT BIT(6) 21 21 #define AIU_MEM_I2S_BUF_CNTL_INIT BIT(0) 22 22 #define AIU_RST_SOFT_I2S_FAST BIT(0) 23 + #define AIU_I2S_MISC_HOLD_EN BIT(2) 24 + #define AIU_I2S_MISC_FORCE_LEFT_RIGHT BIT(4) 23 25 24 26 #define AIU_FIFO_I2S_BLOCK 256 25 27 ··· 92 90 unsigned int val; 93 91 int ret; 94 92 93 + snd_soc_component_update_bits(component, AIU_I2S_MISC, 94 + AIU_I2S_MISC_HOLD_EN, 95 + AIU_I2S_MISC_HOLD_EN); 96 + 95 97 ret = aiu_fifo_hw_params(substream, params, dai); 96 98 if (ret) 97 99 return ret; ··· 122 116 val = FIELD_PREP(AIU_MEM_I2S_MASKS_IRQ_BLOCK, val); 123 117 snd_soc_component_update_bits(component, AIU_MEM_I2S_MASKS, 124 118 AIU_MEM_I2S_MASKS_IRQ_BLOCK, val); 119 + 120 + /* 121 + * Most (all?) supported SoCs have this bit set by default. The vendor 122 + * driver however sets it manually (depending on the version either 123 + * while un-setting AIU_I2S_MISC_HOLD_EN or right before that). Follow 124 + * the same approach for consistency with the vendor driver. 125 + */ 126 + snd_soc_component_update_bits(component, AIU_I2S_MISC, 127 + AIU_I2S_MISC_FORCE_LEFT_RIGHT, 128 + AIU_I2S_MISC_FORCE_LEFT_RIGHT); 129 + 130 + snd_soc_component_update_bits(component, AIU_I2S_MISC, 131 + AIU_I2S_MISC_HOLD_EN, 0); 125 132 126 133 return 0; 127 134 }
+6
sound/soc/meson/aiu-fifo.c
··· 5 5 6 6 #include <linux/bitfield.h> 7 7 #include <linux/clk.h> 8 + #include <linux/dma-mapping.h> 8 9 #include <sound/pcm_params.h> 9 10 #include <sound/soc.h> 10 11 #include <sound/soc-dai.h> ··· 180 179 struct snd_card *card = rtd->card->snd_card; 181 180 struct aiu_fifo *fifo = dai->playback_dma_data; 182 181 size_t size = fifo->pcm->buffer_bytes_max; 182 + int ret; 183 + 184 + ret = dma_coerce_mask_and_coherent(card->dev, DMA_BIT_MASK(32)); 185 + if (ret) 186 + return ret; 183 187 184 188 snd_pcm_set_managed_buffer_all(rtd->pcm, SNDRV_DMA_TYPE_DEV, 185 189 card->dev, size, size);
+5 -3
sound/soc/qcom/qdsp6/q6routing.c
··· 498 498 struct session_data *session = &data->sessions[session_id]; 499 499 500 500 if (ucontrol->value.integer.value[0]) { 501 + if (session->port_id == be_id) 502 + return 0; 503 + 501 504 session->port_id = be_id; 502 505 snd_soc_dapm_mixer_update_power(dapm, kcontrol, 1, update); 503 506 } else { 504 - if (session->port_id == be_id) { 505 - session->port_id = -1; 507 + if (session->port_id == -1 || session->port_id != be_id) 506 508 return 0; 507 - } 508 509 510 + session->port_id = -1; 509 511 snd_soc_dapm_mixer_update_power(dapm, kcontrol, 0, update); 510 512 } 511 513
+4
sound/soc/sof/intel/pci-tgl.c
··· 112 112 .driver_data = (unsigned long)&adls_desc}, 113 113 { PCI_DEVICE(0x8086, 0x51c8), /* ADL-P */ 114 114 .driver_data = (unsigned long)&adl_desc}, 115 + { PCI_DEVICE(0x8086, 0x51cd), /* ADL-P */ 116 + .driver_data = (unsigned long)&adl_desc}, 115 117 { PCI_DEVICE(0x8086, 0x51cc), /* ADL-M */ 118 + .driver_data = (unsigned long)&adl_desc}, 119 + { PCI_DEVICE(0x8086, 0x54c8), /* ADL-N */ 116 120 .driver_data = (unsigned long)&adl_desc}, 117 121 { 0, } 118 122 };
+10 -1
sound/soc/tegra/tegra_asoc_machine.c
··· 116 116 SOC_DAPM_PIN_SWITCH("Headset Mic"), 117 117 SOC_DAPM_PIN_SWITCH("Internal Mic 1"), 118 118 SOC_DAPM_PIN_SWITCH("Internal Mic 2"), 119 + SOC_DAPM_PIN_SWITCH("Headphones"), 120 + SOC_DAPM_PIN_SWITCH("Mic Jack"), 119 121 }; 120 122 121 123 int tegra_asoc_machine_init(struct snd_soc_pcm_runtime *rtd) 122 124 { 123 125 struct snd_soc_card *card = rtd->card; 124 126 struct tegra_machine *machine = snd_soc_card_get_drvdata(card); 127 + const char *jack_name; 125 128 int err; 126 129 127 130 if (machine->gpiod_hp_det && machine->asoc->add_hp_jack) { 128 - err = snd_soc_card_jack_new(card, "Headphones Jack", 131 + if (machine->asoc->hp_jack_name) 132 + jack_name = machine->asoc->hp_jack_name; 133 + else 134 + jack_name = "Headphones Jack"; 135 + 136 + err = snd_soc_card_jack_new(card, jack_name, 129 137 SND_JACK_HEADPHONE, 130 138 &tegra_machine_hp_jack, 131 139 tegra_machine_hp_jack_pins, ··· 666 658 static const struct tegra_asoc_data tegra_max98090_data = { 667 659 .mclk_rate = tegra_machine_mclk_rate_12mhz, 668 660 .card = &snd_soc_tegra_max98090, 661 + .hp_jack_name = "Headphones", 669 662 .add_common_dapm_widgets = true, 670 663 .add_common_controls = true, 671 664 .add_common_snd_ops = true,
+1
sound/soc/tegra/tegra_asoc_machine.h
··· 14 14 struct tegra_asoc_data { 15 15 unsigned int (*mclk_rate)(unsigned int srate); 16 16 const char *codec_dev_name; 17 + const char *hp_jack_name; 17 18 struct snd_soc_card *card; 18 19 unsigned int mclk_id; 19 20 bool hp_jack_gpio_active_low;