From patchwork Wed Oct 25 14:45:59 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 738408 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 24BE3C07545 for ; Wed, 25 Oct 2023 14:46:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344392AbjJYOq2 (ORCPT ); Wed, 25 Oct 2023 10:46:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44282 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343719AbjJYOq0 (ORCPT ); Wed, 25 Oct 2023 10:46:26 -0400 Received: from mail-lf1-x135.google.com (mail-lf1-x135.google.com [IPv6:2a00:1450:4864:20::135]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2B9A01AA for ; Wed, 25 Oct 2023 07:46:10 -0700 (PDT) Received: by mail-lf1-x135.google.com with SMTP id 2adb3069b0e04-508126afb9bso1818536e87.0 for ; Wed, 25 Oct 2023 07:46:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1698245168; x=1698849968; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=7fCndReggPj8sG1syb2HDBs4AgKt0DkohlqpGAodX1o=; b=FKuEN7LlUjU3EuB1MvIf+R5ndIIbioVnEoXnbS24KtQZm0kOKTcxDKN8Dg3mq95fhg 7Ob66Y95QWJXVrV3TzmAGOuG/80QP5Hn04qS/W9KTdZxfRVfW9KSE7w/ehX/c0EBiOnJ hjdJtQZvYKpmulRi7UoRCD3rMk3SmdHWc9gSUkZa8JDmaUB3dvArV8cSKHNBNHuvLd0L lFLFjgrm6i0BAIqI6gRIQHkLvOK5WsIMePMKNjeBBf3ToEjWHO4cV2YkekPF/5IYkGXD mLj+AaN2DR5OgsVVOyw2ENyafV8cb4Aw8FU2LRIH2O8vN7hh00lKY/vBaTUHVKxKLZ/a 8sDg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698245168; x=1698849968; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=7fCndReggPj8sG1syb2HDBs4AgKt0DkohlqpGAodX1o=; b=jYlpt0NB567+GFrxA2jVAtZtCPkZID1ZlXg1ZYawa9VgN0r3hN5ce1hwkA3vQkjoq2 34IblUGm6NDUjaTEL+H/se2FfUpR7OPgKDbUO4N4lL2yoS+vKwHl5ulPE9t8V5FcO8ih qJUKsF0NM4vlEtYWVU6CO71jHwi7x2ak25LFs3jorc0OdDBEYnGR2V+MoAI7OjLVLiKm uGSUu+I0OkOei8uBbv8CvnTeA0ztERDwxJEafIHGwNyq41TVzl1QpWOBjQOg0l1lA5NN 09IvVbdvt8f+fMFetsZ9sgqCLFSrdDsgrWbwNYycinBvpU8KdFTn2+muaIwq2O0LUUZ5 yGmQ== X-Gm-Message-State: AOJu0YyDdXQK4l7FSLL2R69VXMAPpsbmgA3VFxOrHmZ/ALlYy8/bAmpn 403bl/1pxx67tvOKhL9JHE7kfg== X-Google-Smtp-Source: AGHT+IFNwe40aLcfWcgRqBNwoh4xuwRuxRmryBZCAYASICKbNwYeSIEIxBm3Mc2QFFfX2zJNfG3p9w== X-Received: by 2002:a19:7419:0:b0:4fd:c715:5667 with SMTP id v25-20020a197419000000b004fdc7155667mr10143878lfe.20.1698245168251; Wed, 25 Oct 2023 07:46:08 -0700 (PDT) Received: from krzk-bin.. ([178.197.218.126]) by smtp.gmail.com with ESMTPSA id i1-20020a05600011c100b0032dcb08bf94sm12267138wrx.60.2023.10.25.07.46.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Oct 2023 07:46:07 -0700 (PDT) From: Krzysztof Kozlowski To: Andy Gross , Bjorn Andersson , Konrad Dybcio , Vinod Koul , Bard Liao , Pierre-Louis Bossart , Sanyog Kale , Srinivas Kandagatla , Banajit Goswami , Liam Girdwood , Mark Brown , Jaroslav Kysela , Takashi Iwai , linux-arm-msm@vger.kernel.org, alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org Cc: Krzysztof Kozlowski Subject: [PATCH 1/3] soundwire: qcom: drop unneeded DAI .set_stream callback Date: Wed, 25 Oct 2023 16:45:59 +0200 Message-Id: <20231025144601.268645-1-krzysztof.kozlowski@linaro.org> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Qualcomm Soundwire controller drivers do not support multi-link setups, so DAI .set_stream() callback will not be used. What's more, if called it will overwrite the sdw_stream_runtime runtime set in DAI .startup (qcom_swrm_startup()) causing issues (unsupported multi-link error) when two Soundwire controllers are passed as codec DAIs. Signed-off-by: Krzysztof Kozlowski --- drivers/soundwire/qcom.c | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/drivers/soundwire/qcom.c b/drivers/soundwire/qcom.c index f1b8d6ac5140..fe65c26c5281 100644 --- a/drivers/soundwire/qcom.c +++ b/drivers/soundwire/qcom.c @@ -1267,16 +1267,6 @@ static int qcom_swrm_hw_free(struct snd_pcm_substream *substream, return 0; } -static int qcom_swrm_set_sdw_stream(struct snd_soc_dai *dai, - void *stream, int direction) -{ - struct qcom_swrm_ctrl *ctrl = dev_get_drvdata(dai->dev); - - ctrl->sruntime[dai->id] = stream; - - return 0; -} - static void *qcom_swrm_get_sdw_stream(struct snd_soc_dai *dai, int direction) { struct qcom_swrm_ctrl *ctrl = dev_get_drvdata(dai->dev); @@ -1349,7 +1339,6 @@ static const struct snd_soc_dai_ops qcom_swrm_pdm_dai_ops = { .hw_free = qcom_swrm_hw_free, .startup = qcom_swrm_startup, .shutdown = qcom_swrm_shutdown, - .set_stream = qcom_swrm_set_sdw_stream, .get_stream = qcom_swrm_get_sdw_stream, }; From patchwork Wed Oct 25 14:46:00 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 737935 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8F4AAC07545 for ; Wed, 25 Oct 2023 14:46:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235001AbjJYOqa (ORCPT ); Wed, 25 Oct 2023 10:46:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44246 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344192AbjJYOq1 (ORCPT ); Wed, 25 Oct 2023 10:46:27 -0400 Received: from mail-lf1-x12e.google.com (mail-lf1-x12e.google.com [IPv6:2a00:1450:4864:20::12e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 68B451BE for ; Wed, 25 Oct 2023 07:46:12 -0700 (PDT) Received: by mail-lf1-x12e.google.com with SMTP id 2adb3069b0e04-507a62d4788so9080143e87.0 for ; Wed, 25 Oct 2023 07:46:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1698245170; x=1698849970; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=UXAGRRDQU3qBmM4PuKRmO3omKxsrPu1G2pV7PjgXi9w=; b=PMHCUUkvrSK1fb6li3YzbfhtQFF+2mSVW9sqvnHEJ2NsjD/4R5TY2D3PVukGooQgY4 8J/KsbHB5enFa2DAYE7098OvQk1e6rPQYcBZjWd+fx1eOd3+V3+8fXV8QxzuXZX24jU0 bqiCr3YCTIGmyZMqTZCgwkUoHWrkyoTa3qCWMuWh7aN9s1IqDkwBsyM7eLuUzcOx5pxx gjfZHzZEW3fE4mhhwXkKbu7nAAAF8jRlYjbDeuwpp9DiZTqt0Rk8hzLadAVJ3NaA3ZJ0 zxY9YHeNZIhJz85YnpRTv47KrZisUFzLSsSLb5QCei4DuKeEZ7LhR6EGaGQ5d0v0Mzld dmug== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698245170; x=1698849970; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=UXAGRRDQU3qBmM4PuKRmO3omKxsrPu1G2pV7PjgXi9w=; b=IR5LBv6hvuHZHozlNvfpY9y1+C5+eOpZ8LLkyKDjPb+hV04qVrKniSQJnHl5WK6Sps DZ8tKtIvari8wI7XF/kuVlZfvTBI+VaDmOwFJdmAJWlz5EsUBI7Jwx+4Q+eF4H6GRQIz I7HSG19kJH5kmExKzeLZYUKbPwS3lkxroTb4oyaYNI2EY4GVjaGwrV7f3bhfJOf81pZ7 hLJaIeQ/c5tyq/maZID9c3bF3bgXDLd1YtOcb6EV6O/RKgMxi9g0EbMbr7CVPZRJtYnE RK10Un6/SJUq22fLWqNpRkInTDg+T/nVUO60wH07YLhN02ELaNreGq9wIqYJ+4FIUS2R zqFQ== X-Gm-Message-State: AOJu0YzIfhkkXIOj6TR5/mgtaR5ehVlcHlHZpP25hMya9WuffyqO2JHb 839h0hqrjdcM/GSSzFYj+5F+wA== X-Google-Smtp-Source: AGHT+IEm+oG84DNxepaw/B3zgRVBOqJdqjjLvSed6FNsaPOPc1JSYQPpe7VYHi0f4Xg01yt26Oo5fg== X-Received: by 2002:ac2:597a:0:b0:507:9623:8ae8 with SMTP id h26-20020ac2597a000000b0050796238ae8mr11125024lfp.29.1698245169886; Wed, 25 Oct 2023 07:46:09 -0700 (PDT) Received: from krzk-bin.. ([178.197.218.126]) by smtp.gmail.com with ESMTPSA id i1-20020a05600011c100b0032dcb08bf94sm12267138wrx.60.2023.10.25.07.46.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Oct 2023 07:46:09 -0700 (PDT) From: Krzysztof Kozlowski To: Andy Gross , Bjorn Andersson , Konrad Dybcio , Vinod Koul , Bard Liao , Pierre-Louis Bossart , Sanyog Kale , Srinivas Kandagatla , Banajit Goswami , Liam Girdwood , Mark Brown , Jaroslav Kysela , Takashi Iwai , linux-arm-msm@vger.kernel.org, alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org Cc: Krzysztof Kozlowski Subject: [PATCH 2/3] soundwire: qcom: set owner device of runtime stream Date: Wed, 25 Oct 2023 16:46:00 +0200 Message-Id: <20231025144601.268645-2-krzysztof.kozlowski@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231025144601.268645-1-krzysztof.kozlowski@linaro.org> References: <20231025144601.268645-1-krzysztof.kozlowski@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org From: Srinivas Kandagatla Store the pointer to struct device of Soundwire controller owning this runtime stream. This can be later used by Soundwire devices, to check if their DAI prepare callback is called for the same bus, in cases where multiple Soundwire buses are used in same soundcard codec list. Signed-off-by: Srinivas Kandagatla Co-developed-by: Krzysztof Kozlowski Signed-off-by: Krzysztof Kozlowski --- drivers/soundwire/qcom.c | 1 + include/linux/soundwire/sdw.h | 2 ++ 2 files changed, 3 insertions(+) diff --git a/drivers/soundwire/qcom.c b/drivers/soundwire/qcom.c index fe65c26c5281..a95f39563b47 100644 --- a/drivers/soundwire/qcom.c +++ b/drivers/soundwire/qcom.c @@ -1298,6 +1298,7 @@ static int qcom_swrm_startup(struct snd_pcm_substream *substream, goto err_alloc; } + sruntime->dev = ctrl->bus.dev; ctrl->sruntime[dai->id] = sruntime; for_each_rtd_codec_dais(rtd, i, codec_dai) { diff --git a/include/linux/soundwire/sdw.h b/include/linux/soundwire/sdw.h index 4f3d14bb1538..650334adc261 100644 --- a/include/linux/soundwire/sdw.h +++ b/include/linux/soundwire/sdw.h @@ -1023,6 +1023,7 @@ struct sdw_stream_params { * master_list can contain only one m_rt per Master instance * for a stream * @m_rt_count: Count of Master runtime(s) in this stream + * @dev: SoundWire controller owning this runtime stream */ struct sdw_stream_runtime { const char *name; @@ -1031,6 +1032,7 @@ struct sdw_stream_runtime { enum sdw_stream_type type; struct list_head master_list; int m_rt_count; + struct device *dev; }; struct sdw_stream_runtime *sdw_alloc_stream(const char *stream_name); From patchwork Wed Oct 25 14:46:01 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 737934 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E68C9C0032E for ; Wed, 25 Oct 2023 14:47:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343695AbjJYOri (ORCPT ); Wed, 25 Oct 2023 10:47:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44208 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344370AbjJYOq1 (ORCPT ); Wed, 25 Oct 2023 10:46:27 -0400 Received: from mail-wr1-x42f.google.com (mail-wr1-x42f.google.com [IPv6:2a00:1450:4864:20::42f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2680810C6 for ; Wed, 25 Oct 2023 07:46:15 -0700 (PDT) Received: by mail-wr1-x42f.google.com with SMTP id ffacd0b85a97d-31f71b25a99so3810551f8f.2 for ; Wed, 25 Oct 2023 07:46:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1698245173; x=1698849973; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=NSOu9HyrCio0gozoTkpNTmqH+O6Zq1CFoJPsJwIyKFk=; b=ir03GcM4JjTGgpWml7lWgkgK2ckpwILqtIrTm9q4KhyRigpY898RqJJCNES4/vvdTv baHMS4Yxwjul9DkjWn7GdfzeGgzDh0QbHf+Hqs8k86kLI3kdjrpqlEWF4J1cWPCJsy3j OPI7wbOmGUNVKicb97ehJZEkwPH6YmIF0ge4UNNdalYrfEfLiPunPAgsTvyHqwG0whGb k3iUjKepO+B2Dn3jiBObOvy5rEvJIrrn8RSQbS6j+X4ZpTsBcU17smg10bQo4kK/ITbe g7cbBObGQNrfjOkf9YGvH1ODeR+x44gdv79owO56qrZr2hHhol52rIbrJACa7wNmP434 wD8w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698245173; x=1698849973; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=NSOu9HyrCio0gozoTkpNTmqH+O6Zq1CFoJPsJwIyKFk=; b=Sweun3SgZIAXIbr29a3Jl/DqiXhM2qVufLeQajjprBNUa6IykfyTh/SGu7OerwpGl9 4JpfHlC0hs7mfmJhoooAQ1vn1Q2GJWWoZPzJL90t93ErnhXwkt7Vbpm0pffDbk42XBwx qILg7FioEYswtyCzqRuZI4kWPdGl5/9AU9jYP5j58Iq+r+xWvf1gaO2gcQsgcSBJhCYt 8gMqMDvhZw6xMXsK+a95fls/qpgfOb7pRkPiz67pqDlalUQZtM6qdZssjc9j7nDenk/Z KM5Xs+toIsJTA5K5Sd2YKEsJqM6ML5fTVWn4jCDvZe3PsuPJQ8aTXItuwz4QdZPq5lie rWUA== X-Gm-Message-State: AOJu0YzB74KThs3Bw0Tz7zsq5cl1Fa4AnseA31MWd5YhUN91QKglLJC8 nOjLPb/edVzKbcM2nNxwEmUEdw== X-Google-Smtp-Source: AGHT+IEdhXacG3VtzhyUIJTLoFxeWnvtOMaJOeURJsu1+71zwQaYKeffXLMAW2rDPpUPUPrcyoQKDw== X-Received: by 2002:adf:f711:0:b0:32d:b051:9a2b with SMTP id r17-20020adff711000000b0032db0519a2bmr11838769wrp.2.1698245172872; Wed, 25 Oct 2023 07:46:12 -0700 (PDT) Received: from krzk-bin.. ([178.197.218.126]) by smtp.gmail.com with ESMTPSA id i1-20020a05600011c100b0032dcb08bf94sm12267138wrx.60.2023.10.25.07.46.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Oct 2023 07:46:12 -0700 (PDT) From: Krzysztof Kozlowski To: Andy Gross , Bjorn Andersson , Konrad Dybcio , Vinod Koul , Bard Liao , Pierre-Louis Bossart , Sanyog Kale , Srinivas Kandagatla , Banajit Goswami , Liam Girdwood , Mark Brown , Jaroslav Kysela , Takashi Iwai , linux-arm-msm@vger.kernel.org, alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org Cc: Krzysztof Kozlowski Subject: [PATCH 3/3] ASoC: codecs: wsa884x: check if set_stream is called for proper bus Date: Wed, 25 Oct 2023 16:46:01 +0200 Message-Id: <20231025144601.268645-3-krzysztof.kozlowski@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231025144601.268645-1-krzysztof.kozlowski@linaro.org> References: <20231025144601.268645-1-krzysztof.kozlowski@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org From: Srinivas Kandagatla If multiple WSA8840 speakers, from two separate Soundwire buses, are used in one codec DAI link, the set_stream() should ignore calls for setting stream from other Soundwire controller. Signed-off-by: Srinivas Kandagatla Co-developed-by: Krzysztof Kozlowski Signed-off-by: Krzysztof Kozlowski --- sound/soc/codecs/wsa884x.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/sound/soc/codecs/wsa884x.c b/sound/soc/codecs/wsa884x.c index bee6e763c700..91205e8c96f1 100644 --- a/sound/soc/codecs/wsa884x.c +++ b/sound/soc/codecs/wsa884x.c @@ -1775,6 +1775,12 @@ static int wsa884x_set_stream(struct snd_soc_dai *dai, void *stream, int direction) { struct wsa884x_priv *wsa884x = dev_get_drvdata(dai->dev); + struct sdw_stream_runtime *sruntime = stream; + struct sdw_slave *sdw = dev_to_sdw_dev(dai->dev); + + /* Check if this belongs to same bus */ + if (sdw->bus->dev != sruntime->dev) + return 0; wsa884x->sruntime = stream;