summaryrefslogtreecommitdiff
path: root/sys/dev/pci
diff options
context:
space:
mode:
authorJacob Meuser <jakemsr@cvs.openbsd.org>2008-12-23 10:01:15 +0000
committerJacob Meuser <jakemsr@cvs.openbsd.org>2008-12-23 10:01:15 +0000
commit36f5301ed1fd3e451ad0b513f7df6feb1099a557 (patch)
tree13ecbc6e662fb360418a3ba73c102729f98c07e1 /sys/dev/pci
parent0fb9e3402b21f33e4b8025dbacf175aef0702c71 (diff)
remove static mixer configurations wholesale, to make next commit
more clear.
Diffstat (limited to 'sys/dev/pci')
-rw-r--r--sys/dev/pci/azalia_codec.c584
1 files changed, 1 insertions, 583 deletions
diff --git a/sys/dev/pci/azalia_codec.c b/sys/dev/pci/azalia_codec.c
index 96cf9fbc422..d20d090d13b 100644
--- a/sys/dev/pci/azalia_codec.c
+++ b/sys/dev/pci/azalia_codec.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: azalia_codec.c,v 1.86 2008/12/23 09:46:38 jakemsr Exp $ */
+/* $OpenBSD: azalia_codec.c,v 1.87 2008/12/23 10:01:14 jakemsr Exp $ */
/* $NetBSD: azalia_codec.c,v 1.8 2006/05/10 11:17:27 kent Exp $ */
/*-
@@ -93,21 +93,6 @@ void azalia_pin_config_ov(widget_t *, int, int);
int azalia_alc260_mixer_init(codec_t *);
int azalia_alc88x_mixer_init(codec_t *);
-int azalia_ad1984_init_dacgroup(codec_t *);
-int azalia_ad1984_mixer_init(codec_t *);
-int azalia_ad1984_set_port(codec_t *, mixer_ctrl_t *);
-int azalia_ad1984_get_port(codec_t *, mixer_ctrl_t *);
-int azalia_cmi9880_init_dacgroup(codec_t *);
-int azalia_cmi9880_mixer_init(codec_t *);
-int azalia_stac9200_mixer_init(codec_t *);
-int azalia_stac9221_init_dacgroup(codec_t *);
-int azalia_stac9221_mixer_init(codec_t *);
-int azalia_stac9221_set_port(codec_t *, mixer_ctrl_t *);
-int azalia_stac9221_get_port(codec_t *, mixer_ctrl_t *);
-int azalia_stac7661_init_dacgroup(codec_t *);
-int azalia_stac7661_mixer_init(codec_t *);
-int azalia_stac7661_set_port(codec_t *, mixer_ctrl_t *);
-int azalia_stac7661_get_port(codec_t *, mixer_ctrl_t *);
int
azalia_codec_init_vtbl(codec_t *this)
@@ -179,10 +164,6 @@ azalia_codec_init_vtbl(codec_t *this)
break;
case 0x11d41984:
this->name = "Analog Devices AD1984";
- this->init_dacgroup = azalia_ad1984_init_dacgroup;
- this->mixer_init = azalia_ad1984_mixer_init;
- this->get_port = azalia_ad1984_get_port;
- this->set_port = azalia_ad1984_set_port;
break;
case 0x11d41988:
this->name = "Analog Devices AD1988A";
@@ -201,8 +182,6 @@ azalia_codec_init_vtbl(codec_t *this)
break;
case 0x434d4980:
this->name = "CMedia CMI9880";
- this->init_dacgroup = azalia_cmi9880_init_dacgroup;
- this->mixer_init = azalia_cmi9880_mixer_init;
break;
case 0x83847616:
this->name = "Sigmatel STAC9228X";
@@ -244,24 +223,15 @@ azalia_codec_init_vtbl(codec_t *this)
/* FALLTHRU */
case 0x83847662:
this->name = "Sigmatel STAC9225";
- this->init_dacgroup = azalia_stac7661_init_dacgroup;
- this->mixer_init = azalia_stac7661_mixer_init;
- this->get_port = azalia_stac7661_get_port;
- this->set_port = azalia_stac7661_set_port;
break;
case 0x83847680:
this->name = "Sigmatel STAC9221";
- this->init_dacgroup = azalia_stac9221_init_dacgroup;
- this->mixer_init = azalia_stac9221_mixer_init;
- this->set_port = azalia_stac9221_set_port;
- this->get_port = azalia_stac9221_get_port;
break;
case 0x83847683:
this->name = "Sigmatel STAC9221D";
break;
case 0x83847690:
this->name = "Sigmatel STAC9200";
- this->mixer_init = azalia_stac9200_mixer_init;
break;
case 0x83847691:
this->name = "Sigmatel STAC9200D";
@@ -1784,555 +1754,3 @@ azalia_alc88x_mixer_init(codec_t *this)
return 0;
}
-/* ----------------------------------------------------------------
- * Analog Devices AD1984
- * ---------------------------------------------------------------- */
-
-int
-azalia_ad1984_init_dacgroup(codec_t *this)
-{
- static const convgroupset_t dacs = {
- -1, 2,
- {{2, {0x04, 0x03}}, /* analog 4ch */
- {1, {0x02}}}}; /* digital */
- static const convgroupset_t adcs = {
- -1, 3,
- {{2, {0x08, 0x09}}, /* analog 4ch */
- {1, {0x06}}, /* digital */
- {1, {0x05}}}}; /* digital */
- this->dacs = dacs;
- this->adcs = adcs;
- return 0;
-}
-
-static const mixer_item_t ad1984_mixer_items[] = {
- {{AZ_CLASS_INPUT, {AudioCinputs}, AUDIO_MIXER_CLASS, AZ_CLASS_INPUT, 0, 0}, 0},
- {{AZ_CLASS_OUTPUT, {AudioCoutputs}, AUDIO_MIXER_CLASS, AZ_CLASS_OUTPUT, 0, 0}, 0},
- {{AZ_CLASS_RECORD, {AudioCrecord}, AUDIO_MIXER_CLASS, AZ_CLASS_RECORD, 0, 0}, 0},
-#define AD1984_DAC_HP 0x03
-#define AD1984_DAC_SPEAKER 0x04
-#define AD1984_TARGET_MASTER -1
-#define AD1984_TARGET_MASTER_MUTE -2
- {{0, {AudioNmaster}, AUDIO_MIXER_VALUE, AZ_CLASS_OUTPUT,
- 4, 0, .un.v={{""}, 2, MIXER_DELTA(39)}}, 0x03, AD1984_TARGET_MASTER},
- {{0, {AudioNmute}, AUDIO_MIXER_ENUM, AZ_CLASS_OUTPUT,
- 0, 3, ENUM_OFFON}, 0x11, AD1984_TARGET_MASTER_MUTE},
- {{0, {AudioNvolume}, AUDIO_MIXER_VALUE, AZ_CLASS_RECORD,
- 0, 0, .un.v={{""}, 2, MIXER_DELTA(54)}}, 0x0c, MI_TARGET_OUTAMP},
- {{0, {AudioNvolume"."AudioNmute}, AUDIO_MIXER_ENUM, AZ_CLASS_RECORD,
- 0, 0, ENUM_OFFON}, 0x0c, MI_TARGET_OUTAMP},
- {{0, {AudioNsource}, AUDIO_MIXER_ENUM, AZ_CLASS_RECORD,
- 0, 0, .un.e={1, {{{AudioNmicrophone}, 0}}}},
- 0x0c, MI_TARGET_CONNLIST},
- {{0, {AudioNmicrophone"."AudioNpreamp}, AUDIO_MIXER_VALUE, AZ_CLASS_INPUT,
- 0, 0, .un.v={{""}, 2, MIXER_DELTA(3)}}, 0x14, MI_TARGET_INAMP(0)},
- {{0, {AudioNmicrophone}, AUDIO_MIXER_VALUE, AZ_CLASS_INPUT,
- 0, 0, .un.v={{""}, 2, MIXER_DELTA(31)}}, 0x20, MI_TARGET_INAMP(0)},
- {{0, {AudioNmicrophone"."AudioNmute}, AUDIO_MIXER_ENUM, AZ_CLASS_INPUT,
- 0, 0, ENUM_OFFON}, 0x20, MI_TARGET_INAMP(0)},
- {{0, {AudioNheadphone}, AUDIO_MIXER_VALUE, AZ_CLASS_OUTPUT,
- 0, 0, .un.v={{""}, 2, MIXER_DELTA(39)}}, 0x03, MI_TARGET_OUTAMP},
- {{0, {AudioNheadphone"."AudioNmute}, AUDIO_MIXER_ENUM, AZ_CLASS_OUTPUT,
- 0, 0, ENUM_OFFON}, 0x11, MI_TARGET_OUTAMP},
- {{0, {AudioNheadphone".boost"}, AUDIO_MIXER_ENUM, AZ_CLASS_OUTPUT,
- 0, 0, ENUM_OFFON}, 0x11, MI_TARGET_PINBOOST},
- {{0, {AudioNspeaker}, AUDIO_MIXER_VALUE, AZ_CLASS_OUTPUT,
- 0, 0, .un.v={{""}, 2, MIXER_DELTA(39)}}, 0x04, MI_TARGET_OUTAMP},
- {{0, {AudioNspeaker"."AudioNmute}, AUDIO_MIXER_ENUM, AZ_CLASS_OUTPUT,
- 0, 0, ENUM_OFFON}, 0x12, MI_TARGET_OUTAMP},
- {{0, {AudioNspeaker".boost"}, AUDIO_MIXER_ENUM, AZ_CLASS_OUTPUT,
- 0, 0, ENUM_OFFON}, 0x12, MI_TARGET_PINBOOST},
- {{0, {AudioNmono}, AUDIO_MIXER_VALUE, AZ_CLASS_OUTPUT,
- 0, 0, .un.v={{""}, 1, MIXER_DELTA(31)}}, 0x13, MI_TARGET_OUTAMP},
- {{0, {AudioNmono"."AudioNmute}, AUDIO_MIXER_ENUM, AZ_CLASS_OUTPUT,
- 0, 0, ENUM_OFFON}, 0x13, MI_TARGET_OUTAMP}
-};
-
-int
-azalia_ad1984_mixer_init(codec_t *this)
-{
- mixer_ctrl_t mc;
-
- this->nmixers = sizeof(ad1984_mixer_items) / sizeof(mixer_item_t);
- this->mixers = malloc(sizeof(mixer_item_t) * this->nmixers,
- M_DEVBUF, M_NOWAIT | M_ZERO);
- if (this->mixers == NULL) {
- printf("%s: out of memory in %s\n", XNAME(this), __func__);
- return ENOMEM;
- }
- memcpy(this->mixers, ad1984_mixer_items,
- sizeof(mixer_item_t) * this->nmixers);
- azalia_generic_mixer_fix_indexes(this);
- azalia_generic_mixer_default(this);
-
- azalia_generic_mixer_pin_sense(this);
-
- mc.dev = -1;
- mc.type = AUDIO_MIXER_ENUM;
- mc.un.ord = 1; /* front DAC -> headphones */
- azalia_generic_mixer_set(this, 0x22, MI_TARGET_CONNLIST, &mc);
- mc.un.ord = 0; /* unmute */
- azalia_generic_mixer_set(this, 0x07, MI_TARGET_INAMP(0), &mc);
- azalia_generic_mixer_set(this, 0x07, MI_TARGET_INAMP(1), &mc);
- azalia_generic_mixer_set(this, 0x0a, MI_TARGET_INAMP(0), &mc);
- azalia_generic_mixer_set(this, 0x0a, MI_TARGET_INAMP(1), &mc);
- azalia_generic_mixer_set(this, 0x0b, MI_TARGET_INAMP(0), &mc);
- azalia_generic_mixer_set(this, 0x0b, MI_TARGET_INAMP(1), &mc);
- azalia_generic_mixer_set(this, 0x1e, MI_TARGET_INAMP(0), &mc);
- azalia_generic_mixer_set(this, 0x1e, MI_TARGET_INAMP(1), &mc);
- azalia_generic_mixer_set(this, 0x24, MI_TARGET_INAMP(0), &mc);
- azalia_generic_mixer_set(this, 0x24, MI_TARGET_INAMP(1), &mc);
- return 0;
-}
-
-int
-azalia_ad1984_set_port(codec_t *this, mixer_ctrl_t *mc)
-{
- const mixer_item_t *m;
- int err;
-
- if (mc->dev >= this->nmixers)
- return ENXIO;
- m = &this->mixers[mc->dev];
- if (mc->type != m->devinfo.type)
- return EINVAL;
- if (mc->type == AUDIO_MIXER_CLASS)
- return 0;
- if (m->target == AD1984_TARGET_MASTER) {
- err = azalia_generic_mixer_set(this, AD1984_DAC_HP,
- MI_TARGET_OUTAMP, mc);
- err = azalia_generic_mixer_set(this, AD1984_DAC_SPEAKER,
- MI_TARGET_OUTAMP, mc);
- return err;
- }
- if (m->target == AD1984_TARGET_MASTER_MUTE) {
- err = azalia_generic_mixer_set(this, 0x11, MI_TARGET_OUTAMP, mc);
- err = azalia_generic_mixer_set(this, 0x12, MI_TARGET_OUTAMP, mc);
- err = azalia_generic_mixer_set(this, 0x13, MI_TARGET_OUTAMP, mc);
- return err;
- }
- return azalia_generic_mixer_set(this, m->nid, m->target, mc);
-}
-
-int
-azalia_ad1984_get_port(codec_t *this, mixer_ctrl_t *mc)
-{
- const mixer_item_t *m;
-
- if (mc->dev >= this->nmixers)
- return ENXIO;
- m = &this->mixers[mc->dev];
- mc->type = m->devinfo.type;
- if (mc->type == AUDIO_MIXER_CLASS)
- return 0;
- if (m->target == AD1984_TARGET_MASTER ||
- m->target == AD1984_TARGET_MASTER_MUTE)
- return azalia_generic_mixer_get(this, m->nid,
- MI_TARGET_OUTAMP, mc);
- return azalia_generic_mixer_get(this, m->nid, m->target, mc);
-}
-
-/* ----------------------------------------------------------------
- * CMedia CMI9880
- * ---------------------------------------------------------------- */
-
-static const mixer_item_t cmi9880_mixer_items[] = {
- {{AZ_CLASS_INPUT, {AudioCinputs}, AUDIO_MIXER_CLASS, AZ_CLASS_INPUT, 0, 0}, 0},
- {{AZ_CLASS_OUTPUT, {AudioCoutputs}, AUDIO_MIXER_CLASS, AZ_CLASS_OUTPUT, 0, 0}, 0},
- {{AZ_CLASS_RECORD, {AudioCrecord}, AUDIO_MIXER_CLASS, AZ_CLASS_RECORD, 0, 0}, 0},
-
- {{0, {AudioNmaster"."AudioNmute}, AUDIO_MIXER_ENUM, AZ_CLASS_OUTPUT,
- 0, 0, ENUM_OFFON}, 0x03, MI_TARGET_OUTAMP},
- {{0, {AudioNsurround"."AudioNmute}, AUDIO_MIXER_ENUM, AZ_CLASS_OUTPUT,
- 0, 0, ENUM_OFFON}, 0x04, MI_TARGET_OUTAMP},
- {{0, {AzaliaNclfe"."AudioNmute}, AUDIO_MIXER_ENUM, AZ_CLASS_OUTPUT,
- 0, 0, ENUM_OFFON}, 0x05, MI_TARGET_OUTAMP},
- {{0, {AzaliaNside"."AudioNmute}, AUDIO_MIXER_ENUM, AZ_CLASS_OUTPUT,
- 0, 0, ENUM_OFFON}, 0x06, MI_TARGET_OUTAMP},
- {{0, {"digital."AudioNmute}, AUDIO_MIXER_ENUM, AZ_CLASS_OUTPUT,
- 0, 0, ENUM_OFFON}, 0x07, MI_TARGET_OUTAMP},
-
- {{0, {AzaliaNfront"."AudioNmute}, AUDIO_MIXER_ENUM, AZ_CLASS_RECORD,
- 0, 0, ENUM_OFFON}, 0x08, MI_TARGET_INAMP(0)},
- {{0, {AzaliaNfront}, AUDIO_MIXER_VALUE, AZ_CLASS_RECORD,
- 0, 0, .un.v={{""}, 2, MIXER_DELTA(30)}}, 0x08, MI_TARGET_INAMP(0)},
- {{0, {AzaliaNfront"."AudioNsource}, AUDIO_MIXER_ENUM, AZ_CLASS_RECORD,
- 0, 0, .un.e={4, {{{AudioNmicrophone}, 5}, {{AudioNcd}, 6},
- {{"line1"}, 7}, {{"line2"}, 8}}}},
- 0x08, MI_TARGET_CONNLIST},
- {{0, {AudioNsurround"."AudioNmute}, AUDIO_MIXER_ENUM, AZ_CLASS_RECORD,
- 0, 0, ENUM_OFFON}, 0x09, MI_TARGET_INAMP(0)},
- {{0, {AudioNsurround}, AUDIO_MIXER_VALUE, AZ_CLASS_RECORD,
- 0, 0, .un.v={{""}, 2, MIXER_DELTA(30)}}, 0x09, MI_TARGET_INAMP(0)},
- {{0, {AudioNsurround"."AudioNsource}, AUDIO_MIXER_ENUM, AZ_CLASS_RECORD,
- 0, 0, .un.e={4, {{{AudioNmicrophone}, 5}, {{AudioNcd}, 6},
- {{"line1"}, 7}, {{"line2"}, 8}}}},
- 0x09, MI_TARGET_CONNLIST},
-
- {{0, {AudioNspeaker"."AudioNmute}, AUDIO_MIXER_ENUM, AZ_CLASS_INPUT,
- 0, 0, ENUM_OFFON}, 0x23, MI_TARGET_OUTAMP},
- {{0, {AudioNspeaker}, AUDIO_MIXER_VALUE, AZ_CLASS_INPUT,
- 0, 0, .un.v={{""}, 1, MIXER_DELTA(15)}}, 0x23, MI_TARGET_OUTAMP}
-};
-
-int
-azalia_cmi9880_mixer_init(codec_t *this)
-{
- mixer_ctrl_t mc;
-
- this->nmixers = sizeof(cmi9880_mixer_items) / sizeof(mixer_item_t);
- this->mixers = malloc(sizeof(mixer_item_t) * this->nmixers,
- M_DEVBUF, M_NOWAIT | M_ZERO);
- if (this->mixers == NULL) {
- printf("%s: out of memory in %s\n", XNAME(this), __func__);
- return ENOMEM;
- }
- memcpy(this->mixers, cmi9880_mixer_items,
- sizeof(mixer_item_t) * this->nmixers);
- azalia_generic_mixer_fix_indexes(this);
- azalia_generic_mixer_default(this);
-
- azalia_generic_mixer_pin_sense(this);
-
- mc.dev = -1;
- mc.type = AUDIO_MIXER_ENUM;
- mc.un.ord = 5; /* record.front.source=mic */
- azalia_generic_mixer_set(this, 0x08, MI_TARGET_CONNLIST, &mc);
- mc.un.ord = 7; /* record.surround.source=line1 */
- azalia_generic_mixer_set(this, 0x09, MI_TARGET_CONNLIST, &mc);
- mc.un.ord = 0; /* front DAC -> headphones */
- azalia_generic_mixer_set(this, 0x0f, MI_TARGET_CONNLIST, &mc);
- return 0;
-}
-
-int
-azalia_cmi9880_init_dacgroup(codec_t *this)
-{
- static const convgroupset_t dacs = {
- -1, 2,
- {{4, {0x03, 0x04, 0x05, 0x06}}, /* analog 8ch */
- {1, {0x07}}}}; /* digital */
- static const convgroupset_t adcs = {
- -1, 2,
- {{2, {0x08, 0x09}}, /* analog 4ch */
- {1, {0x0a}}}}; /* digital */
-
- this->dacs = dacs;
- this->adcs = adcs;
- return 0;
-}
-
-/* ----------------------------------------------------------------
- * Sigmatel STAC9200
- * ---------------------------------------------------------------- */
-
-static const mixer_item_t stac9200_mixer_items[] = {
- {{AZ_CLASS_INPUT, {AudioCinputs}, AUDIO_MIXER_CLASS, AZ_CLASS_INPUT, 0, 0}, 0},
- {{AZ_CLASS_OUTPUT, {AudioCoutputs}, AUDIO_MIXER_CLASS, AZ_CLASS_OUTPUT, 0, 0}, 0},
- {{AZ_CLASS_RECORD, {AudioCrecord}, AUDIO_MIXER_CLASS, AZ_CLASS_RECORD, 0, 0}, 0},
-
- {{0, {AudioNmaster}, AUDIO_MIXER_VALUE, AZ_CLASS_OUTPUT,
- 4, 0, .un.v={{""}, 2, MIXER_DELTA(31)}}, 0x0b, MI_TARGET_OUTAMP},
- {{0, {AudioNmute}, AUDIO_MIXER_ENUM, AZ_CLASS_OUTPUT,
- 0, 3, ENUM_OFFON}, 0x0b, MI_TARGET_OUTAMP},
- {{0, {AudioNvolume}, AUDIO_MIXER_VALUE, AZ_CLASS_RECORD,
- 0, 0, .un.v={{""}, 2, MIXER_DELTA(15)}}, 0x0a, MI_TARGET_OUTAMP},
- {{0, {AudioNvolume"."AudioNmute}, AUDIO_MIXER_ENUM, AZ_CLASS_RECORD,
- 0, 0, ENUM_OFFON}, 0x0a, MI_TARGET_OUTAMP},
- {{0, {AudioNsource}, AUDIO_MIXER_ENUM, AZ_CLASS_RECORD,
- 0, 0, .un.e={5, {{{AudioNline}, 0}, {{AudioNmicrophone}, 1},
- {{AudioNline"2"}, 2}, {{AudioNline"3"}, 3},
- {{AudioNcd}, 4}}}},
- 0x0c, MI_TARGET_CONNLIST},
- {{0, {AudioNmicrophone}, AUDIO_MIXER_VALUE, AZ_CLASS_INPUT,
- 0, 0, .un.v={{""}, 2, MIXER_DELTA(4)}}, 0x0c, MI_TARGET_OUTAMP},
- {{0, {AudioNmicrophone"."AudioNmute}, AUDIO_MIXER_ENUM, AZ_CLASS_INPUT,
- 0, 0, ENUM_OFFON}, 0x0c, MI_TARGET_OUTAMP},
- {{0, {AudioNsource}, AUDIO_MIXER_ENUM, AZ_CLASS_OUTPUT,
- 0, 0, .un.e={3, {{{AudioNdac}, 0}, {{"digital-in"}, 1}, {{"selector"}, 2}}}},
- 0x07, MI_TARGET_CONNLIST},
- {{0, {"digital."AudioNsource}, AUDIO_MIXER_ENUM, AZ_CLASS_OUTPUT,
- 0, 0, .un.e={2, {{{AudioNdac}, 0}, {{"selector"}, 1}}}},
- 0x09, MI_TARGET_CONNLIST}, /* AudioNdac is not accurate name */
- {{0, {AudioNheadphone".boost"}, AUDIO_MIXER_ENUM, AZ_CLASS_OUTPUT,
- 0, 0, ENUM_OFFON}, 0x0d, MI_TARGET_PINBOOST},
- {{0, {AudioNspeaker".boost"}, AUDIO_MIXER_ENUM, AZ_CLASS_OUTPUT,
- 0, 0, ENUM_OFFON}, 0x0e, MI_TARGET_PINBOOST},
- {{0, {AudioNmono"."AudioNmute}, AUDIO_MIXER_ENUM, AZ_CLASS_OUTPUT,
- 0, 0, ENUM_OFFON}, 0x11, MI_TARGET_OUTAMP},
- {{0, {AudioNmono}, AUDIO_MIXER_VALUE, AZ_CLASS_OUTPUT,
- 0, 0, .un.v={{""}, 1, MIXER_DELTA(31)}}, 0x11, MI_TARGET_OUTAMP},
- {{0, {"beep."AudioNmute}, AUDIO_MIXER_ENUM, AZ_CLASS_OUTPUT,
- 0, 0, ENUM_OFFON}, 0x14, MI_TARGET_OUTAMP},
- {{0, {"beep"}, AUDIO_MIXER_VALUE, AZ_CLASS_OUTPUT,
- 0, 0, .un.v={{""}, 1, MIXER_DELTA(3)}}, 0x14, MI_TARGET_OUTAMP},
- {{0, {"usingdac"}, AUDIO_MIXER_ENUM, AZ_CLASS_INPUT,
- 0, 0, .un.e={2, {{{"analog"}, 0}, {{"digital"}, 1}}}},
- 0, MI_TARGET_DAC},
- {{0, {"usingadc"}, AUDIO_MIXER_ENUM, AZ_CLASS_RECORD,
- 0, 0, .un.e={2, {{{"analog"}, 0}, {{"digital"}, 1}}}},
- 0, MI_TARGET_ADC},
-};
-
-int
-azalia_stac9200_mixer_init(codec_t *this)
-{
- mixer_ctrl_t mc;
-
- this->nmixers = sizeof(stac9200_mixer_items) / sizeof(mixer_item_t);
- this->mixers = malloc(sizeof(mixer_item_t) * this->nmixers,
- M_DEVBUF, M_NOWAIT | M_ZERO);
- if (this->mixers == NULL) {
- printf("%s: out of memory in %s\n", XNAME(this), __func__);
- return ENOMEM;
- }
- memcpy(this->mixers, stac9200_mixer_items,
- sizeof(mixer_item_t) * this->nmixers);
- azalia_generic_mixer_fix_indexes(this);
- azalia_generic_mixer_default(this);
-
- azalia_generic_mixer_pin_sense(this);
-
- mc.dev = -1; /* no need for generic_mixer_set() */
- mc.type = AUDIO_MIXER_VALUE;
- mc.un.value.num_channels = 2;
- mc.un.value.level[0] = AUDIO_MAX_GAIN;
- mc.un.value.level[1] = mc.un.value.level[0];
- azalia_generic_mixer_set(this, 0x0c, MI_TARGET_OUTAMP, &mc);
- return 0;
-}
-
-int
-azalia_stac9221_init_dacgroup(codec_t *this)
-{
- /* master volume at NID 16 */
- static const convgroupset_t dacs = {
- -1, 1,
- {{4, {0x02, 0x03, 0x04, 0x05}}}};
-
- /* vols: 06:12, 07:13 */
- static const convgroupset_t adcs = {
- -1, 2,
- {{2, {0x06, 0x07}},
- {1, {0x09}}}};
-
- this->dacs = dacs;
- this->adcs = adcs;
- return 0;
-}
-
-static const mixer_item_t stac9221_mixer_items[] = {
- {{AZ_CLASS_INPUT, {AudioCinputs}, AUDIO_MIXER_CLASS, AZ_CLASS_INPUT, 0, 0}, 0},
- {{AZ_CLASS_OUTPUT, {AudioCoutputs}, AUDIO_MIXER_CLASS, AZ_CLASS_OUTPUT, 0, 0}, 0},
- {{AZ_CLASS_RECORD, {AudioCrecord}, AUDIO_MIXER_CLASS, AZ_CLASS_RECORD, 0, 0}, 0},
-#define STAC9221_TARGET_MASTER -1
- {{0, {AudioNmaster}, AUDIO_MIXER_VALUE, AZ_CLASS_OUTPUT,
- 4, 0, .un.v={{""}, 2, MIXER_DELTA(127)}}, 0x02, STAC9221_TARGET_MASTER},
- {{0, {AudioNmute}, AUDIO_MIXER_ENUM, AZ_CLASS_OUTPUT,
- 0, 3, ENUM_OFFON}, 0x02, STAC9221_TARGET_MASTER},
-
- {{0, {AudioNheadphone}, AUDIO_MIXER_VALUE, AZ_CLASS_OUTPUT,
- 0, 0, .un.v={{""}, 2, MIXER_DELTA(15)}}, 0x02, MI_TARGET_OUTAMP},
- {{0, {AudioNheadphone".mute"}, AUDIO_MIXER_ENUM, AZ_CLASS_OUTPUT,
- 0, 0, ENUM_OFFON}, 0x02, MI_TARGET_OUTAMP},
-
- {{0, {AudioNspeaker}, AUDIO_MIXER_VALUE, AZ_CLASS_OUTPUT,
- 0, 0, .un.v={{""}, 2, MIXER_DELTA(15)}}, 0x03, MI_TARGET_OUTAMP},
- {{0, {AudioNspeaker".mute"}, AUDIO_MIXER_ENUM, AZ_CLASS_OUTPUT,
- 0, 0, ENUM_OFFON}, 0x03, MI_TARGET_OUTAMP},
-
- {{0, {"line"}, AUDIO_MIXER_VALUE, AZ_CLASS_OUTPUT,
- 0, 0, .un.v={{""}, 2, MIXER_DELTA(15)}}, 0x04, MI_TARGET_OUTAMP},
- {{0, {"line.mute"}, AUDIO_MIXER_ENUM, AZ_CLASS_OUTPUT,
- 0, 0, ENUM_OFFON}, 0x04, MI_TARGET_OUTAMP},
-
- {{0, {"line2"}, AUDIO_MIXER_VALUE, AZ_CLASS_OUTPUT,
- 0, 0, .un.v={{""}, 2, MIXER_DELTA(15)}}, 0x05, MI_TARGET_OUTAMP},
- {{0, {"line2.mute"}, AUDIO_MIXER_ENUM, AZ_CLASS_OUTPUT,
- 0, 0, ENUM_OFFON}, 0x05, MI_TARGET_OUTAMP},
-};
-
-int
-azalia_stac9221_mixer_init(codec_t *this)
-{
- this->nmixers = sizeof(stac9221_mixer_items) / sizeof(mixer_item_t);
- this->mixers = malloc(sizeof(mixer_item_t) * this->nmixers,
- M_DEVBUF, M_NOWAIT | M_ZERO);
- if (this->mixers == NULL) {
- printf("%s: out of memory in %s\n", XNAME(this), __func__);
- return ENOMEM;
- }
- memcpy(this->mixers, stac9221_mixer_items,
- sizeof(mixer_item_t) * this->nmixers);
- azalia_generic_mixer_fix_indexes(this);
- azalia_generic_mixer_default(this);
-
- azalia_generic_mixer_pin_sense(this);
-
- return 0;
-}
-
-int
-azalia_stac9221_set_port(codec_t *this, mixer_ctrl_t *mc)
-{
- const mixer_item_t *m;
- int err;
-
- if (mc->dev >= this->nmixers)
- return ENXIO;
- m = &this->mixers[mc->dev];
- if (mc->type != m->devinfo.type)
- return EINVAL;
- if (mc->type == AUDIO_MIXER_CLASS)
- return 0;
- if (m->target == STAC9221_TARGET_MASTER) {
- err = azalia_generic_mixer_set(this, 0x02,
- MI_TARGET_OUTAMP, mc);
- err = azalia_generic_mixer_set(this, 0x03,
- MI_TARGET_OUTAMP, mc);
- err = azalia_generic_mixer_set(this, 0x04,
- MI_TARGET_OUTAMP, mc);
- err = azalia_generic_mixer_set(this, 0x05,
- MI_TARGET_OUTAMP, mc);
- return err;
- }
- return azalia_generic_mixer_set(this, m->nid, m->target, mc);
-}
-
-int
-azalia_stac9221_get_port(codec_t *this, mixer_ctrl_t *mc)
-{
- const mixer_item_t *m;
-
- if (mc->dev >= this->nmixers)
- return ENXIO;
- m = &this->mixers[mc->dev];
- mc->type = m->devinfo.type;
- if (mc->type == AUDIO_MIXER_CLASS)
- return 0;
- if (m->target == STAC9221_TARGET_MASTER)
- return azalia_generic_mixer_get(this, m->nid,
- MI_TARGET_OUTAMP, mc);
- return azalia_generic_mixer_get(this, m->nid, m->target, mc);
-}
-
-/* ----------------------------------------------------------------
- * Sony VAIO FE and SZ
- * ---------------------------------------------------------------- */
-
-int
-azalia_stac7661_init_dacgroup(codec_t *this)
-{
- static const convgroupset_t dacs = {
- -1, 1,
- {{2, {0x02, 0x05}}}};
-
- static const convgroupset_t adcs = {
- -1, 1,
- {{1, {0x08}}}};
-
- this->dacs = dacs;
- this->adcs = adcs;
-
- return 0;
-}
-
-static const mixer_item_t stac7661_mixer_items[] = {
- {{AZ_CLASS_INPUT, {AudioCinputs}, AUDIO_MIXER_CLASS, AZ_CLASS_INPUT, 0, 0}, 0},
- {{AZ_CLASS_OUTPUT, {AudioCoutputs}, AUDIO_MIXER_CLASS, AZ_CLASS_OUTPUT, 0, 0}, 0},
- {{AZ_CLASS_RECORD, {AudioCrecord}, AUDIO_MIXER_CLASS, AZ_CLASS_RECORD, 0, 0}, 0},
-
-#define STAC7661_DAC_HP 0x02
-#define STAC7661_DAC_SPEAKER 0x05
-#define STAC7661_TARGET_MASTER -1
-
- {{0, {AudioNmaster}, AUDIO_MIXER_VALUE, AZ_CLASS_OUTPUT,
- 4, 0, .un.v={{""}, 2, MIXER_DELTA(127)}}, 0x02, STAC7661_TARGET_MASTER},
- {{0, {AudioNmute}, AUDIO_MIXER_ENUM, AZ_CLASS_OUTPUT,
- 0, 3, ENUM_OFFON}, 0x02, STAC7661_TARGET_MASTER},
- {{0, {AudioNvolume"."AudioNmute}, AUDIO_MIXER_ENUM, AZ_CLASS_RECORD, 0, 0,
- ENUM_OFFON}, 0x09, MI_TARGET_INAMP(0)},
- {{0, {AudioNvolume}, AUDIO_MIXER_VALUE, AZ_CLASS_RECORD, 0, 0,
- .un.v={{""}, 2, MIXER_DELTA(15)}}, 0x09, MI_TARGET_INAMP(0)},
- {{0, {AudioNsource}, AUDIO_MIXER_ENUM, AZ_CLASS_RECORD,
- 0, 0, .un.e={3, {{{AudioNmicrophone}, 1}, {{AudioNmicrophone"2"}, 2},
- {{AudioNdac}, 3}}}},
- 0x15, MI_TARGET_CONNLIST},
- {{0, {AudioNmicrophone}, AUDIO_MIXER_VALUE, AZ_CLASS_INPUT,
- .un.v={{""}, 2, MIXER_DELTA(4)}}, 0x15, MI_TARGET_OUTAMP},
- {{0, {AudioNheadphone".mute"}, AUDIO_MIXER_ENUM, AZ_CLASS_OUTPUT,
- 0, 0, ENUM_OFFON}, 0x02, MI_TARGET_OUTAMP},
- {{0, {AudioNheadphone}, AUDIO_MIXER_VALUE, AZ_CLASS_OUTPUT,
- 0, 0, .un.v={{""}, 2, MIXER_DELTA(127)}}, 0x02, MI_TARGET_OUTAMP},
- {{0, {AudioNspeaker".mute"}, AUDIO_MIXER_ENUM, AZ_CLASS_OUTPUT,
- 0, 0, ENUM_OFFON}, 0x05, MI_TARGET_OUTAMP},
- {{0, {AudioNspeaker}, AUDIO_MIXER_VALUE, AZ_CLASS_OUTPUT,
- 0, 0, .un.v={{""}, 2, MIXER_DELTA(127)}}, 0x05, MI_TARGET_OUTAMP}
-};
-
-int
-azalia_stac7661_mixer_init(codec_t *this)
-{
- mixer_ctrl_t mc;
-
- this->nmixers = sizeof(stac7661_mixer_items) / sizeof(mixer_item_t);
- this->mixers = malloc(sizeof(mixer_item_t) * this->nmixers,
- M_DEVBUF, M_NOWAIT | M_ZERO);
- if (this->mixers == NULL) {
- printf("%s: out of memory in %s\n", XNAME(this), __func__);
- return ENOMEM;
- }
- memcpy(this->mixers, stac7661_mixer_items,
- sizeof(mixer_item_t) * this->nmixers);
- azalia_generic_mixer_fix_indexes(this);
- azalia_generic_mixer_default(this);
-
- azalia_generic_mixer_pin_sense(this);
-
- mc.dev = -1;
- mc.type = AUDIO_MIXER_ENUM;
- mc.un.ord = 1;
- azalia_generic_mixer_set(this, 0x09, MI_TARGET_INAMP(0), &mc); /* mute input */
- mc.un.ord = 2; /* select internal mic for recording */
- azalia_generic_mixer_set(this, 0x15, MI_TARGET_CONNLIST, &mc);
- return 0;
-}
-
-int
-azalia_stac7661_set_port(codec_t *this, mixer_ctrl_t *mc)
-{
- const mixer_item_t *m;
- int err;
-
- if (mc->dev >= this->nmixers)
- return ENXIO;
- m = &this->mixers[mc->dev];
- if (mc->type != m->devinfo.type)
- return EINVAL;
- if (mc->type == AUDIO_MIXER_CLASS)
- return 0;
- if (m->target == STAC7661_TARGET_MASTER) {
- err = azalia_generic_mixer_set(this, STAC7661_DAC_HP,
- MI_TARGET_OUTAMP, mc);
- err = azalia_generic_mixer_set(this, STAC7661_DAC_SPEAKER,
- MI_TARGET_OUTAMP, mc);
- return err;
- }
- return azalia_generic_mixer_set(this, m->nid, m->target, mc);
-}
-int
-azalia_stac7661_get_port(codec_t *this, mixer_ctrl_t *mc)
-{
- const mixer_item_t *m;
-
- if (mc->dev >= this->nmixers)
- return ENXIO;
- m = &this->mixers[mc->dev];
- mc->type = m->devinfo.type;
- if (mc->type == AUDIO_MIXER_CLASS)
- return 0;
- if (m->target == STAC7661_TARGET_MASTER)
- return azalia_generic_mixer_get(this, m->nid,
- MI_TARGET_OUTAMP, mc);
- return azalia_generic_mixer_get(this, m->nid, m->target, mc);
-}