From: Vinod Koul <vkoul@kernel.org>
To: Bard Liao <yung-chuan.liao@linux.intel.com>
Cc: pierre-louis.bossart@linux.intel.com,
alsa-devel@alsa-project.org, tiwai@suse.de,
gregkh@linuxfoundation.org, linux-kernel@vger.kernel.org,
ranjani.sridharan@linux.intel.com, hui.wang@canonical.com,
broonie@kernel.org, srinivas.kandagatla@linaro.org,
jank@cadence.com, mengdong.lin@intel.com,
slawomir.blauciak@intel.com, sanyog.r.kale@intel.com,
rander.wang@linux.intel.com, bard.liao@intel.com
Subject: Re: [PATCH 2/5] soundwire: stream: add helper to startup/shutdown streams
Date: Tue, 30 Jun 2020 21:33:49 +0530 [thread overview]
Message-ID: <20200630160349.GR2599@vkoul-mobl> (raw)
In-Reply-To: <20200622212332.16277-3-yung-chuan.liao@linux.intel.com>
On 23-06-20, 05:23, Bard Liao wrote:
> From: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
>
> To handle streams at the dailink level, expose two helpers that will
> be called from machine drivers.
>
> Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
> Reviewed-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
> Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
> Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
> Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
> ---
> drivers/soundwire/stream.c | 90 +++++++++++++++++++++++++++++++++++
> include/linux/soundwire/sdw.h | 2 +
> 2 files changed, 92 insertions(+)
>
> diff --git a/drivers/soundwire/stream.c b/drivers/soundwire/stream.c
> index a9a72574b34a..48daf4b48f51 100644
> --- a/drivers/soundwire/stream.c
> +++ b/drivers/soundwire/stream.c
> @@ -13,6 +13,9 @@
> #include <linux/slab.h>
> #include <linux/soundwire/sdw_registers.h>
> #include <linux/soundwire/sdw.h>
> +#include <sound/core.h>
Do we really need core header?
> +#include <sound/pcm.h>
> +#include <sound/soc.h>
> #include "bus.h"
>
> /*
> @@ -1826,3 +1829,90 @@ int sdw_deprepare_stream(struct sdw_stream_runtime *stream)
> return ret;
> }
> EXPORT_SYMBOL(sdw_deprepare_stream);
> +
> +static int set_stream(struct snd_pcm_substream *substream,
> + struct sdw_stream_runtime *sdw_stream)
sdw_set_stream() please
> +{
> + struct snd_soc_pcm_runtime *rtd = substream->private_data;
> + struct snd_soc_dai *dai;
> + int ret = 0;
> + int i;
> +
> + /* Set stream pointer on all DAIs */
> + for_each_rtd_dais(rtd, i, dai) {
> + ret = snd_soc_dai_set_sdw_stream(dai, sdw_stream,
> + substream->stream);
> + if (ret < 0) {
> + dev_err(rtd->dev,
> + "failed to set stream pointer on dai %s",
> + dai->name);
lets use one line and shiny new 100 char limit, would make code read
better!
> + break;
So on error should unset of stream pointer be done?
> + }
> + }
> +
> + return ret;
> +}
> +
> +int sdw_startup_stream(void *sdw_substream)
Can we have kernel doc style Documentation for exported APIs?
> +{
> + struct snd_pcm_substream *substream = sdw_substream;
> + struct snd_soc_pcm_runtime *rtd = substream->private_data;
> + struct sdw_stream_runtime *sdw_stream;
> + char *name;
> + int ret;
> +
> + if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
> + name = kasprintf(GFP_KERNEL, "%s-Playback", substream->name);
> + else
> + name = kasprintf(GFP_KERNEL, "%s-Capture", substream->name);
> +
> + if (!name)
> + return -ENOMEM;
> +
> + sdw_stream = sdw_alloc_stream(name);
> + if (!sdw_stream) {
> + dev_err(rtd->dev, "alloc stream failed for substream DAI %s",
> + substream->name);
> + ret = -ENOMEM;
> + goto error;
> + }
> +
> + ret = set_stream(substream, sdw_stream);
> + if (ret < 0)
> + goto release_stream;
> + return 0;
> +
> +release_stream:
> + sdw_release_stream(sdw_stream);
> + set_stream(substream, NULL);
> +error:
> + kfree(name);
> + return ret;
> +}
> +EXPORT_SYMBOL(sdw_startup_stream);
--
~Vinod
next prev parent reply other threads:[~2020-06-30 16:04 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-06-22 21:23 [PATCH 0/5] soundwire: handle stream at the dailink level Bard Liao
2020-06-22 21:23 ` [PATCH 1/5] soundwire: intel: implement get_sdw_stream() operations Bard Liao
2020-06-22 21:23 ` [PATCH 2/5] soundwire: stream: add helper to startup/shutdown streams Bard Liao
2020-06-30 16:03 ` Vinod Koul [this message]
2020-06-30 16:58 ` Pierre-Louis Bossart
2020-07-01 5:39 ` Vinod Koul
2020-06-22 21:23 ` [PATCH 3/5] soundwire: intel: remove stream allocation/free Bard Liao
2020-06-22 21:23 ` [PATCH 4/5] soundwire: cadence: allocate/free dma_data in set_sdw_stream Bard Liao
2020-06-22 21:23 ` [PATCH 5/5] soundwire: intel: don't free dma_data in DAI shutdown Bard Liao
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=20200630160349.GR2599@vkoul-mobl \
--to=vkoul@kernel.org \
--cc=alsa-devel@alsa-project.org \
--cc=bard.liao@intel.com \
--cc=broonie@kernel.org \
--cc=gregkh@linuxfoundation.org \
--cc=hui.wang@canonical.com \
--cc=jank@cadence.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mengdong.lin@intel.com \
--cc=pierre-louis.bossart@linux.intel.com \
--cc=rander.wang@linux.intel.com \
--cc=ranjani.sridharan@linux.intel.com \
--cc=sanyog.r.kale@intel.com \
--cc=slawomir.blauciak@intel.com \
--cc=srinivas.kandagatla@linaro.org \
--cc=tiwai@suse.de \
--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