alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
From: Jerome Anand <jerome.anand@intel.com>
To: intel-gfx@lists.freedesktop.org, alsa-devel@alsa-project.org
Cc: tiwai@suse.de, broonie@kernel.org, rakesh.a.ughreja@intel.com
Subject: [PATCH V2 5/7] ALSA: x86: hdmi: Improve position reporting
Date: Sat,  7 Jan 2017 06:51:07 +0530	[thread overview]
Message-ID: <20170107012109.25744-6-jerome.anand@intel.com> (raw)
In-Reply-To: <20170107012109.25744-1-jerome.anand@intel.com>

Use a hw register to calculate sub-period position reports.
This makes PulseAudio happier.

Signed-off-by: David Henningsson <david.henningsson@canonical.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Jerome Anand <jerome.anand@intel.com>
---
 sound/x86/intel_hdmi_audio.c | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/sound/x86/intel_hdmi_audio.c b/sound/x86/intel_hdmi_audio.c
index d7b57658..d2036bc 100644
--- a/sound/x86/intel_hdmi_audio.c
+++ b/sound/x86/intel_hdmi_audio.c
@@ -1489,6 +1489,8 @@ static snd_pcm_uframes_t snd_intelhad_pcm_pointer(
 {
 	struct snd_intelhad *intelhaddata;
 	u32 bytes_rendered = 0;
+	u32 t;
+	int buf_id;
 
 	/* pr_debug("snd_intelhad_pcm_pointer called\n"); */
 
@@ -1499,6 +1501,14 @@ static snd_pcm_uframes_t snd_intelhad_pcm_pointer(
 		return SNDRV_PCM_POS_XRUN;
 	}
 
+	buf_id = intelhaddata->curr_buf % 4;
+	had_read_register(AUD_BUF_A_LENGTH + (buf_id * HAD_REG_WIDTH), &t);
+	if (t == 0) {
+		pr_debug("discovered buffer done for buf %d\n", buf_id);
+		/* had_process_buffer_done(intelhaddata); */
+	}
+	t = intelhaddata->buf_info[buf_id].buf_size - t;
+
 	if (intelhaddata->stream_info.buffer_rendered)
 		div_u64_rem(intelhaddata->stream_info.buffer_rendered,
 			intelhaddata->stream_info.ring_buf_size,
@@ -1506,7 +1516,7 @@ static snd_pcm_uframes_t snd_intelhad_pcm_pointer(
 
 	intelhaddata->stream_info.buffer_ptr = bytes_to_frames(
 						substream->runtime,
-						bytes_rendered);
+						bytes_rendered + t);
 	return intelhaddata->stream_info.buffer_ptr;
 }
 
-- 
2.9.3

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

  parent reply	other threads:[~2017-01-07  1:21 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-07  1:21 [PATCH V2 0/7] Add support for Legacy HDMI audio drivers Jerome Anand
2017-01-07  1:21 ` [PATCH V2 1/7] drm/i915: setup bridge for HDMI LPE audio driver Jerome Anand
2017-01-06 20:12   ` [alsa-devel] " Pierre-Louis Bossart
2017-01-07  4:45     ` Anand, Jerome
2017-01-07  1:21 ` [PATCH V2 2/7] drm/i915: Add support for audio driver notifications Jerome Anand
2017-01-06 20:20   ` [alsa-devel] " Pierre-Louis Bossart
2017-01-07  4:52     ` Anand, Jerome
2017-01-07  1:21 ` [PATCH V2 3/7] ALSA: add shell for Intel HDMI LPE audio driver Jerome Anand
2017-01-06 20:33   ` [alsa-devel] " Pierre-Louis Bossart
2017-01-07  4:56     ` Anand, Jerome
2017-01-07  1:21 ` [PATCH V2 4/7] ALSA: x86: hdmi: Add audio support for BYT and CHT Jerome Anand
2017-01-07  1:21 ` Jerome Anand [this message]
2017-01-06 20:39   ` [alsa-devel] [PATCH V2 5/7] ALSA: x86: hdmi: Improve position reporting Pierre-Louis Bossart
2017-01-07  4:58     ` Anand, Jerome
2017-01-07  1:21 ` [PATCH V2 6/7] ALSA: x86: hdmi: Fixup some monitor Jerome Anand
2017-01-06 20:40   ` [alsa-devel] " Pierre-Louis Bossart
2017-01-07  1:21 ` [PATCH V2 7/7] ALSA: x86: hdmi: continue playback even when display resolution changes Jerome Anand
2017-01-06 20:43   ` [alsa-devel] " Pierre-Louis Bossart
2017-01-07  4:58     ` Anand, Jerome

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=20170107012109.25744-6-jerome.anand@intel.com \
    --to=jerome.anand@intel.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=rakesh.a.ughreja@intel.com \
    --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;
as well as URLs for NNTP newsgroup(s).