]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - sound/pci/hda/patch_atihdmi.c
Merge branch 'irq-fixes-2' of git://git.kernel.org/pub/scm/linux/kernel/git/jgarzik...
[linux-2.6-omap-h63xx.git] / sound / pci / hda / patch_atihdmi.c
index 831469d3a923db7dd64bd857b287d8379ba4b1ed..12272508b1124abebcb68fdcc06458727cbe86da 100644 (file)
  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
  */
 
-#include <sound/driver.h>
 #include <linux/init.h>
 #include <linux/delay.h>
 #include <linux/slab.h>
 #include <sound/core.h>
 #include "hda_codec.h"
 #include "hda_local.h"
+#include "hda_patch.h"
 
 struct atihdmi_spec {
        struct hda_multi_out multiout;
@@ -59,22 +59,13 @@ static int atihdmi_build_controls(struct hda_codec *codec)
 static int atihdmi_init(struct hda_codec *codec)
 {
        snd_hda_sequence_write(codec, atihdmi_basic_init);
+       /* SI codec requires to unmute the pin */
+       if (get_wcaps(codec, 0x03) & AC_WCAP_OUT_AMP)
+               snd_hda_codec_write(codec, 0x03, 0, AC_VERB_SET_AMP_GAIN_MUTE,
+                                   AMP_OUT_UNMUTE);
        return 0;
 }
 
-#ifdef CONFIG_PM
-/*
- * resume
- */
-static int atihdmi_resume(struct hda_codec *codec)
-{
-       atihdmi_init(codec);
-       snd_hda_resume_spdif_out(codec);
-
-       return 0;
-}
-#endif
-
 /*
  * Digital out
  */
@@ -94,6 +85,17 @@ static int atihdmi_dig_playback_pcm_close(struct hda_pcm_stream *hinfo,
        return snd_hda_multi_out_dig_close(codec, &spec->multiout);
 }
 
+static int atihdmi_dig_playback_pcm_prepare(struct hda_pcm_stream *hinfo,
+                                           struct hda_codec *codec,
+                                           unsigned int stream_tag,
+                                           unsigned int format,
+                                           struct snd_pcm_substream *substream)
+{
+       struct atihdmi_spec *spec = codec->spec;
+       return snd_hda_multi_out_dig_prepare(codec, &spec->multiout, stream_tag,
+                                            format, substream);
+}
+
 static struct hda_pcm_stream atihdmi_pcm_digital_playback = {
        .substreams = 1,
        .channels_min = 2,
@@ -101,7 +103,8 @@ static struct hda_pcm_stream atihdmi_pcm_digital_playback = {
        .nid = 0x2, /* NID to query formats and rates and setup streams */
        .ops = {
                .open = atihdmi_dig_playback_pcm_open,
-               .close = atihdmi_dig_playback_pcm_close
+               .close = atihdmi_dig_playback_pcm_close,
+               .prepare = atihdmi_dig_playback_pcm_prepare
        },
 };
 
@@ -114,6 +117,7 @@ static int atihdmi_build_pcms(struct hda_codec *codec)
        codec->pcm_info = info;
 
        info->name = "ATI HDMI";
+       info->pcm_type = HDA_PCM_TYPE_HDMI;
        info->stream[SNDRV_PCM_STREAM_PLAYBACK] = atihdmi_pcm_digital_playback;
 
        return 0;
@@ -129,9 +133,6 @@ static struct hda_codec_ops atihdmi_patch_ops = {
        .build_pcms = atihdmi_build_pcms,
        .init = atihdmi_init,
        .free = atihdmi_free,
-#ifdef CONFIG_PM
-       .resume = atihdmi_resume,
-#endif
 };
 
 static int patch_atihdmi(struct hda_codec *codec)
@@ -160,6 +161,10 @@ static int patch_atihdmi(struct hda_codec *codec)
  */
 struct hda_codec_preset snd_hda_preset_atihdmi[] = {
        { .id = 0x1002793c, .name = "ATI RS600 HDMI", .patch = patch_atihdmi },
-       { .id = 0x1002791a, .name = "ATI RS690 HDMI", .patch = patch_atihdmi },
+       { .id = 0x10027919, .name = "ATI RS600 HDMI", .patch = patch_atihdmi },
+       { .id = 0x1002791a, .name = "ATI RS690/780 HDMI", .patch = patch_atihdmi },
+       { .id = 0x1002aa01, .name = "ATI R6xx HDMI", .patch = patch_atihdmi },
+       { .id = 0x10951392, .name = "SiI1392 HDMI", .patch = patch_atihdmi },
+       { .id = 0x17e80047, .name = "Chrontel HDMI",  .patch = patch_atihdmi },
        {} /* terminator */
 };