From patchwork Tue Dec 4 08:19:43 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuninori Morimoto X-Patchwork-Id: 10711481 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 958D41923 for ; Tue, 4 Dec 2018 10:47:48 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 832F42AB18 for ; Tue, 4 Dec 2018 10:47:48 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 703E02ABE4; Tue, 4 Dec 2018 10:47:48 +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=-2.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham 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 076222AB8F for ; Tue, 4 Dec 2018 10:47:45 +0000 (UTC) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id AF0A3267B4F; Tue, 4 Dec 2018 09:19:52 +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 B3BF6267B4F; Tue, 4 Dec 2018 09:19:50 +0100 (CET) Received: from JPN01-OS2-obe.outbound.protection.outlook.com (mail-eopbgr1410097.outbound.protection.outlook.com [40.107.141.97]) by alsa0.perex.cz (Postfix) with ESMTP id 9F850267B51 for ; Tue, 4 Dec 2018 09:19:47 +0100 (CET) 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:X-MS-Exchange-SenderADCheck; bh=8Up7w5MqSOLx1Jl8Ih+rUujEC4xcIOlciAcX5UfZ65Y=; b=l6nNCNeUmDXS4S9V3M+8R1X4Nw9q+6Sxn8QSn1UGr/dFcOZK4Ek26p5qSuQsTRosG5/zEO9THFyZSC/WKeSsk0B3NOV9R2j3/PE0yeUBLz2NvlADFrmcvIq0KGvQ6260iMvoXG2epZ/6rK/ZyiumZI8GwMEAEAYVeavc+5zBmWE= Received: from TYAPR01MB3661.jpnprd01.prod.outlook.com (20.178.137.210) by TYAPR01MB4141.jpnprd01.prod.outlook.com (20.178.140.21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1382.22; Tue, 4 Dec 2018 08:19:43 +0000 Received: from TYAPR01MB3661.jpnprd01.prod.outlook.com ([fe80::70b6:5ef2:3f71:77c7]) by TYAPR01MB3661.jpnprd01.prod.outlook.com ([fe80::70b6:5ef2:3f71:77c7%4]) with mapi id 15.20.1382.020; Tue, 4 Dec 2018 08:19:43 +0000 From: Kuninori Morimoto To: Mark Brown Thread-Topic: [PATCH 1/7] ASoC: simple-card: use cpu/codec pointer on simple_dai_props Thread-Index: AQHUi6ocDPupTF4tq0iv8UzQPfctdA== Date: Tue, 4 Dec 2018 08:19:43 +0000 Message-ID: <87d0qh3e75.wl-kuninori.morimoto.gx@renesas.com> References: <87efax3e85.wl-kuninori.morimoto.gx@renesas.com> In-Reply-To: <87efax3e85.wl-kuninori.morimoto.gx@renesas.com> Accept-Language: ja-JP, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: KAWPR01CA0078.jpnprd01.prod.outlook.com (2603:1096:402:c::14) To TYAPR01MB3661.jpnprd01.prod.outlook.com (2603:1096:404:c1::18) authentication-results: spf=none (sender IP is ) smtp.mailfrom=kuninori.morimoto.gx@renesas.com; x-ms-exchange-messagesentrepresentingtype: 1 x-originating-ip: [211.11.155.130] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; TYAPR01MB4141; 20:CjCUXiQVR052TWQxbVd50HECafmxkjB+Lhbxxs2vXDn4i2qHZD5U3TwcXczSU9EeS8yhNis2yWtfMWi2bpyfTGp1Dm9Umfz43J/5YpzXzeFBLrRpiZr+hwhh2Zf+F2POJJ5oxm7coYd+6PGrYNRwKeeShWA04vypTDJ7qBpMqtI= x-ms-office365-filtering-correlation-id: 34241e2f-2f1c-4369-20e1-08d659c13e74 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390098)(7020095)(4652040)(8989299)(5600074)(711020)(4618075)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(2017052603328)(7153060)(7193020); SRVR:TYAPR01MB4141; x-ms-traffictypediagnostic: TYAPR01MB4141: x-microsoft-antispam-prvs: x-ms-exchange-senderadcheck: 1 x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(8121501046)(5005006)(10201501046)(3002001)(3231455)(999002)(944501493)(52105112)(93006095)(93001095)(6055026)(148016)(149066)(150057)(6041310)(20161123558120)(20161123564045)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123562045)(201708071742011)(7699051)(76991095); SRVR:TYAPR01MB4141; BCL:0; PCL:0; RULEID:; SRVR:TYAPR01MB4141; x-forefront-prvs: 0876988AF0 x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(346002)(376002)(39860400002)(396003)(366004)(136003)(199004)(189003)(4326008)(5660300001)(305945005)(7736002)(26005)(68736007)(186003)(81156014)(6512007)(102836004)(81166006)(386003)(105586002)(53936002)(6506007)(6916009)(106356001)(3846002)(8936002)(6116002)(36756003)(6436002)(6486002)(2906002)(8676002)(99286004)(76176011)(316002)(52116002)(97736004)(86362001)(446003)(476003)(2616005)(11346002)(486006)(25786009)(256004)(14454004)(71200400001)(71190400001)(66066001)(478600001); DIR:OUT; SFP:1102; SCL:1; SRVR:TYAPR01MB4141; H:TYAPR01MB3661.jpnprd01.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; received-spf: None (protection.outlook.com: renesas.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: fx3HWs2PthdXyJjERHr0NbVgN/ffNdRrwYy/BqVJNJTVWDuZFTvayM3UlRAml4/6S30hdL+AbHsGjwpaMSXyHApV8xTSktsldF1jyDkP7iSsYZdfcIQGF6xdJWd7oQjwLSn7TR67UP23Sa8ELzhitjRDbOFcjCFbq68YhN7qDaxCi8pqc7gzsGu4VK5pWrs1huMpIzLxr9EYnVWvW3gaO4VYm2zmtZslCcFef8qPeNyBtIMrqkY1tjadbJwoIIsqyxjvfMG0DCCVfNMS1jJVYOD8WxEdI6LsRvq6DoSLlIzJpD+bD9cjvpUD/4Ksa1t7+Y0nquIshc8C6TBlZ3s9UAfMjhqCTVjwhYliRWFBRGQ= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-ID: <3FDD8E6727BC7B44A533DEFDFDDEB020@jpnprd01.prod.outlook.com> MIME-Version: 1.0 X-OriginatorOrg: renesas.com X-MS-Exchange-CrossTenant-Network-Message-Id: 34241e2f-2f1c-4369-20e1-08d659c13e74 X-MS-Exchange-CrossTenant-originalarrivaltime: 04 Dec 2018 08:19:43.3814 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 53d82571-da19-47e4-9cb4-625a166a4a2a X-MS-Exchange-Transport-CrossTenantHeadersStamped: TYAPR01MB4141 Cc: Linux-ALSA Subject: [alsa-devel] [PATCH 1/7] ASoC: simple-card: use cpu/codec pointer on simple_dai_props 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 In DPCM case, it uses CPU-dummy / dummy-Codec dai links, and non DPCM case, it uses CPU-Codec dai links. Now, we want to merge simple-card and simple-scu-card. These sound cards are using silimar but not same logic on each functions. Then, of course we want to share same logic. To compromise, this patch uses cpu/codec pointer on simple-card. It is same logic with simple-scu-card, thus easy merging. This is prepare for merging audio card Signed-off-by: Kuninori Morimoto --- sound/soc/generic/simple-card.c | 62 ++++++++++++++++++++++++----------------- 1 file changed, 36 insertions(+), 26 deletions(-) diff --git a/sound/soc/generic/simple-card.c b/sound/soc/generic/simple-card.c index ff3f9fa..7661234 100644 --- a/sound/soc/generic/simple-card.c +++ b/sound/soc/generic/simple-card.c @@ -18,8 +18,8 @@ struct simple_card_data { struct snd_soc_card snd_card; struct simple_dai_props { - struct asoc_simple_dai cpu_dai; - struct asoc_simple_dai codec_dai; + struct asoc_simple_dai *cpu_dai; + struct asoc_simple_dai *codec_dai; struct snd_soc_dai_link_component codecs; /* single codec */ struct snd_soc_dai_link_component platform; unsigned int mclk_fs; @@ -28,6 +28,7 @@ struct simple_card_data { struct asoc_simple_jack hp_jack; struct asoc_simple_jack mic_jack; struct snd_soc_dai_link *dai_link; + struct asoc_simple_dai *dais; }; #define simple_priv_to_card(priv) (&(priv)->snd_card) @@ -47,13 +48,13 @@ static int asoc_simple_card_startup(struct snd_pcm_substream *substream) simple_priv_to_props(priv, rtd->num); int ret; - ret = asoc_simple_card_clk_enable(&dai_props->cpu_dai); + ret = asoc_simple_card_clk_enable(dai_props->cpu_dai); if (ret) return ret; - ret = asoc_simple_card_clk_enable(&dai_props->codec_dai); + ret = asoc_simple_card_clk_enable(dai_props->codec_dai); if (ret) - asoc_simple_card_clk_disable(&dai_props->cpu_dai); + asoc_simple_card_clk_disable(dai_props->cpu_dai); return ret; } @@ -65,9 +66,9 @@ static void asoc_simple_card_shutdown(struct snd_pcm_substream *substream) struct simple_dai_props *dai_props = simple_priv_to_props(priv, rtd->num); - asoc_simple_card_clk_disable(&dai_props->cpu_dai); + asoc_simple_card_clk_disable(dai_props->cpu_dai); - asoc_simple_card_clk_disable(&dai_props->codec_dai); + asoc_simple_card_clk_disable(dai_props->codec_dai); } static int asoc_simple_set_clk_rate(struct asoc_simple_dai *simple_dai, @@ -102,11 +103,11 @@ static int asoc_simple_card_hw_params(struct snd_pcm_substream *substream, if (mclk_fs) { mclk = params_rate(params) * mclk_fs; - ret = asoc_simple_set_clk_rate(&dai_props->codec_dai, mclk); + ret = asoc_simple_set_clk_rate(dai_props->codec_dai, mclk); if (ret < 0) return ret; - ret = asoc_simple_set_clk_rate(&dai_props->cpu_dai, mclk); + ret = asoc_simple_set_clk_rate(dai_props->cpu_dai, mclk); if (ret < 0) return ret; @@ -134,17 +135,16 @@ static const struct snd_soc_ops asoc_simple_card_ops = { static int asoc_simple_card_dai_init(struct snd_soc_pcm_runtime *rtd) { struct simple_card_data *priv = snd_soc_card_get_drvdata(rtd->card); - struct snd_soc_dai *codec = rtd->codec_dai; - struct snd_soc_dai *cpu = rtd->cpu_dai; - struct simple_dai_props *dai_props = - simple_priv_to_props(priv, rtd->num); + struct simple_dai_props *dai_props = simple_priv_to_props(priv, rtd->num); int ret; - ret = asoc_simple_card_init_dai(codec, &dai_props->codec_dai); + ret = asoc_simple_card_init_dai(rtd->codec_dai, + dai_props->codec_dai); if (ret < 0) return ret; - ret = asoc_simple_card_init_dai(cpu, &dai_props->cpu_dai); + ret = asoc_simple_card_init_dai(rtd->cpu_dai, + dai_props->cpu_dai); if (ret < 0) return ret; @@ -153,14 +153,14 @@ static int asoc_simple_card_dai_init(struct snd_soc_pcm_runtime *rtd) static int asoc_simple_card_dai_link_of(struct device_node *node, struct simple_card_data *priv, - int idx, + int *dai_idx, int link_idx, bool is_top_level_node) { struct device *dev = simple_priv_to_dev(priv); - struct snd_soc_dai_link *dai_link = simple_priv_to_link(priv, idx); - struct simple_dai_props *dai_props = simple_priv_to_props(priv, idx); - struct asoc_simple_dai *cpu_dai = &dai_props->cpu_dai; - struct asoc_simple_dai *codec_dai = &dai_props->codec_dai; + struct snd_soc_dai_link *dai_link = simple_priv_to_link(priv, link_idx); + struct simple_dai_props *dai_props = simple_priv_to_props(priv, link_idx); + struct asoc_simple_dai *cpu_dai; + struct asoc_simple_dai *codec_dai; struct device_node *cpu = NULL; struct device_node *plat = NULL; struct device_node *codec = NULL; @@ -193,6 +193,11 @@ static int asoc_simple_card_dai_link_of(struct device_node *node, goto dai_link_of_err; } + cpu_dai = + dai_props->cpu_dai = &priv->dais[(*dai_idx)++]; + codec_dai = + dai_props->codec_dai = &priv->dais[(*dai_idx)++]; + ret = asoc_simple_card_parse_daifmt(dev, node, codec, prefix, &dai_link->dai_fmt); if (ret < 0) @@ -290,6 +295,7 @@ static int asoc_simple_card_parse_of(struct simple_card_data *priv) struct device_node *dai_link; struct device_node *node = dev->of_node; int ret; + int link_idx, dai_idx; if (!node) return -EINVAL; @@ -308,23 +314,24 @@ static int asoc_simple_card_parse_of(struct simple_card_data *priv) of_property_read_u32(node, PREFIX "mclk-fs", &priv->mclk_fs); /* Single/Muti DAI link(s) & New style of DT node */ + link_idx = 0; + dai_idx = 0; if (dai_link) { struct device_node *np = NULL; - int i = 0; for_each_child_of_node(node, np) { - dev_dbg(dev, "\tlink %d:\n", i); + dev_dbg(dev, "\tlink %d:\n", link_idx); ret = asoc_simple_card_dai_link_of(np, priv, - i, false); + &dai_idx, link_idx++, false); if (ret < 0) { of_node_put(np); goto card_parse_end; } - i++; } } else { /* For single DAI link & old style of DT node */ - ret = asoc_simple_card_dai_link_of(node, priv, 0, true); + ret = asoc_simple_card_dai_link_of(node, priv, + &dai_idx, link_idx++, true); if (ret < 0) goto card_parse_end; } @@ -362,6 +369,7 @@ static int asoc_simple_card_probe(struct platform_device *pdev) struct simple_card_data *priv; struct snd_soc_dai_link *dai_link; struct simple_dai_props *dai_props; + struct asoc_simple_dai *dais; struct device *dev = &pdev->dev; struct device_node *np = dev->of_node; struct snd_soc_card *card; @@ -380,7 +388,8 @@ static int asoc_simple_card_probe(struct platform_device *pdev) dai_props = devm_kcalloc(dev, num, sizeof(*dai_props), GFP_KERNEL); dai_link = devm_kcalloc(dev, num, sizeof(*dai_link), GFP_KERNEL); - if (!dai_props || !dai_link) + dais = devm_kcalloc(dev, num * 2, sizeof(*dais), GFP_KERNEL); + if (!dai_props || !dai_link || !dais) return -ENOMEM; /* @@ -397,6 +406,7 @@ static int asoc_simple_card_probe(struct platform_device *pdev) priv->dai_props = dai_props; priv->dai_link = dai_link; + priv->dais = dais; /* Init snd_soc_card */ card = simple_priv_to_card(priv); From patchwork Tue Dec 4 08:20:13 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuninori Morimoto X-Patchwork-Id: 10711487 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 4ED04109C for ; Tue, 4 Dec 2018 10:47:49 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3F47A2AB15 for ; Tue, 4 Dec 2018 10:47:49 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 33AD02AB18; Tue, 4 Dec 2018 10:47:49 +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=-2.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham 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 022EB2AB1E for ; Tue, 4 Dec 2018 10:47:45 +0000 (UTC) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id 14BD5267B3E; Tue, 4 Dec 2018 09:20:21 +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 CA1F6267B50; Tue, 4 Dec 2018 09:20:18 +0100 (CET) Received: from JPN01-OS2-obe.outbound.protection.outlook.com (mail-eopbgr1410109.outbound.protection.outlook.com [40.107.141.109]) by alsa0.perex.cz (Postfix) with ESMTP id B4594267B37 for ; Tue, 4 Dec 2018 09:20:16 +0100 (CET) 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:X-MS-Exchange-SenderADCheck; bh=z+LLpyKkojrL6URia+BC98h5ZRT5gZ0WuwIwgWFy2EE=; b=gh6uuKpzrMbQ3WOy9pxzAB+GkyEVEGXDrDP7YAQhLn+TAqemrqftIgqAWx+23FmN4CDzGDF7lHGM9zQpfwLIhNdmg1k9F5BUSNvV++NAUWsMDknZeBlKhy13Uz48udQjrou2vPOikKLZKJdFCOFbkfMZiyHQ42QSBF33K6hjb+4= Received: from TYAPR01MB3661.jpnprd01.prod.outlook.com (20.178.137.210) by TYAPR01MB4255.jpnprd01.prod.outlook.com (20.178.140.149) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1382.22; Tue, 4 Dec 2018 08:20:13 +0000 Received: from TYAPR01MB3661.jpnprd01.prod.outlook.com ([fe80::70b6:5ef2:3f71:77c7]) by TYAPR01MB3661.jpnprd01.prod.outlook.com ([fe80::70b6:5ef2:3f71:77c7%4]) with mapi id 15.20.1382.020; Tue, 4 Dec 2018 08:20:13 +0000 From: Kuninori Morimoto To: Mark Brown Thread-Topic: [PATCH 2/7] ASoC: simple-scu-card: tidyup asoc_simple_card_parse_daifmt() timing Thread-Index: AQHUi6oucss2UAR0cE6CARSg87kxUA== Date: Tue, 4 Dec 2018 08:20:13 +0000 Message-ID: <87bm613e6b.wl-kuninori.morimoto.gx@renesas.com> References: <87efax3e85.wl-kuninori.morimoto.gx@renesas.com> In-Reply-To: <87efax3e85.wl-kuninori.morimoto.gx@renesas.com> Accept-Language: ja-JP, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: TY2PR02CA0007.apcprd02.prod.outlook.com (2603:1096:404:56::19) To TYAPR01MB3661.jpnprd01.prod.outlook.com (2603:1096:404:c1::18) authentication-results: spf=none (sender IP is ) smtp.mailfrom=kuninori.morimoto.gx@renesas.com; x-ms-exchange-messagesentrepresentingtype: 1 x-originating-ip: [211.11.155.130] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; TYAPR01MB4255; 20:hIrMdeCtnXlyyJPs1+jRIFztPkrZn9V4jQun37hQOtafbOuhDxQs6XxB1jUSO7FdB+qOF59flBaYerX3+2vimyBl6P1j4cjJdUtjV/2Hy42D5qC9lQBVhso+wn/D3NaP8miF1evpuoowFfheYUzDpPUTpkQI+Iwrz7yAkNbd4N4= x-ms-office365-filtering-correlation-id: 5c7e1282-b237-47f8-93a4-08d659c15063 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390098)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600074)(711020)(4618075)(2017052603328)(7153060)(7193020); SRVR:TYAPR01MB4255; x-ms-traffictypediagnostic: TYAPR01MB4255: x-microsoft-antispam-prvs: x-ms-exchange-senderadcheck: 1 x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(8121501046)(5005006)(93006095)(93001095)(3231455)(999002)(944501493)(52105112)(3002001)(10201501046)(6055026)(148016)(149066)(150057)(6041310)(20161123562045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123564045)(20161123560045)(20161123558120)(201708071742011)(7699051)(76991095); SRVR:TYAPR01MB4255; BCL:0; PCL:0; RULEID:; SRVR:TYAPR01MB4255; x-forefront-prvs: 0876988AF0 x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(136003)(39860400002)(376002)(346002)(396003)(366004)(189003)(199004)(81156014)(8676002)(486006)(8936002)(81166006)(99286004)(2906002)(3846002)(256004)(11346002)(6116002)(71200400001)(446003)(476003)(71190400001)(86362001)(25786009)(2616005)(68736007)(53936002)(36756003)(478600001)(4326008)(5660300001)(305945005)(14454004)(7736002)(97736004)(26005)(6506007)(102836004)(76176011)(186003)(386003)(6436002)(6512007)(105586002)(6486002)(52116002)(106356001)(6916009)(66066001)(316002); DIR:OUT; SFP:1102; SCL:1; SRVR:TYAPR01MB4255; H:TYAPR01MB3661.jpnprd01.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; received-spf: None (protection.outlook.com: renesas.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: LB7kiij/ncF4Kr1St8fBMvZEhQv/zO5JcMgPpEK5AeiYmnWAB8XxCEr/SgQj61+5y1jDYU7DbEIYagUHFKTEEhMvT8M3fVtjkBWuL9eVho4w6dsxWSh08XZtZo/9ItN/EBb/Mc7g0khOBgl6E7kcStnq8OIsRID2ErU4dePG2x12hWp6ndmFHw/JaDVfIxkTyBE4jELyGi5AQUzzzsKRTgSkZ06p0zKQ+a47F1bMecnCjXGyPg4O9eCUgx/vZDYc8BQXhOYcvhPjCJsSU+nIfFAr1ZnpfNBpNIoQK7E6ofgTnnQkb4eGxme6Gy2uk+vsMvl6FWdPxq32oiCrYxfy0Z7BeY8rtxR/VcXiRFpIOlk= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-ID: MIME-Version: 1.0 X-OriginatorOrg: renesas.com X-MS-Exchange-CrossTenant-Network-Message-Id: 5c7e1282-b237-47f8-93a4-08d659c15063 X-MS-Exchange-CrossTenant-originalarrivaltime: 04 Dec 2018 08:20:13.4599 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 53d82571-da19-47e4-9cb4-625a166a4a2a X-MS-Exchange-Transport-CrossTenantHeadersStamped: TYAPR01MB4255 Cc: Linux-ALSA Subject: [alsa-devel] [PATCH 2/7] ASoC: simple-scu-card: tidyup asoc_simple_card_parse_daifmt() timing 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 Current simple-scu-card driver is parsing codec position for DPCM and consider DAI format. But, current operation is doing totally pointless, because it should be called for each CPU/Codec pair. Let's tidyup asoc_simple_card_parse_daifmt() timing. Signed-off-by: Kuninori Morimoto --- sound/soc/generic/simple-scu-card.c | 37 ++++++++++++++++++++++--------------- 1 file changed, 22 insertions(+), 15 deletions(-) diff --git a/sound/soc/generic/simple-scu-card.c b/sound/soc/generic/simple-scu-card.c index 7ae1901..77c1efb 100644 --- a/sound/soc/generic/simple-scu-card.c +++ b/sound/soc/generic/simple-scu-card.c @@ -92,17 +92,24 @@ static int asoc_simple_card_be_hw_params_fixup(struct snd_soc_pcm_runtime *rtd, return 0; } -static int asoc_simple_card_dai_link_of(struct device_node *np, +static int asoc_simple_card_dai_link_of(struct device_node *link, + struct device_node *np, + struct device_node *codec, struct simple_card_data *priv, - unsigned int daifmt, - int idx, bool is_fe) + int idx, bool is_fe, + bool is_top_level_node) { struct device *dev = simple_priv_to_dev(priv); struct snd_soc_dai_link *dai_link = simple_priv_to_link(priv, idx); struct simple_dai_props *dai_props = simple_priv_to_props(priv, idx); struct snd_soc_card *card = simple_priv_to_card(priv); + char *prefix = ""; int ret; + /* For single DAI link & old style of DT node */ + if (is_top_level_node) + prefix = PREFIX; + if (is_fe) { int is_single_links = 0; struct snd_soc_dai_link_component *codecs; @@ -178,7 +185,11 @@ static int asoc_simple_card_dai_link_of(struct device_node *np, if (ret < 0) return ret; - dai_link->dai_fmt = daifmt; + ret = asoc_simple_card_parse_daifmt(dev, link, codec, + prefix, &dai_link->dai_fmt); + if (ret < 0) + return ret; + dai_link->dpcm_playback = 1; dai_link->dpcm_capture = 1; dai_link->ops = &asoc_simple_card_ops; @@ -191,10 +202,10 @@ static int asoc_simple_card_parse_of(struct simple_card_data *priv) { struct device *dev = simple_priv_to_dev(priv); + struct device_node *node = dev->of_node; struct device_node *np; + struct device_node *codec; struct snd_soc_card *card = simple_priv_to_card(priv); - struct device_node *node = dev->of_node; - unsigned int daifmt = 0; bool is_fe; int ret, i; @@ -211,22 +222,18 @@ static int asoc_simple_card_parse_of(struct simple_card_data *priv) asoc_simple_card_parse_convert(dev, node, PREFIX, &priv->adata); - /* find 1st codec */ - np = of_get_child_by_name(node, PREFIX "codec"); - if (!np) + i = 0; + codec = of_get_child_by_name(node, PREFIX "codec"); + if (!codec) return -ENODEV; - ret = asoc_simple_card_parse_daifmt(dev, node, np, PREFIX, &daifmt); - if (ret < 0) - return ret; - - i = 0; for_each_child_of_node(node, np) { is_fe = false; if (strcmp(np->name, PREFIX "cpu") == 0) is_fe = true; - ret = asoc_simple_card_dai_link_of(np, priv, daifmt, i, is_fe); + ret = asoc_simple_card_dai_link_of(node, np, codec, priv, + i, is_fe, true); if (ret < 0) return ret; i++; From patchwork Tue Dec 4 08:20:26 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuninori Morimoto X-Patchwork-Id: 10711477 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 3F46A17D5 for ; Tue, 4 Dec 2018 10:47:48 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 317592AC49 for ; Tue, 4 Dec 2018 10:47:48 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 257A02ABE4; Tue, 4 Dec 2018 10:47:48 +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=-2.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham 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 EDF572AB15 for ; Tue, 4 Dec 2018 10:47:45 +0000 (UTC) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id 628CC267B58; Tue, 4 Dec 2018 09:20:33 +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 14B6B267B59; Tue, 4 Dec 2018 09:20:31 +0100 (CET) Received: from JPN01-TY1-obe.outbound.protection.outlook.com (mail-eopbgr1400123.outbound.protection.outlook.com [40.107.140.123]) by alsa0.perex.cz (Postfix) with ESMTP id CEA09267B37 for ; Tue, 4 Dec 2018 09:20:28 +0100 (CET) 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:X-MS-Exchange-SenderADCheck; bh=WAvOA6jPzeAaDgB29N+mLjJbLxrDgVggsWu8nPqD+oQ=; b=ADgSRUvMhZsmYylsfqr/WSf550yYQ017C7pKa9ipr0pZ8MBGr2sLVD770da07swKqwZlk2ry/kgEpXQEPfGwBizgALJmKz+HgeWJyiElDQ65pziDjZQ/7Ab31whcvSZEUGaSQkYSy/svZaVGH1s4Q+CXrFRSt2lJOxAMkDSkWGU= Received: from TYAPR01MB3661.jpnprd01.prod.outlook.com (20.178.137.210) by TYAPR01MB1918.jpnprd01.prod.outlook.com (52.133.176.143) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1382.22; Tue, 4 Dec 2018 08:20:26 +0000 Received: from TYAPR01MB3661.jpnprd01.prod.outlook.com ([fe80::70b6:5ef2:3f71:77c7]) by TYAPR01MB3661.jpnprd01.prod.outlook.com ([fe80::70b6:5ef2:3f71:77c7%4]) with mapi id 15.20.1382.020; Tue, 4 Dec 2018 08:20:26 +0000 From: Kuninori Morimoto To: Mark Brown Thread-Topic: [PATCH 3/7] ASoC: simple-scu-card: add dai-link support Thread-Index: AQHUi6o1dz5AIw2cpk+YHcvNLaZ2cA== Date: Tue, 4 Dec 2018 08:20:26 +0000 Message-ID: <87a7ll3e5y.wl-kuninori.morimoto.gx@renesas.com> References: <87efax3e85.wl-kuninori.morimoto.gx@renesas.com> In-Reply-To: <87efax3e85.wl-kuninori.morimoto.gx@renesas.com> Accept-Language: ja-JP, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: TYAPR01CA0044.jpnprd01.prod.outlook.com (2603:1096:404:28::32) To TYAPR01MB3661.jpnprd01.prod.outlook.com (2603:1096:404:c1::18) authentication-results: spf=none (sender IP is ) smtp.mailfrom=kuninori.morimoto.gx@renesas.com; x-ms-exchange-messagesentrepresentingtype: 1 x-originating-ip: [211.11.155.130] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; TYAPR01MB1918; 20:IlOKbKh2CxQM9CMNPv+4CHFhpiFVDjM7Z7O/42lYtFKSUdOq3FPo7pXgHM2c+ET/UpVOY51gM1dGjbj/Cu9nkw7HoMEYwTjuMJjtQZFXqKmLecNvz8Aeti/sYexdZBrA1nyXMY26rKlDxVPDESDo3QJE215M8UsIdp3J79dl9Q4= x-ms-office365-filtering-correlation-id: 1afce05f-7d12-465c-1619-08d659c157e9 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390098)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600074)(711020)(4618075)(2017052603328)(7153060)(7193020); SRVR:TYAPR01MB1918; x-ms-traffictypediagnostic: TYAPR01MB1918: x-microsoft-antispam-prvs: x-ms-exchange-senderadcheck: 1 x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(8121501046)(5005006)(10201501046)(3002001)(3231455)(999002)(944501493)(52105112)(93006095)(93001095)(6055026)(148016)(149066)(150057)(6041310)(20161123558120)(20161123564045)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123562045)(201708071742011)(7699051)(76991095); SRVR:TYAPR01MB1918; BCL:0; PCL:0; RULEID:; SRVR:TYAPR01MB1918; x-forefront-prvs: 0876988AF0 x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(136003)(346002)(396003)(366004)(376002)(39860400002)(189003)(199004)(5660300001)(81166006)(11346002)(81156014)(106356001)(105586002)(478600001)(2616005)(14454004)(25786009)(2906002)(446003)(6506007)(386003)(86362001)(52116002)(486006)(36756003)(4326008)(8676002)(99286004)(186003)(256004)(66066001)(102836004)(6116002)(3846002)(53936002)(97736004)(305945005)(6916009)(7736002)(76176011)(71200400001)(71190400001)(6512007)(68736007)(476003)(6486002)(8936002)(26005)(6436002)(316002); DIR:OUT; SFP:1102; SCL:1; SRVR:TYAPR01MB1918; H:TYAPR01MB3661.jpnprd01.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; received-spf: None (protection.outlook.com: renesas.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: x8u93I7raqMbkdHwnfsoFkmEG81FFMHQaPi6VMtljS3KSwewNSmJHJ38xagx0tDVOgiTPDMweF5dAKhWP4Tl7EiGIgZoJHPlQ+J5D3O9rduNp6znNyXmT12kLNd7UavWB5WN/h7SBW2Y5iPdgG4P++Nh1nWiR8gc8e2FTCybiOvRwEOUG6LnrUlBSFNk2GdPHT9PsR3Ki7t5ZxSdsVvIY1GnFnDXLZj6AA5ANRrwUfpSg9EY31J8IEQquZpaZhj1ao1p2TXdPXeIhbQEdUWEkVC3W60b1lM6lWFnRZTazf95BVz3Zh9wnXe7pRnuSBQuM35YGvzoLdH4WrcWk7Ng5lJhaGyLIQ/AQUcT3IGLwnQ= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-ID: <641592CEB9284443A00DCFFAD6E2244C@jpnprd01.prod.outlook.com> MIME-Version: 1.0 X-OriginatorOrg: renesas.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1afce05f-7d12-465c-1619-08d659c157e9 X-MS-Exchange-CrossTenant-originalarrivaltime: 04 Dec 2018 08:20:26.0699 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 53d82571-da19-47e4-9cb4-625a166a4a2a X-MS-Exchange-Transport-CrossTenantHeadersStamped: TYAPR01MB1918 Cc: Linux-ALSA Subject: [alsa-devel] [PATCH 3/7] ASoC: simple-scu-card: add dai-link support 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 simple-card is supporting dai-link support, but simple-scu-card doesn't have it. This patch support it. This is prepare for merging simple-card and simple-scu-card. Signed-off-by: Kuninori Morimoto --- sound/soc/generic/simple-scu-card.c | 46 ++++++++++++++++++++++--------------- 1 file changed, 28 insertions(+), 18 deletions(-) diff --git a/sound/soc/generic/simple-scu-card.c b/sound/soc/generic/simple-scu-card.c index 77c1efb..666ace6 100644 --- a/sound/soc/generic/simple-scu-card.c +++ b/sound/soc/generic/simple-scu-card.c @@ -202,14 +202,15 @@ static int asoc_simple_card_parse_of(struct simple_card_data *priv) { struct device *dev = simple_priv_to_dev(priv); - struct device_node *node = dev->of_node; + struct device_node *top = dev->of_node; + struct device_node *node; struct device_node *np; struct device_node *codec; struct snd_soc_card *card = simple_priv_to_card(priv); bool is_fe; - int ret, i; + int ret, i, loop; - if (!node) + if (!top) return -EINVAL; ret = asoc_simple_card_of_parse_widgets(card, PREFIX); @@ -220,25 +221,34 @@ static int asoc_simple_card_parse_of(struct simple_card_data *priv) if (ret < 0) return ret; - asoc_simple_card_parse_convert(dev, node, PREFIX, &priv->adata); + asoc_simple_card_parse_convert(dev, top, PREFIX, &priv->adata); + loop = 1; i = 0; - codec = of_get_child_by_name(node, PREFIX "codec"); - if (!codec) - return -ENODEV; - - for_each_child_of_node(node, np) { - is_fe = false; - if (strcmp(np->name, PREFIX "cpu") == 0) - is_fe = true; - - ret = asoc_simple_card_dai_link_of(node, np, codec, priv, - i, is_fe, true); - if (ret < 0) - return ret; - i++; + node = of_get_child_by_name(top, PREFIX "dai-link"); + if (!node) { + node = dev->of_node; + loop = 0; } + do { + codec = of_get_child_by_name(node, + loop ? "codec" : PREFIX "codec"); + if (!codec) + return -ENODEV; + + for_each_child_of_node(node, np) { + is_fe = (np != codec); + + ret = asoc_simple_card_dai_link_of(node, np, codec, priv, + i, is_fe, !loop); + if (ret < 0) + return ret; + i++; + } + node = of_get_next_child(top, node); + } while (loop && node); + ret = asoc_simple_card_parse_card_name(card, PREFIX); if (ret < 0) return ret; From patchwork Tue Dec 4 08:20:47 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuninori Morimoto X-Patchwork-Id: 10711479 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 587E8109C for ; Tue, 4 Dec 2018 10:47:48 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4A1EC2AB18 for ; Tue, 4 Dec 2018 10:47:48 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3E4EC2AD1E; Tue, 4 Dec 2018 10:47:48 +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=-2.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham 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 F36C82AB18 for ; Tue, 4 Dec 2018 10:47:45 +0000 (UTC) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id 8D0CC267B60; Tue, 4 Dec 2018 09:20:53 +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 70B98267B62; Tue, 4 Dec 2018 09:20:51 +0100 (CET) Received: from JPN01-TY1-obe.outbound.protection.outlook.com (mail-eopbgr1400095.outbound.protection.outlook.com [40.107.140.95]) by alsa0.perex.cz (Postfix) with ESMTP id 25E23267B49 for ; Tue, 4 Dec 2018 09:20:48 +0100 (CET) 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:X-MS-Exchange-SenderADCheck; bh=UK5OZcqdI98PeZvnU8+9bDfgcMoS3RblyFoIps+6zYU=; b=WFsUaus7K75X4Xz/TpvOdFisfqJA4OYZ5jJC/HjHNVoZ2fIyDrcE0N+dsI+LLQ/nCELe944Z4ANp/If3mD5g4dG5Njcz2vel9HQpyYh1jU8GtdVqJ4YlZZyR4B0TrwclSpcHtZ/mu8lkRPjpIo1EtOLpnYOYi96LBgJ2qAuu8M4= Received: from TYAPR01MB3661.jpnprd01.prod.outlook.com (20.178.137.210) by TYAPR01MB1918.jpnprd01.prod.outlook.com (52.133.176.143) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1382.22; Tue, 4 Dec 2018 08:20:47 +0000 Received: from TYAPR01MB3661.jpnprd01.prod.outlook.com ([fe80::70b6:5ef2:3f71:77c7]) by TYAPR01MB3661.jpnprd01.prod.outlook.com ([fe80::70b6:5ef2:3f71:77c7%4]) with mapi id 15.20.1382.020; Tue, 4 Dec 2018 08:20:47 +0000 From: Kuninori Morimoto To: Mark Brown Thread-Topic: [PATCH 4/7] ASoC: simple-scu-card: care link / dai count Thread-Index: AQHUi6pCeBXpghM3f0yhtXspO0KHBw== Date: Tue, 4 Dec 2018 08:20:47 +0000 Message-ID: <878t153e5d.wl-kuninori.morimoto.gx@renesas.com> References: <87efax3e85.wl-kuninori.morimoto.gx@renesas.com> In-Reply-To: <87efax3e85.wl-kuninori.morimoto.gx@renesas.com> Accept-Language: ja-JP, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: TYAPR01CA0148.jpnprd01.prod.outlook.com (2603:1096:404:7e::16) To TYAPR01MB3661.jpnprd01.prod.outlook.com (2603:1096:404:c1::18) authentication-results: spf=none (sender IP is ) smtp.mailfrom=kuninori.morimoto.gx@renesas.com; x-ms-exchange-messagesentrepresentingtype: 1 x-originating-ip: [211.11.155.130] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; TYAPR01MB1918; 20:xflTn3SuFbbnx+oGIPlTO5A2FjbCDUWwbURf2cECMpIQzg26gUJPM6aOWjngh1yd15Ju5fWPiMUd9GM6S6jk9zFAesqbPiVLY5RJ1NhsMT4neNtKcLam0gd/3NTKcElWVT37lANoKQKTlc9cCHMOdJQWibS7Imb9Kc0cUUROktU= x-ms-office365-filtering-correlation-id: afb94d7e-ba5e-4c14-0427-08d659c16463 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390098)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600074)(711020)(4618075)(2017052603328)(7153060)(7193020); SRVR:TYAPR01MB1918; x-ms-traffictypediagnostic: TYAPR01MB1918: x-microsoft-antispam-prvs: x-ms-exchange-senderadcheck: 1 x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(8121501046)(5005006)(10201501046)(3002001)(3231455)(999002)(944501493)(52105112)(93006095)(93001095)(6055026)(148016)(149066)(150057)(6041310)(20161123558120)(20161123564045)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123562045)(201708071742011)(7699051)(76991095); SRVR:TYAPR01MB1918; BCL:0; PCL:0; RULEID:; SRVR:TYAPR01MB1918; x-forefront-prvs: 0876988AF0 x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(136003)(346002)(396003)(366004)(376002)(39860400002)(189003)(199004)(5660300001)(81166006)(11346002)(81156014)(106356001)(105586002)(478600001)(2616005)(14454004)(25786009)(2906002)(446003)(6506007)(575784001)(386003)(86362001)(52116002)(486006)(36756003)(4326008)(8676002)(99286004)(186003)(256004)(66066001)(102836004)(6116002)(3846002)(53936002)(97736004)(305945005)(6916009)(7736002)(76176011)(71200400001)(71190400001)(6512007)(68736007)(476003)(6486002)(8936002)(26005)(6436002)(316002); DIR:OUT; SFP:1102; SCL:1; SRVR:TYAPR01MB1918; H:TYAPR01MB3661.jpnprd01.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; received-spf: None (protection.outlook.com: renesas.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: xXLFTQYrwX/EZTeRnAhC3crx+niTEjTmzVmhSfkF5OircJN/upRUEoFCetAzCGjAb84YozG6QJD1O8ThPKsoxsxIijdn11sfWqZkvrK+YaZybjtTYId2K3zBiUkCPnjapJO0KHOU6KIWYjMC+96AxSURy9T2MEZE4gizfl1W8/7ZXjMn3gvXOZ++9ywnMYXk3WNvRghO1+a0lFanEg41oKhScDj4jH0VGns6sgDzM/K/oDwLVWvkJGW7SZGvVGD3oepM1wLPW4frdh+JHncD7ZqW1l2mI7ENbdbnHeb2NKO148VZXYMTDTjIowHu0+l+oyaPaHMyhfIqs/vic5+ApIGrP6dGQs4gpW3RWOyM7Vs= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-ID: <86E3C1FB6C17FE4C914796E86DC925AC@jpnprd01.prod.outlook.com> MIME-Version: 1.0 X-OriginatorOrg: renesas.com X-MS-Exchange-CrossTenant-Network-Message-Id: afb94d7e-ba5e-4c14-0427-08d659c16463 X-MS-Exchange-CrossTenant-originalarrivaltime: 04 Dec 2018 08:20:47.0086 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 53d82571-da19-47e4-9cb4-625a166a4a2a X-MS-Exchange-Transport-CrossTenantHeadersStamped: TYAPR01MB1918 Cc: Linux-ALSA Subject: [alsa-devel] [PATCH 4/7] ASoC: simple-scu-card: care link / dai count 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 In DPCM case, it uses CPU-dummy / dummy-Codec dai links. If sound card is caring only DPCM, link count = dai count, but, if non DPCM case, link count != dai count. Now, we want to merge simple-card and simple-scu-card, then, we need to care both link / dai count more carefly This patch cares it, and prepare for merging simple card Signed-off-by: Kuninori Morimoto --- sound/soc/generic/simple-scu-card.c | 90 ++++++++++++++++++++++++++++++++++--- 1 file changed, 83 insertions(+), 7 deletions(-) diff --git a/sound/soc/generic/simple-scu-card.c b/sound/soc/generic/simple-scu-card.c index 666ace6..1c6382f 100644 --- a/sound/soc/generic/simple-scu-card.c +++ b/sound/soc/generic/simple-scu-card.c @@ -256,6 +256,80 @@ static int asoc_simple_card_parse_of(struct simple_card_data *priv) return 0; } +static void asoc_simple_card_get_dais_count(struct device *dev, + int *link_num, + int *dais_num, + int *ccnf_num) +{ + struct device_node *top = dev->of_node; + struct device_node *node; + int loop; + int num; + + /* + * link_num : number of links. + * CPU-Codec / CPU-dummy / dummy-Codec + * dais_num : number of DAIs + * ccnf_num : number of codec_conf + * same number for "dummy-Codec" + * + * ex1) + * CPU0 --- Codec0 link : 5 + * CPU1 --- Codec1 dais : 7 + * CPU2 -/ ccnf : 1 + * CPU3 --- Codec2 + * + * => 5 links = 2xCPU-Codec + 2xCPU-dummy + 1xdummy-Codec + * => 7 DAIs = 4xCPU + 3xCodec + * => 1 ccnf = 1xdummy-Codec + * + * ex2) + * CPU0 --- Codec0 link : 5 + * CPU1 --- Codec1 dais : 6 + * CPU2 -/ ccnf : 1 + * CPU3 -/ + * + * => 5 links = 1xCPU-Codec + 3xCPU-dummy + 1xdummy-Codec + * => 6 DAIs = 4xCPU + 2xCodec + * => 1 ccnf = 1xdummy-Codec + * + * ex3) + * CPU0 --- Codec0 link : 6 + * CPU1 -/ dais : 6 + * CPU2 --- Codec1 ccnf : 2 + * CPU3 -/ + * + * => 6 links = 0xCPU-Codec + 4xCPU-dummy + 2xdummy-Codec + * => 6 DAIs = 4xCPU + 2xCodec + * => 2 ccnf = 2xdummy-Codec + */ + if (!top) { + (*link_num) = 1; + (*dais_num) = 2; + (*ccnf_num) = 0; + return; + } + + loop = 1; + node = of_get_child_by_name(top, PREFIX "dai-link"); + if (!node) { + node = top; + loop = 0; + } + + do { + num = of_get_child_count(node); + (*dais_num) += num; + if (num > 2) { + (*link_num) += num; + (*ccnf_num)++; + } else { + (*link_num)++; + } + node = of_get_next_child(top, node); + } while (loop && node); +} + static int asoc_simple_card_probe(struct platform_device *pdev) { struct simple_card_data *priv; @@ -263,18 +337,20 @@ static int asoc_simple_card_probe(struct platform_device *pdev) struct simple_dai_props *dai_props; struct snd_soc_card *card; struct device *dev = &pdev->dev; - struct device_node *np = dev->of_node; - int num, ret, i; + int ret, i; + int lnum = 0, dnum = 0, cnum = 0; /* Allocate the private data */ priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); if (!priv) return -ENOMEM; - num = of_get_child_count(np); + asoc_simple_card_get_dais_count(dev, &lnum, &dnum, &cnum); + if (!lnum || !dnum) + return -EINVAL; - dai_props = devm_kcalloc(dev, num, sizeof(*dai_props), GFP_KERNEL); - dai_link = devm_kcalloc(dev, num, sizeof(*dai_link), GFP_KERNEL); + dai_props = devm_kcalloc(dev, lnum, sizeof(*dai_props), GFP_KERNEL); + dai_link = devm_kcalloc(dev, lnum, sizeof(*dai_link), GFP_KERNEL); if (!dai_props || !dai_link) return -ENOMEM; @@ -284,7 +360,7 @@ static int asoc_simple_card_probe(struct platform_device *pdev) * see * soc-core.c :: snd_soc_init_multicodec() */ - for (i = 0; i < num; i++) { + for (i = 0; i < lnum; i++) { dai_link[i].codecs = &dai_props[i].codecs; dai_link[i].num_codecs = 1; dai_link[i].platform = &dai_props[i].platform; @@ -298,7 +374,7 @@ static int asoc_simple_card_probe(struct platform_device *pdev) card->owner = THIS_MODULE; card->dev = dev; card->dai_link = priv->dai_link; - card->num_links = num; + card->num_links = lnum; card->codec_conf = &priv->codec_conf; card->num_configs = 1; From patchwork Tue Dec 4 08:21:00 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuninori Morimoto X-Patchwork-Id: 10711485 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id F21C6417B for ; Tue, 4 Dec 2018 10:47:48 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E31D72AB15 for ; Tue, 4 Dec 2018 10:47:48 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D76A02AB8F; Tue, 4 Dec 2018 10:47:48 +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=-2.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham 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 386AD2AB15 for ; Tue, 4 Dec 2018 10:47:48 +0000 (UTC) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id E67DE267B5F; Tue, 4 Dec 2018 09:21: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 F390A267B68; Tue, 4 Dec 2018 09:21:05 +0100 (CET) Received: from JPN01-OS2-obe.outbound.protection.outlook.com (mail-eopbgr1410113.outbound.protection.outlook.com [40.107.141.113]) by alsa0.perex.cz (Postfix) with ESMTP id 86353267B59 for ; Tue, 4 Dec 2018 09:21:03 +0100 (CET) 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:X-MS-Exchange-SenderADCheck; bh=iAw0R6E1DQkokQ3ALTuIV4l/d2Bc4Ok8nEIoOJLl54Q=; b=KYimjdUf2kqmkklP+TXYM1eTtxRaQIxLmHTIMOvEUi7wmGgtbGEaCY5aBk+j9RACgGiYKK133LQXeWEjrFJFd5uKNcC6k/erFjiDrpl3CC0UCSIPW/ANDO2FqsXV5jAM1dSJbYg8IcPGnpVkkXhgM41zcq+xz3dmSwFl/wQLu/I= Received: from TYAPR01MB3661.jpnprd01.prod.outlook.com (20.178.137.210) by TYAPR01MB4255.jpnprd01.prod.outlook.com (20.178.140.149) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1382.22; Tue, 4 Dec 2018 08:21:01 +0000 Received: from TYAPR01MB3661.jpnprd01.prod.outlook.com ([fe80::70b6:5ef2:3f71:77c7]) by TYAPR01MB3661.jpnprd01.prod.outlook.com ([fe80::70b6:5ef2:3f71:77c7%4]) with mapi id 15.20.1382.020; Tue, 4 Dec 2018 08:21:00 +0000 From: Kuninori Morimoto To: Mark Brown Thread-Topic: [PATCH 5/7] ASoC: simple-scu-card: tidyup "convert-rate/channels" parsing Thread-Index: AQHUi6pKchue/zNlXEG2Ncd6W2zTbw== Date: Tue, 4 Dec 2018 08:21:00 +0000 Message-ID: <877egp3e4z.wl-kuninori.morimoto.gx@renesas.com> References: <87efax3e85.wl-kuninori.morimoto.gx@renesas.com> In-Reply-To: <87efax3e85.wl-kuninori.morimoto.gx@renesas.com> Accept-Language: ja-JP, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: TY2PR04CA0021.apcprd04.prod.outlook.com (2603:1096:404:f6::33) To TYAPR01MB3661.jpnprd01.prod.outlook.com (2603:1096:404:c1::18) authentication-results: spf=none (sender IP is ) smtp.mailfrom=kuninori.morimoto.gx@renesas.com; x-ms-exchange-messagesentrepresentingtype: 1 x-originating-ip: [211.11.155.130] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; TYAPR01MB4255; 20:24FTI2ltapcsA4jEje5ogfjJQ2sadzoEcf7iNz1NHDhs2ibwdClAC68rD6rVXerdM0dSVEByU3djXgj4VDQoWXd6fjN5SA3pyiN08n3DKFPUU5pbW9UDm9nq44QASMKj3Ho1I/W5bnMcB809Sh1RD6WCh14T5g898+cAzYkjvDs= x-ms-office365-filtering-correlation-id: 82aace04-b9fe-4094-89c6-08d659c16c8a x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390098)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600074)(711020)(4618075)(2017052603328)(7153060)(7193020); SRVR:TYAPR01MB4255; x-ms-traffictypediagnostic: TYAPR01MB4255: x-microsoft-antispam-prvs: x-ms-exchange-senderadcheck: 1 x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(8121501046)(5005006)(93006095)(93001095)(3231455)(999002)(944501493)(52105112)(3002001)(10201501046)(6055026)(148016)(149066)(150057)(6041310)(20161123562045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123564045)(20161123560045)(20161123558120)(201708071742011)(7699051)(76991095); SRVR:TYAPR01MB4255; BCL:0; PCL:0; RULEID:; SRVR:TYAPR01MB4255; x-forefront-prvs: 0876988AF0 x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(136003)(39860400002)(376002)(346002)(396003)(366004)(189003)(199004)(81156014)(8676002)(486006)(8936002)(81166006)(99286004)(2906002)(3846002)(256004)(11346002)(6116002)(71200400001)(446003)(476003)(71190400001)(86362001)(25786009)(2616005)(68736007)(53936002)(36756003)(478600001)(4326008)(5660300001)(305945005)(14454004)(7736002)(97736004)(26005)(6506007)(102836004)(76176011)(186003)(386003)(6436002)(6512007)(105586002)(6486002)(52116002)(106356001)(6916009)(66066001)(316002); DIR:OUT; SFP:1102; SCL:1; SRVR:TYAPR01MB4255; H:TYAPR01MB3661.jpnprd01.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; received-spf: None (protection.outlook.com: renesas.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: 0OpsU+MMWREjC/9WLORMV71Yrdo3Mld1WuViJ1sWrTmrL7OSVkwu6w8rffAGl6IM2Vjg7XC8M3u4QvD4Ei32WW3Qa1QvV0NSYVi6qOJtbSvcf67Wzurk2qxtV6sdhTm5ioU6GmHz6/72cZYAQjFIVvT+Y4XX40eWXbJRAkGi3vBYtyz1JSksefFqT7gGE+QmHHH0wZTuySq9XKlUoBzceoW+43sT53P6OYC7E6n/dCXI894JW7ZncGw8gCCEIPkuVE2TS6DPwo40afwxzZhMotf+diHCF1VSQcLedf2vMugWp+lYtpraCKVALO7Tc5lrCpm/18Lq9sMrtOw9DAayaeafzeFhR7WEZ5J74sCDwQw= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-ID: <669933256909A44685B3267FFE151C38@jpnprd01.prod.outlook.com> MIME-Version: 1.0 X-OriginatorOrg: renesas.com X-MS-Exchange-CrossTenant-Network-Message-Id: 82aace04-b9fe-4094-89c6-08d659c16c8a X-MS-Exchange-CrossTenant-originalarrivaltime: 04 Dec 2018 08:21:00.7525 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 53d82571-da19-47e4-9cb4-625a166a4a2a X-MS-Exchange-Transport-CrossTenantHeadersStamped: TYAPR01MB4255 Cc: Linux-ALSA Subject: [alsa-devel] [PATCH 5/7] ASoC: simple-scu-card: tidyup "convert-rate/channels" parsing 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 simple-scu-card.c is supporting "convert-rate/channels" which is used for DPCM. But, sound card might have multi codecs, and each codec might need each convert-rate/channels. This patch supports each codec's convert-rate/channles support. top node convert-rate/channels will overwrite settings if exist. It can't support each codec's convert-rate/channels if sound card had multi codecs without this patch. Signed-off-by: Kuninori Morimoto --- sound/soc/generic/simple-scu-card.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/sound/soc/generic/simple-scu-card.c b/sound/soc/generic/simple-scu-card.c index 1c6382f..3c4e289 100644 --- a/sound/soc/generic/simple-scu-card.c +++ b/sound/soc/generic/simple-scu-card.c @@ -26,6 +26,7 @@ struct simple_card_data { struct asoc_simple_dai dai; struct snd_soc_dai_link_component codecs; struct snd_soc_dai_link_component platform; + struct asoc_simple_card_data adata; } *dai_props; struct snd_soc_dai_link *dai_link; struct asoc_simple_card_data adata; @@ -86,7 +87,11 @@ static int asoc_simple_card_be_hw_params_fixup(struct snd_soc_pcm_runtime *rtd, struct snd_pcm_hw_params *params) { struct simple_card_data *priv = snd_soc_card_get_drvdata(rtd->card); + struct simple_dai_props *dai_props = simple_priv_to_props(priv, rtd->num); + asoc_simple_card_convert_fixup(&dai_props->adata, params); + + /* overwrite by top level adata if exist */ asoc_simple_card_convert_fixup(&priv->adata, params); return 0; @@ -177,6 +182,8 @@ static int asoc_simple_card_dai_link_of(struct device_node *link, "prefix"); } + asoc_simple_card_parse_convert(dev, link, prefix, &dai_props->adata); + ret = asoc_simple_card_of_parse_tdm(np, &dai_props->dai); if (ret) return ret; From patchwork Tue Dec 4 08:21:15 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuninori Morimoto X-Patchwork-Id: 10711489 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 03B0F17DB for ; Tue, 4 Dec 2018 10:47:50 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E78012AAD0 for ; Tue, 4 Dec 2018 10:47:49 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D9A832AB15; Tue, 4 Dec 2018 10:47:49 +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=-2.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham 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 04CE92AB2F for ; Tue, 4 Dec 2018 10:47:45 +0000 (UTC) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id 4BE36267B59; Tue, 4 Dec 2018 09:21:23 +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 A16DB267B59; Tue, 4 Dec 2018 09:21:20 +0100 (CET) Received: from JPN01-OS2-obe.outbound.protection.outlook.com (mail-eopbgr1410122.outbound.protection.outlook.com [40.107.141.122]) by alsa0.perex.cz (Postfix) with ESMTP id 0CDEA267B67 for ; Tue, 4 Dec 2018 09:21:17 +0100 (CET) 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:X-MS-Exchange-SenderADCheck; bh=DBXhGX1bEvkYNwnMHN3eTeneziVT0cGStE6lesXbOY0=; b=gokD98qEQbmXJ47bewvap1L2qSOx15XQ8aYWJxjgzWsWCrPTkZGIyFXqY//22dBr2tBNO6vXQijvoRkqFT4F3Uuo7SWwCJ0f0QhQpgn/x4fUVtVrEnYGeUI+iHNa4Fj3WuUpqqdtfYHwgLDnZLlXdCs47mdLuuKtlXFv5VXC/Qc= Received: from TYAPR01MB3661.jpnprd01.prod.outlook.com (20.178.137.210) by TYAPR01MB4255.jpnprd01.prod.outlook.com (20.178.140.149) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1382.22; Tue, 4 Dec 2018 08:21:15 +0000 Received: from TYAPR01MB3661.jpnprd01.prod.outlook.com ([fe80::70b6:5ef2:3f71:77c7]) by TYAPR01MB3661.jpnprd01.prod.outlook.com ([fe80::70b6:5ef2:3f71:77c7%4]) with mapi id 15.20.1382.020; Tue, 4 Dec 2018 08:21:15 +0000 From: Kuninori Morimoto To: Mark Brown Thread-Topic: [PATCH 6/7] ASoC: simple-scu-card: use cpu/codec pointer on graph_dai_props Thread-Index: AQHUi6pSB6Mhpl0uMUqVygoDXK+YSA== Date: Tue, 4 Dec 2018 08:21:15 +0000 Message-ID: <875zw93e4l.wl-kuninori.morimoto.gx@renesas.com> References: <87efax3e85.wl-kuninori.morimoto.gx@renesas.com> In-Reply-To: <87efax3e85.wl-kuninori.morimoto.gx@renesas.com> Accept-Language: ja-JP, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: TY2PR04CA0012.apcprd04.prod.outlook.com (2603:1096:404:f6::24) To TYAPR01MB3661.jpnprd01.prod.outlook.com (2603:1096:404:c1::18) authentication-results: spf=none (sender IP is ) smtp.mailfrom=kuninori.morimoto.gx@renesas.com; x-ms-exchange-messagesentrepresentingtype: 1 x-originating-ip: [211.11.155.130] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; TYAPR01MB4255; 20:t5gHEHOmMtbvWeMmPXEpVUhUfrXtCfUlwVVyRzxEQkH+qF0N73MkVKEWgleADTW0lTR9/cC8J9ZVKbdDwPk/zAxEqHiIuGbuqKDkyWmCG8s54g2O9aP96yi+tMwo5POJWaYqNS2QoceACVklCieuT5qzEn0rfXgNBDB0ezB3ZIU= x-ms-office365-filtering-correlation-id: b4e62ce9-0ba6-4278-e5a8-08d659c1752d x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390098)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600074)(711020)(4618075)(2017052603328)(7153060)(7193020); SRVR:TYAPR01MB4255; x-ms-traffictypediagnostic: TYAPR01MB4255: x-microsoft-antispam-prvs: x-ms-exchange-senderadcheck: 1 x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(8121501046)(5005006)(93006095)(93001095)(3231455)(999002)(944501493)(52105112)(3002001)(10201501046)(6055026)(148016)(149066)(150057)(6041310)(20161123562045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123564045)(20161123560045)(20161123558120)(201708071742011)(7699051)(76991095); SRVR:TYAPR01MB4255; BCL:0; PCL:0; RULEID:; SRVR:TYAPR01MB4255; x-forefront-prvs: 0876988AF0 x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(136003)(39860400002)(376002)(346002)(396003)(366004)(189003)(199004)(81156014)(8676002)(486006)(8936002)(81166006)(99286004)(2906002)(3846002)(256004)(11346002)(6116002)(71200400001)(446003)(476003)(71190400001)(86362001)(25786009)(2616005)(68736007)(53936002)(36756003)(478600001)(4326008)(5660300001)(305945005)(14454004)(7736002)(97736004)(26005)(6506007)(102836004)(76176011)(186003)(386003)(6436002)(6512007)(105586002)(6486002)(52116002)(106356001)(6916009)(66066001)(316002); DIR:OUT; SFP:1102; SCL:1; SRVR:TYAPR01MB4255; H:TYAPR01MB3661.jpnprd01.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; received-spf: None (protection.outlook.com: renesas.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: 9n9LkKVDGP4/kIkP0tcSmWA68/T2GqdYV1scpz23GxIXJHFwKAn4jtO0CWpJpTONdUMa7zRzgRWchQJrsZVWHZOYCbbmKkOxoGI3Lj8O5+R8GK/Tihk3KuFHHlfeZs2ysWKX4L1q8r81Zp7Bpc3FoGi4HZ2qWwCcKFqNXLK0ZH3Gb7jDlF/ZQJnoDFFwssQ3lp7NLZUP+GtCpRj2ZaNlVU8+Ht8p/ug6054PWQ5wJU3WpxqXSHuZMSA8UhG5scKehstH5t7bHk7thK1BU5v12gZkhw443F+k4xWV60XPK7XmJIYTKaGpGad7V2J0Q8swTNXGE7PSbWNztJWpAstFKJ31BPYMfo87V2NyiEYP+0Q= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-ID: MIME-Version: 1.0 X-OriginatorOrg: renesas.com X-MS-Exchange-CrossTenant-Network-Message-Id: b4e62ce9-0ba6-4278-e5a8-08d659c1752d X-MS-Exchange-CrossTenant-originalarrivaltime: 04 Dec 2018 08:21:15.2238 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 53d82571-da19-47e4-9cb4-625a166a4a2a X-MS-Exchange-Transport-CrossTenantHeadersStamped: TYAPR01MB4255 Cc: Linux-ALSA Subject: [alsa-devel] [PATCH 6/7] ASoC: simple-scu-card: use cpu/codec pointer on graph_dai_props 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 In DPCM case, it uses CPU-dummy / dummy-Codec dai links, and non DPCM case, it uses CPU-Codec dai links. Now, we want to merge simple-card and simple-scu-card. These sound cards are using silimar but not same logic on each functions. Then, of course we want to share same logic. To compromise, this patch uses cpu/codec pointer on simple-scu-card. It is same logic with simple-card, thus easy merging. This is prepare for merging simple card Signed-off-by: Kuninori Morimoto --- sound/soc/generic/simple-scu-card.c | 77 +++++++++++++++++++++++++------------ 1 file changed, 52 insertions(+), 25 deletions(-) diff --git a/sound/soc/generic/simple-scu-card.c b/sound/soc/generic/simple-scu-card.c index 3c4e289..944a6f4 100644 --- a/sound/soc/generic/simple-scu-card.c +++ b/sound/soc/generic/simple-scu-card.c @@ -23,12 +23,14 @@ struct simple_card_data { struct snd_soc_card snd_card; struct snd_soc_codec_conf codec_conf; struct simple_dai_props { - struct asoc_simple_dai dai; + struct asoc_simple_dai *cpu_dai; + struct asoc_simple_dai *codec_dai; struct snd_soc_dai_link_component codecs; struct snd_soc_dai_link_component platform; struct asoc_simple_card_data adata; } *dai_props; struct snd_soc_dai_link *dai_link; + struct asoc_simple_dai *dais; struct asoc_simple_card_data adata; }; @@ -47,8 +49,17 @@ static int asoc_simple_card_startup(struct snd_pcm_substream *substream) struct simple_card_data *priv = snd_soc_card_get_drvdata(rtd->card); struct simple_dai_props *dai_props = simple_priv_to_props(priv, rtd->num); + int ret; + + ret = asoc_simple_card_clk_enable(dai_props->cpu_dai); + if (ret) + return ret; + + ret = asoc_simple_card_clk_enable(dai_props->codec_dai); + if (ret) + asoc_simple_card_clk_disable(dai_props->cpu_dai); - return asoc_simple_card_clk_enable(&dai_props->dai); + return ret; } static void asoc_simple_card_shutdown(struct snd_pcm_substream *substream) @@ -58,7 +69,9 @@ static void asoc_simple_card_shutdown(struct snd_pcm_substream *substream) struct simple_dai_props *dai_props = simple_priv_to_props(priv, rtd->num); - asoc_simple_card_clk_disable(&dai_props->dai); + asoc_simple_card_clk_disable(dai_props->cpu_dai); + + asoc_simple_card_clk_disable(dai_props->codec_dai); } static const struct snd_soc_ops asoc_simple_card_ops = { @@ -68,19 +81,21 @@ static const struct snd_soc_ops asoc_simple_card_ops = { static int asoc_simple_card_dai_init(struct snd_soc_pcm_runtime *rtd) { - struct simple_card_data *priv = snd_soc_card_get_drvdata(rtd->card); - struct snd_soc_dai *dai; - struct snd_soc_dai_link *dai_link; - struct simple_dai_props *dai_props; - int num = rtd->num; + struct simple_card_data *priv = snd_soc_card_get_drvdata(rtd->card); + struct simple_dai_props *dai_props = simple_priv_to_props(priv, rtd->num); + int ret; - dai_link = simple_priv_to_link(priv, num); - dai_props = simple_priv_to_props(priv, num); - dai = dai_link->dynamic ? - rtd->cpu_dai : - rtd->codec_dai; + ret = asoc_simple_card_init_dai(rtd->codec_dai, + dai_props->codec_dai); + if (ret < 0) + return ret; - return asoc_simple_card_init_dai(dai, &dai_props->dai); + ret = asoc_simple_card_init_dai(rtd->cpu_dai, + dai_props->cpu_dai); + if (ret < 0) + return ret; + + return 0; } static int asoc_simple_card_be_hw_params_fixup(struct snd_soc_pcm_runtime *rtd, @@ -101,13 +116,14 @@ static int asoc_simple_card_dai_link_of(struct device_node *link, struct device_node *np, struct device_node *codec, struct simple_card_data *priv, - int idx, bool is_fe, + int *dai_idx, int link_idx, int is_fe, bool is_top_level_node) { struct device *dev = simple_priv_to_dev(priv); - struct snd_soc_dai_link *dai_link = simple_priv_to_link(priv, idx); - struct simple_dai_props *dai_props = simple_priv_to_props(priv, idx); + struct snd_soc_dai_link *dai_link = simple_priv_to_link(priv, link_idx); + struct simple_dai_props *dai_props = simple_priv_to_props(priv, link_idx); struct snd_soc_card *card = simple_priv_to_card(priv); + struct asoc_simple_dai *dai; char *prefix = ""; int ret; @@ -129,12 +145,15 @@ static int asoc_simple_card_dai_link_of(struct device_node *link, dai_link->dynamic = 1; dai_link->dpcm_merged_format = 1; + dai = + dai_props->cpu_dai = &priv->dais[(*dai_idx)++]; + ret = asoc_simple_card_parse_cpu(np, dai_link, DAI, CELL, &is_single_links); if (ret) return ret; - ret = asoc_simple_card_parse_clk_cpu(dev, np, dai_link, &dai_props->dai); + ret = asoc_simple_card_parse_clk_cpu(dev, np, dai_link, dai); if (ret < 0) return ret; @@ -155,11 +174,14 @@ static int asoc_simple_card_dai_link_of(struct device_node *link, dai_link->no_pcm = 1; dai_link->be_hw_params_fixup = asoc_simple_card_be_hw_params_fixup; + dai = + dai_props->codec_dai = &priv->dais[(*dai_idx)++]; + ret = asoc_simple_card_parse_codec(np, dai_link, DAI, CELL); if (ret < 0) return ret; - ret = asoc_simple_card_parse_clk_codec(dev, np, dai_link, &dai_props->dai); + ret = asoc_simple_card_parse_clk_codec(dev, np, dai_link, dai); if (ret < 0) return ret; @@ -184,7 +206,7 @@ static int asoc_simple_card_dai_link_of(struct device_node *link, asoc_simple_card_parse_convert(dev, link, prefix, &dai_props->adata); - ret = asoc_simple_card_of_parse_tdm(np, &dai_props->dai); + ret = asoc_simple_card_of_parse_tdm(np, dai); if (ret) return ret; @@ -215,7 +237,8 @@ static int asoc_simple_card_parse_of(struct simple_card_data *priv) struct device_node *codec; struct snd_soc_card *card = simple_priv_to_card(priv); bool is_fe; - int ret, i, loop; + int ret, loop; + int dai_idx, link_idx; if (!top) return -EINVAL; @@ -231,7 +254,8 @@ static int asoc_simple_card_parse_of(struct simple_card_data *priv) asoc_simple_card_parse_convert(dev, top, PREFIX, &priv->adata); loop = 1; - i = 0; + link_idx = 0; + dai_idx = 0; node = of_get_child_by_name(top, PREFIX "dai-link"); if (!node) { node = dev->of_node; @@ -248,10 +272,10 @@ static int asoc_simple_card_parse_of(struct simple_card_data *priv) is_fe = (np != codec); ret = asoc_simple_card_dai_link_of(node, np, codec, priv, - i, is_fe, !loop); + &dai_idx, link_idx++, + is_fe, !loop); if (ret < 0) return ret; - i++; } node = of_get_next_child(top, node); } while (loop && node); @@ -342,6 +366,7 @@ static int asoc_simple_card_probe(struct platform_device *pdev) struct simple_card_data *priv; struct snd_soc_dai_link *dai_link; struct simple_dai_props *dai_props; + struct asoc_simple_dai *dais; struct snd_soc_card *card; struct device *dev = &pdev->dev; int ret, i; @@ -358,7 +383,8 @@ static int asoc_simple_card_probe(struct platform_device *pdev) dai_props = devm_kcalloc(dev, lnum, sizeof(*dai_props), GFP_KERNEL); dai_link = devm_kcalloc(dev, lnum, sizeof(*dai_link), GFP_KERNEL); - if (!dai_props || !dai_link) + dais = devm_kcalloc(dev, dnum, sizeof(*dais), GFP_KERNEL); + if (!dai_props || !dai_link || !dais) return -ENOMEM; /* @@ -375,6 +401,7 @@ static int asoc_simple_card_probe(struct platform_device *pdev) priv->dai_props = dai_props; priv->dai_link = dai_link; + priv->dais = dais; /* Init snd_soc_card */ card = simple_priv_to_card(priv); From patchwork Tue Dec 4 08:25:02 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuninori Morimoto X-Patchwork-Id: 10711491 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id EC53217DB for ; Tue, 4 Dec 2018 10:52:45 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DA63A2AE9E for ; Tue, 4 Dec 2018 10:52:45 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CE5ED2B799; Tue, 4 Dec 2018 10:52:45 +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=-2.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham 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 06B4C2B794 for ; Tue, 4 Dec 2018 10:52:45 +0000 (UTC) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id 0C306267B62; Tue, 4 Dec 2018 09:25:10 +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 C4971267B6F; Tue, 4 Dec 2018 09:25:07 +0100 (CET) Received: from JPN01-TY1-obe.outbound.protection.outlook.com (mail-eopbgr1400110.outbound.protection.outlook.com [40.107.140.110]) by alsa0.perex.cz (Postfix) with ESMTP id E4B84267B49 for ; Tue, 4 Dec 2018 09:25:04 +0100 (CET) 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:X-MS-Exchange-SenderADCheck; bh=XEZVuZCGl/6QGHPXGID8sNpQI9qAEd0+48bzNGLtz9I=; b=b0GlhHXUPuSEPx49GzhQS3GZRbJWDp3+8oqd6WVUjUz5LSNGOd7nUEW5ZnJXsKvKQrMX9pr2OK95QyPOdWznpliXmmKg2ewW4PrxKL/5efN/gNsTv15dPYmkyCt7yPSwCW3CPqYiudWc9Tw+4C3d6v9YACCw2AVPOPWUuXutcXw= Received: from TYAPR01MB3661.jpnprd01.prod.outlook.com (20.178.137.210) by TYAPR01MB4574.jpnprd01.prod.outlook.com (20.179.174.142) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1404.17; Tue, 4 Dec 2018 08:25:02 +0000 Received: from TYAPR01MB3661.jpnprd01.prod.outlook.com ([fe80::70b6:5ef2:3f71:77c7]) by TYAPR01MB3661.jpnprd01.prod.outlook.com ([fe80::70b6:5ef2:3f71:77c7%4]) with mapi id 15.20.1382.020; Tue, 4 Dec 2018 08:25:02 +0000 From: Kuninori Morimoto To: Mark Brown Thread-Topic: [PATCH 7/7] ASoC: simple-scu-card: care multi DPCM codec_conf Thread-Index: AQHUi6raIk2uLk8K2US8nRMyRbM0vA== Date: Tue, 4 Dec 2018 08:25:02 +0000 Message-ID: <874lbt3dya.wl-kuninori.morimoto.gx@renesas.com> References: <87efax3e85.wl-kuninori.morimoto.gx@renesas.com> In-Reply-To: <87efax3e85.wl-kuninori.morimoto.gx@renesas.com> Accept-Language: ja-JP, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: TYAPR01CA0091.jpnprd01.prod.outlook.com (2603:1096:404:2c::31) To TYAPR01MB3661.jpnprd01.prod.outlook.com (2603:1096:404:c1::18) authentication-results: spf=none (sender IP is ) smtp.mailfrom=kuninori.morimoto.gx@renesas.com; x-ms-exchange-messagesentrepresentingtype: 1 x-originating-ip: [211.11.155.130] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; TYAPR01MB4574; 20:ctLJh1jFGCAj7iJ1WqxEl6U94Wv04vWweIUF5WoJ0PUxI9rYlJ0575xpW1LngjDfZpdQDIKUmcAHNIh360YLGyPTfPxyB7lCYJimC5EYFwiI+9Q95GyoVVA7yYzBxnWTWegt4D+R/LJ913Kjurguq83BuLJUZxVfNuDFKlL4nBg= x-ms-office365-filtering-correlation-id: 9214a210-e7dc-419b-bbc6-08d659c1fc87 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390098)(7020095)(4652040)(8989299)(5600074)(711020)(4618075)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(2017052603328)(7153060)(7193020); SRVR:TYAPR01MB4574; x-ms-traffictypediagnostic: TYAPR01MB4574: x-microsoft-antispam-prvs: x-ms-exchange-senderadcheck: 1 x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(5005006)(8121501046)(10201501046)(3002001)(93006095)(93001095)(3231455)(999002)(944501493)(52105112)(6055026)(148016)(149066)(150057)(6041310)(20161123558120)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(20161123564045)(20161123562045)(201708071742011)(7699051)(76991095); SRVR:TYAPR01MB4574; BCL:0; PCL:0; RULEID:; SRVR:TYAPR01MB4574; x-forefront-prvs: 0876988AF0 x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(366004)(136003)(396003)(39860400002)(346002)(376002)(189003)(199004)(68736007)(105586002)(6116002)(5660300001)(99286004)(97736004)(3846002)(486006)(4326008)(52116002)(6436002)(316002)(7736002)(6486002)(66066001)(305945005)(2906002)(106356001)(6512007)(6916009)(53936002)(8676002)(81166006)(71190400001)(71200400001)(81156014)(8936002)(36756003)(256004)(478600001)(25786009)(446003)(6506007)(386003)(86362001)(11346002)(14454004)(76176011)(102836004)(2616005)(476003)(26005)(186003); DIR:OUT; SFP:1102; SCL:1; SRVR:TYAPR01MB4574; H:TYAPR01MB3661.jpnprd01.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; received-spf: None (protection.outlook.com: renesas.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: /Qj2/HNBq9Ukyej7I1doaNmK8lK1jj+68NLPtHD31sE8S96NAMRvMBK5CQh0kz0VaimQJfRCwnI8nSJv4oTkeI8/czkxL8J7NJhxyKfm7Qj2tjv6jb36DD3C8PQHvY+hQJ/CElDDiU3EKYtNMdcB05oO71ymUs5XFO5HbuPrnmdI0l3QMoq4LHUdeWNuwg10vOlO9cVqgtPK4bp1jtx3S+4j73970b8IDF+01urCxRFcxsuPIWIN8DP7Tq22DKs/EPw4b3KLIOtTkErVaGhemoCXBvBMCySN6Pq2P8tXyJZuLoHfTtm3WmG9rjyiKwpnTb2WyvWwR8OIo2wpX2Y1wQHqz38sP8tPSGF82uPW3QU= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-ID: <630482A77840424E98E1D1D2EF93876B@jpnprd01.prod.outlook.com> MIME-Version: 1.0 X-OriginatorOrg: renesas.com X-MS-Exchange-CrossTenant-Network-Message-Id: 9214a210-e7dc-419b-bbc6-08d659c1fc87 X-MS-Exchange-CrossTenant-originalarrivaltime: 04 Dec 2018 08:25:02.3330 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 53d82571-da19-47e4-9cb4-625a166a4a2a X-MS-Exchange-Transport-CrossTenantHeadersStamped: TYAPR01MB4574 Cc: Linux-ALSA Subject: [alsa-devel] [PATCH 7/7] ASoC: simple-scu-card: care multi DPCM codec_conf 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 Current simple-scu-card didn't care about codec_conf for multi DPCM case. This patch cares it. Signed-off-by: Kuninori Morimoto --- sound/soc/generic/simple-scu-card.c | 30 ++++++++++++++++++++---------- 1 file changed, 20 insertions(+), 10 deletions(-) diff --git a/sound/soc/generic/simple-scu-card.c b/sound/soc/generic/simple-scu-card.c index 944a6f4..9d7299d 100644 --- a/sound/soc/generic/simple-scu-card.c +++ b/sound/soc/generic/simple-scu-card.c @@ -21,17 +21,18 @@ struct simple_card_data { struct snd_soc_card snd_card; - struct snd_soc_codec_conf codec_conf; struct simple_dai_props { struct asoc_simple_dai *cpu_dai; struct asoc_simple_dai *codec_dai; struct snd_soc_dai_link_component codecs; struct snd_soc_dai_link_component platform; struct asoc_simple_card_data adata; + struct snd_soc_codec_conf *codec_conf; } *dai_props; struct snd_soc_dai_link *dai_link; struct asoc_simple_dai *dais; struct asoc_simple_card_data adata; + struct snd_soc_codec_conf *codec_conf; }; #define simple_priv_to_card(priv) (&(priv)->snd_card) @@ -116,7 +117,8 @@ static int asoc_simple_card_dai_link_of(struct device_node *link, struct device_node *np, struct device_node *codec, struct simple_card_data *priv, - int *dai_idx, int link_idx, int is_fe, + int *dai_idx, int link_idx, + int *conf_idx, int is_fe, bool is_top_level_node) { struct device *dev = simple_priv_to_dev(priv); @@ -165,6 +167,8 @@ static int asoc_simple_card_dai_link_of(struct device_node *link, asoc_simple_card_canonicalize_cpu(dai_link, is_single_links); } else { + struct snd_soc_codec_conf *cconf; + /* FE is dummy */ dai_link->cpu_of_node = NULL; dai_link->cpu_dai_name = "snd-soc-dummy-dai"; @@ -177,6 +181,9 @@ static int asoc_simple_card_dai_link_of(struct device_node *link, dai = dai_props->codec_dai = &priv->dais[(*dai_idx)++]; + cconf = + dai_props->codec_conf = &priv->codec_conf[(*conf_idx)++]; + ret = asoc_simple_card_parse_codec(np, dai_link, DAI, CELL); if (ret < 0) return ret; @@ -192,14 +199,12 @@ static int asoc_simple_card_dai_link_of(struct device_node *link, return ret; /* check "prefix" from top node */ - snd_soc_of_parse_audio_prefix(card, - &priv->codec_conf, + snd_soc_of_parse_audio_prefix(card, cconf, dai_link->codecs->of_node, PREFIX "prefix"); /* check "prefix" from each node if top doesn't have */ - if (!priv->codec_conf.of_node) - snd_soc_of_parse_node_prefix(np, - &priv->codec_conf, + if (!cconf->of_node) + snd_soc_of_parse_node_prefix(np, cconf, dai_link->codecs->of_node, "prefix"); } @@ -238,7 +243,7 @@ static int asoc_simple_card_parse_of(struct simple_card_data *priv) struct snd_soc_card *card = simple_priv_to_card(priv); bool is_fe; int ret, loop; - int dai_idx, link_idx; + int dai_idx, link_idx, conf_idx; if (!top) return -EINVAL; @@ -256,6 +261,7 @@ static int asoc_simple_card_parse_of(struct simple_card_data *priv) loop = 1; link_idx = 0; dai_idx = 0; + conf_idx = 0; node = of_get_child_by_name(top, PREFIX "dai-link"); if (!node) { node = dev->of_node; @@ -273,6 +279,7 @@ static int asoc_simple_card_parse_of(struct simple_card_data *priv) ret = asoc_simple_card_dai_link_of(node, np, codec, priv, &dai_idx, link_idx++, + &conf_idx, is_fe, !loop); if (ret < 0) return ret; @@ -368,6 +375,7 @@ static int asoc_simple_card_probe(struct platform_device *pdev) struct simple_dai_props *dai_props; struct asoc_simple_dai *dais; struct snd_soc_card *card; + struct snd_soc_codec_conf *cconf; struct device *dev = &pdev->dev; int ret, i; int lnum = 0, dnum = 0, cnum = 0; @@ -384,6 +392,7 @@ static int asoc_simple_card_probe(struct platform_device *pdev) dai_props = devm_kcalloc(dev, lnum, sizeof(*dai_props), GFP_KERNEL); dai_link = devm_kcalloc(dev, lnum, sizeof(*dai_link), GFP_KERNEL); dais = devm_kcalloc(dev, dnum, sizeof(*dais), GFP_KERNEL); + cconf = devm_kcalloc(dev, cnum, sizeof(*cconf), GFP_KERNEL); if (!dai_props || !dai_link || !dais) return -ENOMEM; @@ -402,6 +411,7 @@ static int asoc_simple_card_probe(struct platform_device *pdev) priv->dai_props = dai_props; priv->dai_link = dai_link; priv->dais = dais; + priv->codec_conf = cconf; /* Init snd_soc_card */ card = simple_priv_to_card(priv); @@ -409,8 +419,8 @@ static int asoc_simple_card_probe(struct platform_device *pdev) card->dev = dev; card->dai_link = priv->dai_link; card->num_links = lnum; - card->codec_conf = &priv->codec_conf; - card->num_configs = 1; + card->codec_conf = cconf; + card->num_configs = cnum; ret = asoc_simple_card_parse_of(priv); if (ret < 0) {