From patchwork Mon Nov 30 11:33:56 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pavel Machek X-Patchwork-Id: 7723291 Return-Path: X-Original-To: patchwork-alsa-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 6AC999F387 for ; Mon, 30 Nov 2015 11:34:35 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 934F5204FC for ; Mon, 30 Nov 2015 11:34:34 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id 5E2F6204D3 for ; Mon, 30 Nov 2015 11:34:33 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id D3FC726548F; Mon, 30 Nov 2015 12:34:31 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_LOW, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id 3683D2619E3; Mon, 30 Nov 2015 12:34: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 64420261B23; Mon, 30 Nov 2015 12:34:22 +0100 (CET) Received: from atrey.karlin.mff.cuni.cz (atrey.karlin.mff.cuni.cz [195.113.26.193]) by alsa0.perex.cz (Postfix) with ESMTP id E09C1261560 for ; Mon, 30 Nov 2015 12:34:16 +0100 (CET) Received: by atrey.karlin.mff.cuni.cz (Postfix, from userid 512) id A915F82285; Mon, 30 Nov 2015 12:33:56 +0100 (CET) Date: Mon, 30 Nov 2015 12:33:56 +0100 From: Pavel Machek To: Charles Keepax Message-ID: <20151130113356.GA32172@amd> References: <20150914115439.GA29646@amd> <20150914115255.GE11200@ck-lbox> <20151012090045.GA7448@amd> <20151012113702.GC8805@ck-lbox> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20151012113702.GC8805@ck-lbox> User-Agent: Mutt/1.5.23 (2014-03-12) Cc: alsa-devel@alsa-project.org, tiwai@suse.de, linux-kernel@vger.kernel.org, patches@opensource.wolfsonmicro.com, lgirdwood@gmail.com, broonie@kernel.org Subject: [alsa-devel] multi-card support for davinci-evm 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 Hi! If I undestand things correctly... when there's more than one wm5102, we need to dynamically allocate struct snd_soc_card. So something like this? (Patch from v4.2) Signed-off-by: Pavel Machek diff --git a/sound/soc/davinci/davinci-evm.c b/sound/soc/davinci/davinci-evm.c index 731fb0d..718631a 100644 --- a/sound/soc/davinci/davinci-evm.c +++ b/sound/soc/davinci/davinci-evm.c @@ -364,8 +516,11 @@ static int davinci_evm_probe(struct platform_device *pdev) struct snd_soc_card_drvdata_davinci *drvdata = NULL; struct clk *mclk; int ret = 0; + struct snd_soc_card *card = devm_kzalloc(&pdev->dev, sizeof(struct snd_soc_card), GFP_KERNEL); + + *card = evm_soc_card; - evm_soc_card.dai_link = dai; + card->dai_link = dai; dai->codec_of_node = of_parse_phandle(np, "ti,audio-codec", 0); if (!dai->codec_of_node) @@ -377,8 +533,8 @@ static int davinci_evm_probe(struct platform_device *pdev) dai->platform_of_node = dai->cpu_of_node; - evm_soc_card.dev = &pdev->dev; - ret = snd_soc_of_parse_card_name(&evm_soc_card, "ti,model"); + card->dev = &pdev->dev; + ret = snd_soc_of_parse_card_name(card, "ti,model"); if (ret) return ret; @@ -415,8 +588,8 @@ static int davinci_evm_probe(struct platform_device *pdev) requestd_rate, drvdata->sysclk); } - snd_soc_card_set_drvdata(&evm_soc_card, drvdata); - ret = devm_snd_soc_register_card(&pdev->dev, &evm_soc_card); + snd_soc_card_set_drvdata(card, drvdata); + ret = devm_snd_soc_register_card(&pdev->dev, card); if (ret) dev_err(&pdev->dev, "snd_soc_register_card failed (%d)\n", ret);