From patchwork Wed Apr 22 04:48:06 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuninori Morimoto X-Patchwork-Id: 11502897 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id D215214DD for ; Wed, 22 Apr 2020 04:48:15 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id AEE7D20747 for ; Wed, 22 Apr 2020 04:48:15 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="hl8ZTWRU" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org AEE7D20747 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=renesas.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:To: Subject:From:Message-ID:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=el0PDqvM+NqeEFRjyA7KV3jlBhD7SLgyyNCnunivGzA=; b=hl8ZTWRUBQAlLq CGB6jAk6W05cyjiaChlxk0eR/xLOrgMJu+dJkk77YDBc6I5D1ZQ2a+mHJJJl9jY+UdlUAUpjnglcl /xj7L7tImTmZwzWn5DeaYlbpIf0VT9/PH4tAiAO1hg+MvkNjY7ntsNWpPbotnA/OASrY1igJC8Xze OK3tlvrqMs4jsgM5rOeoei2v7eLfLYwzM/k/OYVb9cbglF6ppKFkQxhDQNigasCDKSE9jwyQ/M1xe uTlQhzrxVnEn/bGJw2CtTT/Xp4qZP884KyHgXz1WX6jQE+9AcLknh9l3qv9s53Mn7YqxBwK3n17k5 1tfEfnG0uMEyM1wiWdgA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jR7Ix-0006YO-LW; Wed, 22 Apr 2020 04:48:11 +0000 Received: from relmlor2.renesas.com ([210.160.252.172] helo=relmlie6.idc.renesas.com) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jR7Iu-0006Xl-2v; Wed, 22 Apr 2020 04:48:10 +0000 Date: 22 Apr 2020 13:48:06 +0900 X-IronPort-AV: E=Sophos;i="5.72,412,1580742000"; d="scan'208";a="45169016" Received: from unknown (HELO relmlir6.idc.renesas.com) ([10.200.68.152]) by relmlie6.idc.renesas.com with ESMTP; 22 Apr 2020 13:48:06 +0900 Received: from mercury.renesas.com (unknown [10.166.252.133]) by relmlir6.idc.renesas.com (Postfix) with ESMTP id F3EEA41C1DAA; Wed, 22 Apr 2020 13:48:05 +0900 (JST) Message-ID: <87blnkunw9.wl-kuninori.morimoto.gx@renesas.com> From: Kuninori Morimoto Subject: [PATCH 1/4] ASoC: mediatek: don't use snd_soc_rtdcom_lookup() User-Agent: Wanderlust/2.15.9 Emacs/25.2 Mule/6.0 To: Mark Brown In-Reply-To: <87d080unyx.wl-kuninori.morimoto.gx@renesas.com> References: <87d080unyx.wl-kuninori.morimoto.gx@renesas.com> MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200421_214808_478806_4693D042 X-CRM114-Status: GOOD ( 11.75 ) X-Spam-Score: 0.0 (/) X-Spam-Report: SpamAssassin version 3.4.4 on bombadil.infradead.org summary: Content analysis details: (0.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [210.160.252.172 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kate Stewart , Cezary Rojewski , Jie Yang , alsa-devel@alsa-project.org, Jaroslav Kysela , Liam Girdwood , Richard Fontana , Shunli Wang , YueHaibing , Pierre-Louis Bossart , Jiaxin Yu , linux-arm-kernel@lists.infradead.org, Vijendar Mukunda , Stephen Boyd , linux-mediatek@lists.infradead.org, Eason Yen , Matthias Brugger , Thomas Gleixner , Allison Randal , Takashi Iwai , Ravulapati Vishnu vardhan rao , Colin Ian King Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org From: Kuninori Morimoto We shouldn't use snd_soc_rtdcom_lookup() as much as possible. It works today, but, will not work in the future if we support multi CPU/Codec/Platform, because 1 rtd might have multiple same driver named component. mediatek drivers are using snd_soc_rtdcom_lookup() at afe->memif_fs and/or afe->irq_fs to get component. But, caller knows it via dai->component. We don't need to use snd_soc_rtdcom_lookup(). This patch fixup it. Signed-off-by: Kuninori Morimoto --- sound/soc/mediatek/common/mtk-afe-fe-dai.c | 12 +++++------- sound/soc/mediatek/common/mtk-afe-fe-dai.h | 3 ++- sound/soc/mediatek/common/mtk-base-afe.h | 6 ++++-- sound/soc/mediatek/mt2701/mt2701-afe-pcm.c | 6 ++++-- sound/soc/mediatek/mt6797/mt6797-afe-pcm.c | 11 ++++------- sound/soc/mediatek/mt8173/mt8173-afe-pcm.c | 7 ++++--- sound/soc/mediatek/mt8183/mt8183-afe-pcm.c | 11 ++++------- 7 files changed, 27 insertions(+), 29 deletions(-) diff --git a/sound/soc/mediatek/common/mtk-afe-fe-dai.c b/sound/soc/mediatek/common/mtk-afe-fe-dai.c index 375e3b492922..8ee7206aa63d 100644 --- a/sound/soc/mediatek/common/mtk-afe-fe-dai.c +++ b/sound/soc/mediatek/common/mtk-afe-fe-dai.c @@ -162,7 +162,7 @@ int mtk_afe_fe_hw_params(struct snd_pcm_substream *substream, } /* set rate */ - ret = mtk_memif_set_rate_substream(substream, id, rate); + ret = mtk_memif_set_rate_substream(dai->component, substream, id, rate); if (ret) { dev_err(afe->dev, "%s(), error, id %d, set rate %d, ret %d\n", __func__, id, rate, ret); @@ -225,7 +225,7 @@ int mtk_afe_fe_trigger(struct snd_pcm_substream *substream, int cmd, irq_data->irq_cnt_shift); /* set irq fs */ - fs = afe->irq_fs(substream, runtime->rate); + fs = afe->irq_fs(dai->component, substream, runtime->rate); if (fs < 0) return -EINVAL; @@ -502,12 +502,10 @@ int mtk_memif_set_rate(struct mtk_base_afe *afe, } EXPORT_SYMBOL_GPL(mtk_memif_set_rate); -int mtk_memif_set_rate_substream(struct snd_pcm_substream *substream, +int mtk_memif_set_rate_substream(struct snd_soc_component *component, + struct snd_pcm_substream *substream, int id, unsigned int rate) { - struct snd_soc_pcm_runtime *rtd = substream->private_data; - struct snd_soc_component *component = - snd_soc_rtdcom_lookup(rtd, AFE_PCM_NAME); struct mtk_base_afe *afe = snd_soc_component_get_drvdata(component); int fs = 0; @@ -518,7 +516,7 @@ int mtk_memif_set_rate_substream(struct snd_pcm_substream *substream, return -EINVAL; } - fs = afe->memif_fs(substream, rate); + fs = afe->memif_fs(component, substream, rate); if (fs < 0) return -EINVAL; diff --git a/sound/soc/mediatek/common/mtk-afe-fe-dai.h b/sound/soc/mediatek/common/mtk-afe-fe-dai.h index 8cec90671827..d8fab806dbd0 100644 --- a/sound/soc/mediatek/common/mtk-afe-fe-dai.h +++ b/sound/soc/mediatek/common/mtk-afe-fe-dai.h @@ -44,7 +44,8 @@ int mtk_memif_set_channel(struct mtk_base_afe *afe, int id, unsigned int channel); int mtk_memif_set_rate(struct mtk_base_afe *afe, int id, unsigned int rate); -int mtk_memif_set_rate_substream(struct snd_pcm_substream *substream, +int mtk_memif_set_rate_substream(struct snd_soc_component *component, + struct snd_pcm_substream *substream, int id, unsigned int rate); int mtk_memif_set_format(struct mtk_base_afe *afe, int id, snd_pcm_format_t format); diff --git a/sound/soc/mediatek/common/mtk-base-afe.h b/sound/soc/mediatek/common/mtk-base-afe.h index a8cf44d98244..c5e3c680332d 100644 --- a/sound/soc/mediatek/common/mtk-base-afe.h +++ b/sound/soc/mediatek/common/mtk-base-afe.h @@ -97,9 +97,11 @@ struct mtk_base_afe { unsigned int num_dai_drivers; const struct snd_pcm_hardware *mtk_afe_hardware; - int (*memif_fs)(struct snd_pcm_substream *substream, + int (*memif_fs)(struct snd_soc_component *component, + struct snd_pcm_substream *substream, unsigned int rate); - int (*irq_fs)(struct snd_pcm_substream *substream, + int (*irq_fs)(struct snd_soc_component *component, + struct snd_pcm_substream *substream, unsigned int rate); int (*get_dai_fs)(struct mtk_base_afe *afe, int dai_id, unsigned int rate); diff --git a/sound/soc/mediatek/mt2701/mt2701-afe-pcm.c b/sound/soc/mediatek/mt2701/mt2701-afe-pcm.c index f0250b0dd734..456f3a0b98f9 100644 --- a/sound/soc/mediatek/mt2701/mt2701-afe-pcm.c +++ b/sound/soc/mediatek/mt2701/mt2701-afe-pcm.c @@ -491,7 +491,8 @@ static int mt2701_dlm_fe_trigger(struct snd_pcm_substream *substream, } } -static int mt2701_memif_fs(struct snd_pcm_substream *substream, +static int mt2701_memif_fs(struct snd_soc_component *component, + struct snd_pcm_substream *substream, unsigned int rate) { struct snd_soc_pcm_runtime *rtd = substream->private_data; @@ -505,7 +506,8 @@ static int mt2701_memif_fs(struct snd_pcm_substream *substream, return fs; } -static int mt2701_irq_fs(struct snd_pcm_substream *substream, unsigned int rate) +static int mt2701_irq_fs(struct snd_soc_component *component, + struct snd_pcm_substream *substream, unsigned int rate) { return mt2701_afe_i2s_fs(rate); } diff --git a/sound/soc/mediatek/mt6797/mt6797-afe-pcm.c b/sound/soc/mediatek/mt6797/mt6797-afe-pcm.c index 7f930556d961..7a0bbaaad677 100644 --- a/sound/soc/mediatek/mt6797/mt6797-afe-pcm.c +++ b/sound/soc/mediatek/mt6797/mt6797-afe-pcm.c @@ -136,23 +136,20 @@ static const struct snd_pcm_hardware mt6797_afe_hardware = { .fifo_size = 0, }; -static int mt6797_memif_fs(struct snd_pcm_substream *substream, +static int mt6797_memif_fs(struct snd_soc_component *component, + struct snd_pcm_substream *substream, unsigned int rate) { struct snd_soc_pcm_runtime *rtd = substream->private_data; - struct snd_soc_component *component = - snd_soc_rtdcom_lookup(rtd, AFE_PCM_NAME); struct mtk_base_afe *afe = snd_soc_component_get_drvdata(component); int id = asoc_rtd_to_cpu(rtd, 0)->id; return mt6797_rate_transform(afe->dev, rate, id); } -static int mt6797_irq_fs(struct snd_pcm_substream *substream, unsigned int rate) +static int mt6797_irq_fs(struct snd_soc_component *component, + struct snd_pcm_substream *substream, unsigned int rate) { - struct snd_soc_pcm_runtime *rtd = substream->private_data; - struct snd_soc_component *component = - snd_soc_rtdcom_lookup(rtd, AFE_PCM_NAME); struct mtk_base_afe *afe = snd_soc_component_get_drvdata(component); return mt6797_general_rate_transform(afe->dev, rate); diff --git a/sound/soc/mediatek/mt8173/mt8173-afe-pcm.c b/sound/soc/mediatek/mt8173/mt8173-afe-pcm.c index 1e3f2d786066..6262e2c69107 100644 --- a/sound/soc/mediatek/mt8173/mt8173-afe-pcm.c +++ b/sound/soc/mediatek/mt8173/mt8173-afe-pcm.c @@ -479,11 +479,11 @@ static int mt8173_afe_hdmi_trigger(struct snd_pcm_substream *substream, int cmd, } } -static int mt8173_memif_fs(struct snd_pcm_substream *substream, +static int mt8173_memif_fs(struct snd_soc_component *component, + struct snd_pcm_substream *substream, unsigned int rate) { struct snd_soc_pcm_runtime *rtd = substream->private_data; - struct snd_soc_component *component = snd_soc_rtdcom_lookup(rtd, AFE_PCM_NAME); struct mtk_base_afe *afe = snd_soc_component_get_drvdata(component); struct mtk_base_afe_memif *memif = &afe->memif[asoc_rtd_to_cpu(rtd, 0)->id]; int fs; @@ -509,7 +509,8 @@ static int mt8173_memif_fs(struct snd_pcm_substream *substream, return fs; } -static int mt8173_irq_fs(struct snd_pcm_substream *substream, unsigned int rate) +static int mt8173_irq_fs(struct snd_soc_component *component, + struct snd_pcm_substream *substream, unsigned int rate) { return mt8173_afe_i2s_fs(rate); } diff --git a/sound/soc/mediatek/mt8183/mt8183-afe-pcm.c b/sound/soc/mediatek/mt8183/mt8183-afe-pcm.c index c8ded53bde1d..5071f38fba29 100644 --- a/sound/soc/mediatek/mt8183/mt8183-afe-pcm.c +++ b/sound/soc/mediatek/mt8183/mt8183-afe-pcm.c @@ -139,23 +139,20 @@ static const struct snd_pcm_hardware mt8183_afe_hardware = { .fifo_size = 0, }; -static int mt8183_memif_fs(struct snd_pcm_substream *substream, +static int mt8183_memif_fs(struct snd_soc_component *component, + struct snd_pcm_substream *substream, unsigned int rate) { struct snd_soc_pcm_runtime *rtd = substream->private_data; - struct snd_soc_component *component = - snd_soc_rtdcom_lookup(rtd, AFE_PCM_NAME); struct mtk_base_afe *afe = snd_soc_component_get_drvdata(component); int id = asoc_rtd_to_cpu(rtd, 0)->id; return mt8183_rate_transform(afe->dev, rate, id); } -static int mt8183_irq_fs(struct snd_pcm_substream *substream, unsigned int rate) +static int mt8183_irq_fs(struct snd_soc_component *component, + struct snd_pcm_substream *substream, unsigned int rate) { - struct snd_soc_pcm_runtime *rtd = substream->private_data; - struct snd_soc_component *component = - snd_soc_rtdcom_lookup(rtd, AFE_PCM_NAME); struct mtk_base_afe *afe = snd_soc_component_get_drvdata(component); return mt8183_general_rate_transform(afe->dev, rate); From patchwork Wed Apr 22 04:48:12 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuninori Morimoto X-Patchwork-Id: 11502901 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 58F10913 for ; Wed, 22 Apr 2020 04:48:36 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 1022A2072D for ; Wed, 22 Apr 2020 04:48:36 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="hnoDPZM9" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 1022A2072D Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=renesas.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:To: Subject:From:Message-ID:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=kfnJCdgToohKeLaIfLyi77iOQTgyMSmwhWb5QAof0ZU=; b=hnoDPZM9sH+2+h VPopYRwU3AD3935I/6+c878On1MEqMFAB8mbOftU3qC69GWCJKCuZa2bPP29pSfBr2wXUYQPnl+ee U+DAD9st06SzRfqpEmR4eF9t6wYwujuv++y+U4o2YkMfzTLFIHmq+mciNadgENqaVTMSXXPp3V5yH 6p/GnMODlqDVP+EQL29MjV2VQ6PqC9gY5mudjYt+KxsRnCERJ70Z4RNQMWqxvlF1xcJy7Dnpjenbf WVMXJfIfTq93D03min6u/g/baxgS55ZdxFOhvOqaEtil0qxfPDbXCUSx0jNtkZvqrBRdkLzQCQTlH MKV1Bff7rToZrGUfoviA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jR7JE-0006nQ-Qr; Wed, 22 Apr 2020 04:48:28 +0000 Received: from relmlor2.renesas.com ([210.160.252.172] helo=relmlie6.idc.renesas.com) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jR7Iy-0006Xl-K6; Wed, 22 Apr 2020 04:48:14 +0000 Date: 22 Apr 2020 13:48:12 +0900 X-IronPort-AV: E=Sophos;i="5.72,412,1580742000"; d="scan'208";a="45169025" Received: from unknown (HELO relmlir6.idc.renesas.com) ([10.200.68.152]) by relmlie6.idc.renesas.com with ESMTP; 22 Apr 2020 13:48:12 +0900 Received: from mercury.renesas.com (unknown [10.166.252.133]) by relmlir6.idc.renesas.com (Postfix) with ESMTP id ECC9E41C1D93; Wed, 22 Apr 2020 13:48:11 +0900 (JST) Message-ID: <87a734unw4.wl-kuninori.morimoto.gx@renesas.com> From: Kuninori Morimoto Subject: [PATCH 2/4] ASoC: intel: baytrail: don't use snd_soc_rtdcom_lookup() User-Agent: Wanderlust/2.15.9 Emacs/25.2 Mule/6.0 To: Mark Brown In-Reply-To: <87d080unyx.wl-kuninori.morimoto.gx@renesas.com> References: <87d080unyx.wl-kuninori.morimoto.gx@renesas.com> MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200421_214812_897756_138E3019 X-CRM114-Status: UNSURE ( 9.87 ) X-CRM114-Notice: Please train this message. X-Spam-Score: 0.0 (/) X-Spam-Report: SpamAssassin version 3.4.4 on bombadil.infradead.org summary: Content analysis details: (0.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [210.160.252.172 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kate Stewart , Cezary Rojewski , Jie Yang , alsa-devel@alsa-project.org, Jaroslav Kysela , Liam Girdwood , Richard Fontana , Shunli Wang , YueHaibing , Pierre-Louis Bossart , Jiaxin Yu , linux-arm-kernel@lists.infradead.org, Vijendar Mukunda , Stephen Boyd , linux-mediatek@lists.infradead.org, Eason Yen , Matthias Brugger , Thomas Gleixner , Allison Randal , Takashi Iwai , Ravulapati Vishnu vardhan rao , Colin Ian King Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org From: Kuninori Morimoto We shouldn't use snd_soc_rtdcom_lookup() as much as possible. It works today, but, will not work in the future if we support multi CPU/Codec/Platform, because 1 rtd might have multiple same driver named component. intel baytrail driver is using it, but we can avoid it easily by having component pointer at sst_byt_pcm_data. This patch removes snd_soc_rtdcom_lookup() from this driver. Signed-off-by: Kuninori Morimoto --- sound/soc/intel/baytrail/sst-baytrail-pcm.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/sound/soc/intel/baytrail/sst-baytrail-pcm.c b/sound/soc/intel/baytrail/sst-baytrail-pcm.c index 53383055c8dc..dbd830375bc4 100644 --- a/sound/soc/intel/baytrail/sst-baytrail-pcm.c +++ b/sound/soc/intel/baytrail/sst-baytrail-pcm.c @@ -36,6 +36,7 @@ static const struct snd_pcm_hardware sst_byt_pcm_hardware = { /* private data for each PCM DSP stream */ struct sst_byt_pcm_data { struct sst_byt_stream *stream; + struct snd_soc_component *component; struct snd_pcm_substream *substream; struct mutex mutex; @@ -119,12 +120,11 @@ static int sst_byt_pcm_hw_params(struct snd_soc_component *component, return 0; } -static int sst_byt_pcm_restore_stream_context(struct snd_pcm_substream *substream) +static int sst_byt_pcm_restore_stream_context(struct sst_byt_pcm_data *pcm_data) { - struct snd_soc_pcm_runtime *rtd = substream->private_data; - struct snd_soc_component *component = snd_soc_rtdcom_lookup(rtd, DRV_NAME); + struct snd_soc_pcm_runtime *rtd = pcm_data->substream->private_data; + struct snd_soc_component *component = pcm_data->component; struct sst_byt_priv_data *pdata = snd_soc_component_get_drvdata(component); - struct sst_byt_pcm_data *pcm_data = &pdata->pcm[substream->stream]; struct sst_byt *byt = pdata->byt; int ret; @@ -149,7 +149,7 @@ static void sst_byt_pcm_work(struct work_struct *work) container_of(work, struct sst_byt_pcm_data, work); if (snd_pcm_running(pcm_data->substream)) - sst_byt_pcm_restore_stream_context(pcm_data->substream); + sst_byt_pcm_restore_stream_context(pcm_data); } static int sst_byt_pcm_trigger(struct snd_soc_component *component, @@ -198,7 +198,7 @@ static u32 byt_notify_pointer(struct sst_byt_stream *stream, void *data) struct snd_pcm_substream *substream = pcm_data->substream; struct snd_pcm_runtime *runtime = substream->runtime; struct snd_soc_pcm_runtime *rtd = substream->private_data; - struct snd_soc_component *component = snd_soc_rtdcom_lookup(rtd, DRV_NAME); + struct snd_soc_component *component = pcm_data->component; struct sst_byt_priv_data *pdata = snd_soc_component_get_drvdata(component); struct sst_byt *byt = pdata->byt; u32 pos, hw_pos; @@ -242,6 +242,7 @@ static int sst_byt_pcm_open(struct snd_soc_component *component, mutex_lock(&pcm_data->mutex); pcm_data->substream = substream; + pcm_data->component = component; snd_soc_set_runtime_hwparams(substream, &sst_byt_pcm_hardware); From patchwork Wed Apr 22 04:48:16 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuninori Morimoto X-Patchwork-Id: 11502905 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 8B3BA913 for ; Wed, 22 Apr 2020 04:48:52 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 689A620747 for ; Wed, 22 Apr 2020 04:48:52 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="FjQ7+R04" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 689A620747 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=renesas.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:To: Subject:From:Message-ID:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=nx48UsQeEJ4TtRs1bmruG5oA/puRy8wbNflcR1lVCu4=; b=FjQ7+R04e6JWru 7L4P/ACoOW4usR/dTUKQ0Q2YW/eqjLbVwg4aL+EfvXftn0xTJSKJAnsWKq0bLI8JhlU8LkwUEAf8/ Ph9tdafMiyxiCpgY/vUeyubgtq8oY9YClMo+cxaKevcOTkJR7ZuDJFlRJ2SwDZG20/Vum15YAibL+ YKIVmWC58/fXFHJC7kO7MizIZ8wYtwurU9YSr35AxKsfiHvJONfp38bnrMOp0NHUJrpSKNk10vbV9 y7LK558fW9cIwtgSfh/ZSdbZ4NToNGkmWzWot+uLnaGIPfsShrw5eA8NtIDsIbgH4TAvw741fb4fy zhq4TQQmbHRMW+rz2d9w==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jR7JX-00072Q-Fh; Wed, 22 Apr 2020 04:48:47 +0000 Received: from relmlor1.renesas.com ([210.160.252.171] helo=relmlie5.idc.renesas.com) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jR7J3-0006ep-MD; Wed, 22 Apr 2020 04:48:20 +0000 Date: 22 Apr 2020 13:48:16 +0900 X-IronPort-AV: E=Sophos;i="5.72,412,1580742000"; d="scan'208";a="45382387" Received: from unknown (HELO relmlir6.idc.renesas.com) ([10.200.68.152]) by relmlie5.idc.renesas.com with ESMTP; 22 Apr 2020 13:48:16 +0900 Received: from mercury.renesas.com (unknown [10.166.252.133]) by relmlir6.idc.renesas.com (Postfix) with ESMTP id 78D7841C00DA; Wed, 22 Apr 2020 13:48:16 +0900 (JST) Message-ID: <878siounvz.wl-kuninori.morimoto.gx@renesas.com> From: Kuninori Morimoto Subject: [PATCH 3/4] ASoC: intel: haswell: don't use snd_soc_rtdcom_lookup() User-Agent: Wanderlust/2.15.9 Emacs/25.2 Mule/6.0 To: Mark Brown In-Reply-To: <87d080unyx.wl-kuninori.morimoto.gx@renesas.com> References: <87d080unyx.wl-kuninori.morimoto.gx@renesas.com> MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200421_214817_848050_899F25EA X-CRM114-Status: UNSURE ( 9.11 ) X-CRM114-Notice: Please train this message. X-Spam-Score: 0.0 (/) X-Spam-Report: SpamAssassin version 3.4.4 on bombadil.infradead.org summary: Content analysis details: (0.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [210.160.252.171 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kate Stewart , Cezary Rojewski , Jie Yang , alsa-devel@alsa-project.org, Jaroslav Kysela , Liam Girdwood , Richard Fontana , Shunli Wang , YueHaibing , Pierre-Louis Bossart , Jiaxin Yu , linux-arm-kernel@lists.infradead.org, Vijendar Mukunda , Stephen Boyd , linux-mediatek@lists.infradead.org, Eason Yen , Matthias Brugger , Thomas Gleixner , Allison Randal , Takashi Iwai , Ravulapati Vishnu vardhan rao , Colin Ian King Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org From: Kuninori Morimoto We shouldn't use snd_soc_rtdcom_lookup() as much as possible. It works today, but, will not work in the future if we support multi CPU/Codec/Platform, because 1 rtd might have multiple same driver named component. intel haswell driver is using it, but we can avoid it easily by having component pointer at hsw_pcm_data. This patch removes snd_soc_rtdcom_lookup() from this driver. Signed-off-by: Kuninori Morimoto --- sound/soc/intel/haswell/sst-haswell-pcm.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sound/soc/intel/haswell/sst-haswell-pcm.c b/sound/soc/intel/haswell/sst-haswell-pcm.c index c183f8e94ee4..15e94dae45de 100644 --- a/sound/soc/intel/haswell/sst-haswell-pcm.c +++ b/sound/soc/intel/haswell/sst-haswell-pcm.c @@ -108,6 +108,7 @@ struct hsw_pcm_data { struct snd_pcm *hsw_pcm; u32 volume[2]; struct snd_pcm_substream *substream; + struct snd_soc_component *component; struct snd_compr_stream *cstream; unsigned int wpos; struct mutex mutex; @@ -696,7 +697,7 @@ static u32 hsw_notify_pointer(struct sst_hsw_stream *stream, void *data) struct snd_pcm_substream *substream = pcm_data->substream; struct snd_pcm_runtime *runtime = substream->runtime; struct snd_soc_pcm_runtime *rtd = substream->private_data; - struct snd_soc_component *component = snd_soc_rtdcom_lookup(rtd, DRV_NAME); + struct snd_soc_component *component = pcm_data->component; struct hsw_priv_data *pdata = snd_soc_component_get_drvdata(component); struct sst_hsw *hsw = pdata->hsw; u32 pos; @@ -798,6 +799,7 @@ static int hsw_pcm_open(struct snd_soc_component *component, pm_runtime_get_sync(pdata->dev); pcm_data->substream = substream; + pcm_data->component = component; snd_soc_set_runtime_hwparams(substream, &hsw_pcm_hardware); From patchwork Wed Apr 22 04:48:22 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuninori Morimoto X-Patchwork-Id: 11502909 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id B787B14DD for ; Wed, 22 Apr 2020 04:49:14 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 781202072D for ; Wed, 22 Apr 2020 04:49:14 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="guwewpiK" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 781202072D Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=renesas.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:To: Subject:From:Message-ID:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=xHvRodrih5USKdQu5aO2SOsJrPpFjE8jx9RGZxlOJOo=; b=guwewpiK7gjGVB vRm0XrprvgDijR9vtAIhvSdaMxHVnfMFWdQN3ji8YSWrkH8ob0KRyo2kHMlb+2EJ23EsH+dYckxlc hqCVA5jDjjt3PXSNg7VvClaLamc/oWYfQc3Yz0AwuAvj4kNfusc/T/1SIvwvyLftz+FF11yo2ICo/ omHiccFcKHju5uu3EuR/i/Pe+3nxw/Do9fcoJMK5/sAmKLDZywJwFx7KrqlXRe2opmCAk8QcKpB6t 1s1t2oB6S3wY6+tL9izvqRTv172rA6CMfye9hR8NhVLVA/u336rZMmD1FZxAqglTBcc+7Z1AJmuJ9 J5iXjro/EIc0mxhbLOCw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jR7Js-0007OA-SR; Wed, 22 Apr 2020 04:49:08 +0000 Received: from relmlor1.renesas.com ([210.160.252.171] helo=relmlie5.idc.renesas.com) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jR7J8-0006ep-It; Wed, 22 Apr 2020 04:48:24 +0000 Date: 22 Apr 2020 13:48:22 +0900 X-IronPort-AV: E=Sophos;i="5.72,412,1580742000"; d="scan'208";a="45382396" Received: from unknown (HELO relmlir6.idc.renesas.com) ([10.200.68.152]) by relmlie5.idc.renesas.com with ESMTP; 22 Apr 2020 13:48:22 +0900 Received: from mercury.renesas.com (unknown [10.166.252.133]) by relmlir6.idc.renesas.com (Postfix) with ESMTP id D985541C1DB1; Wed, 22 Apr 2020 13:48:21 +0900 (JST) Message-ID: <877dy8unvu.wl-kuninori.morimoto.gx@renesas.com> From: Kuninori Morimoto Subject: [PATCH 4/4] ASoC: amd: don't use snd_soc_rtdcom_lookup() User-Agent: Wanderlust/2.15.9 Emacs/25.2 Mule/6.0 To: Mark Brown In-Reply-To: <87d080unyx.wl-kuninori.morimoto.gx@renesas.com> References: <87d080unyx.wl-kuninori.morimoto.gx@renesas.com> MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200421_214822_761469_C1870A1F X-CRM114-Status: UNSURE ( 7.80 ) X-CRM114-Notice: Please train this message. X-Spam-Score: 0.0 (/) X-Spam-Report: SpamAssassin version 3.4.4 on bombadil.infradead.org summary: Content analysis details: (0.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [210.160.252.171 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kate Stewart , Cezary Rojewski , Jie Yang , alsa-devel@alsa-project.org, Jaroslav Kysela , Liam Girdwood , Richard Fontana , Shunli Wang , YueHaibing , Pierre-Louis Bossart , Jiaxin Yu , linux-arm-kernel@lists.infradead.org, Vijendar Mukunda , Stephen Boyd , linux-mediatek@lists.infradead.org, Eason Yen , Matthias Brugger , Thomas Gleixner , Allison Randal , Takashi Iwai , Ravulapati Vishnu vardhan rao , Colin Ian King Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org From: Kuninori Morimoto We shouldn't use snd_soc_rtdcom_lookup() as much as possible. It works today, but, will not work in the future if we support multi CPU/Codec/Platform, because 1 rtd might have multiple same driver named component. acp3x-pcm-dma driver is using snd_soc_rtdcom_lookup() at open/close() to get component by using DRV_NAME. But, lookuped "component" and function parameter "component" are same. We don't need to use snd_soc_rtdcom_lookup(). This patch fixup it. Signed-off-by: Kuninori Morimoto --- sound/soc/amd/raven/acp3x-pcm-dma.c | 6 ------ 1 file changed, 6 deletions(-) diff --git a/sound/soc/amd/raven/acp3x-pcm-dma.c b/sound/soc/amd/raven/acp3x-pcm-dma.c index e362f0bc9e46..8a892ade1f40 100644 --- a/sound/soc/amd/raven/acp3x-pcm-dma.c +++ b/sound/soc/amd/raven/acp3x-pcm-dma.c @@ -211,14 +211,11 @@ static int acp3x_dma_open(struct snd_soc_component *component, struct snd_pcm_substream *substream) { struct snd_pcm_runtime *runtime; - struct snd_soc_pcm_runtime *prtd; struct i2s_dev_data *adata; struct i2s_stream_instance *i2s_data; int ret; runtime = substream->runtime; - prtd = substream->private_data; - component = snd_soc_rtdcom_lookup(prtd, DRV_NAME); adata = dev_get_drvdata(component->dev); i2s_data = kzalloc(sizeof(*i2s_data), GFP_KERNEL); if (!i2s_data) @@ -337,11 +334,8 @@ static int acp3x_dma_mmap(struct snd_soc_component *component, static int acp3x_dma_close(struct snd_soc_component *component, struct snd_pcm_substream *substream) { - struct snd_soc_pcm_runtime *prtd; struct i2s_dev_data *adata; - prtd = substream->private_data; - component = snd_soc_rtdcom_lookup(prtd, DRV_NAME); adata = dev_get_drvdata(component->dev);