Skip to content

Commit aecd1fb

Browse files
committed
Merge tag 'asoc-fix-v5.10-rc4' of https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound into for-linus
ASoC: Fixes for v5.11 A collection of driver specific fixes, mostly for x86 systems (or CODECs used mostly on x86) and all for relatively minor issues, the biggest one being fixing S24_LE format on Keem Bay systems.
2 parents d21b96c + 879ee8b commit aecd1fb

8 files changed

Lines changed: 57 additions & 10 deletions

File tree

Documentation/devicetree/bindings/sound/rt1015.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,16 @@ Required properties:
88

99
- reg : The I2C address of the device.
1010

11+
Optional properties:
12+
13+
- realtek,power-up-delay-ms
14+
Set a delay time for flush work to be completed,
15+
this value is adjustable depending on platform.
1116

1217
Example:
1318

1419
rt1015: codec@28 {
1520
compatible = "realtek,rt1015";
1621
reg = <0x28>;
22+
realtek,power-up-delay-ms = <50>;
1723
};

include/sound/rt1015.h

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
/* SPDX-License-Identifier: GPL-2.0-only */
2+
/*
3+
* linux/sound/rt1015.h -- Platform data for RT1015
4+
*
5+
* Copyright 2020 Realtek Microelectronics
6+
*/
7+
8+
#ifndef __LINUX_SND_RT1015_H
9+
#define __LINUX_SND_RT1015_H
10+
11+
struct rt1015_platform_data {
12+
unsigned int power_up_delay_ms;
13+
};
14+
15+
#endif

sound/soc/codecs/rt1015.c

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,15 @@
2727
#include <sound/soc-dapm.h>
2828
#include <sound/soc.h>
2929
#include <sound/tlv.h>
30+
#include <sound/rt1015.h>
3031

3132
#include "rl6231.h"
3233
#include "rt1015.h"
3334

35+
static const struct rt1015_platform_data i2s_default_platform_data = {
36+
.power_up_delay_ms = 50,
37+
};
38+
3439
static const struct reg_default rt1015_reg[] = {
3540
{ 0x0000, 0x0000 },
3641
{ 0x0004, 0xa000 },
@@ -539,7 +544,7 @@ static void rt1015_flush_work(struct work_struct *work)
539544
struct rt1015_priv *rt1015 = container_of(work, struct rt1015_priv,
540545
flush_work.work);
541546
struct snd_soc_component *component = rt1015->component;
542-
unsigned int val, i = 0, count = 20;
547+
unsigned int val, i = 0, count = 200;
543548

544549
while (i < count) {
545550
usleep_range(1000, 1500);
@@ -650,6 +655,7 @@ static int rt1015_amp_drv_event(struct snd_soc_dapm_widget *w,
650655
case SND_SOC_DAPM_POST_PMU:
651656
if (rt1015->hw_config == RT1015_HW_28)
652657
schedule_delayed_work(&rt1015->flush_work, msecs_to_jiffies(10));
658+
msleep(rt1015->pdata.power_up_delay_ms);
653659
break;
654660
default:
655661
break;
@@ -1067,9 +1073,16 @@ static struct acpi_device_id rt1015_acpi_match[] = {
10671073
MODULE_DEVICE_TABLE(acpi, rt1015_acpi_match);
10681074
#endif
10691075

1076+
static void rt1015_parse_dt(struct rt1015_priv *rt1015, struct device *dev)
1077+
{
1078+
device_property_read_u32(dev, "realtek,power-up-delay-ms",
1079+
&rt1015->pdata.power_up_delay_ms);
1080+
}
1081+
10701082
static int rt1015_i2c_probe(struct i2c_client *i2c,
10711083
const struct i2c_device_id *id)
10721084
{
1085+
struct rt1015_platform_data *pdata = dev_get_platdata(&i2c->dev);
10731086
struct rt1015_priv *rt1015;
10741087
int ret;
10751088
unsigned int val;
@@ -1081,6 +1094,13 @@ static int rt1015_i2c_probe(struct i2c_client *i2c,
10811094

10821095
i2c_set_clientdata(i2c, rt1015);
10831096

1097+
rt1015->pdata = i2s_default_platform_data;
1098+
1099+
if (pdata)
1100+
rt1015->pdata = *pdata;
1101+
else
1102+
rt1015_parse_dt(rt1015, &i2c->dev);
1103+
10841104
rt1015->regmap = devm_regmap_init_i2c(i2c, &rt1015_regmap);
10851105
if (IS_ERR(rt1015->regmap)) {
10861106
ret = PTR_ERR(rt1015->regmap);

sound/soc/codecs/rt1015.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212

1313
#ifndef __RT1015_H__
1414
#define __RT1015_H__
15+
#include <sound/rt1015.h>
1516

1617
#define RT1015_DEVICE_ID_VAL 0x1011
1718
#define RT1015_DEVICE_ID_VAL2 0x1015
@@ -380,6 +381,7 @@ enum {
380381

381382
struct rt1015_priv {
382383
struct snd_soc_component *component;
384+
struct rt1015_platform_data pdata;
383385
struct regmap *regmap;
384386
int sysclk;
385387
int sysclk_src;

sound/soc/intel/boards/kbl_rt5663_rt5514_max98927.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -700,6 +700,8 @@ static int kabylake_set_bias_level(struct snd_soc_card *card,
700700
switch (level) {
701701
case SND_SOC_BIAS_PREPARE:
702702
if (dapm->bias_level == SND_SOC_BIAS_ON) {
703+
if (!__clk_is_enabled(priv->mclk))
704+
return 0;
703705
dev_dbg(card->dev, "Disable mclk");
704706
clk_disable_unprepare(priv->mclk);
705707
} else {

sound/soc/intel/catpt/pcm.c

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -458,10 +458,6 @@ static int catpt_dai_prepare(struct snd_pcm_substream *substream,
458458
if (ret)
459459
return CATPT_IPC_ERROR(ret);
460460

461-
ret = catpt_dsp_update_lpclock(cdev);
462-
if (ret)
463-
return ret;
464-
465461
ret = catpt_dai_apply_usettings(dai, stream);
466462
if (ret)
467463
return ret;
@@ -500,18 +496,19 @@ static int catpt_dai_trigger(struct snd_pcm_substream *substream, int cmd,
500496
case SNDRV_PCM_TRIGGER_RESUME:
501497
case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
502498
resume_stream:
499+
catpt_dsp_update_lpclock(cdev);
503500
ret = catpt_ipc_resume_stream(cdev, stream->info.stream_hw_id);
504501
if (ret)
505502
return CATPT_IPC_ERROR(ret);
506503
break;
507504

508505
case SNDRV_PCM_TRIGGER_STOP:
509506
stream->prepared = false;
510-
catpt_dsp_update_lpclock(cdev);
511507
fallthrough;
512508
case SNDRV_PCM_TRIGGER_SUSPEND:
513509
case SNDRV_PCM_TRIGGER_PAUSE_PUSH:
514510
ret = catpt_ipc_pause_stream(cdev, stream->info.stream_hw_id);
511+
catpt_dsp_update_lpclock(cdev);
515512
if (ret)
516513
return CATPT_IPC_ERROR(ret);
517514
break;
@@ -534,6 +531,8 @@ void catpt_stream_update_position(struct catpt_dev *cdev,
534531

535532
dsppos = bytes_to_frames(r, pos->stream_position);
536533

534+
if (!stream->prepared)
535+
goto exit;
537536
/* only offload is set_write_pos driven */
538537
if (stream->template->type != CATPT_STRM_TYPE_RENDER)
539538
goto exit;

sound/soc/intel/keembay/kmb_platform.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -487,9 +487,9 @@ static int kmb_dai_hw_params(struct snd_pcm_substream *substream,
487487
kmb_i2s->xfer_resolution = 0x02;
488488
break;
489489
case SNDRV_PCM_FORMAT_S24_LE:
490-
config->data_width = 24;
491-
kmb_i2s->ccr = 0x08;
492-
kmb_i2s->xfer_resolution = 0x04;
490+
config->data_width = 32;
491+
kmb_i2s->ccr = 0x14;
492+
kmb_i2s->xfer_resolution = 0x05;
493493
break;
494494
case SNDRV_PCM_FORMAT_S32_LE:
495495
config->data_width = 32;

sound/soc/qcom/lpass-platform.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,8 +122,10 @@ static int lpass_platform_pcmops_open(struct snd_soc_component *component,
122122
else
123123
dma_ch = 0;
124124

125-
if (dma_ch < 0)
125+
if (dma_ch < 0) {
126+
kfree(data);
126127
return dma_ch;
128+
}
127129

128130
if (cpu_dai->driver->id == LPASS_DP_RX) {
129131
map = drvdata->hdmiif_map;
@@ -147,6 +149,7 @@ static int lpass_platform_pcmops_open(struct snd_soc_component *component,
147149
ret = snd_pcm_hw_constraint_integer(runtime,
148150
SNDRV_PCM_HW_PARAM_PERIODS);
149151
if (ret < 0) {
152+
kfree(data);
150153
dev_err(soc_runtime->dev, "setting constraints failed: %d\n",
151154
ret);
152155
return -EINVAL;

0 commit comments

Comments
 (0)