lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date:   Thu, 22 Sep 2016 23:50:44 +0300
From:   Nikita Yushchenko <nikita.yoush@...entembedded.com>
To:     Liam Girdwood <lgirdwood@...il.com>,
        Mark Brown <broonie@...nel.org>,
        Rob Herring <robh+dt@...nel.org>,
        Mark Rutland <mark.rutland@....com>,
        Jaroslav Kysela <perex@...ex.cz>,
        Takashi Iwai <tiwai@...e.com>,
        Otto Kekäläinen <otto@...avo.fi>,
        Kuninori Morimoto <kuninori.morimoto.gx@...esas.com>,
        Mengdong Lin <mengdong.lin@...ux.intel.com>,
        Aaro Koskinen <aaro.koskinen@....fi>,
        Andrew Lunn <andrew@...n.ch>,
        Peter Ujfalusi <peter.ujfalusi@...com>,
        alsa-devel@...a-project.org, devicetree@...r.kernel.org,
        linux-kernel@...r.kernel.org
Cc:     Chris Healy <cphealy@...il.com>,
        Nikita Yushchenko <nikita.yoush@...entembedded.com>
Subject: [PATCH] ASoC: simple-card: add support for aux devices

This patch makes it possible to use simple-card in setups where separate
amplifier chip is connected to codec's output.

Example usage:

	codec: tlv320dac3100@18 {
		compatible = "ti,tlv320dac3100";
		...
	}

	amp: tpa6130a2@60 {
		compatible = "ti,tpa6130a2";
		...
	}

	sound {
		compatible = "simple-audio-card";
		...
		simple-audio-card,widgets =
			"Headphone", "Headphone Jack";
		simple-audio-card,routing =
			"Headphone Jack", "HPLEFT",
			"Headphone Jack", "HPRIGHT",
			"LEFTIN", "HPL",
			"RIGHTIN", "HPR";
		simple-audio-card,aux-devs = <&amp>;
		simple-audio-card,cpu {
			sound-dai = <&ssi2>;
		};
		simple-audio-card,codec {
			sound-dai = <&codec1>;
			clocks = ...
		};

This describes audio path from IMX6 SSI2 through TLV320DAC3100 codec
through TPA6130A2 amplifier to headphones.

Signed-off-by: Nikita Yushchenko <nikita.yoush@...entembedded.com>
---
 .../devicetree/bindings/sound/simple-card.txt      |  2 ++
 sound/soc/generic/simple-card.c                    | 34 ++++++++++++++++++++++
 2 files changed, 36 insertions(+)

diff --git a/Documentation/devicetree/bindings/sound/simple-card.txt b/Documentation/devicetree/bindings/sound/simple-card.txt
index 59d8628..5579f40 100644
--- a/Documentation/devicetree/bindings/sound/simple-card.txt
+++ b/Documentation/devicetree/bindings/sound/simple-card.txt
@@ -22,6 +22,8 @@ Optional properties:
 					  headphones are attached.
 - simple-audio-card,mic-det-gpio	: Reference to GPIO that signals when
 					  a microphone is attached.
+- simple-audio-card,aux-devs		: List of phandles pointing to auxiliary devices, such
+					  as amplifiers, to be added to the sound card.
 
 Optional subnodes:
 
diff --git a/sound/soc/generic/simple-card.c b/sound/soc/generic/simple-card.c
index 43295f0..f989f34 100644
--- a/sound/soc/generic/simple-card.c
+++ b/sound/soc/generic/simple-card.c
@@ -417,6 +417,36 @@ dai_link_of_err:
 	return ret;
 }
 
+static int asoc_simple_card_parse_aux_devs(struct device_node *node,
+					   struct simple_card_data *priv)
+{
+	struct device *dev = simple_priv_to_dev(priv);
+	struct device_node *aux_node;
+	int i, n, len;
+
+	if (!of_find_property(node, PREFIX "aux-devs", &len))
+		return 0;		/* Ok to have no aux-devs */
+
+	n = len / sizeof(__be32);
+	if (n <= 0)
+		return -EINVAL;
+
+	priv->snd_card.aux_dev = devm_kzalloc(dev,
+			n * sizeof(*priv->snd_card.aux_dev), GFP_KERNEL);
+	if (!priv->snd_card.aux_dev)
+		return -ENOMEM;
+
+	for (i = 0; i < n; i++) {
+		aux_node = of_parse_phandle(node, PREFIX "aux-devs", i);
+		if (!aux_node)
+			return -EINVAL;
+		priv->snd_card.aux_dev[i].codec_of_node = aux_node;
+	}
+
+	priv->snd_card.num_aux_devs = n;
+	return 0;
+}
+
 static int asoc_simple_card_parse_of(struct device_node *node,
 				     struct simple_card_data *priv)
 {
@@ -474,6 +504,10 @@ static int asoc_simple_card_parse_of(struct device_node *node,
 	if (ret)
 		return ret;
 
+	ret = asoc_simple_card_parse_aux_devs(node, priv);
+	if (ret)
+		return ret;
+
 	return 0;
 }
 
-- 
2.1.4

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ