summaryrefslogtreecommitdiff
path: root/sys/dev/pci/azalia_codec.c
AgeCommit message (Collapse)Author
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
2007-07-23STAC7661: rename "inputs.mic" to "record.volume". This is what theDeanna Phillips
audio layer wants, and is a more accurate description. Use the correct number of steps.
2007-07-23STAC7661:Deanna Phillips
- Add set_port and get_port functions and use them to create a stereo master volume out of the headphone and speaker dacs. Unbreaks setting the volume in ports like xmms. - Use the correct number of steps for the dac volumes.
2007-07-23We will never make a mixer item out of the pin control operation, soDeanna Phillips
move it out of azalia_generic_mixer_set into its own function, azalia_generic_mixer_pinctrl. From kent@netbsd. In azalia_stac9200_mixer_init, let the unsolicited event handler make the initial headphone vs speaker choice. Removes some duplicate code. These changes only affect STAC9200. Tested by krw@ on a Latitude D620.
2007-07-07Add support for Realtek ALC883. This is the "value" edition of theDeanna Phillips
ALC882, and differs only by lacking an ADC and a mixer, so have it use ALC882's get_port(), set_port() and a slightly modified version of its mixer init. This also works around a problem where the generic mixer init creates truncated mixer item names which can't be manipulated (noticed by steven@). Tested by steven@, ckuethe@ and jmc@.
2007-06-19Add a dac group init, mixer table and mixer init for the SigmatelDeanna Phillips
codec ID 83847661 found in some Sony VAIO FE and SZ laptops. No regressions noticed by jasper@, steven@ or Will Backman. I've been using it for months.
2007-06-13Support the Macbook, Macbook Pro, Mac Mini and possibly the iMac.Deanna Phillips
Tested by many.
2007-05-02- Add support for handling unsolicited events (based on NetBSD).Deanna Phillips
- The STAC9200 codec was mistakenly referred to as STAC9220. Change this to STAC9200 and add a link to the datasheet. - Add a new target, MI_TARGET_PINCTRL, to azalia_generic_mixer_set() that allows us to turn pins on and off. - Add an unsolicited event handler for STAC9200 that will toggle the headphone and speaker pins. This means the speaker will now mute and unmute based on headphone presence. - Spelling: PRESENSE -> PRESENCE Tested by ajacoutot@, tedu@ and krw@, ok krw@.
2006-07-23Make the default value of outputs.linein.dir "output" for the ThinkPad T60.Brad Smith
From kent@NetBSD