Skip to content

Commit a032ff0

Browse files
committed
Merge branch 'for-linus' into for-next
Taking the 5.5 devel branch back into the main devel branch. A USB-audio fix needs to be adjusted to adapt the changes that have been formerly applied for stop_sync. Signed-off-by: Takashi Iwai <tiwai@suse.de>
2 parents df4654b + 92adc96 commit a032ff0

30 files changed

Lines changed: 223 additions & 114 deletions

‎include/sound/soc.h‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1150,6 +1150,7 @@ struct snd_soc_pcm_runtime {
11501150
unsigned int num_codecs;
11511151

11521152
struct delayed_work delayed_work;
1153+
void (*close_delayed_work_func)(struct snd_soc_pcm_runtime *rtd);
11531154
#ifdef CONFIG_DEBUG_FS
11541155
struct dentry *debugfs_dpcm_root;
11551156
#endif

‎sound/core/pcm_native.c‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -740,6 +740,10 @@ static int snd_pcm_hw_params(struct snd_pcm_substream *substream,
740740
while (runtime->boundary * 2 <= LONG_MAX - runtime->buffer_size)
741741
runtime->boundary *= 2;
742742

743+
/* clear the buffer for avoiding possible kernel info leaks */
744+
if (runtime->dma_area && !substream->ops->copy_user)
745+
memset(runtime->dma_area, 0, runtime->dma_bytes);
746+
743747
snd_pcm_timer_resolution_change(substream);
744748
snd_pcm_set_state(substream, SNDRV_PCM_STATE_SETUP);
745749

‎sound/hda/hdac_stream.c‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -120,10 +120,8 @@ void snd_hdac_stream_clear(struct hdac_stream *azx_dev)
120120
snd_hdac_stream_updateb(azx_dev, SD_CTL,
121121
SD_CTL_DMA_START | SD_INT_MASK, 0);
122122
snd_hdac_stream_writeb(azx_dev, SD_STS, SD_INT_MASK); /* to be sure */
123-
if (azx_dev->stripe) {
123+
if (azx_dev->stripe)
124124
snd_hdac_stream_updateb(azx_dev, SD_CTL_3B, SD_CTL_STRIPE_MASK, 0);
125-
azx_dev->stripe = 0;
126-
}
127125
azx_dev->running = false;
128126
}
129127
EXPORT_SYMBOL_GPL(snd_hdac_stream_clear);

‎sound/pci/hda/hda_controller.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -835,7 +835,7 @@ static int azx_rirb_get_response(struct hdac_bus *bus, unsigned int addr,
835835
return -EAGAIN; /* give a chance to retry */
836836
}
837837

838-
dev_WARN(chip->card->dev,
838+
dev_err(chip->card->dev,
839839
"azx_get_response timeout, switching to single_cmd mode: last cmd=0x%08x\n",
840840
bus->last_cmd[addr]);
841841
chip->single_cmd = 1;

‎sound/pci/hda/patch_ca0132.c‎

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1809,13 +1809,14 @@ struct scp_msg {
18091809

18101810
static void dspio_clear_response_queue(struct hda_codec *codec)
18111811
{
1812+
unsigned long timeout = jiffies + msecs_to_jiffies(1000);
18121813
unsigned int dummy = 0;
1813-
int status = -1;
1814+
int status;
18141815

18151816
/* clear all from the response queue */
18161817
do {
18171818
status = dspio_read(codec, &dummy);
1818-
} while (status == 0);
1819+
} while (status == 0 && time_before(jiffies, timeout));
18191820
}
18201821

18211822
static int dspio_get_response_data(struct hda_codec *codec)
@@ -7588,12 +7589,14 @@ static void ca0132_process_dsp_response(struct hda_codec *codec,
75887589
struct ca0132_spec *spec = codec->spec;
75897590

75907591
codec_dbg(codec, "ca0132_process_dsp_response\n");
7592+
snd_hda_power_up_pm(codec);
75917593
if (spec->wait_scp) {
75927594
if (dspio_get_response_data(codec) >= 0)
75937595
spec->wait_scp = 0;
75947596
}
75957597

75967598
dspio_clear_response_queue(codec);
7599+
snd_hda_power_down_pm(codec);
75977600
}
75987601

75997602
static void hp_callback(struct hda_codec *codec, struct hda_jack_callback *cb)
@@ -7604,11 +7607,10 @@ static void hp_callback(struct hda_codec *codec, struct hda_jack_callback *cb)
76047607
/* Delay enabling the HP amp, to let the mic-detection
76057608
* state machine run.
76067609
*/
7607-
cancel_delayed_work(&spec->unsol_hp_work);
7608-
schedule_delayed_work(&spec->unsol_hp_work, msecs_to_jiffies(500));
76097610
tbl = snd_hda_jack_tbl_get(codec, cb->nid);
76107611
if (tbl)
76117612
tbl->block_report = 1;
7613+
schedule_delayed_work(&spec->unsol_hp_work, msecs_to_jiffies(500));
76127614
}
76137615

76147616
static void amic_callback(struct hda_codec *codec, struct hda_jack_callback *cb)
@@ -8454,12 +8456,25 @@ static void ca0132_reboot_notify(struct hda_codec *codec)
84548456
codec->patch_ops.free(codec);
84558457
}
84568458

8459+
#ifdef CONFIG_PM
8460+
static int ca0132_suspend(struct hda_codec *codec)
8461+
{
8462+
struct ca0132_spec *spec = codec->spec;
8463+
8464+
cancel_delayed_work_sync(&spec->unsol_hp_work);
8465+
return 0;
8466+
}
8467+
#endif
8468+
84578469
static const struct hda_codec_ops ca0132_patch_ops = {
84588470
.build_controls = ca0132_build_controls,
84598471
.build_pcms = ca0132_build_pcms,
84608472
.init = ca0132_init,
84618473
.free = ca0132_free,
84628474
.unsol_event = snd_hda_jack_unsol_event,
8475+
#ifdef CONFIG_PM
8476+
.suspend = ca0132_suspend,
8477+
#endif
84638478
.reboot_notify = ca0132_reboot_notify,
84648479
};
84658480

‎sound/pci/hda/patch_hdmi.c‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2021,6 +2021,8 @@ static int hdmi_pcm_close(struct hda_pcm_stream *hinfo,
20212021
per_cvt->assigned = 0;
20222022
hinfo->nid = 0;
20232023

2024+
azx_stream(get_azx_dev(substream))->stripe = 0;
2025+
20242026
mutex_lock(&spec->pcm_lock);
20252027
snd_hda_spdif_ctls_unassign(codec, pcm_idx);
20262028
clear_bit(pcm_idx, &spec->pcm_in_use);

‎sound/pci/hda/patch_realtek.c‎

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7643,11 +7643,6 @@ static const struct snd_hda_pin_quirk alc269_pin_fixup_tbl[] = {
76437643
{0x1a, 0x90a70130},
76447644
{0x1b, 0x90170110},
76457645
{0x21, 0x03211020}),
7646-
SND_HDA_PIN_QUIRK(0x10ec0274, 0x1028, "Dell", ALC274_FIXUP_DELL_AIO_LINEOUT_VERB,
7647-
{0x12, 0xb7a60130},
7648-
{0x13, 0xb8a61140},
7649-
{0x16, 0x90170110},
7650-
{0x21, 0x04211020}),
76517646
SND_HDA_PIN_QUIRK(0x10ec0280, 0x103c, "HP", ALC280_FIXUP_HP_GPIO4,
76527647
{0x12, 0x90a60130},
76537648
{0x14, 0x90170110},
@@ -7841,6 +7836,9 @@ static const struct snd_hda_pin_quirk alc269_fallback_pin_fixup_tbl[] = {
78417836
SND_HDA_PIN_QUIRK(0x10ec0236, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
78427837
{0x19, 0x40000000},
78437838
{0x1a, 0x40000000}),
7839+
SND_HDA_PIN_QUIRK(0x10ec0274, 0x1028, "Dell", ALC274_FIXUP_DELL_AIO_LINEOUT_VERB,
7840+
{0x19, 0x40000000},
7841+
{0x1a, 0x40000000}),
78447842
{}
78457843
};
78467844

‎sound/soc/amd/acp-da7219-max98357a.c‎

Lines changed: 14 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -96,14 +96,19 @@ static int cz_da7219_init(struct snd_soc_pcm_runtime *rtd)
9696
return 0;
9797
}
9898

99-
static int da7219_clk_enable(struct snd_pcm_substream *substream,
100-
int wclk_rate, int bclk_rate)
99+
static int da7219_clk_enable(struct snd_pcm_substream *substream)
101100
{
102101
int ret = 0;
103102
struct snd_soc_pcm_runtime *rtd = substream->private_data;
104103

105-
clk_set_rate(da7219_dai_wclk, wclk_rate);
106-
clk_set_rate(da7219_dai_bclk, bclk_rate);
104+
/*
105+
* Set wclk to 48000 because the rate constraint of this driver is
106+
* 48000. ADAU7002 spec: "The ADAU7002 requires a BCLK rate that is
107+
* minimum of 64x the LRCLK sample rate." DA7219 is the only clk
108+
* source so for all codecs we have to limit bclk to 64X lrclk.
109+
*/
110+
clk_set_rate(da7219_dai_wclk, 48000);
111+
clk_set_rate(da7219_dai_bclk, 48000 * 64);
107112
ret = clk_prepare_enable(da7219_dai_bclk);
108113
if (ret < 0) {
109114
dev_err(rtd->dev, "can't enable master clock %d\n", ret);
@@ -156,7 +161,7 @@ static int cz_da7219_play_startup(struct snd_pcm_substream *substream)
156161
&constraints_rates);
157162

158163
machine->play_i2s_instance = I2S_SP_INSTANCE;
159-
return 0;
164+
return da7219_clk_enable(substream);
160165
}
161166

162167
static int cz_da7219_cap_startup(struct snd_pcm_substream *substream)
@@ -178,7 +183,7 @@ static int cz_da7219_cap_startup(struct snd_pcm_substream *substream)
178183

179184
machine->cap_i2s_instance = I2S_SP_INSTANCE;
180185
machine->capture_channel = CAP_CHANNEL1;
181-
return 0;
186+
return da7219_clk_enable(substream);
182187
}
183188

184189
static int cz_max_startup(struct snd_pcm_substream *substream)
@@ -199,7 +204,7 @@ static int cz_max_startup(struct snd_pcm_substream *substream)
199204
&constraints_rates);
200205

201206
machine->play_i2s_instance = I2S_BT_INSTANCE;
202-
return 0;
207+
return da7219_clk_enable(substream);
203208
}
204209

205210
static int cz_dmic0_startup(struct snd_pcm_substream *substream)
@@ -220,7 +225,7 @@ static int cz_dmic0_startup(struct snd_pcm_substream *substream)
220225
&constraints_rates);
221226

222227
machine->cap_i2s_instance = I2S_BT_INSTANCE;
223-
return 0;
228+
return da7219_clk_enable(substream);
224229
}
225230

226231
static int cz_dmic1_startup(struct snd_pcm_substream *substream)
@@ -242,25 +247,7 @@ static int cz_dmic1_startup(struct snd_pcm_substream *substream)
242247

243248
machine->cap_i2s_instance = I2S_SP_INSTANCE;
244249
machine->capture_channel = CAP_CHANNEL0;
245-
return 0;
246-
}
247-
248-
static int cz_da7219_params(struct snd_pcm_substream *substream,
249-
struct snd_pcm_hw_params *params)
250-
{
251-
int wclk, bclk;
252-
253-
wclk = params_rate(params);
254-
bclk = wclk * params_channels(params) *
255-
snd_pcm_format_width(params_format(params));
256-
/* ADAU7002 spec: "The ADAU7002 requires a BCLK rate
257-
* that is minimum of 64x the LRCLK sample rate."
258-
* DA7219 is the only clk source so for all codecs
259-
* we have to limit bclk to 64X lrclk.
260-
*/
261-
if (bclk < (wclk * 64))
262-
bclk = wclk * 64;
263-
return da7219_clk_enable(substream, wclk, bclk);
250+
return da7219_clk_enable(substream);
264251
}
265252

266253
static void cz_da7219_shutdown(struct snd_pcm_substream *substream)
@@ -271,31 +258,26 @@ static void cz_da7219_shutdown(struct snd_pcm_substream *substream)
271258
static const struct snd_soc_ops cz_da7219_play_ops = {
272259
.startup = cz_da7219_play_startup,
273260
.shutdown = cz_da7219_shutdown,
274-
.hw_params = cz_da7219_params,
275261
};
276262

277263
static const struct snd_soc_ops cz_da7219_cap_ops = {
278264
.startup = cz_da7219_cap_startup,
279265
.shutdown = cz_da7219_shutdown,
280-
.hw_params = cz_da7219_params,
281266
};
282267

283268
static const struct snd_soc_ops cz_max_play_ops = {
284269
.startup = cz_max_startup,
285270
.shutdown = cz_da7219_shutdown,
286-
.hw_params = cz_da7219_params,
287271
};
288272

289273
static const struct snd_soc_ops cz_dmic0_cap_ops = {
290274
.startup = cz_dmic0_startup,
291275
.shutdown = cz_da7219_shutdown,
292-
.hw_params = cz_da7219_params,
293276
};
294277

295278
static const struct snd_soc_ops cz_dmic1_cap_ops = {
296279
.startup = cz_dmic1_startup,
297280
.shutdown = cz_da7219_shutdown,
298-
.hw_params = cz_da7219_params,
299281
};
300282

301283
SND_SOC_DAILINK_DEF(designware1,

‎sound/soc/codecs/max98090.c‎

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2103,26 +2103,40 @@ static void max98090_pll_det_disable_work(struct work_struct *work)
21032103
M98090_IULK_MASK, 0);
21042104
}
21052105

2106-
static void max98090_pll_work(struct work_struct *work)
2106+
static void max98090_pll_work(struct max98090_priv *max98090)
21072107
{
2108-
struct max98090_priv *max98090 =
2109-
container_of(work, struct max98090_priv, pll_work);
21102108
struct snd_soc_component *component = max98090->component;
2109+
unsigned int pll;
2110+
int i;
21112111

21122112
if (!snd_soc_component_is_active(component))
21132113
return;
21142114

21152115
dev_info_ratelimited(component->dev, "PLL unlocked\n");
21162116

2117+
/*
2118+
* As the datasheet suggested, the maximum PLL lock time should be
2119+
* 7 msec. The workaround resets the codec softly by toggling SHDN
2120+
* off and on if PLL failed to lock for 10 msec. Notably, there is
2121+
* no suggested hold time for SHDN off.
2122+
*/
2123+
21172124
/* Toggle shutdown OFF then ON */
21182125
snd_soc_component_update_bits(component, M98090_REG_DEVICE_SHUTDOWN,
21192126
M98090_SHDNN_MASK, 0);
2120-
msleep(10);
21212127
snd_soc_component_update_bits(component, M98090_REG_DEVICE_SHUTDOWN,
21222128
M98090_SHDNN_MASK, M98090_SHDNN_MASK);
21232129

2124-
/* Give PLL time to lock */
2125-
msleep(10);
2130+
for (i = 0; i < 10; ++i) {
2131+
/* Give PLL time to lock */
2132+
usleep_range(1000, 1200);
2133+
2134+
/* Check lock status */
2135+
pll = snd_soc_component_read32(
2136+
component, M98090_REG_DEVICE_STATUS);
2137+
if (!(pll & M98090_ULK_MASK))
2138+
break;
2139+
}
21262140
}
21272141

21282142
static void max98090_jack_work(struct work_struct *work)
@@ -2259,7 +2273,7 @@ static irqreturn_t max98090_interrupt(int irq, void *data)
22592273

22602274
if (active & M98090_ULK_MASK) {
22612275
dev_dbg(component->dev, "M98090_ULK_MASK\n");
2262-
schedule_work(&max98090->pll_work);
2276+
max98090_pll_work(max98090);
22632277
}
22642278

22652279
if (active & M98090_JDET_MASK) {
@@ -2422,7 +2436,6 @@ static int max98090_probe(struct snd_soc_component *component)
24222436
max98090_pll_det_enable_work);
24232437
INIT_WORK(&max98090->pll_det_disable_work,
24242438
max98090_pll_det_disable_work);
2425-
INIT_WORK(&max98090->pll_work, max98090_pll_work);
24262439

24272440
/* Enable jack detection */
24282441
snd_soc_component_write(component, M98090_REG_JACK_DETECT,
@@ -2475,7 +2488,6 @@ static void max98090_remove(struct snd_soc_component *component)
24752488
cancel_delayed_work_sync(&max98090->jack_work);
24762489
cancel_delayed_work_sync(&max98090->pll_det_enable_work);
24772490
cancel_work_sync(&max98090->pll_det_disable_work);
2478-
cancel_work_sync(&max98090->pll_work);
24792491
max98090->component = NULL;
24802492
}
24812493

‎sound/soc/codecs/max98090.h‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1530,7 +1530,6 @@ struct max98090_priv {
15301530
struct delayed_work jack_work;
15311531
struct delayed_work pll_det_enable_work;
15321532
struct work_struct pll_det_disable_work;
1533-
struct work_struct pll_work;
15341533
struct snd_soc_jack *jack;
15351534
unsigned int dai_fmt;
15361535
int tdm_slots;

0 commit comments

Comments
 (0)