From f1013cdeeeb978e3d8ef254bee1f007da4c862f3 Mon Sep 17 00:00:00 2001 From: Linus Walleij Date: Tue, 28 Feb 2017 15:43:43 +0100 Subject: ASoC: ux500: drop platform DAI assignments This platform is completely probed by device tree nowadays, so we need to do a bigger cleanup removing all the non-DT codepaths. This cleanup must however go in as a fix since it fixes a regression. Currently when Ux500 audio is enabled, dmesg complains like this: entry->name == "prealloc" entry->name == "prealloc_max" entry->name == "prealloc" ------------[ cut here ]------------ WARNING: CPU: 0 PID: 95 at ../fs/proc/generic.c:346 proc_register+0xf0/0x110 proc_dir_entry 'sub0/prealloc' already registered (...) entry->name == "prealloc_max" ------------[ cut here ]------------ WARNING: CPU: 0 PID: 95 at ../fs/proc/generic.c:346 proc_register+0xf0/0x110 proc_dir_entry 'sub0/prealloc_max' already registered (...) snd-soc-mop500 soc:sound: ab8500-codec-dai.0 <-> 80124000.msp mapping ok entry->name == "prealloc" entry->name == "prealloc_max" entry->name == "prealloc" ------------[ cut here ]------------ WARNING: CPU: 0 PID: 95 at ../fs/proc/generic.c:346 proc_register+0xf0/0x110 proc_dir_entry 'sub0/prealloc' already registered (...) entry->name == "prealloc_max" ------------[ cut here ]------------ WARNING: CPU: 0 PID: 95 at ../fs/proc/generic.c:346 proc_register+0xf0/0x110 proc_dir_entry 'sub0/prealloc_max' already registered snd-soc-mop500 soc:sound: ab8500-codec-dai.1 <-> 80125000.msp mapping ok This is because PCMs are created twice for the same hardware, and this happens because both "platform" and "CPU" DAI links are specified. But platform/CPU is an either/or pair, not a both/and pair. This has maybe worked in the past, but it is causing trouble now, so let us begin the cleanups by removing the platform assignment and silencing the boot noise, and make a proper DT cleanup for the next kernel cycle. Cc: Ulf Hansson Cc: Lee Jones Signed-off-by: Linus Walleij Signed-off-by: Mark Brown --- sound/soc/ux500/mop500.c | 4 ---- 1 file changed, 4 deletions(-) (limited to 'sound') diff --git a/sound/soc/ux500/mop500.c b/sound/soc/ux500/mop500.c index ba9fc099cf67..b50f68a439ce 100644 --- a/sound/soc/ux500/mop500.c +++ b/sound/soc/ux500/mop500.c @@ -33,7 +33,6 @@ static struct snd_soc_dai_link mop500_dai_links[] = { .stream_name = "ab8500_0", .cpu_dai_name = "ux500-msp-i2s.1", .codec_dai_name = "ab8500-codec-dai.0", - .platform_name = "ux500-msp-i2s.1", .codec_name = "ab8500-codec.0", .init = mop500_ab8500_machine_init, .ops = mop500_ab8500_ops, @@ -43,7 +42,6 @@ static struct snd_soc_dai_link mop500_dai_links[] = { .stream_name = "ab8500_1", .cpu_dai_name = "ux500-msp-i2s.3", .codec_dai_name = "ab8500-codec-dai.1", - .platform_name = "ux500-msp-i2s.3", .codec_name = "ab8500-codec.0", .init = NULL, .ops = mop500_ab8500_ops, @@ -87,8 +85,6 @@ static int mop500_of_probe(struct platform_device *pdev, for (i = 0; i < 2; i++) { mop500_dai_links[i].cpu_of_node = msp_np[i]; mop500_dai_links[i].cpu_dai_name = NULL; - mop500_dai_links[i].platform_of_node = msp_np[i]; - mop500_dai_links[i].platform_name = NULL; mop500_dai_links[i].codec_of_node = codec_np; mop500_dai_links[i].codec_name = NULL; } -- cgit From 8fcf1e5eb460d8f032c699280f5a33fbf3716c29 Mon Sep 17 00:00:00 2001 From: Codrut Grosu Date: Sat, 25 Feb 2017 21:33:22 +0200 Subject: ASoC: ux500: Added */ to the next line This was reported by checkpatch.pl Signed-off-by: Codrut GROSU Signed-off-by: Mark Brown --- sound/soc/ux500/ux500_msp_dai.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'sound') diff --git a/sound/soc/ux500/ux500_msp_dai.c b/sound/soc/ux500/ux500_msp_dai.c index b343efd9be5b..36e9bb2bd634 100644 --- a/sound/soc/ux500/ux500_msp_dai.c +++ b/sound/soc/ux500/ux500_msp_dai.c @@ -482,7 +482,8 @@ static int ux500_msp_dai_prepare(struct snd_pcm_substream *substream, if ((drvdata->fmt & SND_SOC_DAIFMT_MASTER_MASK) && (drvdata->msp->f_bitclk > 19200000)) { /* If the bit-clock is higher than 19.2MHz, Vape should be - * run in 100% OPP. Only when bit-clock is used (MSP master) */ + * run in 100% OPP. Only when bit-clock is used (MSP master) + */ prcmu_qos_update_requirement(PRCMU_QOS_APE_OPP, "ux500-msp-i2s", 100); drvdata->vape_opp_constraint = 1; -- cgit From b1c5d923720a066b95249f3702a94d27b5714ee9 Mon Sep 17 00:00:00 2001 From: Codrut Grosu Date: Sat, 25 Feb 2017 21:41:25 +0200 Subject: ASoC: ux500: Remove unuseful break after return This was reported by checkpatch.pl Signed-off-by: Codrut GROSU Signed-off-by: Mark Brown --- sound/soc/ux500/ux500_msp_i2s.c | 1 - 1 file changed, 1 deletion(-) (limited to 'sound') diff --git a/sound/soc/ux500/ux500_msp_i2s.c b/sound/soc/ux500/ux500_msp_i2s.c index 959d7b4edf56..bd5266aca0f1 100644 --- a/sound/soc/ux500/ux500_msp_i2s.c +++ b/sound/soc/ux500/ux500_msp_i2s.c @@ -604,7 +604,6 @@ int ux500_msp_i2s_trigger(struct ux500_msp *msp, int cmd, int direction) break; default: return -EINVAL; - break; } return 0; -- cgit From fe3a980cd39125efb7e9ddd67dd0f1a9ef237171 Mon Sep 17 00:00:00 2001 From: Codrut Grosu Date: Sat, 25 Feb 2017 21:50:21 +0200 Subject: ASoC: ux500: Added blank line after declarations This was reported by checkpatch.pl Signed-off-by: Codrut GROSU Signed-off-by: Mark Brown --- sound/soc/ux500/ux500_msp_dai.c | 1 + 1 file changed, 1 insertion(+) (limited to 'sound') diff --git a/sound/soc/ux500/ux500_msp_dai.c b/sound/soc/ux500/ux500_msp_dai.c index 36e9bb2bd634..ec5152aa3f6e 100644 --- a/sound/soc/ux500/ux500_msp_dai.c +++ b/sound/soc/ux500/ux500_msp_dai.c @@ -133,6 +133,7 @@ static int setup_pcm_framing(struct snd_soc_dai *dai, unsigned int rate, struct ux500_msp_i2s_drvdata *drvdata = dev_get_drvdata(dai->dev); u32 frame_length = MSP_FRAME_LEN_1; + prot_desc->frame_width = 0; switch (drvdata->slots) { -- cgit From b3bbef45e97526e8c56fd542d75e505776eecc01 Mon Sep 17 00:00:00 2001 From: Linus Walleij Date: Mon, 20 Mar 2017 10:13:52 +0100 Subject: ASoC: wm8903: add regulator handling The WM8903 has four different voltage inputs: AVDD, CPVDD, DBVDD and DCVDD. On the Qualcomm APQ8060 Dragonboard these are all supplied from proper regulators and thus need activating and binding. This is a quick-and-dirty solution just grabbing and enabling the regulator supplies on probe() and disabling them on remove() and the errorpath. More elaborate power management is likely possible. I assume the nVidia designs using this codec have some hard-wired always-on power and will be happy with using the dummy regulators for this. But someone from the nVidia camp should probably check whether they can bind these to proper regulators instead. We also amend the DT binding document. A small change like this does not warrant a separate patch for augmenting these. Cc: devicetree@vger.kernel.org Cc: Mark Brown Cc: Liam Girdwood Cc: Stephen Warren Cc: Charles Keepax Signed-off-by: Linus Walleij Signed-off-by: Mark Brown --- sound/soc/codecs/wm8903.c | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) (limited to 'sound') diff --git a/sound/soc/codecs/wm8903.c b/sound/soc/codecs/wm8903.c index 6e887c2c42b1..237eeb9a8b97 100644 --- a/sound/soc/codecs/wm8903.c +++ b/sound/soc/codecs/wm8903.c @@ -24,6 +24,7 @@ #include #include #include +#include #include #include #include @@ -115,10 +116,19 @@ static const struct reg_default wm8903_reg_defaults[] = { { 172, 0x0000 }, /* R172 - Analogue Output Bias 0 */ }; +#define WM8903_NUM_SUPPLIES 4 +static const char *wm8903_supply_names[WM8903_NUM_SUPPLIES] = { + "AVDD", + "CPVDD", + "DBVDD", + "DCVDD", +}; + struct wm8903_priv { struct wm8903_platform_data *pdata; struct device *dev; struct regmap *regmap; + struct regulator_bulk_data supplies[WM8903_NUM_SUPPLIES]; int sysclk; int irq; @@ -2030,6 +2040,23 @@ static int wm8903_i2c_probe(struct i2c_client *i2c, pdata = wm8903->pdata; + for (i = 0; i < ARRAY_SIZE(wm8903->supplies); i++) + wm8903->supplies[i].supply = wm8903_supply_names[i]; + + ret = devm_regulator_bulk_get(&i2c->dev, ARRAY_SIZE(wm8903->supplies), + wm8903->supplies); + if (ret != 0) { + dev_err(&i2c->dev, "Failed to request supplies: %d\n", ret); + return ret; + } + + ret = regulator_bulk_enable(ARRAY_SIZE(wm8903->supplies), + wm8903->supplies); + if (ret != 0) { + dev_err(&i2c->dev, "Failed to enable supplies: %d\n", ret); + return ret; + } + ret = regmap_read(wm8903->regmap, WM8903_SW_RESET_AND_ID, &val); if (ret != 0) { dev_err(&i2c->dev, "Failed to read chip ID: %d\n", ret); @@ -2160,6 +2187,8 @@ static int wm8903_i2c_probe(struct i2c_client *i2c, return 0; err: + regulator_bulk_disable(ARRAY_SIZE(wm8903->supplies), + wm8903->supplies); return ret; } @@ -2167,6 +2196,8 @@ static int wm8903_i2c_remove(struct i2c_client *client) { struct wm8903_priv *wm8903 = i2c_get_clientdata(client); + regulator_bulk_disable(ARRAY_SIZE(wm8903->supplies), + wm8903->supplies); if (client->irq) free_irq(client->irq, wm8903); wm8903_free_gpio(wm8903); -- cgit From ea22a26e676ebc39a2ba7836e814864bf85324e7 Mon Sep 17 00:00:00 2001 From: Javier Martinez Canillas Date: Tue, 4 Apr 2017 15:26:28 -0400 Subject: ASoC: uda1380: Add OF device ID table The driver doesn't have a struct of_device_id table but supported devices are registered via Device Trees. This is working on the assumption that a I2C device registered via OF will always match a legacy I2C device ID and that the MODALIAS reported will always be of the form i2c:. But this could change in the future so the correct approach is to have an OF device ID table if the devices are registered via OF. Before this patch: $ modinfo sound/soc/codecs/snd-soc-uda1380.ko | grep alias alias: i2c:uda1380 After this patch: $ modinfo sound/soc/codecs/snd-soc-uda1380.ko | grep alias alias: of:N*T*Cnxp,uda1380C* alias: of:N*T*Cnxp,uda1380 alias: i2c:uda1380 Signed-off-by: Javier Martinez Canillas Signed-off-by: Mark Brown --- sound/soc/codecs/uda1380.c | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'sound') diff --git a/sound/soc/codecs/uda1380.c b/sound/soc/codecs/uda1380.c index 2918fdb95e58..61cdc79840e7 100644 --- a/sound/soc/codecs/uda1380.c +++ b/sound/soc/codecs/uda1380.c @@ -791,9 +791,16 @@ static const struct i2c_device_id uda1380_i2c_id[] = { }; MODULE_DEVICE_TABLE(i2c, uda1380_i2c_id); +static const struct of_device_id uda1380_of_match[] = { + { .compatible = "nxp,uda1380", }, + { } +}; +MODULE_DEVICE_TABLE(of, uda1380_of_match); + static struct i2c_driver uda1380_i2c_driver = { .driver = { .name = "uda1380-codec", + .of_match_table = uda1380_of_match, }, .probe = uda1380_i2c_probe, .remove = uda1380_i2c_remove, -- cgit From c12c1aad98bb75b435e79c6208b56d2018b42f8b Mon Sep 17 00:00:00 2001 From: Kuninori Morimoto Date: Mon, 3 Apr 2017 06:31:22 +0000 Subject: ASoC: soc-core: verify Sound Card normality Current ALSA SoC Sound Card basically consists of CPU/Codec/Platform components. If system uses Kernel modules, we can disable these drivers by using rmmod command. In such case, we can't disable CPU/Codec/Platform driver without disabling Sound Card driver. But on the other hand, we can disable these drivers by using unbind command. In such case, we can disable these drivers randomly. In this case, we can create dirty Sound Card which is missing necessary components. (1) If user disabled Sound Card first, but did nothing to other drivers, user can't use Sound because Sound Card is no longer exists. (2) If user disabled CPU/Codec/Platform driver randomly, but did nothing to Sound Card, user still be able to use Sound Card, because dirty Sound Card still exists. In this case, Sound system will be crashed if user started sound playback/capture. But we can't block such random unbind now. To avoid Sound Card crash in (2) case, we need to unregister Sound Card whenever CPU/Codec/Platform component were unregistered. This patch solves this issue. Signed-off-by: Kuninori Morimoto Signed-off-by: Mark Brown --- sound/soc/soc-core.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'sound') diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c index f1901bb1466e..de6d5609c252 100644 --- a/sound/soc/soc-core.c +++ b/sound/soc/soc-core.c @@ -3076,6 +3076,11 @@ static void snd_soc_component_cleanup(struct snd_soc_component *component) static void snd_soc_component_del_unlocked(struct snd_soc_component *component) { + struct snd_soc_card *card = component->card; + + if (card) + snd_soc_unregister_card(card); + list_del(&component->list); } -- cgit From fd9f069d876d6a96eb0f731b1e293145352d5f4f Mon Sep 17 00:00:00 2001 From: Colin Ian King Date: Sat, 22 Apr 2017 13:28:42 +0100 Subject: ASoC: wm5100: fix spelling mistake: "micropone" -> "microphone" Trivial fix to spelling mistake in dev_err message Signed-off-by: Colin Ian King Acked-by: Linus Walleij Acked-by: Charles Keepax Signed-off-by: Mark Brown --- sound/soc/codecs/wm5100.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'sound') diff --git a/sound/soc/codecs/wm5100.c b/sound/soc/codecs/wm5100.c index 560575000cc5..138a84efdd54 100644 --- a/sound/soc/codecs/wm5100.c +++ b/sound/soc/codecs/wm5100.c @@ -2014,7 +2014,7 @@ static void wm5100_micd_irq(struct wm5100_priv *wm5100) ret = regmap_read(wm5100->regmap, WM5100_MIC_DETECT_3, &val); if (ret != 0) { - dev_err(wm5100->dev, "Failed to read micropone status: %d\n", + dev_err(wm5100->dev, "Failed to read microphone status: %d\n", ret); return; } -- cgit