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 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 smtp.lore.kernel.org (Postfix) with ESMTPS id EC385C4167B for ; Tue, 28 Nov 2023 17:55:17 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id DD45ADF6; Tue, 28 Nov 2023 18:55:00 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz DD45ADF6 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1701194110; bh=qIrihs3bgqghpQQf+Q4tySVJ/cFlr64il/GtOmU5bi4=; h=Date:Subject:To:Cc:References:From:In-Reply-To:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=KzipA28TQyt/E84pEIXyJaj7Eh2CrFs9cxp2gVNIE/beKjTyJcsct1MhDqjqlb8Nm ly2j5iWHzEoQvDJHREEwUsE93hoRdcWbkxSekhSZATKgN/hf+KRn8zGY91STnuw4JJ F3V1JhCSDauXEDoWsYxyBZ9C7XpStRACy0LwMFm8= Received: by alsa1.perex.cz (Postfix, from userid 50401) id DCCD3F805E3; Tue, 28 Nov 2023 18:54:13 +0100 (CET) Received: from mailman-core.alsa-project.org (mailman-core.alsa-project.org [10.254.200.10]) by alsa1.perex.cz (Postfix) with ESMTP id 67C61F805EF; Tue, 28 Nov 2023 18:54:12 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 6DA2FF805A9; Tue, 28 Nov 2023 18:54:08 +0100 (CET) Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.88]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 0CBD8F80104 for ; Tue, 28 Nov 2023 18:54:00 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 0CBD8F80104 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key, unprotected) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=Z5TXnyoF DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1701194042; x=1732730042; h=message-id:date:mime-version:subject:to:cc:references: from:in-reply-to:content-transfer-encoding; bh=qIrihs3bgqghpQQf+Q4tySVJ/cFlr64il/GtOmU5bi4=; b=Z5TXnyoFbMB7KG14mea7mRYUlIEc0OxdUeqr5G/x1qEoSF2UbFUknvD3 cGntYD/h7i+oxCwye0Mvp/4VTGA3gFEYrFX2slbgEdGpqkV93Yt95xIC9 V2DTDPCKQwkYQySp26tw47iGSU1cVXqIuSqv/iHsRWZRC6IWGx4bik/SN c5h7mjjIk2buNnBGPwYzFRK1sN7ieU+onySXgESkBQPR76None84aKnnT ewRPwHK2G+76Hs1fYoANv1SIK74gNrUj5zaIYnvmOSUEIsCYdRIup54Y0 SFDE2sLbPsX0TU/FXjqbJpmq3A/5ayfIgkFjSLWcyALBj5anD6Q+Y4vQg A==; X-IronPort-AV: E=McAfee;i="6600,9927,10908"; a="424127086" X-IronPort-AV: E=Sophos;i="6.04,234,1695711600"; d="scan'208";a="424127086" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 28 Nov 2023 09:53:57 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10908"; a="834715306" X-IronPort-AV: E=Sophos;i="6.04,234,1695711600"; d="scan'208";a="834715306" Received: from skumarso-mobl33.amr.corp.intel.com (HELO [10.255.231.208]) ([10.255.231.208]) by fmsmga008-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 28 Nov 2023 09:53:56 -0800 Message-ID: Date: Tue, 28 Nov 2023 09:35:56 -0600 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] soundwire: qcom: allow multi-link on newer devices Content-Language: en-US To: Krzysztof Kozlowski , Andy Gross , Bjorn Andersson , Konrad Dybcio , Vinod Koul , Bard Liao , Sanyog Kale , linux-arm-msm@vger.kernel.org, alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org Cc: Mark Brown References: <20231128150049.412236-1-krzysztof.kozlowski@linaro.org> From: Pierre-Louis Bossart In-Reply-To: <20231128150049.412236-1-krzysztof.kozlowski@linaro.org> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Message-ID-Hash: 5YIIS5M4CNVNRED5EYGMFN5C6GAIXCGC X-Message-ID-Hash: 5YIIS5M4CNVNRED5EYGMFN5C6GAIXCGC X-MailFrom: pierre-louis.bossart@linux.intel.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-alsa-devel.alsa-project.org-0; header-match-alsa-devel.alsa-project.org-1; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.9 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: On 11/28/23 09:00, Krzysztof Kozlowski wrote: > Newer Qualcomm SoCs like X1E80100 might come with four speakers spread > over two Soundwire controllers, thus they need a multi-link Soundwire > stream runtime. > > Cc: Mark Brown > Cc: alsa-devel@alsa-project.org > Signed-off-by: Krzysztof Kozlowski > > --- > > This is an entirely different approach than my previous try here: > https://lore.kernel.org/all/20231025144601.268645-1-krzysztof.kozlowski@linaro.org/ > --- > drivers/soundwire/qcom.c | 22 ++++++++++++++++++++++ > 1 file changed, 22 insertions(+) > > diff --git a/drivers/soundwire/qcom.c b/drivers/soundwire/qcom.c > index 412b8e663a0a..57943724f0eb 100644 > --- a/drivers/soundwire/qcom.c > +++ b/drivers/soundwire/qcom.c > @@ -920,6 +920,18 @@ static int qcom_swrm_init(struct qcom_swrm_ctrl *ctrl) > return 0; > } > > +static int qcom_swrm_read_prop(struct sdw_bus *bus) > +{ > + struct qcom_swrm_ctrl *ctrl = to_qcom_sdw(bus); > + > + if (ctrl->version >= SWRM_VERSION_2_0_0) { > + bus->multi_link = true; > + bus->hw_sync_min_links = 3; > + } > + > + return 0; > +} > + > static enum sdw_command_response qcom_swrm_xfer_msg(struct sdw_bus *bus, > struct sdw_msg *msg) > { > @@ -1078,6 +1090,7 @@ static const struct sdw_master_port_ops qcom_swrm_port_ops = { > }; > > static const struct sdw_master_ops qcom_swrm_ops = { > + .read_prop = qcom_swrm_read_prop, nit-pick: read_prop() literally means "read platform properties". The functionality implemented in this callback looks more like an initialization done in a probe, no? > .xfer_msg = qcom_swrm_xfer_msg, > .pre_bank_switch = qcom_swrm_pre_bank_switch, > .post_bank_switch = qcom_swrm_post_bank_switch, > @@ -1196,6 +1209,15 @@ static int qcom_swrm_stream_alloc_ports(struct qcom_swrm_ctrl *ctrl, > > mutex_lock(&ctrl->port_lock); > list_for_each_entry(m_rt, &stream->master_list, stream_node) { just realizing this now, are you sure the 'port_lock' is the proper means to protecting the stream->master_list? I don't see this used anywhere else in stream.c. I think you need to use bus_lock. > + /* > + * For streams with multiple masters: > + * Allocate ports only for devices connected to this master. > + * Such devices will have ports allocated by their own master > + * and its qcom_swrm_stream_alloc_ports() call. > + */ > + if (ctrl->bus.id != m_rt->bus->id) > + continue; > + > if (m_rt->direction == SDW_DATA_DIR_RX) { > maxport = ctrl->num_dout_ports; > port_mask = &ctrl->dout_port_mask;