All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jerome Anand <jerome.anand@intel.com>
To: intel-gfx@lists.freedesktop.org
Cc: tiwai@suse.de, broonie@opensource.wolfsonmicro.com
Subject: [RFC PATCH v2 6/8] hdmi_audio: Improve position reporting Using a hw register to calculate sub-period position reports.
Date: Sat,  1 Oct 2016 05:52:40 +0530	[thread overview]
Message-ID: <20161001002242.31025-7-jerome.anand@intel.com> (raw)
In-Reply-To: <20161001002242.31025-1-jerome.anand@intel.com>

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 2dc0881..0802b29 100644
--- a/sound/x86/intel_hdmi_audio.c
+++ b/sound/x86/intel_hdmi_audio.c
@@ -1491,6 +1491,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"); */
 
@@ -1501,6 +1503,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,
@@ -1508,7 +1518,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:[~2016-10-12 16:26 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-01  0:22 [RFC PATCH v2 0/8] Add support for Legacy Hdmi audio Jerome Anand
2016-10-01  0:22 ` [RFC PATCH v2 1/8] drm/i915: setup bridge for HDMI LPE audio driver Jerome Anand
2016-10-11  9:15   ` Ville Syrjälä
2016-10-13 19:38     ` Pierre-Louis Bossart
2016-10-14  9:10       ` Ville Syrjälä
2016-10-14 13:50         ` Jani Nikula
2016-10-17  6:46   ` Daniel Vetter
2016-10-01  0:22 ` [RFC PATCH v2 2/8] ALSA: add shell for Intel " Jerome Anand
2016-10-01  0:22 ` [RFC PATCH v2 3/8] ALSA: Add support for hdmi " Jerome Anand
2016-10-01  0:22 ` [RFC PATCH v2 4/8] drm/i915: Add support for enabling/disabling hdmi audio interrupts Jerome Anand
2016-10-11  9:18   ` Ville Syrjälä
2016-10-13 19:41     ` Pierre-Louis Bossart
2016-10-01  0:22 ` [RFC PATCH v2 5/8] drm/i915: Add support for audio driver notifications Jerome Anand
2016-10-01  0:22 ` Jerome Anand [this message]
2016-10-01  0:22 ` [RFC PATCH v2 7/8] hdmi_audio: Fixup some monitor Jerome Anand
2016-10-01  0:22 ` [RFC PATCH v2 8/8] hdmi_audio: continue audio playback even when display resolution changes Jerome Anand
2016-10-12 18:49 ` ✗ Fi.CI.BAT: warning for Add support for Legacy Hdmi audio Patchwork
2016-10-12 18:59   ` Saarinen, Jani
2016-11-03 23:01 ` [RFC PATCH v2 0/8] " Daniel Vetter
2016-11-07  6:42   ` Pierre-Louis Bossart
2016-11-09 13:19     ` Mark Brown
2016-11-10 16:35       ` Pierre-Louis Bossart
2016-11-11 15:14         ` Mark Brown

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=20161001002242.31025-7-jerome.anand@intel.com \
    --to=jerome.anand@intel.com \
    --cc=broonie@opensource.wolfsonmicro.com \
    --cc=intel-gfx@lists.freedesktop.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 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.