Skip to content

Commit 7027eee

Browse files
committed
Merge tag 'asoc-fix-v6.12-rc5' of https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound into for-linus
ASoC: Fixes for v6.12 The biggest set of changes here is Hans' fixes and quirks for various Baytrail based platforms with RT5640 CODECs, and there's one core fix for a missed length assignment for __counted_by() checking. Otherwise it's small device specific fixes, several of them in the DT bindings.
2 parents ef5fbdf + 2db63e9 commit 7027eee

File tree

9 files changed

+144
-28
lines changed

9 files changed

+144
-28
lines changed

Documentation/devicetree/bindings/sound/rockchip,rk3308-codec.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,10 @@ properties:
4848
- const: mclk_rx
4949
- const: hclk
5050

51+
port:
52+
$ref: audio-graph-port.yaml#
53+
unevaluatedProperties: false
54+
5155
resets:
5256
maxItems: 1
5357

sound/hda/intel-dsp-config.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -721,6 +721,10 @@ static const struct config_entry acpi_config_table[] = {
721721
#if IS_ENABLED(CONFIG_SND_SST_ATOM_HIFI2_PLATFORM_ACPI) || \
722722
IS_ENABLED(CONFIG_SND_SOC_SOF_BAYTRAIL)
723723
/* BayTrail */
724+
{
725+
.flags = FLAG_SST_OR_SOF_BYT,
726+
.acpi_hid = "LPE0F28",
727+
},
724728
{
725729
.flags = FLAG_SST_OR_SOF_BYT,
726730
.acpi_hid = "80860F28",

sound/soc/codecs/cs42l51.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -747,8 +747,10 @@ int cs42l51_probe(struct device *dev, struct regmap *regmap)
747747

748748
cs42l51->reset_gpio = devm_gpiod_get_optional(dev, "reset",
749749
GPIOD_OUT_LOW);
750-
if (IS_ERR(cs42l51->reset_gpio))
751-
return PTR_ERR(cs42l51->reset_gpio);
750+
if (IS_ERR(cs42l51->reset_gpio)) {
751+
ret = PTR_ERR(cs42l51->reset_gpio);
752+
goto error;
753+
}
752754

753755
if (cs42l51->reset_gpio) {
754756
dev_dbg(dev, "Release reset gpio\n");
@@ -780,6 +782,7 @@ int cs42l51_probe(struct device *dev, struct regmap *regmap)
780782
return 0;
781783

782784
error:
785+
gpiod_set_value_cansleep(cs42l51->reset_gpio, 1);
783786
regulator_bulk_disable(ARRAY_SIZE(cs42l51->supplies),
784787
cs42l51->supplies);
785788
return ret;

sound/soc/codecs/rt5640.c

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2419,10 +2419,20 @@ static irqreturn_t rt5640_jd_gpio_irq(int irq, void *data)
24192419
return IRQ_HANDLED;
24202420
}
24212421

2422-
static void rt5640_cancel_work(void *data)
2422+
static void rt5640_disable_irq_and_cancel_work(void *data)
24232423
{
24242424
struct rt5640_priv *rt5640 = data;
24252425

2426+
if (rt5640->jd_gpio_irq_requested) {
2427+
free_irq(rt5640->jd_gpio_irq, rt5640);
2428+
rt5640->jd_gpio_irq_requested = false;
2429+
}
2430+
2431+
if (rt5640->irq_requested) {
2432+
free_irq(rt5640->irq, rt5640);
2433+
rt5640->irq_requested = false;
2434+
}
2435+
24262436
cancel_delayed_work_sync(&rt5640->jack_work);
24272437
cancel_delayed_work_sync(&rt5640->bp_work);
24282438
}
@@ -2463,22 +2473,14 @@ static void rt5640_disable_jack_detect(struct snd_soc_component *component)
24632473
if (!rt5640->jack)
24642474
return;
24652475

2466-
if (rt5640->jd_gpio_irq_requested)
2467-
free_irq(rt5640->jd_gpio_irq, rt5640);
2468-
2469-
if (rt5640->irq_requested)
2470-
free_irq(rt5640->irq, rt5640);
2471-
2472-
rt5640_cancel_work(rt5640);
2476+
rt5640_disable_irq_and_cancel_work(rt5640);
24732477

24742478
if (rt5640->jack->status & SND_JACK_MICROPHONE) {
24752479
rt5640_disable_micbias1_ovcd_irq(component);
24762480
rt5640_disable_micbias1_for_ovcd(component);
24772481
snd_soc_jack_report(rt5640->jack, 0, SND_JACK_BTN_0);
24782482
}
24792483

2480-
rt5640->jd_gpio_irq_requested = false;
2481-
rt5640->irq_requested = false;
24822484
rt5640->jd_gpio = NULL;
24832485
rt5640->jack = NULL;
24842486
}
@@ -2798,7 +2800,8 @@ static int rt5640_suspend(struct snd_soc_component *component)
27982800
if (rt5640->jack) {
27992801
/* disable jack interrupts during system suspend */
28002802
disable_irq(rt5640->irq);
2801-
rt5640_cancel_work(rt5640);
2803+
cancel_delayed_work_sync(&rt5640->jack_work);
2804+
cancel_delayed_work_sync(&rt5640->bp_work);
28022805
}
28032806

28042807
snd_soc_component_force_bias_level(component, SND_SOC_BIAS_OFF);
@@ -3032,7 +3035,7 @@ static int rt5640_i2c_probe(struct i2c_client *i2c)
30323035
INIT_DELAYED_WORK(&rt5640->jack_work, rt5640_jack_work);
30333036

30343037
/* Make sure work is stopped on probe-error / remove */
3035-
ret = devm_add_action_or_reset(&i2c->dev, rt5640_cancel_work, rt5640);
3038+
ret = devm_add_action_or_reset(&i2c->dev, rt5640_disable_irq_and_cancel_work, rt5640);
30363039
if (ret)
30373040
return ret;
30383041

sound/soc/codecs/wcd937x.c

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -715,12 +715,17 @@ static int wcd937x_codec_enable_aux_pa(struct snd_soc_dapm_widget *w,
715715
struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm);
716716
struct wcd937x_priv *wcd937x = snd_soc_component_get_drvdata(component);
717717
int hph_mode = wcd937x->hph_mode;
718+
u8 val;
718719

719720
switch (event) {
720721
case SND_SOC_DAPM_PRE_PMU:
722+
val = WCD937X_DIGITAL_PDM_WD_CTL2_EN |
723+
WCD937X_DIGITAL_PDM_WD_CTL2_TIMEOUT_SEL |
724+
WCD937X_DIGITAL_PDM_WD_CTL2_HOLD_OFF;
721725
snd_soc_component_update_bits(component,
722726
WCD937X_DIGITAL_PDM_WD_CTL2,
723-
BIT(0), BIT(0));
727+
WCD937X_DIGITAL_PDM_WD_CTL2_MASK,
728+
val);
724729
break;
725730
case SND_SOC_DAPM_POST_PMU:
726731
usleep_range(1000, 1010);
@@ -741,7 +746,8 @@ static int wcd937x_codec_enable_aux_pa(struct snd_soc_dapm_widget *w,
741746
hph_mode);
742747
snd_soc_component_update_bits(component,
743748
WCD937X_DIGITAL_PDM_WD_CTL2,
744-
BIT(0), 0x00);
749+
WCD937X_DIGITAL_PDM_WD_CTL2_MASK,
750+
0x00);
745751
break;
746752
}
747753

@@ -2049,6 +2055,8 @@ static const struct snd_kcontrol_new wcd937x_snd_controls[] = {
20492055
wcd937x_get_swr_port, wcd937x_set_swr_port),
20502056
SOC_SINGLE_EXT("HPHR Switch", WCD937X_HPH_R, 0, 1, 0,
20512057
wcd937x_get_swr_port, wcd937x_set_swr_port),
2058+
SOC_SINGLE_EXT("LO Switch", WCD937X_LO, 0, 1, 0,
2059+
wcd937x_get_swr_port, wcd937x_set_swr_port),
20522060

20532061
SOC_SINGLE_EXT("ADC1 Switch", WCD937X_ADC1, 1, 1, 0,
20542062
wcd937x_get_swr_port, wcd937x_set_swr_port),

sound/soc/codecs/wcd937x.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -391,6 +391,10 @@
391391
#define WCD937X_DIGITAL_PDM_WD_CTL0 0x3465
392392
#define WCD937X_DIGITAL_PDM_WD_CTL1 0x3466
393393
#define WCD937X_DIGITAL_PDM_WD_CTL2 0x3467
394+
#define WCD937X_DIGITAL_PDM_WD_CTL2_HOLD_OFF BIT(2)
395+
#define WCD937X_DIGITAL_PDM_WD_CTL2_TIMEOUT_SEL BIT(1)
396+
#define WCD937X_DIGITAL_PDM_WD_CTL2_EN BIT(0)
397+
#define WCD937X_DIGITAL_PDM_WD_CTL2_MASK GENMASK(2, 0)
394398
#define WCD937X_DIGITAL_INTR_MODE 0x346A
395399
#define WCD937X_DIGITAL_INTR_MASK_0 0x346B
396400
#define WCD937X_DIGITAL_INTR_MASK_1 0x346C

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

Lines changed: 55 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,28 @@ static const struct sst_res_info bytcr_res_info = {
125125
.acpi_ipc_irq_index = 0
126126
};
127127

128+
/* For "LPE0F28" ACPI device found on some Android factory OS models */
129+
static const struct sst_res_info lpe8086_res_info = {
130+
.shim_offset = 0x140000,
131+
.shim_size = 0x000100,
132+
.shim_phy_addr = SST_BYT_SHIM_PHY_ADDR,
133+
.ssp0_offset = 0xa0000,
134+
.ssp0_size = 0x1000,
135+
.dma0_offset = 0x98000,
136+
.dma0_size = 0x4000,
137+
.dma1_offset = 0x9c000,
138+
.dma1_size = 0x4000,
139+
.iram_offset = 0x0c0000,
140+
.iram_size = 0x14000,
141+
.dram_offset = 0x100000,
142+
.dram_size = 0x28000,
143+
.mbox_offset = 0x144000,
144+
.mbox_size = 0x1000,
145+
.acpi_lpe_res_index = 1,
146+
.acpi_ddr_index = 0,
147+
.acpi_ipc_irq_index = 0
148+
};
149+
128150
static struct sst_platform_info byt_rvp_platform_data = {
129151
.probe_data = &byt_fwparse_info,
130152
.ipc_info = &byt_ipc_info,
@@ -268,10 +290,38 @@ static int sst_acpi_probe(struct platform_device *pdev)
268290
mach->pdata = &chv_platform_data;
269291
pdata = mach->pdata;
270292

271-
ret = kstrtouint(id->id, 16, &dev_id);
272-
if (ret < 0) {
273-
dev_err(dev, "Unique device id conversion error: %d\n", ret);
274-
return ret;
293+
if (!strcmp(id->id, "LPE0F28")) {
294+
struct resource *rsrc;
295+
296+
/* Use regular BYT SST PCI VID:PID */
297+
dev_id = 0x80860F28;
298+
byt_rvp_platform_data.res_info = &lpe8086_res_info;
299+
300+
/*
301+
* The "LPE0F28" ACPI device has separate IO-mem resources for:
302+
* DDR, SHIM, MBOX, IRAM, DRAM, CFG
303+
* None of which covers the entire LPE base address range.
304+
* lpe8086_res_info.acpi_lpe_res_index points to the SHIM.
305+
* Patch this to cover the entire base address range as expected
306+
* by sst_platform_get_resources().
307+
*/
308+
rsrc = platform_get_resource(pdev, IORESOURCE_MEM,
309+
pdata->res_info->acpi_lpe_res_index);
310+
if (!rsrc) {
311+
dev_err(dev, "Invalid SHIM base\n");
312+
return -EIO;
313+
}
314+
rsrc->start -= pdata->res_info->shim_offset;
315+
rsrc->end = rsrc->start + 0x200000 - 1;
316+
} else {
317+
ret = kstrtouint(id->id, 16, &dev_id);
318+
if (ret < 0) {
319+
dev_err(dev, "Unique device id conversion error: %d\n", ret);
320+
return ret;
321+
}
322+
323+
if (soc_intel_is_byt_cr(pdev))
324+
byt_rvp_platform_data.res_info = &bytcr_res_info;
275325
}
276326

277327
dev_dbg(dev, "ACPI device id: %x\n", dev_id);
@@ -280,11 +330,6 @@ static int sst_acpi_probe(struct platform_device *pdev)
280330
if (ret < 0)
281331
return ret;
282332

283-
if (soc_intel_is_byt_cr(pdev)) {
284-
/* override resource info */
285-
byt_rvp_platform_data.res_info = &bytcr_res_info;
286-
}
287-
288333
/* update machine parameters */
289334
mach->mach_params.acpi_ipc_irq_index =
290335
pdata->res_info->acpi_ipc_irq_index;
@@ -344,6 +389,7 @@ static void sst_acpi_remove(struct platform_device *pdev)
344389
}
345390

346391
static const struct acpi_device_id sst_acpi_ids[] = {
392+
{ "LPE0F28", (unsigned long)&snd_soc_acpi_intel_baytrail_machines},
347393
{ "80860F28", (unsigned long)&snd_soc_acpi_intel_baytrail_machines},
348394
{ "808622A8", (unsigned long)&snd_soc_acpi_intel_cherrytrail_machines},
349395
{ },

sound/soc/intel/boards/bytcr_rt5640.c

Lines changed: 45 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
#include <linux/acpi.h>
1818
#include <linux/clk.h>
1919
#include <linux/device.h>
20+
#include <linux/device/bus.h>
2021
#include <linux/dmi.h>
2122
#include <linux/gpio/consumer.h>
2223
#include <linux/gpio/machine.h>
@@ -32,6 +33,8 @@
3233
#include "../atom/sst-atom-controls.h"
3334
#include "../common/soc-intel-quirks.h"
3435

36+
#define BYT_RT5640_FALLBACK_CODEC_DEV_NAME "i2c-rt5640"
37+
3538
enum {
3639
BYT_RT5640_DMIC1_MAP,
3740
BYT_RT5640_DMIC2_MAP,
@@ -1129,6 +1132,21 @@ static const struct dmi_system_id byt_rt5640_quirk_table[] = {
11291132
BYT_RT5640_SSP0_AIF2 |
11301133
BYT_RT5640_MCLK_EN),
11311134
},
1135+
{ /* Vexia Edu Atla 10 tablet */
1136+
.matches = {
1137+
DMI_MATCH(DMI_BOARD_VENDOR, "AMI Corporation"),
1138+
DMI_MATCH(DMI_BOARD_NAME, "Aptio CRB"),
1139+
/* Above strings are too generic, also match on BIOS date */
1140+
DMI_MATCH(DMI_BIOS_DATE, "08/25/2014"),
1141+
},
1142+
.driver_data = (void *)(BYT_RT5640_IN1_MAP |
1143+
BYT_RT5640_JD_SRC_JD2_IN4N |
1144+
BYT_RT5640_OVCD_TH_2000UA |
1145+
BYT_RT5640_OVCD_SF_0P75 |
1146+
BYT_RT5640_DIFF_MIC |
1147+
BYT_RT5640_SSP0_AIF2 |
1148+
BYT_RT5640_MCLK_EN),
1149+
},
11321150
{ /* Voyo Winpad A15 */
11331151
.matches = {
11341152
DMI_MATCH(DMI_BOARD_VENDOR, "AMI Corporation"),
@@ -1698,9 +1716,33 @@ static int snd_byt_rt5640_mc_probe(struct platform_device *pdev)
16981716

16991717
codec_dev = acpi_get_first_physical_node(adev);
17001718
acpi_dev_put(adev);
1701-
if (!codec_dev)
1702-
return -EPROBE_DEFER;
1703-
priv->codec_dev = get_device(codec_dev);
1719+
1720+
if (codec_dev) {
1721+
priv->codec_dev = get_device(codec_dev);
1722+
} else {
1723+
/*
1724+
* Special case for Android tablets where the codec i2c_client
1725+
* has been manually instantiated by x86_android_tablets.ko due
1726+
* to a broken DSDT.
1727+
*/
1728+
codec_dev = bus_find_device_by_name(&i2c_bus_type, NULL,
1729+
BYT_RT5640_FALLBACK_CODEC_DEV_NAME);
1730+
if (!codec_dev)
1731+
return -EPROBE_DEFER;
1732+
1733+
if (!i2c_verify_client(codec_dev)) {
1734+
dev_err(dev, "Error '%s' is not an i2c_client\n",
1735+
BYT_RT5640_FALLBACK_CODEC_DEV_NAME);
1736+
put_device(codec_dev);
1737+
}
1738+
1739+
/* fixup codec name */
1740+
strscpy(byt_rt5640_codec_name, BYT_RT5640_FALLBACK_CODEC_DEV_NAME,
1741+
sizeof(byt_rt5640_codec_name));
1742+
1743+
/* bus_find_device() returns a reference no need to get() */
1744+
priv->codec_dev = codec_dev;
1745+
}
17041746

17051747
/*
17061748
* swap SSP0 if bytcr is detected

sound/soc/soc-dapm.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1147,6 +1147,8 @@ static int dapm_widget_list_create(struct snd_soc_dapm_widget_list **list,
11471147
if (*list == NULL)
11481148
return -ENOMEM;
11491149

1150+
(*list)->num_widgets = size;
1151+
11501152
list_for_each_entry(w, widgets, work_list)
11511153
(*list)->widgets[i++] = w;
11521154

0 commit comments

Comments
 (0)