summaryrefslogtreecommitdiff
path: root/sound/pci/hda/hda_codec.c
AgeCommit message (Collapse)Author
2012-08-02alsa: hda: add alsa ctl to query max channelsNikesh Oswal
add alsa ctl to query maximum supported channels Bug: 998697 Signed-off-by: Nikesh Oswal <noswal@nvidia.com> Change-Id: Id2f0e6a62d2413615f13a0c18757c05610ef0c2c Reviewed-on: http://git-master/r/118602 Reviewed-by: Automatic_Commit_Validation_User Reviewed-by: Scott Peterson <speterson@nvidia.com>
2012-03-23ALSA:hda: add alsa control for query of deviceSayak Ghosh Choudhury
alsa control is added to facilitate querying dts decode capability of connected device. dts decode capability of the connected device is updated in the ELD buffer. That information is updated in the ALSA control structure. In addition to that, the code is amended to handle other pass through decoder mode support. Bug 943017 Change-Id: If8da7dfb24be3b86592191f5586b70492282b438 Signed-off-by: Sayak Ghosh Choudhury <sayakc@nvidia.com> Reviewed-on: http://git-master/r/91813 Reviewed-by: Automatic_Commit_Validation_User Reviewed-by: Scott Peterson <speterson@nvidia.com>
2012-03-09arm: tegra: hda: Improve resume timeScottPeterson
Improve the resume time of the HD Audio driver by replacing selected msleep() functions with mdelay(). msleep() return times are not deterministic. Signed-off-by: ScottPeterson <speterson@nvidia.com> Reviewed-on: http://git-master/r/86896 (cherry picked from commit eccbe7983d1b010cc60b49bfb13d041b3a0957d3) Change-Id: I261ba51e7f8414bca50076ae73473114a308645c Reviewed-on: http://git-master/r/88090 Reviewed-by: Scott Peterson <speterson@nvidia.com> Tested-by: Scott Peterson <speterson@nvidia.com>
2012-02-13ALSA:hda: add alsa control for query of deviceSayak Ghosh Choudhury
alsa control is added to facilitate querying ac3 decode capability of connected device. ac3 decode capability of the connected device is updated in the ELD buffer. That information is updated in the ALSA control structure. Bug 909141 Bug 904553 Bug 920831 Change-Id: I81af196fc5dd85c5c87691393cf2f079611f9b47 Signed-off-by: Sayak Ghosh Choudhury <sayakc@nvidia.com> Reviewed-on: http://git-master/r/83067 Reviewed-by: Automatic_Commit_Validation_User Reviewed-by: Scott Peterson <speterson@nvidia.com> Reviewed-by: Sumit Bhattacharya <sumitb@nvidia.com>
2012-01-19ALSA: HDA: change hd-audio as freezable workqueueHaley Teng
bug 921335 Change-Id: Ie5810536f1693a93c365a8cd9a51e4e9906d8c1a Signed-off-by: Haley Teng <hteng@nvidia.com> Reviewed-on: http://git-master/r/74904 Reviewed-by: Automatic_Commit_Validation_User Reviewed-by: Sachin Nikam <snikam@nvidia.com> Reviewed-by: Varun Wadekar <vwadekar@nvidia.com> Reviewed-by: Nitin Kumbhar <nkumbhar@nvidia.com> Reviewed-by: Bharat Nihalani <bnihalani@nvidia.com> Reviewed-on: http://git-master/r/75546 Tested-by: Varun Wadekar <vwadekar@nvidia.com>
2011-11-21ALSA: hda - Don't add elements of other codecs to vmaster slaveTakashi Iwai
commit aeb4b88ec0a948efce8e3a23a8f964d3560a7308 upstream. When a virtual mater control is created, the driver looks for slave elements from the assigned card instance. But this may include the elements of other codecs when multiple codecs are on the same HD-audio bus. This works at the first time, but it'll give Oops when it's once freed and re-created via reconfig sysfs. This patch changes the element-look-up strategy to limit only to the mixer elements of the same codec. Reported-by: David Henningsson <david.henningsson@canonical.com> Signed-off-by: Takashi Iwai <tiwai@suse.de> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-09-13ALSA: hda - Terminate the recursive connection search properlyTakashi Iwai
The recursive search of widget connections in snd_hda_get_conn_index() must be terminated at the pin and the audio-out widgets. Otherwise you'll get "too deep connection" warnings unnecessarily. Reported-by: Francis Moreau <francis.moro@gmail.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2011-07-26ALSA: hda - Allow codec-specific set_power_state opsTakashi Iwai
The procedure for codec D-state change may have exceptional cases depending on the codec chip, such as a longer delay or suppressing D3. This patch adds a new codec ops, set_power_state() to override the system default function. For ease of porting, snd_hda_codec_set_power_to_all() helper function is extracted from the default set_power_state() function. As an example, the Conexant codec-specific delay is removed from the default routine but moved to patch_conexant.c. Signed-off-by: Takashi Iwai <tiwai@suse.de>
2011-07-26ALSA: hda - Add post_suspend patch opsTakashi Iwai
Add a new ops, post_suspend(), which is called after suspend() ops is performed. This is called only in the case of the real PM suspend, and the codec driver can use this for further changing of D-state or clearing the LED, etc. Signed-off-by: Takashi Iwai <tiwai@suse.de>
2011-07-26ALSA: hda - Make CONFIG_SND_HDA_POWER_SAVE depending on CONFIG_PMTakashi Iwai
It makes little sense to enable power-saving without PM. This removes SND_HDA_NEEDS_RESUME define so that we can use CONFIG_PM in all places. Signed-off-by: Takashi Iwai <tiwai@suse.de>
2011-07-26ALSA: hda - Fix invalid mute led state on resume of IDT codecsVitaliy Kulikov
Codec state is not restored immediately on resume but on the first access when power-save is enabled. That leads to an invalid mute led state after resume until either sound is played or some control is changed. This patch adds a possibility for a vendor specific patch to restore codec state immediately after resume if required. And it adds code to restore IDT codecs state immediately on resume on HP systems with mute led support. Signed-off-by: Vitaliy Kulikov <Vitaliy.Kulikov@idt.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2011-07-22Merge branch 'topic/hda' into for-linusTakashi Iwai
2011-07-14ALSA: hda - Fix krealloc() replacement in hda_codec.cTakashi Iwai
It was obviously wrong, grr.... Signed-off-by: Takashi Iwai <tiwai@suse.de>
2011-07-12ALSA: Use krealloc() in possible placesTakashi Iwai
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2011-07-12ALSA: hda - Always read raw connections for proc outputTakashi Iwai
In the codec proc outputs, read the raw connections instead of the cached connection list, i.e. proc files contain only raw values. Signed-off-by: Takashi Iwai <tiwai@suse.de>
2011-07-12ALSA: hda - Add snd_hda_override_conn_list() helper functionTakashi Iwai
Add a function to add/modify the connection-list cache entry. It'll be useful to fix a buggy hardware result. Signed-off-by: Takashi Iwai <tiwai@suse.de>
2011-06-29ALSA: hda - Create snd_hda_get_conn_index() helper functionTakashi Iwai
Create snd_hda_get_conn_index() helper function for obtaining the connection index of the widget. Replaced the similar codes used in several codec-drivers with this common helper. Signed-off-by: Takashi Iwai <tiwai@suse.de>
2011-06-25ALSA: hda - Add snd_hda_get_conn_list() helper functionTakashi Iwai
Add a new helper function snd_hda_get_conn_list(). Unlike snd_hda_get_connections(), this function doesn't copy the connection-list but gives the raw pointer for the cached list. Signed-off-by: Takashi Iwai <tiwai@suse.de>
2011-06-24ALSA: hda - Add a workaround for invalid line-out setupsTakashi Iwai
Some BIOS set up the pin config wrongly as line-out although it's supposed to be a speaker out. In most cases, though, we can judge the validity by checking the connection type -- when it's FIXED, mostly it's an invalid line-out but a speaker. Signed-off-by: Takashi Iwai <tiwai@suse.de>
2011-06-13ALSA: hda: check make_exec_verb() return valueGreg Thelen
If given a -1 cmd parameter then make_exec_verb() returns -1 without setting the res output value. Prior to this change snd_hda_codec_read() assumed that make_exec_verb() unconditionally set res regardless of the cmd value. This change explicitly checks the make_exec_verb() return value before consuming the potentially unset res value. Signed-off-by: Greg Thelen <gthelen@google.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2011-06-06ALSA: hda: HDMI: Support codecs with fewer cvts than pinsStephen Warren
The general concept of this change is to create a PCM device for each pin widget instead of each converter widget. Whenever a PCM is opened, a converter is dynamically selected to drive that pin based on those available for muxing into the pin. The one thing this model doesn't support is a single PCM/converter sending audio to multiple pin widgets at once. Note that this means that a struct hda_pcm_stream's nid variable is set to 0 except between a stream's open and cleanup calls. The dynamic de-assignment of converters to PCMs occurs within cleanup, not close, in order for it to co-incide with when controller stream IDs are cleaned up from converters. While the PCM for a pin is not open, the pin is disabled (its widget control's PIN_OUT bit is cleared) so that if the currently routed converter is used to drive a different PCM/pin, that audio does not leak out over a disabled pin. We use the recently added SPDIF virtualization feature in order to create SPDIF controls for each pin widget instead of each converter widget, so that state is specific to a PCM. In order to support this, a number of more mechanical changes are made: * s/nid/pin_nid/ or s/nid/cvt_nid/ in many places in order to make it clear exactly what the code is dealing with. * We now have per_pin and per_cvt arrays in hdmi_spec to store relevant data. In particular, we store a converter's capabilities in the per_cvt entry, rather than relying on a combination of codec_pcm_pars and the struct hda_pcm_stream. * ELD-related workarounds were removed from hdmi_channel_allocation into hdmi_instrinsic in order to simplifiy infoframe calculations and remove HW dependencies. * Various functions only apply to a single pin, since there is now only 1 pin per PCM. For example, hdmi_setup_infoframe, hdmi_setup_stream. * hdmi_add_pin and hdmi_add_cvt are more oriented at pure codec parsing and data retrieval, rather than determining which pins/converters are to be used for creating PCMs. This is quite a large change; it may be appropriate to simply read the result of the patch rather than the diffs. Some small parts of the change might be separable into different patches, but I think the bulk of the change will probably always be one large patch. Hopefully the change isn't too opaque! This has been tested on: * NVIDIA GeForce 400 series discrete graphics card. This model has the classical 1:1:1 codec:converter:pcm widget model. Tested stereo PCM audio to a PC monitor that supports audio. * NVIDIA GeForce 520 discrete graphics card. This model is the new 1 codec n converters m pins m>n model. Tested stereo PCM audio to a PC monitor that supports audio. * NVIDIA GeForce 400 series laptop graphics chip. This model has the classical 1:1:1 codec:converter:pcm widget model. Tested stereo PCM, multi-channel PCM, and AC3 pass-through to an AV receiver. * Intel Ibex Peak laptop. This model is the new 1 codec n converters m pins m>n model. Tested stereo PCM, multi-channel PCM, and AC3 pass- through to an AV receiver. Note that I'm not familiar at all with AC3 pass-through. Hence, I may not have covered all possible mechanisms that are applicable here. I do know that my receiver definitely received AC3, not decoded PCM. I tested with mplayer's "-afm hwac3" and/or "-af lavcac3enc" options, and alsa a WAV file that I believe has AC3 content rather than PCM. I also tested: * Play a stream * Mute while playing * Stop stream * Play some other streams to re-assign the converter to a different pin, PCM, set of SPDIF controls, ... hence hopefully triggering cleanup for the original PCM. * Unmute original stream while not playing * Play a stream on the original pin/PCM. This was to test SPDIF control virtualization. Signed-off-by: Stephen Warren <swarren@nvidia.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2011-06-06ALSA: hda: Virtualize SPDIF out controlsStephen Warren
The SPDIF output controls apply to converter widgets. A future change will create a PCM device per pin widget, and hence a set of SPDIF output controls per pin widget, for certain HDMI codecs. To support this, we need the ability to virtualize the SPDIF output controls. Specifically: * Controls can be "unassigned" from real hardware when a converter is not used for the PCM the control was created for. * Control puts only write to hardware when they are assigned. * Controls can be "assigned" to real hardware when a converter is picked to support output for a particular PCM. * When a converter is assigned, the hardware is updated to the cached configuration. Signed-off-by: Stephen Warren <swarren@nvidia.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2011-06-06ALSA: hda: Allow multple SPDIF controls per codecStephen Warren
Currently, the data that backs the kcontrols created by snd_hda_create_spdif_out_ctls is stored directly in struct hda_codec. When multiple sets of these controls are stored, they will all manipulate the same data, causing confusion. Instead, store an array of this data, one copy per converter, to isolate the controls. This patch would cause a behavioural change in the case where snd_hda_create_spdif_out_ctls was called multiple times for a single codec. As best I can tell, this is never the case for any codec. This will be relevant at least for some HDMI audio codecs, such as the NVIDIA GeForce 520 and Intel Ibex Peak. A future change will modify the driver's handling of those codecs to create multiple PCMs per codec. Note that this issue isn't affected by whether one creates a PCM-per-converter or PCM-per-pin; there are multiple of both within a single codec in both of those codecs. Note that those codecs don't currently create multiple PCMs for the codec due to the default HW mux state of all pins being to point at the same converter, hence there is only a single converter routed to any pin, and hence only a single PCM. Signed-off-by: Stephen Warren <swarren@nvidia.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2011-05-26ALSA: hda - Use snd_printd() in snd_hda_parse_pin_def_config()Takashi Iwai
Fixed the wrong usage of snd_printdd() for debug prints of input entries. It should be snd_printd() like others. Signed-off-by: Takashi Iwai <tiwai@suse.de>
2011-05-19ALSA: HDA: Add jack detection for HDMIDavid Henningsson
Just as for headphones and microphone jacks, this patch adds reporting of HDMI jack status through the input layer. Signed-off-by: David Henningsson <david.henningsson@canonical.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2011-05-02ALSA: hda - Constify some API function argumentsTakashi Iwai
Also fixed the assignment of multiout.dac_nids to satisfy const. Signed-off-by: Takashi Iwai <tiwai@suse.de>
2011-05-02ALSA: hda - Constify some API function argumentsTakashi Iwai
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2011-05-02Merge branch 'fix/hda' into topic/hdaTakashi Iwai
2011-04-29ALSA: hda - Show the line-out type in snd_hda_parse_pin_def_config()Takashi Iwai
Helpful for debugging. Signed-off-by: Takashi Iwai <tiwai@suse.de>
2011-04-26Merge branch 'fix/hda' into topic/hdaTakashi Iwai
2011-04-21Merge branch 'fix/hda' into for-linusTakashi Iwai
2011-04-20ALSA: hda - Fix unused warnings when !SND_HDA_NEEDS_RESUMEMike Waychison
When SND_HDA_NEEDS_RESUME is not defined, the compiler identifies that the following symbols are static but not used: restore_shutup_pins hda_cleanup_all_streams Fix warnings by adding SND_HDA_NEEDS_RESUME guards. Signed-off-by: Mike Waychison <mikew@google.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2011-04-15ALSA: hda - sound/pci/hda/hda_codec.c: fix warningAndrew Morton
sound/pci/hda/hda_codec.c: In function 'snd_hda_get_connections': sound/pci/hda/hda_codec.c:332: warning: unused variable 'j' Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2011-04-07ALSA: hda - Remember connection listsTakashi Iwai
The connection lists are static and we can reuse the previous results instead of querying via verb at each time. This will reduce the I/O in the runtime especially for some codec auto-parsers. Signed-off-by: Takashi Iwai <tiwai@suse.de>
2011-03-31Fix common misspellingsLucas De Marchi
Fixes generated by 'codespell' and manually reviewed. Signed-off-by: Lucas De Marchi <lucas.demarchi@profusion.mobi>
2011-03-03ALSA: hda - Make common input-jack helper functionsTakashi Iwai
Since multiple codec drivers already use the input-jack stuff, let's make common helper functions to reduce the duplicated codes. Signed-off-by: Takashi Iwai <tiwai@suse.de>
2011-01-18ALSA: hda - consitify string arraysTakashi Iwai
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2011-01-10ALSA: hda - Fix multi-headphone handling for Realtek codecsTakashi Iwai
When multiple headphone pins are defined without line-out pins, the driver takes them as primary outputs. But it forgot to set line_out_type to HP by assuming there is some rest of HP pins. This results in some mis-handling of these pins for Realtek codec parser. It takes as if these are pure line-out jacks. Signed-off-by: Takashi Iwai <tiwai@suse.de> Cc: <stable@kernel.org>
2010-12-23ALSA: hda - Try to find an empty control index when it's occupiedTakashi Iwai
When a mixer control element was already created with the given name, try to find another index for avoiding conflicts, instead of breaking with an error. This makes the driver more robust. Signed-off-by: Takashi Iwai <tiwai@suse.de>
2010-10-25ALSA: hda - Disable sticky PCM stream assignment for AD codecsTakashi Iwai
The sticky PCM stream assignment introduced in 2.6.36 kernel seems causing problems on AD codecs. At some time later, the streaming no longer works by unknown reason. A simple workaround is to disable sticky-assignment for these codecs. Tested-by: Vasily Khoruzhick <anarsoul@gmail.com> Cc: <stable@kernel.org> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2010-10-22ALSA: hda - Add workarounds for CT-IBG controllersTakashi Iwai
Creative IBG controllers require the playback stream-tags to be started from 1, instead of capture+1. Otherwise the stream stalls. Reported-by: Wai Yew CHAY <wychay@ctl.creative.com> Cc: <stable@kernel.org> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2010-10-17ALSA: tlv - Define numbers in sound/tlv.hTakashi Iwai
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2010-10-17ALSA: HDA: Sigmatel: work around incorrect master mutingClemens Ladisch
The HDA specification does not allow for a codec to mute itself just because the volume is reduced, so _of course_ somebody had to go and do it. This wouldn'\''t hurt too much when the volume is adjusted by hand, but programs like PA that try to set the volume automatically could inadvertently mute the output. To work around this, change the TLV dB information for the Master volume on all Sigmatel HDA codecs to indicate the the minimal volume setting actually mutes. Reported-by: Colin Guthrie <gmane@colin.guthr.ie> Reported-by: "Alexander E. Patrakov" <patrakov@gmail.com> Tested-by: Colin Guthrie <cguthrie@mandriva.org> Signed-off-by: Clemens Ladisch <clemens@ladisch.de> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2010-09-21ALSA: hda - Introduce hda_call_check_power_status() helperTakashi Iwai
Replace the explicit ifdef check and call of check_power_status ops with a new helper function, hda_call_check_power_status(). Signed-off-by: Takashi Iwai <tiwai@suse.de>
2010-09-17ALSA: hda - Make snd_hda_get_input_pin_attr() helperTakashi Iwai
Make the helper function to give the input-pin attribute for jack connectivity and location. This simplifies checks of input-pin jacks a bit in some places. Signed-off-by: Takashi Iwai <tiwai@suse.de>
2010-09-17ALSA: hda - Fix mic attribute check for internal micsTakashi Iwai
Now Windows claims that the BIOS sets pins for internal mics to be BOTH connection instead of FIXED. Signed-off-by: Takashi Iwai <tiwai@suse.de>
2010-09-09ALSA: hda - Sort input pins in snd_hda_parse_pin_def_config()Takashi Iwai
Sort inputs[] array in autocfg so that the codec parsers can filter out easily per input pin types. Signed-off-by: Takashi Iwai <tiwai@suse.de>
2010-09-09ALSA: hda - Add comments to new helper functionsTakashi Iwai
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2010-09-09ALSA: hda - Reduce redundant mic location prefix in input source labelsTakashi Iwai
When the mic pins are assigned to the same location, we can omit the redundant location prefix like "Front" or "Rear". Signed-off-by: Takashi Iwai <tiwai@suse.de>
2010-09-09ALSA: hda - Improve the input source name labelsTakashi Iwai
This patch improves the input-source label strings to be generated from the pin information instead of fixed strings per AUTO_PIN_* type. This gives more suitable labels, especially for mic and line-in pins. Signed-off-by: Takashi Iwai <tiwai@suse.de>