History

Merge tag 'asoc-fix-v5.19-rc4' of https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound into for-linus

ASoC: Fixes for v5.19 Quite a large batch due to things building up for a couple of weeks but all driver specific apart from Marek's documentation fix.

Takashi Iwai committed 4 years ago

Commit a4bd9352 parents c5e58c4 fc976f521 files · +168 −120Browse files

Unified · Split

21 files
  1. Documentation/devicetree/bindings/sound/qcom,lpass-cpu.yaml +4 −4
  2. Documentation/sound/soc/dai.rst +1 −1
  3. sound/soc/codecs/arizona.c +2 −2
  4. sound/soc/codecs/cs47l92.c +7 −1
  5. sound/soc/codecs/max98396.c +6 −4
  6. sound/soc/codecs/rt5640.c +22 −8
  7. sound/soc/codecs/sgtl5000.c +9 −0
  8. sound/soc/codecs/sgtl5000.h +1 −0
  9. sound/soc/codecs/tas2764.c +28 −18
  10. sound/soc/codecs/tas2764.h +2 −4
  11. sound/soc/codecs/tlv320adcx140.c +6 −7
  12. sound/soc/codecs/wcd9335.c +11 −6
  13. sound/soc/codecs/wm5102.c +17 −4
  14. sound/soc/codecs/wm8998.c +14 −7
  15. sound/soc/generic/audio-graph-card2.c +3 −3
  16. sound/soc/intel/boards/sof_rt5682.c +3 −7
  17. sound/soc/intel/skylake/skl-nhlt.c +27 −13
  18. sound/soc/qcom/qdsp6/q6apm.c +1 −0
  19. sound/soc/ti/omap-mcbsp-priv.h +0 −2
  20. sound/soc/ti/omap-mcbsp-st.c +2 −12
  21. sound/soc/ti/omap-mcbsp.c +2 −17
Documentation/devicetree/bindings/sound/qcom,lpass-cpu.yaml+4−4
@@ -25,12 +25,12 @@ properties: · 24 unmodified lines
2525 - qcom,sc7280-lpass-cpu
2626
2727 reg:
28− minItems: 2
28+ minItems: 1
2929 maxItems: 6
3030 description: LPAIF core registers
3131
3232 reg-names:
33− minItems: 2
33+ minItems: 1
3434 maxItems: 6
3535
3636 clocks:
@@ -42,12 +42,12 @@ properties: · 5 unmodified lines
4242 maxItems: 10
4343
4444 interrupts:
45− minItems: 2
45+ minItems: 1
4646 maxItems: 4
4747 description: LPAIF DMA buffer interrupt
4848
4949 interrupt-names:
50− minItems: 2
50+ minItems: 1
5151 maxItems: 4
5252
5353 qcom,adsp:
Documentation/sound/soc/dai.rst+1−1
@@ -10,7 +10,7 @@ AC97 · 9 unmodified lines
1010 ====
1111
1212 AC97 is a five wire interface commonly found on many PC sound cards. It is
13−now also popular in many portable devices. This DAI has a reset line and time
13+now also popular in many portable devices. This DAI has a RESET line and time
1414 multiplexes its data on its SDATA_OUT (playback) and SDATA_IN (capture) lines.
1515 The bit clock (BCLK) is always driven by the CODEC (usually 12.288MHz) and the
1616 frame (FRAME) (usually 48kHz) is always driven by the controller. Each AC97
sound/soc/codecs/arizona.c+2−2
@@ -1760,8 +1760,8 @@ static bool arizona_aif_cfg_changed(struct snd_soc_component *component, · 1759 unmodified lines
17601760 if (bclk != (val & ARIZONA_AIF1_BCLK_FREQ_MASK))
17611761 return true;
17621762
1763− val = snd_soc_component_read(component, base + ARIZONA_AIF_TX_BCLK_RATE);
1764− if (lrclk != (val & ARIZONA_AIF1TX_BCPF_MASK))
1763+ val = snd_soc_component_read(component, base + ARIZONA_AIF_RX_BCLK_RATE);
1764+ if (lrclk != (val & ARIZONA_AIF1RX_BCPF_MASK))
17651765 return true;
17661766
17671767 val = snd_soc_component_read(component, base + ARIZONA_AIF_FRAME_CTRL_1);
sound/soc/codecs/cs47l92.c+7−1
@@ -119,7 +119,13 @@ static int cs47l92_put_demux(struct snd_kcontrol *kcontrol, · 118 unmodified lines
119119 end:
120120 snd_soc_dapm_mutex_unlock(dapm);
121121
122− return snd_soc_dapm_mux_update_power(dapm, kcontrol, mux, e, NULL);
122+ ret = snd_soc_dapm_mux_update_power(dapm, kcontrol, mux, e, NULL);
123+ if (ret < 0) {
124+ dev_err(madera->dev, "Failed to update demux power state: %d\n", ret);
125+ return ret;
126+ }
127+
128+ return change;
123129 }
124130
125131 static SOC_ENUM_SINGLE_DECL(cs47l92_outdemux_enum,
sound/soc/codecs/max98396.c+6−4
@@ -342,12 +342,15 @@ static int max98396_dai_set_fmt(struct snd_soc_dai *codec_dai, unsigned int fmt) · 341 unmodified lines
342342 {
343343 struct snd_soc_component *component = codec_dai->component;
344344 struct max98396_priv *max98396 = snd_soc_component_get_drvdata(component);
345− unsigned int format = 0;
345+ unsigned int format_mask, format = 0;
346346 unsigned int bclk_pol = 0;
347347 int ret, status;
348348 int reg;
349349 bool update = false;
350350
351+ format_mask = MAX98396_PCM_MODE_CFG_FORMAT_MASK |
352+ MAX98396_PCM_MODE_CFG_LRCLKEDGE;
353+
351354 dev_dbg(component->dev, "%s: fmt 0x%08X\n", __func__, fmt);
352355
353356 switch (fmt & SND_SOC_DAIFMT_INV_MASK) {
@@ -395,7 +398,7 @@ static int max98396_dai_set_fmt(struct snd_soc_dai *codec_dai, unsigned int fmt) · 41 unmodified lines
395398 ret = regmap_read(max98396->regmap, MAX98396_R2041_PCM_MODE_CFG, &reg);
396399 if (ret < 0)
397400 return -EINVAL;
398− if (format != (reg & MAX98396_PCM_BCLKEDGE_BSEL_MASK)) {
401+ if (format != (reg & format_mask)) {
399402 update = true;
400403 } else {
401404 ret = regmap_read(max98396->regmap,
@@ -412,8 +415,7 @@ static int max98396_dai_set_fmt(struct snd_soc_dai *codec_dai, unsigned int fmt) · 10 unmodified lines
412415
413416 regmap_update_bits(max98396->regmap,
414417 MAX98396_R2041_PCM_MODE_CFG,
415− MAX98396_PCM_BCLKEDGE_BSEL_MASK,
416− format);
418+ format_mask, format);
417419
418420 regmap_update_bits(max98396->regmap,
419421 MAX98396_R2042_PCM_CLK_SETUP,
sound/soc/codecs/rt5640.c+22−8
@@ -1984,7 +1984,12 @@ static int rt5640_set_bias_level(struct snd_soc_component *component, · 1983 unmodified lines
19841984 snd_soc_component_write(component, RT5640_PWR_DIG2, 0x0000);
19851985 snd_soc_component_write(component, RT5640_PWR_VOL, 0x0000);
19861986 snd_soc_component_write(component, RT5640_PWR_MIXER, 0x0000);
1987− snd_soc_component_write(component, RT5640_PWR_ANLG1, 0x0000);
1987+ if (rt5640->jd_src == RT5640_JD_SRC_HDA_HEADER)
1988+ snd_soc_component_write(component, RT5640_PWR_ANLG1,
1989+ 0x0018);
1990+ else
1991+ snd_soc_component_write(component, RT5640_PWR_ANLG1,
1992+ 0x0000);
19881993 snd_soc_component_write(component, RT5640_PWR_ANLG2, 0x0000);
19891994 break;
19901995
@@ -2393,9 +2398,15 @@ static void rt5640_jack_work(struct work_struct *work) · 402 unmodified lines
23932398 static irqreturn_t rt5640_irq(int irq, void *data)
23942399 {
23952400 struct rt5640_priv *rt5640 = data;
2401+ int delay = 0;
2402+
2403+ if (rt5640->jd_src == RT5640_JD_SRC_HDA_HEADER) {
2404+ cancel_delayed_work_sync(&rt5640->jack_work);
2405+ delay = 100;
2406+ }
23962407
23972408 if (rt5640->jack)
2398− queue_delayed_work(system_long_wq, &rt5640->jack_work, 0);
2409+ queue_delayed_work(system_long_wq, &rt5640->jack_work, delay);
23992410
24002411 return IRQ_HANDLED;
24012412 }
@@ -2580,6 +2591,12 @@ static void rt5640_enable_hda_jack_detect( · 178 unmodified lines
25802591
25812592 snd_soc_component_update_bits(component, RT5640_DUMMY1, 0x400, 0x0);
25822593
2594+ snd_soc_component_update_bits(component, RT5640_PWR_ANLG1,
2595+ RT5640_PWR_VREF2, RT5640_PWR_VREF2);
2596+ usleep_range(10000, 15000);
2597+ snd_soc_component_update_bits(component, RT5640_PWR_ANLG1,
2598+ RT5640_PWR_FV2, RT5640_PWR_FV2);
2599+
25832600 rt5640->jack = jack;
25842601
25852602 ret = request_irq(rt5640->irq, rt5640_irq,
@@ -2696,16 +2713,13 @@ static int rt5640_probe(struct snd_soc_component *component) · 110 unmodified lines
26962713
26972714 if (device_property_read_u32(component->dev,
26982715 "realtek,jack-detect-source", &val) == 0) {
2699− if (val <= RT5640_JD_SRC_GPIO4) {
2716+ if (val <= RT5640_JD_SRC_GPIO4)
27002717 rt5640->jd_src = val << RT5640_JD_SFT;
2701− } else if (val == RT5640_JD_SRC_HDA_HEADER) {
2718+ else if (val == RT5640_JD_SRC_HDA_HEADER)
27022719 rt5640->jd_src = RT5640_JD_SRC_HDA_HEADER;
2703− snd_soc_component_update_bits(component, RT5640_DUMMY1,
2704− 0x0300, 0x0);
2705− } else {
2720+ else
27062721 dev_warn(component->dev, "Warning: Invalid jack-detect-source value: %d, leaving jack-detect disabled\n",
27072722 val);
2708− }
27092723 }
27102724
27112725 if (!device_property_read_bool(component->dev, "realtek,jack-detect-not-inverted"))
sound/soc/codecs/sgtl5000.c+9−0
@@ -1795,6 +1795,9 @@ static int sgtl5000_i2c_remove(struct i2c_client *client) · 1794 unmodified lines
17951795 {
17961796 struct sgtl5000_priv *sgtl5000 = i2c_get_clientdata(client);
17971797
1798+ regmap_write(sgtl5000->regmap, SGTL5000_CHIP_DIG_POWER, SGTL5000_DIG_POWER_DEFAULT);
1799+ regmap_write(sgtl5000->regmap, SGTL5000_CHIP_ANA_POWER, SGTL5000_ANA_POWER_DEFAULT);
1800+
17981801 clk_disable_unprepare(sgtl5000->mclk);
17991802 regulator_bulk_disable(sgtl5000->num_supplies, sgtl5000->supplies);
18001803 regulator_bulk_free(sgtl5000->num_supplies, sgtl5000->supplies);
@@ -1802,6 +1805,11 @@ static int sgtl5000_i2c_remove(struct i2c_client *client) · 1 unmodified line
18021805 return 0;
18031806 }
18041807
1808+static void sgtl5000_i2c_shutdown(struct i2c_client *client)
1809+{
1810+ sgtl5000_i2c_remove(client);
1811+}
1812+
18051813 static const struct i2c_device_id sgtl5000_id[] = {
18061814 {"sgtl5000", 0},
18071815 {},
@@ -1822,6 +1830,7 @@ static struct i2c_driver sgtl5000_i2c_driver = { · 14 unmodified lines
18221830 },
18231831 .probe_new = sgtl5000_i2c_probe,
18241832 .remove = sgtl5000_i2c_remove,
1833+ .shutdown = sgtl5000_i2c_shutdown,
18251834 .id_table = sgtl5000_id,
18261835 };
18271836
sound/soc/codecs/sgtl5000.h+1−0
@@ -80,6 +80,7 @@ · 79 unmodified lines
8080 /*
8181 * SGTL5000_CHIP_DIG_POWER
8282 */
83+#define SGTL5000_DIG_POWER_DEFAULT 0x0000
8384 #define SGTL5000_ADC_EN 0x0040
8485 #define SGTL5000_DAC_EN 0x0020
8586 #define SGTL5000_DAP_POWERUP 0x0010
sound/soc/codecs/tas2764.c+28−18
@@ -42,10 +42,12 @@ static void tas2764_reset(struct tas2764_priv *tas2764) · 41 unmodified lines
4242 gpiod_set_value_cansleep(tas2764->reset_gpio, 0);
4343 msleep(20);
4444 gpiod_set_value_cansleep(tas2764->reset_gpio, 1);
45+ usleep_range(1000, 2000);
4546 }
4647
4748 snd_soc_component_write(tas2764->component, TAS2764_SW_RST,
4849 TAS2764_RST);
50+ usleep_range(1000, 2000);
4951 }
5052
5153 static int tas2764_set_bias_level(struct snd_soc_component *component,
@@ -107,8 +109,10 @@ static int tas2764_codec_resume(struct snd_soc_component *component) · 55 unmodified lines
107109 struct tas2764_priv *tas2764 = snd_soc_component_get_drvdata(component);
108110 int ret;
109111
110− if (tas2764->sdz_gpio)
112+ if (tas2764->sdz_gpio) {
111113 gpiod_set_value_cansleep(tas2764->sdz_gpio, 1);
114+ usleep_range(1000, 2000);
115+ }
112116
113117 ret = snd_soc_component_update_bits(component, TAS2764_PWR_CTRL,
114118 TAS2764_PWR_CTRL_MASK,
@@ -131,7 +135,8 @@ static const char * const tas2764_ASI1_src[] = { · 16 unmodified lines
131135 };
132136
133137 static SOC_ENUM_SINGLE_DECL(
134− tas2764_ASI1_src_enum, TAS2764_TDM_CFG2, 4, tas2764_ASI1_src);
138+ tas2764_ASI1_src_enum, TAS2764_TDM_CFG2, TAS2764_TDM_CFG2_SCFG_SHIFT,
139+ tas2764_ASI1_src);
135140
136141 static const struct snd_kcontrol_new tas2764_asi1_mux =
137142 SOC_DAPM_ENUM("ASI1 Source", tas2764_ASI1_src_enum);
@@ -329,20 +334,22 @@ static int tas2764_set_fmt(struct snd_soc_dai *dai, unsigned int fmt) · 191 unmodified lines
329334 {
330335 struct snd_soc_component *component = dai->component;
331336 struct tas2764_priv *tas2764 = snd_soc_component_get_drvdata(component);
332− u8 tdm_rx_start_slot = 0, asi_cfg_1 = 0;
333− int iface;
337+ u8 tdm_rx_start_slot = 0, asi_cfg_0 = 0, asi_cfg_1 = 0;
334338 int ret;
335339
336340 switch (fmt & SND_SOC_DAIFMT_INV_MASK) {
341+ case SND_SOC_DAIFMT_NB_IF:
342+ asi_cfg_0 ^= TAS2764_TDM_CFG0_FRAME_START;
343+ fallthrough;
337344 case SND_SOC_DAIFMT_NB_NF:
338345 asi_cfg_1 = TAS2764_TDM_CFG1_RX_RISING;
339346 break;
347+ case SND_SOC_DAIFMT_IB_IF:
348+ asi_cfg_0 ^= TAS2764_TDM_CFG0_FRAME_START;
349+ fallthrough;
340350 case SND_SOC_DAIFMT_IB_NF:
341351 asi_cfg_1 = TAS2764_TDM_CFG1_RX_FALLING;
342352 break;
343− default:
344− dev_err(tas2764->dev, "ASI format Inverse is not found\n");
345− return -EINVAL;
346353 }
347354
348355 ret = snd_soc_component_update_bits(component, TAS2764_TDM_CFG1,
@@ -353,13 +360,13 @@ static int tas2764_set_fmt(struct snd_soc_dai *dai, unsigned int fmt) · 4 unmodified lines
353360
354361 switch (fmt & SND_SOC_DAIFMT_FORMAT_MASK) {
355362 case SND_SOC_DAIFMT_I2S:
363+ asi_cfg_0 ^= TAS2764_TDM_CFG0_FRAME_START;
364+ fallthrough;
356365 case SND_SOC_DAIFMT_DSP_A:
357− iface = TAS2764_TDM_CFG2_SCFG_I2S;
358366 tdm_rx_start_slot = 1;
359367 break;
360368 case SND_SOC_DAIFMT_DSP_B:
361369 case SND_SOC_DAIFMT_LEFT_J:
362− iface = TAS2764_TDM_CFG2_SCFG_LEFT_J;
363370 tdm_rx_start_slot = 0;
364371 break;
365372 default:
@@ -368,14 +375,15 @@ static int tas2764_set_fmt(struct snd_soc_dai *dai, unsigned int fmt) · 2 unmodified lines
368375 return -EINVAL;
369376 }
370377
371− ret = snd_soc_component_update_bits(component, TAS2764_TDM_CFG1,
372− TAS2764_TDM_CFG1_MASK,
373− (tdm_rx_start_slot << TAS2764_TDM_CFG1_51_SHIFT));
378+ ret = snd_soc_component_update_bits(component, TAS2764_TDM_CFG0,
379+ TAS2764_TDM_CFG0_FRAME_START,
380+ asi_cfg_0);
374381 if (ret < 0)
375382 return ret;
376383
377− ret = snd_soc_component_update_bits(component, TAS2764_TDM_CFG2,
378− TAS2764_TDM_CFG2_SCFG_MASK, iface);
384+ ret = snd_soc_component_update_bits(component, TAS2764_TDM_CFG1,
385+ TAS2764_TDM_CFG1_MASK,
386+ (tdm_rx_start_slot << TAS2764_TDM_CFG1_51_SHIFT));
379387 if (ret < 0)
380388 return ret;
381389
@@ -501,8 +509,10 @@ static int tas2764_codec_probe(struct snd_soc_component *component) · 119 unmodified lines
501509
502510 tas2764->component = component;
503511
504− if (tas2764->sdz_gpio)
512+ if (tas2764->sdz_gpio) {
505513 gpiod_set_value_cansleep(tas2764->sdz_gpio, 1);
514+ usleep_range(1000, 2000);
515+ }
506516
507517 tas2764_reset(tas2764);
508518
@@ -526,12 +536,12 @@ static int tas2764_codec_probe(struct snd_soc_component *component) · 17 unmodified lines
526536 }
527537
528538 static DECLARE_TLV_DB_SCALE(tas2764_digital_tlv, 1100, 50, 0);
529−static DECLARE_TLV_DB_SCALE(tas2764_playback_volume, -10000, 50, 0);
539+static DECLARE_TLV_DB_SCALE(tas2764_playback_volume, -10050, 50, 1);
530540
531541 static const struct snd_kcontrol_new tas2764_snd_controls[] = {
532542 SOC_SINGLE_TLV("Speaker Volume", TAS2764_DVC, 0,
533543 TAS2764_DVC_MAX, 1, tas2764_playback_volume),
534− SOC_SINGLE_TLV("Amp Gain Volume", TAS2764_CHNL_0, 0, 0x14, 0,
544+ SOC_SINGLE_TLV("Amp Gain Volume", TAS2764_CHNL_0, 1, 0x14, 0,
535545 tas2764_digital_tlv),
536546 };
537547
@@ -556,7 +566,7 @@ static const struct reg_default tas2764_reg_defaults[] = { · 18 unmodified lines
556566 { TAS2764_SW_RST, 0x00 },
557567 { TAS2764_PWR_CTRL, 0x1a },
558568 { TAS2764_DVC, 0x00 },
559− { TAS2764_CHNL_0, 0x00 },
569+ { TAS2764_CHNL_0, 0x28 },
560570 { TAS2764_TDM_CFG0, 0x09 },
561571 { TAS2764_TDM_CFG1, 0x02 },
562572 { TAS2764_TDM_CFG2, 0x0a },
sound/soc/codecs/tas2764.h+2−4
@@ -47,6 +47,7 @@ · 46 unmodified lines
4747 #define TAS2764_TDM_CFG0_MASK GENMASK(3, 1)
4848 #define TAS2764_TDM_CFG0_44_1_48KHZ BIT(3)
4949 #define TAS2764_TDM_CFG0_88_2_96KHZ (BIT(3) | BIT(1))
50+#define TAS2764_TDM_CFG0_FRAME_START BIT(0)
5051
5152 /* TDM Configuration Reg1 */
5253 #define TAS2764_TDM_CFG1 TAS2764_REG(0X0, 0x09)
@@ -66,10 +67,7 @@ · 13 unmodified lines
6667 #define TAS2764_TDM_CFG2_RXS_16BITS 0x0
6768 #define TAS2764_TDM_CFG2_RXS_24BITS BIT(0)
6869 #define TAS2764_TDM_CFG2_RXS_32BITS BIT(1)
69−#define TAS2764_TDM_CFG2_SCFG_MASK GENMASK(5, 4)
70−#define TAS2764_TDM_CFG2_SCFG_I2S 0x0
71−#define TAS2764_TDM_CFG2_SCFG_LEFT_J BIT(4)
72−#define TAS2764_TDM_CFG2_SCFG_RIGHT_J BIT(5)
70+#define TAS2764_TDM_CFG2_SCFG_SHIFT 4
7371
7472 /* TDM Configuration Reg3 */
7573 #define TAS2764_TDM_CFG3 TAS2764_REG(0X0, 0x0c)
sound/soc/codecs/tlv320adcx140.c+6−7
@@ -33,7 +33,6 @@ struct adcx140_priv { · 32 unmodified lines
3333 bool micbias_vg;
3434
3535 unsigned int dai_fmt;
36− unsigned int tdm_delay;
3736 unsigned int slot_width;
3837 };
3938
@@ -792,12 +791,13 @@ static int adcx140_set_dai_tdm_slot(struct snd_soc_dai *codec_dai, · 752 unmodified lines
792791 {
793792 struct snd_soc_component *component = codec_dai->component;
794793 struct adcx140_priv *adcx140 = snd_soc_component_get_drvdata(component);
795− unsigned int lsb;
796794
797− /* TDM based on DSP mode requires slots to be adjacent */
798− lsb = __ffs(tx_mask);
799− if ((lsb + 1) != __fls(tx_mask)) {
800− dev_err(component->dev, "Invalid mask, slots must be adjacent\n");
795+ /*
796+ * The chip itself supports arbitrary masks, but the driver currently
797+ * only supports adjacent slots beginning at the first slot.
798+ */
799+ if (tx_mask != GENMASK(__fls(tx_mask), 0)) {
800+ dev_err(component->dev, "Only lower adjacent slots are supported\n");
801801 return -EINVAL;
802802 }
803803
@@ -812,7 +812,6 @@ static int adcx140_set_dai_tdm_slot(struct snd_soc_dai *codec_dai, · 8 unmodified lines
812812 return -EINVAL;
813813 }
814814
815− adcx140->tdm_delay = lsb;
816815 adcx140->slot_width = slot_width;
817816
818817 return 0;
sound/soc/codecs/wcd9335.c+11−6
@@ -342,7 +342,7 @@ struct wcd9335_codec { · 341 unmodified lines
342342 struct regulator_bulk_data supplies[WCD9335_MAX_SUPPLY];
343343
344344 unsigned int rx_port_value[WCD9335_RX_MAX];
345− unsigned int tx_port_value;
345+ unsigned int tx_port_value[WCD9335_TX_MAX];
346346 int hph_l_gain;
347347 int hph_r_gain;
348348 u32 rx_bias_count;
@@ -1334,8 +1334,13 @@ static int slim_tx_mixer_get(struct snd_kcontrol *kc, · 985 unmodified lines
13341334
13351335 struct snd_soc_dapm_context *dapm = snd_soc_dapm_kcontrol_dapm(kc);
13361336 struct wcd9335_codec *wcd = dev_get_drvdata(dapm->dev);
1337+ struct snd_soc_dapm_widget *widget = snd_soc_dapm_kcontrol_widget(kc);
1338+ struct soc_mixer_control *mixer =
1339+ (struct soc_mixer_control *)kc->private_value;
1340+ int dai_id = widget->shift;
1341+ int port_id = mixer->shift;
13371342
1338− ucontrol->value.integer.value[0] = wcd->tx_port_value;
1343+ ucontrol->value.integer.value[0] = wcd->tx_port_value[port_id] == dai_id;
13391344
13401345 return 0;
13411346 }
@@ -1358,12 +1363,12 @@ static int slim_tx_mixer_put(struct snd_kcontrol *kc, · 16 unmodified lines
13581363 case AIF2_CAP:
13591364 case AIF3_CAP:
13601365 /* only add to the list if value not set */
1361− if (enable && !(wcd->tx_port_value & BIT(port_id))) {
1362− wcd->tx_port_value |= BIT(port_id);
1366+ if (enable && wcd->tx_port_value[port_id] != dai_id) {
1367+ wcd->tx_port_value[port_id] = dai_id;
13631368 list_add_tail(&wcd->tx_chs[port_id].list,
13641369 &wcd->dai[dai_id].slim_ch_list);
1365− } else if (!enable && (wcd->tx_port_value & BIT(port_id))) {
1366− wcd->tx_port_value &= ~BIT(port_id);
1370+ } else if (!enable && wcd->tx_port_value[port_id] == dai_id) {
1371+ wcd->tx_port_value[port_id] = -1;
13671372 list_del_init(&wcd->tx_chs[port_id].list);
13681373 }
13691374 break;
sound/soc/codecs/wm5102.c+17−4
@@ -680,12 +680,17 @@ static int wm5102_out_comp_coeff_put(struct snd_kcontrol *kcontrol, · 679 unmodified lines
680680 {
681681 struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
682682 struct arizona *arizona = dev_get_drvdata(component->dev->parent);
683+ uint16_t dac_comp_coeff = get_unaligned_be16(ucontrol->value.bytes.data);
684+ int ret = 0;
683685
684686 mutex_lock(&arizona->dac_comp_lock);
685− arizona->dac_comp_coeff = get_unaligned_be16(ucontrol->value.bytes.data);
687+ if (arizona->dac_comp_coeff != dac_comp_coeff) {
688+ arizona->dac_comp_coeff = dac_comp_coeff;
689+ ret = 1;
690+ }
686691 mutex_unlock(&arizona->dac_comp_lock);
687692
688− return 0;
693+ return ret;
689694 }
690695
691696 static int wm5102_out_comp_switch_get(struct snd_kcontrol *kcontrol,
@@ -706,12 +711,20 @@ static int wm5102_out_comp_switch_put(struct snd_kcontrol *kcontrol, · 14 unmodified lines
706711 {
707712 struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
708713 struct arizona *arizona = dev_get_drvdata(component->dev->parent);
714+ struct soc_mixer_control *mc = (struct soc_mixer_control *)kcontrol->private_value;
715+ int ret = 0;
716+
717+ if (ucontrol->value.integer.value[0] > mc->max)
718+ return -EINVAL;
709719
710720 mutex_lock(&arizona->dac_comp_lock);
711− arizona->dac_comp_enabled = ucontrol->value.integer.value[0];
721+ if (arizona->dac_comp_enabled != ucontrol->value.integer.value[0]) {
722+ arizona->dac_comp_enabled = ucontrol->value.integer.value[0];
723+ ret = 1;
724+ }
712725 mutex_unlock(&arizona->dac_comp_lock);
713726
714− return 0;
727+ return ret;
715728 }
716729
717730 static const char * const wm5102_osr_text[] = {
sound/soc/codecs/wm8998.c+14−7
@@ -108,6 +108,7 @@ static int wm8998_inmux_put(struct snd_kcontrol *kcontrol, · 107 unmodified lines
108108 struct soc_enum *e = (struct soc_enum *)kcontrol->private_value;
109109 unsigned int mode_reg, mode_index;
110110 unsigned int mux, inmode, src_val, mode_val;
111+ int change, ret;
111112
112113 mux = ucontrol->value.enumerated.item[0];
113114 if (mux > 1)
@@ -137,14 +138,20 @@ static int wm8998_inmux_put(struct snd_kcontrol *kcontrol, · 23 unmodified lines
137138 snd_soc_component_update_bits(component, mode_reg,
138139 ARIZONA_IN1_MODE_MASK, mode_val);
139140
140− snd_soc_component_update_bits(component, e->reg,
141− ARIZONA_IN1L_SRC_MASK |
142− ARIZONA_IN1L_SRC_SE_MASK,
143− src_val);
141+ change = snd_soc_component_update_bits(component, e->reg,
142+ ARIZONA_IN1L_SRC_MASK |
143+ ARIZONA_IN1L_SRC_SE_MASK,
144+ src_val);
144145
145− return snd_soc_dapm_mux_update_power(dapm, kcontrol,
146− ucontrol->value.enumerated.item[0],
147− e, NULL);
146+ ret = snd_soc_dapm_mux_update_power(dapm, kcontrol,
147+ ucontrol->value.enumerated.item[0],
148+ e, NULL);
149+ if (ret < 0) {
150+ dev_err(arizona->dev, "Failed to update demux power state: %d\n", ret);
151+ return ret;
152+ }
153+
154+ return change;
148155 }
149156
150157 static const char * const wm8998_inmux_texts[] = {
sound/soc/generic/audio-graph-card2.c+3−3
@@ -90,12 +90,12 @@ links indicates connection part of CPU side (= A). · 89 unmodified lines
9090 ports@0 {
9191 (X) (A) mcpu: port@0 { mcpu0_ep: endpoint { remote-endpoint = <&mcodec0_ep>; }; };
9292 (y) port@1 { mcpu1_ep: endpoint { remote-endpoint = <&cpu1_ep>; }; };
93−(y) port@1 { mcpu2_ep: endpoint { remote-endpoint = <&cpu2_ep>; }; };
93+(y) port@2 { mcpu2_ep: endpoint { remote-endpoint = <&cpu2_ep>; }; };
9494 };
9595 ports@1 {
9696 (X) port@0 { mcodec0_ep: endpoint { remote-endpoint = <&mcpu0_ep>; }; };
97−(y) port@0 { mcodec1_ep: endpoint { remote-endpoint = <&codec1_ep>; }; };
98−(y) port@1 { mcodec2_ep: endpoint { remote-endpoint = <&codec2_ep>; }; };
97+(y) port@1 { mcodec1_ep: endpoint { remote-endpoint = <&codec1_ep>; }; };
98+(y) port@2 { mcodec2_ep: endpoint { remote-endpoint = <&codec2_ep>; }; };
9999 };
100100 };
101101 };
sound/soc/intel/boards/sof_rt5682.c+3−7
@@ -69,11 +69,10 @@ static unsigned long sof_rt5682_quirk = SOF_RT5682_MCLK_EN | · 68 unmodified lines
6969
7070 static int is_legacy_cpu;
7171
72−static struct snd_soc_jack sof_hdmi[3];
73−
7472 struct sof_hdmi_pcm {
7573 struct list_head head;
7674 struct snd_soc_dai *codec_dai;
75+ struct snd_soc_jack hdmi_jack;
7776 int device;
7877 };
7978
@@ -434,7 +433,6 @@ static int sof_card_late_probe(struct snd_soc_card *card) · 354 unmodified lines
434433 char jack_name[NAME_SIZE];
435434 struct sof_hdmi_pcm *pcm;
436435 int err;
437− int i = 0;
438436
439437 /* HDMI is not supported by SOF on Baytrail/CherryTrail */
440438 if (is_legacy_cpu || !ctx->idisp_codec)
@@ -455,17 +453,15 @@ static int sof_card_late_probe(struct snd_soc_card *card) · 14 unmodified lines
455453 snprintf(jack_name, sizeof(jack_name),
456454 "HDMI/DP, pcm=%d Jack", pcm->device);
457455 err = snd_soc_card_jack_new(card, jack_name,
458− SND_JACK_AVOUT, &sof_hdmi[i]);
456+ SND_JACK_AVOUT, &pcm->hdmi_jack);
459457
460458 if (err)
461459 return err;
462460
463461 err = hdac_hdmi_jack_init(pcm->codec_dai, pcm->device,
464− &sof_hdmi[i]);
462+ &pcm->hdmi_jack);
465463 if (err < 0)
466464 return err;
467−
468− i++;
469465 }
470466
471467 if (sof_rt5682_quirk & SOF_MAX98373_SPEAKER_AMP_PRESENT) {
sound/soc/intel/skylake/skl-nhlt.c+27−13
@@ -99,7 +99,6 @@ static void skl_get_ssp_clks(struct skl_dev *skl, struct skl_ssp_clk *ssp_clks, · 98 unmodified lines
9999 struct nhlt_fmt_cfg *fmt_cfg;
100100 struct wav_fmt_ext *wav_fmt;
101101 unsigned long rate;
102− bool present = false;
103102 int rate_index = 0;
104103 u16 channels, bps;
105104 u8 clk_src;
@@ -112,9 +111,12 @@ static void skl_get_ssp_clks(struct skl_dev *skl, struct skl_ssp_clk *ssp_clks, · 6 unmodified lines
112111 if (fmt->fmt_count == 0)
113112 return;
114113
114+ fmt_cfg = (struct nhlt_fmt_cfg *)fmt->fmt_config;
115115 for (i = 0; i < fmt->fmt_count; i++) {
116− fmt_cfg = &fmt->fmt_config[i];
117− wav_fmt = &fmt_cfg->fmt_ext;
116+ struct nhlt_fmt_cfg *saved_fmt_cfg = fmt_cfg;
117+ bool present = false;
118+
119+ wav_fmt = &saved_fmt_cfg->fmt_ext;
118120
119121 channels = wav_fmt->fmt.channels;
120122 bps = wav_fmt->fmt.bits_per_sample;
@@ -132,12 +134,18 @@ static void skl_get_ssp_clks(struct skl_dev *skl, struct skl_ssp_clk *ssp_clks, · 11 unmodified lines
132134 * derive the rate.
133135 */
134136 for (j = i; j < fmt->fmt_count; j++) {
135− fmt_cfg = &fmt->fmt_config[j];
136− wav_fmt = &fmt_cfg->fmt_ext;
137+ struct nhlt_fmt_cfg *tmp_fmt_cfg = fmt_cfg;
138+
139+ wav_fmt = &tmp_fmt_cfg->fmt_ext;
137140 if ((fs == wav_fmt->fmt.samples_per_sec) &&
138− (bps == wav_fmt->fmt.bits_per_sample))
141+ (bps == wav_fmt->fmt.bits_per_sample)) {
139142 channels = max_t(u16, channels,
140143 wav_fmt->fmt.channels);
144+ saved_fmt_cfg = tmp_fmt_cfg;
145+ }
146+ /* Move to the next nhlt_fmt_cfg */
147+ tmp_fmt_cfg = (struct nhlt_fmt_cfg *)(tmp_fmt_cfg->config.caps +
148+ tmp_fmt_cfg->config.size);
141149 }
142150
143151 rate = channels * bps * fs;
@@ -153,8 +161,11 @@ static void skl_get_ssp_clks(struct skl_dev *skl, struct skl_ssp_clk *ssp_clks, · 9 unmodified lines
153161
154162 /* Fill rate and parent for sclk/sclkfs */
155163 if (!present) {
164+ struct nhlt_fmt_cfg *first_fmt_cfg;
165+
166+ first_fmt_cfg = (struct nhlt_fmt_cfg *)fmt->fmt_config;
156167 i2s_config_ext = (struct skl_i2s_config_blob_ext *)
157− fmt->fmt_config[0].config.caps;
168+ first_fmt_cfg->config.caps;
158169
159170 /* MCLK Divider Source Select */
160171 if (is_legacy_blob(i2s_config_ext->hdr.sig)) {
@@ -168,6 +179,9 @@ static void skl_get_ssp_clks(struct skl_dev *skl, struct skl_ssp_clk *ssp_clks, · 7 unmodified lines
168179
169180 parent = skl_get_parent_clk(clk_src);
170181
182+ /* Move to the next nhlt_fmt_cfg */
183+ fmt_cfg = (struct nhlt_fmt_cfg *)(fmt_cfg->config.caps +
184+ fmt_cfg->config.size);
171185 /*
172186 * Do not copy the config data if there is no parent
173187 * clock available for this clock source select
@@ -176,9 +190,9 @@ static void skl_get_ssp_clks(struct skl_dev *skl, struct skl_ssp_clk *ssp_clks, · 2 unmodified lines
176190 continue;
177191
178192 sclk[id].rate_cfg[rate_index].rate = rate;
179− sclk[id].rate_cfg[rate_index].config = fmt_cfg;
193+ sclk[id].rate_cfg[rate_index].config = saved_fmt_cfg;
180194 sclkfs[id].rate_cfg[rate_index].rate = rate;
181− sclkfs[id].rate_cfg[rate_index].config = fmt_cfg;
195+ sclkfs[id].rate_cfg[rate_index].config = saved_fmt_cfg;
182196 sclk[id].parent_name = parent->name;
183197 sclkfs[id].parent_name = parent->name;
184198
@@ -192,13 +206,13 @@ static void skl_get_mclk(struct skl_dev *skl, struct skl_ssp_clk *mclk, · 7 unmodified lines
192206 {
193207 struct skl_i2s_config_blob_ext *i2s_config_ext;
194208 struct skl_i2s_config_blob_legacy *i2s_config;
195− struct nhlt_specific_cfg *fmt_cfg;
209+ struct nhlt_fmt_cfg *fmt_cfg;
196210 struct skl_clk_parent_src *parent;
197211 u32 clkdiv, div_ratio;
198212 u8 clk_src;
199213
200− fmt_cfg = &fmt->fmt_config[0].config;
201− i2s_config_ext = (struct skl_i2s_config_blob_ext *)fmt_cfg->caps;
214+ fmt_cfg = (struct nhlt_fmt_cfg *)fmt->fmt_config;
215+ i2s_config_ext = (struct skl_i2s_config_blob_ext *)fmt_cfg->config.caps;
202216
203217 /* MCLK Divider Source Select and divider */
204218 if (is_legacy_blob(i2s_config_ext->hdr.sig)) {
@@ -227,7 +241,7 @@ static void skl_get_mclk(struct skl_dev *skl, struct skl_ssp_clk *mclk, · 22 unmodified lines
227241 return;
228242
229243 mclk[id].rate_cfg[0].rate = parent->rate/div_ratio;
230− mclk[id].rate_cfg[0].config = &fmt->fmt_config[0];
244+ mclk[id].rate_cfg[0].config = fmt_cfg;
231245 mclk[id].parent_name = parent->name;
232246 }
233247
sound/soc/qcom/qdsp6/q6apm.c+1−0
@@ -75,6 +75,7 @@ static struct audioreach_graph *q6apm_get_audioreach_graph(struct q6apm *apm, ui · 74 unmodified lines
7575 id = idr_alloc(&apm->graph_idr, graph, graph_id, graph_id + 1, GFP_KERNEL);
7676 if (id < 0) {
7777 dev_err(apm->dev, "Unable to allocate graph id (%d)\n", graph_id);
78+ kfree(graph->graph);
7879 kfree(graph);
7980 mutex_unlock(&apm->lock);
8081 return ERR_PTR(id);
sound/soc/ti/omap-mcbsp-priv.h+0−2
@@ -316,8 +316,6 @@ static inline int omap_mcbsp_read(struct omap_mcbsp *mcbsp, u16 reg, · 315 unmodified lines
316316
317317 /* Sidetone specific API */
318318 int omap_mcbsp_st_init(struct platform_device *pdev);
319−void omap_mcbsp_st_cleanup(struct platform_device *pdev);
320−
321319 int omap_mcbsp_st_start(struct omap_mcbsp *mcbsp);
322320 int omap_mcbsp_st_stop(struct omap_mcbsp *mcbsp);
323321
sound/soc/ti/omap-mcbsp-st.c+2−12
@@ -347,7 +347,7 @@ int omap_mcbsp_st_init(struct platform_device *pdev) · 346 unmodified lines
347347 if (!st_data)
348348 return -ENOMEM;
349349
350− st_data->mcbsp_iclk = clk_get(mcbsp->dev, "ick");
350+ st_data->mcbsp_iclk = devm_clk_get(mcbsp->dev, "ick");
351351 if (IS_ERR(st_data->mcbsp_iclk)) {
352352 dev_warn(mcbsp->dev,
353353 "Failed to get ick, sidetone might be broken\n");
@@ -359,7 +359,7 @@ int omap_mcbsp_st_init(struct platform_device *pdev) · 5 unmodified lines
359359 if (!st_data->io_base_st)
360360 return -ENOMEM;
361361
362− ret = sysfs_create_group(&mcbsp->dev->kobj, &sidetone_attr_group);
362+ ret = devm_device_add_group(mcbsp->dev, &sidetone_attr_group);
363363 if (ret)
364364 return ret;
365365
@@ -368,16 +368,6 @@ int omap_mcbsp_st_init(struct platform_device *pdev) · 2 unmodified lines
368368 return 0;
369369 }
370370
371−void omap_mcbsp_st_cleanup(struct platform_device *pdev)
372−{
373− struct omap_mcbsp *mcbsp = platform_get_drvdata(pdev);
374−
375− if (mcbsp->st_data) {
376− sysfs_remove_group(&mcbsp->dev->kobj, &sidetone_attr_group);
377− clk_put(mcbsp->st_data->mcbsp_iclk);
378− }
379−}
380−
381371 static int omap_mcbsp_st_info_volsw(struct snd_kcontrol *kcontrol,
382372 struct snd_ctl_elem_info *uinfo)
383373 {
sound/soc/ti/omap-mcbsp.c+2−17
@@ -702,8 +702,7 @@ static int omap_mcbsp_init(struct platform_device *pdev) · 701 unmodified lines
702702 mcbsp->max_tx_thres = max_thres(mcbsp) - 0x10;
703703 mcbsp->max_rx_thres = max_thres(mcbsp) - 0x10;
704704
705− ret = sysfs_create_group(&mcbsp->dev->kobj,
706− &additional_attr_group);
705+ ret = devm_device_add_group(mcbsp->dev, &additional_attr_group);
707706 if (ret) {
708707 dev_err(mcbsp->dev,
709708 "Unable to create additional controls\n");
@@ -711,16 +710,7 @@ static int omap_mcbsp_init(struct platform_device *pdev) · 1 unmodified line
711710 }
712711 }
713712
714− ret = omap_mcbsp_st_init(pdev);
715− if (ret)
716− goto err_st;
717−
718− return 0;
719−
720−err_st:
721− if (mcbsp->pdata->buffer_size)
722− sysfs_remove_group(&mcbsp->dev->kobj, &additional_attr_group);
723− return ret;
713+ return omap_mcbsp_st_init(pdev);
724714 }
725715
726716 /*
@@ -1431,11 +1421,6 @@ static int asoc_mcbsp_remove(struct platform_device *pdev) · 704 unmodified lines
14311421 if (cpu_latency_qos_request_active(&mcbsp->pm_qos_req))
14321422 cpu_latency_qos_remove_request(&mcbsp->pm_qos_req);
14331423
1434− if (mcbsp->pdata->buffer_size)
1435− sysfs_remove_group(&mcbsp->dev->kobj, &additional_attr_group);
1436−
1437− omap_mcbsp_st_cleanup(pdev);
1438−
14391424 return 0;
14401425 }
14411426