From patchwork Thu Aug 24 21:01:32 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marian Postevca X-Patchwork-Id: 716579 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 alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (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 99D77C3DA6F for ; Thu, 24 Aug 2023 21:03:42 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 3DBF684A; Thu, 24 Aug 2023 23:02:50 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 3DBF684A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1692911020; bh=Tm63Mvp1jvDf3sJhV/8zUpCX7xgXcTbDK1PgG6byMck=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=IUjAPS1NyCE/VKXiQIc+eWSfwtcThvHBCvAry4ZBiEDOzPnGkytQJMskmVJkaAAHy Q4yERWbxIdneIGcQEOSftHcKbySNVW24x8sws9Tg6oG9eFosqxdXGCo/T0Ck4pHbvB d0vnEItvRHnOK6pCC5thZnXl0FTIVWK6fKriIOcQ= Received: by alsa1.perex.cz (Postfix, from userid 50401) id C733DF8055C; Thu, 24 Aug 2023 23:02:00 +0200 (CEST) Received: from mailman-core.alsa-project.org (mailman-core.alsa-project.org [10.254.200.10]) by alsa1.perex.cz (Postfix) with ESMTP id 54138F800F5; Thu, 24 Aug 2023 23:02:00 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 70FE0F8025F; Thu, 24 Aug 2023 23:01:55 +0200 (CEST) Received: from mail.mutex.one (mail.mutex.one [62.77.152.124]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id C5E54F800F5 for ; Thu, 24 Aug 2023 23:01:41 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz C5E54F800F5 Authentication-Results: alsa1.perex.cz; dkim=pass (1024-bit key, unprotected) header.d=mutex.one header.i=@mutex.one header.a=rsa-sha256 header.s=default header.b=k9+JsulQ Received: from localhost (localhost.localdomain [127.0.0.1]) by mail.mutex.one (Postfix) with ESMTP id 939F616C0047; Fri, 25 Aug 2023 00:01:40 +0300 (EEST) X-Virus-Scanned: Debian amavisd-new at mail.mutex.one Received: from mail.mutex.one ([127.0.0.1]) by localhost (mail.mutex.one [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id DwQrudmliFeG; Fri, 25 Aug 2023 00:01:39 +0300 (EEST) From: Marian Postevca DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=mutex.one; s=default; t=1692910899; bh=Tm63Mvp1jvDf3sJhV/8zUpCX7xgXcTbDK1PgG6byMck=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=k9+JsulQYF8QcuNC0in5P0Mz+GgGOdKYcq8yrJZYhAuZMdh8S4CRo63VTEqYX+AfR 3TbWd7CQjRgOO+nTn6EDl4svzq1qV98E9P7bpU6/tlm08jG97FMJ03HCrSQxWzsU41 fEd6cL9O5fcojj8UsWzFf7m6VUjtD+VgCElUtUKU= To: Takashi Iwai , Liam Girdwood , Mark Brown , Jaroslav Kysela Cc: alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org, Marian Postevca Subject: [PATCH v2 1/4] ASoC: es8316: Enable support for S32 LE format Date: Fri, 25 Aug 2023 00:01:32 +0300 Message-ID: <20230824210135.19303-2-posteuca@mutex.one> In-Reply-To: <20230824210135.19303-1-posteuca@mutex.one> References: <20230824210135.19303-1-posteuca@mutex.one> MIME-Version: 1.0 Message-ID-Hash: YJ4CWOHZ2HO43UASRDPWMCVISIJZCXII X-Message-ID-Hash: YJ4CWOHZ2HO43UASRDPWMCVISIJZCXII X-MailFrom: posteuca@mutex.one X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-alsa-devel.alsa-project.org-0; header-match-alsa-devel.alsa-project.org-1; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.8 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: To properly support a line of Huawei laptops with AMD CPU and a ES8336 codec connected to the ACP3X module we need to enable the S32 LE format. Signed-off-by: Marian Postevca --- sound/soc/codecs/es8316.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sound/soc/codecs/es8316.c b/sound/soc/codecs/es8316.c index a8f347f1affb..09fc0b25f600 100644 --- a/sound/soc/codecs/es8316.c +++ b/sound/soc/codecs/es8316.c @@ -526,7 +526,7 @@ static int es8316_mute(struct snd_soc_dai *dai, int mute, int direction) } #define ES8316_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S20_3LE | \ - SNDRV_PCM_FMTBIT_S24_LE) + SNDRV_PCM_FMTBIT_S24_LE | SNDRV_PCM_FMTBIT_S32_LE) static const struct snd_soc_dai_ops es8316_ops = { .startup = es8316_pcm_startup, From patchwork Thu Aug 24 21:01:34 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marian Postevca X-Patchwork-Id: 716578 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 alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (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 1C6EBC27C40 for ; Thu, 24 Aug 2023 21:04:07 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 8920EA4C; Thu, 24 Aug 2023 23:03:14 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 8920EA4C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1692911044; bh=8PTrXsqkL0UNlPVGEVRU0vTAbW7pki9umfY6TrlE7rM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=BkKAjizpz9nzpk6P5v+wBkAVaSLS/xlNasUDMOOg/PgefkhrdUU6xrNqucdOADm7F +/PNdh4lNraGCTj8s0Y5QCtriHtxgORCNfieM4Kmw3Tn5X6TUz19u5sgRr6m9MEfWZ 6CMy9ILvMsMPigSxIySowQ07C1N8m9QguLrYFGVk= Received: by alsa1.perex.cz (Postfix, from userid 50401) id EDF87F80564; Thu, 24 Aug 2023 23:02:06 +0200 (CEST) Received: from mailman-core.alsa-project.org (mailman-core.alsa-project.org [10.254.200.10]) by alsa1.perex.cz (Postfix) with ESMTP id 66488F8057C; Thu, 24 Aug 2023 23:02:06 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id EF0B6F80567; Thu, 24 Aug 2023 23:02:01 +0200 (CEST) Received: from mail.mutex.one (mail.mutex.one [62.77.152.124]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id AEB81F800BF for ; Thu, 24 Aug 2023 23:01:44 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz AEB81F800BF Authentication-Results: alsa1.perex.cz; dkim=pass (1024-bit key, unprotected) header.d=mutex.one header.i=@mutex.one header.a=rsa-sha256 header.s=default header.b=XsjxURkv Received: from localhost (localhost.localdomain [127.0.0.1]) by mail.mutex.one (Postfix) with ESMTP id C806416C0048; Fri, 25 Aug 2023 00:01:43 +0300 (EEST) X-Virus-Scanned: Debian amavisd-new at mail.mutex.one Received: from mail.mutex.one ([127.0.0.1]) by localhost (mail.mutex.one [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 5CX7HXT9j10U; Fri, 25 Aug 2023 00:01:41 +0300 (EEST) From: Marian Postevca DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=mutex.one; s=default; t=1692910901; bh=8PTrXsqkL0UNlPVGEVRU0vTAbW7pki9umfY6TrlE7rM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XsjxURkv7BAH88nQTsbx+qKsY4taPx0e9iItwBt4+BL2O+Y3CD0aMu0h9xn+kOhZ3 htWOlY958/6rDSS7yPM0sAFxnOtarQ5KT9lheMUOxKj1NUzIWnySunL55jNp1/IgdZ sqwdIFWhbvj3aNgwsLqtX419zkJnQNHwpD45EYyQ= To: Takashi Iwai , Liam Girdwood , Mark Brown , Jaroslav Kysela Cc: alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org, Marian Postevca Subject: [PATCH v2 3/4] ASoC: amd: acp: Add support for splitting the codec specific code from the ACP driver Date: Fri, 25 Aug 2023 00:01:34 +0300 Message-ID: <20230824210135.19303-4-posteuca@mutex.one> In-Reply-To: <20230824210135.19303-1-posteuca@mutex.one> References: <20230824210135.19303-1-posteuca@mutex.one> MIME-Version: 1.0 Message-ID-Hash: EU4WZAS5UOFV74S6WIOJYHIQ7FDSAYQP X-Message-ID-Hash: EU4WZAS5UOFV74S6WIOJYHIQ7FDSAYQP X-MailFrom: posteuca@mutex.one X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-alsa-devel.alsa-project.org-0; header-match-alsa-devel.alsa-project.org-1; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.8 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: This commit adds support for splitting more complicated machine drivers, that need special handling, from the generic ACP code. By adding support for callbacks to configure and handle codec specific implementation details, we can split them in separate files that don't clutter the ACP code. Signed-off-by: Marian Postevca --- sound/soc/amd/acp/acp-mach.h | 65 ++++++++++++++++++++++++++++++++++++ 1 file changed, 65 insertions(+) diff --git a/sound/soc/amd/acp/acp-mach.h b/sound/soc/amd/acp/acp-mach.h index 2b3ec6594023..31f38ec4b1d1 100644 --- a/sound/soc/amd/acp/acp-mach.h +++ b/sound/soc/amd/acp/acp-mach.h @@ -20,6 +20,10 @@ #define TDM_CHANNELS 8 +#define ACP_OPS(priv, cb) ((priv)->ops.cb) + +#define acp_get_drvdata(card) ((struct acp_card_drvdata *)(card)->drvdata) + enum be_id { HEADSET_BE_ID = 0, AMP_BE_ID, @@ -50,6 +54,14 @@ enum platform_end_point { REMBRANDT, }; +struct acp_mach_ops { + int (*probe)(struct snd_soc_card *card); + int (*configure_link)(struct snd_soc_card *card, struct snd_soc_dai_link *dai_link); + int (*configure_widgets)(struct snd_soc_card *card); + int (*suspend_pre)(struct snd_soc_card *card); + int (*resume_post)(struct snd_soc_card *card); +}; + struct acp_card_drvdata { unsigned int hs_cpu_id; unsigned int amp_cpu_id; @@ -61,6 +73,8 @@ struct acp_card_drvdata { unsigned int platform; struct clk *wclk; struct clk *bclk; + struct acp_mach_ops ops; + void *mach_priv; bool soc_mclk; bool tdm_mode; }; @@ -69,4 +83,55 @@ int acp_sofdsp_dai_links_create(struct snd_soc_card *card); int acp_legacy_dai_links_create(struct snd_soc_card *card); extern const struct dmi_system_id acp_quirk_table[]; +static inline int acp_ops_probe(struct snd_soc_card *card) +{ + int ret = 1; + struct acp_card_drvdata *priv = acp_get_drvdata(card); + + if (ACP_OPS(priv, probe)) + ret = ACP_OPS(priv, probe)(card); + return ret; +} + +static inline int acp_ops_configure_link(struct snd_soc_card *card, + struct snd_soc_dai_link *dai_link) +{ + int ret = 1; + struct acp_card_drvdata *priv = acp_get_drvdata(card); + + if (ACP_OPS(priv, configure_link)) + ret = ACP_OPS(priv, configure_link)(card, dai_link); + return ret; +} + +static inline int acp_ops_configure_widgets(struct snd_soc_card *card) +{ + int ret = 1; + struct acp_card_drvdata *priv = acp_get_drvdata(card); + + if (ACP_OPS(priv, configure_widgets)) + ret = ACP_OPS(priv, configure_widgets)(card); + return ret; +} + +static inline int acp_ops_suspend_pre(struct snd_soc_card *card) +{ + int ret = 1; + struct acp_card_drvdata *priv = acp_get_drvdata(card); + + if (ACP_OPS(priv, suspend_pre)) + ret = ACP_OPS(priv, suspend_pre)(card); + return ret; +} + +static inline int acp_ops_resume_post(struct snd_soc_card *card) +{ + int ret = 1; + struct acp_card_drvdata *priv = acp_get_drvdata(card); + + if (ACP_OPS(priv, resume_post)) + ret = ACP_OPS(priv, resume_post)(card); + return ret; +} + #endif