From patchwork Tue Dec 11 03:24:57 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuninori Morimoto X-Patchwork-Id: 10723031 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 3DC0C1751 for ; Tue, 11 Dec 2018 04:42:54 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2D71C2A81E for ; Tue, 11 Dec 2018 04:42:54 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2200B2A827; Tue, 11 Dec 2018 04:42:54 +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 1608D2A82D for ; Tue, 11 Dec 2018 04:42:51 +0000 (UTC) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id B3217267B47; Tue, 11 Dec 2018 04:25:05 +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 ED498267B47; Tue, 11 Dec 2018 04:25:03 +0100 (CET) Received: from JPN01-OS2-obe.outbound.protection.outlook.com (mail-eopbgr1410132.outbound.protection.outlook.com [40.107.141.132]) by alsa0.perex.cz (Postfix) with ESMTP id 3333A267B52 for ; Tue, 11 Dec 2018 04:25:00 +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=dCqINYBg5RYnpVoS/reRjl4rgY5DuyTZJWvJCwEj2a4=; b=cPKHTKe8A5ZEbnRVVG8OL9EX6pY9iBfELqN7n94jAjxUFqnAED7orqdwIXbZ16Xo/K2bltTaQcnYQkpVnEwO98YapXRTGAFGzaxuL/AWZel7aIsc2OIerf4pZQY4GrQKbeelSSkgbsaX1c71/Hd8l7jwwS12qx0lHZlghP6souU= Received: from TYAPR01MB3661.jpnprd01.prod.outlook.com (20.178.137.210) by TYAPR01MB4047.jpnprd01.prod.outlook.com (20.178.139.205) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1404.20; Tue, 11 Dec 2018 03:24:57 +0000 Received: from TYAPR01MB3661.jpnprd01.prod.outlook.com ([fe80::939:87f0:3329:af2f]) by TYAPR01MB3661.jpnprd01.prod.outlook.com ([fe80::939:87f0:3329:af2f%4]) with mapi id 15.20.1404.026; Tue, 11 Dec 2018 03:24:57 +0000 From: Kuninori Morimoto To: Mark Brown Thread-Topic: [PATCH 1/5] ASoC: simple-scu-card: add dai-link support Thread-Index: AQHUkQEXpA5qxUkI8kawgATv019O9A== Date: Tue, 11 Dec 2018 03:24:57 +0000 Message-ID: <87a7lcbvpg.wl-kuninori.morimoto.gx@renesas.com> References: <87bm5sbvq6.wl-kuninori.morimoto.gx@renesas.com> In-Reply-To: <87bm5sbvq6.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: TYXPR01CA0063.jpnprd01.prod.outlook.com (2603:1096:403:a::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; TYAPR01MB4047; 20:415XESQDDZcpZjDF/5FphHoBgWiOy/t5+sE6VyPXNvflApKpmR4fdW7Bzr2vJebq52lRU8p4GMvu0S2TKMyLs+8yaDXskKwcyCTMhxu/Wv6up7YX8PajOl5fBTFYvcdpp2fx2qB/rCpITIUZLZWvNNOZiq6M82Vm4oh4438RqM4= x-ms-office365-filtering-correlation-id: 5173fb86-bbb3-4a38-6b2d-08d65f1839ca 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:TYAPR01MB4047; x-ms-traffictypediagnostic: TYAPR01MB4047: 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)(93006095)(93001095)(3231455)(999002)(944501520)(52105112)(3002001)(6055026)(148016)(149066)(150057)(6041310)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123562045)(20161123558120)(20161123564045)(201708071742011)(7699051)(76991095); SRVR:TYAPR01MB4047; BCL:0; PCL:0; RULEID:; SRVR:TYAPR01MB4047; x-forefront-prvs: 08831F51DC x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(396003)(39860400002)(346002)(136003)(376002)(366004)(189003)(199004)(478600001)(76176011)(99286004)(2906002)(66066001)(14454004)(5660300001)(7736002)(446003)(316002)(305945005)(186003)(6436002)(11346002)(97736004)(6486002)(486006)(2616005)(4326008)(8936002)(476003)(256004)(3846002)(25786009)(68736007)(6116002)(81166006)(106356001)(81156014)(105586002)(8676002)(386003)(26005)(6506007)(52116002)(71200400001)(6512007)(36756003)(6916009)(71190400001)(102836004)(86362001)(53936002); DIR:OUT; SFP:1102; SCL:1; SRVR:TYAPR01MB4047; 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: QzogzxC7RZcK9Rn+E9EXU72jPsVXSaO/mmE4X0e47lBY9JBYkHvCs9FnUcedIc6CYt3i3I0puWkBN48dWdeNrqibhbnnKyLKog2rMsidWnp+8yO+ghuFRFCO6zVxJbJWVJmjlVvk7rxmReS1vAAudtFlEpqrqzykEScqZ7/sQJXiIPH/7/E4pJPJCB3+mJyE/PowOXFSVtRxEVSQZUdC1c2p2qCGltDAQD+gSmxLkGTeqFlUVPjhmT240e0OIIyJZAUy1Ssc1Qqf69/HvMfpSUWzbYUKg/tAkfz1isLPB4noYOII2xipWjpSnI8Vs8aT spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-ID: <1A0F30BF7FB17C488888F3E9C41CE835@jpnprd01.prod.outlook.com> MIME-Version: 1.0 X-OriginatorOrg: renesas.com X-MS-Exchange-CrossTenant-Network-Message-Id: 5173fb86-bbb3-4a38-6b2d-08d65f1839ca X-MS-Exchange-CrossTenant-originalarrivaltime: 11 Dec 2018 03:24:57.4018 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 53d82571-da19-47e4-9cb4-625a166a4a2a X-MS-Exchange-Transport-CrossTenantHeadersStamped: TYAPR01MB4047 Cc: Linux-ALSA Subject: [alsa-devel] [PATCH 1/5] 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 24099e6..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 (of_node_name_eq(np, PREFIX "cpu")) - 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 11 03:25:08 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuninori Morimoto X-Patchwork-Id: 10723021 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 635221751 for ; Tue, 11 Dec 2018 04:42:52 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 473852A81E for ; Tue, 11 Dec 2018 04:42:52 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 384FA2A85E; Tue, 11 Dec 2018 04:42:52 +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 003612A828 for ; Tue, 11 Dec 2018 04:42:50 +0000 (UTC) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id 3D36B267B5C; Tue, 11 Dec 2018 04:25:17 +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 1F0D1267B67; Tue, 11 Dec 2018 04:25:14 +0100 (CET) Received: from JPN01-TY1-obe.outbound.protection.outlook.com (mail-eopbgr1400122.outbound.protection.outlook.com [40.107.140.122]) by alsa0.perex.cz (Postfix) with ESMTP id A8E99267B64 for ; Tue, 11 Dec 2018 04:25:11 +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=UocIma7hQobAfYVEQepTRuaq5sJbNt5JlDanXtZYFqlKMRZGoWTyz6QF/42Yb4WTgjB393yl79+dItAvTF7aA78k+64DQIj0rKxAOaYk7UnDJgLAFpu0gjcPOlmzib26/Ml44KPeFo60xVmvFJ4XUeI3CCGbZCi1964yeEvS8mo= Received: from TYAPR01MB3661.jpnprd01.prod.outlook.com (20.178.137.210) by TYAPR01MB2592.jpnprd01.prod.outlook.com (20.177.102.12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1404.22; Tue, 11 Dec 2018 03:25:08 +0000 Received: from TYAPR01MB3661.jpnprd01.prod.outlook.com ([fe80::939:87f0:3329:af2f]) by TYAPR01MB3661.jpnprd01.prod.outlook.com ([fe80::939:87f0:3329:af2f%4]) with mapi id 15.20.1404.026; Tue, 11 Dec 2018 03:25:08 +0000 From: Kuninori Morimoto To: Mark Brown Thread-Topic: [PATCH 2/5] ASoC: simple-scu-card: care link / dai count Thread-Index: AQHUkQEej0zopXJv/katnyBoZkGMiQ== Date: Tue, 11 Dec 2018 03:25:08 +0000 Message-ID: <878t0wbvp6.wl-kuninori.morimoto.gx@renesas.com> References: <87bm5sbvq6.wl-kuninori.morimoto.gx@renesas.com> In-Reply-To: <87bm5sbvq6.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: TYXPR01CA0048.jpnprd01.prod.outlook.com (2603:1096:403:a::18) 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; TYAPR01MB2592; 20:IhhKiWCJ1fkGCq3mEU+b6kkv6pb3EexjHbc7BHx8v8pIWLxmnUvW4xAhYyM1wdApzzcMehbjxyySsxymQ0zpbASQEMJ7GuWxgshgdkJlaom2SQaeRLRNPf3h6J28Me2OzAgv66ExIhkauVhz6eZNkluECuZlV1T5vZqKqqfrvf8= x-ms-office365-filtering-correlation-id: 799d6431-2749-49bd-0714-08d65f18408b 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:TYAPR01MB2592; x-ms-traffictypediagnostic: TYAPR01MB2592: x-microsoft-antispam-prvs: x-ms-exchange-senderadcheck: 1 x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(8211001083)(3230017)(999002)(6040522)(2401047)(8121501046)(5005006)(3002001)(10201501046)(93006095)(93001095)(3231472)(944501520)(52105112)(6055026)(148016)(149066)(150057)(6041310)(20161123560045)(20161123562045)(20161123558120)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123564045)(201708071742011)(7699051)(76991095); SRVR:TYAPR01MB2592; BCL:0; PCL:0; RULEID:; SRVR:TYAPR01MB2592; x-forefront-prvs: 08831F51DC x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(366004)(136003)(346002)(39860400002)(396003)(376002)(189003)(199004)(68736007)(81166006)(6116002)(3846002)(105586002)(25786009)(81156014)(4326008)(8676002)(106356001)(2616005)(486006)(476003)(8936002)(256004)(6512007)(102836004)(76176011)(53936002)(6506007)(36756003)(71190400001)(71200400001)(6916009)(386003)(26005)(575784001)(86362001)(52116002)(478600001)(99286004)(66066001)(2906002)(316002)(14454004)(7736002)(305945005)(97736004)(446003)(6436002)(186003)(11346002)(5660300001)(6486002); DIR:OUT; SFP:1102; SCL:1; SRVR:TYAPR01MB2592; 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: 82ttnJqRLM7znUd9bjb+TaBRVlDMVPyetbMBdTAD/b8ko4vLEGE8AtMXXpmoM2gfylhuPLZ7/HlDqQ389j4XSeBFyZUie4E4p3ZXFVXTlNasVluzNc8XLrhKJSVzI7EADHbtfDeQIIc/kaOHV65i70tQm812rugnWY9QIRx6KLjJslz3zYC8rH7D34Q9sWxQAZiH0cZWUYMscV+1Sw4kJ4Sx1cLTSiDDGHVnqqDcBXCo6ReYs9H2CRW1IOHtYanlFv2Eu7BWIwSE0ZYZqX/SaoTqa4IZnQZLpZ2UdOX0WoFRdZRI5F0Exr2Ckyw14kMI spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-ID: <863268A3482D1D4BB866FF37D4269234@jpnprd01.prod.outlook.com> MIME-Version: 1.0 X-OriginatorOrg: renesas.com X-MS-Exchange-CrossTenant-Network-Message-Id: 799d6431-2749-49bd-0714-08d65f18408b X-MS-Exchange-CrossTenant-originalarrivaltime: 11 Dec 2018 03:25:08.7304 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 53d82571-da19-47e4-9cb4-625a166a4a2a X-MS-Exchange-Transport-CrossTenantHeadersStamped: TYAPR01MB2592 Cc: Linux-ALSA Subject: [alsa-devel] [PATCH 2/5] 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 11 03:25:18 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuninori Morimoto X-Patchwork-Id: 10723029 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 85A6E18A7 for ; Tue, 11 Dec 2018 04:42:53 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7622F2A81E for ; Tue, 11 Dec 2018 04:42:53 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6AF932A835; Tue, 11 Dec 2018 04:42:53 +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 F3F422A827 for ; Tue, 11 Dec 2018 04:42:50 +0000 (UTC) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id 9B97B267B4D; Tue, 11 Dec 2018 04:25:26 +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 BE9C7267B6A; Tue, 11 Dec 2018 04:25:24 +0100 (CET) Received: from JPN01-TY1-obe.outbound.protection.outlook.com (mail-eopbgr1400105.outbound.protection.outlook.com [40.107.140.105]) by alsa0.perex.cz (Postfix) with ESMTP id DB548267B4D for ; Tue, 11 Dec 2018 04:25:21 +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=WTfbCEBgFf7k8lhQYj8rOWWbc/AHwVdoX8MR6RPmLeXM+qYg4QbSGB54O+ObXvswxQ1fpl/1Brj84WDON8BrRoMuYgdefLCI1CwnvgSddMypDyb7Wf34kyzAueJjlTLXOnJ1hYzyJQBzSng0B66w45hXW8lOO5cb8Pi7NvZ+WyQ= Received: from TYAPR01MB3661.jpnprd01.prod.outlook.com (20.178.137.210) by TYAPR01MB2592.jpnprd01.prod.outlook.com (20.177.102.12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1404.22; Tue, 11 Dec 2018 03:25:18 +0000 Received: from TYAPR01MB3661.jpnprd01.prod.outlook.com ([fe80::939:87f0:3329:af2f]) by TYAPR01MB3661.jpnprd01.prod.outlook.com ([fe80::939:87f0:3329:af2f%4]) with mapi id 15.20.1404.026; Tue, 11 Dec 2018 03:25:18 +0000 From: Kuninori Morimoto To: Mark Brown Thread-Topic: [PATCH 3/5] ASoC: simple-scu-card: tidyup "convert-rate/channels" parsing Thread-Index: AQHUkQEjaPIDA/ea00OcFxV/ghZIlg== Date: Tue, 11 Dec 2018 03:25:18 +0000 Message-ID: <877eggbvov.wl-kuninori.morimoto.gx@renesas.com> References: <87bm5sbvq6.wl-kuninori.morimoto.gx@renesas.com> In-Reply-To: <87bm5sbvq6.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: TY2PR06CA0024.apcprd06.prod.outlook.com (2603:1096:404:42::36) 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; TYAPR01MB2592; 20:ruv1165vsIl0q9AQs9MoaLoBYkOQNJdQf9tH4IM+P5UM9oQDzrzOBp7VbYQtYGzVmLBLGaR3v36rAQDAJp+q3p8/1KSZ2+HoM6F6lAZS8yFZ1Ai/vAUkrgHox5lAV3mc42si9SQAhSM5lP7E294r6Mkj6D3s2pAmNh3UksF8Rf0= x-ms-office365-filtering-correlation-id: 00c76282-9756-45be-f941-08d65f184661 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:TYAPR01MB2592; x-ms-traffictypediagnostic: TYAPR01MB2592: x-microsoft-antispam-prvs: x-ms-exchange-senderadcheck: 1 x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(8211001083)(3230017)(999002)(6040522)(2401047)(8121501046)(5005006)(3002001)(10201501046)(93006095)(93001095)(3231472)(944501520)(52105112)(6055026)(148016)(149066)(150057)(6041310)(20161123560045)(20161123562045)(20161123558120)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123564045)(201708071742011)(7699051)(76991095); SRVR:TYAPR01MB2592; BCL:0; PCL:0; RULEID:; SRVR:TYAPR01MB2592; x-forefront-prvs: 08831F51DC x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(366004)(136003)(346002)(39860400002)(396003)(376002)(189003)(199004)(68736007)(81166006)(6116002)(3846002)(105586002)(25786009)(81156014)(4326008)(8676002)(106356001)(2616005)(486006)(476003)(8936002)(256004)(6512007)(102836004)(76176011)(53936002)(6506007)(36756003)(71190400001)(71200400001)(6916009)(386003)(26005)(86362001)(52116002)(478600001)(99286004)(66066001)(2906002)(316002)(14454004)(7736002)(305945005)(97736004)(446003)(6436002)(186003)(11346002)(5660300001)(6486002); DIR:OUT; SFP:1102; SCL:1; SRVR:TYAPR01MB2592; 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: macLCF6SlpBTHYMr1H8HMkFocwIiuUhg0FbB+YzmtJO/ySCRhUH4zzLV1GZ0I1fQzCyM40oJSfCkROZDhFHg2NAZE9BWr63d/iEkKhVjVoYpcb2a10hihDKw8erBrJwmDtErarVm2kMrLUWLMuNeItn3PgmLxnZbTlBTMqjP6LdANuWONqvD+AqT2KdvRvWwwPxTsQpRw5BqdoEZzbqjqkmQ0kGPhe35vJe60NQC0sPtHcxtuJHWoJXOjfcypdj8F1a/CbhTxtqim6ATAOL8ebtd1OqeFyf4auPTtsCjI0uNLN0tY/GukOgN7nZmdEp3 spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-ID: <22EA344CACF63242B43D08E42F182B0F@jpnprd01.prod.outlook.com> MIME-Version: 1.0 X-OriginatorOrg: renesas.com X-MS-Exchange-CrossTenant-Network-Message-Id: 00c76282-9756-45be-f941-08d65f184661 X-MS-Exchange-CrossTenant-originalarrivaltime: 11 Dec 2018 03:25:18.5433 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 53d82571-da19-47e4-9cb4-625a166a4a2a X-MS-Exchange-Transport-CrossTenantHeadersStamped: TYAPR01MB2592 Cc: Linux-ALSA Subject: [alsa-devel] [PATCH 3/5] 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 11 03:25:27 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuninori Morimoto X-Patchwork-Id: 10723027 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 57A3C1751 for ; Tue, 11 Dec 2018 04:42:53 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4465B2A81E for ; Tue, 11 Dec 2018 04:42:53 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 38F5E2A835; Tue, 11 Dec 2018 04:42:53 +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 2418F2A852 for ; Tue, 11 Dec 2018 04:42:52 +0000 (UTC) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id 0B3AC267B6D; Tue, 11 Dec 2018 04:25:36 +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 8E7D8267B6F; Tue, 11 Dec 2018 04:25:33 +0100 (CET) Received: from JPN01-OS2-obe.outbound.protection.outlook.com (mail-eopbgr1410092.outbound.protection.outlook.com [40.107.141.92]) by alsa0.perex.cz (Postfix) with ESMTP id 2452526770D for ; Tue, 11 Dec 2018 04:25:30 +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=fWQiz2nWH4jYIV9Al+CSN2xmgU+Yyv23HRTLBs0ij0iRQslMNqTZyjFTX/NoptJrWI+F0/4F2gnsoRwKFERSCU/TTFjv2il1hAwtYbihJPr9x6CM76ooOWcpUTZ3ZHsNimcDg6xhQoAwwlF1NJs65y7QxCpFfJ6eJVkwDVcroGM= Received: from TYAPR01MB3661.jpnprd01.prod.outlook.com (20.178.137.210) by TYAPR01MB4047.jpnprd01.prod.outlook.com (20.178.139.205) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1404.20; Tue, 11 Dec 2018 03:25:28 +0000 Received: from TYAPR01MB3661.jpnprd01.prod.outlook.com ([fe80::939:87f0:3329:af2f]) by TYAPR01MB3661.jpnprd01.prod.outlook.com ([fe80::939:87f0:3329:af2f%4]) with mapi id 15.20.1404.026; Tue, 11 Dec 2018 03:25:28 +0000 From: Kuninori Morimoto To: Mark Brown Thread-Topic: [PATCH 4/5] ASoC: simple-scu-card: use cpu/codec pointer on graph_dai_props Thread-Index: AQHUkQEp8UibqkZ/PU6N9sXdyPG7UQ== Date: Tue, 11 Dec 2018 03:25:27 +0000 Message-ID: <875zw0bvol.wl-kuninori.morimoto.gx@renesas.com> References: <87bm5sbvq6.wl-kuninori.morimoto.gx@renesas.com> In-Reply-To: <87bm5sbvq6.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: TY2PR06CA0012.apcprd06.prod.outlook.com (2603:1096:404:42::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; TYAPR01MB4047; 20:UM8DwdWHGTVv1Scol83YKZjTV+t4i6stDqPz0M0cnXT22YSFuH/z4cce4wqN+QbNH09KhDYhZ9XfpmZ25JPWOlSy79w260VtMtgOPAYLSHkBpH4LWOOYsIUeXHbOEnccsex1oTB1zVRzHXplSESXSWxuWGmErXJgRG5TnMa8WNg= x-ms-office365-filtering-correlation-id: ba883f47-67fd-48ae-b24f-08d65f184bff 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:TYAPR01MB4047; x-ms-traffictypediagnostic: TYAPR01MB4047: 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)(93006095)(93001095)(3231455)(999002)(944501520)(52105112)(3002001)(6055026)(148016)(149066)(150057)(6041310)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123562045)(20161123558120)(20161123564045)(201708071742011)(7699051)(76991095); SRVR:TYAPR01MB4047; BCL:0; PCL:0; RULEID:; SRVR:TYAPR01MB4047; x-forefront-prvs: 08831F51DC x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(396003)(39860400002)(346002)(136003)(376002)(366004)(189003)(199004)(478600001)(76176011)(99286004)(2906002)(66066001)(14454004)(5660300001)(7736002)(446003)(316002)(305945005)(186003)(6436002)(11346002)(97736004)(6486002)(486006)(2616005)(4326008)(8936002)(476003)(256004)(3846002)(25786009)(68736007)(6116002)(81166006)(106356001)(81156014)(105586002)(8676002)(386003)(26005)(6506007)(52116002)(71200400001)(6512007)(36756003)(6916009)(71190400001)(102836004)(86362001)(53936002); DIR:OUT; SFP:1102; SCL:1; SRVR:TYAPR01MB4047; 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: XoH59LWeQ7VTPwVlmIN7ofAMwxfCnf7w1E06Br3Bcj1iSn/eBvuOpTnTeUfhSJUlqkAhumK8JMkgVJt2hzzmIzXB3n7PbmfevJ/hwFJwYdv+AsyOBmHqfSQIXZxa4wz/d4RpZsPdWiOgc6Jz+kpn0+xYEV10Ro5opuyz6Mv+RJdkDAgkZ8kOMnkR2iEy4c/fXGatQi8qM9WXMtL/6V2aqN0zAtteAbkXM4XVI9P9/jHLR4Cmn2okWJN4dU7R34cqITP9Ncv5++aacJBLZFr2k3oMCeTyb4+bLpwmaUatD2lJI420GaOegRm6siPFLa1A spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-ID: <80362DCC054A6F40A242BCC8398577F4@jpnprd01.prod.outlook.com> MIME-Version: 1.0 X-OriginatorOrg: renesas.com X-MS-Exchange-CrossTenant-Network-Message-Id: ba883f47-67fd-48ae-b24f-08d65f184bff X-MS-Exchange-CrossTenant-originalarrivaltime: 11 Dec 2018 03:25:27.9656 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 53d82571-da19-47e4-9cb4-625a166a4a2a X-MS-Exchange-Transport-CrossTenantHeadersStamped: TYAPR01MB4047 Cc: Linux-ALSA Subject: [alsa-devel] [PATCH 4/5] 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 11 03:25:37 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuninori Morimoto X-Patchwork-Id: 10723025 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 D2F6D6C5 for ; Tue, 11 Dec 2018 04:42:52 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BF6E32A81E for ; Tue, 11 Dec 2018 04:42:52 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B3A562A835; Tue, 11 Dec 2018 04:42:52 +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 1B1B82A839 for ; Tue, 11 Dec 2018 04:42:51 +0000 (UTC) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id EF4CC267B78; Tue, 11 Dec 2018 04:25:45 +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 7FCD9267B79; Tue, 11 Dec 2018 04:25:43 +0100 (CET) Received: from JPN01-OS2-obe.outbound.protection.outlook.com (mail-eopbgr1410127.outbound.protection.outlook.com [40.107.141.127]) by alsa0.perex.cz (Postfix) with ESMTP id 8C3BD267B74 for ; Tue, 11 Dec 2018 04:25:40 +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=gs9yQd49EwgPLOmLDYRgwBUmDXgVGojUJOpnANa2F4iudfHLJGYzpQIO95yX+V8XzAvnKXOBym9hMN4wLvD9QnDBntY44XcQX8nctZvJk+8Z7B51Kkxt3ITYEvUTgDpeGdZZw8D38aMUFOj5bGhseO6m3M4vnXTpzxLRBghbVTo= Received: from TYAPR01MB3661.jpnprd01.prod.outlook.com (20.178.137.210) by TYAPR01MB4047.jpnprd01.prod.outlook.com (20.178.139.205) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1404.20; Tue, 11 Dec 2018 03:25:38 +0000 Received: from TYAPR01MB3661.jpnprd01.prod.outlook.com ([fe80::939:87f0:3329:af2f]) by TYAPR01MB3661.jpnprd01.prod.outlook.com ([fe80::939:87f0:3329:af2f%4]) with mapi id 15.20.1404.026; Tue, 11 Dec 2018 03:25:38 +0000 From: Kuninori Morimoto To: Mark Brown Thread-Topic: [PATCH 5/5] ASoC: simple-scu-card: care multi DPCM codec_conf Thread-Index: AQHUkQEvEdI2Pk0UA0Wt6z6/ohU/2g== Date: Tue, 11 Dec 2018 03:25:37 +0000 Message-ID: <874lbkbvoc.wl-kuninori.morimoto.gx@renesas.com> References: <87bm5sbvq6.wl-kuninori.morimoto.gx@renesas.com> In-Reply-To: <87bm5sbvq6.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: TY2PR06CA0002.apcprd06.prod.outlook.com (2603:1096:404:42::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; TYAPR01MB4047; 20:89jvTA4UDHxIuy8qcxFfZbL9XWsTtGFLJmBCZHWO34A26GZdD8+R/MZe+6Xyd7N5e4heQgbgz9MkWU6SeY6mJSpXZPCJAVwVV2Jj59Q4xgKAqHxTzVgQqKoTFgIBEQ0qM80qcG+CGf8vfIexIGtzUQW9jvyVp2Uo+iondlyf4dA= x-ms-office365-filtering-correlation-id: d2609462-0cfd-41a2-693c-08d65f1851db 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:TYAPR01MB4047; x-ms-traffictypediagnostic: TYAPR01MB4047: 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)(93006095)(93001095)(3231455)(999002)(944501520)(52105112)(3002001)(6055026)(148016)(149066)(150057)(6041310)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123562045)(20161123558120)(20161123564045)(201708071742011)(7699051)(76991095); SRVR:TYAPR01MB4047; BCL:0; PCL:0; RULEID:; SRVR:TYAPR01MB4047; x-forefront-prvs: 08831F51DC x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(396003)(39860400002)(346002)(136003)(376002)(366004)(189003)(199004)(478600001)(76176011)(99286004)(2906002)(66066001)(14454004)(5660300001)(7736002)(446003)(316002)(305945005)(186003)(6436002)(11346002)(97736004)(6486002)(486006)(2616005)(4326008)(8936002)(476003)(256004)(3846002)(25786009)(68736007)(6116002)(81166006)(106356001)(81156014)(105586002)(8676002)(386003)(26005)(6506007)(52116002)(71200400001)(6512007)(36756003)(6916009)(71190400001)(102836004)(86362001)(53936002); DIR:OUT; SFP:1102; SCL:1; SRVR:TYAPR01MB4047; 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: oJgugxkIQIS3fAwZEylwMbNPCMq7n6EXwzUNgYd/yoisFWnykbUJVI+C9OWLO0SoNoe6sbvjbTRTjOgoIjRIFxnqq8cm/2v7wG4+biej7JAwlzeQedb1aviO7L1wCVX5ZkzK8Vzre3dDnIe2swx6DZ0le9RWVWHisc1+q+GMTLQ1v9Br7aaRsg5hNl0WZZBneLIGHN0lq1B49mC8Sj5zQ4S1/85aE3TCXUHrKTzHvxMas1jBJbT2hLz5m78h2IQkvKPZ5OF9ZKXkXTD9+Bezb9VPNT0iqSgM+Ul59dI9wlUmohyZjxptWA5Gw8aUVqtj spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-ID: <51D1810DA2D62240A66648C21D37BD49@jpnprd01.prod.outlook.com> MIME-Version: 1.0 X-OriginatorOrg: renesas.com X-MS-Exchange-CrossTenant-Network-Message-Id: d2609462-0cfd-41a2-693c-08d65f1851db X-MS-Exchange-CrossTenant-originalarrivaltime: 11 Dec 2018 03:25:37.8254 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 53d82571-da19-47e4-9cb4-625a166a4a2a X-MS-Exchange-Transport-CrossTenantHeadersStamped: TYAPR01MB4047 Cc: Linux-ALSA Subject: [alsa-devel] [PATCH 5/5] 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) {