From patchwork Tue Jan 24 02:12:45 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuninori Morimoto X-Patchwork-Id: 13113324 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 03AE0C05027 for ; Tue, 24 Jan 2023 02:14:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Date:Subject:Cc:References :In-Reply-To:To:From:Message-ID:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=kKI5rW1Y0j12NH319TekK8j3BD2AFIHJkKPNvrpRmBU=; b=IbP9TtVYZaXK69 6W80rOBsBgmkWaWf5AzpSzQJnF4AvrWU0oQKYDar7mob7B6AEV6C8OP7SN0R+1o/X3TEA9RZUXj5g g/uYHFzaNGT2ds4E84P3O4OURy+WHeAKB+MXeGli3A6ahiUfrDCJe4dloczZz48Q3S7yX68w8qeSZ CkIc8KI+LmAxCJoi/1howD3M6zvle5OW04FX8qv6V5eaPia523+eneTlGubMDN4Pp4cFaGtmY+RpN sZfhy/1gCt1dNqB4KY2/E8mghqkXeeNO83SXVDs2VLPAYKk+C93UtH9Cbsmk63W0um9CKtMyL6FzR szF23qpnPhxnagB9KVDg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pK8o3-0025KP-Cn; Tue, 24 Jan 2023 02:13:03 +0000 Received: from mail-os0jpn01on2118.outbound.protection.outlook.com ([40.107.113.118] helo=JPN01-OS0-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1pK8nz-0025J1-L7; Tue, 24 Jan 2023 02:13:02 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=j1QDK62/q70voPZ35hFdIA19H3jy5IKIvXsPETL0qEQ5YOpfqfEBdRfJXKVKn/rD9mA448blx/LMIRjcu/qV4XMqCwVtJZmOIP3p7QUTBA6HYvski1x8J8QFxaB5XB0Zi0USeyWHKbphav/wTacklGmRHx9wsGAXP+pyKl95FES1V5fWrJlJAW3jBCDPFhZU5hg63g6mAHt96Xu9ytl/mBIphKK0KdS4MRLtKRJmvL9SgpqFHQsADQXkM/5MlZExwGjazcACl7vw+k8YO7n6I88y8INxHFkkiwYaoPQmfPirLhSjbvylP9KthRVnUAyflG+FivXC2d7bA7kEA5ryHg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=EcHtF/n2MSlkWXR586MqlkB7DN4Aawdn+kM8+CENqbw=; b=HB+f3OSiCR7oFI11dC0ynoVQlfa6up+opoNxqtM0jpsuaTULrqrIT//YwbzrKyZHt3gyXV6vcIl++J/XMBgkMcdOlvjQGc5Qnkp+P89v7Wnj2AZdqpICgBApvtY0llGQCBU0/zfDMfsVHWWh/6rT7X9unKceq1zpCO+dV0kEEjzZ85PS7BfPSTmrnSjuzm8JrChsTOygDXceF5omKHQNzWN55hUUAw2BwqUHK8glWMXuVmjhIjpR2J/oOpS3w6p0SHMQ5rKJjJDZ2KKbsgsghS6MsrHfobiG8J9OCudW93CaFLmR1iPxSt3znTkEPEosrR0JJOZr6Unz18FVVykqIA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=renesas.com; dmarc=pass action=none header.from=renesas.com; dkim=pass header.d=renesas.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=renesas.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=EcHtF/n2MSlkWXR586MqlkB7DN4Aawdn+kM8+CENqbw=; b=kP2zeiIJ5p0Ne1mT3sQKafti/Pc6ui+drdFeoiyJUT1rDDVT7iDd4Ibwi2z2v4HI2eULqa3Y/oCZq8xADFmElSh52lgxLXsKQCk/YvSedFx/j+94xplY8KyX4zDd9qwos5KcG4ifRbrq/Hy7+eqmwGCKU7Al9K2chIcWDCXFVGU= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=renesas.com; Received: from OS3PR01MB8426.jpnprd01.prod.outlook.com (2603:1096:604:194::10) by OS7PR01MB11964.jpnprd01.prod.outlook.com (2603:1096:604:23e::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6002.33; Tue, 24 Jan 2023 02:12:46 +0000 Received: from OS3PR01MB8426.jpnprd01.prod.outlook.com ([fe80::3cd7:a7b5:ea86:9ae]) by OS3PR01MB8426.jpnprd01.prod.outlook.com ([fe80::3cd7:a7b5:ea86:9ae%6]) with mapi id 15.20.6002.033; Tue, 24 Jan 2023 02:12:46 +0000 Message-ID: <87edrku1cy.wl-kuninori.morimoto.gx@renesas.com> From: Kuninori Morimoto To: Mark Brown In-Reply-To: <87y1psu1m1.wl-kuninori.morimoto.gx@renesas.com> References: <87y1psu1m1.wl-kuninori.morimoto.gx@renesas.com> Cc: Matthias Brugger , Chunxu Li , Jiaxin Yu , AngeloGioacchino Del Regno , Charles Keepax , Minghao Chi , linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, Linux-ALSA Subject: [PATCH v2 14/25] ASoC: mediatek: use helper function User-Agent: Wanderlust/2.15.9 Emacs/26.3 Mule/6.0 Date: Tue, 24 Jan 2023 02:12:45 +0000 X-ClientProxiedBy: TYCPR01CA0183.jpnprd01.prod.outlook.com (2603:1096:400:2b0::19) To OS3PR01MB8426.jpnprd01.prod.outlook.com (2603:1096:604:194::10) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: OS3PR01MB8426:EE_|OS7PR01MB11964:EE_ X-MS-Office365-Filtering-Correlation-Id: 7f4d2812-9d8a-4cd1-e5e3-08dafdb07bb8 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: N/hpDMLYeneW4dKcEMJ9O8dw/QdvL6Igp9qX7eM7uHlXopfzECOkLRv+WfPgfF49Q/hrxZIVhnXZc706c+WnT3C1Fft7jiwbvQVn+9tOCzw2+rbxzIiCknJ/DFgVPIJCtRii4NAAPjJ+o+tSD/xiKVijEmRcyIXVwielEsRj2WwCHKQy+nQzz7bWtAt65x3zGbgAvjbCwogpdkmtlyq2rNjYHtvX5AooaOcLT9alVXWmlqtaEcFTbyX5Vhq9Vqn7LqLhkqxb438dARz176nA4ybfZ7cVLXcTYekMinAxjcFENp+wKjRTYMGpIgtpOenEHq9BmfT7Mq+nK8i8aFfTYlqwWQqECvQLe4EG/8TR3BAbqgSZrZbFd3bxSCJ8pm9sJyKrPoOA1y+O375n+38NCREP0oBymmkFaiaBTD0BY3v8w0n8SjFea8X5f6JuaZjJkKZwPCnCkKFAH98jhko0p2QgQ3Rzry5M4VETAQxlCJIypQOiNSctUYJ1hnpx/BgLk1w+Jh6MpPAxdI0TUENsH5uXB4bPv3Av/QGrwPqyp9M5XImsOV6VtOCAZtaBsbECQOASs76evqf6X0F4FXw94aLjWXKVX3fJGlTnsmhGJS9dbH16SeMpiiZIdoQVoLRQRcbV7WgbgLeQDtXDqodFMX8Z5pVQfQKcn0ov1rPlr4hyQiaZ0rYmqeUhoKNwkirb6yV5ylNepZ/EagmC5TCKeg== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:OS3PR01MB8426.jpnprd01.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230022)(4636009)(39860400002)(376002)(346002)(396003)(366004)(136003)(451199015)(36756003)(2906002)(6512007)(7416002)(5660300002)(478600001)(186003)(6486002)(26005)(2616005)(8936002)(54906003)(66946007)(316002)(4326008)(66556008)(66476007)(8676002)(6916009)(83380400001)(6506007)(52116002)(86362001)(38100700002)(38350700002)(41300700001);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: gDlUUOSW9gJaWLa5kTiI5CxhPoxFx00HgHhpk7/73XgPsep57DKQlZp/+Hc7/hnaxgA9eqhRTRUzVv6Q7dWYLYM/0OdTq9YQrnakuwyd7X1/ztuNBKazX/L03w6mnCow7NszhpIGQqqVCTWIeliGaR/8gWMc086pDGe3Fgx+NkbjpNLy2Molsabm6Zw5bcZaEOBsQTJkLuNsqNRwzdLX1wPWQLLhnw5NztdjAqS8QOH7lH5WDzl0KCkQj4goAZT8COwujJOXCbcUNfE5YxSc4ilfM8MSe2YBBEPo7JZueXhh+x/wVEqbaoUm1FAOrOJoImtJNIuha9v40CkPOSP0CvzR1oYhikHCWfZfQnncpHubcf/DelHt9cy58wLkwtBQUmozh98ZUoubcJRZIlxe3pQMMrsqZQ11mMXvDoIxGa2Alt3CXrmauBxft+OZTMQooh07FXlPEbkBIJO+wHo0lF0qD2e9kWg8dX5Ewfj6YXO7d6jygsYMeaZDPHh/k6wLQbusP1AOu/igckWiGsRUgSH/Pc/RAv7ut9nDeDwW8l1vYAmGf71afAMSZCMCKAro93fhhVemxQXWJ43P6VyZK2b4xrAcMy6qMRdBjDAa2HXtUEV+ywwKbNZQew4QifS6fnL2ysaRu5iQaZa4sN7938mecNtLYo32eySgVI1vuUcoK9Knn7dPUWqVIuHrPk9OA3Mw7V+xthFo4SCsEd0KwY7FeckzK8BGZGaE5QAa4QSVY3bX5AAEcWVdeQZtDG8eGaNFqONGGXQxwRrOUAl5l/9UwRGy70EiOvzaihSEWs/rIiRfe1GaJpszIb+QsiFUsoDEKAofO4DYURZyXh5j29RH6c1tjzjMkBEa9n3VvCsz72PIn5tePC7X/OTRqj7pJEiBO8ogSQ+bDV+bchll556KX1LzCid9fb7BE+hAM+/je6FP+PF0kf7VV/Gd88TVs/QfMIDkWBWYSmVgnl3K8uLh7b7dtr06JS2TELANeAXseIXRvSlXhRKLYsqPaMR2W3hn3GrGU7iU7gPuYuLLtwlMlF6LumBqZb9zgdds4e25nAHlyKEyPP25VL2VLc3Uzw+nDYOP9nhideWMV6fM8hNtaHVEYJo6VrJ9rnTuhtwl4bzJQsdqhnemAYuUa/18H+39VCKIQBkKUqFSApwooSF/zPGOVUkCXNldVjxp3Amau8rWJIrELYhSlKmUyBoxHZwKObp0IZaPipzMrAXwYa1jGow9r/y6wIrKL6fXGZaotSF/jLq/A8A3Ve6CdLO8GPrP/qkrTCzyho5ky9p1aSZzok3uc1licRJQW1kRSktGd9Jk17Eg/kAnkfiOgtM3x5tKHmzkume590PqVkR0atiutfhOAAj/Vt465yC7Vid90l6dAUOORUJhWClbXAojdJQvoDfxePIagSZyj8VK6PDOgAbGYusSUjM8MSPU8dm3U5h6s66T4YBwkx8wtwR/hbPrr9r2JS2SuABuERPneGZNIKfgmRgUypBymOywIEDpd0F6QKk1RYVjru0Vsp3xIyu2YtW+bYfxQKVMzbsuJK7sKFZck9+1LJ2kexyBQbf15J5QrTb05Io/foO+hicDxkenKjvWi7pAqpEjKriT4h7Yk1vSjfQ/kAlgZ2VBMPo= X-OriginatorOrg: renesas.com X-MS-Exchange-CrossTenant-Network-Message-Id: 7f4d2812-9d8a-4cd1-e5e3-08dafdb07bb8 X-MS-Exchange-CrossTenant-AuthSource: OS3PR01MB8426.jpnprd01.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Jan 2023 02:12:45.9070 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 53d82571-da19-47e4-9cb4-625a166a4a2a X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: XEVSX2x0eomLp9b3fgGolG8c6RblouJVqRqFHe1SfvUOgrV2BOH1GSrLjDUfTBQKKk4qS1HBKoqA+rcfXxCxk7H4KkM8IHkQohMoAkvIpXq66w2RVwT0+riRXDQnCifK X-MS-Exchange-Transport-CrossTenantHeadersStamped: OS7PR01MB11964 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230123_181259_860628_E5241AFF X-CRM114-Status: GOOD ( 13.72 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org From: Kuninori Morimoto Current ASoC has many helper function. This patch use it. Signed-off-by: Kuninori Morimoto Reviewed-by: AngeloGioacchino Del Regno --- sound/soc/mediatek/common/mtk-dsp-sof-common.c | 18 +++++++----------- sound/soc/mediatek/mt6797/mt6797-dai-pcm.c | 8 +++++--- sound/soc/mediatek/mt8183/mt8183-dai-pcm.c | 7 ++++--- sound/soc/mediatek/mt8186/mt8186-dai-pcm.c | 7 ++++--- sound/soc/mediatek/mt8192/mt8192-dai-pcm.c | 8 +++++--- sound/soc/mediatek/mt8195/mt8195-dai-pcm.c | 7 +++++-- 6 files changed, 30 insertions(+), 25 deletions(-) diff --git a/sound/soc/mediatek/common/mtk-dsp-sof-common.c b/sound/soc/mediatek/common/mtk-dsp-sof-common.c index 8b1b623207be..6fef16306f74 100644 --- a/sound/soc/mediatek/common/mtk-dsp-sof-common.c +++ b/sound/soc/mediatek/common/mtk-dsp-sof-common.c @@ -32,7 +32,7 @@ int mtk_sof_dai_link_fixup(struct snd_soc_pcm_runtime *rtd, continue; for_each_rtd_cpu_dais(runtime, j, cpu_dai) { - if (cpu_dai->stream_active[conn->stream_dir] > 0) { + if (snd_soc_dai_stream_active(cpu_dai, conn->stream_dir) > 0) { sof_dai_link = runtime->dai_link; break; } @@ -111,21 +111,17 @@ int mtk_sof_card_late_probe(struct snd_soc_card *card) for_each_rtd_cpu_dais(sof_rtd, j, cpu_dai) { struct snd_soc_dapm_route route; struct snd_soc_dapm_path *p = NULL; - struct snd_soc_dapm_widget *play_widget = - cpu_dai->playback_widget; - struct snd_soc_dapm_widget *cap_widget = - cpu_dai->capture_widget; + struct snd_soc_dapm_widget *widget = snd_soc_dai_get_widget(cpu_dai, conn->stream_dir); + memset(&route, 0, sizeof(route)); - if (conn->stream_dir == SNDRV_PCM_STREAM_CAPTURE && - cap_widget) { - snd_soc_dapm_widget_for_each_sink_path(cap_widget, p) { + if (conn->stream_dir == SNDRV_PCM_STREAM_CAPTURE && widget) { + snd_soc_dapm_widget_for_each_sink_path(widget, p) { route.source = conn->sof_dma; route.sink = p->sink->name; snd_soc_dapm_add_routes(&card->dapm, &route, 1); } - } else if (conn->stream_dir == SNDRV_PCM_STREAM_PLAYBACK && - play_widget) { - snd_soc_dapm_widget_for_each_source_path(play_widget, p) { + } else if (conn->stream_dir == SNDRV_PCM_STREAM_PLAYBACK && widget) { + snd_soc_dapm_widget_for_each_source_path(widget, p) { route.source = p->source->name; route.sink = conn->sof_dma; snd_soc_dapm_add_routes(&card->dapm, &route, 1); diff --git a/sound/soc/mediatek/mt6797/mt6797-dai-pcm.c b/sound/soc/mediatek/mt6797/mt6797-dai-pcm.c index 51f736f319e4..8a309b0734f7 100644 --- a/sound/soc/mediatek/mt6797/mt6797-dai-pcm.c +++ b/sound/soc/mediatek/mt6797/mt6797-dai-pcm.c @@ -183,6 +183,8 @@ static int mtk_dai_pcm_hw_params(struct snd_pcm_substream *substream, struct snd_soc_dai *dai) { struct mtk_base_afe *afe = snd_soc_dai_get_drvdata(dai); + struct snd_soc_dapm_widget *p = snd_soc_dai_get_widget_playback(dai); + struct snd_soc_dapm_widget *c = snd_soc_dai_get_widget_capture(dai); unsigned int rate = params_rate(params); unsigned int rate_reg = mt6797_rate_transform(afe->dev, rate, dai->id); unsigned int pcm_con = 0; @@ -193,10 +195,10 @@ static int mtk_dai_pcm_hw_params(struct snd_pcm_substream *substream, substream->stream, rate, rate_reg, - dai->playback_widget->active, - dai->capture_widget->active); + p->active, + c->active); - if (dai->playback_widget->active || dai->capture_widget->active) + if (p->active || c->active) return 0; switch (dai->id) { diff --git a/sound/soc/mediatek/mt8183/mt8183-dai-pcm.c b/sound/soc/mediatek/mt8183/mt8183-dai-pcm.c index 38ce0e36cdb4..4e25287fc0e4 100644 --- a/sound/soc/mediatek/mt8183/mt8183-dai-pcm.c +++ b/sound/soc/mediatek/mt8183/mt8183-dai-pcm.c @@ -183,6 +183,8 @@ static int mtk_dai_pcm_hw_params(struct snd_pcm_substream *substream, struct snd_soc_dai *dai) { struct mtk_base_afe *afe = snd_soc_dai_get_drvdata(dai); + struct snd_soc_dapm_widget *p = snd_soc_dai_get_widget_playback(dai); + struct snd_soc_dapm_widget *c = snd_soc_dai_get_widget_capture(dai); unsigned int rate = params_rate(params); unsigned int rate_reg = mt8183_rate_transform(afe->dev, rate, dai->id); unsigned int pcm_con = 0; @@ -193,10 +195,9 @@ static int mtk_dai_pcm_hw_params(struct snd_pcm_substream *substream, substream->stream, rate, rate_reg, - dai->playback_widget->active, - dai->capture_widget->active); + p->active, c->active); - if (dai->playback_widget->active || dai->capture_widget->active) + if (p->active || c->active) return 0; switch (dai->id) { diff --git a/sound/soc/mediatek/mt8186/mt8186-dai-pcm.c b/sound/soc/mediatek/mt8186/mt8186-dai-pcm.c index 41221a66111c..a50aa294960b 100644 --- a/sound/soc/mediatek/mt8186/mt8186-dai-pcm.c +++ b/sound/soc/mediatek/mt8186/mt8186-dai-pcm.c @@ -218,6 +218,8 @@ static int mtk_dai_pcm_hw_params(struct snd_pcm_substream *substream, { struct mtk_base_afe *afe = snd_soc_dai_get_drvdata(dai); struct mt8186_afe_private *afe_priv = afe->platform_priv; + struct snd_soc_dapm_widget *p = snd_soc_dai_get_widget_playback(dai); + struct snd_soc_dapm_widget *c = snd_soc_dai_get_widget_capture(dai); int pcm_id = dai->id; struct mtk_afe_pcm_priv *pcm_priv = afe_priv->dai_priv[pcm_id]; unsigned int rate = params_rate(params); @@ -230,12 +232,11 @@ static int mtk_dai_pcm_hw_params(struct snd_pcm_substream *substream, unsigned int pcm_con = 0; dev_dbg(afe->dev, "%s(), id %d, stream %d, widget active p %d, c %d\n", - __func__, dai->id, substream->stream, dai->playback_widget->active, - dai->capture_widget->active); + __func__, dai->id, substream->stream, p->active, c->active); dev_dbg(afe->dev, "%s(), rate %d, rate_reg %d, data_width %d, wlen_width %d\n", __func__, rate, rate_reg, data_width, wlen_width); - if (dai->playback_widget->active || dai->capture_widget->active) + if (p->active || c->active) return 0; switch (dai->id) { diff --git a/sound/soc/mediatek/mt8192/mt8192-dai-pcm.c b/sound/soc/mediatek/mt8192/mt8192-dai-pcm.c index 239e3f5b53d3..2847a2e747be 100644 --- a/sound/soc/mediatek/mt8192/mt8192-dai-pcm.c +++ b/sound/soc/mediatek/mt8192/mt8192-dai-pcm.c @@ -273,6 +273,8 @@ static int mtk_dai_pcm_hw_params(struct snd_pcm_substream *substream, struct snd_soc_dai *dai) { struct mtk_base_afe *afe = snd_soc_dai_get_drvdata(dai); + struct snd_soc_dapm_widget *p = snd_soc_dai_get_widget_playback(dai); + struct snd_soc_dapm_widget *c = snd_soc_dai_get_widget_capture(dai); unsigned int rate = params_rate(params); unsigned int rate_reg = mt8192_rate_transform(afe->dev, rate, dai->id); unsigned int pcm_con = 0; @@ -283,10 +285,10 @@ static int mtk_dai_pcm_hw_params(struct snd_pcm_substream *substream, substream->stream, rate, rate_reg, - dai->playback_widget->active, - dai->capture_widget->active); + p->active, + c->active); - if (dai->playback_widget->active || dai->capture_widget->active) + if (p->active || c->active) return 0; switch (dai->id) { diff --git a/sound/soc/mediatek/mt8195/mt8195-dai-pcm.c b/sound/soc/mediatek/mt8195/mt8195-dai-pcm.c index caceb0deb467..051433689ff5 100644 --- a/sound/soc/mediatek/mt8195/mt8195-dai-pcm.c +++ b/sound/soc/mediatek/mt8195/mt8195-dai-pcm.c @@ -213,11 +213,14 @@ static int mtk_dai_pcm_configure(struct snd_pcm_substream *substream, static int mtk_dai_pcm_prepare(struct snd_pcm_substream *substream, struct snd_soc_dai *dai) { + struct snd_soc_dapm_widget *p = snd_soc_dai_get_widget_playback(dai); + struct snd_soc_dapm_widget *c = snd_soc_dai_get_widget_capture(dai); + dev_dbg(dai->dev, "%s(), id %d, stream %d, widget active p %d, c %d\n", __func__, dai->id, substream->stream, - dai->playback_widget->active, dai->capture_widget->active); + p->active, c->active); - if (dai->playback_widget->active || dai->capture_widget->active) + if (p->active || c->active) return 0; return mtk_dai_pcm_configure(substream, dai); From patchwork Tue Jan 24 02:13:13 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuninori Morimoto X-Patchwork-Id: 13113325 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 5B8BEC25B50 for ; Tue, 24 Jan 2023 02:14:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Date:Subject:Cc:References :In-Reply-To:To:From:Message-ID:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=lUvPMO2skRHUQ+jC/m7oXs06poZqXKrEbh531FQOomE=; b=zDMY0sevQv70+4 p5skGoyGs+DQBL96F04+WNDy43Rik2c2sRdtKXWJO5JNkQKXKeKu1nlahGQDDK2Hbnn/Li/OYdgRs UmfDVb621QD0xyTYwjv9e79JfelT99kQ+2FwKJSa/37Ma4l9dXfojNPQIpGnhZWxuYiM/zUihIWZM efQFdka6l060tjxCzK274axV9RTWvisx0NTEa7z8+cd9YU89dzqlGOgMEq/eooRMz9HZNa6rl5Oy3 L/kzhwc01dHTDSKv6dXGNUF7p0tklbOVeMthBS0eSVfCu9kL2zOvxP+RmKIRm+Q/tq6wc4dRfLKjy JAyZLrBefb9duuUw/rhA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pK8oO-0025OR-2w; Tue, 24 Jan 2023 02:13:24 +0000 Received: from mail-os0jpn01on2094.outbound.protection.outlook.com ([40.107.113.94] helo=JPN01-OS0-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1pK8oK-0025Mm-BZ; Tue, 24 Jan 2023 02:13:22 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=D62z9bekzSviaQdcgUtt0Cje0ToC8p9pHlguBXArhhFdT6n6FtOVpE8hk1TF5BIgDEDXOEEI2ltrz2O0mS/4Lx8GOxDOBGBHNCw3MJ5lW+l/wrxW4hHaBe7Lgf6xSt2vOK8COYo1fixDZYxncmbl2X1SVbr/C/TrhJ9rw2ADfEMM/I1SbfECNhnOYgTGJ/uQ+e1tvLW0nmPz6WkmWrCnhaeCnRNpH6m2a9lBIqE4TRUEx/aWeepJ7gVD98Kgm3knmIuQzSX0mnSr1o3vHJWAT5PoQIBR4vhm1NIEJMXML+EvLsLu3XxQ+OpRiMTaFz89xMpN1bdsyDzkoo2oh9eVhg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=abCmlxjTeJUpbD23/u/q8Igmh45AfePycqqbck2s2Hg=; b=DR0XWnuA8FwWW1P+SBacc1u3wafkJA5xsxTpf6zmEA61WdtejupRt9oDU45U0UwHG+4E8Q1CA0IRo2Di2VB7GJUy5N+Tp8TVzpEajYx9VQGZo3TgV8VPREnhklGwA1glCiqSgfmNQdAzKaE03nX1p6UlvlVuCyAnYQwbf8gneam70MIh8qkt1YIpSzT5ARykO5MCOF0z62XFWWiPkyaKcZPtip/t6x9qYJwNE4+1+SMJx2N/1bIyXcqHjQtzNpHma4pdxGSNLhHoZhDSkF3jHEPKPcRuh0fS3JUNpewbvEH+3o+SUvxqAtQJSueElYowYaL/hHEj5PDh2nw8bJzSUA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=renesas.com; dmarc=pass action=none header.from=renesas.com; dkim=pass header.d=renesas.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=renesas.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=abCmlxjTeJUpbD23/u/q8Igmh45AfePycqqbck2s2Hg=; b=ZCNjedEnSbzMMEh13lFy1uMLM22N/PzxNRfT0R7DE9zFi0dwndu3CdscNoDhImGh1xDeSL7Was28GxoBOu7dMeyS5ezboiGIc6X6du0NwZsAya5F/hhMCyJMOkwwryEUUWk3letakSRv1tkZVEHkY4CfAzGUEIvv4+pXg35EFWw= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=renesas.com; Received: from OS3PR01MB8426.jpnprd01.prod.outlook.com (2603:1096:604:194::10) by TYCPR01MB11127.jpnprd01.prod.outlook.com (2603:1096:400:362::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6002.33; Tue, 24 Jan 2023 02:13:13 +0000 Received: from OS3PR01MB8426.jpnprd01.prod.outlook.com ([fe80::3cd7:a7b5:ea86:9ae]) by OS3PR01MB8426.jpnprd01.prod.outlook.com ([fe80::3cd7:a7b5:ea86:9ae%6]) with mapi id 15.20.6002.033; Tue, 24 Jan 2023 02:13:13 +0000 Message-ID: <87cz74u1c7.wl-kuninori.morimoto.gx@renesas.com> From: Kuninori Morimoto To: Mark Brown In-Reply-To: <87y1psu1m1.wl-kuninori.morimoto.gx@renesas.com> References: <87y1psu1m1.wl-kuninori.morimoto.gx@renesas.com> Cc: Jerome Brunet , Neil Armstrong , Kevin Hilman , Martin Blumenstingl , alsa-devel@alsa-project.org, linux-arm-kernel@lists.infradead.org, linux-amlogic@lists.infradead.org Subject: [PATCH v2 15/25] ASoC: meson: use helper function User-Agent: Wanderlust/2.15.9 Emacs/26.3 Mule/6.0 Date: Tue, 24 Jan 2023 02:13:13 +0000 X-ClientProxiedBy: TYCPR01CA0116.jpnprd01.prod.outlook.com (2603:1096:405:4::32) To OS3PR01MB8426.jpnprd01.prod.outlook.com (2603:1096:604:194::10) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: OS3PR01MB8426:EE_|TYCPR01MB11127:EE_ X-MS-Office365-Filtering-Correlation-Id: 4135f367-b573-448d-6c39-08dafdb08c3d X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: SrMiyDvWpw9bMymVu9Jg0mvtvGZ3U3A96UOLnVvr0wEtsYZxNLc/S16TDMXU5U9ziZBjLpBr6AweEzDfT1+oSgjJFisUORSKVv5x4/JqedrhwgNfDyjGBxeBtwPqZKBlso+I8OPKlH59mqjHPrpAUQBqmrE41FER71Vp3N9c/BcQwfxZOIKawM4kMWL0KSywQs8/7EIY+IdsSZH+NLYjuogLhIEmMD0mX4ZOp17PX/mwfSB6HR+fx5zQMVLzVlGh7pwW9RC3cOHGwJiIEP9k8k9THJS0Yfi5beKL/7227A+Mabi18JzSN2YsPvB0SgBNDKPwxx/uxQW9aiHixHPlscR2vuHSTGrVLjzYDg8Xdsen+ne+QUE9H18/TrsCiDgk18wfMpb8oMunPpBQgMST2inJRb/dY+j2XfiZitOUL6jJ9RECx21SSCyTzVOTtCDwWPLAiikRsMLHhq0KHTTyp0H8t8bW5M/9aeF5DszgqvCD8dMPkr8dKn8t2nJOJLNHq2dGqfhbdKRljDAWxvcfoGSWtLgzYc+yjkVrVYRGnAtnwMu/xXP5F4YBKKM/zGsEsTOu+1LBrPZahxtXgHf2015y0C1rWip3yTi3J3tBZYtnRBvsnq/5Hv1k8+toAqjHCJ8MkNLmCAqHLNO8Jw3Uqa+NXC7vn5cL81dRw8APMANizs7KYaAqP4d4e56l6PUsHZ3oMOdIAxQbJCH93PJhBg== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:OS3PR01MB8426.jpnprd01.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230022)(4636009)(346002)(376002)(39860400002)(136003)(396003)(366004)(451199015)(8676002)(54906003)(316002)(86362001)(2906002)(36756003)(4326008)(5660300002)(66476007)(66946007)(66556008)(6916009)(41300700001)(478600001)(6506007)(83380400001)(6486002)(8936002)(38350700002)(52116002)(6512007)(38100700002)(2616005)(186003)(26005);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: q83T1PT9C2M7zEDMgL5NWlEMcnc1yCVTr6gVv8dzuTcQ/E/GIUDK7j9b3SX/v33lqV6cCSFANEZAnhSqioRtH2w9a6yvMrp0t+sPsItFVNpvWFZYgv6/bzgQYfFzVLoNWfsGhBBxHktGogmYSoAi5ykt4y/A5T5bZ0N0WFLBaVrd8Fy+yWnHmVCG/3/hIkYBNgsVHmSC/9ADVWqXRNUcWE1Vd9fe6Zt1omYX/SGY/hguzqgNcFaWIxh+iXaTT1okrSTcAbN2BdqLTRQVbWfbDHSJ57Xf9X+/MLoIYrPxX4yeDJ7MXsgn+r/Wcb/Icq+Qt/cTUvNhhBP78bAMS64QOXPQSoUondH1u08U4fV3CaIYFUdYNB/12HvHFClv78rEdfNM74MNQrs6DyHfKLKCc6Qf994Ra3rQEhH3RUQQoeqBmbNnIH83a8nR6jM/6nHv2flMOq+ojVzu9OsNUB181xrbGgSC0XvN3ugcY6TmA2Q25qZk6sPQLgnB52Xwa9lK6aRmFe9X8wfjr2xBCCGeMpphhQSw2RvRyudA0DNAFYxlm9xsUN5GNE22rDBHqA2Utd4G6uMhxPpLZKP/SeoBV9h7DkF6agokvfHjdTWTGau9m471FTkFNRXyPNVrMQxjc17OEqYb080q0/GopcTTnS2GlauVQ5ScHu+Cwae/98hrhkPpXSIBDAZKb8mz6+++E7ljzv7jKmRAHI5ISLmrldGDom6qaTa+Zif+pXl/nwOg+xrUyXBQwGdP+XidTd0gA3n8tsEpD2KTVXVkyZDwWG5NY7z3cmcRCJF0bKL3MWWiLaHRy0PC9JRBCY+B66IAz00fxb6qq3yrqAfmk5PxT1tzNmRtPdGSo+ciWOBI93XVx7iFX0t+DaPnQfuMHZL6bsyPGjtF7fMriGCVD8gPlJaoAHH+kST8+SGYbPV3oaBngYIbfY3lo+Gc1zgIxicWhfieyYQOC6REHAt1+ygSi3mCalshyQciVe973vN4RSk9lNzA4hZcAFcdQEiyODkcBlgLkuIIP+Fu7fA51KRJ9BQ8KRzEFhDruywzUC+m/8wucCHZZc6P14ryNk3B+Tk3cCFeH7cvqG9nZ9UWCNVIl7TWlSzcHjJCnGQtNYysRuIftUq+wKY4CodDV2eZe3CRllifErsGv56VI5UzHoH4/g8aMZZjrFWSdLm1wVSa+hmII2xXxUuHE5Zvk+DXIlTXhAmCGCOCx5E+OubpHk9xoPzjnb/YnIlWNdaGH4bSxitw1JJVUKAAu8YB+0Y0S+s6m/dBZjefDbxs0COq4jx/Z5LEO/45GKANa4UCgm2G8oS//h9YUGH3kDf60J+pF5bvpLVemjPtm49aid2oE5GUIbtwKegJ56wlnTf2/kFnN7c1DcGFpvJlIE8F865Wd3LaxSI1vf641QQ0bozXi3PMYmQhNbiIC8HyoU/ig+LpfWaaSet7c61uTDjogleSChdfx3fGMP0VRB2nH2keiJgnABwoi4sWndP3Jg5Nk4zdeH7+baPd/ysBktZ0s47eIwNyl3a4UMzIWu8eWXeVg3U1i4aSooFDl1tj/yB4UrLe2NqBqShmAScGWOTmQnKKj/JR6E/0ICy5tyJuDR8SU7Ml0fHdHVNXAvuGOJ91XY9lhGU= X-OriginatorOrg: renesas.com X-MS-Exchange-CrossTenant-Network-Message-Id: 4135f367-b573-448d-6c39-08dafdb08c3d X-MS-Exchange-CrossTenant-AuthSource: OS3PR01MB8426.jpnprd01.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Jan 2023 02:13:13.6659 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 53d82571-da19-47e4-9cb4-625a166a4a2a X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: cRPp7stQVQCpAox1uEk1R0dSvyLD2p13n+ZdBHUt/LGoXWWcIH6d12NmDCLiRlBalARefWk7rkIwKBBW6a/VMrVCO7070BGPrVMLNRl9Y1J5qCu6QNWSmzU/3lwa1jrf X-MS-Exchange-Transport-CrossTenantHeadersStamped: TYCPR01MB11127 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230123_181320_549431_331B7042 X-CRM114-Status: GOOD ( 16.06 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org From: Kuninori Morimoto Current ASoC has many helper function. This patch use it. Signed-off-by: Kuninori Morimoto Reviewed-by: Jerome Brunet --- sound/soc/meson/aiu-fifo-i2s.c | 4 ++-- sound/soc/meson/aiu-fifo-spdif.c | 2 +- sound/soc/meson/aiu-fifo.c | 21 +++++++++--------- sound/soc/meson/axg-tdm-interface.c | 34 +++++++++++++++-------------- sound/soc/meson/axg-tdmin.c | 2 +- sound/soc/meson/axg-tdmout.c | 2 +- sound/soc/meson/meson-codec-glue.c | 8 +++---- 7 files changed, 38 insertions(+), 35 deletions(-) diff --git a/sound/soc/meson/aiu-fifo-i2s.c b/sound/soc/meson/aiu-fifo-i2s.c index 57e6e7160d2f..59e00a74b5f8 100644 --- a/sound/soc/meson/aiu-fifo-i2s.c +++ b/sound/soc/meson/aiu-fifo-i2s.c @@ -88,7 +88,7 @@ static int aiu_fifo_i2s_hw_params(struct snd_pcm_substream *substream, struct snd_soc_dai *dai) { struct snd_soc_component *component = dai->component; - struct aiu_fifo *fifo = dai->playback_dma_data; + struct aiu_fifo *fifo = snd_soc_dai_dma_data_get_playback(dai); unsigned int val; int ret; @@ -158,7 +158,7 @@ int aiu_fifo_i2s_dai_probe(struct snd_soc_dai *dai) if (ret) return ret; - fifo = dai->playback_dma_data; + fifo = snd_soc_dai_dma_data_get_playback(dai); fifo->pcm = &fifo_i2s_pcm; fifo->mem_offset = AIU_MEM_I2S_START; diff --git a/sound/soc/meson/aiu-fifo-spdif.c b/sound/soc/meson/aiu-fifo-spdif.c index 2fb30f89bf7a..ddbd2fc40185 100644 --- a/sound/soc/meson/aiu-fifo-spdif.c +++ b/sound/soc/meson/aiu-fifo-spdif.c @@ -173,7 +173,7 @@ int aiu_fifo_spdif_dai_probe(struct snd_soc_dai *dai) if (ret) return ret; - fifo = dai->playback_dma_data; + fifo = snd_soc_dai_dma_data_get_playback(dai); fifo->pcm = &fifo_spdif_pcm; fifo->mem_offset = AIU_MEM_IEC958_START; diff --git a/sound/soc/meson/aiu-fifo.c b/sound/soc/meson/aiu-fifo.c index d67ff4cdabd5..543d41856c12 100644 --- a/sound/soc/meson/aiu-fifo.c +++ b/sound/soc/meson/aiu-fifo.c @@ -34,7 +34,7 @@ snd_pcm_uframes_t aiu_fifo_pointer(struct snd_soc_component *component, struct snd_pcm_substream *substream) { struct snd_soc_dai *dai = aiu_fifo_dai(substream); - struct aiu_fifo *fifo = dai->playback_dma_data; + struct aiu_fifo *fifo = snd_soc_dai_dma_data_get_playback(dai); struct snd_pcm_runtime *runtime = substream->runtime; unsigned int addr; @@ -46,7 +46,7 @@ snd_pcm_uframes_t aiu_fifo_pointer(struct snd_soc_component *component, static void aiu_fifo_enable(struct snd_soc_dai *dai, bool enable) { struct snd_soc_component *component = dai->component; - struct aiu_fifo *fifo = dai->playback_dma_data; + struct aiu_fifo *fifo = snd_soc_dai_dma_data_get_playback(dai); unsigned int en_mask = (AIU_MEM_CONTROL_FILL_EN | AIU_MEM_CONTROL_EMPTY_EN); @@ -80,7 +80,7 @@ int aiu_fifo_prepare(struct snd_pcm_substream *substream, struct snd_soc_dai *dai) { struct snd_soc_component *component = dai->component; - struct aiu_fifo *fifo = dai->playback_dma_data; + struct aiu_fifo *fifo = snd_soc_dai_dma_data_get_playback(dai); snd_soc_component_update_bits(component, fifo->mem_offset + AIU_MEM_CONTROL, @@ -98,7 +98,7 @@ int aiu_fifo_hw_params(struct snd_pcm_substream *substream, { struct snd_pcm_runtime *runtime = substream->runtime; struct snd_soc_component *component = dai->component; - struct aiu_fifo *fifo = dai->playback_dma_data; + struct aiu_fifo *fifo = snd_soc_dai_dma_data_get_playback(dai); dma_addr_t end; /* Setup the fifo boundaries */ @@ -132,7 +132,7 @@ static irqreturn_t aiu_fifo_isr(int irq, void *dev_id) int aiu_fifo_startup(struct snd_pcm_substream *substream, struct snd_soc_dai *dai) { - struct aiu_fifo *fifo = dai->playback_dma_data; + struct aiu_fifo *fifo = snd_soc_dai_dma_data_get_playback(dai); int ret; snd_soc_set_runtime_hwparams(substream, fifo->pcm); @@ -168,7 +168,7 @@ int aiu_fifo_startup(struct snd_pcm_substream *substream, void aiu_fifo_shutdown(struct snd_pcm_substream *substream, struct snd_soc_dai *dai) { - struct aiu_fifo *fifo = dai->playback_dma_data; + struct aiu_fifo *fifo = snd_soc_dai_dma_data_get_playback(dai); free_irq(fifo->irq, substream); clk_disable_unprepare(fifo->pclk); @@ -178,7 +178,7 @@ int aiu_fifo_pcm_new(struct snd_soc_pcm_runtime *rtd, struct snd_soc_dai *dai) { struct snd_card *card = rtd->card->snd_card; - struct aiu_fifo *fifo = dai->playback_dma_data; + struct aiu_fifo *fifo = snd_soc_dai_dma_data_get_playback(dai); size_t size = fifo->pcm->buffer_bytes_max; int ret; @@ -200,15 +200,16 @@ int aiu_fifo_dai_probe(struct snd_soc_dai *dai) if (!fifo) return -ENOMEM; - dai->playback_dma_data = fifo; + snd_soc_dai_dma_data_set_playback(dai, fifo); return 0; } int aiu_fifo_dai_remove(struct snd_soc_dai *dai) { - kfree(dai->playback_dma_data); + struct aiu_fifo *fifo = snd_soc_dai_dma_data_get_playback(dai); + + kfree(fifo); return 0; } - diff --git a/sound/soc/meson/axg-tdm-interface.c b/sound/soc/meson/axg-tdm-interface.c index c040c83637e0..7624aafe9009 100644 --- a/sound/soc/meson/axg-tdm-interface.c +++ b/sound/soc/meson/axg-tdm-interface.c @@ -37,10 +37,8 @@ int axg_tdm_set_tdm_slots(struct snd_soc_dai *dai, u32 *tx_mask, unsigned int slot_width) { struct axg_tdm_iface *iface = snd_soc_dai_get_drvdata(dai); - struct axg_tdm_stream *tx = (struct axg_tdm_stream *) - dai->playback_dma_data; - struct axg_tdm_stream *rx = (struct axg_tdm_stream *) - dai->capture_dma_data; + struct axg_tdm_stream *tx = snd_soc_dai_dma_data_get_playback(dai); + struct axg_tdm_stream *rx = snd_soc_dai_dma_data_get_capture(dai); unsigned int tx_slots, rx_slots; unsigned int fmt = 0; @@ -362,11 +360,14 @@ static int axg_tdm_iface_prepare(struct snd_pcm_substream *substream, static int axg_tdm_iface_remove_dai(struct snd_soc_dai *dai) { - if (dai->capture_dma_data) - axg_tdm_stream_free(dai->capture_dma_data); + int stream; - if (dai->playback_dma_data) - axg_tdm_stream_free(dai->playback_dma_data); + for_each_pcm_streams(stream) { + struct axg_tdm_stream *ts = snd_soc_dai_dma_data_get(dai, stream); + + if (ts) + axg_tdm_stream_free(ts); + } return 0; } @@ -374,19 +375,20 @@ static int axg_tdm_iface_remove_dai(struct snd_soc_dai *dai) static int axg_tdm_iface_probe_dai(struct snd_soc_dai *dai) { struct axg_tdm_iface *iface = snd_soc_dai_get_drvdata(dai); + int stream; - if (dai->capture_widget) { - dai->capture_dma_data = axg_tdm_stream_alloc(iface); - if (!dai->capture_dma_data) - return -ENOMEM; - } + for_each_pcm_streams(stream) { + struct axg_tdm_stream *ts; + + if (!snd_soc_dai_get_widget(dai, stream)) + continue; - if (dai->playback_widget) { - dai->playback_dma_data = axg_tdm_stream_alloc(iface); - if (!dai->playback_dma_data) { + ts = axg_tdm_stream_alloc(iface); + if (!ts) { axg_tdm_iface_remove_dai(dai); return -ENOMEM; } + snd_soc_dai_dma_data_set(dai, stream, ts); } return 0; diff --git a/sound/soc/meson/axg-tdmin.c b/sound/soc/meson/axg-tdmin.c index 49b613a1faf2..c8f6ea24ae78 100644 --- a/sound/soc/meson/axg-tdmin.c +++ b/sound/soc/meson/axg-tdmin.c @@ -83,7 +83,7 @@ axg_tdmin_get_tdm_stream(struct snd_soc_dapm_widget *w) if (!be) return NULL; - return be->capture_dma_data; + return snd_soc_dai_dma_data_get_capture(be); } static void axg_tdmin_enable(struct regmap *map) diff --git a/sound/soc/meson/axg-tdmout.c b/sound/soc/meson/axg-tdmout.c index 22d519fc07b2..c4039e4f0847 100644 --- a/sound/soc/meson/axg-tdmout.c +++ b/sound/soc/meson/axg-tdmout.c @@ -81,7 +81,7 @@ axg_tdmout_get_tdm_stream(struct snd_soc_dapm_widget *w) if (!be) return NULL; - return be->playback_dma_data; + return snd_soc_dai_dma_data_get_playback(be); } static void axg_tdmout_enable(struct regmap *map) diff --git a/sound/soc/meson/meson-codec-glue.c b/sound/soc/meson/meson-codec-glue.c index 80c5ed196961..5913486c43ab 100644 --- a/sound/soc/meson/meson-codec-glue.c +++ b/sound/soc/meson/meson-codec-glue.c @@ -39,13 +39,13 @@ meson_codec_glue_get_input(struct snd_soc_dapm_widget *w) static void meson_codec_glue_input_set_data(struct snd_soc_dai *dai, struct meson_codec_glue_input *data) { - dai->playback_dma_data = data; + snd_soc_dai_dma_data_set_playback(dai, data); } struct meson_codec_glue_input * meson_codec_glue_input_get_data(struct snd_soc_dai *dai) { - return dai->playback_dma_data; + return snd_soc_dai_dma_data_get_playback(dai); } EXPORT_SYMBOL_GPL(meson_codec_glue_input_get_data); @@ -99,8 +99,8 @@ int meson_codec_glue_output_startup(struct snd_pcm_substream *substream, struct snd_soc_dai *dai) { struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream); - struct meson_codec_glue_input *in_data = - meson_codec_glue_output_get_input_data(dai->capture_widget); + struct snd_soc_dapm_widget *w = snd_soc_dai_get_widget_capture(dai); + struct meson_codec_glue_input *in_data = meson_codec_glue_output_get_input_data(w); if (!in_data) return -ENODEV; From patchwork Tue Jan 24 02:13:37 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuninori Morimoto X-Patchwork-Id: 13113326 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 3B3C6C25B50 for ; Tue, 24 Jan 2023 02:14:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Date:Subject:Cc:References :In-Reply-To:To:From:Message-ID:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=zBWvVec7hcTq2560aD0bf4L0Tet3wkWgz3MdqQA4a6E=; b=qcEUMn5odYC2B9 VgE7UfxX00vDSSl1A7uQzZI0ogkEo7xg4G/4fz9Kib0DnIw9UQHRq7hPAXfToOr/qXY1yIeicU98s beU0oNXKWZsEMHqKZYTJ9gBS72XKN4MEiZTSwZ+ppag4F5JMFBVCKOtryiPd2s/9+NwnuGpd6qcOi QFF8F0q8OqgSmUM+s44atBTWlBOLKpMukrecLRjj7C5dMQYi+nUbXTpN7YfiColyz731vnVI8iFmH 9eLduhJC0oJvqYNj1L2CMcFQJr47e07QNWmvIz6oEVp6ktVQ2R0pAwbgvJUO7eR2EWrV/zhq5G/J1 w8E82HsJTDCNX69n8KuA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pK8om-0025W0-VF; Tue, 24 Jan 2023 02:13:49 +0000 Received: from mail-os0jpn01on2125.outbound.protection.outlook.com ([40.107.113.125] helo=JPN01-OS0-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1pK8oi-0025TZ-4S; Tue, 24 Jan 2023 02:13:45 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ZrIUFrVO6mD+hdINRSwr9pTSOg5mqGM2fNKo6WWAdlVjy7+U3bID8/QGzBywoD2J8vc+SYX6YK6dagOnqg7hpcrqlmmakWzI6/RkbmlCOLXDwExd1xNeYF2yHwqa1dMeI4fpUroyIWoVoxQ9LkmulwkTOvHfqxSVPjvaRBLmVOhwFjzdicokMBRTlT7hb49+9bjb38EO42U7msI3zqveUaz8d6lPJU7EQ48vk3p/TRUYNieDNve7aUjb6iQHxhXfiAnTLvOKzxrBFOa1C42vMHqQi1x2EeXlVuxBORXO2VcIbILb+wETlVRQxyZwxXPXEZE2IUx56d16xEAba5KlFQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=r1lwRWv+Ldc2M5zyJ6cUcgdNTcI7rj6Z3D3wQBfvenE=; b=LQyH6Qj/j64tfQmQUvRBKK8B9Ld4IZNtibo8ZSWNcAj+d9MnACOONaFZFV4sYWvQ7QwoouQ9zw4QrwljRqa/bW5SUO6PlHDnuI0N0xjkjs8dRqfH7yysyuXO42K0cMqT7bebdpyKbDN5pC1vEbCkl/71iQFCwAG9L2WnWyqgvS2YyXDIsvyQ/jO51jilcV9w+1JYAiNU57lP/waZuk5oqyfa0Me//hMYRFF+r67AZ2dPEtubB1fjCmyesiTFDgx5UTaxTFhw03pgMQwu9S1LqX2WKa+I1yWAG0JzByH7UF/TfVjoIgrEJEoTqfIo/l83TZ5b+oO1lU7zgjQRZGsODw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=renesas.com; dmarc=pass action=none header.from=renesas.com; dkim=pass header.d=renesas.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=renesas.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=r1lwRWv+Ldc2M5zyJ6cUcgdNTcI7rj6Z3D3wQBfvenE=; b=K7t3N2BFL2JeXhuGr8N75bMPwEdEAOB3ylgVLmI7ojM9noRCcg5X0OrjlNZHpmWWbcELTVnQGNLWlxNIyUA8X2MgiU8buYWrK8Z1McAhg3uMobchiOSqQT+EvoDYsglvOqH2vKlfXjDamCRuMgKzLkHLOz4B670fbltMIdZraP0= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=renesas.com; Received: from OS3PR01MB8426.jpnprd01.prod.outlook.com (2603:1096:604:194::10) by TYCPR01MB11127.jpnprd01.prod.outlook.com (2603:1096:400:362::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6002.33; Tue, 24 Jan 2023 02:13:37 +0000 Received: from OS3PR01MB8426.jpnprd01.prod.outlook.com ([fe80::3cd7:a7b5:ea86:9ae]) by OS3PR01MB8426.jpnprd01.prod.outlook.com ([fe80::3cd7:a7b5:ea86:9ae%6]) with mapi id 15.20.6002.033; Tue, 24 Jan 2023 02:13:37 +0000 Message-ID: <87bkmou1bi.wl-kuninori.morimoto.gx@renesas.com> From: Kuninori Morimoto To: Mark Brown In-Reply-To: <87y1psu1m1.wl-kuninori.morimoto.gx@renesas.com> References: <87y1psu1m1.wl-kuninori.morimoto.gx@renesas.com> Cc: Nicolas Frattaroli , Heiko Stuebner , linux-rockchip@lists.infradead.org, linux-arm-kernel@lists.infradead.org, Linux-ALSA Subject: [PATCH v2 16/25] ASoC: rockchip: use helper function User-Agent: Wanderlust/2.15.9 Emacs/26.3 Mule/6.0 Date: Tue, 24 Jan 2023 02:13:37 +0000 X-ClientProxiedBy: TYCPR01CA0127.jpnprd01.prod.outlook.com (2603:1096:400:26d::12) To OS3PR01MB8426.jpnprd01.prod.outlook.com (2603:1096:604:194::10) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: OS3PR01MB8426:EE_|TYCPR01MB11127:EE_ X-MS-Office365-Filtering-Correlation-Id: 727b9ad6-284b-4bb9-8038-08dafdb09a8c X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: zmod0TEBz4AOauoVHkocOzCq3pJaEewAUkQAWtg7IjbJAvQ9FJWCIbgdwHC/pdmJbUxjfVAL1PAmoutEul8yoEANeQxeVT3pPhzNxIIp8OArE8Eildd4VWQsGFvhvKhtkLzv/J1PYzhFHs+9SBdTr+jzf3SONf9F5JQcg4SfMvcgAsEvbwV0k89dgYrQO5P0LNvxfa0gs5lnFEnbLsVL6NyW06W4CuVX05htiqeZjfy50Xj9AZLUbn6OUVdoQr/8v6I+mKkVFzt+i2yLA4JR/DaloUQ0Xrz0ETRReqrYgF0IpWSdY9PGmUQ6LT9Uyp8e6rRPErFDEKSlJzWOhnRrDb+ULLDoseFHFl9/Vy5DmyTJf3G53Zo1gigfuetZ/PNrlW2e47/WFqhCdZ21Jxiukri8aZHtxSUD01iRbnC/XhxNI1EMv2e1G4zJOqlpULy04ypmTIJHMKKJtJxoGcO1cFUJa2NlIE25IUX5WKAgwSqkYFr3sAna9HF6kPbvx+2orjbut+497gjoHpTjGOX7LiNL862u0PLnKAn5BaqiZDfWr2wjqDrqDLWju+wOfSkUwkHiqkwt/YeVXggfA3cDFPDQL4z4jOUODzh64WwiX0EUMGIvbVv5EVTPiSCUC+r/s/JTKE2Ycm5n6Edn3NuglC/pAqEVDmvzeAuGIGjhx4owVkIlBi2T1f1UVzXSPC4pyHvZgvvUFhB5+p9JvoLklw== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:OS3PR01MB8426.jpnprd01.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230022)(4636009)(346002)(376002)(39860400002)(136003)(396003)(366004)(451199015)(8676002)(54906003)(316002)(86362001)(2906002)(36756003)(4326008)(5660300002)(66476007)(66946007)(66556008)(6916009)(41300700001)(478600001)(6506007)(83380400001)(6486002)(8936002)(38350700002)(52116002)(6512007)(38100700002)(2616005)(186003)(26005);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 09sZIv/nH9klEkQAyIFctc8Ed3UuQ2ZWaFU8YEFsvJpUjCJ5f4EwAJM5eHm/ONscF1G5G3W06EhFW3pe3TiWjCzyJvEsBuHvfJP1qjY2dtctZq0xgsQB9JRe9M/DdHDy5Bb8EVrj9k1FJ652Irnh35P6XxCNfH8S4Kr9KpYP70MUnpY76DU4lwFun7NJ0FxHtMgFV+w7NZC4i82mtPfgHAUFJXLmArLpaTkedoAzBaHK1I+qUfXdGUB9hdAf0SAz6ywJeiGmatZlZ+giP8fS40otgeBuTovHj0jz51pw3bgGqXEKZU1WB22DpaPgi0FfM7QwF4yObOx1/wO7Y9pBLMYzd7PbWrtjzgqTzv6rlCCdNCZK7+8fxzksWTBgxHOTu1mEj/ENBV9W1sNlJsuaNoY5i76II5wQ7YLFzMEp1EWNx3cTEqv7cghmEEgAY58OLr+AEbfzon0Rpnc7hswaPkJRT/iDykpCCkss1JQ/Tfc4c4968y9iPG9z5/toLyniea3rkdwZ68Sphwo0HImRvsPi0KJEfJnIeRK3qBaShQDhJ9nVCcRG7abGNISwGhaOjU4jKzQvSiJzwC0AwQv0rL/v9+u7JerJ85n3LjRSO4AJBF3VpCxu/ph91jEnDo8mht46DXR9HTcV4eqsxeOeEspNBgKXtBYDAC2BFbzQPNhNGhvZQKOKTIvA5M3XUkhHp4w3UU4624ga3e1D4wyjqaoWC1sMwZSQ1Xfd+m8WJD+vj0GZJrltUKaTMLJSQ6c7PdvbM6nsFxj7wK0UVI9ZacBs+O6RnwTo+tdSK1OrBBKEMdTkFXcHzl7tawa/u6LR9YaZdOtLGt4+7kTF/VzitRelu+FsHiA9bjLP7vmowU9ss/a+9YglFWzccFyS4rTEJP1IMjDZsNs/WPB859RwI5/OQGzlCdbpMHdPCMOa4X7SM7WvJqD8/lIAsmYyMR8f0/a97oKzL9r9ixqQ0JBDz19YLES0n6JTqWFmxGX3owgB868q8i2vGJEsAVBnMiq6G2kVEeg3+w54Dx5X8F+TYuyEzA/VZuatUUch9cjda/LCB4Fhtl6EeauZVCKUn34XEMs8KdLn4m5QOevp2vu7IxlV2xrhr5f+O+1WoBa8Bky+TKCxBfSibSw43xXpH14v6K9YdjddW0mXQo7MITb45dwGQiY+36pRjKHSXZE28fO4+Q5cXqUU+iR7VAJa/IUrOF8KSb4/UiqfqG2fRDu33ZtH7sS65LXqj4FlpjoPC7XUvAILD4cc72WU4+bOlzqVsfglGteTgj4dKPiUU9/miXqLM1SwhLxjS0gQV0mBe68AimWgquJfDncrcPbFN8v7IzLalp5ihJxf8ty/74NuTJy801v3+7MiHy8VFNnntRIeF/JwFUqFvynHA8t5fVfWS84JWp/TIIGn0/XLE6BK8IP2fFseyzQLufeZkhE19RU/8Frvp4uW499SepIdI8KpGv1gSNmTU5eodxlKc38ebSHx7Rh6Kl0dqbZiV7Q4dFN93S1h8Vb0BGsasbA+hhkg1/J2QkswGOXHqqaGvvh6MMMkgdZxUutkWRSC/rlSG1UkaAwsF8V5RZDpme+Y2ZwxxEFVoZ2h1kO4oBKw6h6QyLjnEJJSz8q2gl+F2iFznt4= X-OriginatorOrg: renesas.com X-MS-Exchange-CrossTenant-Network-Message-Id: 727b9ad6-284b-4bb9-8038-08dafdb09a8c X-MS-Exchange-CrossTenant-AuthSource: OS3PR01MB8426.jpnprd01.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Jan 2023 02:13:37.6879 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 53d82571-da19-47e4-9cb4-625a166a4a2a X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: kwH3tRnUY7T1D8yYp6PVNGrL0tgd0PojzLb3A4BrgCkcJr1IZnsOp0lhYvvIueU1pkiQHWLytDgVYFf+c1a3ik4AA9iYdf7Wpo6qbvp5R20lXUY9K4M2THqLp/1h56X1 X-MS-Exchange-Transport-CrossTenantHeadersStamped: TYCPR01MB11127 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230123_181344_421295_72E0A805 X-CRM114-Status: GOOD ( 10.72 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org From: Kuninori Morimoto Current ASoC has many helper function. This patch use it. Signed-off-by: Kuninori Morimoto --- sound/soc/rockchip/rockchip_i2s_tdm.c | 4 ++-- sound/soc/rockchip/rockchip_pdm.c | 2 +- sound/soc/rockchip/rockchip_spdif.c | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/sound/soc/rockchip/rockchip_i2s_tdm.c b/sound/soc/rockchip/rockchip_i2s_tdm.c index 08b90ec5cc80..166257c6ae14 100644 --- a/sound/soc/rockchip/rockchip_i2s_tdm.c +++ b/sound/soc/rockchip/rockchip_i2s_tdm.c @@ -1070,9 +1070,9 @@ static int rockchip_i2s_tdm_dai_probe(struct snd_soc_dai *dai) struct rk_i2s_tdm_dev *i2s_tdm = snd_soc_dai_get_drvdata(dai); if (i2s_tdm->has_capture) - dai->capture_dma_data = &i2s_tdm->capture_dma_data; + snd_soc_dai_dma_data_set_capture(dai, &i2s_tdm->capture_dma_data); if (i2s_tdm->has_playback) - dai->playback_dma_data = &i2s_tdm->playback_dma_data; + snd_soc_dai_dma_data_set_playback(dai, &i2s_tdm->playback_dma_data); if (i2s_tdm->mclk_calibrate) snd_soc_add_dai_controls(dai, &rockchip_i2s_tdm_compensation_control, 1); diff --git a/sound/soc/rockchip/rockchip_pdm.c b/sound/soc/rockchip/rockchip_pdm.c index 5b1e47bdc376..6ce92b1db790 100644 --- a/sound/soc/rockchip/rockchip_pdm.c +++ b/sound/soc/rockchip/rockchip_pdm.c @@ -373,7 +373,7 @@ static int rockchip_pdm_dai_probe(struct snd_soc_dai *dai) { struct rk_pdm_dev *pdm = to_info(dai); - dai->capture_dma_data = &pdm->capture_dma_data; + snd_soc_dai_dma_data_set_capture(dai, &pdm->capture_dma_data); return 0; } diff --git a/sound/soc/rockchip/rockchip_spdif.c b/sound/soc/rockchip/rockchip_spdif.c index 5b4f00457587..2d937fcf357d 100644 --- a/sound/soc/rockchip/rockchip_spdif.c +++ b/sound/soc/rockchip/rockchip_spdif.c @@ -196,7 +196,7 @@ static int rk_spdif_dai_probe(struct snd_soc_dai *dai) { struct rk_spdif_dev *spdif = snd_soc_dai_get_drvdata(dai); - dai->playback_dma_data = &spdif->playback_dma_data; + snd_soc_dai_dma_data_set_playback(dai, &spdif->playback_dma_data); return 0; }