linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/5] ASoC: rockchip: Fix audio on Veyron.
@ 2016-05-09 10:46 Enric Balletbo i Serra
  2016-05-09 10:46 ` [PATCH v2 1/5] ASoC: rockchip-max98090: Fix NULL pointer dereference while accessing to jack Enric Balletbo i Serra
                   ` (4 more replies)
  0 siblings, 5 replies; 12+ messages in thread
From: Enric Balletbo i Serra @ 2016-05-09 10:46 UTC (permalink / raw)
  To: linux-kernel, linux-rockchip, alsa-devel; +Cc: Mark Brown, Heiko Stuebner

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 from 1/5 to 3/5 should go through the Mark Brown ASoC tree.

Patches 4/5 and 5/5 should go through the Heiko Stuebner rockchip tree.

Changes since v1:
 - Improve log messages trying to explain better the issues (suggested by Mark Brown)
 - Remove patches from John Keeping as are already cherry-picked.
   - https://git.kernel.org/cgit/linux/kernel/git/broonie/sound.git/commit/?h=for-next&id=a6e806c49e3265494ac6fe6ec88ed5c010652e0d
   - https://git.kernel.org/cgit/linux/kernel/git/broonie/sound.git/commit/?h=for-next&id=7e885d211f023dfd201fad8246bbf3c3bd126c61

Enric Balletbo i Serra (5):
  ASoC: rockchip-max98090: Fix NULL pointer dereference while accessing
    to jack.
  ASoC: rockchip-max98090: Fix the Headset Mic route.
  ASoC: rockchip-max98090: Fix jack detection and event reporting.
  ARM: dts: rockchip: Add shared file for audio related nodes for veyron
    boards
  ARM: dts: rockchip: veyron: Add analog audio codecs.

 arch/arm/boot/dts/rk3288-veyron-analog-audio.dtsi | 102 ++++++++++++++++++++++
 arch/arm/boot/dts/rk3288-veyron-chromebook.dtsi   |   1 +
 sound/soc/rockchip/rockchip_max98090.c            |  65 ++++++++------
 3 files changed, 140 insertions(+), 28 deletions(-)
 create mode 100644 arch/arm/boot/dts/rk3288-veyron-analog-audio.dtsi

-- 
2.1.0

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [PATCH v2 1/5] ASoC: rockchip-max98090: Fix NULL pointer dereference while accessing to jack.
  2016-05-09 10:46 [PATCH v2 0/5] ASoC: rockchip: Fix audio on Veyron Enric Balletbo i Serra
@ 2016-05-09 10:46 ` Enric Balletbo i Serra
  2016-05-09 10:46 ` [PATCH v2 2/5] ASoC: rockchip-max98090: Fix the Headset Mic route Enric Balletbo i Serra
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 12+ messages in thread
From: Enric Balletbo i Serra @ 2016-05-09 10:46 UTC (permalink / raw)
  To: linux-kernel, linux-rockchip, alsa-devel; +Cc: Mark Brown, Heiko Stuebner

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>
---
Changes since v1:
 - Improve log message.

 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;
-- 
2.1.0

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH v2 2/5] ASoC: rockchip-max98090: Fix the Headset Mic route.
  2016-05-09 10:46 [PATCH v2 0/5] ASoC: rockchip: Fix audio on Veyron Enric Balletbo i Serra
  2016-05-09 10:46 ` [PATCH v2 1/5] ASoC: rockchip-max98090: Fix NULL pointer dereference while accessing to jack Enric Balletbo i Serra
@ 2016-05-09 10:46 ` Enric Balletbo i Serra
  2016-05-09 10:46 ` [PATCH v2 3/5] ASoC: rockchip-max98090: Fix jack detection and event reporting Enric Balletbo i Serra
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 12+ messages in thread
From: Enric Balletbo i Serra @ 2016-05-09 10:46 UTC (permalink / raw)
  To: linux-kernel, linux-rockchip, alsa-devel; +Cc: Mark Brown, Heiko Stuebner

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>
---
Changes since v1:
 - Improve log message.

 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"},
-- 
2.1.0

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH v2 3/5] ASoC: rockchip-max98090: Fix jack detection and event reporting.
  2016-05-09 10:46 [PATCH v2 0/5] ASoC: rockchip: Fix audio on Veyron Enric Balletbo i Serra
  2016-05-09 10:46 ` [PATCH v2 1/5] ASoC: rockchip-max98090: Fix NULL pointer dereference while accessing to jack Enric Balletbo i Serra
  2016-05-09 10:46 ` [PATCH v2 2/5] ASoC: rockchip-max98090: Fix the Headset Mic route Enric Balletbo i Serra
@ 2016-05-09 10:46 ` Enric Balletbo i Serra
  2016-05-10 18:49   ` Applied "ASoC: rockchip-max98090: Fix jack detection and event reporting." to the asoc tree Mark Brown
  2016-05-09 10:46 ` [PATCH v2 4/5] ARM: dts: rockchip: Add shared file for audio related nodes for veyron boards Enric Balletbo i Serra
  2016-05-09 10:46 ` [PATCH v2 5/5] ARM: dts: rockchip: veyron: Add analog audio codecs Enric Balletbo i Serra
  4 siblings, 1 reply; 12+ messages in thread
From: Enric Balletbo i Serra @ 2016-05-09 10:46 UTC (permalink / raw)
  To: linux-kernel, linux-rockchip, alsa-devel; +Cc: Mark Brown, Heiko Stuebner

Physically there is a jackset which includes a Headphone and a Jackset
Mic pin. The patch add thw two pins with the correct pin name so the
DAPM management can find the pin and make the jack detection and event
reporting work again.

The patch also shut up the following error:

 rockchip-snd-max98090 sound: ASoC: DAPM unknown pin Headset Jack

Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>
---
Changes since v1:
 - Improve log message.
 - Include Headphone and Jackset Mic pins.

 sound/soc/rockchip/rockchip_max98090.c | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/sound/soc/rockchip/rockchip_max98090.c b/sound/soc/rockchip/rockchip_max98090.c
index 3da7891..e70ffad 100644
--- a/sound/soc/rockchip/rockchip_max98090.c
+++ b/sound/soc/rockchip/rockchip_max98090.c
@@ -34,13 +34,18 @@
 #define DRV_NAME "rockchip-snd-max98090"
 
 static struct snd_soc_jack headset_jack;
+
+/* Headset jack detection DAPM pins */
 static struct snd_soc_jack_pin headset_jack_pins[] = {
 	{
-		.pin = "Headset Jack",
-		.mask = SND_JACK_HEADPHONE | SND_JACK_MICROPHONE |
-			SND_JACK_BTN_0 | SND_JACK_BTN_1 |
-			SND_JACK_BTN_2 | SND_JACK_BTN_3,
+		.pin = "Headphone",
+		.mask = SND_JACK_HEADPHONE,
+	},
+	{
+		.pin = "Headset Mic",
+		.mask = SND_JACK_MICROPHONE,
 	},
+
 };
 
 static const struct snd_soc_dapm_widget rk_dapm_widgets[] = {
-- 
2.1.0

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH v2 4/5] ARM: dts: rockchip: Add shared file for audio related nodes for veyron boards
  2016-05-09 10:46 [PATCH v2 0/5] ASoC: rockchip: Fix audio on Veyron Enric Balletbo i Serra
                   ` (2 preceding siblings ...)
  2016-05-09 10:46 ` [PATCH v2 3/5] ASoC: rockchip-max98090: Fix jack detection and event reporting Enric Balletbo i Serra
@ 2016-05-09 10:46 ` Enric Balletbo i Serra
  2016-05-15 22:06   ` Heiko Stuebner
  2016-05-09 10:46 ` [PATCH v2 5/5] ARM: dts: rockchip: veyron: Add analog audio codecs Enric Balletbo i Serra
  4 siblings, 1 reply; 12+ messages in thread
From: Enric Balletbo i Serra @ 2016-05-09 10:46 UTC (permalink / raw)
  To: linux-kernel, linux-rockchip, alsa-devel; +Cc: Mark Brown, Heiko Stuebner

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>
---
Changes since v1:
 - None

 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>;
+		};
+	};
+};
-- 
2.1.0

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH v2 5/5] ARM: dts: rockchip: veyron: Add analog audio codecs.
  2016-05-09 10:46 [PATCH v2 0/5] ASoC: rockchip: Fix audio on Veyron Enric Balletbo i Serra
                   ` (3 preceding siblings ...)
  2016-05-09 10:46 ` [PATCH v2 4/5] ARM: dts: rockchip: Add shared file for audio related nodes for veyron boards Enric Balletbo i Serra
@ 2016-05-09 10:46 ` Enric Balletbo i Serra
  2016-05-15 22:06   ` Heiko Stuebner
  4 siblings, 1 reply; 12+ messages in thread
From: Enric Balletbo i Serra @ 2016-05-09 10:46 UTC (permalink / raw)
  To: linux-kernel, linux-rockchip, alsa-devel; +Cc: Mark Brown, Heiko Stuebner

Add analog-audio functionality for Veyron devices.

Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>
---
Changes since v1:
 - None

 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"
 
 / {
-- 
2.1.0

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* Applied "ASoC: rockchip-max98090: Fix jack detection and event reporting." to the asoc tree
  2016-05-09 10:46 ` [PATCH v2 3/5] ASoC: rockchip-max98090: Fix jack detection and event reporting Enric Balletbo i Serra
@ 2016-05-10 18:49   ` Mark Brown
  0 siblings, 0 replies; 12+ messages in thread
From: Mark Brown @ 2016-05-10 18:49 UTC (permalink / raw)
  To: Enric Balletbo i Serra
  Cc: Mark Brown, linux-kernel, linux-rockchip, alsa-devel, Mark Brown,
	Heiko Stuebner

The patch

   ASoC: rockchip-max98090: Fix jack detection and event reporting.

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 525aba92762666aa6fa56e1b92e7d4959bda426a Mon Sep 17 00:00:00 2001
From: Enric Balletbo i Serra <enric.balletbo@collabora.com>
Date: Mon, 9 May 2016 12:46:33 +0200
Subject: [PATCH] ASoC: rockchip-max98090: Fix jack detection and event
 reporting.

Physically there is a jackset which includes a Headphone and a Jackset
Mic pin. The patch add thw two pins with the correct pin name so the
DAPM management can find the pin and make the jack detection and event
reporting work again.

The patch also shut up the following error:

 rockchip-snd-max98090 sound: ASoC: DAPM unknown pin Headset Jack

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 | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/sound/soc/rockchip/rockchip_max98090.c b/sound/soc/rockchip/rockchip_max98090.c
index 3da7891b7dfb..e70ffad07184 100644
--- a/sound/soc/rockchip/rockchip_max98090.c
+++ b/sound/soc/rockchip/rockchip_max98090.c
@@ -34,13 +34,18 @@
 #define DRV_NAME "rockchip-snd-max98090"
 
 static struct snd_soc_jack headset_jack;
+
+/* Headset jack detection DAPM pins */
 static struct snd_soc_jack_pin headset_jack_pins[] = {
 	{
-		.pin = "Headset Jack",
-		.mask = SND_JACK_HEADPHONE | SND_JACK_MICROPHONE |
-			SND_JACK_BTN_0 | SND_JACK_BTN_1 |
-			SND_JACK_BTN_2 | SND_JACK_BTN_3,
+		.pin = "Headphone",
+		.mask = SND_JACK_HEADPHONE,
+	},
+	{
+		.pin = "Headset Mic",
+		.mask = SND_JACK_MICROPHONE,
 	},
+
 };
 
 static const struct snd_soc_dapm_widget rk_dapm_widgets[] = {
-- 
2.8.1

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* Re: [PATCH v2 4/5] ARM: dts: rockchip: Add shared file for audio related nodes for veyron boards
  2016-05-09 10:46 ` [PATCH v2 4/5] ARM: dts: rockchip: Add shared file for audio related nodes for veyron boards Enric Balletbo i Serra
@ 2016-05-15 22:06   ` Heiko Stuebner
  2016-05-17  8:14     ` [alsa-devel] " Enric Balletbo Serra
  0 siblings, 1 reply; 12+ messages in thread
From: Heiko Stuebner @ 2016-05-15 22:06 UTC (permalink / raw)
  To: Enric Balletbo i Serra
  Cc: linux-kernel, linux-rockchip, alsa-devel, Mark Brown

Am Montag, 9. Mai 2016, 12:46:34 schrieb Enric Balletbo i Serra:
> 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>

I only got a "applied" reply from Marks scripts for patch 3/5, so only today
saw that all 3 actually got applied.

Anyway, I've applied this to my dts32-branch for 4.8 now [0] with some
modifications regarding
- the commit subject+message
- ordering
- io_domains access (via the phandle now)
- regulator suspend property
so maybe take a look and holler if you see a mistake.

I was able to get audio over the headphones (so definitly an improvement),
but so far not over the built-in speakers. Did you need to do something
special in the configuration for this?


Heiko

[0] https://git.kernel.org/cgit/linux/kernel/git/mmind/linux-rockchip.git/commit/?h=volatile-v4.8-armsoc/dts32&id=1452aee5a7acc03518ef5215dd3dbac4444efe52

> ---
> Changes since v1:
>  - None
> 
>  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>;
> +		};
> +	};
> +};

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH v2 5/5] ARM: dts: rockchip: veyron: Add analog audio codecs.
  2016-05-09 10:46 ` [PATCH v2 5/5] ARM: dts: rockchip: veyron: Add analog audio codecs Enric Balletbo i Serra
@ 2016-05-15 22:06   ` Heiko Stuebner
  0 siblings, 0 replies; 12+ messages in thread
From: Heiko Stuebner @ 2016-05-15 22:06 UTC (permalink / raw)
  To: Enric Balletbo i Serra
  Cc: linux-kernel, linux-rockchip, alsa-devel, Mark Brown

Am Montag, 9. Mai 2016, 12:46:35 schrieb Enric Balletbo i Serra:
> Add analog-audio functionality for Veyron devices.
> 
> Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>

applied for 4.8


Thanks
Heiko

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [alsa-devel] [PATCH v2 4/5] ARM: dts: rockchip: Add shared file for audio related nodes for veyron boards
  2016-05-15 22:06   ` Heiko Stuebner
@ 2016-05-17  8:14     ` Enric Balletbo Serra
  2016-05-17  9:36       ` Heiko Stuebner
  0 siblings, 1 reply; 12+ messages in thread
From: Enric Balletbo Serra @ 2016-05-17  8:14 UTC (permalink / raw)
  To: Heiko Stuebner
  Cc: Enric Balletbo i Serra, linux-rockchip, alsa-devel, Mark Brown,
	linux-kernel

Hi Heiko,

2016-05-16 0:06 GMT+02:00 Heiko Stuebner <heiko@sntech.de>:
> Am Montag, 9. Mai 2016, 12:46:34 schrieb Enric Balletbo i Serra:
>> 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>
>
> I only got a "applied" reply from Marks scripts for patch 3/5, so only today
> saw that all 3 actually got applied.
>
> Anyway, I've applied this to my dts32-branch for 4.8 now [0] with some
> modifications regarding
> - the commit subject+message
> - ordering
> - io_domains access (via the phandle now)
> - regulator suspend property
> so maybe take a look and holler if you see a mistake.
>

The changes looks good to me, thanks.

> I was able to get audio over the headphones (so definitly an improvement),
> but so far not over the built-in speakers. Did you need to do something
> special in the configuration for this?
>

I added an UCM file [1] to my setup to test this and tested as follows
(you can also use alsamixer but as you know this is not safe though ;)
)

# enable the speaker at bootup:
alsaucm -c ROCKCHIP-I2S set _verb HiFi
# set speaker to half loudness:
amixer set Speaker 50%
# play something
aplay music.wav
# enable headphones (disable speaker):
alsaucm -c ROCKCHIP-I2S set _verb HiFi set _enadev Headphone
# set headphones to half loudness:
amixer set Headphone 50%
# play something
aplay music.wav
# disable headphones (enable speaker):
alsaucm -c ROCKCHIP-I2S set _verb HiFi set _disdev Headphone


[1] http://git.alsa-project.org/?p=alsa-lib.git;a=commit;h=a192f52fc63a86e1fbb9a09adb0bc2a6bbc8dab1

>
> Heiko
>
> [0] https://git.kernel.org/cgit/linux/kernel/git/mmind/linux-rockchip.git/commit/?h=volatile-v4.8-armsoc/dts32&id=1452aee5a7acc03518ef5215dd3dbac4444efe52
>
>> ---
>> Changes since v1:
>>  - None
>>
>>  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>;
>> +             };
>> +     };
>> +};
>
> _______________________________________________
> Alsa-devel mailing list
> Alsa-devel@alsa-project.org
> http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [alsa-devel] [PATCH v2 4/5] ARM: dts: rockchip: Add shared file for audio related nodes for veyron boards
  2016-05-17  8:14     ` [alsa-devel] " Enric Balletbo Serra
@ 2016-05-17  9:36       ` Heiko Stuebner
  2016-05-17 13:30         ` Heiko Stuebner
  0 siblings, 1 reply; 12+ messages in thread
From: Heiko Stuebner @ 2016-05-17  9:36 UTC (permalink / raw)
  To: Enric Balletbo Serra
  Cc: Enric Balletbo i Serra, linux-rockchip, alsa-devel, Mark Brown,
	linux-kernel

Am Dienstag, 17. Mai 2016, 10:14:55 schrieb Enric Balletbo Serra:
> Hi Heiko,
> 
> 2016-05-16 0:06 GMT+02:00 Heiko Stuebner <heiko@sntech.de>:
> > Am Montag, 9. Mai 2016, 12:46:34 schrieb Enric Balletbo i Serra:
> >> 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>
> > 
> > I only got a "applied" reply from Marks scripts for patch 3/5, so only
> > today saw that all 3 actually got applied.
> > 
> > Anyway, I've applied this to my dts32-branch for 4.8 now [0] with some
> > modifications regarding
> > - the commit subject+message
> > - ordering
> > - io_domains access (via the phandle now)
> > - regulator suspend property
> > so maybe take a look and holler if you see a mistake.
> 
> The changes looks good to me, thanks.
> 
> > I was able to get audio over the headphones (so definitly an
> > improvement), but so far not over the built-in speakers. Did you need
> > to do something special in the configuration for this?
> 
> I added an UCM file [1] to my setup to test this and tested as follows
> (you can also use alsamixer but as you know this is not safe though ;)
> )
> 
> # enable the speaker at bootup:
> alsaucm -c ROCKCHIP-I2S set _verb HiFi
> # set speaker to half loudness:
> amixer set Speaker 50%
> # play something
> aplay music.wav
> # enable headphones (disable speaker):
> alsaucm -c ROCKCHIP-I2S set _verb HiFi set _enadev Headphone
> # set headphones to half loudness:
> amixer set Headphone 50%
> # play something
> aplay music.wav
> # disable headphones (enable speaker):
> alsaucm -c ROCKCHIP-I2S set _verb HiFi set _disdev Headphone

woohoo ... sound on the speakers :-D

Thanks for the hints
Heiko

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [alsa-devel] [PATCH v2 4/5] ARM: dts: rockchip: Add shared file for audio related nodes for veyron boards
  2016-05-17  9:36       ` Heiko Stuebner
@ 2016-05-17 13:30         ` Heiko Stuebner
  0 siblings, 0 replies; 12+ messages in thread
From: Heiko Stuebner @ 2016-05-17 13:30 UTC (permalink / raw)
  To: Enric Balletbo Serra, Enric Balletbo i Serra
  Cc: linux-rockchip, alsa-devel, Mark Brown, linux-kernel

Am Dienstag, 17. Mai 2016, 11:36:23 schrieb Heiko Stuebner:
> Am Dienstag, 17. Mai 2016, 10:14:55 schrieb Enric Balletbo Serra:
> > Hi Heiko,
> > 
> > 2016-05-16 0:06 GMT+02:00 Heiko Stuebner <heiko@sntech.de>:
> > > Am Montag, 9. Mai 2016, 12:46:34 schrieb Enric Balletbo i Serra:
> > >> 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>
> > > 
> > > I only got a "applied" reply from Marks scripts for patch 3/5, so only
> > > today saw that all 3 actually got applied.
> > > 
> > > Anyway, I've applied this to my dts32-branch for 4.8 now [0] with some
> > > modifications regarding
> > > - the commit subject+message
> > > - ordering
> > > - io_domains access (via the phandle now)
> > > - regulator suspend property
> > > so maybe take a look and holler if you see a mistake.
> > 
> > The changes looks good to me, thanks.
> > 
> > > I was able to get audio over the headphones (so definitly an
> > > improvement), but so far not over the built-in speakers. Did you need
> > > to do something special in the configuration for this?
> > 
> > I added an UCM file [1] to my setup to test this and tested as follows
> > (you can also use alsamixer but as you know this is not safe though ;)
> > )
> > 
> > # enable the speaker at bootup:
> > alsaucm -c ROCKCHIP-I2S set _verb HiFi
> > # set speaker to half loudness:
> > amixer set Speaker 50%
> > # play something
> > aplay music.wav
> > # enable headphones (disable speaker):
> > alsaucm -c ROCKCHIP-I2S set _verb HiFi set _enadev Headphone
> > # set headphones to half loudness:
> > amixer set Headphone 50%
> > # play something
> > aplay music.wav
> > # disable headphones (enable speaker):
> > alsaucm -c ROCKCHIP-I2S set _verb HiFi set _disdev Headphone
> 
> woohoo ... sound on the speakers :-D

one thing I'm not sure about is the naming though.

The ucm profiles most likely are board-specific and looking at the other alsa 
ucm subdirs, they really are named after their boards (like daisy-i2s for 
some exynos chromebooks). Hogging ROCKCHIP-I2S for veyron chromebooks seems 
wrong especially wrt. other Rockchip devices. Shouldn't this be named 
VEYRON-I2S or so instead - same on the kernel side probably.


Heiko

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2016-05-17 13:30 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-05-09 10:46 [PATCH v2 0/5] ASoC: rockchip: Fix audio on Veyron Enric Balletbo i Serra
2016-05-09 10:46 ` [PATCH v2 1/5] ASoC: rockchip-max98090: Fix NULL pointer dereference while accessing to jack Enric Balletbo i Serra
2016-05-09 10:46 ` [PATCH v2 2/5] ASoC: rockchip-max98090: Fix the Headset Mic route Enric Balletbo i Serra
2016-05-09 10:46 ` [PATCH v2 3/5] ASoC: rockchip-max98090: Fix jack detection and event reporting Enric Balletbo i Serra
2016-05-10 18:49   ` Applied "ASoC: rockchip-max98090: Fix jack detection and event reporting." to the asoc tree Mark Brown
2016-05-09 10:46 ` [PATCH v2 4/5] ARM: dts: rockchip: Add shared file for audio related nodes for veyron boards Enric Balletbo i Serra
2016-05-15 22:06   ` Heiko Stuebner
2016-05-17  8:14     ` [alsa-devel] " Enric Balletbo Serra
2016-05-17  9:36       ` Heiko Stuebner
2016-05-17 13:30         ` Heiko Stuebner
2016-05-09 10:46 ` [PATCH v2 5/5] ARM: dts: rockchip: veyron: Add analog audio codecs Enric Balletbo i Serra
2016-05-15 22:06   ` Heiko Stuebner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).