]> git.hungrycats.org Git - linux/commitdiff
Merge 2.4.x changes for old OSS ac97_codec driver:
authorJeff Garzik <jgarzik@mandrakesoft.com>
Thu, 9 May 2002 20:09:43 +0000 (16:09 -0400)
committerJeff Garzik <jgarzik@mandrakesoft.com>
Thu, 9 May 2002 20:09:43 +0000 (16:09 -0400)
* update Wolfson codec support
* add new AC97 codec ids

sound/oss/ac97_codec.c

index ecdf2fa84519554d81b6ce9f878b406311812380..d743c7787f0632955b788da42bd651b4c6fd220b 100644 (file)
@@ -31,6 +31,8 @@
  **************************************************************************
  *
  * History
+ * Mar 28, 2002 Randolph Bentson <bentson@holmsjoen.com>
+ *     corrections to support WM9707 in ViewPad 1000
  * v0.4 Mar 15 2000 Ollie Lho
  *     dual codecs support verified with 4 channels output
  * v0.3 Feb 22 2000 Ollie Lho
@@ -59,7 +61,9 @@ static int ac97_mixer_ioctl(struct ac97_codec *codec, unsigned int cmd, unsigned
 
 static int ac97_init_mixer(struct ac97_codec *codec);
 
-static int wolfson_init(struct ac97_codec * codec);
+static int wolfson_init00(struct ac97_codec * codec);
+static int wolfson_init03(struct ac97_codec * codec);
+static int wolfson_init04(struct ac97_codec * codec);
 static int tritech_init(struct ac97_codec * codec);
 static int tritech_maestro_init(struct ac97_codec * codec);
 static int sigmatel_9708_init(struct ac97_codec *codec);
@@ -88,7 +92,9 @@ static int crystal_digital_control(struct ac97_codec *codec, int mode);
  
 static struct ac97_ops null_ops = { NULL, NULL, NULL };
 static struct ac97_ops default_ops = { NULL, eapd_control, NULL };
-static struct ac97_ops wolfson_ops = { wolfson_init, NULL, NULL };
+static struct ac97_ops wolfson_ops00 = { wolfson_init00, NULL, NULL };
+static struct ac97_ops wolfson_ops03 = { wolfson_init03, NULL, NULL };
+static struct ac97_ops wolfson_ops04 = { wolfson_init04, NULL, NULL };
 static struct ac97_ops tritech_ops = { tritech_init, NULL, NULL };
 static struct ac97_ops tritech_m_ops = { tritech_maestro_init, NULL, NULL };
 static struct ac97_ops sigmatel_9708_ops = { sigmatel_9708_init, NULL, NULL };
@@ -114,6 +120,7 @@ static const struct {
        {0x414B4D01, "Asahi Kasei AK4542",      &null_ops},
        {0x414B4D02, "Asahi Kasei AK4543",      &null_ops},
        {0x414C4710, "ALC200/200P",             &null_ops},
+       {0x414C4720, "ALC650",                  &null_ops},
        {0x43525900, "Cirrus Logic CS4297",     &default_ops},
        {0x43525903, "Cirrus Logic CS4297",     &default_ops},
        {0x43525913, "Cirrus Logic CS4297A rev A", &default_ops},
@@ -135,9 +142,9 @@ static const struct {
        {0x54524106, "TriTech TR28026",         &null_ops},
        {0x54524108, "TriTech TR28028",         &tritech_ops},
        {0x54524123, "TriTech TR A5",           &null_ops},
-       {0x574D4C00, "Wolfson WM9704",          &wolfson_ops},
-       {0x574D4C03, "Wolfson WM9703/9704",     &wolfson_ops},
-       {0x574D4C04, "Wolfson WM9704 (quad)",   &wolfson_ops},
+       {0x574D4C00, "Wolfson WM9700A",         &wolfson_ops00},
+       {0x574D4C03, "Wolfson WM9703/WM9707",   &wolfson_ops03},
+       {0x574D4C04, "Wolfson WM9704M/WM9704Q", &wolfson_ops04},
        {0x83847600, "SigmaTel STAC????",       &null_ops},
        {0x83847604, "SigmaTel STAC9701/3/4/5", &null_ops},
        {0x83847605, "SigmaTel STAC9704",       &null_ops},
@@ -145,6 +152,7 @@ static const struct {
        {0x83847609, "SigmaTel STAC9721/23",    &sigmatel_9721_ops},
        {0x83847644, "SigmaTel STAC9744/45",    &sigmatel_9744_ops},
        {0x83847656, "SigmaTel STAC9756/57",    &sigmatel_9744_ops},
+       {0x83847666, "SigmaTel STAC9750T",      &sigmatel_9744_ops},
        {0x83847684, "SigmaTel STAC9783/84?",   &null_ops},
        {0x57454301, "Winbond 83971D",          &null_ops},
 };
@@ -837,7 +845,38 @@ static int sigmatel_9744_init(struct ac97_codec * codec)
 }
 
 
-static int wolfson_init(struct ac97_codec * codec)
+static int wolfson_init00(struct ac97_codec * codec)
+{
+       /* This initialization is suspect, but not known to be wrong.
+          It was copied from the initialization for the WM9704Q, but
+          that same sequence is known to fail for the WM9707.  Thus
+          this warning may help someone with hardware to test
+          this code. */
+       codec->codec_write(codec, 0x72, 0x0808);
+       codec->codec_write(codec, 0x74, 0x0808);
+
+       // patch for DVD noise
+       codec->codec_write(codec, 0x5a, 0x0200);
+
+       // init vol as PCM vol
+       codec->codec_write(codec, 0x70,
+               codec->codec_read(codec, AC97_PCMOUT_VOL));
+
+       codec->codec_write(codec, AC97_SURROUND_MASTER, 0x0000);
+       return 0;
+}
+
+
+static int wolfson_init03(struct ac97_codec * codec)
+{
+       /* this is known to work for the ViewSonic ViewPad 1000 */
+       codec->codec_write(codec, 0x72, 0x0808);
+       codec->codec_write(codec, 0x20, 0x8000);
+       return 0;
+}
+
+
+static int wolfson_init04(struct ac97_codec * codec)
 {
        codec->codec_write(codec, 0x72, 0x0808);
        codec->codec_write(codec, 0x74, 0x0808);