alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
From: libin.yang@intel.com
To: alsa-devel@alsa-project.org, tiwai@suse.de,
	intel-gfx@lists.freedesktop.org, daniel.vetter@ffwll.ch,
	jani.nikula@linux.intel.com, ville.syrjala@linux.intel.com
Subject: [PATCH v6 3/4] ALSA: hda - display audio call sync_audio_rate callback
Date: Wed,  2 Sep 2015 14:11:40 +0800	[thread overview]
Message-ID: <1441174301-144177-3-git-send-email-libin.yang@intel.com> (raw)
In-Reply-To: <1441174301-144177-1-git-send-email-libin.yang@intel.com>

From: Libin Yang <libin.yang@intel.com>

For display audio, call the sync_audio_rate callback function
to do the synchronization between gfx driver and audio driver.

Signed-off-by: Libin Yang <libin.yang@intel.com>
Reviewed-by: Takashi Iwai <tiwai@suse.de>
---
 sound/pci/hda/patch_hdmi.c | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/sound/pci/hda/patch_hdmi.c b/sound/pci/hda/patch_hdmi.c
index a97db5f..1668868 100644
--- a/sound/pci/hda/patch_hdmi.c
+++ b/sound/pci/hda/patch_hdmi.c
@@ -1770,6 +1770,16 @@ static bool check_non_pcm_per_cvt(struct hda_codec *codec, hda_nid_t cvt_nid)
 	return non_pcm;
 }
 
+/* There is a fixed mapping between audio pin node and display port
+ * on current Intel platforms:
+ * Pin Widget 5 - PORT B (port = 1 in i915 driver)
+ * Pin Widget 6 - PORT C (port = 2 in i915 driver)
+ * Pin Widget 7 - PORT D (port = 3 in i915 driver)
+ */
+static int intel_pin2port(hda_nid_t pin_nid)
+{
+	return pin_nid - 4;
+}
 
 /*
  * HDMI callbacks
@@ -1786,6 +1796,8 @@ static int generic_hdmi_playback_pcm_prepare(struct hda_pcm_stream *hinfo,
 	int pin_idx = hinfo_to_pin_index(codec, hinfo);
 	struct hdmi_spec_per_pin *per_pin = get_pin(spec, pin_idx);
 	hda_nid_t pin_nid = per_pin->pin_nid;
+	struct snd_pcm_runtime *runtime = substream->runtime;
+	struct i915_audio_component *acomp = codec->bus->core.audio_component;
 	bool non_pcm;
 	int pinctl;
 
@@ -1802,6 +1814,13 @@ static int generic_hdmi_playback_pcm_prepare(struct hda_pcm_stream *hinfo,
 		intel_not_share_assigned_cvt(codec, pin_nid, per_pin->mux_idx);
 	}
 
+	/* Call sync_audio_rate to set the N/CTS/M manually if necessary */
+	/* Todo: add DP1.2 MST audio support later */
+	if (acomp && acomp->ops && acomp->ops->sync_audio_rate)
+		acomp->ops->sync_audio_rate(acomp->dev,
+				intel_pin2port(pin_nid),
+				runtime->rate);
+
 	non_pcm = check_non_pcm_per_cvt(codec, cvt_nid);
 	mutex_lock(&per_pin->lock);
 	per_pin->channels = substream->runtime->channels;
-- 
1.9.1

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

  parent reply	other threads:[~2015-09-02  6:11 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-02  6:11 [PATCH v6 1/4] drm/i915: Add audio sync_audio_rate callback libin.yang
2015-09-02  6:11 ` [PATCH v6 2/4] drm/i915: implement " libin.yang
2015-09-02  7:52   ` Jani Nikula
2015-09-02  8:24     ` Yang, Libin
2015-09-02  8:42       ` Jani Nikula
2015-09-02  8:47         ` Yang, Libin
2015-09-02  6:11 ` libin.yang [this message]
2015-09-02  6:11 ` [PATCH v6 4/4] drm/i915: set proper N/CTS in modeset libin.yang
2015-09-02  8:20   ` Jani Nikula
2015-09-02  8:42     ` Yang, Libin
2015-09-02  9:02       ` Jani Nikula
2015-09-02 13:34         ` Takashi Iwai
2015-09-02 13:44           ` Jani Nikula
2015-09-02 13:46             ` Takashi Iwai
2015-09-02 15:22               ` Daniel Vetter
2015-09-02 15:36                 ` Takashi Iwai
2015-09-04  1:56                   ` Yang, Libin
2015-09-04  4:50                     ` Takashi Iwai
2015-10-19  8:25           ` Jani Nikula
2015-10-19  8:27             ` Takashi Iwai
2015-09-02  7:23 ` [PATCH v6 1/4] drm/i915: Add audio sync_audio_rate callback Jani Nikula

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=1441174301-144177-3-git-send-email-libin.yang@intel.com \
    --to=libin.yang@intel.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=daniel.vetter@ffwll.ch \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=jani.nikula@linux.intel.com \
    --cc=tiwai@suse.de \
    --cc=ville.syrjala@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 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).