summaryrefslogtreecommitdiff
path: root/sys/dev/pci/azalia_codec.c
AgeCommit message (Collapse)Author
2008-11-28don't create a _source control on mixers if none of the sources areJacob Meuser
usable. better (generalized) solution forthcoming, but this is a reasonable check anyway. problem noted and fix tested by Alexey Suslikov, thanks.
2008-11-28AZ_TARGET_PINSENSE -> MI_TARGET_PINSENSEJacob Meuser
reminder from Alexey Suslikov, thanks
2008-11-28- remove a couple unneeded checksJacob Meuser
- another place to use azalia_nid_to_index
2008-11-28- use switch() instead of multiple if elseJacob Meuser
- put selectors that feed ADCs into the record class like we do for mixers - use azalia_nid_to_index more - shrink mixer items list by condensing mutes for multiple input sources into a single _source control of type AUDIO_MIXER_SET. for example, record.mix6_mic_mute=off record.mix6_mic2_mute=off record.mix6_line_mute=off record.mix6_hp_mute=off record.mix6_spkr_mute=off record.mix6_mix_mute=off is now represented as record.mix6_source=mic,mic2,line,hp,spkr,mix to mute all sources but the mic just do record.mix6_source=mic reduces mixer items by about 25% on my machine. also shortens the longest names.
2008-11-28- DACs don't have connection lists like ADCs doJacob Meuser
- we're only interested in ADCs in the ADC converter group
2008-11-28add paranoia helper function, azalia_nid_to_index. the nid isJacob Meuser
assumed in places to be the index of the widget in the widget_t array of the codec_t, but I'm paranoid. use it to shrink/simplify/fortify some parts. will be used more soon.
2008-11-27widget initialization cleanup:Jacob Meuser
* configure widgets all in one place * add a flag on the widget_t to let us know if the widget is not connected; shaves a lot of connection checking code * be sure not to add power widgets as connectable sources/sinks * configure unconnected pins as output pins. should help some MacBooks and be benign to other devices. the last change has been tested by several as a separate diff. no real functional changes otherwise. from Alexey Suslikov. thanks!
2008-11-27finally, generic converter grouping that fits our needs and worksJacob Meuser
on all (at least all tested) devices. briefly, it works like so: group together all converters that can be reached from or can reach a connected input or output pin. ordering in the converter groups correlates to the association and sequence of the input/output pin. remove lots of static converter groupings in favor of the generic grouping method. the only static groups left are for codecs that still have static mixer configurations. tested by many. thanks to all who tested; this wouldn't have happened without your support.
2008-11-19Many ALC88x codecs have a fifth DAC at NID 0x25 for 7.1+2 multistreaming.Christian Weisgerber
Add this and other missing entries to the pre-defined DAC groups. Tested with ALC885; other models according to their data sheets. ok jakemsr@
2008-11-19the jack sense automatic muting code has many problems, includingJacob Meuser
being the cause of PR5982. unfortunately, there's no easy and clean solution to automatic muting. we can't always rely on the codec giving us the right information. people have different preferences as to what should be muted and what shouldn't. etc, etc. so instead, just make the sense state of jacks that support sensing available through the mixer interface. this allows for any possible user configuration and supports all pins that have sense capabilities, not just headpones. codecs that use the generic mixer configuration (which is the plan for all codecs) and have sensing capable pins will now get a few more read-only mixer items, such as: outputs.hp_sense=plugged outputs.mic_sense=unplugged outputs.line_sense=unplugged hopefully what they mean is self-explanatory. based on much discussion with ratchov@ and Alexey Suslikov
2008-11-17- recognize some Conexant codecs.Jacob Meuser
- recognize several STAC (Sigmatel/IDT) codecs and create converter groups for the multi-channel capable codecs. - use the correct name for Sigmatel 7661/7662.
2008-11-17use the generic mixer configuration for all Realtek ALC codecs.Jacob Meuser
adds outputs.master to ALC885 and ALC888 (and probably others that don't yet have it). also makes ALC88{2,3} much more useful. tested by jmc@ and simon@ (and myself), thanks.
2008-11-16don't create a virtual inputs.dac, as this will be a duplicate ofJacob Meuser
the real and already existing inputs.dac in most cases.
2008-11-16expand the usefulness of azalia_generic_mixer_create_virtual byJacob Meuser
passing in "preferred" DACs and ADCs. this will be used to give more devices "outputs.master" and "record.volume".
2008-11-16make lists of what widgets are directly connected to DACc and ADCs.Jacob Meuser
use the lists to figure out what class some widgets belong to. ok ratchov
2008-11-16'.' is a special character in mixer item names. it's the separatorJacob Meuser
between class, device and qualifier. replace use of '.' with '_' where it's not really a separator. idea from/ok ratchov@ warning: if you have a mixerctl.conf(5), it will need to be updated.
2008-11-14oops. not yet. sorry for the noise.Jacob Meuser
2008-11-14* readability improvement in azalia_codec_connect_streamJacob Meuser
* DEBUG cleanup from Alexey Suslikov, thanks
2008-11-05* remove two custom unsolicited event handlers in favor of genericJacob Meuser
jack sense handling. makes azalia_generic_mixer_pinctrl useless, so zap it. * azalia_generic_mixer_pin_sense works well enough to not need guessing of pin direction in azalia_generic_mixer_default. from Alexey Suslikov, thanks
2008-11-04volume scaling/setting cleanup:Jacob Meuser
* MAX_VOLUME_255 has been defined for ages. remove this define and the code that was only being used when this wasn't defined. * remove azalia_generic_mixer_{max,validate_value} since they are pointless. * when setting both stereo channels to the same level, just set the right channel level to the left channel level instead of calculating both separately. from Alexey Suslikov
2008-10-28Add the MacBookPro4,1 to the list of systems with GPIO quirks andBrad Smith
needs adjustment. Allows the integrated speakers to work. from Alexey Suslikov
2008-10-27for the AD1984 codec, connect headphones to a proper DAC.Jacob Meuser
tested by danh@ and Aaron Stellman on Thinkpad T61. from Alexey Suslikov, thanks
2008-10-25Add proper DAC/ADC grouping for AD1984 (from NetBSD).Jacob Meuser
This fixes fallout for AD1984 revealed by recent azalia.c changes and reported on misc@. While here: * move gpio_unmute to more logical place, * remove code ifdef'ed and unused for ages. from Alexey Suslikov, thanks Index: sys/dev/pci/azalia_codec.c =================================================================== RCS file: /cvs/src/sys/dev/pci/azalia_codec.c,v retrieving revision 1.52 diff -u -r1.52 azalia_codec.c --- sys/dev/pci/azalia_codec.c 23 Oct 2008 02:23:04 -0000 1.52 +++ sys/dev/pci/azalia_codec.c 24 Oct 2008 17:29:36 -0000 @@ -98,6 +98,7 @@ (const codec_t *, nid_t, int, u_char); int azalia_generic_set_port(codec_t *, mixer_ctrl_t *); int azalia_generic_get_port(codec_t *, mixer_ctrl_t *); +int azalia_gpio_unmute(codec_t *, int); int azalia_alc260_init_dacgroup(codec_t *); int azalia_alc260_mixer_init(codec_t *); @@ -127,7 +128,6 @@ int azalia_stac9221_set_port(codec_t *, mixer_ctrl_t *); int azalia_stac9221_get_port(codec_t *, mixer_ctrl_t *); int azalia_stac9221_apple_unsol_event(codec_t *, int); -int azalia_gpio_unmute(codec_t *, int); int azalia_stac7661_init_dacgroup(codec_t *); int azalia_stac7661_mixer_init(codec_t *); int azalia_stac7661_set_port(codec_t *, mixer_ctrl_t *); @@ -1708,6 +1708,26 @@ return azalia_generic_mixer_get(this, m->nid, m->target, mc); } +int +azalia_gpio_unmute(codec_t *this, int pin) +{ + uint32_t data, mask, dir; + + this->comresp(this, this->audiofunc, CORB_GET_GPIO_DATA, 0, &data); + this->comresp(this, this->audiofunc, CORB_GET_GPIO_ENABLE_MASK, 0, &mask); + this->comresp(this, this->audiofunc, CORB_GET_GPIO_DIRECTION, 0, &dir); + + data |= 1 << pin; + mask |= 1 << pin; + dir |= 1 << pin; + + this->comresp(this, this->audiofunc, CORB_SET_GPIO_ENABLE_MASK, mask, NULL); + this->comresp(this, this->audiofunc, CORB_SET_GPIO_DIRECTION, dir, NULL); + DELAY(1000); + this->comresp(this, this->audiofunc, CORB_SET_GPIO_DATA, data, NULL); + + return 0; +} /* ---------------------------------------------------------------- * Realtek ALC260 @@ -2181,18 +2201,11 @@ int azalia_alc882_init_dacgroup(codec_t *this) { -#if 0 - static const convgroupset_t dacs = { - -1, 3, - {{4, {0x02, 0x03, 0x04, 0x05}}, /* analog 8ch */ - {1, {0x06}}, /* digital */ - {1, {0x25}}}}; /* another analog */ -#else static const convgroupset_t dacs = { -1, 2, {{4, {0x02, 0x03, 0x04, 0x05}}, /* analog 8ch */ {1, {0x06}}}}; /* digital */ -#endif + /* don't support for 0x25 dac */ static const convgroupset_t adcs = { -1, 2, {{3, {0x07, 0x08, 0x09}}, /* analog 6ch */ @@ -2484,13 +2497,14 @@ azalia_ad1984_init_dacgroup(codec_t *this) { static const convgroupset_t dacs = { - -1, 1, - {{2, {0x03, 0x04}}}}; - + -1, 2, + {{2, {0x04, 0x03}}, /* analog 4ch */ + {1, {0x02}}}}; /* digital */ static const convgroupset_t adcs = { - -1, 1, - {{1, {0x08}}}}; - + -1, 3, + {{2, {0x08, 0x09}}, /* analog 4ch */ + {1, {0x06}}, /* digital */ + {1, {0x05}}}}; /* digital */ this->dacs = dacs; this->adcs = adcs; return 0; @@ -3006,27 +3020,6 @@ DPRINTF(("%s: unknown tag: %d\n", __func__, tag)); } return 0; -} - -int -azalia_gpio_unmute(codec_t *this, int pin) -{ - uint32_t data, mask, dir; - - this->comresp(this, this->audiofunc, CORB_GET_GPIO_DATA, 0, &data); - this->comresp(this, this->audiofunc, CORB_GET_GPIO_ENABLE_MASK, 0, &mask); - this->comresp(this, this->audiofunc, CORB_GET_GPIO_DIRECTION, 0, &dir); - - data |= 1 << pin; - mask |= 1 << pin; - dir |= 1 << pin; - - this->comresp(this, this->audiofunc, CORB_SET_GPIO_ENABLE_MASK, mask, NULL); - this->comresp(this, this->audiofunc, CORB_SET_GPIO_DIRECTION, dir, NULL); - DELAY(1000); - this->comresp(this, this->audiofunc, CORB_SET_GPIO_DATA, data, NULL); - - return 0; } /* ----------------------------------------------------------------
2008-10-23- new function azalia_generic_mixer_pin_sense - configures pin direction,Jacob Meuser
enables EAPD when needed - new function azalia_generic_mixer_create_virtual - creates some well known mixer controls, such as outputs.master - use the two new functions when setting up a codec with the generic codec support - remove explicit pindir manipulations (azalia_generic_mixer_pin_sense does this automatically now) - add some GPIO quirks (from FreeBSD's snd_hda) - move all GPIO quirks into one place - add DAC/ADC groupings and support for several more codecs using the generic codec support - correct Sigmatel STAC9872AK name - initialize unsol_event to NULL by default DAC/ADC grouping and create_virtual/pin_sense code from NetBSD. GPIO quirks from FreeBSD. from Alexey Suslikov, thanks
2008-10-16Add S/PDIF support. From NetBSD.Jacob Meuser
Clean up a little while here. from Alexey Suslikov, thanks tested by several as part of a larger diff, thanks also
2008-10-16Some pins are not connected and dead-end. This diff removes such pinsJacob Meuser
from conection and mixer lists. It also removes knobs connected to power widgets. from NetBSD via Alexey Suslikov, thanks tested by several, thanks also
2008-06-26First pass at removing clauses 3 and 4 from NetBSD licenses.Ray Lai
Not sure what's more surprising: how long it took for NetBSD to catch up to the rest of the BSDs (including UCB), or the amount of code that NetBSD has claimed for itself without attributing to the actual authors. OK deraadt@
2008-05-13Remove commented out NetBSD __KERNEL_RCSID macro usage.Brad Smith
ok dlg@
2008-04-10Add support for recording through the mic jack on AD1984.Deanna Phillips
Tested by Alexander Hall, thanks ok jakemsr
2007-12-16Put inamp gain and inamp mute controls under AudioCinputs. ThisDeanna Phillips
avoids some duplicate items when a pin widget has both input and output amplifiers.
2007-12-06Remove AD1981HD code, since the generic mixer init can do all of thisDeanna Phillips
now. Also, note that codec->init_widget functions must be used with care since they can create duplicate mixer item names.
2007-11-24The Sigmatel codec id 7662 looks identical to STAC7661 and works fine withDeanna Phillips
the code here. Tested by Rob Lytle, thanks.
2007-11-21Collect subid #defines at the top.Deanna Phillips
2007-11-14less obnoxious dmesgDeanna Phillips
ok ratchov
2007-11-06Generalize most of the apple-specific code, since it works fine onDeanna Phillips
other machines with STAC9221. Tested by Vladas Urbonas on XPS M1210. no objections jakemsr@
2007-10-14audio(4)-compatible mixer items for ALC883.Deanna Phillips
Tested jmc, jakemsr
2007-10-10Rework the debug dmesg to perform a more complete codec dump.Deanna Phillips
Tested by jmc, ckuethe, kettenis and jakemsr.
2007-10-05The Acer TravelMate 3010 (ALC883) has a couple of gpio pins that needDeanna Phillips
to be enabled in order for it to produce sound. It can use the same gpio function as the macs, so rename that to azalia_gpio_unmute. Tested by damien@, no regressions noticed by jakemsr@
2007-09-26Clean up STAC7661 codec: sort mixer items, add prev and next pointersDeanna Phillips
for master, remove useless pin direction calls, add mixer item for mic boost, remove useless item for the volume knob.
2007-09-20Add mixer items, master volume and dacgroup init for Analog DevicesDeanna Phillips
AD1984. Recording isn't supported yet. Lots of testing by reyk@, Pau Amaro-Seoane and Alexey Vatchenko; thanks!
2007-09-11For STAC9221 Macs - no need to max the DAC volumes now that a masterDeanna Phillips
is available.
2007-09-11For STAC9221 Macs, create master volume and mute controls by bindingDeanna Phillips
the DAC volumes. Tested by otto@, ajacoutot@, merdeley@ and Darrin Chandler.
2007-09-10Use M_ZERO.Deanna Phillips
ok dlg@
2007-09-10Add command verbs, a mixer target and mixer controls for EAPD control.Deanna Phillips
Some codecs, like the AD1984 found in x60s, need this in order for the speakers to work. New mixer items with names *.eapd will show up for codecs that need it and that are using the generic functions. From kent@netbsd
2007-09-10Set bidirectional pins to output, ignoring what the codec says isDeanna Phillips
their purpose, since that's often incorrect. This should solve some no-sound problems for codecs using the generic functions. From kent@netbsd
2007-09-06Add an unsolicited even handler for the Sigmatel Apple codecs. TheDeanna Phillips
speakers and line outputs will now mute and unmute depending on headphone presence. Tested on Macbook, Macbook Pro and Mini by otto@, ajacoutot@, merdely@ and Darrin Chandler, thanks.
2007-07-31Our audio layer doesn't know anything about mixer names likeDeanna Phillips
"selector" and "front", so instead create the items that it actually needs. This unbreaks the mute button in wscons, and allows setting the volume in programs like xmms and xine. This is for STAC9200 only - similiar fixes for other codecs coming soon. Tested and ok krw@
2007-07-31In the mixer to device level conversions, round down to the nearestDeanna Phillips
valid step, and keep them in sync. This lets audio(4) set exact gain levels based on the mixer delta, and unbreaks volume up/down buttons in wscons. This also avoids a divide by zero that could occur if the generic mixer init found an amplifier with zero steps. Problem noticed and tested by jmc@, similar diff tested by krw@
2007-07-23STAC7661:Deanna Phillips
- enable internal mic and select it as the default recording source, - create mixerctl record.source for selecting between internal and external mics, - mute input by default.
2007-07-23Fix a typo in a comment: VAIO SE -> VAIO SZ.Deanna Phillips