From mboxrd@z Thu Jan 1 00:00:00 1970 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=-16.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable 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 73B7AC433DB for ; Thu, 25 Feb 2021 12:22:07 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 179C864F03 for ; Thu, 25 Feb 2021 12:22:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229880AbhBYMWG (ORCPT ); Thu, 25 Feb 2021 07:22:06 -0500 Received: from inva021.nxp.com ([92.121.34.21]:57174 "EHLO inva021.nxp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232600AbhBYMVg (ORCPT ); Thu, 25 Feb 2021 07:21:36 -0500 Received: from inva021.nxp.com (localhost [127.0.0.1]) by inva021.eu-rdc02.nxp.com (Postfix) with ESMTP id 96293200C0F; Thu, 25 Feb 2021 13:20:48 +0100 (CET) Received: from invc005.ap-rdc01.nxp.com (invc005.ap-rdc01.nxp.com [165.114.16.14]) by inva021.eu-rdc02.nxp.com (Postfix) with ESMTP id 51FFD200C38; Thu, 25 Feb 2021 13:20:43 +0100 (CET) Received: from localhost.localdomain (shlinux2.ap.freescale.net [10.192.224.44]) by invc005.ap-rdc01.nxp.com (Postfix) with ESMTP id 97A4340291; Thu, 25 Feb 2021 13:20:36 +0100 (CET) From: Shengjiu Wang To: lgirdwood@gmail.com, broonie@kernel.org, perex@perex.cz, tiwai@suse.com, pierre-louis.bossart@linux.intel.com, stephan@gerhold.net, guennadi.liakhovetski@linux.intel.com, kai.vehmanen@linux.intel.com, alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org Subject: [PATCH] ASoC: simple-card: Add dummy dai support simple sound card Date: Thu, 25 Feb 2021 20:08:32 +0800 Message-Id: <1614254912-15746-1-git-send-email-shengjiu.wang@nxp.com> X-Mailer: git-send-email 2.7.4 X-Virus-Scanned: ClamAV using ClamSMTP Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org If sound card doesn't need specific codec device, just dummy codec is enough, then we can link the dummy component directly. In this case, user needs to specify below setting in devicetree. Previously the sound-dai is a node of codec, now we check if it is zero before parsing the node, zero means dummy component is specified. simple-audio-card,codec { sound-dai = <0>; }; Signed-off-by: Shengjiu Wang --- sound/soc/generic/simple-card.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/sound/soc/generic/simple-card.c b/sound/soc/generic/simple-card.c index c262281bc64d..8b0cabd1bad1 100644 --- a/sound/soc/generic/simple-card.c +++ b/sound/soc/generic/simple-card.c @@ -34,10 +34,19 @@ static int asoc_simple_parse_dai(struct device_node *node, { struct of_phandle_args args; int ret; + u32 val; if (!node) return 0; + ret = of_property_read_u32(node, DAI, &val); + if (val == 0) { + dlc->of_node = NULL; + dlc->dai_name = "snd-soc-dummy-dai"; + dlc->name = "snd-soc-dummy"; + return 0; + } + /* * Get node via "sound-dai = <&phandle port>" * it will be used as xxx_of_node on soc_bind_dai_link() -- 2.27.0