All of lore.kernel.org
 help / color / mirror / Atom feed
From: Takashi Iwai <tiwai@suse.de>
To: Liam Girdwood <liam.r.girdwood@linux.intel.com>
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: Fri, 21 Feb 2014 08:28:49 +0100	[thread overview]
Message-ID: <s5hsircx6tq.wl%tiwai@suse.de> (raw)
In-Reply-To: <1392932927-9725-3-git-send-email-liam.r.girdwood@linux.intel.com>

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?


> +/* 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.


Takashi

  parent reply	other threads:[~2014-02-21  7:28 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 [this message]
2014-02-24 20:07     ` Liam Girdwood
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=s5hsircx6tq.wl%tiwai@suse.de \
    --to=tiwai@suse.de \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --cc=liam.r.girdwood@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 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.