From: Liam Girdwood <liam.r.girdwood@linux.intel.com>
To: Takashi Iwai <tiwai@suse.de>
Cc: alsa-devel@alsa-project.org, Mark Brown <broonie@kernel.org>
Subject: Re: [PATCH 3/6] ASoC: Intel: Add Haswell and Broadwell PCM platform driver
Date: Mon, 24 Feb 2014 20:07:12 +0000 [thread overview]
Message-ID: <1393272432.2323.72.camel@loki> (raw)
In-Reply-To: <s5hsircx6tq.wl%tiwai@suse.de>
On Fri, 2014-02-21 at 08:28 +0100, Takashi Iwai wrote:
> At Thu, 20 Feb 2014 21:48:44 +0000,
> Liam Girdwood wrote:
> > +/* TLV used by both global and stream volumes */
> > +static const DECLARE_TLV_DB_SCALE(hsw_vol_tlv, -9000, 300, 1);
> > +
> > +/* System Pin has no volume control */
> > +static const struct snd_kcontrol_new hsw_volume_controls[] = {
> > + /* Global DSP volume */
> > + SOC_DOUBLE_EXT_TLV("Master Playback Volume", 0, 0, 8,
> > + ARRAY_SIZE(volume_map) -1, 0,
> > + hsw_volume_get, hsw_volume_put, hsw_vol_tlv),
> > + /* Offload 0 volume */
> > + SOC_DOUBLE_EXT_TLV("Media0 Playback Volume", 1, 0, 8,
> > + ARRAY_SIZE(volume_map), 0,
> > + hsw_stream_volume_get, hsw_stream_volume_put, hsw_vol_tlv),
>
> Why -1 is for Master and not for others although they use the same
> TLV?
Iirc, one could be gain and the other attenuation. Let me double check.
>
>
> > +/* Create DMA buffer page table for DSP */
> > +static int create_adsp_page_table(struct hsw_priv_data *pdata,
> > + struct snd_soc_pcm_runtime *rtd,
> > + unsigned char *dma_area, size_t size, int pcm, int stream)
> > +{
> > + int i, pages;
> > +
> > + if (size % PAGE_SIZE)
> > + pages = (size / PAGE_SIZE) + 1;
> > + else
> > + pages = size / PAGE_SIZE;
> > +
> > + dev_dbg(rtd->dev, "generating page table for %p size 0x%zu pages %d\n",
> > + dma_area, size, pages);
> > +
> > + for (i = 0; i < pages; i++) {
> > + u32 idx = (((i << 2) + i)) >> 1;
> > + u32 pfn = (virt_to_phys(dma_area + i * PAGE_SIZE)) >> PAGE_SHIFT;
>
> virt_to_phys() is bad, pretty unportable. And, this implementation
> doesn't use SG-buffer although the hardware can it obviously.
>
> For managing SG-buffer, just use SNDRV_DMA_TPE_DEV_SG for
> preallocation, and change the page setup code like:
>
> struct snd_dma_buffer *dmab = snd_pcm_get_dma_buf(substream)
>
> ....
> pages = snd_sgbuf_aligned_pages(size);
> for (i = 0; i < pages; i++) {
> u32 idx = (((i << 2) + i)) >> 1;
> u32 pfn = snd_sgbuf_get_addr(dmab, i * PAGE_SIZE) >> PAGE_SHIFT;
>
> The only other thing to change is to pass snd_pcm_sgbuf_ops_page to
> snd_pcm_ops.page. That's all.
Thanks, I wasn't aware these helpers existed. Will fix.
Liam
next prev parent reply other threads:[~2014-02-24 20:09 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-02-20 21:48 [PATCH 1/6] ASoC: Intel: Add support for Haswell/Broadwell DSP Liam Girdwood
2014-02-20 21:48 ` [PATCH 2/6] ASoC: Intel: Add Haswell/Broadwell IPC Liam Girdwood
2014-02-21 5:03 ` Mark Brown
2014-02-20 21:48 ` [PATCH 3/6] ASoC: Intel: Add Haswell and Broadwell PCM platform driver Liam Girdwood
2014-02-21 5:16 ` Mark Brown
2014-02-21 7:11 ` Takashi Iwai
2014-02-23 3:19 ` Mark Brown
2014-02-24 20:00 ` Liam Girdwood
2014-02-21 7:28 ` Takashi Iwai
2014-02-24 20:07 ` Liam Girdwood [this message]
2014-02-20 21:48 ` [PATCH 4/6] ASoC: Intel: Add trace support for Haswell/Broadwell SST IPC messages Liam Girdwood
2014-02-21 5:19 ` Mark Brown
2014-02-24 19:50 ` Liam Girdwood
2014-02-20 21:48 ` [PATCH 5/6] ASoC: Intel: Add build support for Haswell ADSP Liam Girdwood
2014-02-21 5:19 ` Mark Brown
2014-02-20 21:48 ` [PATCH 6/6] ASoC: Intel: Add Haswell Machine support Liam Girdwood
2014-02-21 5:22 ` Mark Brown
2014-02-24 19:55 ` Liam Girdwood
2014-02-21 5:01 ` [PATCH 1/6] ASoC: Intel: Add support for Haswell/Broadwell DSP Mark Brown
2014-02-21 13:05 ` Jarkko Nikula
2014-02-24 20:09 ` Liam Girdwood
2014-02-24 19:47 ` Liam Girdwood
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=1393272432.2323.72.camel@loki \
--to=liam.r.girdwood@linux.intel.com \
--cc=alsa-devel@alsa-project.org \
--cc=broonie@kernel.org \
--cc=tiwai@suse.de \
/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