aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci/hda/patch_hdmi.c
diff options
context:
space:
mode:
Diffstat (limited to 'sound/pci/hda/patch_hdmi.c')
-rw-r--r--sound/pci/hda/patch_hdmi.c76
1 files changed, 39 insertions, 37 deletions
diff --git a/sound/pci/hda/patch_hdmi.c b/sound/pci/hda/patch_hdmi.c
index 5ef95034d041..994713cb07bc 100644
--- a/sound/pci/hda/patch_hdmi.c
+++ b/sound/pci/hda/patch_hdmi.c
@@ -353,40 +353,43 @@ static struct cea_channel_speaker_allocation channel_allocations[] = {
353#define get_pcm_rec(spec, idx) \ 353#define get_pcm_rec(spec, idx) \
354 ((struct hda_pcm *)snd_array_elem(&spec->pcm_rec, idx)) 354 ((struct hda_pcm *)snd_array_elem(&spec->pcm_rec, idx))
355 355
356static int pin_nid_to_pin_index(struct hdmi_spec *spec, hda_nid_t pin_nid) 356static int pin_nid_to_pin_index(struct hda_codec *codec, hda_nid_t pin_nid)
357{ 357{
358 struct hdmi_spec *spec = codec->spec;
358 int pin_idx; 359 int pin_idx;
359 360
360 for (pin_idx = 0; pin_idx < spec->num_pins; pin_idx++) 361 for (pin_idx = 0; pin_idx < spec->num_pins; pin_idx++)
361 if (get_pin(spec, pin_idx)->pin_nid == pin_nid) 362 if (get_pin(spec, pin_idx)->pin_nid == pin_nid)
362 return pin_idx; 363 return pin_idx;
363 364
364 snd_printk(KERN_WARNING "HDMI: pin nid %d not registered\n", pin_nid); 365 codec_warn(codec, "HDMI: pin nid %d not registered\n", pin_nid);
365 return -EINVAL; 366 return -EINVAL;
366} 367}
367 368
368static int hinfo_to_pin_index(struct hdmi_spec *spec, 369static int hinfo_to_pin_index(struct hda_codec *codec,
369 struct hda_pcm_stream *hinfo) 370 struct hda_pcm_stream *hinfo)
370{ 371{
372 struct hdmi_spec *spec = codec->spec;
371 int pin_idx; 373 int pin_idx;
372 374
373 for (pin_idx = 0; pin_idx < spec->num_pins; pin_idx++) 375 for (pin_idx = 0; pin_idx < spec->num_pins; pin_idx++)
374 if (get_pcm_rec(spec, pin_idx)->stream == hinfo) 376 if (get_pcm_rec(spec, pin_idx)->stream == hinfo)
375 return pin_idx; 377 return pin_idx;
376 378
377 snd_printk(KERN_WARNING "HDMI: hinfo %p not registered\n", hinfo); 379 codec_warn(codec, "HDMI: hinfo %p not registered\n", hinfo);
378 return -EINVAL; 380 return -EINVAL;
379} 381}
380 382
381static int cvt_nid_to_cvt_index(struct hdmi_spec *spec, hda_nid_t cvt_nid) 383static int cvt_nid_to_cvt_index(struct hda_codec *codec, hda_nid_t cvt_nid)
382{ 384{
385 struct hdmi_spec *spec = codec->spec;
383 int cvt_idx; 386 int cvt_idx;
384 387
385 for (cvt_idx = 0; cvt_idx < spec->num_cvts; cvt_idx++) 388 for (cvt_idx = 0; cvt_idx < spec->num_cvts; cvt_idx++)
386 if (get_cvt(spec, cvt_idx)->cvt_nid == cvt_nid) 389 if (get_cvt(spec, cvt_idx)->cvt_nid == cvt_nid)
387 return cvt_idx; 390 return cvt_idx;
388 391
389 snd_printk(KERN_WARNING "HDMI: cvt nid %d not registered\n", cvt_nid); 392 codec_warn(codec, "HDMI: cvt nid %d not registered\n", cvt_nid);
390 return -EINVAL; 393 return -EINVAL;
391} 394}
392 395
@@ -706,7 +709,7 @@ static void hdmi_debug_channel_mapping(struct hda_codec *codec,
706 709
707 for (i = 0; i < 8; i++) { 710 for (i = 0; i < 8; i++) {
708 channel = spec->ops.pin_get_slot_channel(codec, pin_nid, i); 711 channel = spec->ops.pin_get_slot_channel(codec, pin_nid, i);
709 printk(KERN_DEBUG "HDMI: ASP channel %d => slot %d\n", 712 codec_dbg(codec, "HDMI: ASP channel %d => slot %d\n",
710 channel, i); 713 channel, i);
711 } 714 }
712#endif 715#endif
@@ -755,8 +758,7 @@ static void hdmi_std_setup_channel_mapping(struct hda_codec *codec,
755 int channel = (slotsetup & 0xf0) >> 4; 758 int channel = (slotsetup & 0xf0) >> 4;
756 err = spec->ops.pin_set_slot_channel(codec, pin_nid, hdmi_slot, channel); 759 err = spec->ops.pin_set_slot_channel(codec, pin_nid, hdmi_slot, channel);
757 if (err) { 760 if (err) {
758 snd_printdd(KERN_NOTICE 761 codec_dbg(codec, "HDMI: channel mapping failed\n");
759 "HDMI: channel mapping failed\n");
760 break; 762 break;
761 } 763 }
762 } 764 }
@@ -967,12 +969,12 @@ static void hdmi_debug_dip_size(struct hda_codec *codec, hda_nid_t pin_nid)
967 int size; 969 int size;
968 970
969 size = snd_hdmi_get_eld_size(codec, pin_nid); 971 size = snd_hdmi_get_eld_size(codec, pin_nid);
970 printk(KERN_DEBUG "HDMI: ELD buf size is %d\n", size); 972 codec_dbg(codec, "HDMI: ELD buf size is %d\n", size);
971 973
972 for (i = 0; i < 8; i++) { 974 for (i = 0; i < 8; i++) {
973 size = snd_hda_codec_read(codec, pin_nid, 0, 975 size = snd_hda_codec_read(codec, pin_nid, 0,
974 AC_VERB_GET_HDMI_DIP_SIZE, i); 976 AC_VERB_GET_HDMI_DIP_SIZE, i);
975 printk(KERN_DEBUG "HDMI: DIP GP[%d] buf size is %d\n", i, size); 977 codec_dbg(codec, "HDMI: DIP GP[%d] buf size is %d\n", i, size);
976 } 978 }
977#endif 979#endif
978} 980}
@@ -994,12 +996,12 @@ static void hdmi_clear_dip_buffers(struct hda_codec *codec, hda_nid_t pin_nid)
994 hdmi_write_dip_byte(codec, pin_nid, 0x0); 996 hdmi_write_dip_byte(codec, pin_nid, 0x0);
995 hdmi_get_dip_index(codec, pin_nid, &pi, &bi); 997 hdmi_get_dip_index(codec, pin_nid, &pi, &bi);
996 if (pi != i) 998 if (pi != i)
997 snd_printd(KERN_INFO "dip index %d: %d != %d\n", 999 codec_dbg(codec, "dip index %d: %d != %d\n",
998 bi, pi, i); 1000 bi, pi, i);
999 if (bi == 0) /* byte index wrapped around */ 1001 if (bi == 0) /* byte index wrapped around */
1000 break; 1002 break;
1001 } 1003 }
1002 snd_printd(KERN_INFO 1004 codec_dbg(codec,
1003 "HDMI: DIP GP[%d] buf reported size=%d, written=%d\n", 1005 "HDMI: DIP GP[%d] buf reported size=%d, written=%d\n",
1004 i, size, j); 1006 i, size, j);
1005 } 1007 }
@@ -1080,7 +1082,7 @@ static void hdmi_pin_setup_infoframe(struct hda_codec *codec,
1080 dp_ai->CC02_CT47 = active_channels - 1; 1082 dp_ai->CC02_CT47 = active_channels - 1;
1081 dp_ai->CA = ca; 1083 dp_ai->CA = ca;
1082 } else { 1084 } else {
1083 snd_printd("HDMI: unknown connection type at pin %d\n", 1085 codec_dbg(codec, "HDMI: unknown connection type at pin %d\n",
1084 pin_nid); 1086 pin_nid);
1085 return; 1087 return;
1086 } 1088 }
@@ -1092,8 +1094,8 @@ static void hdmi_pin_setup_infoframe(struct hda_codec *codec,
1092 */ 1094 */
1093 if (!hdmi_infoframe_uptodate(codec, pin_nid, ai.bytes, 1095 if (!hdmi_infoframe_uptodate(codec, pin_nid, ai.bytes,
1094 sizeof(ai))) { 1096 sizeof(ai))) {
1095 snd_printdd("hdmi_pin_setup_infoframe: " 1097 codec_dbg(codec,
1096 "pin=%d channels=%d ca=0x%02x\n", 1098 "hdmi_pin_setup_infoframe: pin=%d channels=%d ca=0x%02x\n",
1097 pin_nid, 1099 pin_nid,
1098 active_channels, ca); 1100 active_channels, ca);
1099 hdmi_stop_infoframe_trans(codec, pin_nid); 1101 hdmi_stop_infoframe_trans(codec, pin_nid);
@@ -1161,7 +1163,7 @@ static bool hdmi_present_sense(struct hdmi_spec_per_pin *per_pin, int repoll);
1161static void jack_callback(struct hda_codec *codec, struct hda_jack_tbl *jack) 1163static void jack_callback(struct hda_codec *codec, struct hda_jack_tbl *jack)
1162{ 1164{
1163 struct hdmi_spec *spec = codec->spec; 1165 struct hdmi_spec *spec = codec->spec;
1164 int pin_idx = pin_nid_to_pin_index(spec, jack->nid); 1166 int pin_idx = pin_nid_to_pin_index(codec, jack->nid);
1165 if (pin_idx < 0) 1167 if (pin_idx < 0)
1166 return; 1168 return;
1167 1169
@@ -1180,7 +1182,7 @@ static void hdmi_intrinsic_event(struct hda_codec *codec, unsigned int res)
1180 return; 1182 return;
1181 jack->jack_dirty = 1; 1183 jack->jack_dirty = 1;
1182 1184
1183 _snd_printd(SND_PR_VERBOSE, 1185 codec_dbg(codec,
1184 "HDMI hot plug event: Codec=%d Pin=%d Device=%d Inactive=%d Presence_Detect=%d ELD_Valid=%d\n", 1186 "HDMI hot plug event: Codec=%d Pin=%d Device=%d Inactive=%d Presence_Detect=%d ELD_Valid=%d\n",
1185 codec->addr, jack->nid, dev_entry, !!(res & AC_UNSOL_RES_IA), 1187 codec->addr, jack->nid, dev_entry, !!(res & AC_UNSOL_RES_IA),
1186 !!(res & AC_UNSOL_RES_PD), !!(res & AC_UNSOL_RES_ELDV)); 1188 !!(res & AC_UNSOL_RES_PD), !!(res & AC_UNSOL_RES_ELDV));
@@ -1195,7 +1197,7 @@ static void hdmi_non_intrinsic_event(struct hda_codec *codec, unsigned int res)
1195 int cp_state = !!(res & AC_UNSOL_RES_CP_STATE); 1197 int cp_state = !!(res & AC_UNSOL_RES_CP_STATE);
1196 int cp_ready = !!(res & AC_UNSOL_RES_CP_READY); 1198 int cp_ready = !!(res & AC_UNSOL_RES_CP_READY);
1197 1199
1198 printk(KERN_INFO 1200 codec_info(codec,
1199 "HDMI CP event: CODEC=%d TAG=%d SUBTAG=0x%x CP_STATE=%d CP_READY=%d\n", 1201 "HDMI CP event: CODEC=%d TAG=%d SUBTAG=0x%x CP_STATE=%d CP_READY=%d\n",
1200 codec->addr, 1202 codec->addr,
1201 tag, 1203 tag,
@@ -1217,7 +1219,7 @@ static void hdmi_unsol_event(struct hda_codec *codec, unsigned int res)
1217 int subtag = (res & AC_UNSOL_RES_SUBTAG) >> AC_UNSOL_RES_SUBTAG_SHIFT; 1219 int subtag = (res & AC_UNSOL_RES_SUBTAG) >> AC_UNSOL_RES_SUBTAG_SHIFT;
1218 1220
1219 if (!snd_hda_jack_tbl_get_from_tag(codec, tag)) { 1221 if (!snd_hda_jack_tbl_get_from_tag(codec, tag)) {
1220 snd_printd(KERN_INFO "Unexpected HDMI event tag 0x%x\n", tag); 1222 codec_dbg(codec, "Unexpected HDMI event tag 0x%x\n", tag);
1221 return; 1223 return;
1222 } 1224 }
1223 1225
@@ -1244,7 +1246,7 @@ static void haswell_verify_D0(struct hda_codec *codec,
1244 msleep(40); 1246 msleep(40);
1245 pwr = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_POWER_STATE, 0); 1247 pwr = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_POWER_STATE, 0);
1246 pwr = (pwr & AC_PWRST_ACTUAL) >> AC_PWRST_ACTUAL_SHIFT; 1248 pwr = (pwr & AC_PWRST_ACTUAL) >> AC_PWRST_ACTUAL_SHIFT;
1247 snd_printd("Haswell HDMI audio: Power for pin 0x%x is now D%d\n", nid, pwr); 1249 codec_dbg(codec, "Haswell HDMI audio: Power for pin 0x%x is now D%d\n", nid, pwr);
1248 } 1250 }
1249} 1251}
1250 1252
@@ -1274,8 +1276,8 @@ static int hdmi_pin_hbr_setup(struct hda_codec *codec, hda_nid_t pin_nid,
1274 else 1276 else
1275 new_pinctl |= AC_PINCTL_EPT_NATIVE; 1277 new_pinctl |= AC_PINCTL_EPT_NATIVE;
1276 1278
1277 snd_printdd("hdmi_pin_hbr_setup: " 1279 codec_dbg(codec,
1278 "NID=0x%x, %spinctl=0x%x\n", 1280 "hdmi_pin_hbr_setup: NID=0x%x, %spinctl=0x%x\n",
1279 pin_nid, 1281 pin_nid,
1280 pinctl == new_pinctl ? "" : "new-", 1282 pinctl == new_pinctl ? "" : "new-",
1281 new_pinctl); 1283 new_pinctl);
@@ -1302,7 +1304,7 @@ static int hdmi_setup_stream(struct hda_codec *codec, hda_nid_t cvt_nid,
1302 err = spec->ops.pin_hbr_setup(codec, pin_nid, is_hbr_format(format)); 1304 err = spec->ops.pin_hbr_setup(codec, pin_nid, is_hbr_format(format));
1303 1305
1304 if (err) { 1306 if (err) {
1305 snd_printdd("hdmi_setup_stream: HBR is not supported\n"); 1307 codec_dbg(codec, "hdmi_setup_stream: HBR is not supported\n");
1306 return err; 1308 return err;
1307 } 1309 }
1308 1310
@@ -1389,7 +1391,8 @@ static void intel_not_share_assigned_cvt(struct hda_codec *codec,
1389 for (cvt_idx = 0; cvt_idx < spec->num_cvts; cvt_idx++) { 1391 for (cvt_idx = 0; cvt_idx < spec->num_cvts; cvt_idx++) {
1390 per_cvt = get_cvt(spec, cvt_idx); 1392 per_cvt = get_cvt(spec, cvt_idx);
1391 if (!per_cvt->assigned) { 1393 if (!per_cvt->assigned) {
1392 snd_printdd("choose cvt %d for pin nid %d\n", 1394 codec_dbg(codec,
1395 "choose cvt %d for pin nid %d\n",
1393 cvt_idx, nid); 1396 cvt_idx, nid);
1394 snd_hda_codec_write_cache(codec, nid, 0, 1397 snd_hda_codec_write_cache(codec, nid, 0,
1395 AC_VERB_SET_CONNECT_SEL, 1398 AC_VERB_SET_CONNECT_SEL,
@@ -1416,7 +1419,7 @@ static int hdmi_pcm_open(struct hda_pcm_stream *hinfo,
1416 int err; 1419 int err;
1417 1420
1418 /* Validate hinfo */ 1421 /* Validate hinfo */
1419 pin_idx = hinfo_to_pin_index(spec, hinfo); 1422 pin_idx = hinfo_to_pin_index(codec, hinfo);
1420 if (snd_BUG_ON(pin_idx < 0)) 1423 if (snd_BUG_ON(pin_idx < 0))
1421 return -EINVAL; 1424 return -EINVAL;
1422 per_pin = get_pin(spec, pin_idx); 1425 per_pin = get_pin(spec, pin_idx);
@@ -1482,9 +1485,8 @@ static int hdmi_read_pin_conn(struct hda_codec *codec, int pin_idx)
1482 hda_nid_t pin_nid = per_pin->pin_nid; 1485 hda_nid_t pin_nid = per_pin->pin_nid;
1483 1486
1484 if (!(get_wcaps(codec, pin_nid) & AC_WCAP_CONN_LIST)) { 1487 if (!(get_wcaps(codec, pin_nid) & AC_WCAP_CONN_LIST)) {
1485 snd_printk(KERN_WARNING 1488 codec_warn(codec,
1486 "HDMI: pin %d wcaps %#x " 1489 "HDMI: pin %d wcaps %#x does not support connection list\n",
1487 "does not support connection list\n",
1488 pin_nid, get_wcaps(codec, pin_nid)); 1490 pin_nid, get_wcaps(codec, pin_nid));
1489 return -EINVAL; 1491 return -EINVAL;
1490 } 1492 }
@@ -1527,7 +1529,7 @@ static bool hdmi_present_sense(struct hdmi_spec_per_pin *per_pin, int repoll)
1527 else 1529 else
1528 eld->eld_valid = false; 1530 eld->eld_valid = false;
1529 1531
1530 _snd_printd(SND_PR_VERBOSE, 1532 codec_dbg(codec,
1531 "HDMI status: Codec=%d Pin=%d Presence_Detect=%d ELD_Valid=%d\n", 1533 "HDMI status: Codec=%d Pin=%d Presence_Detect=%d ELD_Valid=%d\n",
1532 codec->addr, pin_nid, pin_eld->monitor_present, eld->eld_valid); 1534 codec->addr, pin_nid, pin_eld->monitor_present, eld->eld_valid);
1533 1535
@@ -1690,7 +1692,7 @@ static int hdmi_parse_codec(struct hda_codec *codec)
1690 1692
1691 nodes = snd_hda_get_sub_nodes(codec, codec->afg, &nid); 1693 nodes = snd_hda_get_sub_nodes(codec, codec->afg, &nid);
1692 if (!nid || nodes < 0) { 1694 if (!nid || nodes < 0) {
1693 snd_printk(KERN_WARNING "HDMI: failed to get afg sub nodes\n"); 1695 codec_warn(codec, "HDMI: failed to get afg sub nodes\n");
1694 return -EINVAL; 1696 return -EINVAL;
1695 } 1697 }
1696 1698
@@ -1744,7 +1746,7 @@ static int generic_hdmi_playback_pcm_prepare(struct hda_pcm_stream *hinfo,
1744{ 1746{
1745 hda_nid_t cvt_nid = hinfo->nid; 1747 hda_nid_t cvt_nid = hinfo->nid;
1746 struct hdmi_spec *spec = codec->spec; 1748 struct hdmi_spec *spec = codec->spec;
1747 int pin_idx = hinfo_to_pin_index(spec, hinfo); 1749 int pin_idx = hinfo_to_pin_index(codec, hinfo);
1748 struct hdmi_spec_per_pin *per_pin = get_pin(spec, pin_idx); 1750 struct hdmi_spec_per_pin *per_pin = get_pin(spec, pin_idx);
1749 hda_nid_t pin_nid = per_pin->pin_nid; 1751 hda_nid_t pin_nid = per_pin->pin_nid;
1750 bool non_pcm; 1752 bool non_pcm;
@@ -1788,7 +1790,7 @@ static int hdmi_pcm_close(struct hda_pcm_stream *hinfo,
1788 int pinctl; 1790 int pinctl;
1789 1791
1790 if (hinfo->nid) { 1792 if (hinfo->nid) {
1791 cvt_idx = cvt_nid_to_cvt_index(spec, hinfo->nid); 1793 cvt_idx = cvt_nid_to_cvt_index(codec, hinfo->nid);
1792 if (snd_BUG_ON(cvt_idx < 0)) 1794 if (snd_BUG_ON(cvt_idx < 0))
1793 return -EINVAL; 1795 return -EINVAL;
1794 per_cvt = get_cvt(spec, cvt_idx); 1796 per_cvt = get_cvt(spec, cvt_idx);
@@ -1797,7 +1799,7 @@ static int hdmi_pcm_close(struct hda_pcm_stream *hinfo,
1797 per_cvt->assigned = 0; 1799 per_cvt->assigned = 0;
1798 hinfo->nid = 0; 1800 hinfo->nid = 0;
1799 1801
1800 pin_idx = hinfo_to_pin_index(spec, hinfo); 1802 pin_idx = hinfo_to_pin_index(codec, hinfo);
1801 if (snd_BUG_ON(pin_idx < 0)) 1803 if (snd_BUG_ON(pin_idx < 0))
1802 return -EINVAL; 1804 return -EINVAL;
1803 per_pin = get_pin(spec, pin_idx); 1805 per_pin = get_pin(spec, pin_idx);
@@ -2211,7 +2213,7 @@ static void intel_haswell_fixup_connect_list(struct hda_codec *codec,
2211 return; 2213 return;
2212 2214
2213 /* override pins connection list */ 2215 /* override pins connection list */
2214 snd_printdd("hdmi: haswell: override pin connection 0x%x\n", nid); 2216 codec_dbg(codec, "hdmi: haswell: override pin connection 0x%x\n", nid);
2215 snd_hda_override_conn_list(codec, nid, spec->num_cvts, spec->cvt_nids); 2217 snd_hda_override_conn_list(codec, nid, spec->num_cvts, spec->cvt_nids);
2216} 2218}
2217 2219
@@ -3132,8 +3134,8 @@ static int atihdmi_pin_hbr_setup(struct hda_codec *codec, hda_nid_t pin_nid,
3132 else 3134 else
3133 hbr_ctl_new = hbr_ctl & ~ATI_HBR_ENABLE; 3135 hbr_ctl_new = hbr_ctl & ~ATI_HBR_ENABLE;
3134 3136
3135 snd_printdd("atihdmi_pin_hbr_setup: " 3137 codec_dbg(codec,
3136 "NID=0x%x, %shbr-ctl=0x%x\n", 3138 "atihdmi_pin_hbr_setup: NID=0x%x, %shbr-ctl=0x%x\n",
3137 pin_nid, 3139 pin_nid,
3138 hbr_ctl == hbr_ctl_new ? "" : "new-", 3140 hbr_ctl == hbr_ctl_new ? "" : "new-",
3139 hbr_ctl_new); 3141 hbr_ctl_new);