From patchwork Wed May 22 03:46:26 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuninori Morimoto X-Patchwork-Id: 10954795 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 0D7F413AD for ; Wed, 22 May 2019 04:42:31 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F084D28B3E for ; Wed, 22 May 2019 04:42:30 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DDEE928B3C; Wed, 22 May 2019 04:42:30 +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.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,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]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 9C59828B55 for ; Wed, 22 May 2019 04:42:29 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 91A2517B6; Wed, 22 May 2019 06:33:41 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 91A2517B6 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1558499671; bh=F4dFhmMMRr2/o2DjQnwRS2U8GL6bP6zFQIpz+rTSti8=; h=Date:From:To:In-Reply-To:References:Cc:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=JfWLWX43FMf5JMCR4cO4Fk10akAEbtrizoyOaDttR0cREO/nAdQmQuDSdwFpYBg2/ +RAiyFPjlpLSNs+u9DgMBEtETE9MNF1+SIW5uLqe4s3tOt6wGniyaIkR/4la5g1ufn YmgqzrNSr47n4M/XSMa5LVHyJisQGyxsyEcixcr4= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id D976CF898BB; Wed, 22 May 2019 05:46:32 +0200 (CEST) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa1.perex.cz (Postfix, from userid 50401) id E2DACF898C1; Wed, 22 May 2019 05:46:31 +0200 (CEST) Received: from relmlie6.idc.renesas.com (relmlor2.renesas.com [210.160.252.172]) by alsa1.perex.cz (Postfix) with ESMTP id 9AB9DF898BB for ; Wed, 22 May 2019 05:46:27 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 9AB9DF898BB Date: 22 May 2019 12:46:26 +0900 X-IronPort-AV: E=Sophos;i="5.60,497,1549897200"; d="scan'208";a="16425644" Received: from unknown (HELO relmlir5.idc.renesas.com) ([10.200.68.151]) by relmlie6.idc.renesas.com with ESMTP; 22 May 2019 12:46:26 +0900 Received: from morimoto-PC.renesas.com (unknown [10.166.18.140]) by relmlir5.idc.renesas.com (Postfix) with ESMTP id 5B8A34003EBC; Wed, 22 May 2019 12:46:26 +0900 (JST) Message-ID: <87h89nkvvg.wl-kuninori.morimoto.gx@renesas.com> From: Kuninori Morimoto User-Agent: Wanderlust/2.15.9 Emacs/24.5 Mule/6.0 To: Mark Brown In-Reply-To: <87sgt7p3zo.wl-kuninori.morimoto.gx@renesas.com> References: <87sgt7p3zo.wl-kuninori.morimoto.gx@renesas.com> MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Cc: Linux-ALSA Subject: [alsa-devel] [PATCH 083/145] ASoC: fsl: mpc8610_hpcd/p1022_ds/p1022_rdk: use modern dai_link style X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 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" X-Virus-Scanned: ClamAV using ClamSMTP From: Kuninori Morimoto ASoC is now supporting modern style dai_link (= snd_soc_dai_link_component) for CPU/Codec/Platform. This patch switches to use it. mpc8610_hpcd/p1022_ds/p1022_rdk are sharing fsl_asoc_get_dma_channel() which setups platform. We need to update these by 1 patch. Signed-off-by: Kuninori Morimoto --- sound/soc/fsl/fsl_utils.c | 2 +- sound/soc/fsl/mpc8610_hpcd.c | 33 ++++++++++++++++++++++++++++----- sound/soc/fsl/p1022_ds.c | 36 ++++++++++++++++++++++++++++++------ sound/soc/fsl/p1022_rdk.c | 35 +++++++++++++++++++++++++++++------ 4 files changed, 88 insertions(+), 18 deletions(-) diff --git a/sound/soc/fsl/fsl_utils.c b/sound/soc/fsl/fsl_utils.c index 040d06b..9bab202 100644 --- a/sound/soc/fsl/fsl_utils.c +++ b/sound/soc/fsl/fsl_utils.c @@ -57,7 +57,7 @@ int fsl_asoc_get_dma_channel(struct device_node *ssi_np, of_node_put(dma_channel_np); return ret; } - snprintf((char *)dai->platform_name, DAI_NAME_SIZE, "%llx.%pOFn", + snprintf((char *)dai->platforms->name, DAI_NAME_SIZE, "%llx.%pOFn", (unsigned long long) res.start, dma_channel_np); iprop = of_get_property(dma_channel_np, "cell-index", NULL); diff --git a/sound/soc/fsl/mpc8610_hpcd.c b/sound/soc/fsl/mpc8610_hpcd.c index f6261a3..23617eb 100644 --- a/sound/soc/fsl/mpc8610_hpcd.c +++ b/sound/soc/fsl/mpc8610_hpcd.c @@ -189,6 +189,7 @@ static int mpc8610_hpcd_probe(struct platform_device *pdev) struct device_node *np = ssi_pdev->dev.of_node; struct device_node *codec_np = NULL; struct mpc8610_hpcd_data *machine_data; + struct snd_soc_dai_link_component *comp; int ret = -ENODEV; const char *sprop; const u32 *iprop; @@ -206,14 +207,36 @@ static int mpc8610_hpcd_probe(struct platform_device *pdev) goto error_alloc; } - machine_data->dai[0].cpu_dai_name = dev_name(&ssi_pdev->dev); + comp = devm_kzalloc(&pdev->dev, 6 * sizeof(*comp), GFP_KERNEL); + if (!comp) { + ret = -ENOMEM; + goto error_alloc; + } + + machine_data->dai[0].cpus = &comp[0]; + machine_data->dai[0].codecs = &comp[1]; + machine_data->dai[0].platforms = &comp[2]; + + machine_data->dai[0].num_cpus = 1; + machine_data->dai[0].num_codecs = 1; + machine_data->dai[0].num_platforms = 1; + + machine_data->dai[1].cpus = &comp[3]; + machine_data->dai[1].codecs = &comp[4]; + machine_data->dai[1].platforms = &comp[5]; + + machine_data->dai[1].num_cpus = 1; + machine_data->dai[1].num_codecs = 1; + machine_data->dai[1].num_platforms = 1; + + machine_data->dai[0].cpus->dai_name = dev_name(&ssi_pdev->dev); machine_data->dai[0].ops = &mpc8610_hpcd_ops; /* ASoC core can match codec with device node */ - machine_data->dai[0].codec_of_node = codec_np; + machine_data->dai[0].codecs->of_node = codec_np; /* The DAI name from the codec (snd_soc_dai_driver.name) */ - machine_data->dai[0].codec_dai_name = "cs4270-hifi"; + machine_data->dai[0].codecs->dai_name = "cs4270-hifi"; /* We register two DAIs per SSI, one for playback and the other for * capture. Currently, we only support codecs that have one DAI for @@ -306,7 +329,7 @@ static int mpc8610_hpcd_probe(struct platform_device *pdev) } /* Find the playback DMA channel to use. */ - machine_data->dai[0].platform_name = machine_data->platform_name[0]; + machine_data->dai[0].platforms->name = machine_data->platform_name[0]; ret = fsl_asoc_get_dma_channel(np, "fsl,playback-dma", &machine_data->dai[0], &machine_data->dma_channel_id[0], @@ -317,7 +340,7 @@ static int mpc8610_hpcd_probe(struct platform_device *pdev) } /* Find the capture DMA channel to use. */ - machine_data->dai[1].platform_name = machine_data->platform_name[1]; + machine_data->dai[1].platforms->name = machine_data->platform_name[1]; ret = fsl_asoc_get_dma_channel(np, "fsl,capture-dma", &machine_data->dai[1], &machine_data->dma_channel_id[1], diff --git a/sound/soc/fsl/p1022_ds.c b/sound/soc/fsl/p1022_ds.c index 80384f7..6114b01 100644 --- a/sound/soc/fsl/p1022_ds.c +++ b/sound/soc/fsl/p1022_ds.c @@ -199,6 +199,7 @@ static int p1022_ds_probe(struct platform_device *pdev) struct device_node *np = ssi_pdev->dev.of_node; struct device_node *codec_np = NULL; struct machine_data *mdata; + struct snd_soc_dai_link_component *comp; int ret = -ENODEV; const char *sprop; const u32 *iprop; @@ -216,11 +217,34 @@ static int p1022_ds_probe(struct platform_device *pdev) goto error_put; } - mdata->dai[0].cpu_dai_name = dev_name(&ssi_pdev->dev); + comp = devm_kzalloc(&pdev->dev, 6 * sizeof(*comp), GFP_KERNEL); + if (!comp) { + ret = -ENOMEM; + goto error_put; + } + + mdata->dai[0].cpus = &comp[0]; + mdata->dai[0].codecs = &comp[1]; + mdata->dai[0].platforms = &comp[2]; + + mdata->dai[0].num_cpus = 1; + mdata->dai[0].num_codecs = 1; + mdata->dai[0].num_platforms = 1; + + mdata->dai[1].cpus = &comp[3]; + mdata->dai[1].codecs = &comp[4]; + mdata->dai[1].platforms = &comp[5]; + + mdata->dai[1].num_cpus = 1; + mdata->dai[1].num_codecs = 1; + mdata->dai[1].num_platforms = 1; + + + mdata->dai[0].cpus->dai_name = dev_name(&ssi_pdev->dev); mdata->dai[0].ops = &p1022_ds_ops; /* ASoC core can match codec with device node */ - mdata->dai[0].codec_of_node = codec_np; + mdata->dai[0].codecs->of_node = codec_np; /* We register two DAIs per SSI, one for playback and the other for * capture. We support codecs that have separate DAIs for both playback @@ -229,8 +253,8 @@ static int p1022_ds_probe(struct platform_device *pdev) memcpy(&mdata->dai[1], &mdata->dai[0], sizeof(struct snd_soc_dai_link)); /* The DAI names from the codec (snd_soc_dai_driver.name) */ - mdata->dai[0].codec_dai_name = "wm8776-hifi-playback"; - mdata->dai[1].codec_dai_name = "wm8776-hifi-capture"; + mdata->dai[0].codecs->dai_name = "wm8776-hifi-playback"; + mdata->dai[1].codecs->dai_name = "wm8776-hifi-capture"; /* Get the device ID */ iprop = of_get_property(np, "cell-index", NULL); @@ -316,7 +340,7 @@ static int p1022_ds_probe(struct platform_device *pdev) } /* Find the playback DMA channel to use. */ - mdata->dai[0].platform_name = mdata->platform_name[0]; + mdata->dai[0].platforms->name = mdata->platform_name[0]; ret = fsl_asoc_get_dma_channel(np, "fsl,playback-dma", &mdata->dai[0], &mdata->dma_channel_id[0], &mdata->dma_id[0]); @@ -326,7 +350,7 @@ static int p1022_ds_probe(struct platform_device *pdev) } /* Find the capture DMA channel to use. */ - mdata->dai[1].platform_name = mdata->platform_name[1]; + mdata->dai[1].platforms->name = mdata->platform_name[1]; ret = fsl_asoc_get_dma_channel(np, "fsl,capture-dma", &mdata->dai[1], &mdata->dma_channel_id[1], &mdata->dma_id[1]); diff --git a/sound/soc/fsl/p1022_rdk.c b/sound/soc/fsl/p1022_rdk.c index 1c32c2d..7268723 100644 --- a/sound/soc/fsl/p1022_rdk.c +++ b/sound/soc/fsl/p1022_rdk.c @@ -203,6 +203,7 @@ static int p1022_rdk_probe(struct platform_device *pdev) struct device_node *np = ssi_pdev->dev.of_node; struct device_node *codec_np = NULL; struct machine_data *mdata; + struct snd_soc_dai_link_component *comp; const u32 *iprop; int ret; @@ -219,11 +220,33 @@ static int p1022_rdk_probe(struct platform_device *pdev) goto error_put; } - mdata->dai[0].cpu_dai_name = dev_name(&ssi_pdev->dev); + comp = devm_kzalloc(&pdev->dev, 6 * sizeof(*comp), GFP_KERNEL); + if (!comp) { + ret = -ENOMEM; + goto error_put; + } + + mdata->dai[0].cpus = &comp[0]; + mdata->dai[0].codecs = &comp[1]; + mdata->dai[0].platforms = &comp[2]; + + mdata->dai[0].num_cpus = 1; + mdata->dai[0].num_codecs = 1; + mdata->dai[0].num_platforms = 1; + + mdata->dai[1].cpus = &comp[3]; + mdata->dai[1].codecs = &comp[4]; + mdata->dai[1].platforms = &comp[5]; + + mdata->dai[1].num_cpus = 1; + mdata->dai[1].num_codecs = 1; + mdata->dai[1].num_platforms = 1; + + mdata->dai[0].cpus->dai_name = dev_name(&ssi_pdev->dev); mdata->dai[0].ops = &p1022_rdk_ops; /* ASoC core can match codec with device node */ - mdata->dai[0].codec_of_node = codec_np; + mdata->dai[0].codecs->of_node = codec_np; /* * We register two DAIs per SSI, one for playback and the other for @@ -233,8 +256,8 @@ static int p1022_rdk_probe(struct platform_device *pdev) memcpy(&mdata->dai[1], &mdata->dai[0], sizeof(struct snd_soc_dai_link)); /* The DAI names from the codec (snd_soc_dai_driver.name) */ - mdata->dai[0].codec_dai_name = "wm8960-hifi"; - mdata->dai[1].codec_dai_name = mdata->dai[0].codec_dai_name; + mdata->dai[0].codecs->dai_name = "wm8960-hifi"; + mdata->dai[1].codecs->dai_name = mdata->dai[0].codecs->dai_name; /* * Configure the SSI for I2S slave mode. Older device trees have @@ -266,7 +289,7 @@ static int p1022_rdk_probe(struct platform_device *pdev) } /* Find the playback DMA channel to use. */ - mdata->dai[0].platform_name = mdata->platform_name[0]; + mdata->dai[0].platforms->name = mdata->platform_name[0]; ret = fsl_asoc_get_dma_channel(np, "fsl,playback-dma", &mdata->dai[0], &mdata->dma_channel_id[0], &mdata->dma_id[0]); @@ -277,7 +300,7 @@ static int p1022_rdk_probe(struct platform_device *pdev) } /* Find the capture DMA channel to use. */ - mdata->dai[1].platform_name = mdata->platform_name[1]; + mdata->dai[1].platforms->name = mdata->platform_name[1]; ret = fsl_asoc_get_dma_channel(np, "fsl,capture-dma", &mdata->dai[1], &mdata->dma_channel_id[1], &mdata->dma_id[1]);