Skip to content

Commit a4bd935

Browse files
committed
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.
2 parents c5e58c4 + fc976f5 commit a4bd935

File tree

21 files changed

+168
-120
lines changed

21 files changed

+168
-120
lines changed

Documentation/devicetree/bindings/sound/qcom,lpass-cpu.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,12 @@ properties:
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:
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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ AC97
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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1760,8 +1760,8 @@ static bool arizona_aif_cfg_changed(struct snd_soc_component *component,
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

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,13 @@ static int cs47l92_put_demux(struct snd_kcontrol *kcontrol,
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

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -342,12 +342,15 @@ static int max98396_dai_set_fmt(struct snd_soc_dai *codec_dai, unsigned int fmt)
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)
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)
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

Lines changed: 22 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1984,7 +1984,12 @@ static int rt5640_set_bias_level(struct snd_soc_component *component,
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)
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(
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)
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

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1795,13 +1795,21 @@ static int sgtl5000_i2c_remove(struct i2c_client *client)
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);
18011804

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 = {
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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@
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

Lines changed: 28 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,12 @@ static void tas2764_reset(struct tas2764_priv *tas2764)
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)
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[] = {
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)
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)
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)
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)
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)
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[] = {
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

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@
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 @@
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)

0 commit comments

Comments
 (0)