From: Tobias Klauser <tklauser-93Khv+1bN0NyDzI6CaY1VQ@public.gmane.org>
To: Nicolin Chen <nicoleotsuka-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Cc: broonie-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org,
shawn.guo-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org,
robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org,
pawel.moll-5wv7dgnIgG8@public.gmane.org,
mark.rutland-5wv7dgnIgG8@public.gmane.org,
ijc+devicetree-KcIKpvwj1kUDXYZnReoRVg@public.gmane.org,
galak-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org,
rdunlap-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org,
lgirdwood-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org,
perex-/Fr2/VpizcU@public.gmane.org,
tiwai-l3A5Bk7waGM@public.gmane.org,
timur-N01EOCouUvQ@public.gmane.org,
grant.likely-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org,
devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
alsa-devel-K7yf7f+aM1XWsZ/bQMPhNw@public.gmane.org,
linuxppc-dev-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org,
b02247-KZfg59tc24xl57MIdRCFDg@public.gmane.org,
b42378-KZfg59tc24xl57MIdRCFDg@public.gmane.org
Subject: Re: [PATCH v2 2/2] ASoC: fsl_asrc: Add ASRC ASoC CPU DAI and platform drivers
Date: Thu, 24 Jul 2014 17:20:45 +0200 [thread overview]
Message-ID: <20140724152045.GA3384@distanz.ch> (raw)
In-Reply-To: <2c74a11776ffcc017c80dc31be4a8313755be8f5.1406189745.git.nicoleotsuka-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
On 2014-07-24 at 10:35:29 +0200, Nicolin Chen <nicoleotsuka-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
> The Asynchronous Sample Rate Converter (ASRC) converts the sampling rate of a
> signal associated with an input clock into a signal associated with a different
> output clock. The driver currently works as a Front End of DPCM with other Back
> Ends DAI links such as ESAI<->CS42888 and SSI<->WM8962 and SAI. It converts the
> original sample rate to a common rate supported by Back Ends for playback while
> converts the common rate of Back Ends to a desired rate for capture. It has 3
> pairs to support three different substreams within totally 10 channels.
>
> Signed-off-by: Nicolin Chen <nicoleotsuka-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
> ---
[...]
> --- /dev/null
> +++ b/sound/soc/fsl/fsl_asrc.c
> @@ -0,0 +1,1031 @@
[...]
> +static struct platform_driver fsl_asrc_driver = {
> + .probe = fsl_asrc_probe,
> + .driver = {
> + .name = "fsl-asrc",
> + .owner = THIS_MODULE,
Not necessary, this will be set by module_platform_driver (or
the expansion of platform_driver_register, respectively).
> + .of_match_table = fsl_asrc_ids,
> + .pm = &fsl_asrc_pm,
> + },
> +};
> +module_platform_driver(fsl_asrc_driver);
[...]
> --- /dev/null
> +++ b/sound/soc/fsl/fsl_asrc_dma.c
> @@ -0,0 +1,384 @@
[...]
> +static int fsl_asrc_dma_pcm_new(struct snd_soc_pcm_runtime *rtd)
> +{
> + struct snd_card *card = rtd->card->snd_card;
> + struct snd_pcm_substream *substream;
> + struct snd_pcm *pcm = rtd->pcm;
> + u64 dma_mask = DMA_BIT_MASK(32);
> + int ret, i;
> +
> + if (!card->dev->dma_mask)
> + card->dev->dma_mask = &dma_mask;
dma_mask will go out of scope after fsl_asrc_dma_pcm_new returns,
resulting in a stray pointer in card->dev->dma_mask.
> + if (!card->dev->coherent_dma_mask)
> + card->dev->coherent_dma_mask = DMA_BIT_MASK(32);
> +
> + for (i = SNDRV_PCM_STREAM_PLAYBACK; i <= SNDRV_PCM_STREAM_LAST; i++) {
> + substream = pcm->streams[i].substream;
> +
> + ret = snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV, pcm->card->dev,
> + FSL_ASRC_DMABUF_SIZE, &substream->dma_buffer);
> + if (ret) {
> + dev_err(card->dev, "failed to allocate DMA buffer\n");
> + goto err;
> + }
> + }
> +
> + return 0;
> +
> +err:
> + if (--i == 0)
> + snd_dma_free_pages(&pcm->streams[i].substream->dma_buffer);
> +
> + return ret;
> +}
> +
> +static void fsl_asrc_dma_pcm_free(struct snd_pcm *pcm)
> +{
> + struct snd_pcm_substream *substream;
> + int i;
> +
> + for (i = SNDRV_PCM_STREAM_PLAYBACK; i <= SNDRV_PCM_STREAM_LAST; i++) {
> + substream = pcm->streams[i].substream;
> + if (!substream)
> + continue;
> +
> + snd_dma_free_pages(&substream->dma_buffer);
> + substream->dma_buffer.area = NULL;
> + substream->dma_buffer.addr = 0;
> + }
> +}
> +
> +struct snd_soc_platform_driver fsl_asrc_platform = {
> + .ops = &fsl_asrc_dma_pcm_ops,
> + .pcm_new = fsl_asrc_dma_pcm_new,
> + .pcm_free = fsl_asrc_dma_pcm_free,
> +};
> +EXPORT_SYMBOL_GPL(fsl_asrc_platform);
> --
> 1.8.4
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
WARNING: multiple messages have this Message-ID (diff)
From: Tobias Klauser <tklauser@distanz.ch>
To: Nicolin Chen <nicoleotsuka@gmail.com>
Cc: mark.rutland@arm.com, devicetree@vger.kernel.org,
alsa-devel@alsa-project.org, b42378@freescale.com,
timur@tabi.org, pawel.moll@arm.com,
ijc+devicetree@hellion.org.uk, tiwai@suse.de,
linux-kernel@vger.kernel.org, rdunlap@infradead.org,
b02247@freescale.com, lgirdwood@gmail.com, robh+dt@kernel.org,
perex@perex.cz, broonie@kernel.org, galak@codeaurora.org,
grant.likely@linaro.org, shawn.guo@linaro.org,
linuxppc-dev@lists.ozlabs.org
Subject: Re: [PATCH v2 2/2] ASoC: fsl_asrc: Add ASRC ASoC CPU DAI and platform drivers
Date: Thu, 24 Jul 2014 17:20:45 +0200 [thread overview]
Message-ID: <20140724152045.GA3384@distanz.ch> (raw)
In-Reply-To: <2c74a11776ffcc017c80dc31be4a8313755be8f5.1406189745.git.nicoleotsuka@gmail.com>
On 2014-07-24 at 10:35:29 +0200, Nicolin Chen <nicoleotsuka@gmail.com> wrote:
> The Asynchronous Sample Rate Converter (ASRC) converts the sampling rate of a
> signal associated with an input clock into a signal associated with a different
> output clock. The driver currently works as a Front End of DPCM with other Back
> Ends DAI links such as ESAI<->CS42888 and SSI<->WM8962 and SAI. It converts the
> original sample rate to a common rate supported by Back Ends for playback while
> converts the common rate of Back Ends to a desired rate for capture. It has 3
> pairs to support three different substreams within totally 10 channels.
>
> Signed-off-by: Nicolin Chen <nicoleotsuka@gmail.com>
> ---
[...]
> --- /dev/null
> +++ b/sound/soc/fsl/fsl_asrc.c
> @@ -0,0 +1,1031 @@
[...]
> +static struct platform_driver fsl_asrc_driver = {
> + .probe = fsl_asrc_probe,
> + .driver = {
> + .name = "fsl-asrc",
> + .owner = THIS_MODULE,
Not necessary, this will be set by module_platform_driver (or
the expansion of platform_driver_register, respectively).
> + .of_match_table = fsl_asrc_ids,
> + .pm = &fsl_asrc_pm,
> + },
> +};
> +module_platform_driver(fsl_asrc_driver);
[...]
> --- /dev/null
> +++ b/sound/soc/fsl/fsl_asrc_dma.c
> @@ -0,0 +1,384 @@
[...]
> +static int fsl_asrc_dma_pcm_new(struct snd_soc_pcm_runtime *rtd)
> +{
> + struct snd_card *card = rtd->card->snd_card;
> + struct snd_pcm_substream *substream;
> + struct snd_pcm *pcm = rtd->pcm;
> + u64 dma_mask = DMA_BIT_MASK(32);
> + int ret, i;
> +
> + if (!card->dev->dma_mask)
> + card->dev->dma_mask = &dma_mask;
dma_mask will go out of scope after fsl_asrc_dma_pcm_new returns,
resulting in a stray pointer in card->dev->dma_mask.
> + if (!card->dev->coherent_dma_mask)
> + card->dev->coherent_dma_mask = DMA_BIT_MASK(32);
> +
> + for (i = SNDRV_PCM_STREAM_PLAYBACK; i <= SNDRV_PCM_STREAM_LAST; i++) {
> + substream = pcm->streams[i].substream;
> +
> + ret = snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV, pcm->card->dev,
> + FSL_ASRC_DMABUF_SIZE, &substream->dma_buffer);
> + if (ret) {
> + dev_err(card->dev, "failed to allocate DMA buffer\n");
> + goto err;
> + }
> + }
> +
> + return 0;
> +
> +err:
> + if (--i == 0)
> + snd_dma_free_pages(&pcm->streams[i].substream->dma_buffer);
> +
> + return ret;
> +}
> +
> +static void fsl_asrc_dma_pcm_free(struct snd_pcm *pcm)
> +{
> + struct snd_pcm_substream *substream;
> + int i;
> +
> + for (i = SNDRV_PCM_STREAM_PLAYBACK; i <= SNDRV_PCM_STREAM_LAST; i++) {
> + substream = pcm->streams[i].substream;
> + if (!substream)
> + continue;
> +
> + snd_dma_free_pages(&substream->dma_buffer);
> + substream->dma_buffer.area = NULL;
> + substream->dma_buffer.addr = 0;
> + }
> +}
> +
> +struct snd_soc_platform_driver fsl_asrc_platform = {
> + .ops = &fsl_asrc_dma_pcm_ops,
> + .pcm_new = fsl_asrc_dma_pcm_new,
> + .pcm_free = fsl_asrc_dma_pcm_free,
> +};
> +EXPORT_SYMBOL_GPL(fsl_asrc_platform);
> --
> 1.8.4
WARNING: multiple messages have this Message-ID (diff)
From: Tobias Klauser <tklauser@distanz.ch>
To: Nicolin Chen <nicoleotsuka@gmail.com>
Cc: broonie@kernel.org, shawn.guo@linaro.org, robh+dt@kernel.org,
pawel.moll@arm.com, mark.rutland@arm.com,
ijc+devicetree@hellion.org.uk, galak@codeaurora.org,
rdunlap@infradead.org, lgirdwood@gmail.com, perex@perex.cz,
tiwai@suse.de, timur@tabi.org, grant.likely@linaro.org,
devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
alsa-devel@alsa-project.org, linuxppc-dev@lists.ozlabs.org,
b02247@freescale.com, b42378@freescale.com
Subject: Re: [PATCH v2 2/2] ASoC: fsl_asrc: Add ASRC ASoC CPU DAI and platform drivers
Date: Thu, 24 Jul 2014 17:20:45 +0200 [thread overview]
Message-ID: <20140724152045.GA3384@distanz.ch> (raw)
In-Reply-To: <2c74a11776ffcc017c80dc31be4a8313755be8f5.1406189745.git.nicoleotsuka@gmail.com>
On 2014-07-24 at 10:35:29 +0200, Nicolin Chen <nicoleotsuka@gmail.com> wrote:
> The Asynchronous Sample Rate Converter (ASRC) converts the sampling rate of a
> signal associated with an input clock into a signal associated with a different
> output clock. The driver currently works as a Front End of DPCM with other Back
> Ends DAI links such as ESAI<->CS42888 and SSI<->WM8962 and SAI. It converts the
> original sample rate to a common rate supported by Back Ends for playback while
> converts the common rate of Back Ends to a desired rate for capture. It has 3
> pairs to support three different substreams within totally 10 channels.
>
> Signed-off-by: Nicolin Chen <nicoleotsuka@gmail.com>
> ---
[...]
> --- /dev/null
> +++ b/sound/soc/fsl/fsl_asrc.c
> @@ -0,0 +1,1031 @@
[...]
> +static struct platform_driver fsl_asrc_driver = {
> + .probe = fsl_asrc_probe,
> + .driver = {
> + .name = "fsl-asrc",
> + .owner = THIS_MODULE,
Not necessary, this will be set by module_platform_driver (or
the expansion of platform_driver_register, respectively).
> + .of_match_table = fsl_asrc_ids,
> + .pm = &fsl_asrc_pm,
> + },
> +};
> +module_platform_driver(fsl_asrc_driver);
[...]
> --- /dev/null
> +++ b/sound/soc/fsl/fsl_asrc_dma.c
> @@ -0,0 +1,384 @@
[...]
> +static int fsl_asrc_dma_pcm_new(struct snd_soc_pcm_runtime *rtd)
> +{
> + struct snd_card *card = rtd->card->snd_card;
> + struct snd_pcm_substream *substream;
> + struct snd_pcm *pcm = rtd->pcm;
> + u64 dma_mask = DMA_BIT_MASK(32);
> + int ret, i;
> +
> + if (!card->dev->dma_mask)
> + card->dev->dma_mask = &dma_mask;
dma_mask will go out of scope after fsl_asrc_dma_pcm_new returns,
resulting in a stray pointer in card->dev->dma_mask.
> + if (!card->dev->coherent_dma_mask)
> + card->dev->coherent_dma_mask = DMA_BIT_MASK(32);
> +
> + for (i = SNDRV_PCM_STREAM_PLAYBACK; i <= SNDRV_PCM_STREAM_LAST; i++) {
> + substream = pcm->streams[i].substream;
> +
> + ret = snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV, pcm->card->dev,
> + FSL_ASRC_DMABUF_SIZE, &substream->dma_buffer);
> + if (ret) {
> + dev_err(card->dev, "failed to allocate DMA buffer\n");
> + goto err;
> + }
> + }
> +
> + return 0;
> +
> +err:
> + if (--i == 0)
> + snd_dma_free_pages(&pcm->streams[i].substream->dma_buffer);
> +
> + return ret;
> +}
> +
> +static void fsl_asrc_dma_pcm_free(struct snd_pcm *pcm)
> +{
> + struct snd_pcm_substream *substream;
> + int i;
> +
> + for (i = SNDRV_PCM_STREAM_PLAYBACK; i <= SNDRV_PCM_STREAM_LAST; i++) {
> + substream = pcm->streams[i].substream;
> + if (!substream)
> + continue;
> +
> + snd_dma_free_pages(&substream->dma_buffer);
> + substream->dma_buffer.area = NULL;
> + substream->dma_buffer.addr = 0;
> + }
> +}
> +
> +struct snd_soc_platform_driver fsl_asrc_platform = {
> + .ops = &fsl_asrc_dma_pcm_ops,
> + .pcm_new = fsl_asrc_dma_pcm_new,
> + .pcm_free = fsl_asrc_dma_pcm_free,
> +};
> +EXPORT_SYMBOL_GPL(fsl_asrc_platform);
> --
> 1.8.4
next prev parent reply other threads:[~2014-07-24 15:20 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-07-24 8:35 [PATCH v2 0/2] Add Freescale ASRC driver Nicolin Chen
2014-07-24 8:35 ` Nicolin Chen
2014-07-24 8:35 ` Nicolin Chen
2014-07-24 8:35 ` [PATCH v2 1/2] ARM: imx: Add the secondary request into the structure for imx-sdma Nicolin Chen
2014-07-24 8:35 ` Nicolin Chen
2014-07-24 8:35 ` Nicolin Chen
2014-07-24 13:30 ` Shawn Guo
2014-07-24 13:30 ` Shawn Guo
2014-07-24 13:30 ` Shawn Guo
2014-07-24 8:35 ` [PATCH v2 2/2] ASoC: fsl_asrc: Add ASRC ASoC CPU DAI and platform drivers Nicolin Chen
2014-07-24 8:35 ` Nicolin Chen
2014-07-24 8:35 ` Nicolin Chen
[not found] ` <2c74a11776ffcc017c80dc31be4a8313755be8f5.1406189745.git.nicoleotsuka-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2014-07-24 15:20 ` Tobias Klauser [this message]
2014-07-24 15:20 ` Tobias Klauser
2014-07-24 15:20 ` Tobias Klauser
2014-07-25 2:05 ` Nicolin Chen
2014-07-25 2:05 ` Nicolin Chen
2014-07-25 2:05 ` Nicolin Chen
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=20140724152045.GA3384@distanz.ch \
--to=tklauser-93khv+1bn0nydzi6cay1vq@public.gmane.org \
--cc=alsa-devel-K7yf7f+aM1XWsZ/bQMPhNw@public.gmane.org \
--cc=b02247-KZfg59tc24xl57MIdRCFDg@public.gmane.org \
--cc=b42378-KZfg59tc24xl57MIdRCFDg@public.gmane.org \
--cc=broonie-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
--cc=devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=galak-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org \
--cc=grant.likely-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org \
--cc=ijc+devicetree-KcIKpvwj1kUDXYZnReoRVg@public.gmane.org \
--cc=lgirdwood-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
--cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=linuxppc-dev-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org \
--cc=mark.rutland-5wv7dgnIgG8@public.gmane.org \
--cc=nicoleotsuka-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
--cc=pawel.moll-5wv7dgnIgG8@public.gmane.org \
--cc=perex-/Fr2/VpizcU@public.gmane.org \
--cc=rdunlap-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org \
--cc=robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
--cc=shawn.guo-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org \
--cc=timur-N01EOCouUvQ@public.gmane.org \
--cc=tiwai-l3A5Bk7waGM@public.gmane.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.