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) {