From patchwork Thu May 27 02:24:55 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuninori Morimoto X-Patchwork-Id: 449543 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2912BC47089 for ; Thu, 27 May 2021 02:26:01 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 9A5D7613C7 for ; Thu, 27 May 2021 02:25:59 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 9A5D7613C7 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=renesas.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=alsa-devel-bounces@alsa-project.org Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 64CA41705; Thu, 27 May 2021 04:25:07 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 64CA41705 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1622082357; bh=H6aZGsrl7ZV1MY4oioovtZKXVBHpx0p0oVO4fk8EYbw=; h=Date:From:To:Subject:Cc:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From; b=pdb1kcgcsqAFtXFm2sqJk7hlBP9TNyWRGfohEg9tGVqKH55VAV7UnQiKjDCfAKxqD fNehZtxo1ynpyCYZb6TvFD/KFas0Kmhg8OounytMs4w0852668+TRP3vSm+A+BOVLH QNM1EhvHFE03y5DLsNOovpqkI6suf/TyTnXeKzjM= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id EB778F8010C; Thu, 27 May 2021 04:25:06 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 7D14FF8012E; Thu, 27 May 2021 04:25:05 +0200 (CEST) Received: from relmlie6.idc.renesas.com (relmlor2.renesas.com [210.160.252.172]) by alsa1.perex.cz (Postfix) with ESMTP id E5794F8010C for ; Thu, 27 May 2021 04:24:57 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz E5794F8010C Date: 27 May 2021 11:24:55 +0900 X-IronPort-AV: E=Sophos;i="5.82,333,1613401200"; d="scan'208";a="82371507" Received: from unknown (HELO relmlir5.idc.renesas.com) ([10.200.68.151]) by relmlie6.idc.renesas.com with ESMTP; 27 May 2021 11:24:55 +0900 Received: from mercury.renesas.com (unknown [10.166.252.133]) by relmlir5.idc.renesas.com (Postfix) with ESMTP id A3DD1401474A; Thu, 27 May 2021 11:24:55 +0900 (JST) Message-ID: <87k0nkncaw.wl-kuninori.morimoto.gx@renesas.com> From: Kuninori Morimoto To: Mark Brown Subject: [PATCH v3 0/7] ASoC: adds new .auto_selectable_formats support User-Agent: Wanderlust/2.15.9 Emacs/26.3 Mule/6.0 MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Cc: Linux-ALSA X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" Hi Mark These are v3 of "ASoC: adds new .get_fmt support", but renamed Subject. This is a little bit challenging patch-set. The idea/code is almost same as v1 / v2. v3 has "priority" support. We need to set dai_link->dai_fmt to select CPU/Codec settings, and it is selected by Sound Card Driver, today. Because of it, Sound Card user need to know both CPU / Codec available dai_fmt, and needs to select it. For example simple-card / audio-graph case, it is selected by "format" and "bitclock/frame-master/inversion" on DT. But, it can be automatically selected if both CPU and Codec drivers indicate it to ALSA SoC Framework, somehow. By this patch, dai_fmt can be automatically selected from each driver if both CPU / Codec driver had .auto_selectable_formats. Automatically selectable *field* is depends on each drivers. For example, some driver want to select format "automatically", but want to select other fields "manually", because of complex limitation. Or other example, in case of both CPU and Codec are possible to be clock provider, but the quality was different. In these case, user need/want to *manually* select each fields from Sound Card driver. It uses Sound Card specified fields preferentially, and try to select non-specific fields from CPU and Codec driver settings if driver had .auto_selectable_formats. In other words, we can select all dai_fmt via Sound Card driver same as before. Select dai_fmt 100% automatically is very difficult and will be very complex, but select automatically some fields only is very easy, I guess. This patch-set is based on such assumption. v1 -> v2 - Add more detail explanation on git-log, code, comment. - Possible to be Clock/Frame provider is depends on driver's situation. v2 -> v3 - has priority - tidyup function explanation for snd_soc_dai_get_fmt() - Each driver don't try to have SND_SOC_DAIFMT_CBx_CFx to avoid confusion Link: https://lore.kernel.org/r/871rb3hypy.wl-kuninori.morimoto.gx@renesas.com Link: https://lore.kernel.org/r/871racbx0w.wl-kuninori.morimoto.gx@renesas.com Kuninori Morimoto (7): ASoC: soc-core: move snd_soc_runtime_set_dai_fmt() to upside ASoC: soc-core: add snd_soc_runtime_get_dai_fmt() ASoC: ak4613: add .auto_selectable_formats support ASoC: pcm3168a: add .auto_selectable_formats support ASoC: rsnd: add .auto_selectable_formats support ASoC: fsi: add .auto_selectable_formats support ASoC: hdmi-codec: add .auto_selectable_formats support include/sound/soc-dai.h | 55 +++++++ sound/soc/codecs/ak4613.c | 11 ++ sound/soc/codecs/hdmi-codec.c | 21 +++ sound/soc/codecs/pcm3168a.c | 26 +++ sound/soc/sh/fsi.c | 15 ++ sound/soc/sh/rcar/core.c | 31 +++- sound/soc/soc-core.c | 288 ++++++++++++++++++++++++++-------- sound/soc/soc-dai.c | 63 ++++++++ sound/soc/soc-utils.c | 29 ++++ 9 files changed, 475 insertions(+), 64 deletions(-)