From patchwork Wed Mar 11 18:04:21 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Srinivas Kandagatla X-Patchwork-Id: 11432463 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 0D65B913 for ; Wed, 11 Mar 2020 18:06:30 +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 4E82F20691 for ; Wed, 11 Mar 2020 18:06:29 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=alsa-project.org header.i=@alsa-project.org header.b="t9VAyBm+"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="KGUQqjtX" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 4E82F20691 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.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 DC35C1679; Wed, 11 Mar 2020 19:05:42 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz DC35C1679 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1583949987; bh=TZqe4ZtYQUmklWOXHOEpIq5uF4AXsMvZegYk3tGqNh8=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=t9VAyBm+Zf68+TQ8RdWvmso93mtv/e6CEuSFF35/pur9WchC6B8MDEg2WPmY6MM3v 1P2WY7GjYu3TBC37CQdCa5baI5Q/SxcKPvIcxW6eSz0pDvpPBr1D+poOG6Ab19/9+T qQVqSLqMaOlsKYy34dHCF/fMiOiGUmQJenPikqqM= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id E50A9F80217; Wed, 11 Mar 2020 19:04:50 +0100 (CET) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa1.perex.cz (Postfix, from userid 50401) id 79BEAF801F7; Wed, 11 Mar 2020 19:04:47 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on alsa1.perex.cz X-Spam-Level: X-Spam-Status: No, score=-0.1 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,SPF_HELO_NONE,SPF_PASS,SURBL_BLOCKED,URIBL_BLOCKED autolearn=disabled version=3.4.0 Received: from mail-wm1-x344.google.com (mail-wm1-x344.google.com [IPv6:2a00:1450:4864:20::344]) (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 DCC5BF800BE for ; Wed, 11 Mar 2020 19:04:44 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz DCC5BF800BE Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="KGUQqjtX" Received: by mail-wm1-x344.google.com with SMTP id f7so3171561wml.4 for ; Wed, 11 Mar 2020 11:04:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Ko+f04MVdRtDW1tJPAYxq3VR8XAY3gAswAGYqmbv10w=; b=KGUQqjtXCiM9TTaRqOalBpsoGhAuqWfLxdC6jGMu+jkWXmhHu++/mDWPhjwg5VTICC hWegtEImHiXCNZaoTi3Laup0KYsxQ2k085mIEQmS6D2JiSrZYeJY5ZjdXgIALRpbeSDr Fd+uWYZRl7wPw/zZbTgx1YmHlc+Z8dCeXcGDEljSjVACdlcDLEgRcFGnzQZi5vcCO6Ij QNcVufk66xuZss6cNQ4zuGxvxXCYHCbp/JY+Y/BYbHNhbuUOC+wa0MPGMlNIQPc2yEb+ ucOGh5mhxY0yKALnJieG8fEuUWBM6rHgnePfPMBG7TUI20LlJVyodk8vIYBIOtvt8i9g ScXw== 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=Ko+f04MVdRtDW1tJPAYxq3VR8XAY3gAswAGYqmbv10w=; b=M2pqvc/xFQJd6FCVEampeM0AuC1JOMZz1t+zTWUhyT0z4k9ukJ5SyR5hvq/Q4mKlin b4KYGKUHtGxO7Uj2+F69+FxloPC3HFLMhjRE2sAgmpUuFvNKXXEwu70pq8qPvSiUQwSG T+4f5JrRN92XdVQtwxi9hlJ3GD1bPLm4yl59tnu1Akt3mFP/4gakjcgs4G+HXl37DEWI f+5qHp308DK6VlKMhyoISKpESv3cr9tGQ5xzFvZR3mMQPUixqG5yXPfNx8rHXUCzXfTl vg72eAmNc50V0Mfs6m6BpgQ8+Wsz6M/y1YFhlgshObN3qZoxNCmOYG3Aii79b6grgANF 3C7g== X-Gm-Message-State: ANhLgQ30SVs9O669nYirgDNfyTWDzijKdxg6s88hzzc1BpjlKYh/9a3Y 8h2kOlAExgiW3075D7ptTBCI6Q== X-Google-Smtp-Source: ADFU+vvVrTaAUu7ON5vFK7p0ja0xplS1TC2dk+nm4D+UFMEJx/tKEtHgJH5iT2cEGJuo+5TZgIq5fg== X-Received: by 2002:a1c:2045:: with SMTP id g66mr4772885wmg.15.1583949883888; Wed, 11 Mar 2020 11:04:43 -0700 (PDT) Received: from srini-hackbox.lan (cpc89974-aztw32-2-0-cust43.18-1.cable.virginm.net. [86.30.250.44]) by smtp.gmail.com with ESMTPSA id z11sm8997840wmd.47.2020.03.11.11.04.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Mar 2020 11:04:43 -0700 (PDT) From: Srinivas Kandagatla To: broonie@kernel.org Subject: [PATCH 1/2] ASoC: qdsp6: q6asm-dai: only enable dais from device tree Date: Wed, 11 Mar 2020 18:04:21 +0000 Message-Id: <20200311180422.28363-2-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20200311180422.28363-1-srinivas.kandagatla@linaro.org> References: <20200311180422.28363-1-srinivas.kandagatla@linaro.org> MIME-Version: 1.0 Cc: linux-kernel@vger.kernel.org, alsa-devel@alsa-project.org, Srinivas Kandagatla , lgirdwood@gmail.com 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" Existing code enables all the playback and capture dais even if there is no device tree entry. This can lead to un-necessary dais in the system which will never be used. So honour whats specfied in device tree. Signed-off-by: Srinivas Kandagatla --- sound/soc/qcom/qdsp6/q6asm-dai.c | 30 +++++++++++++++++++++++------- 1 file changed, 23 insertions(+), 7 deletions(-) diff --git a/sound/soc/qcom/qdsp6/q6asm-dai.c b/sound/soc/qcom/qdsp6/q6asm-dai.c index c0d422d0ab94..8b48815ff918 100644 --- a/sound/soc/qcom/qdsp6/q6asm-dai.c +++ b/sound/soc/qcom/qdsp6/q6asm-dai.c @@ -69,6 +69,8 @@ struct q6asm_dai_rtd { }; struct q6asm_dai_data { + struct snd_soc_dai_driver *dais; + int num_dais; long long int sid; }; @@ -889,7 +891,7 @@ static const struct snd_soc_component_driver q6asm_fe_dai_component = { .compr_ops = &q6asm_dai_compr_ops, }; -static struct snd_soc_dai_driver q6asm_fe_dais[] = { +static struct snd_soc_dai_driver q6asm_fe_dais_template[] = { Q6ASM_FEDAI_DRIVER(1), Q6ASM_FEDAI_DRIVER(2), Q6ASM_FEDAI_DRIVER(3), @@ -903,10 +905,22 @@ static struct snd_soc_dai_driver q6asm_fe_dais[] = { static int of_q6asm_parse_dai_data(struct device *dev, struct q6asm_dai_data *pdata) { - static struct snd_soc_dai_driver *dai_drv; + struct snd_soc_dai_driver *dai_drv; struct snd_soc_pcm_stream empty_stream; struct device_node *node; - int ret, id, dir; + int ret, id, dir, idx = 0; + + + pdata->num_dais = of_get_child_count(dev->of_node); + if (!pdata->num_dais) { + dev_err(dev, "No dais found in DT\n"); + return -EINVAL; + } + + pdata->dais = devm_kcalloc(dev, pdata->num_dais, sizeof(*dai_drv), + GFP_KERNEL); + if (!pdata->dais) + return -ENOMEM; memset(&empty_stream, 0, sizeof(empty_stream)); @@ -917,7 +931,8 @@ static int of_q6asm_parse_dai_data(struct device *dev, continue; } - dai_drv = &q6asm_fe_dais[id]; + dai_drv = &pdata->dais[idx++]; + *dai_drv = q6asm_fe_dais_template[id]; ret = of_property_read_u32(node, "direction", &dir); if (ret) @@ -955,11 +970,12 @@ static int q6asm_dai_probe(struct platform_device *pdev) dev_set_drvdata(dev, pdata); - of_q6asm_parse_dai_data(dev, pdata); + rc = of_q6asm_parse_dai_data(dev, pdata); + if (rc) + return rc; return devm_snd_soc_register_component(dev, &q6asm_fe_dai_component, - q6asm_fe_dais, - ARRAY_SIZE(q6asm_fe_dais)); + pdata->dais, pdata->num_dais); } static const struct of_device_id q6asm_dai_device_id[] = { From patchwork Wed Mar 11 18:04:22 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Srinivas Kandagatla X-Patchwork-Id: 11432467 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 74EAF913 for ; Wed, 11 Mar 2020 18:07:17 +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 B4E81206E9 for ; Wed, 11 Mar 2020 18:07:16 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=alsa-project.org header.i=@alsa-project.org header.b="RhfB6fCK"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="h4Lr7F+6" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B4E81206E9 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.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 4F61F1680; Wed, 11 Mar 2020 19:06:30 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 4F61F1680 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1583950034; bh=06TVpJq7Lpr9x+viR36ITuT468fatJSftcFPkcw1fes=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=RhfB6fCKizF+0SWUURX/RT5nht5UdQnitm6R3MjhmOZE/G8lJE0DEJOaKv7/RBOCH MT5ncfbm77m1kAqTOwOfSTdK9jzIoXggSmmNWIvszdj1+hH5go5kBRx26a2hMJoRes QmtQNP7kHiv5Sb/+b8WcCsb54AVAoMOju7XU5Uzw= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 33749F8026F; Wed, 11 Mar 2020 19:04:52 +0100 (CET) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa1.perex.cz (Postfix, from userid 50401) id 66BE6F801A3; Wed, 11 Mar 2020 19:04:49 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on alsa1.perex.cz X-Spam-Level: X-Spam-Status: No, score=-0.1 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,SPF_HELO_NONE,SPF_PASS,SURBL_BLOCKED,URIBL_BLOCKED autolearn=disabled version=3.4.0 Received: from mail-wm1-x342.google.com (mail-wm1-x342.google.com [IPv6:2a00:1450:4864:20::342]) (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 3E131F801A3 for ; Wed, 11 Mar 2020 19:04:45 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 3E131F801A3 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="h4Lr7F+6" Received: by mail-wm1-x342.google.com with SMTP id x3so3733192wmj.1 for ; Wed, 11 Mar 2020 11:04:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=4omj6yAnna4dJSDx6mgWTPNUU3WmtYx8C7r3eY7KJR8=; b=h4Lr7F+6v/hE6dalw5i+9v/T+aEcsjQazcSL+w4L8CeLySvy6RvJLOM3X9+74Ek9DO nhAYQtP9yUbK71IC6rY1v/SZKYwaGWBRTgiH+skZHaqaa452ul7KJT6CPjICbCQad7rg Mmhz2xiFvJHQ7O2UJ++ZhXLis3WQN0vrzSca47MuSn2g35SMb6hXvU0d34V+Y2jmn6ik VsIQJF+ySk+scY60ttpsCK+t63v4lsmVVVMw70acLn+crd8u/INAS1DLMxkk2pTQKpgN sr2pzPN9kPM296nb1VXTBPuFs+CQ4nJxrxT2D4p5am9veDPox5Q13YpZW5desLi6j1Ct uaZw== 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=4omj6yAnna4dJSDx6mgWTPNUU3WmtYx8C7r3eY7KJR8=; b=Z9we9FQOCfaqdJcnEHspBewQF2jwNo5PsIoFkoVsCpoDoZ0m9ViVCpCBOOkpNWAOty RSnrCzpStUJv1FqmjVVq01tydXjN7k0oYkPzuZwFiJhIJvmCeLNDM7tQ8bvsPtfFcIhD WWP01FWeW9LpzPk8WVOD3BYiAopTyaBXmS/9+HE43OehXcv8MtW5wAlhwiShlAD6+/v9 d8+J/t811RjGCYxuvWWOrs3vLwTT7Fky39SbCgAReCpLV8f/cDvM7LXZR015j1fn2cHx DLrzcQXXA1OtTIRGG5MQlLEYm4V+5sm6+7a66Xc3DH2LcjCFu1XY/9nKDHjBKzkMoTP5 bZTA== X-Gm-Message-State: ANhLgQ0spxMzHYFN3rsZSDaF2lrTY/4gFVXcjq+uMT5uk/sV4grI/NrJ Bfl2s7pLTPwP42nTR+qHVqEnbQ== X-Google-Smtp-Source: ADFU+vvR5T/YJ0xN9O5b1ViU6reQXdGd7Z+15MpCetrHskMG8KW1ZFhX4v9Gsux7i8Rp5TuBYyt6Ug== X-Received: by 2002:a7b:cc14:: with SMTP id f20mr4562610wmh.132.1583949885317; Wed, 11 Mar 2020 11:04:45 -0700 (PDT) Received: from srini-hackbox.lan (cpc89974-aztw32-2-0-cust43.18-1.cable.virginm.net. [86.30.250.44]) by smtp.gmail.com with ESMTPSA id z11sm8997840wmd.47.2020.03.11.11.04.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Mar 2020 11:04:44 -0700 (PDT) From: Srinivas Kandagatla To: broonie@kernel.org Subject: [PATCH 2/2] ASoC: qdsp6: q6routing: remove default routing Date: Wed, 11 Mar 2020 18:04:22 +0000 Message-Id: <20200311180422.28363-3-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20200311180422.28363-1-srinivas.kandagatla@linaro.org> References: <20200311180422.28363-1-srinivas.kandagatla@linaro.org> MIME-Version: 1.0 Cc: alsa-devel@alsa-project.org, Vinod Koul , linux-kernel@vger.kernel.org, lgirdwood@gmail.com, Srinivas Kandagatla 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" Frontend dais can be configured to rx or tx or both, however having default routes without considering this configuration can lead to failures during card probe as below for compress rx only case. These routing have to come from sound card routing table in device tree. "routing: ASoC: Failed to add route MM_UL1 -> direct -> MultiMedia1 Capture msm-snd-sdm845 sound: ASoC: failed to instantiate card -19 " Reported-by: Vinod Koul Signed-off-by: Srinivas Kandagatla --- sound/soc/qcom/qdsp6/q6routing.c | 19 ------------------- 1 file changed, 19 deletions(-) diff --git a/sound/soc/qcom/qdsp6/q6routing.c b/sound/soc/qcom/qdsp6/q6routing.c index 20724102e85a..4d5915b9a06d 100644 --- a/sound/soc/qcom/qdsp6/q6routing.c +++ b/sound/soc/qcom/qdsp6/q6routing.c @@ -918,25 +918,6 @@ static const struct snd_soc_dapm_route intercon[] = { {"MM_UL6", NULL, "MultiMedia6 Mixer"}, {"MM_UL7", NULL, "MultiMedia7 Mixer"}, {"MM_UL8", NULL, "MultiMedia8 Mixer"}, - - {"MM_DL1", NULL, "MultiMedia1 Playback" }, - {"MM_DL2", NULL, "MultiMedia2 Playback" }, - {"MM_DL3", NULL, "MultiMedia3 Playback" }, - {"MM_DL4", NULL, "MultiMedia4 Playback" }, - {"MM_DL5", NULL, "MultiMedia5 Playback" }, - {"MM_DL6", NULL, "MultiMedia6 Playback" }, - {"MM_DL7", NULL, "MultiMedia7 Playback" }, - {"MM_DL8", NULL, "MultiMedia8 Playback" }, - - {"MultiMedia1 Capture", NULL, "MM_UL1"}, - {"MultiMedia2 Capture", NULL, "MM_UL2"}, - {"MultiMedia3 Capture", NULL, "MM_UL3"}, - {"MultiMedia4 Capture", NULL, "MM_UL4"}, - {"MultiMedia5 Capture", NULL, "MM_UL5"}, - {"MultiMedia6 Capture", NULL, "MM_UL6"}, - {"MultiMedia7 Capture", NULL, "MM_UL7"}, - {"MultiMedia8 Capture", NULL, "MM_UL8"}, - }; static int routing_hw_params(struct snd_soc_component *component,