[alsa-devel] [PATCH 0/7] ASoC: rockchip: Fix audio on Veyron.
Hi all,
This patch series adds support and fixes the audio support for Veyron devices. With these patches I'm able to playback from speakers and headphones, and record from the microphone on a Veyron Jerry Chromebook.
Patches 1/7 and 2/7 were already sent by John Keeping,[1] [2], but I think it's interesting have them included here.
Patches from 1/7 to 5/7 should go through the Mark Brown ASoC tree.
Patches 6/7 and 7/7 should go through the Heiko Stuebner rockchip tree.
[1] https://patchwork.kernel.org/patch/9017491/ [2] https://patchwork.kernel.org/patch/9017501/
Enric Balletbo i Serra (5): ASoC: rockchip-max98090: Fix NULL pointer de reference while accessing to jack ASoC: rockchip-max98090: Fix the Headset Mic route. ASoC: rockchip-max98090: Fix DAPM unknown pin for Headset Jack ARM: dts: rockchip: Add shared file for audio related nodes for veyron boards ARM: dts: rockchip: veyron: Add analog audio codecs.
John Keeping (2): ASoC: rockchip: Revert "ASoC: rockchip: i2s: remove unused variables" ASoC: rockchip: Revert "ASoC: rockchip: i2s: separate capture and playback"
arch/arm/boot/dts/rk3288-veyron-analog-audio.dtsi | 102 ++++++++++++++++++++++ arch/arm/boot/dts/rk3288-veyron-chromebook.dtsi | 1 + sound/soc/rockchip/rockchip_i2s.c | 87 +++++++++++------- sound/soc/rockchip/rockchip_max98090.c | 54 ++++++------ 4 files changed, 187 insertions(+), 57 deletions(-) create mode 100644 arch/arm/boot/dts/rk3288-veyron-analog-audio.dtsi
From: John Keeping john@metanate.com
This reverts commit 5938448b99275cba95167c3f9d39ca9225fdad38.
It turns out that the commit that made these variables unused is wrong so we're about to revert it. Bring back the variables in prepration.
Signed-off-by: John Keeping john@metanate.com Signed-off-by: Enric Balletbo i Serra enric.balletbo@collabora.com --- sound/soc/rockchip/rockchip_i2s.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+)
diff --git a/sound/soc/rockchip/rockchip_i2s.c b/sound/soc/rockchip/rockchip_i2s.c index 2f8e204..34743ec 100644 --- a/sound/soc/rockchip/rockchip_i2s.c +++ b/sound/soc/rockchip/rockchip_i2s.c @@ -34,6 +34,13 @@ struct rk_i2s_dev {
struct regmap *regmap;
+/* + * Used to indicate the tx/rx status. + * I2S controller hopes to start the tx and rx together, + * also to stop them when they are both try to stop. +*/ + bool tx_start; + bool rx_start; bool is_master_mode; };
@@ -77,7 +84,11 @@ static void rockchip_snd_txctrl(struct rk_i2s_dev *i2s, int on) regmap_update_bits(i2s->regmap, I2S_XFER, I2S_XFER_TXS_START, I2S_XFER_TXS_START); + + i2s->tx_start = true; } else { + i2s->tx_start = false; + regmap_update_bits(i2s->regmap, I2S_DMACR, I2S_DMACR_TDE_ENABLE, I2S_DMACR_TDE_DISABLE);
@@ -115,7 +126,11 @@ static void rockchip_snd_rxctrl(struct rk_i2s_dev *i2s, int on) regmap_update_bits(i2s->regmap, I2S_XFER, I2S_XFER_RXS_START, I2S_XFER_RXS_START); + + i2s->rx_start = true; } else { + i2s->rx_start = false; + regmap_update_bits(i2s->regmap, I2S_DMACR, I2S_DMACR_RDE_ENABLE, I2S_DMACR_RDE_DISABLE);
From: John Keeping john@metanate.com
This reverts commit eba65d179c1149cf79e68608d452631f33d7f017.
This broke audio on Veyron Jerry Chromebooks and I now cannot reproduce the problem I was trying to fix even with this commit reverted, so it seems that this was completely the wrong thing to do.
Reported-by: Enric Balletbo Serra eballetbo@gmail.com Signed-off-by: John Keeping john@metanate.com --- sound/soc/rockchip/rockchip_i2s.c | 72 ++++++++++++++++++++++----------------- 1 file changed, 40 insertions(+), 32 deletions(-)
diff --git a/sound/soc/rockchip/rockchip_i2s.c b/sound/soc/rockchip/rockchip_i2s.c index 34743ec..574c6af 100644 --- a/sound/soc/rockchip/rockchip_i2s.c +++ b/sound/soc/rockchip/rockchip_i2s.c @@ -82,8 +82,8 @@ static void rockchip_snd_txctrl(struct rk_i2s_dev *i2s, int on) I2S_DMACR_TDE_ENABLE, I2S_DMACR_TDE_ENABLE);
regmap_update_bits(i2s->regmap, I2S_XFER, - I2S_XFER_TXS_START, - I2S_XFER_TXS_START); + I2S_XFER_TXS_START | I2S_XFER_RXS_START, + I2S_XFER_TXS_START | I2S_XFER_RXS_START);
i2s->tx_start = true; } else { @@ -92,23 +92,27 @@ static void rockchip_snd_txctrl(struct rk_i2s_dev *i2s, int on) regmap_update_bits(i2s->regmap, I2S_DMACR, I2S_DMACR_TDE_ENABLE, I2S_DMACR_TDE_DISABLE);
- regmap_update_bits(i2s->regmap, I2S_XFER, - I2S_XFER_TXS_START, - I2S_XFER_TXS_STOP); - - regmap_update_bits(i2s->regmap, I2S_CLR, - I2S_CLR_TXC, - I2S_CLR_TXC); + if (!i2s->rx_start) { + regmap_update_bits(i2s->regmap, I2S_XFER, + I2S_XFER_TXS_START | + I2S_XFER_RXS_START, + I2S_XFER_TXS_STOP | + I2S_XFER_RXS_STOP);
- regmap_read(i2s->regmap, I2S_CLR, &val); + regmap_update_bits(i2s->regmap, I2S_CLR, + I2S_CLR_TXC | I2S_CLR_RXC, + I2S_CLR_TXC | I2S_CLR_RXC);
- /* Should wait for clear operation to finish */ - while (val & I2S_CLR_TXC) { regmap_read(i2s->regmap, I2S_CLR, &val); - retry--; - if (!retry) { - dev_warn(i2s->dev, "fail to clear\n"); - break; + + /* Should wait for clear operation to finish */ + while (val) { + regmap_read(i2s->regmap, I2S_CLR, &val); + retry--; + if (!retry) { + dev_warn(i2s->dev, "fail to clear\n"); + break; + } } } } @@ -124,8 +128,8 @@ static void rockchip_snd_rxctrl(struct rk_i2s_dev *i2s, int on) I2S_DMACR_RDE_ENABLE, I2S_DMACR_RDE_ENABLE);
regmap_update_bits(i2s->regmap, I2S_XFER, - I2S_XFER_RXS_START, - I2S_XFER_RXS_START); + I2S_XFER_TXS_START | I2S_XFER_RXS_START, + I2S_XFER_TXS_START | I2S_XFER_RXS_START);
i2s->rx_start = true; } else { @@ -134,23 +138,27 @@ static void rockchip_snd_rxctrl(struct rk_i2s_dev *i2s, int on) regmap_update_bits(i2s->regmap, I2S_DMACR, I2S_DMACR_RDE_ENABLE, I2S_DMACR_RDE_DISABLE);
- regmap_update_bits(i2s->regmap, I2S_XFER, - I2S_XFER_RXS_START, - I2S_XFER_RXS_STOP); - - regmap_update_bits(i2s->regmap, I2S_CLR, - I2S_CLR_RXC, - I2S_CLR_RXC); + if (!i2s->tx_start) { + regmap_update_bits(i2s->regmap, I2S_XFER, + I2S_XFER_TXS_START | + I2S_XFER_RXS_START, + I2S_XFER_TXS_STOP | + I2S_XFER_RXS_STOP);
- regmap_read(i2s->regmap, I2S_CLR, &val); + regmap_update_bits(i2s->regmap, I2S_CLR, + I2S_CLR_TXC | I2S_CLR_RXC, + I2S_CLR_TXC | I2S_CLR_RXC);
- /* Should wait for clear operation to finish */ - while (val & I2S_CLR_RXC) { regmap_read(i2s->regmap, I2S_CLR, &val); - retry--; - if (!retry) { - dev_warn(i2s->dev, "fail to clear\n"); - break; + + /* Should wait for clear operation to finish */ + while (val) { + regmap_read(i2s->regmap, I2S_CLR, &val); + retry--; + if (!retry) { + dev_warn(i2s->dev, "fail to clear\n"); + break; + } } } }
Since commit f2ed6b07645e ("ASoC: Make aux_dev more like a generic component") a kernel Oops is seen. What causes the crash is the chain
rk_98090_headset_init -> ts3a227e_enable_jack_detect -> snd_jack_set_key rk_init -> snd_soc_card_jack_new
The above commit moves the new jack object creation from rk_init to rk_98090_headset_init function making sure jack is accessed after it's created.
Signed-off-by: Enric Balletbo i Serra enric.balletbo@collabora.com --- sound/soc/rockchip/rockchip_max98090.c | 50 ++++++++++++++++++---------------- 1 file changed, 27 insertions(+), 23 deletions(-)
diff --git a/sound/soc/rockchip/rockchip_max98090.c b/sound/soc/rockchip/rockchip_max98090.c index 5436102..abb64a5 100644 --- a/sound/soc/rockchip/rockchip_max98090.c +++ b/sound/soc/rockchip/rockchip_max98090.c @@ -114,43 +114,27 @@ static int rk_aif1_hw_params(struct snd_pcm_substream *substream, return ret; }
-static int rk_init(struct snd_soc_pcm_runtime *runtime) -{ - /* Enable Headset and 4 Buttons Jack detection */ - return snd_soc_card_jack_new(runtime->card, "Headset Jack", - SND_JACK_HEADSET | - SND_JACK_BTN_0 | SND_JACK_BTN_1 | - SND_JACK_BTN_2 | SND_JACK_BTN_3, - &headset_jack, - headset_jack_pins, - ARRAY_SIZE(headset_jack_pins)); -} - -static int rk_98090_headset_init(struct snd_soc_component *component) -{ - return ts3a227e_enable_jack_detect(component, &headset_jack); -} - static struct snd_soc_ops rk_aif1_ops = { .hw_params = rk_aif1_hw_params, };
-static struct snd_soc_aux_dev rk_98090_headset_dev = { - .name = "Headset Chip", - .init = rk_98090_headset_init, -}; - static struct snd_soc_dai_link rk_dailink = { .name = "max98090", .stream_name = "Audio", .codec_dai_name = "HiFi", - .init = rk_init, .ops = &rk_aif1_ops, /* set max98090 as slave */ .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBS_CFS, };
+static int rk_98090_headset_init(struct snd_soc_component *component); + +static struct snd_soc_aux_dev rk_98090_headset_dev = { + .name = "Headset Chip", + .init = rk_98090_headset_init, +}; + static struct snd_soc_card snd_soc_card_rk = { .name = "ROCKCHIP-I2S", .owner = THIS_MODULE, @@ -166,6 +150,26 @@ static struct snd_soc_card snd_soc_card_rk = { .num_controls = ARRAY_SIZE(rk_mc_controls), };
+static int rk_98090_headset_init(struct snd_soc_component *component) +{ + int ret; + + /* Enable Headset and 4 Buttons Jack detection */ + ret = snd_soc_card_jack_new(&snd_soc_card_rk, "Headset Jack", + SND_JACK_HEADSET | + SND_JACK_BTN_0 | SND_JACK_BTN_1 | + SND_JACK_BTN_2 | SND_JACK_BTN_3, + &headset_jack, + headset_jack_pins, + ARRAY_SIZE(headset_jack_pins)); + if (ret) + return ret; + + ret = ts3a227e_enable_jack_detect(component, &headset_jack); + + return ret; +} + static int snd_rk_mc_probe(struct platform_device *pdev) { int ret = 0;
The patch
ASoC: rockchip-max98090: Fix NULL pointer dereference while accessing to jack.
has been applied to the asoc tree at
git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git
All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying to this mail.
Thanks, Mark
From af637e3adaf538288cbb3e6a2d9a4059853fc15a Mon Sep 17 00:00:00 2001
From: Enric Balletbo i Serra enric.balletbo@collabora.com Date: Mon, 9 May 2016 12:46:31 +0200 Subject: [PATCH] ASoC: rockchip-max98090: Fix NULL pointer dereference while accessing to jack.
Commit f2ed6b07645e ("ASoC: Make aux_dev more like a generic component") caused a regression on this driver, since now a kernel oops is seen when rockchip-mac98090 driver is loaded.
That commit changed the probing of aux_devs before checking new DAI links, so for this driver rk_98090_headset_init is called before rk_init and then the kernel oops due a NULL pointer dereference inside rk_98090_headset_init function since there is a call that tries to access the jack pointer which has not been allocated yet.
This is the call chain that causes the crash:
rk_98090_headset_init -> ts3a227e_enable_jack_detect -> snd_jack_set_key rk_init -> snd_soc_card_jack_new
This patch moves the new jack object creation from rk_init to rk_98090_headset_init function making sure the jack is created before is accessed.
Signed-off-by: Enric Balletbo i Serra enric.balletbo@collabora.com Signed-off-by: Mark Brown broonie@kernel.org --- sound/soc/rockchip/rockchip_max98090.c | 50 ++++++++++++++++++---------------- 1 file changed, 27 insertions(+), 23 deletions(-)
diff --git a/sound/soc/rockchip/rockchip_max98090.c b/sound/soc/rockchip/rockchip_max98090.c index 543610282cdb..abb64a553967 100644 --- a/sound/soc/rockchip/rockchip_max98090.c +++ b/sound/soc/rockchip/rockchip_max98090.c @@ -114,43 +114,27 @@ static int rk_aif1_hw_params(struct snd_pcm_substream *substream, return ret; }
-static int rk_init(struct snd_soc_pcm_runtime *runtime) -{ - /* Enable Headset and 4 Buttons Jack detection */ - return snd_soc_card_jack_new(runtime->card, "Headset Jack", - SND_JACK_HEADSET | - SND_JACK_BTN_0 | SND_JACK_BTN_1 | - SND_JACK_BTN_2 | SND_JACK_BTN_3, - &headset_jack, - headset_jack_pins, - ARRAY_SIZE(headset_jack_pins)); -} - -static int rk_98090_headset_init(struct snd_soc_component *component) -{ - return ts3a227e_enable_jack_detect(component, &headset_jack); -} - static struct snd_soc_ops rk_aif1_ops = { .hw_params = rk_aif1_hw_params, };
-static struct snd_soc_aux_dev rk_98090_headset_dev = { - .name = "Headset Chip", - .init = rk_98090_headset_init, -}; - static struct snd_soc_dai_link rk_dailink = { .name = "max98090", .stream_name = "Audio", .codec_dai_name = "HiFi", - .init = rk_init, .ops = &rk_aif1_ops, /* set max98090 as slave */ .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBS_CFS, };
+static int rk_98090_headset_init(struct snd_soc_component *component); + +static struct snd_soc_aux_dev rk_98090_headset_dev = { + .name = "Headset Chip", + .init = rk_98090_headset_init, +}; + static struct snd_soc_card snd_soc_card_rk = { .name = "ROCKCHIP-I2S", .owner = THIS_MODULE, @@ -166,6 +150,26 @@ static struct snd_soc_card snd_soc_card_rk = { .num_controls = ARRAY_SIZE(rk_mc_controls), };
+static int rk_98090_headset_init(struct snd_soc_component *component) +{ + int ret; + + /* Enable Headset and 4 Buttons Jack detection */ + ret = snd_soc_card_jack_new(&snd_soc_card_rk, "Headset Jack", + SND_JACK_HEADSET | + SND_JACK_BTN_0 | SND_JACK_BTN_1 | + SND_JACK_BTN_2 | SND_JACK_BTN_3, + &headset_jack, + headset_jack_pins, + ARRAY_SIZE(headset_jack_pins)); + if (ret) + return ret; + + ret = ts3a227e_enable_jack_detect(component, &headset_jack); + + return ret; +} + static int snd_rk_mc_probe(struct platform_device *pdev) { int ret = 0;
Hi Mark,
2016-05-10 20:50 GMT+02:00 Mark Brown broonie@kernel.org:
The patch
ASoC: rockchip-max98090: Fix NULL pointer dereference while accessing to jack.
has been applied to the asoc tree at
git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git
All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.
I just saw that these patches and the others in the patch series were not applied yet. As are fixes and were accepted since middle May, I expected see the patches merged in this release cycle, but we're at rc6 so I suppose I'll need to wait to see them merged for 4.8 merge window. Please can you coordinate with Heiko and make sure that these patches were merged before he merges the patches to enable the audio on Veyron? Otherwise we will break Veyron support for a while. I'd really like have audio working on Veyron.
Thanks, Enric
You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying to this mail.
Thanks, Mark
From af637e3adaf538288cbb3e6a2d9a4059853fc15a Mon Sep 17 00:00:00 2001 From: Enric Balletbo i Serra enric.balletbo@collabora.com Date: Mon, 9 May 2016 12:46:31 +0200 Subject: [PATCH] ASoC: rockchip-max98090: Fix NULL pointer dereference while accessing to jack.
Commit f2ed6b07645e ("ASoC: Make aux_dev more like a generic component") caused a regression on this driver, since now a kernel oops is seen when rockchip-mac98090 driver is loaded.
That commit changed the probing of aux_devs before checking new DAI links, so for this driver rk_98090_headset_init is called before rk_init and then the kernel oops due a NULL pointer dereference inside rk_98090_headset_init function since there is a call that tries to access the jack pointer which has not been allocated yet.
This is the call chain that causes the crash:
rk_98090_headset_init -> ts3a227e_enable_jack_detect -> snd_jack_set_key rk_init -> snd_soc_card_jack_new
This patch moves the new jack object creation from rk_init to rk_98090_headset_init function making sure the jack is created before is accessed.
Signed-off-by: Enric Balletbo i Serra enric.balletbo@collabora.com Signed-off-by: Mark Brown broonie@kernel.org
sound/soc/rockchip/rockchip_max98090.c | 50 ++++++++++++++++++---------------- 1 file changed, 27 insertions(+), 23 deletions(-)
diff --git a/sound/soc/rockchip/rockchip_max98090.c b/sound/soc/rockchip/rockchip_max98090.c index 543610282cdb..abb64a553967 100644 --- a/sound/soc/rockchip/rockchip_max98090.c +++ b/sound/soc/rockchip/rockchip_max98090.c @@ -114,43 +114,27 @@ static int rk_aif1_hw_params(struct snd_pcm_substream *substream, return ret; }
-static int rk_init(struct snd_soc_pcm_runtime *runtime) -{
/* Enable Headset and 4 Buttons Jack detection */
return snd_soc_card_jack_new(runtime->card, "Headset Jack",
SND_JACK_HEADSET |
SND_JACK_BTN_0 | SND_JACK_BTN_1 |
SND_JACK_BTN_2 | SND_JACK_BTN_3,
&headset_jack,
headset_jack_pins,
ARRAY_SIZE(headset_jack_pins));
-}
-static int rk_98090_headset_init(struct snd_soc_component *component) -{
return ts3a227e_enable_jack_detect(component, &headset_jack);
-}
static struct snd_soc_ops rk_aif1_ops = { .hw_params = rk_aif1_hw_params, };
-static struct snd_soc_aux_dev rk_98090_headset_dev = {
.name = "Headset Chip",
.init = rk_98090_headset_init,
-};
static struct snd_soc_dai_link rk_dailink = { .name = "max98090", .stream_name = "Audio", .codec_dai_name = "HiFi",
.init = rk_init, .ops = &rk_aif1_ops, /* set max98090 as slave */ .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBS_CFS,
};
+static int rk_98090_headset_init(struct snd_soc_component *component);
+static struct snd_soc_aux_dev rk_98090_headset_dev = {
.name = "Headset Chip",
.init = rk_98090_headset_init,
+};
static struct snd_soc_card snd_soc_card_rk = { .name = "ROCKCHIP-I2S", .owner = THIS_MODULE, @@ -166,6 +150,26 @@ static struct snd_soc_card snd_soc_card_rk = { .num_controls = ARRAY_SIZE(rk_mc_controls), };
+static int rk_98090_headset_init(struct snd_soc_component *component) +{
int ret;
/* Enable Headset and 4 Buttons Jack detection */
ret = snd_soc_card_jack_new(&snd_soc_card_rk, "Headset Jack",
SND_JACK_HEADSET |
SND_JACK_BTN_0 | SND_JACK_BTN_1 |
SND_JACK_BTN_2 | SND_JACK_BTN_3,
&headset_jack,
headset_jack_pins,
ARRAY_SIZE(headset_jack_pins));
if (ret)
return ret;
ret = ts3a227e_enable_jack_detect(component, &headset_jack);
return ret;
+}
static int snd_rk_mc_probe(struct platform_device *pdev) { int ret = 0; -- 2.8.1
On Mon, Jul 04, 2016 at 09:24:12AM +0200, Enric Balletbo Serra wrote:
I just saw that these patches and the others in the patch series were not applied yet. As are fixes and were accepted since middle May, I
No, they are actually applied like the e-mail said - please see my git.
expected see the patches merged in this release cycle, but we're at
In general if you think a fix needs to go in urgently it's best to specifically identify this. If nothing is specifically said and it's not obviously related to something done recently then the tendency will be to assume that the issue was recently introduced and is a fix for a development version.
rc6 so I suppose I'll need to wait to see them merged for 4.8 merge window. Please can you coordinate with Heiko and make sure that these patches were merged before he merges the patches to enable the audio on Veyron? Otherwise we will break Veyron support for a while. I'd really like have audio working on Veyron.
As things stand they'll be merged in the next merge window. They're buried in the middle of a branch with other things so I can't just send the branch as-is. If these new patches you're talking about are going to get merged in the merge window as well so we're presumably mostly fine?
2016-07-04 10:47 GMT+02:00 Mark Brown broonie@kernel.org:
On Mon, Jul 04, 2016 at 09:24:12AM +0200, Enric Balletbo Serra wrote:
I just saw that these patches and the others in the patch series were not applied yet. As are fixes and were accepted since middle May, I
No, they are actually applied like the e-mail said - please see my git.
expected see the patches merged in this release cycle, but we're at
In general if you think a fix needs to go in urgently it's best to specifically identify this. If nothing is specifically said and it's not obviously related to something done recently then the tendency will be to assume that the issue was recently introduced and is a fix for a development version.
rc6 so I suppose I'll need to wait to see them merged for 4.8 merge window. Please can you coordinate with Heiko and make sure that these patches were merged before he merges the patches to enable the audio on Veyron? Otherwise we will break Veyron support for a while. I'd really like have audio working on Veyron.
As things stand they'll be merged in the next merge window. They're buried in the middle of a branch with other things so I can't just send the branch as-is. If these new patches you're talking about are going to get merged in the merge window as well so we're presumably mostly fine?
Yeah it's fine as long as the patches will be merged in next merge window before the rockchip DTS updates.
It's only that I expected see them merged, but probably was only something that I assumed wrongly.
Thanks, Enric
Since commit e409dfbfccf9a49 ("ASoC: dapm: Add a few supply widget sanity checks") the following error is seen:
rockchip-snd-max98090 sound: HiFi <-> ff890000.i2s mapping ok rockchip-snd-max98090 sound: Connecting non-supply widget to supply widget is not supported (Headset Mic -> MICBIAS) rockchip-snd-max98090 sound: ASoC: no dapm match for Headset Mic --> (null) --> MICBIAS rockchip-snd-max98090 sound: ASoC: Failed to add route Headset Mic -> direct -> MICBIAS input: ROCKCHIP-I2S Headset Jack as /devices/platform/sound/sound/card0/input3
Invert the route between the Headset Mic and the bias in order to fix it.
Signed-off-by: Enric Balletbo i Serra enric.balletbo@collabora.com --- sound/soc/rockchip/rockchip_max98090.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sound/soc/rockchip/rockchip_max98090.c b/sound/soc/rockchip/rockchip_max98090.c index abb64a5..3da7891 100644 --- a/sound/soc/rockchip/rockchip_max98090.c +++ b/sound/soc/rockchip/rockchip_max98090.c @@ -53,7 +53,7 @@ static const struct snd_soc_dapm_widget rk_dapm_widgets[] = { static const struct snd_soc_dapm_route rk_audio_map[] = { {"IN34", NULL, "Headset Mic"}, {"IN34", NULL, "MICBIAS"}, - {"MICBIAS", NULL, "Headset Mic"}, + {"Headset Mic", NULL, "MICBIAS"}, {"DMICL", NULL, "Int Mic"}, {"Headphone", NULL, "HPL"}, {"Headphone", NULL, "HPR"},
On Thu, May 05, 2016 at 10:03:38AM +0200, Enric Balletbo i Serra wrote:
Since commit e409dfbfccf9a49 ("ASoC: dapm: Add a few supply widget sanity checks") the following error is seen:
rockchip-snd-max98090 sound: Connecting non-supply widget to supply widget is not supported (Headset Mic -> MICBIAS) rockchip-snd-max98090 sound: ASoC: no dapm match for Headset Mic --> (null) --> MICBIAS rockchip-snd-max98090 sound: ASoC: Failed to add route Headset Mic -> direct -> MICBIAS input: ROCKCHIP-I2S Headset Jack as /devices/platform/sound/sound/card0/input3
Invert the route between the Headset Mic and the bias in order to fix it.
This isn't just noise, this is telling you that the route has always been broken...
The patch
ASoC: rockchip-max98090: Fix the Headset Mic route.
has been applied to the asoc tree at
git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git
All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying to this mail.
Thanks, Mark
From 570204232a9578e5d098e7ad0c0cde0b59d30089 Mon Sep 17 00:00:00 2001
From: Enric Balletbo i Serra enric.balletbo@collabora.com Date: Mon, 9 May 2016 12:46:32 +0200 Subject: [PATCH] ASoC: rockchip-max98090: Fix the Headset Mic route.
The path Headset Mic --> MICBIAS is wrong because connects a non-supply widget as a source with a supply widget as a sink. It's the other way around:
MICBIAS (source) --> Headset Mic (sink).
This patch also shut up the following error message:
rockchip-snd-max98090 sound: Connecting non-supply widget to supply widget is not supported (Headset Mic -> MICBIAS) rockchip-snd-max98090 sound: ASoC: no dapm match for Headset Mic --> (null) --> MICBIAS rockchip-snd-max98090 sound: ASoC: Failed to add route Headset Mic -> direct -> MICBIAS
Signed-off-by: Enric Balletbo i Serra enric.balletbo@collabora.com Signed-off-by: Mark Brown broonie@kernel.org --- sound/soc/rockchip/rockchip_max98090.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sound/soc/rockchip/rockchip_max98090.c b/sound/soc/rockchip/rockchip_max98090.c index abb64a553967..3da7891b7dfb 100644 --- a/sound/soc/rockchip/rockchip_max98090.c +++ b/sound/soc/rockchip/rockchip_max98090.c @@ -53,7 +53,7 @@ static const struct snd_soc_dapm_widget rk_dapm_widgets[] = { static const struct snd_soc_dapm_route rk_audio_map[] = { {"IN34", NULL, "Headset Mic"}, {"IN34", NULL, "MICBIAS"}, - {"MICBIAS", NULL, "Headset Mic"}, + {"Headset Mic", NULL, "MICBIAS"}, {"DMICL", NULL, "Int Mic"}, {"Headphone", NULL, "HPL"}, {"Headphone", NULL, "HPR"},
The patch fixes the following error message.
rockchip-snd-max98090 sound: ASoC: DAPM unknown pin Headset Jack
Signed-off-by: Enric Balletbo i Serra enric.balletbo@collabora.com --- sound/soc/rockchip/rockchip_max98090.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sound/soc/rockchip/rockchip_max98090.c b/sound/soc/rockchip/rockchip_max98090.c index 3da7891..40d2ec9 100644 --- a/sound/soc/rockchip/rockchip_max98090.c +++ b/sound/soc/rockchip/rockchip_max98090.c @@ -36,7 +36,7 @@ static struct snd_soc_jack headset_jack; static struct snd_soc_jack_pin headset_jack_pins[] = { { - .pin = "Headset Jack", + .pin = "Headphone", .mask = SND_JACK_HEADPHONE | SND_JACK_MICROPHONE | SND_JACK_BTN_0 | SND_JACK_BTN_1 | SND_JACK_BTN_2 | SND_JACK_BTN_3,
On Thu, May 05, 2016 at 10:03:39AM +0200, Enric Balletbo i Serra wrote:
The patch fixes the following error message.
rockchip-snd-max98090 sound: ASoC: DAPM unknown pin Headset Jack
{
.pin = "Headset Jack",
.pin = "Headphone",
...and makes automatic DAPM management of the headphone jack work. Again, it's not just shutting up warnings it's fixing an actual bug.
Set i2s block to "okay", add sound node for max98090 with gpios for HP and Mic detect and pinctrl, and add a max98090 device and ts3a227e to the correct i2c bus.
Signed-off-by: Enric Balletbo i Serra enric.balletbo@collabora.com --- arch/arm/boot/dts/rk3288-veyron-analog-audio.dtsi | 102 ++++++++++++++++++++++ 1 file changed, 102 insertions(+) create mode 100644 arch/arm/boot/dts/rk3288-veyron-analog-audio.dtsi
diff --git a/arch/arm/boot/dts/rk3288-veyron-analog-audio.dtsi b/arch/arm/boot/dts/rk3288-veyron-analog-audio.dtsi new file mode 100644 index 0000000..f045e1a --- /dev/null +++ b/arch/arm/boot/dts/rk3288-veyron-analog-audio.dtsi @@ -0,0 +1,102 @@ +/* + * Google Veyron (and derivatives) fragment for the max98090 audio + * codec and analog headphone jack. + * + * Copyright 2016 Google, Inc + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + */ + +/ { + + sound { + compatible = "rockchip,rockchip-audio-max98090"; + rockchip,model = "ROCKCHIP-I2S"; + rockchip,i2s-controller = <&i2s>; + rockchip,audio-codec = <&max98090>; + rockchip,hp-det-gpios = <&gpio6 5 GPIO_ACTIVE_HIGH>; + rockchip,mic-det-gpios = <&gpio6 11 GPIO_ACTIVE_LOW>; + rockchip,headset-codec = <&headsetcodec>; + pinctrl-names = "default"; + pinctrl-0 = <&mic_det>, <&hp_det>; + }; + + io-domains { + audio-supply = <&vcc18_codec>; + }; +}; + +&rk808 { + vcc10-supply = <&vcc33_sys>; + + regulators { + vcc18_codec: LDO_REG6 { + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <1800000>; + regulator-name = "vcc18_codec"; + regulator-suspend-mem-disabled; + }; + }; +}; + +&i2c2 { + max98090: max98090@10 { + compatible = "maxim,max98090"; + reg = <0x10>; + clock-names = "mclk"; + clocks = <&cru SCLK_I2S0_OUT>; + interrupt-parent = <&gpio6>; + interrupts = <7 IRQ_TYPE_EDGE_FALLING>; + pinctrl-names = "default"; + pinctrl-0 = <&int_codec>; + }; +}; + +&i2c4 { + headsetcodec: ts3a227e@3b { + compatible = "ti,ts3a227e"; + reg = <0x3b>; + interrupt-parent = <&gpio0>; + interrupts = <3 IRQ_TYPE_LEVEL_LOW>; + pinctrl-names = "default"; + pinctrl-0 = <&ts3a227e_int_l>; + ti,micbias = <7>; /* MICBIAS = 2.8V */ + }; +}; + +&i2s { + status = "okay"; + clock-names = "i2s_hclk", "i2s_clk"; + clocks = <&cru HCLK_I2S0>, <&cru SCLK_I2S0>; +}; + +&pinctrl { + codec { + hp_det: hp-det { + rockchip,pins = <6 5 RK_FUNC_GPIO &pcfg_pull_up>; + }; + + /* + * HACK: We're going to _pull down_ this _active low_ interrupt + * so that it never fires. We don't need this interrupt because + * we've got a ts3a227e chip but the driver requires it. + */ + int_codec: int-codec { + rockchip,pins = <6 7 RK_FUNC_GPIO &pcfg_pull_down>; + }; + + mic_det: mic-det { + rockchip,pins = <6 11 RK_FUNC_GPIO &pcfg_pull_up>; + }; + }; + + headset { + ts3a227e_int_l: ts3a227e-int-l { + rockchip,pins = <0 3 RK_FUNC_GPIO &pcfg_pull_up>; + }; + }; +};
Add analog-audio functionality for Veyron devices.
Signed-off-by: Enric Balletbo i Serra enric.balletbo@collabora.com --- arch/arm/boot/dts/rk3288-veyron-chromebook.dtsi | 1 + 1 file changed, 1 insertion(+)
diff --git a/arch/arm/boot/dts/rk3288-veyron-chromebook.dtsi b/arch/arm/boot/dts/rk3288-veyron-chromebook.dtsi index 610769d..e25bb1a 100644 --- a/arch/arm/boot/dts/rk3288-veyron-chromebook.dtsi +++ b/arch/arm/boot/dts/rk3288-veyron-chromebook.dtsi @@ -46,6 +46,7 @@ #include <dt-bindings/clock/rockchip,rk808.h> #include <dt-bindings/input/input.h> #include "rk3288-veyron.dtsi" +#include "rk3288-veyron-analog-audio.dtsi" #include "rk3288-veyron-sdmmc.dtsi"
/ {
participants (3)
-
Enric Balletbo i Serra
-
Enric Balletbo Serra
-
Mark Brown