Intel HDMI fixes v2
cover Intel HDMI fixes v2
Takashi,
Here are the updated Intel HDMI fixes.
Thanks,
Fengguang
PATCH 1/10 intelhdmi - fix audio infoframe fill size
--- sound/pci/hda/patch_intelhdmi.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
sound/pci/hda/patch_intelhdmi.c +2 -2
@@ -509,12 +509,12 @@ static void hdmi_fill_audio_infoframe(sthdmi_debug_dip_size (codec, pin_nid);hdmi_clear_dip_buffers (codec, pin_nid);/* be paranoid */ -for (i =0 ; i <sizeof (ai); i++) +for (i =0 ; i <sizeof (*ai); i++) sum += params[i]; ai->checksum = - sum;hdmi_set_dip_index (codec, pin_nid,0x0 ,0x0 ); -for (i =0 ; i <sizeof (ai); i++) +for (i =0 ; i <sizeof (*ai); i++)hdmi_write_dip_byte (codec, pin_nid, params[i]); }
_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
PATCH 2/10 intelhdmi - fix channel mapping slot mask
In reply to Wu Fengguang--- sound/pci/hda/patch_intelhdmi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/pci/hda/patch_intelhdmi.c +1 -1
@@ -433,7 +433,7 @@ static void hdmi_debug_channel_mapping(s slot =snd_hda_codec_read (codec, nid,0 ,AC_VERB_GET_HDMI_CHAN_SLOT , i);printk (KERN_DEBUG "HDMI: ASP channel %d => slot %d\n" , - slot >> 4, slot & 0x7); + slot >> 4, slot & 0xf); }#endif }
PATCH 3/10 intelhdmi - export monitor-presence and ELD-valid status
In reply to Wu Fengguang--- sound/pci/hda/hda_eld.c | 8 +++++++- sound/pci/hda/hda_local.h | 4 +++- sound/pci/hda/patch_intelhdmi.c | 8 +++----- 3 files changed, 13 insertions(+), 7 deletions(-)
sound/pci/hda/patch_intelhdmi.c +3 -5
@@ -62,8 +62,6 @@ struct intel_hdmi_spec {/* * HDMI sink attached to each pin */ -bool sink_present[INTEL_HDMI_PINS ]; -bool sink_eldv[INTEL_HDMI_PINS ];struct hdmi_eld sink_eld[INTEL_HDMI_PINS ];/*
@@ -645,7 +643,7 @@ static void hdmi_setup_audio_infoframe(sfor (i =0 ; i < spec->num_pins; i++) {if (spec->pin_cvt[i] != nid)continue ; -if (spec->sink_present[i] != true) +if (!spec->sink_eld[i].monitor_present)continue ; pin_nid = spec->pin[i];
@@ -675,8 +673,8 @@ static void hdmi_intrinsic_event(structif (index <0 )return ; - spec->sink_present[index] = pind; - spec->sink_eldv[index] = eldv; + spec->sink_eld[index].monitor_present = pind; + spec->sink_eld[index].eld_valid = eldv;if (pind && eldv) {hdmi_parse_eld (codec, index);
sound/pci/hda/hda_eld.c +7 -1
@@ -477,6 +477,8 @@ static void hdmi_print_eld_info(struct s [4 ... 7] = "reserved" }; +snd_iprintf (buffer,"monitor_present\t\t%d\n" , e->monitor_present); +snd_iprintf (buffer,"eld_valid\t\t%d\n" , e->eld_valid);snd_iprintf (buffer,"monitor_name\t\t%s\n" , e->monitor_name);snd_iprintf (buffer,"connection_type\t\t%s\n" , eld_connection_type_names[e->conn_type]);
@@ -518,7 +520,11 @@ static void hdmi_write_eld_info(struct s* monitor_name manufacture_id product_id * eld_version edid_version */ -if (!strcmp (name,"connection_type" )) +if (!strcmp (name,"monitor_present" )) + e->monitor_present = val; +else if (!strcmp (name,"eld_valid" )) + e->eld_valid = val; +else if (!strcmp (name,"connection_type" )) e->conn_type = val;else if (!strcmp (name,"port_id" )) e->port_id = val;
sound/pci/hda/hda_local.h +3 -1
@@ -516,9 +516,11 @@ struct cea_sad {* ELD: EDID Like Data */ struct hdmi_eld { +bool monitor_present; +bool eld_valid;int eld_size;int baseline_len; -int eld_ver;/* (eld_ver == 0) indicates invalid ELD */ +int eld_ver;int cea_edid_ver;char monitor_name[ELD_MAX_MNL +1 ];int manufacture_id;
PATCH 4/10 hda - introduce snd_hda_jack_detect() and snd_hda_pin_sense()
In reply to Wu FengguangThis helps merge duplicate code.
v2: add snd_hda_jack_detect() and comments recommended by Takashi.
--- sound/pci/hda/hda_codec.c | 34 +++++ sound/pci/hda/hda_eld.c | 7 - sound/pci/hda/hda_local.h | 2 sound/pci/hda/patch_cirrus.c | 19 -- sound/pci/hda/patch_realtek.c | 206 +++++++------------------------- 5 files changed, 91 insertions(+), 177 deletions(-)
sound/pci/hda/hda_codec.c +34 -0
@@ -1229,6 +1229,40 @@ u32 snd_hda_query_pin_caps(struct hda_co }EXPORT_SYMBOL_HDA (snd_hda_query_pin_caps); +/** +* snd_hda_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 pincap =snd_hda_query_pin_caps (codec, nid); + +if (pincap &AC_PINCAP_TRIG_REQ )/* need trigger? */ +snd_hda_codec_read (codec, nid,0 ,AC_VERB_SET_PIN_SENSE ,0 ); + +return snd_hda_codec_read (codec, nid,0 , +AC_VERB_GET_PIN_SENSE ,0 ); +} +EXPORT_SYMBOL_HDA (snd_hda_pin_sense); + +/** +* snd_hda_jack_detect - query pin Presence Detect status +* @codec: the CODEC to sense +* @nid: the pin NID to sense +* +* Query and return the pin's Presence Detect status. +*/ +int snd_hda_jack_detect (struct hda_codec *codec,hda_nid_t nid) +{ +u32 sense =snd_hda_pin_sense (codec, nid); +return !!(sense &AC_PINSENSE_PRESENCE ); +} +EXPORT_SYMBOL_HDA (snd_hda_jack_detect); +/* * read the current volume to info * if the cache exists, read the cache value.
sound/pci/hda/hda_local.h +2 -0
@@ -424,6 +424,8 @@ u32 query_amp_caps(struct hda_codec *codint snd_hda_override_amp_caps (struct hda_codec *codec,hda_nid_t nid,int dir,unsigned int caps);u32 snd_hda_query_pin_caps (struct hda_codec *codec,hda_nid_t nid); +u32 snd_hda_pin_sense (struct hda_codec *codec,hda_nid_t nid); +int snd_hda_jack_detect (struct hda_codec *codec,hda_nid_t nid);int snd_hda_ctl_add (struct hda_codec *codec,struct snd_kcontrol *kctl);void snd_hda_ctls_clear (struct hda_codec *codec);
sound/pci/hda/patch_realtek.c +49 -157
458 lines not on this page · raw message
sound/pci/hda/patch_cirrus.c +5 -14
@@ -807,7 +807,7 @@ static void cs_automute(struct hda_codec {struct cs_spec *spec = codec->spec;struct auto_pin_cfg *cfg = &spec->autocfg; -unsigned int caps, present, hp_present; +unsigned int caps, hp_present;hda_nid_t nid;int i;
@@ -817,12 +817,7 @@ static void cs_automute(struct hda_codec caps =snd_hda_query_pin_caps (codec, nid);if (!(caps &AC_PINCAP_PRES_DETECT ))continue ; -if (caps &AC_PINCAP_TRIG_REQ ) -snd_hda_codec_read (codec, nid,0 , -AC_VERB_SET_PIN_SENSE ,0 ); - present =snd_hda_codec_read (codec, nid,0 , -AC_VERB_GET_PIN_SENSE ,0 ); - hp_present |= (present &AC_PINSENSE_PRESENCE ) !=0 ; + hp_present =snd_hda_jack_detect (codec, nid);if (hp_present)break ; }
@@ -844,15 +839,11 @@ static void cs_automic(struct hda_codecstruct cs_spec *spec = codec->spec;struct auto_pin_cfg *cfg = &spec->autocfg;hda_nid_t nid; -unsigned int caps, present; +unsigned int present; nid = cfg->input_pins[spec->automic_idx]; - caps =snd_hda_query_pin_caps (codec, nid); -if (caps &AC_PINCAP_TRIG_REQ ) -snd_hda_codec_read (codec, nid,0 ,AC_VERB_SET_PIN_SENSE ,0 ); - present =snd_hda_codec_read (codec, nid,0 , -AC_VERB_GET_PIN_SENSE ,0 ); -if (present &AC_PINSENSE_PRESENCE ) + present =snd_hda_jack_detect (codec, nid); +if (present)change_cur_input (codec, spec->automic_idx,0 );else { unsigned int imic = (spec->automic_idx == AUTO_PIN_MIC) ?
sound/pci/hda/hda_eld.c +1 -6
@@ -309,17 +309,12 @@ out_fail:return -EINVAL ; } -static int hdmi_present_sense (struct hda_codec *codec,hda_nid_t nid) -{ -return snd_hda_codec_read (codec, nid,0 ,AC_VERB_GET_PIN_SENSE ,0 ); -} -static int hdmi_eld_valid (struct hda_codec *codec,hda_nid_t nid) {int eldv;int present; - present =hdmi_present_sense (codec, nid); + present =snd_hda_pin_sense (codec, nid); eldv = (present &AC_PINSENSE_ELDV ); present = (present &AC_PINSENSE_PRESENCE );
PATCH 5/10 intelhdmi - probe for monitor/eld presence at module init time
In reply to Wu FengguangThis avoids lost of presence info on module reloading.
The presence info used to be only updated at the (rare) hotplug events.
Proposed by David, thanks!
--- sound/pci/hda/patch_intelhdmi.c | 33 ++++++++++++++++++++---------- 1 file changed, 23 insertions(+), 10 deletions(-)
sound/pci/hda/patch_intelhdmi.c +22 -10
@@ -259,6 +259,25 @@ static int intel_hdmi_read_pin_conn(strureturn 0 ; } +static void hdmi_get_show_eld (struct hda_codec *codec,hda_nid_t pin_nid, +struct hdmi_eld *eld) +{ +if (!snd_hdmi_get_eld (eld, codec, pin_nid)) +snd_hdmi_show_eld (eld); +} + +static void hdmi_present_sense (struct hda_codec *codec,hda_nid_t pin_nid, +struct hdmi_eld *eld) +{ +int present =snd_hda_pin_sense (codec, pin_nid); + + eld->monitor_present = !!(present &AC_PINSENSE_PRESENCE ); + eld->eld_valid = !!(present &AC_PINSENSE_ELDV ); + +if (present &AC_PINSENSE_ELDV ) +hdmi_get_show_eld (codec, pin_nid, eld); +} +static int intel_hdmi_add_pin (struct hda_codec *codec,hda_nid_t pin_nid) {struct intel_hdmi_spec *spec = codec->spec;
@@ -269,6 +288,8 @@ static int intel_hdmi_add_pin(struct hdareturn -EINVAL ; } +hdmi_present_sense (codec, pin_nid, &spec->sink_eld[spec->num_pins]); + spec->pin[spec->num_pins] = pin_nid; spec->num_pins++;
@@ -436,15 +457,6 @@ static void hdmi_debug_channel_mapping(s#endif } -static void hdmi_parse_eld (struct hda_codec *codec,int index) -{ -struct intel_hdmi_spec *spec = codec->spec; -struct hdmi_eld *eld = &spec->sink_eld[index]; - -if (!snd_hdmi_get_eld (eld, codec, spec->pin[index])) -snd_hdmi_show_eld (eld); -} -/* * Audio InfoFrame routines
@@ -677,7 +690,7 @@ static void hdmi_intrinsic_event(struct spec->sink_eld[index].eld_valid = eldv;if (pind && eldv) { -hdmi_parse_eld (codec, index); +hdmi_get_show_eld (codec, spec->pin[index], &spec->sink_eld[index]);/* TODO: do real things about ELD */ } }
_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
Re: [PATCH 05/10] intelhdmi - probe for monitor/eld presence at module init time
At Wed, 18 Nov 2009 12:38:03 +0800,
Quoted 8 lines · Wu Fengguang
This avoids lost of presence info on module reloading.
The presence info used to be only updated at the (rare) hotplug events.Proposed by David, thanks!
CC David Härdeman <[email protected]>Signed-off-by Wu Fengguang <[email protected]>
I think we should handle this also at resume. Typically, the codec resume callback calls the unsolicited event explicitly.
But, the resume callback can be used for resuming from the power-saving mode, too. Thus it should be optimized and less verbose, e.g. cache the ELD bytes, compare the new data with the cached data, and skip the procedure if it's the same content.
Anyway, all patches have been applied, so let's fix this on the current tree.
thanks,
Takashi
Quoted 60 lines
--- sound/pci/hda/patch_intelhdmi.c | 33 ++++++++++++++++++++---------- 1 file changed, 23 insertions(+), 10 deletions(-)sound/pci/hda/patch_intelhdmi.c +21
-9@@ -259,6 +259,25 @@ static int intel_hdmi_read_pin_conn(strureturn 0 ; } +static void hdmi_get_show_eld (struct hda_codec *codec,hda_nid_t pin_nid, +struct hdmi_eld *eld) +{ +if (!snd_hdmi_get_eld (eld, codec, pin_nid)) +snd_hdmi_show_eld (eld); +} + +static void hdmi_present_sense (struct hda_codec *codec,hda_nid_t pin_nid, +struct hdmi_eld *eld) +{ +int present =snd_hda_pin_sense (codec, pin_nid); + + eld->monitor_present = !!(present &AC_PINSENSE_PRESENCE ); + eld->eld_valid = !!(present &AC_PINSENSE_ELDV ); + +if (present &AC_PINSENSE_ELDV ) +hdmi_get_show_eld (codec, pin_nid, eld); +} +static int intel_hdmi_add_pin (struct hda_codec *codec,hda_nid_t pin_nid) {struct intel_hdmi_spec *spec = codec->spec;@@ -269,6 +288,8 @@ static int intel_hdmi_add_pin(struct hdareturn -EINVAL ; } +hdmi_present_sense (codec, pin_nid, &spec->sink_eld[spec->num_pins]); + spec->pin[spec->num_pins] = pin_nid; spec->num_pins++;@@ -436,15 +457,6 @@ static void hdmi_debug_channel_mapping(s#endif } -static void hdmi_parse_eld (struct hda_codec *codec,int index) -{ -struct intel_hdmi_spec *spec = codec->spec; -struct hdmi_eld *eld = &spec->sink_eld[index]; - -if (!snd_hdmi_get_eld (eld, codec, spec->pin[index])) -snd_hdmi_show_eld (eld); -} -/* * Audio InfoFrame routines
sound/pci/hda/patch_intelhdmi.c static void hdmi_intrinsic_event(struct · line 696
Quoted 8 lines
sound/pci/hda/patch_intelhdmi.c +1
-1@@ -677,7 +690,7 @@ static void hdmi_intrinsic_event(struct spec->sink_eld[index].eld_valid = eldv;if (pind && eldv) { -hdmi_parse_eld (codec, index); +hdmi_get_show_eld (codec, spec->pin[index], &spec->sink_eld[index]);/* TODO: do real things about ELD */ } }
_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
Re: [PATCH 05/10] intelhdmi - probe for monitor/eld presence at module init time
Quoted 15 lines · Takashi Iwai
At Wed, 18 Nov 2009 12:38:03 +0800,
Quoted 8 lines · Wu Fengguang
This avoids lost of presence info on module reloading.
The presence info used to be only updated at the (rare) hotplug events.Proposed by David, thanks!
CC David Härdeman <[email protected]>Signed-off-by Wu Fengguang <[email protected]>I think we should handle this also at resume. Typically, the codec resume callback calls the unsolicited event explicitly.
Quoted 7 lines
But, the resume callback can be used for resuming from the power-saving mode, too. Thus it should be optimized and less verbose, e.g. cache the ELD bytes, compare the new data with the cached data, and skip the procedure if it's the same content.
Anyway, all patches have been applied, so let's fix this on the current tree.
OK, thanks for the tips. Actually I have not tested suspend/resume yet, I will do it next week. Currently I have some pending items (that's why I have to put off the keep-power-on patch).
Thanks,
Fengguang
_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
PATCH 6/10 intelhdmi - separate out infoframe checksum routine
In reply to Wu FengguangAnd make it right when called for more than one times.
--- sound/pci/hda/patch_intelhdmi.c | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-)
sound/pci/hda/patch_intelhdmi.c +17 -6
@@ -508,24 +508,35 @@ static void hdmi_clear_dip_buffers(struc#endif } +static void hdmi_checksum_audio_infoframe (struct hdmi_audio_infoframe *ai) +{ +u8 *bytes = (u8 *)ai; +u8 sum =0 ; +int i; + + ai->checksum =0 ; + +for (i =0 ; i <sizeof (*ai); i++) + sum += bytes[i]; + + ai->checksum = - sum; +} +static void hdmi_fill_audio_infoframe (struct hda_codec *codec,hda_nid_t pin_nid,struct hdmi_audio_infoframe *ai) { -u8 *params = (u8 *)ai; -u8 sum =0 ; +u8 *bytes = (u8 *)ai;int i;hdmi_debug_dip_size (codec, pin_nid);hdmi_clear_dip_buffers (codec, pin_nid);/* be paranoid */ -for (i =0 ; i <sizeof (*ai); i++) - sum += params[i]; - ai->checksum = - sum; +hdmi_checksum_audio_infoframe (ai);hdmi_set_dip_index (codec, pin_nid,0x0 ,0x0 );for (i =0 ; i <sizeof (*ai); i++) -hdmi_write_dip_byte (codec, pin_nid, params[i]); +hdmi_write_dip_byte (codec, pin_nid, bytes[i]); }/*
PATCH 7/10 intelhdmi - sticky infoframe
In reply to Wu FengguangRemember the active infoframe, so as to avoid stop/restart infoframe transmission when switching between audio clips of the same format.
Proposed by Shang and David.
--- sound/pci/hda/patch_intelhdmi.c | 38 ++++++++++++++++++++---------- 1 file changed, 26 insertions(+), 12 deletions(-)
sound/pci/hda/patch_intelhdmi.c +26 -12
@@ -646,6 +646,27 @@ static void hdmi_setup_channel_mapping(shdmi_debug_channel_mapping (codec, nid); } +static bool hdmi_infoframe_uptodate (struct hda_codec *codec,hda_nid_t pin_nid, +struct hdmi_audio_infoframe *ai) +{ +u8 *bytes = (u8 *)ai; +u8 val; +int i; + +if (snd_hda_codec_read (codec, pin_nid,0 ,AC_VERB_GET_HDMI_DIP_XMIT ,0 ) + !=AC_DIPXMIT_BEST ) +return false; + +hdmi_set_dip_index (codec, pin_nid,0x0 ,0x0 ); +for (i =0 ; i <sizeof (*ai); i++) { + val =snd_hda_codec_read (codec, pin_nid,0 , +AC_VERB_GET_HDMI_DIP_DATA ,0 ); +if (val != bytes[i]) +return false; + } + +return true; +}static void hdmi_setup_audio_infoframe (struct hda_codec *codec,hda_nid_t nid,struct snd_pcm_substream *substream)
@@ -670,8 +691,11 @@ static void hdmi_setup_audio_infoframe(scontinue ; pin_nid = spec->pin[i]; -hdmi_fill_audio_infoframe (codec, pin_nid, &ai); -hdmi_start_infoframe_trans (codec, pin_nid); +if (!hdmi_infoframe_uptodate (codec, pin_nid, &ai)) { +hdmi_stop_infoframe_trans (codec, pin_nid); +hdmi_fill_audio_infoframe (codec, pin_nid, &ai); +hdmi_start_infoframe_trans (codec, pin_nid); + } } }
@@ -767,16 +791,6 @@ static int intel_hdmi_playback_pcm_cleanstruct hda_codec *codec, struct snd_pcm_substream *substream) { - struct intel_hdmi_spec *spec = codec->spec; -int i; - -for (i =0 ; i < spec->num_pins; i++) { -if (spec->pin_cvt[i] != hinfo->nid) -continue ; - -hdmi_stop_infoframe_trans (codec, spec->pin[i]); - } - snd_hda_codec_cleanup_stream(codec, hinfo->nid);return 0 ; }
_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
PATCH 8/10 intelhdmi - sticky stream id and format
In reply to Wu FengguangWe tracked down the first-0.5s-hdmi-audio-samples-lost problem to the AC_VERB_SET_CHANNEL_STREAMID command. It is suspected that many HDMI sinks need some time to adapt to the new state.
The workaround is to avoid changing stream id/format whenever possible. Proposed by David.
--- sound/pci/hda/patch_intelhdmi.c | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-)
sound/pci/hda/patch_intelhdmi.c +26 -2
@@ -772,6 +772,31 @@ static void intel_hdmi_unsol_event(struc* Callbacks */ +static void hdmi_setup_stream (struct hda_codec *codec,hda_nid_t nid, +u32 stream_tag,int format) +{ +int tag; +int fmt; + + tag =snd_hda_codec_read (codec, nid,0 ,AC_VERB_GET_CONV ,0 ) >>4 ; + fmt =snd_hda_codec_read (codec, nid,0 ,AC_VERB_GET_STREAM_FORMAT ,0 ); + +snd_printdd ("hdmi_setup_stream: " +"NID=0x%x, %sstream=0x%x, %sformat=0x%x\n" , + nid, + tag == stream_tag ?"" :"new-" , + stream_tag, + fmt == format ?"" :"new-" , + format); + +if (tag != stream_tag) +snd_hda_codec_write (codec, nid,0 , +AC_VERB_SET_CHANNEL_STREAMID , stream_tag <<4 ); +if (fmt != format) +snd_hda_codec_write (codec, nid,0 , +AC_VERB_SET_STREAM_FORMAT , format); +} + static int intel_hdmi_playback_pcm_prepare(struct hda_pcm_stream *hinfo, struct hda_codec *codec, unsigned int stream_tag,
@@ -783,7 +808,7 @@ static int intel_hdmi_playback_pcm_prepahdmi_setup_audio_infoframe (codec, hinfo->nid, substream); -snd_hda_codec_setup_stream (codec, hinfo->nid, stream_tag,0 , format); +hdmi_setup_stream (codec, hinfo->nid, stream_tag, format);return 0 ; }
@@ -791,7 +816,6 @@ static int intel_hdmi_playback_pcm_clean struct hda_codec *codec, struct snd_pcm_substream *substream) { - snd_hda_codec_cleanup_stream(codec, hinfo->nid);return 0 ; }
_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
PATCH 9/10 intelhdmi - sticky channel count
In reply to Wu FengguangDon't change channel count if not necessary.
--- sound/pci/hda/patch_intelhdmi.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-)
sound/pci/hda/patch_intelhdmi.c +2 -8
@@ -422,24 +422,18 @@ static void hdmi_stop_infoframe_trans(st AC_DIPXMIT_DISABLE); } -#ifdef CONFIG_SND_DEBUG_VERBOSE static int hdmi_get_channel_count (struct hda_codec *codec,hda_nid_t nid) {return 1 +snd_hda_codec_read (codec, nid,0 ,AC_VERB_GET_CVT_CHAN_COUNT ,0 ); } -#endif static void hdmi_set_channel_count (struct hda_codec *codec,hda_nid_t nid,int chs) { -snd_hda_codec_write (codec, nid,0 ,AC_VERB_SET_CVT_CHAN_COUNT , chs -1 ); - -#ifdef CONFIG_SND_DEBUG_VERBOSE if (chs !=hdmi_get_channel_count (codec, nid)) -snd_printd (KERN_INFO "HDMI channel count: expect %d, get %d\n" , - chs,hdmi_get_channel_count (codec, nid)); -#endif +snd_hda_codec_write (codec, nid,0 , +AC_VERB_SET_CVT_CHAN_COUNT , chs -1 ); }static void hdmi_debug_channel_mapping (struct hda_codec *codec,hda_nid_t nid)
PATCH 10/10 hda - show EPSS capability in proc
In reply to Wu Fengguang--- sound/pci/hda/hda_codec.h | 4 ++++ sound/pci/hda/hda_proc.c | 31 +++++++++++++++++++++++++++++++ 2 files changed, 35 insertions(+)
sound/pci/hda/hda_codec.h +4 -0
@@ -286,6 +286,10 @@ enum {#define AC_PWRST_D1SUP (1<<1)#define AC_PWRST_D2SUP (1<<2)#define AC_PWRST_D3SUP (1<<3) +#define AC_PWRST_D3COLDSUP (1<<4) +#define AC_PWRST_S3D3COLDSUP (1<<29) +#define AC_PWRST_CLKSTOP (1<<30) +#define AC_PWRST_EPSS (1U<<31)/* Power state values */ #define AC_PWRST_SETTING (0xf<<0)
sound/pci/hda/hda_proc.c +31 -0
@@ -26,6 +26,21 @@#include "hda_codec.h" #include "hda_local.h" +static char *bits_names (unsigned int bits,char *names[],int size) +{ +int i, n; +static char buf[128 ]; + +for (i =0 , n =0 ; i < size; i++) { +if (bits & (1U <<i) && names[i]) + n +=snprintf (buf + n,sizeof (buf) - n," %s" , + names[i]); + } + buf[n] ='\0' ; + +return buf; +} +static const char *get_wid_type_name (unsigned int wid_value) {static char *names[16 ] = {
@@ -363,8 +378,24 @@ static const char *get_pwr_state(u32 stastatic void print_power_state (struct snd_info_buffer *buffer,struct hda_codec *codec,hda_nid_t nid) { +static char *names[] = { + [ilog2 (AC_PWRST_D0SUP )] ="D0" , + [ilog2 (AC_PWRST_D1SUP )] ="D1" , + [ilog2 (AC_PWRST_D2SUP )] ="D2" , + [ilog2 (AC_PWRST_D3SUP )] ="D3" , + [ilog2 (AC_PWRST_D3COLDSUP )] ="D3cold" , + [ilog2 (AC_PWRST_S3D3COLDSUP )] ="S3D3cold" , + [ilog2 (AC_PWRST_CLKSTOP )] ="CLKSTOP" , + [ilog2 (AC_PWRST_EPSS )] ="EPSS" , + }; + +int sup =snd_hda_param_read (codec, nid,AC_PAR_POWER_STATE );int pwr =snd_hda_codec_read (codec, nid,0 ,AC_VERB_GET_POWER_STATE ,0 ); +if (sup) +snd_iprintf (buffer," Power states: %s\n" , +bits_names (sup, names,ARRAY_SIZE (names))); + snd_iprintf(buffer, " Power: setting=%s, actual=%s\n", get_pwr_state(pwr & AC_PWRST_SETTING), get_pwr_state((pwr & AC_PWRST_ACTUAL) >>
Quoted 3 lines · Fengguang
Takashi,
Here are the updated Intel HDMI fixes.
- removed the keep-power-on patch (need more investigation)
- added snd_hda_jack_detect()
- added comments to snd_hda_jack_detect()/snd_hda_pin_sense()
Thanks,
Fengguang
At Wed, 18 Nov 2009 12:58:24 +0800,
Quoted 9 lines · Wu Fengguang
Quoted 3 lines · Fengguang
Takashi,
Here are the updated Intel HDMI fixes.
- removed the keep-power-on patch (need more investigation)
- addedsnd_hda_jack_detect()
- added comments to snd_hda_jack_detect()/snd_hda_pin_sense()
Thanks for quick fixes.
Now applied all patches.
Takashi