summaryrefslogtreecommitdiffstats
path: root/sound/pci/hda/hda_codec.h
AgeCommit message (Collapse)AuthorFilesLines
2014-08-19ALSA: hda - Remove obsoleted EXPORT_SYMBOL_HDA() macroTakashi Iwai1-2/+0
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2014-07-22ALSA: hda - Refactor quirk picking and change quirk priorityDavid Henningsson1-1/+0
Previously, calling one quirk function first and another later would make the latter one take priority, this is now changed to make the former take priority. By adding two special values for fixup_id we can also get rid of the fixup_forced flag. Signed-off-by: David Henningsson <david.henningsson@canonical.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2014-06-25ALSA: hda - Kill the rest of snd_print*() usagesTakashi Iwai1-1/+2
Pass the codec object so that we can replace all the rest of snd_print*() usages with the proper device-specific print helpers. Signed-off-by: Takashi Iwai <tiwai@suse.de>
2014-05-26ALSA: hda - Add fixup_forced flagDavid Henningsson1-0/+1
The "fixup_forced" flag will indicate whether a specific fixup (or nofixup) has been set by the user, to override the driver's default. This flag will help future patches. Signed-off-by: David Henningsson <david.henningsson@canonical.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2014-02-25ALSA: hda - Enable sysfs attributes without CONFIG_SND_HDA_RECONFIGTakashi Iwai1-1/+1
Some sysfs attributes like init_pin_configs or vendor_name are really basic and should be available no matter whether the codec driver is re-configurable or not. Put them out of #ifdef CONFIG_SND_HDA_RECONFIG and allow the read-only accesses. Signed-off-by: Takashi Iwai <tiwai@suse.de>
2014-02-25ALSA: hda - Add sysfs to codec object, tooTakashi Iwai1-2/+5
We have currently sysfs attributes for each hwdep, but basically these should belong to the codec itself, per se. Let's add them to the codec object while keeping them for hwdep as is for compatibility. While we are at it, split the sysfs-related stuff into a separate source file, hda_sysfs.c, and keep only the stuff necessary for hwdep in hda_hwdep.c. Signed-off-by: Takashi Iwai <tiwai@suse.de>
2014-02-25ALSA: hda - Create own device struct for each codecTakashi Iwai1-0/+1
As the HD-audio is treated individually in each codec driver, it's more convenient to assign an own struct device to each codec object. Then we'll be able to use dev_err() more easily for each codec, for example. For achieving it, this patch just creates an object "hdaudioCxDy". It belongs to sound class instead of creating a new bus, just for simplicity, at this stage. No pm ops is implemented in the device struct level but currently it's merely a container. The PCM and hwdep devices are now children of this codec device. Signed-off-by: Takashi Iwai <tiwai@suse.de>
2014-01-29ALSA: hda - Add parameter for dumping processing coefficientsDavid Henningsson1-0/+1
Processing coefficients are often a vital part of the codec's configuration, so dumping them can be important. However, because they are undocumented and secret, we do not want to enable this for all codecs by default. Therefore instead add this as a debugging parameter. I have prepared for codecs that want to enable this by default by the extra dump_coef bitfield, but unsure if we want to do that as long as the (unlikely, but still) race remains. Signed-off-by: David Henningsson <david.henningsson@canonical.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2013-12-19ALSA: hda - Make CONFIG_SND_HDA_CODEC_* tristateTakashi Iwai1-13/+0
So far, CONFIG_SND_HDA_CODEC_* kconfigs have been booleans due to historical reasons. The major reason was that the automatic codec driver probing wouldn't work if user sets a codec driver as a module while the controller driver as a built-in. And, another reason was to avoid exporting symbols of the helper codes when all drivers are built in. But, this sort of "kindness" rather confuses people in the end, especially makes the config refinement via localmodconfig unhappy. Also, a codec module would still work if you re-bind the controller driver via sysfs (although it's no automatic loading), so there might be a slight use case. That said, better to let people fallen into a pitfall than being too smart and restrict something. Let's make things straightforward: now all CONFIG_SND_HDA_CODEC_* become tristate, and all symbols exported unconditionally. Signed-off-by: Takashi Iwai <tiwai@suse.de>
2013-12-09ALSA: hda - Split verb definitions into sound/hda_verbs.hTakashi Iwai1-546/+1
Since there are more HD-audio compatible codecs, move the definitions of HD-audio verbs into common header location, include/sound, so that it can be included cleanly from other drivers than HD-audio driver. Signed-off-by: Takashi Iwai <tiwai@suse.de>
2013-12-06ALSA: hda - Clean up async codec PM using standard async infrastructureTakashi Iwai1-6/+0
This simplifies lots of codes indeed. Tested-by: Mengdong Lin <mengdong.lin@intel.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2013-11-29ALSA: hda - allow a codec to define its own depop delay timeMengdong Lin1-0/+2
This patch adds 'depop_delay' to struct hda_codec, to indicate a depop delay time in ms when power-down, in function set_power_state() to D3. Default value is -1, for a default delay time. Machine fixup can set a suitable value according to the codec chip and HW audio design. Signed-off-by: Mengdong Lin <mengdong.lin@intel.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2013-11-27ALSA: hda - resume codecs in parallelMengdong Lin1-1/+3
To reduce driver resume time, this patch resumes the codecs in parallel if there are multiple codecs on the bus. - The PM workqueue of bus is also used to parallel resuming multiple codecs. - The work item 'pm_work' is renamed to 'suspend_work' to parallel suspending codecs. - Add a work item 'resume_work' to parallel resuming codecs. Signed-off-by: Mengdong Lin <mengdong.lin@intel.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2013-11-27ALSA: hda - suspend codecs in parallelMengdong Lin1-0/+5
The time to suspend a single codec may be several hundreds of ms. When runtime power saving is disabled, driver suspend time can be long especially when there are more than one codec on the bus. To reduce driver suspend time, this patch creates a work queue for the bus, and suspends the codecs in parallel if there are multiple codecs on the bus. [fixed cosmetic issues by tiwai] Signed-off-by: Mengdong Lin <mengdong.lin@intel.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2013-11-26ALSA: hda - Refactor pm notification in hda_codec.cTakashi Iwai1-1/+1
No functional change. - codec->pm_down_notified flag is renamed to codec->pm_up_notified flag (and takes the reversed meaning), which is managed solely in hda_call_pm_notify() now. - The explicit call of hda_call_pm_notify() is moved into hda_keep_power_on(). - Removed a redundant call of hda_call_pm_notify() in snd_hda_power_up(), as it's called in hda_call_codec_resume() anyway. Signed-off-by: Takashi Iwai <tiwai@suse.de>
2013-11-26ALSA: hda - Split the generic parser as an individual moduleTakashi Iwai1-0/+1
Drop the hard dependency on the generic parser code and load / unload the generic parser code dynamically if built as a module. This allows us to avoid the generic parser if only HDMI/DP codecs are found. Signed-off-by: Takashi Iwai <tiwai@suse.de>
2013-11-26ALSA: hda - Drop bus->avoid_link_reset flagTakashi Iwai1-1/+0
Use bus->power_keep_link_on instead. The controller shouldn't go to D3 when the link isn't reset, so essentially avoiding the link reset means avoiding the runtime PM. Signed-off-by: Takashi Iwai <tiwai@suse.de>
2013-10-24ALSA: hda - Fix mute LED on HP laptops in runtime suspendTakashi Iwai1-0/+1
When HP laptops with mute and mic-record LEDs go to runtime suspend, these LEDs are turned on forcibly no matter whether GPIO pis are on or off. This strange behavior seems triggered by resetting the HD-audio bus link at azx_rutime_suspend(). So, just add a new hda_bus flag to avoid the link reset at runtime suspend and set it for these HP machines. Signed-off-by: Takashi Iwai <tiwai@suse.de>
2013-08-27ALSA: hda - add device entry and inactive flag to unsolicited responseMengdong Lin1-0/+5
This patch adds two fields to unsolicited response, according to spec HDA040-A: - Device Entry (bit 20:15) - Inactive (bit 2) and show the info in debug message. Signed-off-by: Mengdong Lin <mengdong.lin@intel.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2013-08-27ALSA: hda - add flags and routines to get devices selection info for DP1.2 MSTMengdong Lin1-0/+16
This patch adds flags and routines to get device list & selection info on a pin. To support Display Port 1.2 multi-stream transport (MST) over single DP port, a pin can support multiple devices. Please refer to HD-A spec Document Change Notificaton HDA040-A. A display audio codec can set flag "dp_mst" in its patch, indicating its pins can support MST. But at runtime, a pin may not be multi-streaming capable and report the device list is empty, depending on Gfx driver configuration. Signed-off-by: Mengdong Lin <mengdong.lin@intel.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2013-06-06ALSA: hda - Don't take unresponsive D3 transition too seriousTakashi Iwai1-0/+3
When a codec is powered off, some systems don't respond properly after D3 FG transition, while the driver still expects the response and tries to fall back to different modes (polling and single-cmd). When the fallback happens, the driver stays in that mode, and falling back to the single-cmd mode means it'll loose the unsol event handling, too. The unresponsiveness at D3 isn't too serious, thus this fallback is mostly superfluous. We can gracefully ignore the error there so that the driver keeps the normal operation mode. This patch adds a new bit flag for codec read/write, set in the power transition stage, which is notified to the controller driver via a new bus->no_response_fallback flag. Signed-off-by: Takashi Iwai <tiwai@suse.de>
2013-06-06ALSA: hda - Introduce bit flags to snd_hda_codec_read/write()Takashi Iwai1-4/+4
snd_hda_codec_read(), snd_hda_codec_write() & co take the argument "direct" that indicates whether the given NID is a direct reference or an indirect reference. However, the indirect reference is practically unimplemented and never exists. And moreover, we don't need the indication of indirect reference at this high level, as NID can be represented in 16bit values at this point. Meanwhile, there are some cases where it'd be nice to give some operational options to these functions. So, we can reuse this argument as a new bit flag! Pretty frugal, eh? All callers so far pass zero to this argument, thus there is no behavior change by this replacement. The real usage of this new bit option will be added in the following patches. Signed-off-by: Takashi Iwai <tiwai@suse.de>
2013-04-05ALSA: hda - Introduce get_delay codec PCM opsTakashi Iwai1-0/+3
Add a new codec PCM ops, get_delay(), to obtain the codec/stream- specific PCM delay count. When it's NULL, nothing changes. This new feature was requested for CA0132, which has significant delays in the path depending on the running DSP code. Signed-off-by: Takashi Iwai <tiwai@suse.de>
2013-02-12ALSA: hda - Fix broken workaround for HDMI/SPDIF conflictsTakashi Iwai1-1/+2
The commit [dcda58061: ALSA: hda - Add workaround for conflicting IEC958 controls] introduced a workaround for cards that have both SPDIF and HDMI devices for giving device=1 to SPDIF control elements. It turned out, however, that this workaround doesn't work well - - The workaround checks only conflicts in a single codec, but SPDIF and HDMI are provided by multiple codecs in many cases, and - ALSA mixer abstraction doesn't care about the device number in ctl elements, thus you'll get errors from amixer such as % amixer scontrols -c 0 ALSA lib simple_none.c:1551:(simple_add1) helem (MIXER,'IEC958 Playback Switch',0,1,0) appears twice or more amixer: Mixer hw:0 load error: Invalid argument This patch fixes the previous broken workaround. Instead of changing the device number of SPDIF ctl elements, shift the element indices of such controls up to 16. Also, the conflict check is performed over all codecs found on the bus. HDMI devices will be put to dev=0,index=0 as before. Only the conflicting SPDIF device is moved to a different place. The new place of SPDIF device is supposed by the updated alsa-lib HDA-Intel.conf, respectively. Reported-by: Stephan Raue <stephan@openelec.tv> Reported-by: Anssi Hannula <anssi.hannula@iki.fi> Cc: <stable@vger.kernel.org> [v3.8] Signed-off-by: Takashi Iwai <tiwai@suse.de>
2013-02-08ALSA: hda - Support rereading widgets under the function groupMengdong Lin1-0/+1
A codec may allow software to hide some unused pin/cvt widgets. Sometimes BIOS does not enable the hidden widgets properly although they are needed for the board. Thus the driver need to enable them as a board-specific fixup and the whole tree will change. This patch implements a common code for rereading codec widgets. So the fixup code can call it after enabling the hidden widgets. Signed-off-by: Mengdong Lin <mengdong.lin@intel.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2013-02-07ALSA: hda - Remove limit of widget connectionsTakashi Iwai1-3/+1
Currently we set the max number of connections to be 32, but there seems codec that gives longer connection lists like AD1988, and we see errors in proc output and else. (Though, in the case of AD1988, it's a list of all codecs connected to a single vendor widget, so this must be something fishy, but it's still valid from the h/w design POV.) This patch tries to remove this restriction. For efficiency, we still use the fixed size array in the parser, but takes a dynamic array when the size is reported to be greater than that. Now the fixed array size is found only in patch_hdmi.c, but it should be fine, as the codec itself can't support so many pins. Reported-by: Raymond Yau <superquad.vortex2@gmail.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2013-02-07Merge branch 'topic/hda-ca0132-dsp' into for-nextTakashi Iwai1-0/+45
2013-01-24ALSA: hda - Add power state filteringTakashi Iwai1-2/+5
Add a hook to struct hda_codec for filtering the target power state of each widget when powering up/down. The current hackish EAPD check is implemented as the default hook pointer, too. This allows codec drivers to implement own power filter. In the upcoming changes, the generic parser will have the better power filter based on the active paths. Signed-off-by: Takashi Iwai <tiwai@suse.de>
2013-01-22ALSA: hda - Combine snd_hda_codec_flush_*_cache() to a single functionTakashi Iwai1-4/+2
Since both snd_hda_codec_flush_amp_cache() and snd_hda_codec_flush_cmd_cache() are called usually at the same time, we can simply combine them to a single function, snd_hda_codec_flush_cache(). Signed-off-by: Takashi Iwai <tiwai@suse.de>
2013-01-12ALSA: hda - Protect user-defined arrays via mutexTakashi Iwai1-0/+1
The pincfgs, init_verbs and hints set by sysfs or patch might be changed dynamically on the fly, thus we need to protect it. Add a simple protection via a mutex. Signed-off-by: Takashi Iwai <tiwai@suse.de>
2013-01-12ALSA: hda - Add helper functions to cache the current pinctl targetTakashi Iwai1-2/+2
We already have the list of whole pin widgets and there is an unused space in the list; let's use it for caching the current pinctl value. Signed-off-by: Takashi Iwai <tiwai@suse.de>
2013-01-12ALSA: hda - Revive snd_hda_get_conn_list()Takashi Iwai1-1/+3
Manage the connection list cache using linked lists instead of snd_array, and revive snd_hda_get_conn_list() again, so that we don't have to keep the expanded values locally. This will reduce the stack usage by recursive call of snd_hda_get_conn_index() or parse_nid_path() of the generic parser. The list management doesn't include any mutex protection, thus the caller needs to take care of race appropriately. Signed-off-by: Takashi Iwai <tiwai@suse.de>
2013-01-12ALSA: hda - Add codec->inv_jack_detect flagTakashi Iwai1-0/+1
Yet another broken hardware workaround: there are hardware indicating the inverted jack detection bit result. Signed-off-by: Takashi Iwai <tiwai@suse.de>
2013-01-12ALSA: hda - Add inv_eapd flag to struct hda_codecTakashi Iwai1-0/+1
Add the new flag, codec->inv_eapd, indicating that the EAPD implementation is inverted. There are always broken hardware in the world. Signed-off-by: Takashi Iwai <tiwai@suse.de>
2013-01-12ALSA: hda - Add snd_hda_codec_flush_*_cache() aliasesTakashi Iwai1-0/+4
It makes easier to understand although these are identical with snd_hda_codec_resume_*() functions. Signed-off-by: Takashi Iwai <tiwai@suse.de>
2013-01-12ALSA: hda - Move fixup code into struct hda_codecTakashi Iwai1-0/+8
Since the fixup code is used commonly, it's worth to move it to the common place, struct hda_codec, instead of keeping in hda_gen_spec. Signed-off-by: Takashi Iwai <tiwai@suse.de>
2013-01-12ALSA: hda - Introduce cache & flush cmd / amp writesTakashi Iwai1-8/+4
For optimizing the verb executions, a new mechanism to cache the verbs and amp update commands is introduced. With the new "write to cache and flush" way, you can reduce the same verbs that have been written multiple times. When codec->cached_write flag is set, the further snd_hda_codec_write_cache() and snd_hda_codec_amp_stereo() calls will be performed only on the command or amp cache table, but not sent to the hardware yet. Once after you call all commands and update amps, call snd_hda_codec_resume_amp() and snd_hda_codec_resume_cache(). Then all cached writes and amp updates will be written to the hardware, and the dirty flags are cleared. In this implementation, the existing cache table is reused, so actually no big code change is seen here. Each cache entry has a new dirty flag now (so the cache key is now reduced to 31bit). As a good side-effect by this change, snd_hda_codec_resume_*() will no longer execute verbs that have been already issued during the resume phase by checking the dirty flags. Signed-off-by: Takashi Iwai <tiwai@suse.de>
2012-11-28ALSA: hda - Change return value for load_dsp_prepare() to -ENOSYSIan Minett1-1/+1
Signed-off-by: Ian Minett <ian_minett@creativelabs.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2012-11-28ALSA: hda - Add new DSP loader callback routinesTakashi Iwai1-0/+45
Pass DMA buffer pointers in calls to setup_bdle(). Add DSP loader callback routines to controller. Add new DSP loader switch to Kconfig to turn off DSP firmware. Signed-off-by: Ian Minett <ian_minett@creativelabs.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2012-11-19Merge branch 'for-linus' into for-nextTakashi Iwai1-0/+1
Merge the recent HD-audio codec change for fixing recursive suspend calls. Conflicts: sound/pci/hda/hda_codec.c
2012-11-19ALSA: hda - Fix recursive suspend/resume callTakashi Iwai1-0/+1
When the bus reset is performed during the suspend/resume (including the power-saving too), it calls snd_hda_suspend() and snd_hda_resume() again, and deadlocks eventually. For avoiding the recursive call, add a new flag indicating that the PM is being performed, and don't go to the bus reset mode when it's on. Reported-and-tested-by: Julian Wollrath <jwollrath@web.de> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2012-11-08ALSA: hda - Apply a proper chmap for built-in 2.1 speakersTakashi Iwai1-0/+3
When 2.1 speakers are detected, use the corresponding channel map instead of the standard map with front+rear surrounds. Signed-off-by: Takashi Iwai <tiwai@suse.de>
2012-10-17ALSA: hda - Add workaround for conflicting IEC958 controlsTakashi Iwai1-0/+1
When both an SPDIF and an HDMI device are created on the same card instance, multiple IEC958 controls are created with indices=0, 1, ... But the alsa-lib configuration can't know which index corresponds actually to which PCM device, and both the SPDIF and the HDMI configurations point to the first IEC958 control wrongly. This patch introduces a (hackish and ugly) workaround: the IEC958 controls for the SPDIF device are re-labeled with device=1 when HDMI coexists. The device=1 corresponds to the actual PCM device for SPDIF, so it's anyway a better representation. In future, HDMI controls should be moved with the corresponding PCM device number, too. Signed-off-by: Takashi Iwai <tiwai@suse.de>
2012-10-15ALSA: hda - Implement a poll loop for jacks as a module parameterDavid Henningsson1-0/+2
Now that we have a generic unsol mechanism, we can implement a generic poll loop, which can be used for debugging, or if a codec's unsol mechanism is broken. Signed-off-by: David Henningsson <david.henningsson@canonical.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2012-09-15Merge branch 'topic/tlv-chmap' into for-nextTakashi Iwai1-0/+1
This is a merge of a topic branch containing the support for the new channel map API using control elements.
2012-09-07ALSA: hda - Remove ignore_misc_bitDavid Henningsson1-1/+0
The purpose of this flag is unclear. If the problem is that some machines have broken misc/NO_PRESENCE bits, they should be fixed by pin fixups. In addition, this causes jack detection functionality to be flawed on the M31EI, where there are two jacks without jack detection (which is properly marked as NO_PRESENCE), but due to ignore_misc_bit, these jacks are instead being reported as being present but always unplugged. BugLink: https://bugs.launchpad.net/bugs/939161 Signed-off-by: David Henningsson <david.henningsson@canonical.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2012-09-06ALSA: hda - Add standard channel mapsTakashi Iwai1-0/+1
Although HD-audio allows pair-wise channel configurations, only the fixed channel positions are used in this version. In future, this can be changed and allow user to modify the channel positions. Signed-off-by: Takashi Iwai <tiwai@suse.de>
2012-08-31ALSA: hda - Yet another fix for D3 stop-clock refcountingTakashi Iwai1-1/+1
The call of pm_notify callback in snd_hda_codec_free() should be with the check of the current state whether pm_notify(false) is called or not, instead of codec->power_on check. For improving the code readability and fixing this inconsistency, codec->d3_stop_clk_ok is renamed to codec->pm_down_notified, and this flag is set only when runtime PM down is called. The new name reflects to a more direct purpose of the flag. Signed-off-by: Takashi Iwai <tiwai@suse.de>
2012-08-30ALSA: hda - Optimize bitfield usage in struct hda_codecTakashi Iwai1-3/+2
Move up a few bitfields to be packed into a single int. Signed-off-by: Takashi Iwai <tiwai@suse.de>
2012-08-30ALSA: hda - Clean up CONFIG_SND_HDA_POWER_SAVETakashi Iwai1-6/+4
CONFIG_SND_HDA_POWER_SAVE is no longer an experimental feature and its behavior can be well controlled via the default value and module parameter. Let's just replace it with the standard CONFIG_PM. Signed-off-by: Takashi Iwai <tiwai@suse.de>