support DP MST audio
v2 cover support DP MST audio
From: Libin Yang <[email protected]>
This patchset starts to support DP MST audio.
This patchset is based on drm-intel-nightly ongit://anongit.freedesktop.org/drm-intel
Libin Yang (2):
ALSA: hda - add DP mst verb support
ALSA: hda - add DP mst audio support
sound/pci/hda/hda_codec.c | 77 +++++++++++++++- sound/pci/hda/hda_codec.h | 3 + sound/pci/hda/patch_hdmi.c | 216 ++++++++++++++++++++++++++++++++++----------- 3 files changed, 241 insertions(+), 55 deletions(-)
Signature · 1 line
1.9.1
RFC PATCH v2 1/2 ALSA: hda - add DP mst verb support
From: Libin Yang <[email protected]>
Add snd_hda_get_dev_select() and snd_hda_set_dev_select() functions for DP MST audio support.
--- sound/pci/hda/hda_codec.c | 73 ++++++++++++++++++++++++++++++++++++++++++++--- sound/pci/hda/hda_codec.h | 3 ++ 2 files changed, 72 insertions(+), 4 deletions(-)
sound/pci/hda/hda_codec.c +69 -4
@@ -311,9 +311,16 @@ int snd_hda_get_conn_index(struct hda_codec *codec, hda_nid_t mux, }EXPORT_SYMBOL_GPL (snd_hda_get_conn_index); - -/* return DEVLIST_LEN parameter of the given widget */ -static unsigned int get_num_devices (struct hda_codec *codec,hda_nid_t nid) +/** +* snd_hda_get_num_devices - get DEVLIST_LEN parameter of the given widget +* @codec: the HDA codec +* @nid: NID of the pin to parse +* +* Get the device entry number on the given widget. +* This is a feature of DP MST audio. Each pin can +* have several device entries in it. +*/ +unsigned int snd_hda_get_num_devices (struct hda_codec *codec,hda_nid_t nid) {unsigned int wcaps =get_wcaps (codec, nid);unsigned int parm;
@@ -327,6 +334,7 @@ static unsigned int get_num_devices(struct hda_codec *codec, hda_nid_t nid) parm =0 ;return parm &AC_DEV_LIST_LEN_MASK ; } +EXPORT_SYMBOL_GPL (snd_hda_get_num_devices);/** * snd_hda_get_devices - copy device list without cache
@@ -344,7 +352,7 @@ int snd_hda_get_devices(struct hda_codec *codec, hda_nid_t nid,unsigned int parm;int i, dev_len, devices; - parm =get_num_devices (codec, nid); + parm =snd_hda_get_num_devices (codec, nid);if (!parm)/* not multi-stream capable */ return 0 ;
@@ -368,6 +376,63 @@ int snd_hda_get_devices(struct hda_codec *codec, hda_nid_t nid,return devices; } +/** +* snd_hda_get_dev_select - get device entry select on the pin +* @codec: the HDA codec +* @nid: NID of the pin to get device entry select +* +* Get the devcie entry select on the pin. Return the device entry +* id selected on the pin. Return 0 means the first device entry +* is selected or MST is not supported. +*/ +int snd_hda_get_dev_select (struct hda_codec *codec,hda_nid_t nid) +{ +/* not support dp_mst will always return 0, using first dev_entry */ +if (!codec->dp_mst) +return 0 ; + +return snd_hda_codec_read (codec, nid,0 ,AC_VERB_GET_DEVICE_SEL ,0 ); +} +EXPORT_SYMBOL_GPL (snd_hda_get_dev_select); + +/** +* snd_hda_set_dev_select - set device entry select on the pin +* @codec: the HDA codec +* @nid: NID of the pin to set device entry select +* @dev_id: device entry id to be set +* +* Set the device entry select on the pin nid. +*/ +int snd_hda_set_dev_select (struct hda_codec *codec,hda_nid_t nid,int dev_id) +{ +int ret, num_devices; + +/* not support dp_mst will always return 0, using first dev_entry */ +if (!codec->dp_mst) +return 0 ; + +/* AC_PAR_DEVLIST_LEN is 0 based. */ + num_devices =snd_hda_get_num_devices (codec, nid) +1 ; +/* If Device List Length is 0 (num_device = 1), +* the pin is not multi stream capable. +* Do nothing in this case. +*/ +if (num_devices ==1 ) +return 0 ; + +/* Behavior of setting index being equal to or greater than +* Device List Length is not predictable +*/ +if (num_devices <= dev_id) +return -EINVAL ; + + ret =snd_hda_codec_write (codec, nid,0 , +AC_VERB_SET_DEVICE_SEL , dev_id); + +return ret; +} +EXPORT_SYMBOL_GPL (snd_hda_set_dev_select); +/* * read widget caps for each widget and store in cache */
sound/pci/hda/hda_codec.h +3 -0
@@ -347,8 +347,11 @@ int snd_hda_override_conn_list(struct hda_codec *codec, hda_nid_t nid, int nums, const hda_nid_t *list);int snd_hda_get_conn_index (struct hda_codec *codec,hda_nid_t mux,hda_nid_t nid,int recursive); +unsigned int snd_hda_get_num_devices (struct hda_codec *codec,hda_nid_t nid);int snd_hda_get_devices (struct hda_codec *codec,hda_nid_t nid,u8 *dev_list,int max_devices); +int snd_hda_get_dev_select (struct hda_codec *codec,hda_nid_t nid); +int snd_hda_set_dev_select (struct hda_codec *codec,hda_nid_t nid,int dev_id);struct hda_verb {hda_nid_t nid;
Signature · 1 line
1.9.1
RFC PATCH v2 2/2 ALSA: hda - add DP mst audio support
In reply to [email protected]From: Libin Yang <[email protected]>
This patch adds the DP mst audio support.
--- sound/pci/hda/hda_codec.c | 4 + sound/pci/hda/patch_hdmi.c | 216 ++++++++++++++++++++++++++++++++++----------- 2 files changed, 169 insertions(+), 51 deletions(-)
sound/pci/hda/hda_codec.c +4 -0
@@ -468,6 +468,10 @@ static int read_pin_defaults(struct hda_codec *codec) pin->nid = nid; pin->cfg =snd_hda_codec_read (codec, nid,0 ,AC_VERB_GET_CONFIG_DEFAULT ,0 ); +/* +* all device entries are the same widget control so far +* fixme: if any codec is different, need fix here +*/ pin->ctrl =snd_hda_codec_read (codec, nid,0 ,AC_VERB_GET_PIN_WIDGET_CONTROL ,0 );
sound/pci/hda/patch_hdmi.c +165 -51
437 lines not on this page · raw message
Signature · 1 line
1.9.1
Hi Takashi and all,
Some of DK's patches are being reverted in drm-intel-nightly branch ofgit://anongit.freedesktop.org/drm-intel
This is because a flicker regression is found.
More detail of this issue can be found:
https://bugs.freedesktop.org/show_bug.cgi?id=97907
Regards,
Libin
Quoted 27 lines
-----Original Message-----
From: [email protected] [mailto:[email protected]]
Sent: Thursday, September 29, 2016 10:22 AM
To: [email protected]; [email protected]
Cc: Lin, Mengdong <[email protected]>; Yang, Libin <[email protected]>; Libin Yang <[email protected]>
Subject: [alsa-devel] [RFC PATCH v2 0/2] support DP MST audioFrom: Libin Yang <[email protected]>
This patchset starts to support DP MST audio.
This patchset is based on drm-intel-nightly on
git://anongit.freedesktop.org/drm-intelLibin Yang (2):
ALSA: hda - add DP mst verb support
ALSA: hda - add DP mst audio supportsound/pci/hda/hda_codec.c | 77 +++++++++++++++- sound/pci/hda/hda_codec.h | 3 + sound/pci/hda/patch_hdmi.c | 216 ++++++++++++++++++++++++++++++++++----------- 3 files changed, 241 insertions(+), 55 deletions(-)--
1.9.1
Quoted 11 lines · On Thu, 29 Sep 2016 04:22:20 +0200, [email protected] wrote:
From: Libin Yang <[email protected]>
This patchset starts to support DP MST audio.
This patchset is based on drm-intel-nightly on
git://anongit.freedesktop.org/drm-intelLibin Yang (2):
ALSA: hda - add DP mst verb support
ALSA: hda - add DP mst audio support
The codes looks much better now. Of course we need further brush up in some places as well as more documentation, but it's a good step forward.
thanks,
Takashi
Hi Takashi,
Quoted 18 lines
-----Original Message-----
From: Takashi Iwai [mailto:[email protected]]
Sent: Friday, September 30, 2016 11:17 PM
To: [email protected]
Cc: [email protected]; Lin, Mengdong <[email protected]>; Yang, Libin <[email protected]>
Subject: Re: [alsa-devel] [RFC PATCH v2 0/2] support DP MST audioQuoted 8 lines · On Thu, 29 Sep 2016 04:22:20 +0200, [email protected] wrote:
From: Libin Yang <[email protected]>
This patchset starts to support DP MST audio.
This patchset is based on drm-intel-nightly on
git://anongit.freedesktop.org/drm-intel
Quoted 6 lines
Quoted 3 lines
Libin Yang (2):
ALSA: hda - add DP mst verb support
ALSA: hda - add DP mst audio supportThe codes looks much better now. Of course we need further brush up in some places as well as more documentation, but it's a good step forward.
OK, I will add descriptions in the code and in the file Documentation/sound/alsa/ HD-Audio-DP-MST-audio.txt
BTW: One of DK's patches is being reverted. This means DP MST audio will not work now on the drm-intel-nightly branch.
Thanks & Regards,
Libin
Quoted 5 lines
thanks,
Takashi