From patchwork Tue Jun 13 21:59:49 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 9785503 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 7D097602D9 for ; Wed, 14 Jun 2017 06:03:14 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7A3A52853F for ; Wed, 14 Jun 2017 06:03:14 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6C9A128585; Wed, 14 Jun 2017 06:03:14 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_NONE,T_DKIM_INVALID autolearn=no version=3.3.1 Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DC3A52853F for ; Wed, 14 Jun 2017 06:03:12 +0000 (UTC) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id BE6CE26680F; Wed, 14 Jun 2017 08:03:07 +0200 (CEST) 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 AE1062668BF; Wed, 14 Jun 2017 00:00:04 +0200 (CEST) Received: from mail-io0-f172.google.com (mail-io0-f172.google.com [209.85.223.172]) by alsa0.perex.cz (Postfix) with ESMTP id 0655F266847 for ; Tue, 13 Jun 2017 23:59:57 +0200 (CEST) Received: by mail-io0-f172.google.com with SMTP id t87so62472122ioe.0 for ; Tue, 13 Jun 2017 14:59:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=HSlnga3I0HX3UQog3CZ8UlTbhIhr12wNplrlkAvuyJQ=; b=Nc3VWrWsFumsG7vIufNCOuhV0PwjxkXaJRMFuX9RaOvJnareZSG/xdiL1jPcS/TgVp FoB7O45dq6rrrfnD0dz60KPQObowK2UGmrb5ZAPmlXoZt/IMpzqWbx4X+vdsbKz3xsHm ohMBZ+u30jxQwOyUqxqWBfq5+G35QYLEmIID0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=HSlnga3I0HX3UQog3CZ8UlTbhIhr12wNplrlkAvuyJQ=; b=JocBgRlkEPnxVid0ptOF3eLspeZpUQ2ewnjVy62IxDiSkm3jfG7fspc7PfGzoxmZfm 2Zeb/OARf9+6B2ebs71OPETYgSVY7gO8zo6VQ/Y2E+fH3fjcgcsP/UvH8M2z0p+uiffG lBvmQi1H0r3uuG4stl7PYrVuhzVeciidt0+oP0kEf6bIRMbbRjk2Tb0XeS8DSiDWB2el zAC7MlSz0v6579B/pGBYmXWsiDWqoqSjXm/XDAilnnGNj6wKjPO/sAZS0F4TizwzRho3 AiuPAgSZ9Yonmb2dqL+q72y4xE+Q97Mt3o7D0arsB2Gf6dyTpYdnPGSuxNRQ4d2+8zsE 8GGA== X-Gm-Message-State: AKS2vOz/nNUJxlY6LaEcVIg5Ef5eccwxOL9SY2u9XgKTUNZVvSQGQVpQ dOIr7aCHdDf1BRJyiwS42g== X-Received: by 10.107.155.140 with SMTP id d134mr2744267ioe.88.1497391196797; Tue, 13 Jun 2017 14:59:56 -0700 (PDT) Received: from localhost.localdomain ([2601:1c2:1002:83f0:4e72:b9ff:fe99:466a]) by smtp.gmail.com with ESMTPSA id i6sm6365905iti.20.2017.06.13.14.59.54 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 13 Jun 2017 14:59:55 -0700 (PDT) From: John Stultz To: lkml Date: Tue, 13 Jun 2017 14:59:49 -0700 Message-Id: <1497391189-9301-1-git-send-email-john.stultz@linaro.org> X-Mailer: git-send-email 2.7.4 X-Mailman-Approved-At: Wed, 14 Jun 2017 08:03:06 +0200 Cc: Archit Taneja , Lars-Peter Clausen , Kuninori Morimoto , David Airlie , Mark Brown , Linux-ALSA , dri-devel@lists.freedesktop.org, Rob Herring , John Stultz Subject: [alsa-devel] [PATCH] drm: adv7511_audio: Add .get_dai_id callback to map port number to dai id 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 ALSA SoC needs to know connected DAI ID for probing. Using the new audio-card-graph approach, ports/endpoints are used to describe how the links are connected. Unfortunately, since ports/endpoints are used as well for video linkages, there are some issues mixing the port ids to the two (video and audio) namespaces. To solve this issue, this patch adds new .get_dai_id callback on hdmi_codec_ops. The will assume that HDMI audio out will be connected to reg = <2>. This will then be remapped to the ALSA SoC side will as DAI 0. Allowing the adv7511's hdmi audio support to be used with the audio-card-graph. Credit to Kuninori Morimoto who's patch to dw-hdmi-i2s-audio.c was what this was mostly copy-pasted from. Cc: Kuninori Morimoto Cc: Archit Taneja Cc: Mark Brown Cc: Rob Herring Cc: David Airlie Cc: Lars-Peter Clausen Cc: Linux-ALSA Cc: dri-devel@lists.freedesktop.org Signed-off-by: John Stultz --- .../bindings/display/bridge/adi,adv7511.txt | 8 ++++++++ drivers/gpu/drm/bridge/adv7511/adv7511_audio.c | 22 ++++++++++++++++++++++ 2 files changed, 30 insertions(+) diff --git a/Documentation/devicetree/bindings/display/bridge/adi,adv7511.txt b/Documentation/devicetree/bindings/display/bridge/adi,adv7511.txt index 00ea670..06668bc 100644 --- a/Documentation/devicetree/bindings/display/bridge/adi,adv7511.txt +++ b/Documentation/devicetree/bindings/display/bridge/adi,adv7511.txt @@ -78,6 +78,7 @@ graph bindings specified in Documentation/devicetree/bindings/graph.txt. remote endpoint phandle should be a reference to a valid mipi_dsi_host device node. - Video port 1 for the HDMI output +- Audio port 2 for the HDMI audio input Example @@ -112,5 +113,12 @@ Example remote-endpoint = <&hdmi_connector_in>; }; }; + + port@2 { + reg = <2>; + codec_endpoint: endpoint { + remote-endpoint = <&i2s0_cpu_endpoint>; + }; + }; }; }; diff --git a/drivers/gpu/drm/bridge/adv7511/adv7511_audio.c b/drivers/gpu/drm/bridge/adv7511/adv7511_audio.c index cf92ebf..67469c2 100644 --- a/drivers/gpu/drm/bridge/adv7511/adv7511_audio.c +++ b/drivers/gpu/drm/bridge/adv7511/adv7511_audio.c @@ -11,6 +11,7 @@ #include #include #include +#include #include "adv7511.h" @@ -182,10 +183,31 @@ static void audio_shutdown(struct device *dev, void *data) { } +static int adv7511_hdmi_i2s_get_dai_id(struct snd_soc_component *component, + struct device_node *endpoint) +{ + struct of_endpoint of_ep; + int ret; + + ret = of_graph_parse_endpoint(endpoint, &of_ep); + if (ret < 0) + return ret; + + /* + * HDMI sound should be located as reg = <2> + * Then, it is sound port 0 + */ + if (of_ep.port == 2) + return 0; + + return -EINVAL; +} + static const struct hdmi_codec_ops adv7511_codec_ops = { .hw_params = adv7511_hdmi_hw_params, .audio_shutdown = audio_shutdown, .audio_startup = audio_startup, + .get_dai_id = adv7511_hdmi_i2s_get_dai_id, }; static struct hdmi_codec_pdata codec_data = {