From patchwork Mon Jun 21 07:41:52 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Judy Hsiao X-Patchwork-Id: 464665 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,DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,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 EAB32C48BE5 for ; Mon, 21 Jun 2021 07:43:08 +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 7DAA760FEE for ; Mon, 21 Jun 2021 07:43:07 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 7DAA760FEE Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=chromium.org 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 3478F169A; Mon, 21 Jun 2021 09:42:15 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 3478F169A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1624261385; bh=FDk7tLKzBImEqf54cmh7+rVnANAoHJfCgpsgCKqC8tM=; h=From:To:Subject:Date:Cc:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From; b=KUrFIME2Jr470ndcFiFMzLAWsNVMwecYivUF1Xgoz3xRtYX60bXL9QwrUtPhvzTkW OfiS0TrF3i9G7YZ38NcTFXUzCZm4pMONZ0C1Siq4fN+jHgPJk6CQSD9KPOCI1RNYzG ynE8JG5DvJhSo0S2urIsD6d8j9y1aMkOlj13liM0= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id AEAEDF8016A; Mon, 21 Jun 2021 09:42:14 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 98699F8016B; Mon, 21 Jun 2021 09:42:12 +0200 (CEST) Received: from mail-pg1-x534.google.com (mail-pg1-x534.google.com [IPv6:2607:f8b0:4864:20::534]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 95492F80163 for ; Mon, 21 Jun 2021 09:42:05 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 95492F80163 Authentication-Results: alsa1.perex.cz; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="PW1xTA2/" Received: by mail-pg1-x534.google.com with SMTP id y14so2039451pgs.12 for ; Mon, 21 Jun 2021 00:42:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=PcRAvrQip+1WJuNclasUdgOdAuaWVTSb28lQVa+Hq0U=; b=PW1xTA2/2xO4PqExn5V1DOomUzRaLUlMK7VPvDZAnglAjgj3HF0HR4tTvM1Jyq4Xo/ lbz8+BPcBz3r6RVcMPnk5m2CUnlfe6Y1yZGbO3GZ9ucEhXHnuWrpQe9DBX2P9BN4xpy/ k0U3/0P/720ja+nHXJ775gb7N3AE3nuCG4Z3E= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=PcRAvrQip+1WJuNclasUdgOdAuaWVTSb28lQVa+Hq0U=; b=QUSeVTaC7stgLuOTlx0fqevCnT/GXdgWIVlhOpkQtihWlxhN9VNXaFR00wImKoUrq/ c2VOsqUP9CO61wZ0+FMGhCrxLfvWGYYpzWoP4KTOskzvTP/YDi/igPoXY6RW6vQNIm3x O5/TzWZJeOyZSpxS8fgqeWFWGXSXdXt3VUEodLP9sLrxKL/raupbjrmFf3ihJrKlFAsY qWUztdksS4GaXwRx64dH7iaRTnM92VJfQvIBKjiIZLKdqKJS33/+HXJ0Y/JXmeZ1KR9k IjZleRm8FMFClVMQZKub7LT2y6M9FN4c6yIIuuB7Kzomt1zSG/WMpqBYaB6nSeTP0ovn cklw== X-Gm-Message-State: AOAM5335PU5cvniw2FHIoe15eiWYEnC32S2USHj/twkZBdGFp18G8a/y Egtc1CbEgSY7jARuuC3rAAnLPg== X-Google-Smtp-Source: ABdhPJxkwpEFihejVk1nobo1GrlcMvMr+6qs8f9VpwqRVo8xZY9eo8LzrK9zu5A5PICZlxCe0KZu7w== X-Received: by 2002:a63:e245:: with SMTP id y5mr22455461pgj.171.1624261320340; Mon, 21 Jun 2021 00:42:00 -0700 (PDT) Received: from judyhsiao-p920.tpe.corp.google.com ([2401:fa00:1:10:5a92:9d6d:3875:d2ba]) by smtp.gmail.com with ESMTPSA id 10sm11954195pfh.174.2021.06.21.00.41.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 21 Jun 2021 00:41:59 -0700 (PDT) From: Judy Hsiao To: broonie@kernel.org Subject: [PATCH] ASoC: snd-soc-dummy: add Device Tree support Date: Mon, 21 Jun 2021 15:41:52 +0800 Message-Id: <20210621074152.306362-1-judyhsiao@chromium.org> X-Mailer: git-send-email 2.31.0 MIME-Version: 1.0 Cc: Taniya Das , alsa-devel@alsa-project.org, Banajit Goswami , Liam Girdwood , Rohit kumar , Patrick Lai , Andy Gross , dgreid@chromium.org, devicetree@vger.kernel.org, judyhsiao@google.com, tzungbi@chromium.org, Stephan Gerhold , linux-arm-msm@vger.kernel.org, swboyd@chromium.org, Rob Herring , Bjorn Andersson , linux-arm-kernel@lists.infradead.org, dianders@chromium.org, cychiang@google.com, Takashi Iwai , Judy Hsiao 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" Support for loading the snd-soc-dummy via DeviceTree. This is useful to create dummy codec devices where we need to have some DAI links without a real Codec. Signed-off-by: Judy Hsiao --- .../devicetree/bindings/sound/snd-soc-dummy.txt | 16 ++++++++++++++++ sound/soc/soc-utils.c | 11 +++++++++++ 2 files changed, 27 insertions(+) create mode 100644 Documentation/devicetree/bindings/sound/snd-soc-dummy.txt diff --git a/Documentation/devicetree/bindings/sound/snd-soc-dummy.txt b/Documentation/devicetree/bindings/sound/snd-soc-dummy.txt new file mode 100644 index 000000000000..7fa8c5751e62 --- /dev/null +++ b/Documentation/devicetree/bindings/sound/snd-soc-dummy.txt @@ -0,0 +1,16 @@ +* snd-soc-dummy + +This node models the snd-soc-dummy. +This is useful to create dummy codec devices where we need to have +some DAI links without a real Codec. + +Required properties: +- compatible : "asoc,snd-soc-dummy" + + +Example: + +dummy_codec { + compatible = "asoc,snd-soc-dummy"; + #sound-dai-cells = <0>; +}; diff --git a/sound/soc/soc-utils.c b/sound/soc/soc-utils.c index 299b5d6ebfd1..def2cc687415 100644 --- a/sound/soc/soc-utils.c +++ b/sound/soc/soc-utils.c @@ -7,6 +7,8 @@ // Author: Mark Brown // Liam Girdwood +#include +#include #include #include #include @@ -181,9 +183,18 @@ static int snd_soc_dummy_probe(struct platform_device *pdev) return ret; } +#ifdef CONFIG_OF +static const struct of_device_id soc_dummy_device_id[] = { + { .compatible = "asoc,snd-soc-dummy" }, + {} +}; +MODULE_DEVICE_TABLE(of, soc_dummy_device_id); +#endif + static struct platform_driver soc_dummy_driver = { .driver = { .name = "snd-soc-dummy", + .of_match_table = of_match_ptr(soc_dummy_device_id), }, .probe = snd_soc_dummy_probe, };