Skip to content

Commit 7c497d7

Browse files
committed
Merge tag 'asoc-fix-v5.5-rc2' of https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound into for-linus
ASoC: Fixes for v5.5 A collection of fixes since the merge window, mostly driver specific but there's a few in the core that clean up fallout from the refactorings done in the last cycle.
2 parents 475feec + 556672d commit 7c497d7

File tree

19 files changed

+158
-97
lines changed

19 files changed

+158
-97
lines changed

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/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;

sound/soc/codecs/rt5677-spi.h

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,25 @@
99
#ifndef __RT5677_SPI_H__
1010
#define __RT5677_SPI_H__
1111

12+
#if IS_ENABLED(CONFIG_SND_SOC_RT5677_SPI)
1213
int rt5677_spi_read(u32 addr, void *rxbuf, size_t len);
1314
int rt5677_spi_write(u32 addr, const void *txbuf, size_t len);
1415
int rt5677_spi_write_firmware(u32 addr, const struct firmware *fw);
1516
void rt5677_spi_hotword_detected(void);
17+
#else
18+
static inline int rt5677_spi_read(u32 addr, void *rxbuf, size_t len)
19+
{
20+
return -EINVAL;
21+
}
22+
static inline int rt5677_spi_write(u32 addr, const void *txbuf, size_t len)
23+
{
24+
return -EINVAL;
25+
}
26+
static inline int rt5677_spi_write_firmware(u32 addr, const struct firmware *fw)
27+
{
28+
return -EINVAL;
29+
}
30+
static inline void rt5677_spi_hotword_detected(void){}
31+
#endif
1632

1733
#endif /* __RT5677_SPI_H__ */

sound/soc/codecs/rt5682.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ struct rt5682_priv {
7373
static const struct reg_sequence patch_list[] = {
7474
{RT5682_HP_IMP_SENS_CTRL_19, 0x1000},
7575
{RT5682_DAC_ADC_DIG_VOL1, 0xa020},
76+
{RT5682_I2C_CTRL, 0x000f},
7677
};
7778

7879
static const struct reg_default rt5682_reg[] = {
@@ -2474,6 +2475,7 @@ static void rt5682_calibrate(struct rt5682_priv *rt5682)
24742475
mutex_lock(&rt5682->calibrate_mutex);
24752476

24762477
rt5682_reset(rt5682->regmap);
2478+
regmap_write(rt5682->regmap, RT5682_I2C_CTRL, 0x000f);
24772479
regmap_write(rt5682->regmap, RT5682_PWR_ANLG_1, 0xa2af);
24782480
usleep_range(15000, 20000);
24792481
regmap_write(rt5682->regmap, RT5682_PWR_ANLG_1, 0xf2af);

sound/soc/codecs/wm8904.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1806,6 +1806,12 @@ static int wm8904_set_sysclk(struct snd_soc_dai *dai, int clk_id,
18061806

18071807
switch (clk_id) {
18081808
case WM8904_CLK_AUTO:
1809+
/* We don't have any rate constraints, so just ignore the
1810+
* request to disable constraining.
1811+
*/
1812+
if (!freq)
1813+
return 0;
1814+
18091815
mclk_freq = clk_get_rate(priv->mclk);
18101816
/* enable FLL if a different sysclk is desired */
18111817
if (mclk_freq != freq) {

sound/soc/codecs/wm8962.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2788,7 +2788,7 @@ static int fll_factors(struct _fll_div *fll_div, unsigned int Fref,
27882788

27892789
if (target % Fref == 0) {
27902790
fll_div->theta = 0;
2791-
fll_div->lambda = 0;
2791+
fll_div->lambda = 1;
27922792
} else {
27932793
gcd_fll = gcd(target, fratio * Fref);
27942794

@@ -2858,7 +2858,7 @@ static int wm8962_set_fll(struct snd_soc_component *component, int fll_id, int s
28582858
return -EINVAL;
28592859
}
28602860

2861-
if (fll_div.theta || fll_div.lambda)
2861+
if (fll_div.theta)
28622862
fll1 |= WM8962_FLL_FRAC;
28632863

28642864
/* Stop the FLL while we reconfigure */

sound/soc/generic/simple-card.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -371,6 +371,7 @@ static int simple_for_each_link(struct asoc_simple_priv *priv,
371371
do {
372372
struct asoc_simple_data adata;
373373
struct device_node *codec;
374+
struct device_node *plat;
374375
struct device_node *np;
375376
int num = of_get_child_count(node);
376377

@@ -381,6 +382,9 @@ static int simple_for_each_link(struct asoc_simple_priv *priv,
381382
ret = -ENODEV;
382383
goto error;
383384
}
385+
/* get platform */
386+
plat = of_get_child_by_name(node, is_top ?
387+
PREFIX "plat" : "plat");
384388

385389
/* get convert-xxx property */
386390
memset(&adata, 0, sizeof(adata));
@@ -389,6 +393,8 @@ static int simple_for_each_link(struct asoc_simple_priv *priv,
389393

390394
/* loop for all CPU/Codec node */
391395
for_each_child_of_node(node, np) {
396+
if (plat == np)
397+
continue;
392398
/*
393399
* It is DPCM
394400
* if it has many CPUs,

sound/soc/intel/atom/sst/sst.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
#include <linux/module.h>
1515
#include <linux/fs.h>
1616
#include <linux/interrupt.h>
17+
#include <linux/io.h>
1718
#include <linux/firmware.h>
1819
#include <linux/pm_runtime.h>
1920
#include <linux/pm_qos.h>

0 commit comments

Comments
 (0)