public inbox for linux-sound@vger.kernel.org
 help / color / mirror / Atom feed
From: Vinod Koul <vkoul@kernel.org>
To: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Cc: linux-sound@vger.kernel.org, alsa-devel@alsa-project.org,
	tiwai@suse.de, broonie@kernel.org, vinod.koul@intel.com,
	Bard liao <yung-chuan.liao@linux.intel.com>,
	Ranjani Sridharan <ranjani.sridharan@linux.intel.com>,
	Peter Ujfalusi <peter.ujfalusi@linux.intel.com>,
	Kai Vehmanen <kai.vehmanen@linux.intel.com>,
	srinivas.kandagatla@linaro.org,
	Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>,
	vijendar.mukunda@amd.com,
	Charles Keepax <ckeepax@opensource.cirrus.com>,
	Richard Fitzgerald <rf@opensource.cirrus.com>,
	Shuming Fan <shumingf@realtek.com>, Jack Yu <jack.yu@realtek.com>,
	Oder Chiou <oder_chiou@realtek.com>
Subject: Re: [RFC PATCH 01/16] Documentation: driver: add SoundWire BRA description
Date: Mon, 18 Dec 2023 17:10:16 +0530	[thread overview]
Message-ID: <ZYAvoFbEP8RH_x0Y@matsya> (raw)
In-Reply-To: <20231207222944.663893-2-pierre-louis.bossart@linux.intel.com>

Hi Pierre,

On 07-12-23, 16:29, Pierre-Louis Bossart wrote:
> The Bulk Register Access protocol was left as a TODO topic since
> 2018. It's time to document this protocol and the design of its Linux
> support.

Thanks for letting me know about this thread. At least now with B4 we
can grab threads we are not copied.

> 
> Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
> ---
>  Documentation/driver-api/soundwire/bra.rst    | 478 ++++++++++++++++++

Can we split the cadence parts of this to bra-cadence.rst that way this
file documents the core parts only

> +Concurrency between BRA and regular read/write
> +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> +
> +The existing 'nread/nwrite' API already relies on a notion of start
> +address and number of bytes, so it would be possible to extend this
> +API with a 'hint' requesting BPT/BRA be used.
> +
> +However BRA transfers could be quite long, and the use of a single
> +mutex for regular read/write and BRA is a show-stopper. Independent
> +operation of the control/command and BRA transfers is a fundamental
> +requirement, e.g. to change the volume level with the existing regmap
> +interface while downloading firmware.
> +
> +This places the burden on the codec driver to verify that there is no
> +concurrent access to the same address with the command/control
> +protocol and the BRA protocol.
> +
> +In addition, the 'sdw_msg' structure hard-codes support for 16-bit
> +addresses and paging registers which are irrelevant for BPT/BRA
> +support based on native 32-bit addresses. A separate API with
> +'sdw_bpt_msg' makes more sense.
> +
> +One possible strategy to speed-up all initialization tasks would be to
> +start a BRA transfer for firmware download, then deal with all the
> +"regular" read/writes in parallel with the command channel, and last
> +to wait for the BRA transfers to complete. This would allow for a
> +degree of overlap instead of a purely sequential solution. As a
> +results, the BRA API must support async transfers and expose a
> +separate wait function.

That sounds logical to me

> +
> +Error handling
> +~~~~~~~~~~~~~~
> +
> +The expected response to a 'bra_message' and follow-up behavior may
> +vary:
> +
> +   (1) A Peripheral driver may want to receive an immediate -EBUSY
> +       response if the BRA protocol is not available at a given time.
> +
> +   (2) A Peripheral driver may want to wait until a timeout for the
> +       on-going transfer to be handled
> +
> +   (3) A Peripheral driver may want to wait until existing BRA
> +       transfers complete or deal with BRA as a background task when
> +       audio transfers stop. In this case, there would be no timeout,
> +       and the operation may not happen if the platform is suspended.

Is this runtime suspend or S3/S4 case?

> +BTP/BRA API available to peripheral drivers
> +-------------------------------------------
> +
> +ASoC Peripheral drivers may use
> +
> +   - sdw_bpt_stream_open(mode)
> +
> +      This function verifies that the BPT protocol with the
> +      'mode'. For now only BRA is accepted as a mode. This function
> +      allocates a work buffer internally. This buffer is not exposed
> +      to the caller.
> +
> +     errors:
> +         -ENODEV: BPT/BRA is not supported by the Manager.
> +
> +         -EBUSY: another agent is already using the audio payload for
> +          audio transfers. There is no way to predict when the audio
> +          streams might stop, this will require the Peripheral driver
> +          to fall back to the regular (slow) command channel.
> +
> +         -EAGAIN: another agent is already transferring data using the
> +          BPT/BRA protocol. Since the transfers will typically last
> +          10s or 100s of ms, the Peripheral driver may wait and retry
> +          later.
> +
> +    - sdw_bpt_message_send_async(bpt_message)

why not have a single API that does both? First check if it is supported
and then allocate buffers and do the transfer.. What are the advantages
of using this two step process

-- 
~Vinod

  parent reply	other threads:[~2023-12-18 11:40 UTC|newest]

Thread overview: 61+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-07 22:29 [RFC PATCH 00/16] soundwire/ASoC: speed-up downloads with BTP/BRA protocol Pierre-Louis Bossart
2023-12-07 22:29 ` [RFC PATCH 01/16] Documentation: driver: add SoundWire BRA description Pierre-Louis Bossart
2023-12-07 23:29   ` Mark Brown
2023-12-08  0:56     ` Pierre-Louis Bossart
2023-12-08 21:49       ` Mark Brown
2023-12-19 16:50         ` Pierre-Louis Bossart
2023-12-19 16:53           ` Mark Brown
2023-12-19 17:08             ` Pierre-Louis Bossart
2023-12-20 15:16               ` Charles Keepax
2023-12-20 18:26                 ` Pierre-Louis Bossart
2023-12-20 18:28                   ` Mark Brown
2023-12-21  9:46                   ` Charles Keepax
2024-08-20  7:48     ` Pierre-Louis Bossart
2024-08-20 11:53       ` Mark Brown
2024-08-20 14:58         ` Pierre-Louis Bossart
2024-08-20 15:09           ` Mark Brown
2023-12-08 16:27   ` Charles Keepax
2023-12-08 18:45     ` Pierre-Louis Bossart
2023-12-08 18:55       ` Mark Brown
2023-12-18 11:40   ` Vinod Koul [this message]
2023-12-18 12:58     ` Pierre-Louis Bossart
2023-12-18 14:29       ` Charles Keepax
2023-12-18 16:33         ` Pierre-Louis Bossart
2023-12-21 14:45           ` Vinod Koul
2023-12-21 14:44         ` Vinod Koul
2023-12-21 14:44       ` Vinod Koul
2023-12-07 22:29 ` [RFC PATCH 02/16] soundwire: cadence: add BTP support for DP0 Pierre-Louis Bossart
2023-12-07 22:29 ` [RFC PATCH 03/16] soundwire: stream: extend sdw_alloc_stream() to take 'type' parameter Pierre-Louis Bossart
2023-12-07 22:29 ` [RFC PATCH 04/16] soundwire: extend sdw_stream_type to BPT Pierre-Louis Bossart
2023-12-07 22:29 ` [RFC PATCH 05/16] soundwire: stream: special-case the bus compute_params() routine Pierre-Louis Bossart
2023-12-07 22:29 ` [RFC PATCH 06/16] soundwire: stream: reuse existing code for BPT stream Pierre-Louis Bossart
2023-12-12 12:30   ` Charles Keepax
2023-12-18 10:45     ` Pierre-Louis Bossart
2023-12-07 22:29 ` [RFC PATCH 07/16] soundwire: bus: add API for BPT protocol Pierre-Louis Bossart
2023-12-12 12:19   ` Charles Keepax
2023-12-18 10:38     ` Pierre-Louis Bossart
2023-12-18 11:54   ` Vinod Koul
2023-12-18 13:12     ` Pierre-Louis Bossart
2023-12-18 14:57       ` Charles Keepax
2023-12-18 16:44         ` Pierre-Louis Bossart
2023-12-21 14:49       ` Vinod Koul
2023-12-07 22:29 ` [RFC PATCH 08/16] soundwire: bus: add bpt_stream pointer Pierre-Louis Bossart
2023-12-18 11:55   ` Vinod Koul
2023-12-18 13:20     ` Pierre-Louis Bossart
2023-12-21 14:39       ` Vinod Koul
2023-12-21 17:09         ` Pierre-Louis Bossart
2023-12-07 22:29 ` [RFC PATCH 09/16] soundwire: crc8: add constant table Pierre-Louis Bossart
2023-12-18 12:01   ` Vinod Koul
2023-12-18 13:26     ` Pierre-Louis Bossart
2023-12-21 14:42       ` Vinod Koul
2023-12-21 17:15         ` Pierre-Louis Bossart
2023-12-21 17:21           ` Vinod Koul
2023-12-07 22:29 ` [RFC PATCH 10/16] soundwire: cadence: add BTP/BRA helpers to format data Pierre-Louis Bossart
2023-12-07 22:29 ` [RFC PATCH 11/16] soundwire: intel_auxdevice: add indirection for BPT open/close/send_async/wait Pierre-Louis Bossart
2023-12-07 22:29 ` [RFC PATCH 12/16] ASoC: SOF: Intel: hda-sdw-bpt: add helpers for SoundWire BPT DMA Pierre-Louis Bossart
2023-12-07 22:29 ` [RFC PATCH 13/16] soundwire: intel: add BPT context definition Pierre-Louis Bossart
2023-12-07 22:29 ` [RFC PATCH 14/16] soundwire: intel_ace2x: add BPT open/close/send_async/wait Pierre-Louis Bossart
2023-12-07 22:29 ` [RFC PATCH 15/16] soundwire: debugfs: add interface for BPT/BRA transfers Pierre-Louis Bossart
2023-12-07 22:29 ` [RFC PATCH 16/16] ASoC: rt711-sdca: add DP0 support Pierre-Louis Bossart
2023-12-07 22:56 ` [RFC PATCH 00/16] soundwire/ASoC: speed-up downloads with BTP/BRA protocol Mark Brown
2023-12-07 23:06   ` Pierre-Louis Bossart

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ZYAvoFbEP8RH_x0Y@matsya \
    --to=vkoul@kernel.org \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --cc=ckeepax@opensource.cirrus.com \
    --cc=jack.yu@realtek.com \
    --cc=kai.vehmanen@linux.intel.com \
    --cc=krzysztof.kozlowski@linaro.org \
    --cc=linux-sound@vger.kernel.org \
    --cc=oder_chiou@realtek.com \
    --cc=peter.ujfalusi@linux.intel.com \
    --cc=pierre-louis.bossart@linux.intel.com \
    --cc=ranjani.sridharan@linux.intel.com \
    --cc=rf@opensource.cirrus.com \
    --cc=shumingf@realtek.com \
    --cc=srinivas.kandagatla@linaro.org \
    --cc=tiwai@suse.de \
    --cc=vijendar.mukunda@amd.com \
    --cc=vinod.koul@intel.com \
    --cc=yung-chuan.liao@linux.intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox