From patchwork Tue Aug 2 05:55:16 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuninori Morimoto X-Patchwork-Id: 9255193 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 4D8F76048B for ; Tue, 2 Aug 2016 05:55:50 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3BFC4284F2 for ; Tue, 2 Aug 2016 05:55:50 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 30AE728504; Tue, 2 Aug 2016 05:55:50 +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=BAD_ENC_HEADER,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 228E8284F2 for ; Tue, 2 Aug 2016 05:55:49 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id 28F802664BF; Tue, 2 Aug 2016 07:55:48 +0200 (CEST) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id C0048265AD3; Tue, 2 Aug 2016 07:55:30 +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 3EAD0265AD3; Tue, 2 Aug 2016 07:55:29 +0200 (CEST) Received: from relmlie4.idc.renesas.com (relmlor1.renesas.com [210.160.252.171]) by alsa0.perex.cz (Postfix) with ESMTP id 21F062659D7 for ; Tue, 2 Aug 2016 07:55:21 +0200 (CEST) Received: from unknown (HELO relmlir4.idc.renesas.com) ([10.200.68.154]) by relmlie4.idc.renesas.com with ESMTP; 02 Aug 2016 14:55:20 +0900 Received: from relmlac3.idc.renesas.com (relmlac3.idc.renesas.com [10.200.69.23]) by relmlir4.idc.renesas.com (Postfix) with ESMTP id 8896E3B03B; Tue, 2 Aug 2016 14:55:20 +0900 (JST) Received: by relmlac3.idc.renesas.com (Postfix, from userid 0) id 5D7E31800A; Tue, 2 Aug 2016 14:55:20 +0900 (JST) Received: from relmlac3.idc.renesas.com (localhost [127.0.0.1]) by relmlac3.idc.renesas.com (Postfix) with ESMTP id 49E6B1806F; Tue, 2 Aug 2016 14:55:20 +0900 (JST) Received: from relmlii2.idc.renesas.com [10.200.68.66] by relmlac3.idc.renesas.com with ESMTP id QAR30155; Tue, 2 Aug 2016 14:55:20 +0900 X-IronPort-AV: E=Sophos;i="5.22,559,1449500400"; d="scan'208";a="216971487" Received: from mail-pu1apc01lp0023.outbound.protection.outlook.com (HELO APC01-PU1-obe.outbound.protection.outlook.com) ([65.55.88.23]) by relmlii2.idc.renesas.com with ESMTP/TLS/AES256-SHA; 02 Aug 2016 14:55:19 +0900 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=renesasgroup.onmicrosoft.com; s=selector1-renesas-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=sUjV9zWeVDrhnrnp0kwMFFonthbtbn2DneyW/1QcFGI=; b=JkTwFIJEB3LVnJdxf4Ut6Ix4l2YrDav0PFydmhTlZopQHNbd1TsGeSn2AYivfoGLivMcJjNl5coGzZbWrbE97MpIaF40B30dfIBTlAitxxF069l8JR8D/jcR/01lnnztg0z5MIHpzX1uZlTZ8Oj9jnKT7aTr5hFdAxnRx92jk6o= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=kuninori.morimoto.gx@renesas.com; Received: from morimoto-PC.renesas.com (211.11.155.144) by PS1PR0601MB1449.apcprd06.prod.outlook.com (10.165.210.153) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.549.15; Tue, 2 Aug 2016 05:55:16 +0000 Message-ID: <871t27iux9.wl%kuninori.morimoto.gx@renesas.com> From: Kuninori Morimoto User-Agent: Wanderlust/2.15.9 Emacs/24.3 Mule/6.0 MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") To: Mark Brown , David Airlie , Russell King In-Reply-To: <8737mniv03.wl%kuninori.morimoto.gx@renesas.com> References: <8737mniv03.wl%kuninori.morimoto.gx@renesas.com> Date: Tue, 2 Aug 2016 05:55:16 +0000 X-Originating-IP: [211.11.155.144] X-ClientProxiedBy: TY1PR01CA0095.jpnprd01.prod.outlook.com (10.167.154.13) To PS1PR0601MB1449.apcprd06.prod.outlook.com (10.165.210.153) X-MS-Office365-Filtering-Correlation-Id: f81a7320-8b48-4f9a-8f7e-08d3ba999449 X-Microsoft-Exchange-Diagnostics: 1; PS1PR0601MB1449; 2:xii326koT7kKHzEjzS1eV3dGAPTWLxw015qdnfrEQiW8JydJuzY5Ku9tUmUz7ihEBzxcmkqvR3XRXsusXdFo5zcxw3PBN4IRhoj4I5V4DSITqSv5NuqnVDdEJmPxYlEh6kYPIO7xHGHEhYBxjGFHZpHdc8JRdlFbZcInxQwHtSXWfKftRm/kQFc+DH/ET0L4; 3:4i5QZ6DyNIJOVbuSzRIxpcCvgSE2cKvVDHeu0m5b7Nc13jGsVg0MVfCFs3gmzP9w9TQoOffCzzFzLpJRObh8+8obinJSFXKkRLj9vxZxvm2wVbEJpe/ZTrDIYR37wx/q; 25:aGyZuvWrhiYZ5fkoqgmXmyYrP8HlK4WA4NuOdCChJERj55iCKAEu4QFzKZxvkujDOa24fPzkirelAZSvJBXpxq47mZYu/UzcA+qYlcfX2R52nmIgF2epRCZbE5O6/Zh0Tsgma32/LTWE2y59Kg4D+TxwvVeIOKOE/RYx843D1rlKVCixwjHTq8jFutJ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antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(2401047)(5005006)(8121501046)(3002001)(10201501046)(6055026); SRVR:PS1PR0601MB1449; BCL:0; PCL:0; RULEID:; SRVR:PS1PR0601MB1449; X-Microsoft-Exchange-Diagnostics: 1; PS1PR0601MB1449; 4:Acnl0XuikT6nKerwLGIeGHDzhhlTJgaRtgAIZjE8X0AmbcxPA7s9BPxvorlySrK8DeskxCQ7sWsdss3DbTP71M0BaC0cLQw8A098EeKnHuqmfFJjGE1gl4SMx8UBIFPQpqIuVT1AcVKq5+k/YTwhyvrqBgDM16n+7UaAmq3+LnaVKfMYEc3mLl9rGJVRqJZ20R1G/iiaRDkd4Gyxf/kF1XHYjdC8ZopCrUUI0ldKvAC9m3O9hZGyYlbwDD3u8Cq6ANrqno63ezOcUt7HNwBlJ/dKu232PS/k1oRs65OHUSsEsjzngbFlS1bStjAT/J4n5H35vLH8B8x/c9UcHAlcffXewbAWYbIlU477mCLoIHhPe/fxOLu70W6hfCeJs0RP X-Forefront-PRVS: 0022134A87 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(4630300001)(6009001)(7916002)(199003)(189002)(97736004)(105586002)(77096005)(7416002)(42186005)(81156014)(5001770100001)(69596002)(68736007)(101416001)(4001350100001)(83506001)(81166006)(66066001)(19580395003)(19580405001)(47776003)(586003)(229853001)(7736002)(3846002)(46406003)(6116002)(2950100001)(50986999)(7846002)(4326007)(92566002)(305945005)(76176999)(53416004)(8666005)(50466002)(8676002)(106356001)(54356999)(36756003)(86362001)(189998001)(23726003)(2906002)(33646002)(7059030)(21314002)(16060500001); DIR:OUT; SFP:1102; SCL:1; SRVR:PS1PR0601MB1449; H:morimoto-PC.renesas.com; FPR:; SPF:None; PTR:InfoNoRecords; A:1; MX:1; LANG:en; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; PS1PR0601MB1449; 23:GGxpOuG1rMTBHzhBWUF+Pt42mOm8kybhbgy76Th?= =?us-ascii?Q?as7Hl+DePPEj88I+cEP0JxlAeIv8bjvYQBwBu0JrbJbxISStxn0ite7IY6jQ?= =?us-ascii?Q?3MF7mnVaNoUMQ4vHldMLSqy4yb6tq/nw5znvbN8G+WrPxmiMzWTjerNS5V8z?= =?us-ascii?Q?i81iCckBhTCqzWn3zSdok+jkGJh2AvjaWEyPfqtqw675zJZT+zFfrXPvnd03?= =?us-ascii?Q?+aUqIs409I+jLfOufKeKnGFjcCmcQCPqxMEAoBLIRnYqUwfNCN0Ut0uuw4H+?= =?us-ascii?Q?HcRqSQNQTEzjEwvxSFeODuvDL/juadlMA5IG/I4bC9pEvhptxo9W4w2wDdxW?= =?us-ascii?Q?yXSeomUakz+0GSNvrq973fM/4xxiNJxusywcoi8XqsxW1NE+Deav4ZOYowz+?= =?us-ascii?Q?lUAXmarKGeCZDoERQ0wq5utHodo7ArRwW6v0d5uzv2S19Z0z/22G0KKHoU8W?= =?us-ascii?Q?pjEvM8npO8A5qCLZPGO3oxOo8Q4ig4/PTLFByaKzdDnxyt/xdhqLsLea8znC?= =?us-ascii?Q?O7SCfrymPMK1lBuP4r4bXzpfNo+KaM+UfnwYF7t1BXv5spbaClLu3rHeu/oV?= =?us-ascii?Q?iu/059YvVNfB60NwvvypWisslfKfrWZwzIlp9fp5HuZN9oV8LW4YFETErjle?= =?us-ascii?Q?/Xeks/KrIZFNzdW3N3EcraMJCTemIuhu0s26XSjbyKmlEibkwy0y7XlKfjJq?= =?us-ascii?Q?OPGzta2LBEZPLHYlG28GAkrsmdlS29Q+m06KN6cS+5nW8JGHGkANt8035hLr?= =?us-ascii?Q?QezpTOLOque60ebqrh3rO/iPOY2T3OZC0v9mGs1Mol4y2uvPeaie0GNDzBcG?= =?us-ascii?Q?AG8CKtzanOqFfg4BXCUNwOJtbMItVafwtDcAThLTy5gmqcZ7+ohojP4P77xJ?= =?us-ascii?Q?mNSoNYH3KUEa4D2Dps4Dyo3d0La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3peC7GBfwgoJVSYKe/r++QI=; 7:3TJ/xxOEXfYX/SwemLaynsxeYL7ZRhwOpZfn3zeWU43OBBdl6eu8f42PXijsmsyfhEvXY7i9fJvo8J9M9iwl+0VfwQufZFBMChgUNTXcGCDetv9x709yqZiy0w6MFYXRCRZ60O44HKIFNfql5IIk1EJdHkl/AmfUfTZJJb79l0MeZnb51lxgJHbwtd54qzwvfs9degXljgvHK9jD2G7VmiHhSoG+8ehH7z3X+anKC7Y0eAL8pU+V5qL6NvwOLjtE SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; PS1PR0601MB1449; 20:pux5lzLmTwL+oh1+2LS2ZyCC/k0FWyQGm0CFXlsKFeQsS6V8tZXihsfsSP75YjNRN0s02B5+V5eWNTtH0mabopyPXBCp9NL5z1yKU4yWImauz9moxkc1VRBucB3WVc/uFfRjNlG+a1BAHuzdjcO3mpC0VeqDbkUrsjcVSJ7aAsE= X-OriginatorOrg: renesas.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Aug 2016 05:55:16.2426 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: PS1PR0601MB1449 Cc: Fabio Estevam , Linux-ALSA , Daniel Vetter , Koji Matsuoka , dri-devel@lists.freedesktop.org, Liam Girdwood , linux-renesas-soc@vger.kernel.org, Simon , Thierry Reding , linux-kernel@vger.kernel.org Subject: [alsa-devel] [PATCH 1/2 v2] ASoC: hdmi-codec: enable multi probe for same device 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: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP From: Kuninori Morimoto hdmi-codec driver is common HDMI sound driver, but it doesn't care about multi sound ports. For example, hdmi-codec driver is supporting 1 I2S and 1 SPDIF ports, so, we can't use this driver if HDMI has 2 or more I2S ports. And we would like to use multi detection. For example, DesignWare HDMI driver is providing dw_hdmi_bind() to DRM/KMS driver, and it will setups HDMI video/sound. Note is that it will be called under for_each loop of ports. int dw_hdmi_bind(xxx) { /* register hdmi-codec driver here */ } static int xxx_probe(struct platform_device *pdev) { for_each_xxx(xx) { ... dw_hdmi_bind(xxx); ... } } This case, dw_hdmi_bind() would like to use hdmi-codec, and it will be called multiple times for each ports. Here, ASoC's CPU/Codec/Card bind will checks each "of_node" on DT, and hdmi-codec driver is assuming its parent device for it. But it doesn't care about case. Thus, ASoC never detect correct sound card in this case. To solve this issue, this patch checks each parent device, and names "hdmi-hifi.x" in order to each ports. And uses struct snd_soc_component_driver :: of_xlate_dai_name for snd_soc_get_dai_name(). Signed-off-by: Kuninori Morimoto --- sound/soc/codecs/hdmi-codec.c | 67 +++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 64 insertions(+), 3 deletions(-) diff --git a/sound/soc/codecs/hdmi-codec.c b/sound/soc/codecs/hdmi-codec.c index f27d115..f64ecaa 100644 --- a/sound/soc/codecs/hdmi-codec.c +++ b/sound/soc/codecs/hdmi-codec.c @@ -24,6 +24,15 @@ #include /* This is only to get MAX_ELD_BYTES */ +struct hdmi_device { + struct device *dev; + struct list_head list; + int cnt; +}; +#define pos_to_hdmi_device(pos) container_of((pos), struct hdmi_device, list) +LIST_HEAD(hdmi_device_list); + +#define DAI_NAME_SIZE 16 struct hdmi_codec_priv { struct hdmi_codec_pdata hcd; struct snd_soc_dai_driver *daidrv; @@ -320,7 +329,6 @@ static const struct snd_soc_dai_ops hdmi_dai_ops = { SNDRV_PCM_FMTBIT_S32_LE | SNDRV_PCM_FMTBIT_S32_BE) static struct snd_soc_dai_driver hdmi_i2s_dai = { - .name = "i2s-hifi", .id = DAI_ID_I2S, .playback = { .stream_name = "Playback", @@ -334,7 +342,6 @@ static struct snd_soc_dai_driver hdmi_i2s_dai = { }; static const struct snd_soc_dai_driver hdmi_spdif_dai = { - .name = "spdif-hifi", .id = DAI_ID_SPDIF, .playback = { .stream_name = "Playback", @@ -346,6 +353,27 @@ static const struct snd_soc_dai_driver hdmi_spdif_dai = { .ops = &hdmi_dai_ops, }; +static char hdmi_dai_name[][DAI_NAME_SIZE] = { + "hdmi-hifi.0", + "hdmi-hifi.1", + "hdmi-hifi.2", + "hdmi-hifi.3", +}; + +static int hdmi_of_xlate_dai_name(struct snd_soc_component *component, + struct of_phandle_args *args, + const char **dai_name) +{ + int id = args->args[0]; + + if (id < ARRAY_SIZE(hdmi_dai_name)) { + *dai_name = hdmi_dai_name[id]; + return 0; + } + + return -EAGAIN; +} + static struct snd_soc_codec_driver hdmi_codec = { .controls = hdmi_controls, .num_controls = ARRAY_SIZE(hdmi_controls), @@ -353,6 +381,9 @@ static struct snd_soc_codec_driver hdmi_codec = { .num_dapm_widgets = ARRAY_SIZE(hdmi_widgets), .dapm_routes = hdmi_routes, .num_dapm_routes = ARRAY_SIZE(hdmi_routes), + .component_driver = { + .of_xlate_dai_name = hdmi_of_xlate_dai_name, + }, }; static int hdmi_codec_probe(struct platform_device *pdev) @@ -360,6 +391,8 @@ static int hdmi_codec_probe(struct platform_device *pdev) struct hdmi_codec_pdata *hcd = pdev->dev.platform_data; struct device *dev = &pdev->dev; struct hdmi_codec_priv *hcp; + struct hdmi_device *hd; + struct list_head *pos; int dai_count, i = 0; int ret; @@ -381,6 +414,31 @@ static int hdmi_codec_probe(struct platform_device *pdev) if (!hcp) return -ENOMEM; + hd = NULL; + list_for_each(pos, &hdmi_device_list) { + struct hdmi_device *tmp = pos_to_hdmi_device(pos); + + if (tmp->dev == dev->parent) { + hd = tmp; + break; + } + } + + if (!hd) { + hd = devm_kzalloc(dev, sizeof(*hd), GFP_KERNEL); + if (!hd) + return -ENOMEM; + + hd->dev = dev->parent; + + list_add_tail(&hd->list, &hdmi_device_list); + } + + if (hd->cnt >= ARRAY_SIZE(hdmi_dai_name)) { + dev_err(dev, "too many hdmi codec are deteced\n"); + return -EINVAL; + } + hcp->hcd = *hcd; mutex_init(&hcp->current_stream_lock); @@ -393,11 +451,14 @@ static int hdmi_codec_probe(struct platform_device *pdev) hcp->daidrv[i] = hdmi_i2s_dai; hcp->daidrv[i].playback.channels_max = hcd->max_i2s_channels; + hcp->daidrv[i].name = hdmi_dai_name[hd->cnt++]; i++; } - if (hcd->spdif) + if (hcd->spdif) { hcp->daidrv[i] = hdmi_spdif_dai; + hcp->daidrv[i].name = hdmi_dai_name[hd->cnt++]; + } ret = snd_soc_register_codec(dev, &hdmi_codec, hcp->daidrv, dai_count);