Skip to content

Commit 7590e37

Browse files
committed
Merge tag 'asoc-v4.16-5' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound
Pull more ASoC updates from Mark Brown: "With the merge window having been delayed for another week here's another batch of updates that came in during that week. There's a few important fixes in here, mainly a fix for I/O on a number of devices caused by some of the component rework and a fix for a potential issue if more than one component in a link provides compressed operations. The I/O fixes are particularly important as the problem causes a power regression on a number of OMAP platforms" * tag 'asoc-v4.16-5' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound: (22 commits) ASoC: stm32: add of dependency for stm32 drivers ASoC: mt8173-rt5650: fix child-node lookup ASoC: dapm: fix debugfs read using path->connected ASoC: compress: Fixup error messages ASoC: compress: Remove some extraneous blank lines ASoC: compress: Correct handling of copy callback ASoC: Intel: kbl: Enable mclk and ssp sclk early ASoC: Intel: Skylake: Add extended I2S config blob support in Clock driver ASoC: Intel: Skylake: Add ssp clock driver ASoC: Fix twl4030 and 6040 regression by adding back read and write ASoC: sun8i-codec: Add ADC support for a33 ASoC: rockchip: Use dummy_dai for rt5514 dsp dailink ASoC: soc-pcm: rename .pmdown_time to .use_pmdown_time for Component ASoC: ak4613: call dummy write for PW_MGMT1/3 when Playback ASoC: soc-pcm: don't call flush_delayed_work() many times in soc_pcm_private_free() ASoC: soc-core: snd_soc_rtdcom_lookup() cares component driver name ASoC: sam9x5_wm8731: Drop 'ASoC' prefix from error messages ASoC: sam9g20_wm8731: use dev_*() logging functions ASoC: max98373 Changed SPDX header in C++ comments style ASoC: dmic: Fix check of return value from read of 'num-channels' ...
2 parents 7e6127c + 3d0a352 commit 7590e37

29 files changed

Lines changed: 919 additions & 107 deletions

‎include/sound/soc.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -841,7 +841,7 @@ struct snd_soc_component_driver {
841841
/* bits */
842842
unsigned int idle_bias_on:1;
843843
unsigned int suspend_bias_off:1;
844-
unsigned int pmdown_time:1; /* care pmdown_time at stop */
844+
unsigned int use_pmdown_time:1; /* care pmdown_time at stop */
845845
unsigned int endianness:1;
846846
unsigned int non_legacy_dai_naming:1;
847847
};

‎sound/soc/atmel/sam9g20_wm8731.c‎

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -110,16 +110,15 @@ static const struct snd_soc_dapm_route intercon[] = {
110110
static int at91sam9g20ek_wm8731_init(struct snd_soc_pcm_runtime *rtd)
111111
{
112112
struct snd_soc_dai *codec_dai = rtd->codec_dai;
113+
struct device *dev = rtd->dev;
113114
int ret;
114115

115-
printk(KERN_DEBUG
116-
"at91sam9g20ek_wm8731 "
117-
": at91sam9g20ek_wm8731_init() called\n");
116+
dev_dbg(dev, "%s called\n", __func__);
118117

119118
ret = snd_soc_dai_set_sysclk(codec_dai, WM8731_SYSCLK_MCLK,
120-
MCLK_RATE, SND_SOC_CLOCK_IN);
119+
MCLK_RATE, SND_SOC_CLOCK_IN);
121120
if (ret < 0) {
122-
printk(KERN_ERR "Failed to set WM8731 SYSCLK: %d\n", ret);
121+
dev_err(dev, "Failed to set WM8731 SYSCLK: %d\n", ret);
123122
return ret;
124123
}
125124

@@ -179,21 +178,21 @@ static int at91sam9g20ek_audio_probe(struct platform_device *pdev)
179178
*/
180179
mclk = clk_get(NULL, "pck0");
181180
if (IS_ERR(mclk)) {
182-
printk(KERN_ERR "ASoC: Failed to get MCLK\n");
181+
dev_err(&pdev->dev, "Failed to get MCLK\n");
183182
ret = PTR_ERR(mclk);
184183
goto err;
185184
}
186185

187186
pllb = clk_get(NULL, "pllb");
188187
if (IS_ERR(pllb)) {
189-
printk(KERN_ERR "ASoC: Failed to get PLLB\n");
188+
dev_err(&pdev->dev, "Failed to get PLLB\n");
190189
ret = PTR_ERR(pllb);
191190
goto err_mclk;
192191
}
193192
ret = clk_set_parent(mclk, pllb);
194193
clk_put(pllb);
195194
if (ret != 0) {
196-
printk(KERN_ERR "ASoC: Failed to set MCLK parent\n");
195+
dev_err(&pdev->dev, "Failed to set MCLK parent\n");
197196
goto err_mclk;
198197
}
199198

@@ -236,7 +235,7 @@ static int at91sam9g20ek_audio_probe(struct platform_device *pdev)
236235

237236
ret = snd_soc_register_card(card);
238237
if (ret) {
239-
printk(KERN_ERR "ASoC: snd_soc_register_card() failed\n");
238+
dev_err(&pdev->dev, "snd_soc_register_card() failed\n");
240239
}
241240

242241
return ret;

‎sound/soc/atmel/sam9x5_wm8731.c‎

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -49,13 +49,13 @@ static int sam9x5_wm8731_init(struct snd_soc_pcm_runtime *rtd)
4949
struct device *dev = rtd->dev;
5050
int ret;
5151

52-
dev_dbg(dev, "ASoC: %s called\n", __func__);
52+
dev_dbg(dev, "%s called\n", __func__);
5353

5454
/* set the codec system clock for DAC and ADC */
5555
ret = snd_soc_dai_set_sysclk(codec_dai, WM8731_SYSCLK_XTAL,
5656
MCLK_RATE, SND_SOC_CLOCK_IN);
5757
if (ret < 0) {
58-
dev_err(dev, "ASoC: Failed to set WM8731 SYSCLK: %d\n", ret);
58+
dev_err(dev, "Failed to set WM8731 SYSCLK: %d\n", ret);
5959
return ret;
6060
}
6161

@@ -146,8 +146,7 @@ static int sam9x5_wm8731_driver_probe(struct platform_device *pdev)
146146

147147
ret = atmel_ssc_set_audio(priv->ssc_id);
148148
if (ret != 0) {
149-
dev_err(&pdev->dev,
150-
"ASoC: Failed to set SSC %d for audio: %d\n",
149+
dev_err(&pdev->dev, "Failed to set SSC %d for audio: %d\n",
151150
ret, priv->ssc_id);
152151
goto out;
153152
}
@@ -157,12 +156,11 @@ static int sam9x5_wm8731_driver_probe(struct platform_device *pdev)
157156

158157
ret = snd_soc_register_card(card);
159158
if (ret) {
160-
dev_err(&pdev->dev,
161-
"ASoC: Platform device allocation failed\n");
159+
dev_err(&pdev->dev, "Platform device allocation failed\n");
162160
goto out_put_audio;
163161
}
164162

165-
dev_dbg(&pdev->dev, "ASoC: %s ok\n", __func__);
163+
dev_dbg(&pdev->dev, "%s ok\n", __func__);
166164

167165
return ret;
168166

‎sound/soc/codecs/ak4613.c‎

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
*/
1616

1717
#include <linux/clk.h>
18+
#include <linux/delay.h>
1819
#include <linux/i2c.h>
1920
#include <linux/slab.h>
2021
#include <linux/of_device.h>
@@ -95,6 +96,9 @@ struct ak4613_priv {
9596
struct mutex lock;
9697
const struct ak4613_interface *iface;
9798
struct snd_pcm_hw_constraint_list constraint;
99+
struct work_struct dummy_write_work;
100+
struct snd_soc_component *component;
101+
unsigned int rate;
98102
unsigned int sysclk;
99103

100104
unsigned int fmt;
@@ -392,6 +396,7 @@ static int ak4613_dai_hw_params(struct snd_pcm_substream *substream,
392396
default:
393397
return -EINVAL;
394398
}
399+
priv->rate = rate;
395400

396401
/*
397402
* FIXME
@@ -467,11 +472,83 @@ static int ak4613_set_bias_level(struct snd_soc_codec *codec,
467472
return 0;
468473
}
469474

475+
static void ak4613_dummy_write(struct work_struct *work)
476+
{
477+
struct ak4613_priv *priv = container_of(work,
478+
struct ak4613_priv,
479+
dummy_write_work);
480+
struct snd_soc_component *component = priv->component;
481+
unsigned int mgmt1;
482+
unsigned int mgmt3;
483+
484+
/*
485+
* PW_MGMT1 / PW_MGMT3 needs dummy write at least after 5 LR clocks
486+
*
487+
* Note
488+
*
489+
* To avoid extra delay, we want to avoid preemption here,
490+
* but we can't. Because it uses I2C access which is using IRQ
491+
* and sleep. Thus, delay might be more than 5 LR clocks
492+
* see also
493+
* ak4613_dai_trigger()
494+
*/
495+
udelay(5000000 / priv->rate);
496+
497+
snd_soc_component_read(component, PW_MGMT1, &mgmt1);
498+
snd_soc_component_read(component, PW_MGMT3, &mgmt3);
499+
500+
snd_soc_component_write(component, PW_MGMT1, mgmt1);
501+
snd_soc_component_write(component, PW_MGMT3, mgmt3);
502+
}
503+
504+
static int ak4613_dai_trigger(struct snd_pcm_substream *substream, int cmd,
505+
struct snd_soc_dai *dai)
506+
{
507+
struct snd_soc_codec *codec = dai->codec;
508+
struct ak4613_priv *priv = snd_soc_codec_get_drvdata(codec);
509+
510+
/*
511+
* FIXME
512+
*
513+
* PW_MGMT1 / PW_MGMT3 needs dummy write at least after 5 LR clocks
514+
* from Power Down Release. Otherwise, Playback volume will be 0dB.
515+
* To avoid complex multiple delay/dummy_write method from
516+
* ak4613_set_bias_level() / SND_SOC_DAPM_DAC_E("DACx", ...),
517+
* call it once here.
518+
*
519+
* But, unfortunately, we can't "write" here because here is atomic
520+
* context (It uses I2C access for writing).
521+
* Thus, use schedule_work() to switching to normal context
522+
* immediately.
523+
*
524+
* Note
525+
*
526+
* Calling ak4613_dummy_write() function might be delayed.
527+
* In such case, ak4613 volume might be temporarily 0dB when
528+
* beggining of playback.
529+
* see also
530+
* ak4613_dummy_write()
531+
*/
532+
533+
if ((cmd != SNDRV_PCM_TRIGGER_START) &&
534+
(cmd != SNDRV_PCM_TRIGGER_RESUME))
535+
return 0;
536+
537+
if (substream->stream != SNDRV_PCM_STREAM_PLAYBACK)
538+
return 0;
539+
540+
priv->component = &codec->component;
541+
schedule_work(&priv->dummy_write_work);
542+
543+
return 0;
544+
}
545+
470546
static const struct snd_soc_dai_ops ak4613_dai_ops = {
471547
.startup = ak4613_dai_startup,
472548
.shutdown = ak4613_dai_shutdown,
473549
.set_sysclk = ak4613_dai_set_sysclk,
474550
.set_fmt = ak4613_dai_set_fmt,
551+
.trigger = ak4613_dai_trigger,
475552
.hw_params = ak4613_dai_hw_params,
476553
};
477554

@@ -590,6 +667,7 @@ static int ak4613_i2c_probe(struct i2c_client *i2c,
590667
priv->iface = NULL;
591668
priv->cnt = 0;
592669
priv->sysclk = 0;
670+
INIT_WORK(&priv->dummy_write_work, ak4613_dummy_write);
593671

594672
mutex_init(&priv->lock);
595673

‎sound/soc/codecs/dmic.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ static int dmic_dev_probe(struct platform_device *pdev)
113113

114114
if (pdev->dev.of_node) {
115115
err = of_property_read_u32(pdev->dev.of_node, "num-channels", &chans);
116-
if (err && (err != -ENOENT))
116+
if (err && (err != -EINVAL))
117117
return err;
118118

119119
if (!err) {

‎sound/soc/codecs/max98373.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
/* SPDX-License-Identifier: GPL-2.0 */
2-
/* Copyright (c) 2017, Maxim Integrated */
1+
// SPDX-License-Identifier: GPL-2.0
2+
// Copyright (c) 2017, Maxim Integrated
33

44
#include <linux/acpi.h>
55
#include <linux/i2c.h>

‎sound/soc/codecs/max98373.h‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
/* SPDX-License-Identifier: GPL-2.0 */
2-
/* Copyright (c) 2017, Maxim Integrated */
1+
// SPDX-License-Identifier: GPL-2.0
2+
// Copyright (c) 2017, Maxim Integrated
3+
34
#ifndef _MAX98373_H
45
#define _MAX98373_H
56

‎sound/soc/codecs/sgtl5000.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1392,7 +1392,7 @@ static int sgtl5000_i2c_probe(struct i2c_client *client,
13921392

13931393
ana_pwr |= SGTL5000_LINEREG_D_POWERUP;
13941394
dev_info(&client->dev,
1395-
"Using internal LDO instead of VDDD: check ER1\n");
1395+
"Using internal LDO instead of VDDD: check ER1 erratum\n");
13961396
} else {
13971397
/* using external LDO for VDDD
13981398
* Clear startup powerup and simple powerup

‎sound/soc/codecs/twl4030.c‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2195,6 +2195,8 @@ static int twl4030_soc_remove(struct snd_soc_codec *codec)
21952195
static const struct snd_soc_codec_driver soc_codec_dev_twl4030 = {
21962196
.probe = twl4030_soc_probe,
21972197
.remove = twl4030_soc_remove,
2198+
.read = twl4030_read,
2199+
.write = twl4030_write,
21982200
.set_bias_level = twl4030_set_bias_level,
21992201
.idle_bias_off = true,
22002202

‎sound/soc/codecs/twl6040.c‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1158,6 +1158,8 @@ static int twl6040_remove(struct snd_soc_codec *codec)
11581158
static const struct snd_soc_codec_driver soc_codec_dev_twl6040 = {
11591159
.probe = twl6040_probe,
11601160
.remove = twl6040_remove,
1161+
.read = twl6040_read,
1162+
.write = twl6040_write,
11611163
.set_bias_level = twl6040_set_bias_level,
11621164
.suspend_bias_off = true,
11631165
.ignore_pmdown_time = true,

0 commit comments

Comments
 (0)