From patchwork Tue Jan 12 15:38:16 2016
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
X-Patchwork-Submitter: Philipp Zabel
X-Patchwork-Id: 8018891
Return-Path:
X-Original-To: patchwork-alsa-devel@patchwork.kernel.org
Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org
Received: from mail.kernel.org (mail.kernel.org [198.145.29.136])
by patchwork2.web.kernel.org (Postfix) with ESMTP id 6E475BEEE5
for ;
Tue, 12 Jan 2016 15:42:17 +0000 (UTC)
Received: from mail.kernel.org (localhost [127.0.0.1])
by mail.kernel.org (Postfix) with ESMTP id 9CC5B203DA
for ;
Tue, 12 Jan 2016 15:42:16 +0000 (UTC)
Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243])
by mail.kernel.org (Postfix) with ESMTP id C2A1C20295
for ;
Tue, 12 Jan 2016 15:42:10 +0000 (UTC)
Received: by alsa0.perex.cz (Postfix, from userid 1000)
id EE257265743; Tue, 12 Jan 2016 16:42:09 +0100 (CET)
X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org
X-Spam-Level:
X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_NONE,
UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1
Received: from alsa0.perex.cz (localhost [127.0.0.1])
by alsa0.perex.cz (Postfix) with ESMTP id A7F5E2605FF;
Tue, 12 Jan 2016 16:39:07 +0100 (CET)
X-Original-To: alsa-devel@alsa-project.org
Delivered-To: alsa-devel@alsa-project.org
Received: by alsa0.perex.cz (Postfix, from userid 1000)
id 707992605FF; Tue, 12 Jan 2016 16:39:05 +0100 (CET)
Received: from metis.ext.4.pengutronix.de (metis.ext.4.pengutronix.de
[92.198.50.35]) by alsa0.perex.cz (Postfix) with ESMTP id 50735260417
for ;
Tue, 12 Jan 2016 16:38:33 +0100 (CET)
Received: from dude.hi.pengutronix.de ([2001:67c:670:100:1d::7]
helo=dude.pengutronix.de.)
by metis.ext.pengutronix.de with esmtp (Exim 4.80)
(envelope-from )
id 1aJ11l-0002XK-14; Tue, 12 Jan 2016 16:38:33 +0100
From: Philipp Zabel
To: alsa-devel@alsa-project.org
Date: Tue, 12 Jan 2016 16:38:16 +0100
Message-Id: <1452613096-8116-8-git-send-email-p.zabel@pengutronix.de>
X-Mailer: git-send-email 2.6.4
In-Reply-To: <1452613096-8116-1-git-send-email-p.zabel@pengutronix.de>
References: <1452613096-8116-1-git-send-email-p.zabel@pengutronix.de>
X-SA-Exim-Connect-IP: 2001:67c:670:100:1d::7
X-SA-Exim-Mail-From: p.zabel@pengutronix.de
X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de);
SAEximRunCond expanded to false
X-PTX-Original-Recipient: alsa-devel@alsa-project.org
Cc: Jean-Francois Moine , Koro Chen ,
Lars-Peter Clausen ,
Russell King - ARM Linux ,
Philipp Zabel ,
Arnaud Pouliquen ,
Liam Girdwood , Jyri Sarha ,
Cawa Cheng , Mark Brown ,
linux-mediatek@lists.infradead.org, Daniel Kurtz ,
kernel@pengutronix.de, Matthias Brugger
Subject: [alsa-devel] [RFC v3 7/7] ASoC: hdmi-codec: Add ELD control
X-BeenThere: alsa-devel@alsa-project.org
X-Mailman-Version: 2.1.14
Precedence: list
List-Id: "Alsa-devel mailing list for ALSA developers -
http://www.alsa-project.org"
List-Unsubscribe:
,
List-Archive:
List-Post:
List-Help:
List-Subscribe: ,
MIME-Version: 1.0
Errors-To: alsa-devel-bounces@alsa-project.org
Sender: alsa-devel-bounces@alsa-project.org
X-Virus-Scanned: ClamAV using ClamSMTP
Exporting the ELD bytes to userspace allows an application to select
an appropriate audio format depending on the current capabilities of
the connected HDMI sink device.
Signed-off-by: Philipp Zabel
Reviewed-by: Jyri Sarha
Tested-by: Jyri Sarha
---
sound/soc/codecs/hdmi-codec.c | 36 ++++++++++++++++++++++++++++++++++++
1 file changed, 36 insertions(+)
diff --git a/sound/soc/codecs/hdmi-codec.c b/sound/soc/codecs/hdmi-codec.c
index 6b327e2..6cb7217 100644
--- a/sound/soc/codecs/hdmi-codec.c
+++ b/sound/soc/codecs/hdmi-codec.c
@@ -54,6 +54,40 @@ enum {
DAI_ID_SPDIF,
};
+static int hdmi_eld_ctl_info(struct snd_kcontrol *kcontrol,
+ struct snd_ctl_elem_info *uinfo)
+{
+ struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
+ struct hdmi_codec_priv *hcp = snd_soc_component_get_drvdata(component);
+
+ uinfo->type = SNDRV_CTL_ELEM_TYPE_BYTES;
+ uinfo->count = sizeof(hcp->eld);
+
+ return 0;
+}
+
+static int hdmi_eld_ctl_get(struct snd_kcontrol *kcontrol,
+ struct snd_ctl_elem_value *ucontrol)
+{
+ struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
+ struct hdmi_codec_priv *hcp = snd_soc_component_get_drvdata(component);
+
+ memcpy(ucontrol->value.bytes.data, hcp->eld, sizeof(hcp->eld));
+
+ return 0;
+}
+
+static const struct snd_kcontrol_new hdmi_controls[] = {
+ {
+ .access = SNDRV_CTL_ELEM_ACCESS_READ |
+ SNDRV_CTL_ELEM_ACCESS_VOLATILE,
+ .iface = SNDRV_CTL_ELEM_IFACE_PCM,
+ .name = "ELD",
+ .info = hdmi_eld_ctl_info,
+ .get = hdmi_eld_ctl_get,
+ },
+};
+
static void hdmi_codec_abort(struct device *dev)
{
struct hdmi_codec_priv *hcp = dev_get_drvdata(dev);
@@ -327,6 +361,8 @@ static const struct snd_soc_dai_driver hdmi_spdif_dai = {
};
static struct snd_soc_codec_driver hdmi_codec = {
+ .controls = hdmi_controls,
+ .num_controls = ARRAY_SIZE(hdmi_controls),
.dapm_widgets = hdmi_widgets,
.num_dapm_widgets = ARRAY_SIZE(hdmi_widgets),
.dapm_routes = hdmi_routes,