From patchwork Fri Jun 29 12:32:06 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Brown X-Patchwork-Id: 140553 Delivered-To: patch@linaro.org Received: by 2002:a2e:9754:0:0:0:0:0 with SMTP id f20-v6csp785423ljj; Fri, 29 Jun 2018 05:32:23 -0700 (PDT) X-Google-Smtp-Source: AAOMgpeK1Ut8nOTjfH0BheMaF0pXjebZj5Eph8MZxKNWTiMx3y84Sa00XIv90D0nXoX1cDmHHIz0 X-Received: by 2002:a1c:1205:: with SMTP id 5-v6mr1780652wms.41.1530275543910; Fri, 29 Jun 2018 05:32:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530275543; cv=none; d=google.com; s=arc-20160816; b=EFRvSZ/Lz5qsa+LBgZTmLBKIBWesQlNJDJK4jrsHmD+zoF15kjvp+e5Xg9cUf/E3e1 kx1xnTRovKODNQjO0TjhB5EdxufOixAeSimZ8te5/iDCYWBu4p8T6xYAiaVSJW/RuDCd 1XRsHRHRMnyna2wGA8WKriucdr9XFNYBbSZ78QHLzC/jdnw6ME5sg3o9x7x0bVzorTzw W7AiyQNNCrXMBNPrrfC4eOABKDEZ+UlQHYHsFt3Ga97aVOBeDR5wTvHLBPpRUjT3H7u6 7tyU16vE+dZxFJQstFT0a94ItTah9aUobM0NzUx8gLVg9f+3xYgZ8nmITWmaclgwHKky zpmg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:cc:date:message-id:in-reply-to:to:from :dkim-signature:delivered-to:arc-authentication-results; bh=ap7lO6xq39FvSDBN3bKbl2HModA0DfWlS5PsqMoeGFw=; b=scTIdWeuVGzc1VU6cYehqrkkaPvwDMQ9SBywe6Smk3KTXh58+cCfYqAM/h2svF0+PL vA2hpJWaMIY8D1JWqxpIC6Pf2eiLyh8Ltp0DrI+71ruCMAnKhmKp7rPiwoGLP/Opp+g2 hbCVbbe/rY/zseS5rVfG46+P8DvD3JzwusdywolO5brP8ghCLS4KIUiuc2hYF+4Vgypw YWT9Wcu6LVz8z14S/5VZPU/Bs5zY9UJfpUB2cDGwrOBiDpOwRv2HiHdCqUyXQB/kyjW7 HccuCo2/qE0y3T3DcYgaYTAGQoWKnai0odzUAhQcxQCMSmjgGHP6qL+gMwGmrx3S1Fs0 i3cQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@sirena.org.uk header.s=20170815-heliosphere header.b=tuqWONJm; spf=pass (google.com: domain of alsa-devel-bounces@alsa-project.org designates 77.48.224.243 as permitted sender) smtp.mailfrom=alsa-devel-bounces@alsa-project.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from alsa0.perex.cz (alsa0.perex.cz. [77.48.224.243]) by mx.google.com with ESMTP id h90-v6si10069137wrh.461.2018.06.29.05.32.23; Fri, 29 Jun 2018 05:32:23 -0700 (PDT) Received-SPF: pass (google.com: domain of alsa-devel-bounces@alsa-project.org designates 77.48.224.243 as permitted sender) client-ip=77.48.224.243; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@sirena.org.uk header.s=20170815-heliosphere header.b=tuqWONJm; spf=pass (google.com: domain of alsa-devel-bounces@alsa-project.org designates 77.48.224.243 as permitted sender) smtp.mailfrom=alsa-devel-bounces@alsa-project.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id F0C1C267A46; Fri, 29 Jun 2018 14:32:17 +0200 (CEST) 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 D5D96267A42; Fri, 29 Jun 2018 14:32:13 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on mail1.perex.cz X-Spam-Level: X-Spam-Status: No, score=0.2 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=disabled version=3.4.0 Received: from heliosphere.sirena.org.uk (heliosphere.sirena.org.uk [172.104.155.198]) by alsa0.perex.cz (Postfix) with ESMTP id 55035267A38 for ; Fri, 29 Jun 2018 14:32:11 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sirena.org.uk; s=20170815-heliosphere; h=Date:Message-Id:In-Reply-To: Subject:Cc:To:From:Sender:Reply-To:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:References: List-Id:List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner: List-Archive; bh=X0riHNByRYYDl47fz+/ywYUVV0Db3z8FZsf5A2UOqoM=; b=tuqWONJmhW9f VX3WiQIJtd9Swn3Q/anUFTQLMOsJ+ql0EpROtkWWGYlocMTZU0VeYsiQVcyer6wA/5w9D4fFihbd4 ztmTgaebCmr7eqmT3x8a755A5WblT1zScFSxU5ZurTuCniO+r/b2Iy4CqURbBM96cg7VUCWMTqNfa zEnmo=; Received: from debutante.sirena.org.uk ([2001:470:1f1d:6b5::3] helo=debutante) by heliosphere.sirena.org.uk with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1fYsZL-0007oo-6U; Fri, 29 Jun 2018 12:32:07 +0000 Received: from broonie by debutante with local (Exim 4.91) (envelope-from ) id 1fYsZK-0005dE-GX; Fri, 29 Jun 2018 13:32:06 +0100 From: Mark Brown To: KaiChieh Chuang In-Reply-To: Message-Id: Date: Fri, 29 Jun 2018 13:32:06 +0100 Cc: alsa-devel@alsa-project.org, Mark Brown Subject: [alsa-devel] Applied "ASoC: mt6797: sub dai use list_head" to the asoc tree 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: , MIME-Version: 1.0 Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org The patch ASoC: mt6797: sub dai use list_head has been applied to the asoc tree at https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted. You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed. If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced. Please add any relevant lists and maintainers to the CCs when replying to this mail. Thanks, Mark >From c1d9b4196ba6b311bd48a9320cd46aa125e0b034 Mon Sep 17 00:00:00 2001 From: KaiChieh Chuang Date: Fri, 29 Jun 2018 20:29:45 +0800 Subject: [PATCH] ASoC: mt6797: sub dai use list_head Signed-off-by: KaiChieh Chuang Signed-off-by: Mark Brown --- sound/soc/mediatek/mt6797/mt6797-afe-common.h | 1 + sound/soc/mediatek/mt6797/mt6797-afe-pcm.c | 65 +++++++++++++------ sound/soc/mediatek/mt6797/mt6797-dai-adda.c | 20 ++++-- .../soc/mediatek/mt6797/mt6797-dai-hostless.c | 16 +++-- sound/soc/mediatek/mt6797/mt6797-dai-pcm.c | 19 ++++-- 5 files changed, 81 insertions(+), 40 deletions(-) -- 2.18.0.rc2 _______________________________________________ Alsa-devel mailing list Alsa-devel@alsa-project.org http://mailman.alsa-project.org/mailman/listinfo/alsa-devel diff --git a/sound/soc/mediatek/mt6797/mt6797-afe-common.h b/sound/soc/mediatek/mt6797/mt6797-afe-common.h index 22eb7b455cf1..4eac9977b2b0 100644 --- a/sound/soc/mediatek/mt6797/mt6797-afe-common.h +++ b/sound/soc/mediatek/mt6797/mt6797-afe-common.h @@ -10,6 +10,7 @@ #define _MT_6797_AFE_COMMON_H_ #include +#include #include #include "../common/mtk-base-afe.h" diff --git a/sound/soc/mediatek/mt6797/mt6797-afe-pcm.c b/sound/soc/mediatek/mt6797/mt6797-afe-pcm.c index 6c5dd9fc9976..192f4d7b37b6 100644 --- a/sound/soc/mediatek/mt6797/mt6797-afe-pcm.c +++ b/sound/soc/mediatek/mt6797/mt6797-afe-pcm.c @@ -733,6 +733,34 @@ static const struct snd_soc_component_driver mt6797_afe_component = { .probe = mt6797_afe_component_probe, }; +static int mt6797_dai_memif_register(struct mtk_base_afe *afe) +{ + struct mtk_base_afe_dai *dai; + + dai = devm_kzalloc(afe->dev, sizeof(*dai), GFP_KERNEL); + if (!dai) + return -ENOMEM; + + list_add(&dai->list, &afe->sub_dais); + + dai->dai_drivers = mt6797_memif_dai_driver; + dai->num_dai_drivers = ARRAY_SIZE(mt6797_memif_dai_driver); + + dai->dapm_widgets = mt6797_memif_widgets; + dai->num_dapm_widgets = ARRAY_SIZE(mt6797_memif_widgets); + dai->dapm_routes = mt6797_memif_routes; + dai->num_dapm_routes = ARRAY_SIZE(mt6797_memif_routes); + return 0; +} + +typedef int (*dai_register_cb)(struct mtk_base_afe *); +static const dai_register_cb dai_register_cbs[] = { + mt6797_dai_adda_register, + mt6797_dai_pcm_register, + mt6797_dai_hostless_register, + mt6797_dai_memif_register, +}; + static int mt6797_afe_pcm_dev_probe(struct platform_device *pdev) { struct mtk_base_afe *afe; @@ -811,29 +839,24 @@ static int mt6797_afe_pcm_dev_probe(struct platform_device *pdev) } /* init sub_dais */ - afe->num_sub_dais = MT6797_DAI_NUM; - afe->sub_dais = devm_kcalloc(dev, afe->num_sub_dais, - sizeof(*afe->sub_dais), - GFP_KERNEL); - if (!afe->sub_dais) - return -ENOMEM; - - mt6797_dai_adda_register(afe); - mt6797_dai_pcm_register(afe); - mt6797_dai_hostless_register(afe); - - afe->sub_dais[MT6797_MEMIF_DL1].dai_drivers = mt6797_memif_dai_driver; - afe->sub_dais[MT6797_MEMIF_DL1].num_dai_drivers = - ARRAY_SIZE(mt6797_memif_dai_driver); - afe->sub_dais[MT6797_MEMIF_DL1].dapm_widgets = mt6797_memif_widgets; - afe->sub_dais[MT6797_MEMIF_DL1].num_dapm_widgets = - ARRAY_SIZE(mt6797_memif_widgets); - afe->sub_dais[MT6797_MEMIF_DL1].dapm_routes = mt6797_memif_routes; - afe->sub_dais[MT6797_MEMIF_DL1].num_dapm_routes = - ARRAY_SIZE(mt6797_memif_routes); + INIT_LIST_HEAD(&afe->sub_dais); + + for (i = 0; i < ARRAY_SIZE(dai_register_cbs); i++) { + ret = dai_register_cbs[i](afe); + if (ret) { + dev_warn(afe->dev, "dai register i %d fail, ret %d\n", + i, ret); + return ret; + } + } /* init dai_driver and component_driver */ - mtk_afe_combine_sub_dai(afe); + ret = mtk_afe_combine_sub_dai(afe); + if (ret) { + dev_warn(afe->dev, "mtk_afe_combine_sub_dai fail, ret %d\n", + ret); + return ret; + } afe->mtk_afe_hardware = &mt6797_afe_hardware; afe->memif_fs = mt6797_memif_fs; diff --git a/sound/soc/mediatek/mt6797/mt6797-dai-adda.c b/sound/soc/mediatek/mt6797/mt6797-dai-adda.c index ad083265ce94..0ac6409c6d61 100644 --- a/sound/soc/mediatek/mt6797/mt6797-dai-adda.c +++ b/sound/soc/mediatek/mt6797/mt6797-dai-adda.c @@ -383,14 +383,20 @@ static struct snd_soc_dai_driver mtk_dai_adda_driver[] = { int mt6797_dai_adda_register(struct mtk_base_afe *afe) { - int id = MT6797_DAI_ADDA; + struct mtk_base_afe_dai *dai; - afe->sub_dais[id].dai_drivers = mtk_dai_adda_driver; - afe->sub_dais[id].num_dai_drivers = ARRAY_SIZE(mtk_dai_adda_driver); + dai = devm_kzalloc(afe->dev, sizeof(*dai), GFP_KERNEL); + if (!dai) + return -ENOMEM; - afe->sub_dais[id].dapm_widgets = mtk_dai_adda_widgets; - afe->sub_dais[id].num_dapm_widgets = ARRAY_SIZE(mtk_dai_adda_widgets); - afe->sub_dais[id].dapm_routes = mtk_dai_adda_routes; - afe->sub_dais[id].num_dapm_routes = ARRAY_SIZE(mtk_dai_adda_routes); + list_add(&dai->list, &afe->sub_dais); + + dai->dai_drivers = mtk_dai_adda_driver; + dai->num_dai_drivers = ARRAY_SIZE(mtk_dai_adda_driver); + + dai->dapm_widgets = mtk_dai_adda_widgets; + dai->num_dapm_widgets = ARRAY_SIZE(mtk_dai_adda_widgets); + dai->dapm_routes = mtk_dai_adda_routes; + dai->num_dapm_routes = ARRAY_SIZE(mtk_dai_adda_routes); return 0; } diff --git a/sound/soc/mediatek/mt6797/mt6797-dai-hostless.c b/sound/soc/mediatek/mt6797/mt6797-dai-hostless.c index 4cf985b15a11..ed23e6a53b08 100644 --- a/sound/soc/mediatek/mt6797/mt6797-dai-hostless.c +++ b/sound/soc/mediatek/mt6797/mt6797-dai-hostless.c @@ -100,13 +100,19 @@ static struct snd_soc_dai_driver mtk_dai_hostless_driver[] = { int mt6797_dai_hostless_register(struct mtk_base_afe *afe) { - int id = MT6797_DAI_HOSTLESS_LPBK; + struct mtk_base_afe_dai *dai; - afe->sub_dais[id].dai_drivers = mtk_dai_hostless_driver; - afe->sub_dais[id].num_dai_drivers = ARRAY_SIZE(mtk_dai_hostless_driver); + dai = devm_kzalloc(afe->dev, sizeof(*dai), GFP_KERNEL); + if (!dai) + return -ENOMEM; - afe->sub_dais[id].dapm_routes = mtk_dai_hostless_routes; - afe->sub_dais[id].num_dapm_routes = ARRAY_SIZE(mtk_dai_hostless_routes); + list_add(&dai->list, &afe->sub_dais); + + dai->dai_drivers = mtk_dai_hostless_driver; + dai->num_dai_drivers = ARRAY_SIZE(mtk_dai_hostless_driver); + + dai->dapm_routes = mtk_dai_hostless_routes; + dai->num_dapm_routes = ARRAY_SIZE(mtk_dai_hostless_routes); return 0; } diff --git a/sound/soc/mediatek/mt6797/mt6797-dai-pcm.c b/sound/soc/mediatek/mt6797/mt6797-dai-pcm.c index 16d5b5067204..3136f0bc7827 100644 --- a/sound/soc/mediatek/mt6797/mt6797-dai-pcm.c +++ b/sound/soc/mediatek/mt6797/mt6797-dai-pcm.c @@ -298,15 +298,20 @@ static struct snd_soc_dai_driver mtk_dai_pcm_driver[] = { int mt6797_dai_pcm_register(struct mtk_base_afe *afe) { - int id = MT6797_DAI_PCM_1; + struct mtk_base_afe_dai *dai; - afe->sub_dais[id].dai_drivers = mtk_dai_pcm_driver; - afe->sub_dais[id].num_dai_drivers = ARRAY_SIZE(mtk_dai_pcm_driver); + dai = devm_kzalloc(afe->dev, sizeof(*dai), GFP_KERNEL); + if (!dai) + return -ENOMEM; - afe->sub_dais[id].dapm_widgets = mtk_dai_pcm_widgets; - afe->sub_dais[id].num_dapm_widgets = ARRAY_SIZE(mtk_dai_pcm_widgets); - afe->sub_dais[id].dapm_routes = mtk_dai_pcm_routes; - afe->sub_dais[id].num_dapm_routes = ARRAY_SIZE(mtk_dai_pcm_routes); + list_add(&dai->list, &afe->sub_dais); + dai->dai_drivers = mtk_dai_pcm_driver; + dai->num_dai_drivers = ARRAY_SIZE(mtk_dai_pcm_driver); + + dai->dapm_widgets = mtk_dai_pcm_widgets; + dai->num_dapm_widgets = ARRAY_SIZE(mtk_dai_pcm_widgets); + dai->dapm_routes = mtk_dai_pcm_routes; + dai->num_dapm_routes = ARRAY_SIZE(mtk_dai_pcm_routes); return 0; }