ALSA: hda - Add DP-MST support for NVIDIA codecs
cover ALSA: hda - Add DP-MST support for NVIDIA codecs
Today, DisplayPort multi-stream transport (DP-MST) audio is not supported on codec drivers which don't use the audio component (acomp) binding.
The commit ade49db337a9 (ALSA: hda/hdmi - Allow audio component for AMD/ATI and Nvidia HDMI) added the DRM audio component binding for the NVIDIA codec drivers, but the traditional HD-audio unsolicited event code path is still in use by the proprietary NVIDIA graphics driver.
This patch set adds DP-MST audio support for non-acomp codec drivers which use the traditional HD-audio unsolicited event code path. This patch set adds DP-MST support for NVIDIA codecs.
The patch set has been tested for HDMI/DP-SST/DP-MST(4 dp-mst audio streams) configurations on NVIDIA Kepler and Maxwell GPUs, using both the nouveau driver and the proprietary NVIDIA graphics driver.
Nikhil Mahale (5):
ALSA: hda - Rename snd_hda_pin_sense to snd_hda_jack_pin_sense
ALSA: hda - Add DP-MST jack support
ALSA: hda - Add DP-MST conn list support
ALSA: hda - Add DP-MST support for non-acomp codecs
ALSA: hda - Add DP-MST support for NVIDIA codecs
sound/pci/hda/hda_codec.c | 5 +- sound/pci/hda/hda_generic.c | 16 +-- sound/pci/hda/hda_jack.c | 111 ++++++++++++------ sound/pci/hda/hda_jack.h | 26 +++-- sound/pci/hda/patch_ca0132.c | 24 ++-- sound/pci/hda/patch_cirrus.c | 4 +- sound/pci/hda/patch_conexant.c | 2 +- sound/pci/hda/patch_hdmi.c | 255 +++++++++++++++++++++++++++++------------ sound/pci/hda/patch_realtek.c | 46 ++++---- sound/pci/hda/patch_sigmatel.c | 12 +- 10 files changed, 333 insertions(+), 168 deletions(-)
Signature · 6 lines
2.16.4 _______________________________________________ Alsa-devel mailing list [email protected] https://mailman.alsa-project.org/mailman/listinfo/alsa-devel
PATCH 1/5 ALSA: hda - Rename snd_hda_pin_sense to snd_hda_jack_pin_sense
s/snd_hda_pin_sense/snd_hda_jack_pin_sense/g
This aligns the snd_hda_pin_sense function name with the names of other functions in hda_jack.h.
--- sound/pci/hda/hda_jack.c | 8 ++++---- sound/pci/hda/hda_jack.h | 2 +- sound/pci/hda/patch_hdmi.c | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-)
sound/pci/hda/hda_jack.c +4 -4
@@ -191,14 +191,14 @@ void snd_hda_jack_set_dirty_all(struct hda_codec *codec)EXPORT_SYMBOL_GPL (snd_hda_jack_set_dirty_all);/** -* snd_hda_pin_sense - execute pin sense measurement +* snd_hda_jack_pin_sense - execute pin sense measurement * @codec: the CODEC to sense * @nid: the pin NID to sense * * Execute necessary pin sense measurement and return its Presence Detect, * Impedance, ELD Valid etc. status bits. */ -u32 snd_hda_pin_sense (struct hda_codec *codec,hda_nid_t nid) +u32 snd_hda_jack_pin_sense (struct hda_codec *codec,hda_nid_t nid) {struct hda_jack_tbl *jack =snd_hda_jack_tbl_get (codec, nid);if (jack) {
@@ -207,7 +207,7 @@ u32 snd_hda_pin_sense(struct hda_codec *codec, hda_nid_t nid) }return read_pin_sense (codec, nid); } -EXPORT_SYMBOL_GPL (snd_hda_pin_sense); +EXPORT_SYMBOL_GPL (snd_hda_jack_pin_sense);/** * snd_hda_jack_detect_state - query pin Presence Detect status
@@ -222,7 +222,7 @@ int snd_hda_jack_detect_state(struct hda_codec *codec, hda_nid_t nid)struct hda_jack_tbl *jack =snd_hda_jack_tbl_get (codec, nid);if (jack && jack->phantom_jack)return HDA_JACK_PHANTOM ; -else if (snd_hda_pin_sense (codec, nid) &AC_PINSENSE_PRESENCE ) +else if (snd_hda_jack_pin_sense (codec, nid) &AC_PINSENSE_PRESENCE )return HDA_JACK_PRESENT ;else return HDA_JACK_NOT_PRESENT ;
sound/pci/hda/hda_jack.h +1 -1
@@ -65,7 +65,7 @@ snd_hda_jack_detect_enable_callback(struct hda_codec *codec, hda_nid_t nid,int snd_hda_jack_set_gating_jack (struct hda_codec *codec,hda_nid_t gated_nid,hda_nid_t gating_nid); -u32 snd_hda_pin_sense (struct hda_codec *codec,hda_nid_t nid); +u32 snd_hda_jack_pin_sense (struct hda_codec *codec,hda_nid_t nid);/* the jack state returned from snd_hda_jack_detect_state() */ enum {
sound/pci/hda/patch_hdmi.c +1 -1
@@ -1521,7 +1521,7 @@ static bool hdmi_present_sense_via_verbs(struct hdmi_spec_per_pin *per_pin,bool ret;bool do_repoll = false; - present =snd_hda_pin_sense (codec, pin_nid); + present =snd_hda_jack_pin_sense (codec, pin_nid);mutex_lock (&per_pin->lock); eld->monitor_present = !!(present &AC_PINSENSE_PRESENCE );
Signature · 6 lines
2.16.4 _______________________________________________ Alsa-devel mailing list [email protected] https://mailman.alsa-project.org/mailman/listinfo/alsa-devel
PATCH 2/5 ALSA: hda - Add DP-MST jack support
In reply to Nikhil MahaleThis patch adds DP-MST jack support which will be used on NVIDIA platforms. Today, DP-MST audio is supported only if the codec has acomp support. This patch makes it possible to add DP-MST support for non-acomp codecs.
For the codecs supporting DP-MST audio, each pin can contain several device entries. Each device entry is a virtual pin, described by pin_nid and dev_id in struct hdmi_spec_per_pin. For monitor hotplug event handling, non-acomp codecs enable and register jack-detection for every hdmi_spec_per_pin.
This patch updates every relevant function in hda_jack.h and its implementation in hda_jack.c, to consider dev_id along with pin_nid.
Changes to the HD Audio specification to support DP-MST audio are described in the Intel Document Change Notification (DCN) number HDA040-A.
From HDA040-A, "For the case of multi stream capable Digital Display Pin Widget, [the Get Pin Sense verb] can be used to read a specific Device Entry state as reported in Get Device List Entry verb." This patch updates the read_pin_sense() function to take the dev_id as an argument and pass it as a parameter to the Get Pin Sense verb.
Bits 15 through 20 from the Unsolicited Response for intrinsic events contain the index of the Device Entry that generated the event. This patch updates the Unsolicited Response event handlers to extract the device entry index from the response and pass it to snd_hda_jack_tbl_get_from_tag().
This patch updates snd_hda_jack_tbl_new() to take a dev_id argument and store it in the jack structure, and to make sure not to generate a different tag when called more than once for the same nid.
--- sound/pci/hda/hda_generic.c | 16 +++--- sound/pci/hda/hda_jack.c | 107 +++++++++++++++++++++++++++++------------ sound/pci/hda/hda_jack.h | 26 ++++++---- sound/pci/hda/patch_ca0132.c | 24 ++++----- sound/pci/hda/patch_cirrus.c | 4 +- sound/pci/hda/patch_conexant.c | 2 +- sound/pci/hda/patch_hdmi.c | 47 +++++++++--------- sound/pci/hda/patch_realtek.c | 46 +++++++++--------- sound/pci/hda/patch_sigmatel.c | 12 ++--- 9 files changed, 167 insertions(+), 117 deletions(-)
sound/pci/hda/hda_generic.c +8 -8
@@ -4203,7 +4203,7 @@ static bool detect_pin_state(struct hda_codec *codec, hda_nid_t pin) {if (!is_jack_detectable (codec, pin))return true; -return snd_hda_jack_detect_state (codec, pin) !=HDA_JACK_NOT_PRESENT ; +return snd_hda_jack_detect_state (codec, pin,0 ) !=HDA_JACK_NOT_PRESENT ; }/* power up/down the paths of the given pin according to the jack state;
@@ -4260,7 +4260,7 @@ static void add_pin_power_ctls(struct hda_codec *codec, int num_pins,for (i =0 ; i < num_pins && pins[i]; i++) {if (is_jack_detectable (codec, pins[i])) -snd_hda_jack_detect_enable_callback (codec, pins[i], cb); +snd_hda_jack_detect_enable_callback (codec, pins[i],0 , cb);else set_path_power (codec, pins[i], true,-1 ); }
@@ -4413,7 +4413,7 @@ static bool detect_jacks(struct hda_codec *codec, int num_pins, hda_nid_t *pins)/* don't detect pins retasked as inputs */ if (snd_hda_codec_get_pin_target (codec, nid) &AC_PINCTL_IN_EN )continue ; -if (snd_hda_jack_detect_state (codec, nid) ==HDA_JACK_PRESENT ) +if (snd_hda_jack_detect_state (codec, nid,0 ) ==HDA_JACK_PRESENT ) present = true; }return present;
@@ -4614,7 +4614,7 @@ void snd_hda_gen_mic_autoswitch(struct hda_codec *codec,/* don't detect pins retasked as outputs */ if (snd_hda_codec_get_pin_target (codec, pin) &AC_PINCTL_OUT_EN )continue ; -if (snd_hda_jack_detect_state (codec, pin) ==HDA_JACK_PRESENT ) { +if (snd_hda_jack_detect_state (codec, pin,0 ) ==HDA_JACK_PRESENT ) {mux_select (codec,0 , spec->am_entry[i].idx);return ; }
@@ -4794,7 +4794,7 @@ static int check_auto_mute_availability(struct hda_codec *codec)if (!is_jack_detectable (codec, nid))continue ;codec_dbg (codec,"Enable HP auto-muting on NID 0x%x\n" , nid); -snd_hda_jack_detect_enable_callback (codec, nid, +snd_hda_jack_detect_enable_callback (codec, nid,0 , call_hp_automute); spec->detect_hp =1 ; }
@@ -4806,7 +4806,7 @@ static int check_auto_mute_availability(struct hda_codec *codec)if (!is_jack_detectable (codec, nid))continue ;codec_dbg (codec,"Enable Line-Out auto-muting on NID 0x%x\n" , nid); -snd_hda_jack_detect_enable_callback (codec, nid, +snd_hda_jack_detect_enable_callback (codec, nid,0 , call_line_automute); spec->detect_lo =1 ; }
@@ -4847,7 +4847,7 @@ static bool auto_mic_check_imux(struct hda_codec *codec)/* we don't need the jack detection for the first pin */ for (i =1 ; i < spec->am_num_entries; i++)snd_hda_jack_detect_enable_callback (codec, - spec->am_entry[i].pin, + spec->am_entry[i].pin,0 , call_mic_autoswitch);return true; }
@@ -5990,7 +5990,7 @@ static void clear_unsol_on_unused_pins(struct hda_codec *codec)snd_array_for_each (&codec->init_pins, i, pin) {hda_nid_t nid = pin->nid;if (is_jack_detectable (codec, nid) && - !snd_hda_jack_tbl_get (codec, nid)) + !snd_hda_jack_tbl_get (codec, nid,0 ))snd_hda_codec_write_cache (codec, nid,0 ,AC_VERB_SET_UNSOLICITED_ENABLE ,0 ); }
sound/pci/hda/hda_jack.c +76 -31
297 lines not on this page · raw message
sound/pci/hda/hda_jack.h +17 -9
@@ -19,6 +19,7 @@ typedef void (*hda_jack_callback_fn) (struct hda_codec *, struct hda_jack_callbastruct hda_jack_callback {hda_nid_t nid; +int dev_id;hda_jack_callback_fn func;unsigned int private_data;/* arbitrary data */ unsigned int unsol_res;/* unsolicited event bits */
@@ -28,6 +29,7 @@ struct hda_jack_callback {struct hda_jack_tbl {hda_nid_t nid; +int dev_id;unsigned char tag;/* unsol event tag */ struct hda_jack_callback *callback;/* jack-detection stuff */
@@ -49,45 +51,51 @@ struct hda_jack_keymap { };struct hda_jack_tbl * -snd_hda_jack_tbl_get (struct hda_codec *codec,hda_nid_t nid); +snd_hda_jack_tbl_get (struct hda_codec *codec,hda_nid_t nid,int dev_id);struct hda_jack_tbl * -snd_hda_jack_tbl_get_from_tag (struct hda_codec *codec,unsigned char tag); +snd_hda_jack_tbl_get_from_tag (struct hda_codec *codec, +unsigned char tag,int dev_id);void snd_hda_jack_tbl_clear (struct hda_codec *codec);void snd_hda_jack_set_dirty_all (struct hda_codec *codec); -int snd_hda_jack_detect_enable (struct hda_codec *codec,hda_nid_t nid); +int snd_hda_jack_detect_enable (struct hda_codec *codec,hda_nid_t nid, +int dev_id);struct hda_jack_callback *snd_hda_jack_detect_enable_callback (struct hda_codec *codec,hda_nid_t nid, -hda_jack_callback_fn cb); +int dev_id,hda_jack_callback_fn cb);int snd_hda_jack_set_gating_jack (struct hda_codec *codec,hda_nid_t gated_nid,hda_nid_t gating_nid); -u32 snd_hda_jack_pin_sense (struct hda_codec *codec,hda_nid_t nid); +u32 snd_hda_jack_pin_sense (struct hda_codec *codec,hda_nid_t nid,int dev_id);/* the jack state returned from snd_hda_jack_detect_state() */ enum {HDA_JACK_NOT_PRESENT ,HDA_JACK_PRESENT ,HDA_JACK_PHANTOM , }; -int snd_hda_jack_detect_state (struct hda_codec *codec,hda_nid_t nid); +int snd_hda_jack_detect_state (struct hda_codec *codec,hda_nid_t nid, +int dev_id);/** * snd_hda_jack_detect - Detect the jack * @codec: the HDA codec * @nid: pin NID to check jack detection +* @dev_id: pin device entry id */ -static inline bool snd_hda_jack_detect (struct hda_codec *codec,hda_nid_t nid) +static inline bool +snd_hda_jack_detect (struct hda_codec *codec,hda_nid_t nid,int dev_id) { -return snd_hda_jack_detect_state (codec, nid) !=HDA_JACK_NOT_PRESENT ; +return snd_hda_jack_detect_state (codec, nid, dev_id) != +HDA_JACK_NOT_PRESENT ; }bool is_jack_detectable (struct hda_codec *codec,hda_nid_t nid);int snd_hda_jack_add_kctl (struct hda_codec *codec,hda_nid_t nid, -const char *name,bool phantom_jack, +int dev_id,const char *name,bool phantom_jack,int type,const struct hda_jack_keymap *keymap);int snd_hda_jack_add_kctls (struct hda_codec *codec,const struct auto_pin_cfg *cfg);
sound/pci/hda/patch_ca0132.c +12 -12
@@ -4064,7 +4064,7 @@ static int ca0132_select_out(struct hda_codec *codec) auto_jack = spec->vnode_lswitch[VNID_HP_ASEL -VNODE_START_NID ];if (auto_jack) - jack_present =snd_hda_jack_detect (codec, spec->unsol_tag_hp); + jack_present =snd_hda_jack_detect (codec, spec->unsol_tag_hp,0 );else jack_present = spec->vnode_lswitch[VNID_HP_SEL -VNODE_START_NID ];
@@ -4320,8 +4320,8 @@ static int ca0132_alt_select_out(struct hda_codec *codec)* hp/speaker auto detect is enabled. */ if (auto_jack) { - jack_present =snd_hda_jack_detect (codec, spec->unsol_tag_hp) || -snd_hda_jack_detect (codec, spec->unsol_tag_front_hp); + jack_present =snd_hda_jack_detect (codec, spec->unsol_tag_hp,0 ) || +snd_hda_jack_detect (codec, spec->unsol_tag_front_hp,0 );if (jack_present) spec->cur_out_type =HEADPHONE_OUT ;
@@ -4376,9 +4376,9 @@ static int ca0132_alt_select_out(struct hda_codec *codec)/* enable headphone, either front or rear */ -if (snd_hda_jack_detect (codec, spec->unsol_tag_front_hp)) +if (snd_hda_jack_detect (codec, spec->unsol_tag_front_hp,0 )) headphone_nid = spec->out_pins[2 ]; -else if (snd_hda_jack_detect (codec, spec->unsol_tag_hp)) +else if (snd_hda_jack_detect (codec, spec->unsol_tag_hp,0 )) headphone_nid = spec->out_pins[1 ]; pin_ctl = snd_hda_codec_read(codec, headphone_nid, 0,
@@ -4460,7 +4460,7 @@ static void ca0132_unsol_hp_delayed(struct work_struct *work)else ca0132_select_out (spec->codec); - jack =snd_hda_jack_tbl_get (spec->codec, spec->unsol_tag_hp); + jack =snd_hda_jack_tbl_get (spec->codec, spec->unsol_tag_hp,0 );if (jack) { jack->block_report =0 ;snd_hda_jack_report_sync (spec->codec);
@@ -4599,7 +4599,7 @@ static int ca0132_select_mic(struct hda_codec *codec) auto_jack = spec->vnode_lswitch[VNID_AMIC1_ASEL -VNODE_START_NID ];if (auto_jack) - jack_present =snd_hda_jack_detect (codec, spec->unsol_tag_amic1); + jack_present =snd_hda_jack_detect (codec, spec->unsol_tag_amic1,0 );else jack_present = spec->vnode_lswitch[VNID_AMIC1_SEL -VNODE_START_NID ];
@@ -7606,7 +7606,7 @@ static void hp_callback(struct hda_codec *codec, struct hda_jack_callback *cb)*/ cancel_delayed_work (&spec->unsol_hp_work);schedule_delayed_work (&spec->unsol_hp_work,msecs_to_jiffies (500 )); - tbl =snd_hda_jack_tbl_get (codec, cb->nid); + tbl =snd_hda_jack_tbl_get (codec, cb->nid,0 );if (tbl) tbl->block_report =1 ; }
@@ -7624,15 +7624,15 @@ static void amic_callback(struct hda_codec *codec, struct hda_jack_callback *cb)static void ca0132_init_unsol (struct hda_codec *codec) {struct ca0132_spec *spec = codec->spec; -snd_hda_jack_detect_enable_callback (codec, spec->unsol_tag_hp, hp_callback); -snd_hda_jack_detect_enable_callback (codec, spec->unsol_tag_amic1, +snd_hda_jack_detect_enable_callback (codec, spec->unsol_tag_hp,0 , hp_callback); +snd_hda_jack_detect_enable_callback (codec, spec->unsol_tag_amic1,0 , amic_callback); -snd_hda_jack_detect_enable_callback (codec,UNSOL_TAG_DSP , +snd_hda_jack_detect_enable_callback (codec,UNSOL_TAG_DSP ,0 , ca0132_process_dsp_response);/* Front headphone jack detection */ if (ca0132_use_alt_functions (spec))snd_hda_jack_detect_enable_callback (codec, - spec->unsol_tag_front_hp, hp_callback); + spec->unsol_tag_front_hp,0 , hp_callback); }/*
sound/pci/hda/patch_cirrus.c +2 -2
@@ -1028,7 +1028,7 @@ static void cs4210_spdif_automute(struct hda_codec *codec, spec->vendor_nid != CS4210_VENDOR_NID)return ; - spdif_present =snd_hda_jack_detect (codec, spdif_pin); + spdif_present =snd_hda_jack_detect (codec, spdif_pin,0 );if (spdif_present == spec->spdif_present)return ;
@@ -1049,7 +1049,7 @@ static void parse_cs421x_digital(struct hda_codec *codec)hda_nid_t nid = cfg->dig_out_pins[i];if (get_wcaps (codec, nid) &AC_WCAP_UNSOL_CAP ) { spec->spdif_detect =1 ; -snd_hda_jack_detect_enable_callback (codec, nid, +snd_hda_jack_detect_enable_callback (codec, nid,0 , cs4210_spdif_automute); } }
sound/pci/hda/patch_conexant.c +1 -1
@@ -261,7 +261,7 @@ static void cxt_update_headset_mode(struct hda_codec *codec) spec->gen.hp_jack_present = false; }else {snd_hda_codec_write_cache (codec,0x1c ,0 ,0x410 ,0x54 );/* disable merged mode for analog int-mic */ - spec->gen.hp_jack_present =snd_hda_jack_detect (codec, spec->gen.autocfg.hp_pins[0 ]); + spec->gen.hp_jack_present =snd_hda_jack_detect (codec, spec->gen.autocfg.hp_pins[0 ],0 ); }snd_hda_gen_update_outputs (codec);
sound/pci/hda/patch_hdmi.c +22 -25
145 lines not on this page · raw message
sound/pci/hda/patch_realtek.c +23 -23
167 lines not on this page · raw message
sound/pci/hda/patch_sigmatel.c +6 -6
@@ -466,7 +466,7 @@ static void jack_update_power(struct hda_codec *codec,if (jack && jack->nid) {stac_toggle_power_map (codec, jack->nid, -snd_hda_jack_detect (codec, jack->nid), +snd_hda_jack_detect (codec, jack->nid,0 ), true);return ; }
@@ -474,10 +474,10 @@ static void jack_update_power(struct hda_codec *codec,/* update all jacks */ for (i =0 ; i < spec->num_pwrs; i++) {hda_nid_t nid = spec->pwr_nids[i]; -if (!snd_hda_jack_tbl_get (codec, nid)) +if (!snd_hda_jack_tbl_get (codec, nid,0 ))continue ;stac_toggle_power_map (codec, nid, -snd_hda_jack_detect (codec, nid), +snd_hda_jack_detect (codec, nid,0 ), false); }
@@ -513,7 +513,7 @@ static void stac_init_power_map(struct hda_codec *codec)if (def_conf ==AC_JACK_PORT_COMPLEX && spec->vref_mute_led_nid != nid &&is_jack_detectable (codec, nid)) { -snd_hda_jack_detect_enable_callback (codec, nid, +snd_hda_jack_detect_enable_callback (codec, nid,0 , jack_update_power); }else {if (def_conf ==AC_JACK_PORT_NONE )
@@ -3063,7 +3063,7 @@ static void stac92hd71bxx_fixup_hp_m4(struct hda_codec *codec,/* Enable VREF power saving on GPIO1 detect */ snd_hda_codec_write_cache (codec, codec->core.afg,0 ,AC_VERB_SET_GPIO_UNSOLICITED_RSP_MASK ,0x02 ); - jack =snd_hda_jack_detect_enable_callback (codec, codec->core.afg, + jack =snd_hda_jack_detect_enable_callback (codec, codec->core.afg,0 , stac_vref_event);if (!IS_ERR (jack)) jack->private_data =0x02 ;
@@ -4105,7 +4105,7 @@ static void stac9205_fixup_dell_m43(struct hda_codec *codec,/* Enable unsol response for GPIO4/Dock HP connection */ snd_hda_codec_write_cache (codec, codec->core.afg,0 ,AC_VERB_SET_GPIO_UNSOLICITED_RSP_MASK ,0x10 ); - jack =snd_hda_jack_detect_enable_callback (codec, codec->core.afg, + jack =snd_hda_jack_detect_enable_callback (codec, codec->core.afg,0 , stac_vref_event);if (!IS_ERR (jack)) jack->private_data =0x01 ;
Signature · 6 lines
2.16.4 _______________________________________________ Alsa-devel mailing list [email protected] https://mailman.alsa-project.org/mailman/listinfo/alsa-devel
Re: [alsa-devel] [PATCH v1 2/5] ALSA: hda - Add DP-MST jack support
Hi Nikhil,
Quoted 4 lines · Nikhil Mahale
This patch adds DP-MST jack support which will be used on NVIDIA platforms. Today, DP-MST audio is supported only if the codec has acomp support. This patch makes it possible to add DP-MST support for non-acomp codecs.
[...]
sound/pci/hda/hda_generic.c static bool detect_pin_state(struct hda_codec *codec, hda_nid_t pin) · line 4207
Quoted 8 lines
+++
b/sound/pci/hda/hda_generic.csound/pci/hda/hda_generic.c +1
-1@@ -4203,7 +4203,7 @@ static bool detect_pin_state(struct hda_codec *codec, hda_nid_t pin) {if (!is_jack_detectable (codec, pin))return true; -return snd_hda_jack_detect_state (codec, pin) !=HDA_JACK_NOT_PRESENT ; +return snd_hda_jack_detect_state (codec, pin,0 ) !=HDA_JACK_NOT_PRESENT ; }
the patch adds quite a few checkpatch warnings. E.g. this line over 80 character limit. Run checkpatch yourself or take a look at e.g.
https://travis-ci.org/thesofproject/linux/jobs/611787177?utm_medium=notification&utm_source=github_status
I'll queued the series to SOF CI to do some testing against regressions on our platforms. I'll report later if anything major found.
Br, Kai
_______________________________________________
Alsa-devel mailing list
[email protected]
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel
Re: [alsa-devel] [PATCH v1 2/5] ALSA: hda - Add DP-MST jack support
Quoted 22 lines · Kai Vehmanen
Hi Nikhil,
Quoted 4 lines · Nikhil Mahale
This patch adds DP-MST jack support which will be used on NVIDIA platforms. Today, DP-MST audio is supported only if the codec has acomp support. This patch makes it possible to add DP-MST support for non-acomp codecs.
[...]
sound/pci/hda/hda_generic.c static bool detect_pin_state(struct hda_codec *codec, hda_nid_t pin) · line 4207
Quoted 8 lines
+++
b/sound/pci/hda/hda_generic.csound/pci/hda/hda_generic.c +1
-1@@ -4203,7 +4203,7 @@ static bool detect_pin_state(struct hda_codec *codec, hda_nid_t pin) {if (!is_jack_detectable (codec, pin))return true; -return snd_hda_jack_detect_state (codec, pin) !=HDA_JACK_NOT_PRESENT ; +return snd_hda_jack_detect_state (codec, pin,0 ) !=HDA_JACK_NOT_PRESENT ; }the patch adds quite a few checkpatch warnings. E.g. this line over 80 character limit. Run checkpatch yourself or take a look at e.g.
https://travis-ci.org/thesofproject/linux/jobs/611787177?utm_medium=notification&utm_source=github_status
Quoted 2 lines
I'll queued the series to SOF CI to do some testing against regressions on our platforms. I'll report later if anything major found.
Thanks Kai, I have fixed all errors reported by checkpatch.pl, in 2nd version of patch set. Sending out 2nd version of patch set for review.
Thanks,
Nikhil Mahale
Quoted 2 lines
Br, Kai
-----------------------------------------------------------------------------------
This email message is for the sole use of the intended recipient(s) and may contain confidential information. Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient, please contact the sender by reply email and destroy all copies of the original message.
-----------------------------------------------------------------------------------
_______________________________________________
Alsa-devel mailing list
[email protected]
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel
Re: [alsa-devel] [PATCH v1 2/5] ALSA: hda - Add DP-MST jack support
In reply to Nikhil MahaleQuoted 37 lines · Nikhil Mahale
This patch adds DP-MST jack support which will be used on NVIDIA platforms. Today, DP-MST audio is supported only if the codec has acomp support. This patch makes it possible to add DP-MST support for non-acomp codecs.
For the codecs supporting DP-MST audio, each pin can contain several device entries. Each device entry is a virtual pin, described by
pin_nidanddev_idin structhdmi_spec_per_pin. For monitor hotplug event handling, non-acomp codecs enable and register jack-detection for everyhdmi_spec_per_pin.This patch updates every relevant function in
hda_jack.hand its implementation inhda_jack.c, to considerdev_idalong withpin_nid.Changes to the HD Audio specification to support DP-MST audio are described in the Intel Document Change Notification (DCN) number HDA040-A.
Quoted 1 line
From HDA040-A, "For the case of multi stream capable Digital Display
Pin Widget, [the Get Pin Sense verb] can be used to read a specific Device Entry state as reported in Get Device List Entry verb." This patch updates the
read_pin_sense()function to take thedev_idas an argument and pass it as a parameter to the Get Pin Sense verb.Bits 15 through 20 from the Unsolicited Response for intrinsic events contain the index of the Device Entry that generated the event. This patch updates the Unsolicited Response event handlers to extract the device entry index from the response and pass it to
snd_hda_jack_tbl_get_from_tag().This patch updates
snd_hda_jack_tbl_new()to take adev_idargument and store it in the jack structure, and to make sure not to generate a different tag when called more than once for the same nid.Signed-off-by Nikhil Mahale <[email protected]>Reviewed-by Aaron Plattner <[email protected]>
Quoted 10 lines
--- sound/pci/hda/hda_generic.c | 16 +++--- sound/pci/hda/hda_jack.c | 107 +++++++++++++++++++++++++++++------------ sound/pci/hda/hda_jack.h | 26 ++++++---- sound/pci/hda/patch_ca0132.c | 24 ++++----- sound/pci/hda/patch_cirrus.c | 4 +- sound/pci/hda/patch_conexant.c | 2 +- sound/pci/hda/patch_hdmi.c | 47 +++++++++--------- sound/pci/hda/patch_realtek.c | 46 +++++++++--------- sound/pci/hda/patch_sigmatel.c | 12 ++---
So this patch touches quite wide range of code just for passing the additional 0. I prefer keeping the old (non-MST) functions as is, while adding a couple of new mst-capable jack function, e.g.
snd_hda_jack_tbl_get_mst(codec, nid, dev_nid); snd_hda_jack_detect_enable_mst(codec, nid, dev_nid, callback);
etc. snd_hda_jack_detect_eanble() and *_callback() can be unified for MST variant, as it's called only from HDMI codec, and also *_get_from_tag() can be extended as it's called only from hda_jack.c and patch_hdmi.c. That is, keep the functions that are accessed outside hda_jack.c and patch_hdmi.c should be kept, while adding a few for handling dev_id.
A few more nitpicks:
sound/pci/hda/hda_jack.c static u32 read_pin_sense(struct hda_codec *codec, hda_nid_t nid) · line 55
Quoted 4 lines
sound/pci/hda/hda_jack.c +0
-0@@ -55,7 +55,7 @@ static u32 read_pin_sense(struct hda_codec *codec, hda_nid_t nid) AC_VERB_SET_PIN_SENSE, 0);
Don't we need to pass dev_id for PIN_SENSE verb, too?
Quoted 10 lines
sound/pci/hda/hda_jack.c +1
-1} val =snd_hda_codec_read (codec, nid,0 , -AC_VERB_GET_PIN_SENSE ,0 ); +AC_VERB_GET_PIN_SENSE , dev_id);sound/pci/hda/patch_hdmi.c +0
-0@@ -784,24 +783,18 @@ static void hdmi_intrinsic_event(struct hda_codec *codec, unsigned int res)struct hda_jack_tbl *jack;
sound/pci/hda/patch_hdmi.c static void hdmi_intrinsic_event(struct hda_codec *codec, unsigned int res) · line 786
Quoted 10 lines
sound/pci/hda/patch_hdmi.c +1
-7int dev_entry = (res &AC_UNSOL_RES_DE ) >>AC_UNSOL_RES_DE_SHIFT ; -/* -* assume DP MST uses dyn_pcm_assign and acomp and -* never comes here -* if DP MST supports unsol event, below code need -* consider dev_entry -*/ - jack =snd_hda_jack_tbl_get_from_tag (codec, tag); + jack =snd_hda_jack_tbl_get_from_tag (codec, tag, dev_entry);
Passing dev_entry unconditionally might be broken on old HDMI codecs. Pass 0 if codec->dp_mst is false.
sound/pci/hda/patch_hdmi.c static void hdmi_intrinsic_event(struct hda_codec *codec, unsigned int res) · line 797
Quoted 13 lines
sound/pci/hda/patch_hdmi.c +2
-2if (!jack)return ; jack->jack_dirty =1 ;codec_dbg (codec,"HDMI hot plug event: Codec=%d Pin=%d Device=%d Inactive=%d Presence_Detect=%d ELD_Valid=%d\n" , - codec->addr, jack->nid, dev_entry, !!(res &AC_UNSOL_RES_IA ), + codec->addr, jack->nid, jack->dev_id, !!(res &AC_UNSOL_RES_IA ), !!(res &AC_UNSOL_RES_PD ), !!(res &AC_UNSOL_RES_ELDV ));/* hda_jack don't support DP MST */ -check_presence_and_report (codec, jack->nid,0 ); +check_presence_and_report (codec, jack->nid, jack->dev_id);
This comment is invalid.
sound/pci/hda/patch_hdmi.c static void hdmi_unsol_event(struct hda_codec *codec, unsigned int res) · line 827
Quoted 5 lines
sound/pci/hda/patch_hdmi.c +1
-0@@ -831,11 +824,12 @@ static void hdmi_unsol_event(struct hda_codec *codec, unsigned int res) {int tag = res >>AC_UNSOL_RES_TAG_SHIFT ;int subtag = (res &AC_UNSOL_RES_SUBTAG ) >>AC_UNSOL_RES_SUBTAG_SHIFT ; +int dev_entry = (res &AC_UNSOL_RES_DE ) >>AC_UNSOL_RES_DE_SHIFT ;
Ditto, let's pass 0 for !codec->dp_mst.
thanks,
Takashi
_______________________________________________
Alsa-devel mailing list
[email protected]
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel
Re: [alsa-devel] [PATCH v1 2/5] ALSA: hda - Add DP-MST jack support
Quoted 64 lines · Takashi Iwai
Quoted 37 lines · Nikhil Mahale
This patch adds DP-MST jack support which will be used on NVIDIA platforms. Today, DP-MST audio is supported only if the codec has acomp support. This patch makes it possible to add DP-MST support for non-acomp codecs.
For the codecs supporting DP-MST audio, each pin can contain several device entries. Each device entry is a virtual pin, described by
pin_nidanddev_idin structhdmi_spec_per_pin. For monitor hotplug event handling, non-acomp codecs enable and register jack-detection for everyhdmi_spec_per_pin.This patch updates every relevant function in
hda_jack.hand its implementation inhda_jack.c, to considerdev_idalong withpin_nid.Changes to the HD Audio specification to support DP-MST audio are described in the Intel Document Change Notification (DCN) number HDA040-A.
Quoted 1 line
From HDA040-A, "For the case of multi stream capable Digital Display
Pin Widget, [the Get Pin Sense verb] can be used to read a specific Device Entry state as reported in Get Device List Entry verb." This patch updates the
read_pin_sense()function to take thedev_idas an argument and pass it as a parameter to the Get Pin Sense verb.Bits 15 through 20 from the Unsolicited Response for intrinsic events contain the index of the Device Entry that generated the event. This patch updates the Unsolicited Response event handlers to extract the device entry index from the response and pass it to
snd_hda_jack_tbl_get_from_tag().This patch updates
snd_hda_jack_tbl_new()to take adev_idargument and store it in the jack structure, and to make sure not to generate a different tag when called more than once for the same nid.Signed-off-by Nikhil Mahale <[email protected]>Reviewed-by Aaron Plattner <[email protected]>Quoted 10 lines
--- sound/pci/hda/hda_generic.c | 16 +++--- sound/pci/hda/hda_jack.c | 107 +++++++++++++++++++++++++++++------------ sound/pci/hda/hda_jack.h | 26 ++++++---- sound/pci/hda/patch_ca0132.c | 24 ++++----- sound/pci/hda/patch_cirrus.c | 4 +- sound/pci/hda/patch_conexant.c | 2 +- sound/pci/hda/patch_hdmi.c | 47 +++++++++--------- sound/pci/hda/patch_realtek.c | 46 +++++++++--------- sound/pci/hda/patch_sigmatel.c | 12 ++---So this patch touches quite wide range of code just for passing the additional 0. I prefer keeping the old (non-MST) functions as is, while adding a couple of new mst-capable jack function, e.g.
snd_hda_jack_tbl_get_mst(codec, nid, dev_nid);snd_hda_jack_detect_enable_mst(codec, nid, dev_nid, callback);etc.
snd_hda_jack_detect_eanble()and*_callback()can be unified for MST variant, as it's called only from HDMI codec, and also*_get_from_tag()can be extended as it's called only fromhda_jack.candpatch_hdmi.c. That is, keep the functions that are accessed outsidehda_jack.candpatch_hdmi.cshould be kept, while adding a few for handlingdev_id.
Quoted 8 lines
A few more nitpicks:
sound/pci/hda/hda_jack.c static u32 read_pin_sense(struct hda_codec *codec, hda_nid_t nid) · line 55
Quoted 4 lines
sound/pci/hda/hda_jack.c +0
-0@@ -55,7 +55,7 @@ static u32 read_pin_sense(struct hda_codec *codec, hda_nid_t nid) AC_VERB_SET_PIN_SENSE, 0);Don't we need to pass
dev_idforPIN_SENSEverb, too?
As per specification, No. I am referring to section 7.3.3.15 from https://www.intel.com/content/dam/www/public/us/en/documents/specification-updates/high-definition-audio-multi-stream.pdf.
Thanks,
Nikhil Mahale
Quoted 50 lines
Quoted 10 lines
sound/pci/hda/hda_jack.c +1
-1} val =snd_hda_codec_read (codec, nid,0 , -AC_VERB_GET_PIN_SENSE ,0 ); +AC_VERB_GET_PIN_SENSE , dev_id);sound/pci/hda/patch_hdmi.c +0
-0@@ -784,24 +783,18 @@ static void hdmi_intrinsic_event(struct hda_codec *codec, unsigned int res)struct hda_jack_tbl *jack;sound/pci/hda/patch_hdmi.c static void hdmi_intrinsic_event(struct hda_codec *codec, unsigned int res) · line 786
Quoted 10 lines
sound/pci/hda/patch_hdmi.c +1
-7int dev_entry = (res &AC_UNSOL_RES_DE ) >>AC_UNSOL_RES_DE_SHIFT ; -/* -* assume DP MST uses dyn_pcm_assign and acomp and -* never comes here -* if DP MST supports unsol event, below code need -* consider dev_entry -*/ - jack =snd_hda_jack_tbl_get_from_tag (codec, tag); + jack =snd_hda_jack_tbl_get_from_tag (codec, tag, dev_entry);Passing
dev_entryunconditionally might be broken on old HDMI codecs. Pass 0 ifcodec->dp_mstis false.sound/pci/hda/patch_hdmi.c static void hdmi_intrinsic_event(struct hda_codec *codec, unsigned int res) · line 797
Quoted 13 lines
sound/pci/hda/patch_hdmi.c +2
-2if (!jack)return ; jack->jack_dirty =1 ;codec_dbg (codec,"HDMI hot plug event: Codec=%d Pin=%d Device=%d Inactive=%d Presence_Detect=%d ELD_Valid=%d\n" , - codec->addr, jack->nid, dev_entry, !!(res &AC_UNSOL_RES_IA ), + codec->addr, jack->nid, jack->dev_id, !!(res &AC_UNSOL_RES_IA ), !!(res &AC_UNSOL_RES_PD ), !!(res &AC_UNSOL_RES_ELDV ));/* hda_jack don't support DP MST */ -check_presence_and_report (codec, jack->nid,0 ); +check_presence_and_report (codec, jack->nid, jack->dev_id);This comment is invalid.
sound/pci/hda/patch_hdmi.c static void hdmi_unsol_event(struct hda_codec *codec, unsigned int res) · line 827
Quoted 5 lines
sound/pci/hda/patch_hdmi.c +1
-0@@ -831,11 +824,12 @@ static void hdmi_unsol_event(struct hda_codec *codec, unsigned int res) {int tag = res >>AC_UNSOL_RES_TAG_SHIFT ;int subtag = (res &AC_UNSOL_RES_SUBTAG ) >>AC_UNSOL_RES_SUBTAG_SHIFT ; +int dev_entry = (res &AC_UNSOL_RES_DE ) >>AC_UNSOL_RES_DE_SHIFT ;Ditto, let's pass 0 for !codec->dp_mst.
Quoted 4 lines
thanks,
Takashi
-----------------------------------------------------------------------------------
This email message is for the sole use of the intended recipient(s) and may contain confidential information. Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient, please contact the sender by reply email and destroy all copies of the original message.
-----------------------------------------------------------------------------------
_______________________________________________
Alsa-devel mailing list
[email protected]
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel
PATCH 3/5 ALSA: hda - Add DP-MST conn list support
In reply to Nikhil MahaleDocument change notification HDA040-A for the Intel High Definition Audio 1.0a specification introduces a Device Select verb for Digital Display Pin Widgets that are multi-stream capable. This verb selects a Device Entry that is used by subsequent Pin Widget verbs, including the Get Connection List Entry verb.
This patch queries the current Device Select value, associates it with the connection list, and updates the connection list management code to consider dev_id along with nid.
--- sound/pci/hda/hda_codec.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
sound/pci/hda/hda_codec.c +4 -1
@@ -88,6 +88,7 @@ struct hda_conn_list {struct list_head list;int len;hda_nid_t nid; +int dev_id;hda_nid_t conns[0 ]; };
@@ -96,8 +97,9 @@ static struct hda_conn_list * lookup_conn_list(struct hda_codec *codec, hda_nid_t nid) {struct hda_conn_list *p; +int dev_id =snd_hda_get_dev_select (codec, nid);list_for_each_entry (p, &codec->conn_list, list) { -if (p->nid == nid) +if (p->nid == nid && p->dev_id == dev_id)return p; }return NULL ;
@@ -113,6 +115,7 @@ static int add_conn_list(struct hda_codec *codec, hda_nid_t nid, int len,return -ENOMEM ; p->len = len; p->nid = nid; + p->dev_id =snd_hda_get_dev_select (codec, nid);memcpy (p->conns, list, len *sizeof (hda_nid_t));list_add (&p->list, &codec->conn_list);return 0 ;
Signature · 6 lines
2.16.4 _______________________________________________ Alsa-devel mailing list [email protected] https://mailman.alsa-project.org/mailman/listinfo/alsa-devel
Re: [alsa-devel] [PATCH v1 3/5] ALSA: hda - Add DP-MST conn list support
Quoted 10 lines · Nikhil Mahale
Document change notification HDA040-A for the Intel High Definition Audio 1.0a specification introduces a Device Select verb for Digital Display Pin Widgets that are multi-stream capable. This verb selects a Device Entry that is used by subsequent Pin Widget verbs, including the Get Connection List Entry verb.
This patch queries the current Device Select value, associates it with the connection list, and updates the connection list management code to consider
dev_idalong with nid.
I don't get why this is needed. This is the list that is added only from snd_hda_override_conn_list(), and you don't change that call pattern, so dev_id is always zero.
thanks,
Takashi
Quoted 41 lines
Signed-off-by Nikhil Mahale <[email protected]>Reviewed-by Aaron Plattner <[email protected]>--- sound/pci/hda/hda_codec.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)sound/pci/hda/hda_codec.c +4
-1@@ -88,6 +88,7 @@ struct hda_conn_list {struct list_head list;int len;hda_nid_t nid; +int dev_id;hda_nid_t conns[0 ]; };@@ -96,8 +97,9 @@ static struct hda_conn_list * lookup_conn_list(struct hda_codec *codec, hda_nid_t nid) {struct hda_conn_list *p; +int dev_id =snd_hda_get_dev_select (codec, nid);list_for_each_entry (p, &codec->conn_list, list) { -if (p->nid == nid) +if (p->nid == nid && p->dev_id == dev_id)return p; }return NULL ;@@ -113,6 +115,7 @@ static int add_conn_list(struct hda_codec *codec, hda_nid_t nid, int len,return -ENOMEM ; p->len = len; p->nid = nid; + p->dev_id =snd_hda_get_dev_select (codec, nid);memcpy (p->conns, list, len *sizeof (hda_nid_t));list_add (&p->list, &codec->conn_list);return 0 ;Signature · 1 line
2.16.4
_______________________________________________
Alsa-devel mailing list
[email protected]
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel
Re: [alsa-devel] [PATCH v1 3/5] ALSA: hda - Add DP-MST conn list support
Quoted 9 lines · Takashi Iwai
Quoted 7 lines · Nikhil Mahale
Document change notification HDA040-A for the Intel High Definition Audio 1.0a specification introduces a Device Select verb for Digital Display Pin Widgets that are multi-stream capable. This verb selects a Device Entry that is used by subsequent Pin Widget verbs, including the Get Connection List Entry verb.
Quoted 7 lines
Quoted 3 lines
This patch queries the current Device Select value, associates it with the connection list, and updates the connection list management code to consider
dev_idalong with nid.I don't get why this is needed. This is the list that is added only from
snd_hda_override_conn_list(), and you don't change that call pattern, sodev_idis always zero.
In follow-on patch "ALSA: hda - Add DP-MST support for non-acomp codecs", hdmi_read_pin_conn() calls into snd_hda_set_dev_select() before running into code path -
snd_hda_get_connections()
|-> snd_hda_get_conn_list()
|-> read_and_add_raw_conns()
|-> snd_hda_override_conn_list()
|-> add_conn_list()If I understand spec correctly, conn_list need to read/write/track along with device entry set into AC_VERB_SET_DEVICE_SEL verb, right? This patch address that limited part here.
Thanks,
Nikhil Mahale
Quoted 37 lines
thanks,
Takashi
Quoted 33 lines
Signed-off-by Nikhil Mahale <[email protected]>Reviewed-by Aaron Plattner <[email protected]>--- sound/pci/hda/hda_codec.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)sound/pci/hda/hda_codec.c +3
-1@@ -88,6 +88,7 @@ struct hda_conn_list {struct list_head list;int len;hda_nid_t nid; +int dev_id;hda_nid_t conns[0 ]; };@@ -96,8 +97,9 @@ static struct hda_conn_list * lookup_conn_list(struct hda_codec *codec, hda_nid_t nid) {struct hda_conn_list *p; +int dev_id =snd_hda_get_dev_select (codec, nid);list_for_each_entry (p, &codec->conn_list, list) { -if (p->nid == nid) +if (p->nid == nid && p->dev_id == dev_id)return p; }return NULL ;@@ -113,6 +115,7 @@ static int add_conn_list(struct hda_codec *codec, hda_nid_t nid, int len,return -ENOMEM ; p->len = len;
Quoted 8 lines
Quoted 8 lines
sound/pci/hda/hda_codec.c +1
-0p->nid = nid; + p->dev_id =snd_hda_get_dev_select (codec, nid);memcpy (p->conns, list, len *sizeof (hda_nid_t));list_add (&p->list, &codec->conn_list);return 0 ;Signature · 1 line
2.16.4
-----------------------------------------------------------------------------------
This email message is for the sole use of the intended recipient(s) and may contain confidential information. Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient, please contact the sender by reply email and destroy all copies of the original message.
-----------------------------------------------------------------------------------
_______________________________________________
Alsa-devel mailing list
[email protected]
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel
Re: [alsa-devel] [PATCH v1 3/5] ALSA: hda - Add DP-MST conn list support
Quoted 23 lines · Nikhil Mahale
Quoted 9 lines · Takashi Iwai
Quoted 7 lines · Nikhil Mahale
Document change notification HDA040-A for the Intel High Definition Audio 1.0a specification introduces a Device Select verb for Digital Display Pin Widgets that are multi-stream capable. This verb selects a Device Entry that is used by subsequent Pin Widget verbs, including the Get Connection List Entry verb.
Quoted 7 lines
Quoted 3 lines
This patch queries the current Device Select value, associates it with the connection list, and updates the connection list management code to consider
dev_idalong with nid.I don't get why this is needed. This is the list that is added only from
snd_hda_override_conn_list(), and you don't change that call pattern, sodev_idis always zero.In follow-on patch "ALSA: hda - Add DP-MST support for non-acomp codecs",
hdmi_read_pin_conn()calls intosnd_hda_set_dev_select()before running into code path -
Quoted 8 lines
snd_hda_get_connections()
|->snd_hda_get_conn_list()|-> read_and_add_raw_conns() |-> snd_hda_override_conn_list() |-> add_conn_list()If I understand spec correctly,
conn_listneed to read/write/track along with device entry set intoAC_VERB_SET_DEVICE_SELverb, right?
AFAIK, the device connection list itself is same no matter which device entry is. The pin widget may choose the route per device entry, but the available routes should be same.
Takashi
_______________________________________________
Alsa-devel mailing list
[email protected]
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel
Re: [alsa-devel] [PATCH v1 3/5] ALSA: hda - Add DP-MST conn list support
Quoted 31 lines · Takashi Iwai
Quoted 29 lines · Nikhil Mahale
Quoted 9 lines · Takashi Iwai
Quoted 7 lines · Nikhil Mahale
Document change notification HDA040-A for the Intel High Definition Audio 1.0a specification introduces a Device Select verb for Digital Display Pin Widgets that are multi-stream capable. This verb selects a Device Entry that is used by subsequent Pin Widget verbs, including the Get Connection List Entry verb.
Quoted 7 lines
Quoted 3 lines
This patch queries the current Device Select value, associates it with the connection list, and updates the connection list management code to consider
dev_idalong with nid.I don't get why this is needed. This is the list that is added only from
snd_hda_override_conn_list(), and you don't change that call pattern, sodev_idis always zero.In follow-on patch "ALSA: hda - Add DP-MST support for non-acomp codecs",
hdmi_read_pin_conn()calls intosnd_hda_set_dev_select()before running into code path -
snd_hda_get_connections()
|->snd_hda_get_conn_list()|-> read_and_add_raw_conns() |-> snd_hda_override_conn_list() |-> add_conn_list()
Quoted 6 lines
Quoted 2 lines
If I understand spec correctly,
conn_listneed to read/write/track along with device entry set intoAC_VERB_SET_DEVICE_SELverb, right?AFAIK, the device connection list itself is same no matter which device entry is. The pin widget may choose the route per device entry, but the available routes should be same.
Section 7.3.3.42 of https://www.intel.com/content/dam/www/public/us/en/documents/specification-updates/high-definition-audio-multi-stream.pdf says that 'Get Connection List Entry' control should be per-device!
Thanks,
Nikhil Mahale
Quoted 2 lines
Takashi
-----------------------------------------------------------------------------------
This email message is for the sole use of the intended recipient(s) and may contain confidential information. Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient, please contact the sender by reply email and destroy all copies of the original message.
-----------------------------------------------------------------------------------
_______________________________________________
Alsa-devel mailing list
[email protected]
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel
Re: [alsa-devel] [PATCH v1 3/5] ALSA: hda - Add DP-MST conn list support
Quoted 33 lines · Nikhil Mahale
Quoted 31 lines · Takashi Iwai
Quoted 29 lines · Nikhil Mahale
Quoted 9 lines · Takashi Iwai
Quoted 7 lines · Nikhil Mahale
Document change notification HDA040-A for the Intel High Definition Audio 1.0a specification introduces a Device Select verb for Digital Display Pin Widgets that are multi-stream capable. This verb selects a Device Entry that is used by subsequent Pin Widget verbs, including the Get Connection List Entry verb.
Quoted 7 lines
Quoted 3 lines
This patch queries the current Device Select value, associates it with the connection list, and updates the connection list management code to consider
dev_idalong with nid.I don't get why this is needed. This is the list that is added only from
snd_hda_override_conn_list(), and you don't change that call pattern, sodev_idis always zero.In follow-on patch "ALSA: hda - Add DP-MST support for non-acomp codecs",
hdmi_read_pin_conn()calls intosnd_hda_set_dev_select()before running into code path -
snd_hda_get_connections()
|->snd_hda_get_conn_list()|-> read_and_add_raw_conns() |-> snd_hda_override_conn_list() |-> add_conn_list()
Quoted 8 lines
Quoted 6 lines
Quoted 2 lines
If I understand spec correctly,
conn_listneed to read/write/track along with device entry set intoAC_VERB_SET_DEVICE_SELverb, right?AFAIK, the device connection list itself is same no matter which device entry is. The pin widget may choose the route per device entry, but the available routes should be same.
Section 7.3.3.42 of https://www.intel.com/content/dam/www/public/us/en/documents/specification-updates/high-definition-audio-multi-stream.pdf says that 'Get Connection List Entry' control should be per-device!
Hrm, right. It's a bit concern that this may lead to the unlimited number of data, though.
Since the necessity is only for HDMI codec, if that's the only place we need the connection list, the call there can be replaced with snd_hda_get_raw_connections() so that the result won't be cached in HD-audio core side.
Takashi
_______________________________________________
Alsa-devel mailing list
[email protected]
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel
Re: [alsa-devel] [PATCH v1 3/5] ALSA: hda - Add DP-MST conn list support
Thanks,
Nikhil Mahale
Quoted 44 lines · Takashi Iwai
Quoted 33 lines · Nikhil Mahale
Quoted 31 lines · Takashi Iwai
Quoted 29 lines · Nikhil Mahale
Quoted 9 lines · Takashi Iwai
Quoted 7 lines · Nikhil Mahale
Document change notification HDA040-A for the Intel High Definition Audio 1.0a specification introduces a Device Select verb for Digital Display Pin Widgets that are multi-stream capable. This verb selects a Device Entry that is used by subsequent Pin Widget verbs, including the Get Connection List Entry verb.
Quoted 7 lines
Quoted 3 lines
This patch queries the current Device Select value, associates it with the connection list, and updates the connection list management code to consider
dev_idalong with nid.I don't get why this is needed. This is the list that is added only from
snd_hda_override_conn_list(), and you don't change that call pattern, sodev_idis always zero.In follow-on patch "ALSA: hda - Add DP-MST support for non-acomp codecs",
hdmi_read_pin_conn()calls intosnd_hda_set_dev_select()before running into code path -
snd_hda_get_connections()
|->snd_hda_get_conn_list()|-> read_and_add_raw_conns() |-> snd_hda_override_conn_list() |-> add_conn_list()Quoted 8 lines
Quoted 6 lines
Quoted 2 lines
If I understand spec correctly,
conn_listneed to read/write/track along with device entry set intoAC_VERB_SET_DEVICE_SELverb, right?AFAIK, the device connection list itself is same no matter which device entry is. The pin widget may choose the route per device entry, but the available routes should be same.
Section 7.3.3.42 of https://www.intel.com/content/dam/www/public/us/en/documents/specification-updates/high-definition-audio-multi-stream.pdf says that 'Get Connection List Entry' control should be per-device!
Quoted 7 lines
Hrm, right. It's a bit concern that this may lead to the unlimited number of data, though.
Since the necessity is only for HDMI codec, if that's the only place we need the connection list, the call there can be replaced with
snd_hda_get_raw_connections()so that the result won't be cached in HD-audio core side.
Ok, I am addressing this in 3rd version of patch set.
Thanks,
Nikhil Mahale
Quoted 2 lines
Takashi
-----------------------------------------------------------------------------------
This email message is for the sole use of the intended recipient(s) and may contain confidential information. Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient, please contact the sender by reply email and destroy all copies of the original message.
-----------------------------------------------------------------------------------
_______________________________________________
Alsa-devel mailing list
[email protected]
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel
PATCH 4/5 ALSA: hda - Add DP-MST support for non-acomp codecs
In reply to Nikhil MahaleThis patch make it possible for non-acomp codecs to set dyn_pcm_assign/dp_mst and get DP-MST audio support.
Document change notification HDA040-A for the Intel High Definition Audio 1.0a specification introduces a Device Select verb for Digital Display Pin Widgets that are multi-stream capable. This verb selects a Device Entry that is used by subsequent Pin Widget verbs. Once the Device Entry is selected, all subsequent Pin Widget verbs controlling the sink device will be directed to the selected Device Entry until the Device Select verb is updated with a new value.
These Pin Widget verbs include:
* Connection Select
* Get Connection List Entry
* Amplifier Gain/Mute
* Power State
* Pin Widget Control
* ELD Data
* DIP-Size
* DIP-Index
* DIP-Data
* DIP-XmitCtrl
* Content Protection Control
* ASP Channel Mapping
This patch adds calls to snd_hda_set_dev_select() to direct each of these Pin Widget control verbs to the correct Device Entry.
--- sound/pci/hda/patch_hdmi.c | 91 +++++++++++++++++++++++++++++++--------------- 1 file changed, 61 insertions(+), 30 deletions(-)
sound/pci/hda/patch_hdmi.c +61 -30
@@ -97,16 +97,19 @@ struct hdmi_spec_per_pin {/* operations used by generic code that can be overridden by patches */ struct hdmi_ops {int (*pin_get_eld)(struct hda_codec *codec,hda_nid_t pin_nid, -unsigned char *buf,int *eld_size); +int dev_id,unsigned char *buf,int *eld_size);void (*pin_setup_infoframe)(struct hda_codec *codec,hda_nid_t pin_nid, +int dev_id,int ca,int active_channels,int conn_type);/* enable/disable HBR (HD passthrough) */ -int (*pin_hbr_setup)(struct hda_codec *codec,hda_nid_t pin_nid,bool hbr); +int (*pin_hbr_setup)(struct hda_codec *codec,hda_nid_t pin_nid, +int dev_id,bool hbr);int (*setup_stream)(struct hda_codec *codec,hda_nid_t cvt_nid, -hda_nid_t pin_nid,u32 stream_tag,int format); +hda_nid_t pin_nid,int dev_id,u32 stream_tag, +int format); void (*pin_cvt_fixup)(struct hda_codec *codec, struct hdmi_spec_per_pin *per_pin,
@@ -652,8 +655,16 @@ static bool hdmi_infoframe_uptodate(struct hda_codec *codec, hda_nid_t pin_nid,return true; } +static int hdmi_pin_get_eld (struct hda_codec *codec,hda_nid_t nid, +int dev_id,unsigned char *buf,int *eld_size) +{ +snd_hda_set_dev_select (codec, nid, dev_id); + +return snd_hdmi_get_eld (codec, nid, buf, eld_size); +} +static void hdmi_pin_setup_infoframe (struct hda_codec *codec, -hda_nid_t pin_nid, +hda_nid_t pin_nid,int dev_id,int ca,int active_channels,int conn_type) {
@@ -683,6 +694,8 @@ static void hdmi_pin_setup_infoframe(struct hda_codec *codec,return ; } +snd_hda_set_dev_select (codec, pin_nid, dev_id); +/* * sizeof(ai) is used instead of sizeof(*hdmi_ai) or * sizeof(*dp_ai) to avoid partial match/update problems when
@@ -708,6 +721,7 @@ static void hdmi_setup_audio_infoframe(struct hda_codec *codec,struct hdmi_spec *spec = codec->spec;struct hdac_chmap *chmap = &spec->chmap;hda_nid_t pin_nid = per_pin->pin_nid; +int dev_id = per_pin->dev_id;int channels = per_pin->channels;int active_channels;struct hdmi_eld *eld;
@@ -716,6 +730,8 @@ static void hdmi_setup_audio_infoframe(struct hda_codec *codec,if (!channels)return ; +snd_hda_set_dev_select (codec, pin_nid, dev_id); +/* some HW (e.g. HSW+) needs reprogramming the amp at each time */ if (get_wcaps (codec, pin_nid) &AC_WCAP_OUT_AMP ) snd_hda_codec_write(codec, pin_nid, 0,
@@ -741,8 +757,8 @@ static void hdmi_setup_audio_infoframe(struct hda_codec *codec, pin_nid, non_pcm, ca, channels, per_pin->chmap, per_pin->chmap_set); - spec->ops.pin_setup_infoframe (codec, pin_nid, ca, active_channels, - eld->info.conn_type); + spec->ops.pin_setup_infoframe (codec, pin_nid, dev_id, + ca, active_channels, eld->info.conn_type); per_pin->non_pcm = non_pcm; }
@@ -870,11 +886,12 @@ static void haswell_verify_D0(struct hda_codec *codec, ((format & AC_FMT_TYPE_NON_PCM) && (format & AC_FMT_CHAN_MASK) == 7)static int hdmi_pin_hbr_setup (struct hda_codec *codec,hda_nid_t pin_nid, -bool hbr) +int dev_id,bool hbr) {int pinctl, new_pinctl;if (snd_hda_query_pin_caps (codec, pin_nid) &AC_PINCAP_HBR ) { +snd_hda_set_dev_select (codec, pin_nid, dev_id); pinctl =snd_hda_codec_read (codec, pin_nid,0 ,AC_VERB_GET_PIN_WIDGET_CONTROL ,0 );
@@ -904,13 +921,15 @@ static int hdmi_pin_hbr_setup(struct hda_codec *codec, hda_nid_t pin_nid, }static int hdmi_setup_stream (struct hda_codec *codec,hda_nid_t cvt_nid, -hda_nid_t pin_nid,u32 stream_tag,int format) +hda_nid_t pin_nid,int dev_id, +u32 stream_tag,int format) {struct hdmi_spec *spec = codec->spec;unsigned int param;int err; - err = spec->ops.pin_hbr_setup (codec, pin_nid,is_hbr_format (format)); + err = spec->ops.pin_hbr_setup (codec, pin_nid, dev_id, +is_hbr_format (format));if (err) {codec_dbg (codec,"hdmi_setup_stream: HBR is not supported\n" );
@@ -1284,6 +1303,7 @@ static int hdmi_read_pin_conn(struct hda_codec *codec, int pin_idx)struct hdmi_spec *spec = codec->spec;struct hdmi_spec_per_pin *per_pin =get_pin (spec, pin_idx);hda_nid_t pin_nid = per_pin->pin_nid; +int dev_id = per_pin->dev_id;if (!(get_wcaps (codec, pin_nid) &AC_WCAP_CONN_LIST )) { codec_warn(codec,
@@ -1292,6 +1312,8 @@ static int hdmi_read_pin_conn(struct hda_codec *codec, int pin_idx)return -EINVAL ; } +snd_hda_set_dev_select (codec, pin_nid, dev_id); +/* all the device entries on the same pin have the same conn list */ per_pin->num_mux_nids = snd_hda_get_connections(codec, pin_nid, per_pin->mux_nids,
@@ -1503,6 +1525,7 @@ static bool hdmi_present_sense_via_verbs(struct hdmi_spec_per_pin *per_pin,struct hdmi_spec *spec = codec->spec;struct hdmi_eld *eld = &spec->temp_eld;hda_nid_t pin_nid = per_pin->pin_nid; +int dev_id = per_pin->dev_id;/* * Always execute a GetPinSense verb here, even when called from * hdmi_intrinsic_event; for some NVIDIA HW, the unsolicited
@@ -1515,7 +1538,7 @@ static bool hdmi_present_sense_via_verbs(struct hdmi_spec_per_pin *per_pin,bool ret;bool do_repoll = false; - present =snd_hda_jack_pin_sense (codec, pin_nid, per_pin->dev_id); + present =snd_hda_jack_pin_sense (codec, pin_nid, dev_id);mutex_lock (&per_pin->lock); eld->monitor_present = !!(present &AC_PINSENSE_PRESENCE );
@@ -1529,8 +1552,8 @@ static bool hdmi_present_sense_via_verbs(struct hdmi_spec_per_pin *per_pin, codec->addr, pin_nid, eld->monitor_present, eld->eld_valid);if (eld->eld_valid) { -if (spec->ops.pin_get_eld (codec, pin_nid, eld->eld_buffer, - &eld->eld_size) <0 ) +if (spec->ops.pin_get_eld (codec, pin_nid, dev_id, + eld->eld_buffer, &eld->eld_size) <0 ) eld->eld_valid = false;else { if (snd_hdmi_parse_eld(codec, &eld->info, eld->eld_buffer,
@@ -1866,7 +1889,6 @@ static int generic_hdmi_playback_pcm_prepare(struct hda_pcm_stream *hinfo,struct hdmi_spec *spec = codec->spec;int pin_idx;struct hdmi_spec_per_pin *per_pin; -hda_nid_t pin_nid;struct snd_pcm_runtime *runtime = substream->runtime;bool non_pcm;int pinctl, stripe;
@@ -1890,7 +1912,6 @@ static int generic_hdmi_playback_pcm_prepare(struct hda_pcm_stream *hinfo, goto unlock; } per_pin =get_pin (spec, pin_idx); - pin_nid = per_pin->pin_nid;/* Verify pin:cvt selections to avoid silent audio after S3. * After S3, the audio driver restores pin:cvt selections
@@ -1905,8 +1926,8 @@ static int generic_hdmi_playback_pcm_prepare(struct hda_pcm_stream *hinfo,/* Call sync_audio_rate to set the N/CTS/M manually if necessary */ /* Todo: add DP1.2 MST audio support later */ if (codec_has_acomp (codec)) -snd_hdac_sync_audio_rate (&codec->core, pin_nid, per_pin->dev_id, - runtime->rate); +snd_hdac_sync_audio_rate (&codec->core, per_pin->pin_nid, + per_pin->dev_id, runtime->rate); non_pcm =check_non_pcm_per_cvt (codec, cvt_nid);mutex_lock (&per_pin->lock);
@@ -1924,16 +1945,17 @@ static int generic_hdmi_playback_pcm_prepare(struct hda_pcm_stream *hinfo,hdmi_setup_audio_infoframe (codec, per_pin, non_pcm);mutex_unlock (&per_pin->lock);if (spec->dyn_pin_out) { - pinctl =snd_hda_codec_read (codec, pin_nid,0 , +snd_hda_set_dev_select (codec, per_pin->pin_nid, per_pin->dev_id); + pinctl =snd_hda_codec_read (codec, per_pin->pin_nid,0 ,AC_VERB_GET_PIN_WIDGET_CONTROL ,0 ); -snd_hda_codec_write (codec, pin_nid,0 , +snd_hda_codec_write (codec, per_pin->pin_nid,0 ,AC_VERB_SET_PIN_WIDGET_CONTROL , pinctl |PIN_OUT ); }/* snd_hda_set_dev_select() has been called before */ - err = spec->ops.setup_stream (codec, cvt_nid, pin_nid, - stream_tag, format); + err = spec->ops.setup_stream (codec, cvt_nid, per_pin->pin_nid, + per_pin->dev_id, stream_tag, format); unlock:mutex_unlock (&spec->pcm_lock);return err;
@@ -1985,6 +2007,7 @@ static int hdmi_pcm_close(struct hda_pcm_stream *hinfo, per_pin =get_pin (spec, pin_idx);if (spec->dyn_pin_out) { +snd_hda_set_dev_select (codec, per_pin->pin_nid, per_pin->dev_id); pinctl =snd_hda_codec_read (codec, per_pin->pin_nid,0 ,AC_VERB_GET_PIN_WIDGET_CONTROL ,0 ); snd_hda_codec_write(codec, per_pin->pin_nid, 0,
@@ -2359,7 +2382,7 @@ static const struct hda_codec_ops generic_hdmi_patch_ops = { };static const struct hdmi_ops generic_standard_hdmi_ops = { - .pin_get_eld = snd_hdmi_get_eld, + .pin_get_eld = hdmi_pin_get_eld, .pin_setup_infoframe = hdmi_pin_setup_infoframe, .pin_hbr_setup = hdmi_pin_hbr_setup, .setup_stream = hdmi_setup_stream,
@@ -2736,10 +2759,12 @@ static void register_i915_notifier(struct hda_codec *codec)/* setup_stream ops override for HSW+ */ static int i915_hsw_setup_stream (struct hda_codec *codec,hda_nid_t cvt_nid, -hda_nid_t pin_nid,u32 stream_tag,int format) +hda_nid_t pin_nid,int dev_id,u32 stream_tag, +int format) {haswell_verify_D0 (codec, cvt_nid, pin_nid); -return hdmi_setup_stream (codec, cvt_nid, pin_nid, stream_tag, format); +return hdmi_setup_stream (codec, cvt_nid, pin_nid, dev_id, + stream_tag, format); }/* pin_cvt_fixup ops override for HSW+ and VLV+ */
@@ -3705,16 +3730,19 @@ static int patch_tegra_hdmi(struct hda_codec *codec)#define ATI_HBR_ENABLE 0x10static int atihdmi_pin_get_eld (struct hda_codec *codec,hda_nid_t nid, -unsigned char *buf,int *eld_size) +int dev_id,unsigned char *buf,int *eld_size) { +WARN_ON (dev_id !=0 );/* call hda_eld.c ATI/AMD-specific function */ return snd_hdmi_get_eld_ati (codec, nid, buf, eld_size,is_amdhdmi_rev3_or_later (codec)); } -static void atihdmi_pin_setup_infoframe (struct hda_codec *codec,hda_nid_t pin_nid,int ca, -int active_channels,int conn_type) +static void atihdmi_pin_setup_infoframe (struct hda_codec *codec,hda_nid_t pin_nid, +int dev_id,int ca,int active_channels, +int conn_type) { +WARN_ON (dev_id !=0 );snd_hda_codec_write (codec, pin_nid,0 ,ATI_VERB_SET_CHANNEL_ALLOCATION , ca); }
@@ -3905,10 +3933,12 @@ static void atihdmi_paired_cea_alloc_to_tlv_chmap(struct hdac_chmap *hchmap, }static int atihdmi_pin_hbr_setup (struct hda_codec *codec,hda_nid_t pin_nid, -bool hbr) +int dev_id,bool hbr) {int hbr_ctl, hbr_ctl_new; +WARN_ON (dev_id !=0 ); + hbr_ctl =snd_hda_codec_read (codec, pin_nid,0 ,ATI_VERB_GET_HBR_CONTROL ,0 );if (hbr_ctl >=0 && (hbr_ctl &ATI_HBR_CAPABLE )) {if (hbr)
@@ -3934,9 +3964,9 @@ static int atihdmi_pin_hbr_setup(struct hda_codec *codec, hda_nid_t pin_nid, }static int atihdmi_setup_stream (struct hda_codec *codec,hda_nid_t cvt_nid, -hda_nid_t pin_nid,u32 stream_tag,int format) +hda_nid_t pin_nid,int dev_id, +u32 stream_tag,int format) { -if (is_amdhdmi_rev3_or_later (codec)) {int ramp_rate =180 ;/* default as per AMD spec */ /* disable ramp-up/down for non-pcm as per AMD spec */
@@ -3946,7 +3976,8 @@ static int atihdmi_setup_stream(struct hda_codec *codec, hda_nid_t cvt_nid,snd_hda_codec_write (codec, cvt_nid,0 ,ATI_VERB_SET_RAMP_RATE , ramp_rate); } -return hdmi_setup_stream (codec, cvt_nid, pin_nid, stream_tag, format); +return hdmi_setup_stream (codec, cvt_nid, pin_nid, dev_id, + stream_tag, format); }
Signature · 6 lines
2.16.4 _______________________________________________ Alsa-devel mailing list [email protected] https://mailman.alsa-project.org/mailman/listinfo/alsa-devel
PATCH 5/5 ALSA: hda - Add DP-MST support for NVIDIA codecs
In reply to Nikhil MahaleThis patch adds DP-MST support for GK104+ NVIDIA codecs.
GK104+ NVIDIA codecs support DP-MST audio. These codecs have 4 output converters and 4 pin widgets, with 4 device entries per pin widget for a total of 16 device entries.
This patch moves the existing patch_nvhdmi() definition to patch_nvhdmi_legacy(), used by pre-GK104 NVIDIA codecs. Redefine patch_nvhdmi() to enable DP-MST support by setting codec->dp_mst and spec->dyn_pcm_assign.
Introduce NVIDIA-specific logic for dynamic pcm assignment, making sure that new pcm assignments are compatible with the legacy static per_pin-pmc assignment that existed in the days before DP-MST.
--- sound/pci/hda/patch_hdmi.c | 119 +++++++++++++++++++++++++++++++++++++-------- 1 file changed, 100 insertions(+), 19 deletions(-)
sound/pci/hda/patch_hdmi.c +100 -19
@@ -33,6 +33,8 @@#include "hda_local.h" #include "hda_jack.h" +struct hdmi_spec ; +static bool static_hdmi_pcm;module_param (static_hdmi_pcm, bool,0644 );MODULE_PARM_DESC (static_hdmi_pcm,"Don't restrict PCM parameters per ELD info" );
@@ -114,6 +116,9 @@ struct hdmi_ops {void (*pin_cvt_fixup)(struct hda_codec *codec,struct hdmi_spec_per_pin *per_pin,hda_nid_t cvt_nid); +int (*find_pcm_slot)(struct hdmi_spec *spec, +struct hdmi_spec_per_pin *per_pin); + };struct hdmi_pcm {
@@ -1353,7 +1358,7 @@ static void hdmi_attach_hda_pcm(struct hdmi_spec *spec,/* pcm already be attached to the pin */ if (per_pin->pcm)return ; - idx =hdmi_find_pcm_slot (spec, per_pin); + idx = spec->ops.find_pcm_slot (spec, per_pin);if (idx == -EBUSY )return ; per_pin->pcm_idx = idx;
@@ -2386,6 +2391,7 @@ static const struct hdmi_ops generic_standard_hdmi_ops = { .pin_setup_infoframe = hdmi_pin_setup_infoframe, .pin_hbr_setup = hdmi_pin_hbr_setup, .setup_stream = hdmi_setup_stream, + .find_pcm_slot = hdmi_find_pcm_slot, };/* allocate codec->spec and assign/initialize generic parser ops */
@@ -3494,11 +3500,86 @@ static const struct drm_audio_component_audio_ops nvhdmi_audio_ops = { .master_unbind = generic_acomp_master_unbind, }; +static int nvhdmi_find_pcm_slot (struct hdmi_spec *spec, +struct hdmi_spec_per_pin *per_pin) +{ +int i; + +/* +* generic_hdmi_build_pcms() allocates (num_nids + dev_num - 1) +* number of pcms. +* +* The per_pin of pin_nid_idx=n and dev_id=m prefers to get pcm-n if m==0. +* This guarantees that dynamic pcm assignments are compatible with the +* legacy static per_pin-pmc assignment that existed in the days before +* DP-MST. +* +* per_pin of m!=0 prefers to get pcm=(num_nids + (m - 1)). +*/ +if (per_pin->dev_id ==0 && + !test_bit (per_pin->pin_nid_idx, &spec->pcm_bitmap)) +return per_pin->pin_nid_idx; + +if (per_pin->dev_id !=0 && + !(test_bit (spec->num_nids + (per_pin->dev_id -1 ), + &spec->pcm_bitmap))) { +return spec->num_nids + (per_pin->dev_id -1 ); + } + +/* have a second try; check the area over num_nids */ +for (i = spec->num_nids; i < spec->pcm_used; i++) { +if (!test_bit (i, &spec->pcm_bitmap)) +return i; + } + +/* the last try; check the empty slots in pins */ +for (i =0 ; i < spec->num_nids; i++) { +if (!test_bit (i, &spec->pcm_bitmap)) +return i; + } +return -EBUSY ; +} +static int patch_nvhdmi (struct hda_codec *codec) {struct hdmi_spec *spec;int err; + err =alloc_generic_hdmi (codec); +if (err <0 ) +return err; + codec->dp_mst = true; + + spec = codec->spec; + spec->dyn_pcm_assign = true; + spec->ops.find_pcm_slot = nvhdmi_find_pcm_slot; + + err =hdmi_parse_codec (codec); +if (err <0 ) { +generic_spec_free (codec); +return err; + } + +generic_hdmi_init_per_pins (codec); + + spec->dyn_pin_out = true; + + spec->chmap.ops.chmap_cea_alloc_validate_get_type = + nvhdmi_chmap_cea_alloc_validate_get_type; + spec->chmap.ops.chmap_validate = nvhdmi_chmap_validate; + + codec->link_down_at_suspend =1 ; + +generic_acomp_init (codec, &nvhdmi_audio_ops, nvhdmi_port2pin); + +return 0 ; +} + +static int patch_nvhdmi_legacy (struct hda_codec *codec) +{ +struct hdmi_spec *spec; +int err; + err =patch_generic_hdmi (codec);if (err)return err;
@@ -4107,25 +4188,25 @@ HDA_CODEC_ENTRY(0x10de0004, "GPU 04 HDMI", patch_nvhdmi_8ch_7x),HDA_CODEC_ENTRY (0x10de0005 ,"MCP77/78 HDMI" , patch_nvhdmi_8ch_7x),HDA_CODEC_ENTRY (0x10de0006 ,"MCP77/78 HDMI" , patch_nvhdmi_8ch_7x),HDA_CODEC_ENTRY (0x10de0007 ,"MCP79/7A HDMI" , patch_nvhdmi_8ch_7x), -HDA_CODEC_ENTRY (0x10de0008 ,"GPU 08 HDMI/DP" , patch_nvhdmi), -HDA_CODEC_ENTRY (0x10de0009 ,"GPU 09 HDMI/DP" , patch_nvhdmi), -HDA_CODEC_ENTRY (0x10de000a ,"GPU 0a HDMI/DP" , patch_nvhdmi), -HDA_CODEC_ENTRY (0x10de000b ,"GPU 0b HDMI/DP" , patch_nvhdmi), -HDA_CODEC_ENTRY (0x10de000c ,"MCP89 HDMI" , patch_nvhdmi), -HDA_CODEC_ENTRY (0x10de000d ,"GPU 0d HDMI/DP" , patch_nvhdmi), -HDA_CODEC_ENTRY (0x10de0010 ,"GPU 10 HDMI/DP" , patch_nvhdmi), -HDA_CODEC_ENTRY (0x10de0011 ,"GPU 11 HDMI/DP" , patch_nvhdmi), -HDA_CODEC_ENTRY (0x10de0012 ,"GPU 12 HDMI/DP" , patch_nvhdmi), -HDA_CODEC_ENTRY (0x10de0013 ,"GPU 13 HDMI/DP" , patch_nvhdmi), -HDA_CODEC_ENTRY (0x10de0014 ,"GPU 14 HDMI/DP" , patch_nvhdmi), -HDA_CODEC_ENTRY (0x10de0015 ,"GPU 15 HDMI/DP" , patch_nvhdmi), -HDA_CODEC_ENTRY (0x10de0016 ,"GPU 16 HDMI/DP" , patch_nvhdmi), +HDA_CODEC_ENTRY (0x10de0008 ,"GPU 08 HDMI/DP" , patch_nvhdmi_legacy), +HDA_CODEC_ENTRY (0x10de0009 ,"GPU 09 HDMI/DP" , patch_nvhdmi_legacy), +HDA_CODEC_ENTRY (0x10de000a ,"GPU 0a HDMI/DP" , patch_nvhdmi_legacy), +HDA_CODEC_ENTRY (0x10de000b ,"GPU 0b HDMI/DP" , patch_nvhdmi_legacy), +HDA_CODEC_ENTRY (0x10de000c ,"MCP89 HDMI" , patch_nvhdmi_legacy), +HDA_CODEC_ENTRY (0x10de000d ,"GPU 0d HDMI/DP" , patch_nvhdmi_legacy), +HDA_CODEC_ENTRY (0x10de0010 ,"GPU 10 HDMI/DP" , patch_nvhdmi_legacy), +HDA_CODEC_ENTRY (0x10de0011 ,"GPU 11 HDMI/DP" , patch_nvhdmi_legacy), +HDA_CODEC_ENTRY (0x10de0012 ,"GPU 12 HDMI/DP" , patch_nvhdmi_legacy), +HDA_CODEC_ENTRY (0x10de0013 ,"GPU 13 HDMI/DP" , patch_nvhdmi_legacy), +HDA_CODEC_ENTRY (0x10de0014 ,"GPU 14 HDMI/DP" , patch_nvhdmi_legacy), +HDA_CODEC_ENTRY (0x10de0015 ,"GPU 15 HDMI/DP" , patch_nvhdmi_legacy), +HDA_CODEC_ENTRY (0x10de0016 ,"GPU 16 HDMI/DP" , patch_nvhdmi_legacy),/* 17 is known to be absent */ -HDA_CODEC_ENTRY (0x10de0018 ,"GPU 18 HDMI/DP" , patch_nvhdmi), -HDA_CODEC_ENTRY (0x10de0019 ,"GPU 19 HDMI/DP" , patch_nvhdmi), -HDA_CODEC_ENTRY (0x10de001a ,"GPU 1a HDMI/DP" , patch_nvhdmi), -HDA_CODEC_ENTRY (0x10de001b ,"GPU 1b HDMI/DP" , patch_nvhdmi), -HDA_CODEC_ENTRY (0x10de001c ,"GPU 1c HDMI/DP" , patch_nvhdmi), +HDA_CODEC_ENTRY (0x10de0018 ,"GPU 18 HDMI/DP" , patch_nvhdmi_legacy), +HDA_CODEC_ENTRY (0x10de0019 ,"GPU 19 HDMI/DP" , patch_nvhdmi_legacy), +HDA_CODEC_ENTRY (0x10de001a ,"GPU 1a HDMI/DP" , patch_nvhdmi_legacy), +HDA_CODEC_ENTRY (0x10de001b ,"GPU 1b HDMI/DP" , patch_nvhdmi_legacy), +HDA_CODEC_ENTRY (0x10de001c ,"GPU 1c HDMI/DP" , patch_nvhdmi_legacy),HDA_CODEC_ENTRY (0x10de0020 ,"Tegra30 HDMI" , patch_tegra_hdmi),HDA_CODEC_ENTRY (0x10de0022 ,"Tegra114 HDMI" , patch_tegra_hdmi), HDA_CODEC_ENTRY(0x10de0028, "Tegra124 HDMI", patch_tegra_hdmi),
Signature · 6 lines
2.16.4 _______________________________________________ Alsa-devel mailing list [email protected] https://mailman.alsa-project.org/mailman/listinfo/alsa-devel
Quoted 34 lines · Nikhil Mahale
sound/pci/hda/patch_hdmi.c +29
-0@@ -3494,11 +3500,86 @@ static const struct drm_audio_component_audio_ops nvhdmi_audio_ops = { .master_unbind = generic_acomp_master_unbind, }; +static int nvhdmi_find_pcm_slot (struct hdmi_spec *spec, +struct hdmi_spec_per_pin *per_pin) +{ +int i; + +/* +* generic_hdmi_build_pcms() allocates (num_nids + dev_num - 1) +* number of pcms. +* +* The per_pin of pin_nid_idx=n and dev_id=m prefers to get pcm-n if m==0. +* This guarantees that dynamic pcm assignments are compatible with the +* legacy static per_pin-pmc assignment that existed in the days before +* DP-MST. +* +* per_pin of m!=0 prefers to get pcm=(num_nids + (m - 1)). +*/ +if (per_pin->dev_id ==0 && + !test_bit (per_pin->pin_nid_idx, &spec->pcm_bitmap)) +return per_pin->pin_nid_idx; + +if (per_pin->dev_id !=0 && + !(test_bit (spec->num_nids + (per_pin->dev_id -1 ), + &spec->pcm_bitmap))) { +return spec->num_nids + (per_pin->dev_id -1 ); + } + +/* have a second try; check the area over num_nids */ +for (i = spec->num_nids; i < spec->pcm_used; i++) { +if (!test_bit (i, &spec->pcm_bitmap))
sound/pci/hda/patch_hdmi.c static const struct drm_audio_component_audio_ops nvhdmi_audio_ops = { · line 3541
Quoted 10 lines
sound/pci/hda/patch_hdmi.c +10
-0+return i; + } + +/* the last try; check the empty slots in pins */ +for (i =0 ; i < spec->num_nids; i++) { +if (!test_bit (i, &spec->pcm_bitmap)) +return i; + } +return -EBUSY ; +}
I think this can be applied for Intel case, too. No need for creating yet another indirect branch.
thanks,
Takashi
_______________________________________________
Alsa-devel mailing list
[email protected]
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel
Quoted 41 lines · Takashi Iwai
Quoted 39 lines · Nikhil Mahale
sound/pci/hda/patch_hdmi.c +34
-0@@ -3494,11 +3500,86 @@ static const struct drm_audio_component_audio_ops nvhdmi_audio_ops = { .master_unbind = generic_acomp_master_unbind, }; +static int nvhdmi_find_pcm_slot (struct hdmi_spec *spec, +struct hdmi_spec_per_pin *per_pin) +{ +int i; + +/* +* generic_hdmi_build_pcms() allocates (num_nids + dev_num - 1) +* number of pcms. +* +* The per_pin of pin_nid_idx=n and dev_id=m prefers to get pcm-n if m==0. +* This guarantees that dynamic pcm assignments are compatible with the +* legacy static per_pin-pmc assignment that existed in the days before +* DP-MST. +* +* per_pin of m!=0 prefers to get pcm=(num_nids + (m - 1)). +*/ +if (per_pin->dev_id ==0 && + !test_bit (per_pin->pin_nid_idx, &spec->pcm_bitmap)) +return per_pin->pin_nid_idx; + +if (per_pin->dev_id !=0 && + !(test_bit (spec->num_nids + (per_pin->dev_id -1 ), + &spec->pcm_bitmap))) { +return spec->num_nids + (per_pin->dev_id -1 ); + } + +/* have a second try; check the area over num_nids */ +for (i = spec->num_nids; i < spec->pcm_used; i++) { +if (!test_bit (i, &spec->pcm_bitmap)) +return i; + } + +/* the last try; check the empty slots in pins */ +for (i =0 ; i < spec->num_nids; i++) {
Quoted 8 lines
sound/pci/hda/patch_hdmi.c static const struct drm_audio_component_audio_ops nvhdmi_audio_ops = { · line 3541
Quoted 5 lines
sound/pci/hda/patch_hdmi.c +5
-0+if (!test_bit (i, &spec->pcm_bitmap)) +return i; + } +return -EBUSY ; +}I think this can be applied for Intel case, too. No need for creating yet another indirect branch.
Do you mean I should replace existing logic in hdmi_find_pcm_slot() by this new logic?
Thanks,
Nikhil Mahale
Quoted 4 lines
thanks,
Takashi
-----------------------------------------------------------------------------------
This email message is for the sole use of the intended recipient(s) and may contain confidential information. Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient, please contact the sender by reply email and destroy all copies of the original message.
-----------------------------------------------------------------------------------
_______________________________________________
Alsa-devel mailing list
[email protected]
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel
Quoted 52 lines · Nikhil Mahale
Quoted 41 lines · Takashi Iwai
Quoted 39 lines · Nikhil Mahale
sound/pci/hda/patch_hdmi.c +34
-0@@ -3494,11 +3500,86 @@ static const struct drm_audio_component_audio_ops nvhdmi_audio_ops = { .master_unbind = generic_acomp_master_unbind, }; +static int nvhdmi_find_pcm_slot (struct hdmi_spec *spec, +struct hdmi_spec_per_pin *per_pin) +{ +int i; + +/* +* generic_hdmi_build_pcms() allocates (num_nids + dev_num - 1) +* number of pcms. +* +* The per_pin of pin_nid_idx=n and dev_id=m prefers to get pcm-n if m==0. +* This guarantees that dynamic pcm assignments are compatible with the +* legacy static per_pin-pmc assignment that existed in the days before +* DP-MST. +* +* per_pin of m!=0 prefers to get pcm=(num_nids + (m - 1)). +*/ +if (per_pin->dev_id ==0 && + !test_bit (per_pin->pin_nid_idx, &spec->pcm_bitmap)) +return per_pin->pin_nid_idx; + +if (per_pin->dev_id !=0 && + !(test_bit (spec->num_nids + (per_pin->dev_id -1 ), + &spec->pcm_bitmap))) { +return spec->num_nids + (per_pin->dev_id -1 ); + } + +/* have a second try; check the area over num_nids */ +for (i = spec->num_nids; i < spec->pcm_used; i++) { +if (!test_bit (i, &spec->pcm_bitmap)) +return i; + } + +/* the last try; check the empty slots in pins */ +for (i =0 ; i < spec->num_nids; i++) {Quoted 8 lines
sound/pci/hda/patch_hdmi.c static const struct drm_audio_component_audio_ops nvhdmi_audio_ops = { · line 3541
Quoted 5 lines
sound/pci/hda/patch_hdmi.c +5
-0+if (!test_bit (i, &spec->pcm_bitmap)) +return i; + } +return -EBUSY ; +}I think this can be applied for Intel case, too. No need for creating yet another indirect branch.
Quoted 2 lines
Do you mean I should replace existing logic in
hdmi_find_pcm_slot()by this new logic?
Yes. It's a dynamic assignment for DP-MST in anyway, so the compatibility of the assigned index shouldn't be a big matter.
Takashi
_______________________________________________
Alsa-devel mailing list
[email protected]
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel
Quoted 11 lines · Nikhil Mahale
Today, DisplayPort multi-stream transport (DP-MST) audio is not supported on codec drivers which don't use the audio component (acomp) binding.
The commit
ade49db337a9(ALSA: hda/hdmi - Allow audio component for AMD/ATI and Nvidia HDMI) added the DRM audio component binding for the NVIDIA codec drivers, but the traditional HD-audio unsolicited event code path is still in use by the proprietary NVIDIA graphics driver.
Quoted 7 lines
This patch set adds DP-MST audio support for non-acomp codec drivers which use the traditional HD-audio unsolicited event code path. This patch set adds DP-MST support for NVIDIA codecs.
The patch set has been tested for HDMI/DP-SST/DP-MST(4 dp-mst audio streams) configurations on NVIDIA Kepler and Maxwell GPUs, using both the nouveau driver and the proprietary NVIDIA graphics driver.
Thanks for the patch. The logic looks good, but there are a few concerns in implementation details. Will comment in the reply of each patch.
The timing is a bit late for merging into 5.5, though, for this kind of non-trivial changes. It'll be likely applied after 5.5 merge window, so for 5.6.
Takashi
_______________________________________________
Alsa-devel mailing list
[email protected]
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel
Quoted 17 lines · Takashi Iwai
Quoted 15 lines · Nikhil Mahale
Today, DisplayPort multi-stream transport (DP-MST) audio is not supported on codec drivers which don't use the audio component (acomp) binding.
The commit
ade49db337a9(ALSA: hda/hdmi - Allow audio component for AMD/ATI and Nvidia HDMI) added the DRM audio component binding for the NVIDIA codec drivers, but the traditional HD-audio unsolicited event code path is still in use by the proprietary NVIDIA graphics driver.This patch set adds DP-MST audio support for non-acomp codec drivers which use the traditional HD-audio unsolicited event code path. This patch set adds DP-MST support for NVIDIA codecs.
Quoted 7 lines
Quoted 3 lines
The patch set has been tested for HDMI/DP-SST/DP-MST(4 dp-mst audio streams) configurations on NVIDIA Kepler and Maxwell GPUs, using both the nouveau driver and the proprietary NVIDIA graphics driver.
Thanks for the patch. The logic looks good, but there are a few concerns in implementation details. Will comment in the reply of each patch.
Thanks Takashi, I am sending out 2nd version of patch set in which I tried to address you concerned.
Thanks,
Nikhil Mahale
Quoted 7 lines
The timing is a bit late for merging into 5.5, though, for this kind of non-trivial changes. It'll be likely applied after 5.5 merge window, so for 5.6.
Takashi
-----------------------------------------------------------------------------------
This email message is for the sole use of the intended recipient(s) and may contain confidential information. Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient, please contact the sender by reply email and destroy all copies of the original message.
-----------------------------------------------------------------------------------
_______________________________________________
Alsa-devel mailing list
[email protected]
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel