Commit 7c56c29a authored by Takashi Iwai's avatar Takashi Iwai

Merge branch 'fix/hda' into for-linus

parents b4583a46 9411e21c
...@@ -3088,6 +3088,16 @@ int snd_hda_multi_out_dig_prepare(struct hda_codec *codec, ...@@ -3088,6 +3088,16 @@ int snd_hda_multi_out_dig_prepare(struct hda_codec *codec,
} }
EXPORT_SYMBOL_HDA(snd_hda_multi_out_dig_prepare); EXPORT_SYMBOL_HDA(snd_hda_multi_out_dig_prepare);
int snd_hda_multi_out_dig_cleanup(struct hda_codec *codec,
struct hda_multi_out *mout)
{
mutex_lock(&codec->spdif_mutex);
cleanup_dig_out_stream(codec, mout->dig_out_nid);
mutex_unlock(&codec->spdif_mutex);
return 0;
}
EXPORT_SYMBOL_HDA(snd_hda_multi_out_dig_cleanup);
/* /*
* release the digital out * release the digital out
*/ */
......
...@@ -175,7 +175,7 @@ static int reconfig_codec(struct hda_codec *codec) ...@@ -175,7 +175,7 @@ static int reconfig_codec(struct hda_codec *codec)
err = snd_hda_codec_build_controls(codec); err = snd_hda_codec_build_controls(codec);
if (err < 0) if (err < 0)
return err; return err;
return 0; return snd_card_register(codec->bus->card);
} }
/* /*
......
...@@ -251,6 +251,8 @@ int snd_hda_multi_out_dig_prepare(struct hda_codec *codec, ...@@ -251,6 +251,8 @@ int snd_hda_multi_out_dig_prepare(struct hda_codec *codec,
unsigned int stream_tag, unsigned int stream_tag,
unsigned int format, unsigned int format,
struct snd_pcm_substream *substream); struct snd_pcm_substream *substream);
int snd_hda_multi_out_dig_cleanup(struct hda_codec *codec,
struct hda_multi_out *mout);
int snd_hda_multi_out_analog_open(struct hda_codec *codec, int snd_hda_multi_out_analog_open(struct hda_codec *codec,
struct hda_multi_out *mout, struct hda_multi_out *mout,
struct snd_pcm_substream *substream, struct snd_pcm_substream *substream,
......
...@@ -275,6 +275,14 @@ static int ad198x_dig_playback_pcm_prepare(struct hda_pcm_stream *hinfo, ...@@ -275,6 +275,14 @@ static int ad198x_dig_playback_pcm_prepare(struct hda_pcm_stream *hinfo,
format, substream); format, substream);
} }
static int ad198x_dig_playback_pcm_cleanup(struct hda_pcm_stream *hinfo,
struct hda_codec *codec,
struct snd_pcm_substream *substream)
{
struct ad198x_spec *spec = codec->spec;
return snd_hda_multi_out_dig_cleanup(codec, &spec->multiout);
}
/* /*
* Analog capture * Analog capture
*/ */
...@@ -333,7 +341,8 @@ static struct hda_pcm_stream ad198x_pcm_digital_playback = { ...@@ -333,7 +341,8 @@ static struct hda_pcm_stream ad198x_pcm_digital_playback = {
.ops = { .ops = {
.open = ad198x_dig_playback_pcm_open, .open = ad198x_dig_playback_pcm_open,
.close = ad198x_dig_playback_pcm_close, .close = ad198x_dig_playback_pcm_close,
.prepare = ad198x_dig_playback_pcm_prepare .prepare = ad198x_dig_playback_pcm_prepare,
.cleanup = ad198x_dig_playback_pcm_cleanup
}, },
}; };
...@@ -1885,8 +1894,8 @@ static hda_nid_t ad1988_capsrc_nids[3] = { ...@@ -1885,8 +1894,8 @@ static hda_nid_t ad1988_capsrc_nids[3] = {
#define AD1988_SPDIF_OUT_HDMI 0x0b #define AD1988_SPDIF_OUT_HDMI 0x0b
#define AD1988_SPDIF_IN 0x07 #define AD1988_SPDIF_IN 0x07
static hda_nid_t ad1989b_slave_dig_outs[2] = { static hda_nid_t ad1989b_slave_dig_outs[] = {
AD1988_SPDIF_OUT, AD1988_SPDIF_OUT_HDMI AD1988_SPDIF_OUT, AD1988_SPDIF_OUT_HDMI, 0
}; };
static struct hda_input_mux ad1988_6stack_capture_source = { static struct hda_input_mux ad1988_6stack_capture_source = {
......
...@@ -49,11 +49,6 @@ static struct hda_verb pinout_enable_verb[] = { ...@@ -49,11 +49,6 @@ static struct hda_verb pinout_enable_verb[] = {
{} /* terminator */ {} /* terminator */
}; };
static struct hda_verb pinout_disable_verb[] = {
{PIN_NID, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00},
{}
};
static struct hda_verb unsolicited_response_verb[] = { static struct hda_verb unsolicited_response_verb[] = {
{PIN_NID, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | {PIN_NID, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN |
INTEL_HDMI_EVENT_TAG}, INTEL_HDMI_EVENT_TAG},
...@@ -248,10 +243,6 @@ static void hdmi_write_dip_byte(struct hda_codec *codec, hda_nid_t nid, ...@@ -248,10 +243,6 @@ static void hdmi_write_dip_byte(struct hda_codec *codec, hda_nid_t nid,
static void hdmi_enable_output(struct hda_codec *codec) static void hdmi_enable_output(struct hda_codec *codec)
{ {
/* Enable Audio InfoFrame Transmission */
hdmi_set_dip_index(codec, PIN_NID, 0x0, 0x0);
snd_hda_codec_write(codec, PIN_NID, 0, AC_VERB_SET_HDMI_DIP_XMIT,
AC_DIPXMIT_BEST);
/* Unmute */ /* Unmute */
if (get_wcaps(codec, PIN_NID) & AC_WCAP_OUT_AMP) if (get_wcaps(codec, PIN_NID) & AC_WCAP_OUT_AMP)
snd_hda_codec_write(codec, PIN_NID, 0, snd_hda_codec_write(codec, PIN_NID, 0,
...@@ -260,17 +251,24 @@ static void hdmi_enable_output(struct hda_codec *codec) ...@@ -260,17 +251,24 @@ static void hdmi_enable_output(struct hda_codec *codec)
snd_hda_sequence_write(codec, pinout_enable_verb); snd_hda_sequence_write(codec, pinout_enable_verb);
} }
static void hdmi_disable_output(struct hda_codec *codec) /*
* Enable Audio InfoFrame Transmission
*/
static void hdmi_start_infoframe_trans(struct hda_codec *codec)
{ {
snd_hda_sequence_write(codec, pinout_disable_verb); hdmi_set_dip_index(codec, PIN_NID, 0x0, 0x0);
if (get_wcaps(codec, PIN_NID) & AC_WCAP_OUT_AMP) snd_hda_codec_write(codec, PIN_NID, 0, AC_VERB_SET_HDMI_DIP_XMIT,
snd_hda_codec_write(codec, PIN_NID, 0, AC_DIPXMIT_BEST);
AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE); }
/* /*
* FIXME: noises may arise when playing music after reloading the * Disable Audio InfoFrame Transmission
* kernel module, until the next X restart or monitor repower. */
*/ static void hdmi_stop_infoframe_trans(struct hda_codec *codec)
{
hdmi_set_dip_index(codec, PIN_NID, 0x0, 0x0);
snd_hda_codec_write(codec, PIN_NID, 0, AC_VERB_SET_HDMI_DIP_XMIT,
AC_DIPXMIT_DISABLE);
} }
static int hdmi_get_channel_count(struct hda_codec *codec) static int hdmi_get_channel_count(struct hda_codec *codec)
...@@ -368,11 +366,16 @@ static void hdmi_fill_audio_infoframe(struct hda_codec *codec, ...@@ -368,11 +366,16 @@ static void hdmi_fill_audio_infoframe(struct hda_codec *codec,
struct hdmi_audio_infoframe *ai) struct hdmi_audio_infoframe *ai)
{ {
u8 *params = (u8 *)ai; u8 *params = (u8 *)ai;
u8 sum = 0;
int i; int i;
hdmi_debug_dip_size(codec); hdmi_debug_dip_size(codec);
hdmi_clear_dip_buffers(codec); /* be paranoid */ hdmi_clear_dip_buffers(codec); /* be paranoid */
for (i = 0; i < sizeof(ai); i++)
sum += params[i];
ai->checksum = - sum;
hdmi_set_dip_index(codec, PIN_NID, 0x0, 0x0); 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]); hdmi_write_dip_byte(codec, PIN_NID, params[i]);
...@@ -419,13 +422,17 @@ static int hdmi_setup_channel_allocation(struct hda_codec *codec, ...@@ -419,13 +422,17 @@ static int hdmi_setup_channel_allocation(struct hda_codec *codec,
/* /*
* CA defaults to 0 for basic stereo audio * CA defaults to 0 for basic stereo audio
*/ */
if (!eld->eld_ver)
return 0;
if (!eld->spk_alloc)
return 0;
if (channels <= 2) if (channels <= 2)
return 0; return 0;
/*
* HDMI sink's ELD info cannot always be retrieved for now, e.g.
* in console or for audio devices. Assume the highest speakers
* configuration, to _not_ prohibit multi-channel audio playback.
*/
if (!eld->spk_alloc)
eld->spk_alloc = 0xffff;
/* /*
* expand ELD's speaker allocation mask * expand ELD's speaker allocation mask
* *
...@@ -485,6 +492,7 @@ static void hdmi_setup_audio_infoframe(struct hda_codec *codec, ...@@ -485,6 +492,7 @@ static void hdmi_setup_audio_infoframe(struct hda_codec *codec,
hdmi_setup_channel_mapping(codec, &ai); hdmi_setup_channel_mapping(codec, &ai);
hdmi_fill_audio_infoframe(codec, &ai); hdmi_fill_audio_infoframe(codec, &ai);
hdmi_start_infoframe_trans(codec);
} }
...@@ -562,7 +570,7 @@ static int intel_hdmi_playback_pcm_close(struct hda_pcm_stream *hinfo, ...@@ -562,7 +570,7 @@ static int intel_hdmi_playback_pcm_close(struct hda_pcm_stream *hinfo,
{ {
struct intel_hdmi_spec *spec = codec->spec; struct intel_hdmi_spec *spec = codec->spec;
hdmi_disable_output(codec); hdmi_stop_infoframe_trans(codec);
return snd_hda_multi_out_dig_close(codec, &spec->multiout); return snd_hda_multi_out_dig_close(codec, &spec->multiout);
} }
...@@ -582,8 +590,6 @@ static int intel_hdmi_playback_pcm_prepare(struct hda_pcm_stream *hinfo, ...@@ -582,8 +590,6 @@ static int intel_hdmi_playback_pcm_prepare(struct hda_pcm_stream *hinfo,
hdmi_setup_audio_infoframe(codec, substream); hdmi_setup_audio_infoframe(codec, substream);
hdmi_enable_output(codec);
return 0; return 0;
} }
...@@ -628,8 +634,7 @@ static int intel_hdmi_build_controls(struct hda_codec *codec) ...@@ -628,8 +634,7 @@ static int intel_hdmi_build_controls(struct hda_codec *codec)
static int intel_hdmi_init(struct hda_codec *codec) static int intel_hdmi_init(struct hda_codec *codec)
{ {
/* disable audio output as early as possible */ hdmi_enable_output(codec);
hdmi_disable_output(codec);
snd_hda_sequence_write(codec, unsolicited_response_verb); snd_hda_sequence_write(codec, unsolicited_response_verb);
...@@ -679,6 +684,7 @@ static struct hda_codec_preset snd_hda_preset_intelhdmi[] = { ...@@ -679,6 +684,7 @@ static struct hda_codec_preset snd_hda_preset_intelhdmi[] = {
{ .id = 0x80862801, .name = "G45 DEVBLC", .patch = patch_intel_hdmi }, { .id = 0x80862801, .name = "G45 DEVBLC", .patch = patch_intel_hdmi },
{ .id = 0x80862802, .name = "G45 DEVCTG", .patch = patch_intel_hdmi }, { .id = 0x80862802, .name = "G45 DEVCTG", .patch = patch_intel_hdmi },
{ .id = 0x80862803, .name = "G45 DEVELK", .patch = patch_intel_hdmi }, { .id = 0x80862803, .name = "G45 DEVELK", .patch = patch_intel_hdmi },
{ .id = 0x80862804, .name = "G45 DEVIBX", .patch = patch_intel_hdmi },
{ .id = 0x10951392, .name = "SiI1392 HDMI", .patch = patch_intel_hdmi }, { .id = 0x10951392, .name = "SiI1392 HDMI", .patch = patch_intel_hdmi },
{} /* terminator */ {} /* terminator */
}; };
...@@ -687,6 +693,7 @@ MODULE_ALIAS("snd-hda-codec-id:808629fb"); ...@@ -687,6 +693,7 @@ MODULE_ALIAS("snd-hda-codec-id:808629fb");
MODULE_ALIAS("snd-hda-codec-id:80862801"); MODULE_ALIAS("snd-hda-codec-id:80862801");
MODULE_ALIAS("snd-hda-codec-id:80862802"); MODULE_ALIAS("snd-hda-codec-id:80862802");
MODULE_ALIAS("snd-hda-codec-id:80862803"); MODULE_ALIAS("snd-hda-codec-id:80862803");
MODULE_ALIAS("snd-hda-codec-id:80862804");
MODULE_ALIAS("snd-hda-codec-id:10951392"); MODULE_ALIAS("snd-hda-codec-id:10951392");
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
......
...@@ -8478,6 +8478,7 @@ static struct snd_pci_quirk alc883_cfg_tbl[] = { ...@@ -8478,6 +8478,7 @@ static struct snd_pci_quirk alc883_cfg_tbl[] = {
SND_PCI_QUIRK(0x103c, 0x2a66, "HP Acacia", ALC888_3ST_HP), SND_PCI_QUIRK(0x103c, 0x2a66, "HP Acacia", ALC888_3ST_HP),
SND_PCI_QUIRK(0x1043, 0x1873, "Asus M90V", ALC888_ASUS_M90V), SND_PCI_QUIRK(0x1043, 0x1873, "Asus M90V", ALC888_ASUS_M90V),
SND_PCI_QUIRK(0x1043, 0x8249, "Asus M2A-VM HDMI", ALC883_3ST_6ch_DIG), SND_PCI_QUIRK(0x1043, 0x8249, "Asus M2A-VM HDMI", ALC883_3ST_6ch_DIG),
SND_PCI_QUIRK(0x1043, 0x8284, "Asus Z37E", ALC883_6ST_DIG),
SND_PCI_QUIRK(0x1043, 0x82fe, "Asus P5Q-EM HDMI", ALC1200_ASUS_P5Q), SND_PCI_QUIRK(0x1043, 0x82fe, "Asus P5Q-EM HDMI", ALC1200_ASUS_P5Q),
SND_PCI_QUIRK(0x1043, 0x835f, "Asus Eee 1601", ALC888_ASUS_EEE1601), SND_PCI_QUIRK(0x1043, 0x835f, "Asus Eee 1601", ALC888_ASUS_EEE1601),
SND_PCI_QUIRK(0x105b, 0x0ce8, "Foxconn P35AX-S", ALC883_6ST_DIG), SND_PCI_QUIRK(0x105b, 0x0ce8, "Foxconn P35AX-S", ALC883_6ST_DIG),
......
...@@ -1799,7 +1799,7 @@ static struct snd_pci_quirk stac92hd71bxx_cfg_tbl[] = { ...@@ -1799,7 +1799,7 @@ static struct snd_pci_quirk stac92hd71bxx_cfg_tbl[] = {
SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x30f2, SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x30f2,
"HP dv5", STAC_HP_M4), "HP dv5", STAC_HP_M4),
SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x30f4, SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x30f4,
"HP dv7", STAC_HP_M4), "HP dv7", STAC_HP_DV5),
SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x30f7, SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x30f7,
"HP dv4", STAC_HP_DV5), "HP dv4", STAC_HP_DV5),
SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x30fc, SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x30fc,
...@@ -2442,6 +2442,14 @@ static int stac92xx_dig_playback_pcm_prepare(struct hda_pcm_stream *hinfo, ...@@ -2442,6 +2442,14 @@ static int stac92xx_dig_playback_pcm_prepare(struct hda_pcm_stream *hinfo,
stream_tag, format, substream); stream_tag, format, substream);
} }
static int stac92xx_dig_playback_pcm_cleanup(struct hda_pcm_stream *hinfo,
struct hda_codec *codec,
struct snd_pcm_substream *substream)
{
struct sigmatel_spec *spec = codec->spec;
return snd_hda_multi_out_dig_cleanup(codec, &spec->multiout);
}
/* /*
* Analog capture callbacks * Analog capture callbacks
...@@ -2486,7 +2494,8 @@ static struct hda_pcm_stream stac92xx_pcm_digital_playback = { ...@@ -2486,7 +2494,8 @@ static struct hda_pcm_stream stac92xx_pcm_digital_playback = {
.ops = { .ops = {
.open = stac92xx_dig_playback_pcm_open, .open = stac92xx_dig_playback_pcm_open,
.close = stac92xx_dig_playback_pcm_close, .close = stac92xx_dig_playback_pcm_close,
.prepare = stac92xx_dig_playback_pcm_prepare .prepare = stac92xx_dig_playback_pcm_prepare,
.cleanup = stac92xx_dig_playback_pcm_cleanup
}, },
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment