summaryrefslogtreecommitdiffstats
path: root/sound/pci/hda/patch_via.c
Commit message (Collapse)AuthorAgeFilesLines
* ALSA: hda/via - Add missing stream_pm ops setupTakashi Iwai2015-04-091-0/+1
| | | | | | | Similar like the case for Realtek, VIA codec driver needs this ops as well for making the widget power-save working. Signed-off-by: Takashi Iwai <tiwai@suse.de>
* ALSA: hda/via - Add beep controls to VIA codecsW. Trevor King2015-03-251-0/+61
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | My codec has a beep-generating node: $ cat /proc/asound/card1/codec#0 Codec: VIA VT1802 ... Vendor Id: 0x11068446 Subsystem Id: 0x15587410 Revision Id: 0x100000 ... Node 0x22 [Beep Generator Widget] wcaps 0x70040c: Mono Amp-Out Amp-Out caps: ofs=0x0a, nsteps=0x12, stepsize=0x05, mute=1 Amp-Out vals: [0x0a] Power states: D0 D1 D2 D3 Power: setting=D0, actual=D0 ... But I was missing the: Control: name=... entries that I need to manage this widget from alsamixer. With this patch (based on the similar Mono Amp-Out handling in patch_conexant.c), I get a new: input: HDA Digital PCBeep as /devices/pci0000:00/0000:00:1b.0/sound/card1/hdaudioC1D0/input15 entry in dmesg and controls to manage that beep: $ cat /proc/asound/card1/codec#0 | grep -A5 Beep Node 0x22 [Beep Generator Widget] wcaps 0x70040c: Mono Amp-Out Control: name="Beep Playback Volume", index=0, device=0 ControlAmp: chs=1, dir=Out, idx=0, ofs=0 Control: name="Beep Playback Switch", index=0, device=0 ControlAmp: chs=1, dir=Out, idx=0, ofs=0 Amp-Out caps: ofs=0x0a, nsteps=0x12, stepsize=0x05, mute=1 Amp-Out vals: [0x12] Power states: D0 D1 D2 D3 Power: setting=D0, actual=D0 [rebased and modified for the latest tree by tiwai] Signed-off-by: W. Trevor King <wking@tremily.us> Signed-off-by: Takashi Iwai <tiwai@suse.de>
* ALSA: hda - Move a part of hda_codec stuff into hdac_deviceTakashi Iwai2015-03-231-12/+11
| | | | | | | | | | Now some codes and functionalities of hda_codec struct are moved to hdac_device struct. A few basic attributes like the codec address, vendor ID number, FG numbers, etc are moved to hdac_device, and they are accessed like codec->core.addr. The basic verb exec functions are moved, too. Signed-off-by: Takashi Iwai <tiwai@suse.de>
* ALSA: hda - Rename power_mgmt flag with power_save_nodeTakashi Iwai2015-03-201-6/+6
| | | | | | | | | | David suggested that the name "power_mgmt" is too ambiguous. Rename the flag with a bit clearer one "power_save_node". Also, add the corresponding description to HD-Audio.txt, too. Reported-by: David Henningsson <david.henningsson@canonical.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
* ALSA: hda - Use the new power control for VIA codecsTakashi Iwai2015-03-181-650/+12
| | | | | | | | | | | | | | | VIA codecs used to have the own power controls but they were disabled at transition to the generic parser due to the coding assuming the fixed routes. Now we get the proper support of equivalently fine power management in the generic parser, and the old kludges can be replaced with it. This results in the reduction of lots of dead codes. The advanced PM feature is disabled as default like before for keeping the compatible behavior. It's enabled via "Dynamic Power-Control" mixer element. Signed-off-by: Takashi Iwai <tiwai@suse.de>
* ALSA: hda - Use standard workqueue for unsol and jack eventsTakashi Iwai2015-03-031-2/+1
| | | | | | | | The events that are handled by HD-audio drivers are no frequent and urgent ones, so we can use the standard workqueue without any problem nowadays. Signed-off-by: Takashi Iwai <tiwai@suse.de>
* ALSA: hda - Allocate hda_pcm objects dynamicallyTakashi Iwai2015-03-031-2/+4
| | | | | | | | | | | | | | | So far, the hda_codec object kept the hda_pcm list in an array, and the codec driver was expected to assign the array. However, this makes the object life cycle management harder, because the assigned array is freed at the codec driver detach while it might be still accessed by the opened streams. In this patch, we allocate each hda_pcm object dynamically and manage it as a linked list. Each object has a kref refcount, and both the codec driver binder and the PCM open/close touches it, so that the object won't be freed while in use. Signed-off-by: Takashi Iwai <tiwai@suse.de>
* ALSA: hda - Add card field to hda_codec structTakashi Iwai2015-03-031-4/+4
| | | | | | | | Allow the codec object to have an individual card pointer. Not only this simplifies the redirections in many places, also this will allow us to make each codec assigned to a different card object. Signed-off-by: Takashi Iwai <tiwai@suse.de>
* ALSA: hda - Bind codecs via standard busTakashi Iwai2015-02-231-14/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Now we create the standard HD-audio bus (/sys/bus/hdaudio), and bind the codec driver with the codec device over there. This is the first step of the whole transition so that the changes to each codec driver are kept as minimal as possible. Each codec driver needs to register hda_codec_driver struct containing the currently existing preset via the new helper macro module_hda_codec_driver(). The old hda_codec_preset_list is replaced with this infrastructure. The generic parsers (for HDMI and other) are also included in the preset with the special IDs to bind uniquely. In HD-audio core side, the device binding code is split to hda_bind.c. It provides the snd_hda_bus_type implementation to match the codec driver with the given codec vendor ID. It also manages the module auto-loading by itself like before: when the matching isn't found, it tries to probe the corresponding codec modules, and finally falls back to the generic drivers. (The special ID mentioned above is set at this stage.) The only visible change to outside is that the hdaudio sysfs entry now appears in /sys/bus/devices, not as a sound class device. More works to move the suspend/resume and remove ops will be (hopefully) done in later patches. Signed-off-by: Takashi Iwai <tiwai@suse.de>
* ALSA: hda - Make add_stereo_mix_input flag tristateTakashi Iwai2014-12-151-1/+1
| | | | | | | | | ... for distinguishing whether it's explicitly enabled via a user hint or enabled by a driver as a fallback. Now the former case corresponds to HDA_HINT_STEREO_MIX_ENABLE while the latter to HDA_HINT_STEREO_MIX_AUTO. Signed-off-by: Takashi Iwai <tiwai@suse.de>
* ALSA: hda - Remove superfluous hooks from VIA driverTakashi Iwai2014-09-161-23/+2
| | | | | | | | Like the previous fix for STAC/IDT codecs, the automute hooks in VIA driver can be also removed by enabling the power control callback for all pins. Signed-off-by: Takashi Iwai <tiwai@suse.de>
* ALSA: hda - Allow multiple callbacks for jackTakashi Iwai2014-09-161-4/+7
| | | | | | | | | | | | | | | | | | | So far, hda_jack infrastructure allows only one callback per jack, and this makes things slightly complicated when a driver wants to assign multiple tasks to a jack, e.g. the standard auto-mute with a power up/down sequence. This can be simplified if the hda_jack accepts multiple callbacks. This patch is such an extension: the callback-specific part (the function and private_data) is split to another struct from hda_jack_tbl, and multiple such objects can be assigned to a single hda_jack_tbl entry. The new struct hda_jack_callback is passed to each callback function now, thus the patch became bigger than expected. But these changes are mostly trivial. Signed-off-by: Takashi Iwai <tiwai@suse.de>
* ALSA: hda - Get rid of action field from struct hda_jack_tblTakashi Iwai2014-09-111-4/+0
| | | | | | | | | | | | | | | The action value assigned to each hda_jack_tbl entry is mostly superfluous. The actually used values are either the widget NID or a value specific to the callback. The former case can be simply replaced by a reference to widget NID itself. The only place doing the latter is STAC/IDT codec driver for the powermap handling. But, the code doesn't need to check the action field at all -- the function jack_update_power() is called either with a specific pin or with NULL. So the check of jack->action can be removed completely there, too. Signed-off-by: Takashi Iwai <tiwai@suse.de>
* ALSA: hda - Make snd_hda_gen_spec_free() staticTakashi Iwai2014-02-101-7/+1
| | | | | | | | The last user of snd_hda_gen_spec_free() is patch_via.c, and we can rewrite it safely with snd_hda_gen_free(), so that snd_hda_gen_spec_free() can be a local function in hda_generic.c. Signed-off-by: Takashi Iwai <tiwai@suse.de>
* ALSA: hda - Enable stereo mix as default for AD and VIA codecsTakashi Iwai2013-12-091-0/+1
| | | | | | | | | | | | AD and VIA codecs had stereo mixer input enabled as default before moving to the generic parser, and people think the lack of such a regression. In this patch, the stereo mixer input is added back to the input selection if no auto-mic is available, and if it's not disabled explicitly via hint. This should satisfy most of demands, i.e. stereo mix on desktop machines like what it worked before, and it still keeps the new auto-mic feature on laptops. Signed-off-by: Takashi Iwai <tiwai@suse.de>
* ALSA: hda - Clearing jackpoll_interval avoid pending workWang Xingchao2013-07-291-1/+1
| | | | | | | | | | Clearing jackpoll_interval before calling cancel_delayed_work_sync(), otherwise the work will be triggered again and cause impact in hda_jackpoll_work(). The next patch will poll jack once even with jackpoll_interval=0. Signed-off-by: Wang Xingchao <xingchao.wang@linux.intel.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
* ALSA: hda - Use auto_mute_via_amp=1 for VT1708Takashi Iwai2013-06-251-0/+2
| | | | | | | | | | | We've got bug report wrt many machines with VT1708 (e.g. IBM POS machines) showing the broken auto-mute behavior. It turned out that the problem is that the pin control values of the speaker and line-out pins are completely ignored. As a workaround, let's use the newly introduced feature of the generic parser, to control the mute via amp on pins. Signed-off-by: Takashi Iwai <tiwai@suse.de>
* ALSA: hda - Fix missing Mic Boost controls for VIA codecsTakashi Iwai2013-06-191-0/+2
| | | | | | | | | | | | | | | | | Some VIA codecs like VT1708S have Mic boost amps in the mic pins but they aren't exposed in the capability bits. In the past driver code, we override the pin caps and create mic boost controls forcibly. While transition to the generic parser, we lost the mic boost controls although the pin caps are still overridden, because the generic parser code checks the widget caps, too. So this patch adds a new helper function to allow the override of the given widget capability bits, and makes VIA codecs driver to add the missing input-amp capability bit. Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=59861 Cc: <stable@vger.kernel.org> [v3.9+] Signed-off-by: Takashi Iwai <tiwai@suse.de>
* ALSA: hda/via - Use standard snd_hda_shutup_pins()Takashi Iwai2013-06-051-8/+3
| | | | | | Just a minor clean up. Signed-off-by: Takashi Iwai <tiwai@suse.de>
* ALSA: hda/via - Fix wrongly cleared pins after suspend on VT1802Takashi Iwai2013-06-031-1/+3
| | | | | | | | | | | | | | | | VIA driver has a special suspend handling only for VT1802 to reduce the pop noise. During the transition to the generic parser, the behavior of snd_hda_set_pin_ctl() was also changed to modify the cached values, too. And this caused a regression where the pin is still cleared even after the resume (including the resume from power save), resulting in the silent output. The fix is simply to replace snd_hda_set_pin_ctl() with the explicit call of snd_hda_codec_write() again. Reported-by: Alex Riesen <raa.lkml@gmail.com> Cc: <stable@vger.kernel.org> [v3.9] Signed-off-by: Takashi Iwai <tiwai@suse.de>
* ALSA: hda - Add keep_eapd_on flag to generic parserTakashi Iwai2013-06-031-0/+1
| | | | | | | | | | | VT1802 codec seems to reset EAPD of other pins in the hardware level, and this was another reason of the silent headphone output on some machines. As a workaround, introduce a new flag indicating to keep the EPAD on to the generic parser, and set it in patch_via.c. Reported-by: Alex Riesen <raa.lkml@gmail.com> Cc: <stable@vger.kernel.org> [v3.9] Signed-off-by: Takashi Iwai <tiwai@suse.de>
* ALSA: hda/via - Disable broken dynamic power controlTakashi Iwai2013-06-031-0/+5
| | | | | | | | | | | | Since the transition to the generic parser, the actual routes used there don't match always with the assumed static paths in some set_widgets_power_state callbacks. This results in the wrong power setup in the end. As a temporary workaround, we need to disable the calls together with the non-functional dynamic power control enum. Reported-by: Alex Riesen <raa.lkml@gmail.com> Cc: <stable@vger.kernel.org> [v3.9] Signed-off-by: Takashi Iwai <tiwai@suse.de>
* ALSA: hda - VIA prefers side surrounds over HPTakashi Iwai2013-03-221-0/+20
| | | | | | | | | | | | The recent fix for the independent HP reduced the availability of the side surround output, because there are only 4 DACs for 7.1 and a HP outputs. Adjust the badness tables for VIA so that 7.1 outputs are activated for the cost of missing independent HP. Once when we implement the dynamic DAC switching to multiple outputs, this conflicts will be eased in future... Signed-off-by: Takashi Iwai <tiwai@suse.de>
* ALSA: hda - Use generic array for loopback list managementTakashi Iwai2013-02-071-3/+5
| | | | Signed-off-by: Takashi Iwai <tiwai@suse.de>
* ALSA: hda - detect jacks on VT1708 even when no streams are activeDavid Henningsson2013-02-051-2/+1
| | | | | | | | | | | These days, GUIs such as Gnome sound settings want to be able to show the correct jack status even when no streams are currently running. I doubt this gives any measurable difference in power, but if it does, the "Jack Detect" control can still be used to turn polling off. Signed-off-by: David Henningsson <david.henningsson@canonical.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
* ALSA: hda - Fix phantom jacks on VT1708David Henningsson2013-02-051-0/+13
| | | | | | | | | The VT1708 has no unsol event capability, and polling is set using the "Jack Detect" alsamixer control. In order not to create phantom Jack controls, temporary enable jackpoll during build_controls. Signed-off-by: David Henningsson <david.henningsson@canonical.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
* ALSA: hda - Add snd_hda_check_power_state() helper functionTakashi Iwai2013-01-241-8/+3
| | | | | | ... for small refactoring. Signed-off-by: Takashi Iwai <tiwai@suse.de>
* ALSA: hda/via - Fix wrong checks of power state bitsTakashi Iwai2013-01-241-4/+8
| | | | | | | | | AC_VERB_GET_POWER_STATE returns the combined bits of the actual state and the target state. Thus, comparing the obtained value directly with the target value can't work. The value has to be shifted and masked properly. Signed-off-by: Takashi Iwai <tiwai@suse.de>
* ALSA: hda - Enable parsing the independent HP mode as default for VIA codecsTakashi Iwai2013-01-211-0/+1
| | | | | | | The original VIA codec parser enabled it as default, so let's keep the behavior as it was. Signed-off-by: Takashi Iwai <tiwai@suse.de>
* ALSA: hda - Use generic parser for VIA codec driverTakashi Iwai2013-01-121-2405/+205
| | | | | | | | Yet another step forward. As all features for VIA codecs have been implemented in the generic driver, we can move on to migrate the VIA codec parser, too. Signed-off-by: Takashi Iwai <tiwai@suse.de>
* ALSA: hda - Rearrange INPUT_PIN_ATTR_*Takashi Iwai2013-01-121-1/+1
| | | | | | | | | | | | Put INPUT_PIN_ATTR_FRONT after INPUT_PIN_ATTR_REAR, and define INPUT_PIN_ATTR_LAST to point to the last element. This is a preliminary work for cleaning up Realtek auto-mic parser. In the auto-mic implementation, the front panel is preferred over the rear panel. By arranging the attr definitions like in this commit, we can simply use sort() for figuring out the priority order. Signed-off-by: Takashi Iwai <tiwai@suse.de>
* ALSA: hda - Move fixup code into struct hda_codecTakashi Iwai2013-01-121-4/+0
| | | | | | | 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>
* ALSA: HDA: VIA: Add support for codec VT1808.Lydia Wang2012-12-101-0/+8
| | | | | | | Add support for new codec VT1808, which is similiar with VT1705CF. Signed-off-by: Lydia Wang <lydiawang@viatech.com.cn> Signed-off-by: Takashi Iwai <tiwai@suse.de>
* ALSA: HDA: VIA Add support for codec VT1705CF.Lydia Wang2012-12-101-0/+151
| | | | | | | | | | | Add support for new codec VT1705CF. When power on/off Audio output converter of VT1705CF, the stream tag will be cleared. But driver caches the value. So when power on Audio output converter, the update_conv_power_state() will restore the saved stream tag of it. Signed-off-by: Lydia Wang <lydiawang@viatech.com.cn> Signed-off-by: Takashi Iwai <tiwai@suse.de>
* ALSA: hda - Add a helper function for simple enum kcontrolsTakashi Iwai2012-11-301-12/+1
| | | | | | | The same type of code is being used in multiple places in various codec drivers, so put it as a core library. Signed-off-by: Takashi Iwai <tiwai@suse.de>
* ALSA: hda - Call snd_array_init() early and only onceTakashi Iwai2012-11-281-1/+1
| | | | | | | | | | | This is a preliminary patch for introducing a protection to access races of snd_array instances. Call snd_array_init() appropriately at the initialization time and don't call it twice. Also the allocations of codec-spec structs are cleaned up by helper functions in patch_sigmatel.c and patch_analog.c. Signed-off-by: Takashi Iwai <tiwai@suse.de>
* ALSA: hda - Removed unused non-standard name "C/LFE"David Henningsson2012-11-091-1/+1
| | | | | | | A closer look shows that the name is not even used and can be removed. Signed-off-by: David Henningsson <david.henningsson@canonical.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
* ALSA: hda - Apply a proper chmap for built-in 2.1 speakersTakashi Iwai2012-11-081-0/+4
| | | | | | | 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>
* ALSA: hda - Give standard "Bass Speaker" mixer for 2.1 speakersTakashi Iwai2012-11-081-3/+3
| | | | | | | | When two built-in speakers are found on the machine, we can suppose it's rather a 2.1 speaker system with a bass output instead of front/surround channels. Signed-off-by: Takashi Iwai <tiwai@suse.de>
* ALSA: hda - Add pin fixups for ASUS G75Takashi Iwai2012-11-071-0/+11
| | | | | | | | | To parse properly the subwoofer outputs on ASUS G75 laptop with VT1802 codec, correct the default configurations of speaker pins 0x24 and 0x33. Reported-by: Massimo Del Fedele <max@veneto.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
* ALSA: hda - Fix invalid connections in VT1802 codecTakashi Iwai2012-11-071-0/+14
| | | | | | | | | | | VT1802 codec provides the invalid connection lists of NID 0x24 and 0x33 containing the routes to a non-exist widget 0x3e. This confuses the auto-parser. Fix it up in the driver by overriding these connections. Reported-by: Massimo Del Fedele <max@veneto.com> Cc: <stable@vger.kernel.org> Signed-off-by: Takashi Iwai <tiwai@suse.de>
* ALSA: hda - Fix empty DAC filling in patch_via.cTakashi Iwai2012-11-071-7/+4
| | | | | | | | | | | | | | | In via_auto_fill_adc_nids(), the parser tries to fill dac_nids[] at the point of the current line-out (i). When no valid path is found for this output, this results in dac = 0, thus it creates a hole in dac_nids[]. This confuses is_empty_dac() and trims the detected DAC in later reference. This patch fixes the bug by appending DAC properly to dac_nids[] in via_auto_fill_adc_nids(). Reported-by: Massimo Del Fedele <max@veneto.com> Cc: <stable@vger.kernel.org> Signed-off-by: Takashi Iwai <tiwai@suse.de>
* ALSA: hda - Add missing hda_gen_spec to struct via_specTakashi Iwai2012-10-101-0/+4
| | | | | | | | | | | | | The commit [4b527b65 ALSA: hda - limit internal mic boost for Asus X202E] introduced the use of auto-parser code, but it forgot to add struct hda_gen_spec at the head of codec->spec which the auto-parser assumes silently. Without this record, it may result in memory corruption. This patch adds the missing piece. Cc: <stable@vger.kernel.org> [v3.5+] Signed-off-by: Takashi Iwai <tiwai@suse.de>
* ALSA: hda - make VIA codec use generic unsol event handlerDavid Henningsson2012-10-081-24/+23
| | | | | Signed-off-by: David Henningsson <david.henningsson@canonical.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
* ALSA: hda - Remove dead GPIO code for VIA codecDavid Henningsson2012-10-081-47/+0
| | | | | | | | From what I can conclude all GPIO handling was removed in 2009. Remove dead code remnants. Signed-off-by: David Henningsson <david.henningsson@canonical.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
* ALSA: hda/via - don't report presence on HPs with no presence supportHerton Ronaldo Krzesinski2012-09-221-1/+2
| | | | | | | | | | | | | | | | | | | If headphone jack can't detect plug presence, and we have the jack in the jack table, snd_hda_jack_detect will return the plug as always present (as it'll be considered as a phantom jack). The problem is that when this happens, line out pins will always be disabled, resulting in no sound if there are no headphones connected. This was reported as a no sound problem after suspend on http://bugs.launchpad.net/bugs/1052499, since the bug doesn't manifests on first initialization before the phantom jack is added, but on resume we reexecute the initialization code, and via_hp_automute starts reporting HP always present with the jack now on the table. BugLink: https://bugs.launchpad.net/bugs/1052499 Signed-off-by: Herton Ronaldo Krzesinski <herton.krzesinski@canonical.com> Cc: <stable@vger.kernel.org> [v3.6+] Signed-off-by: Takashi Iwai <tiwai@suse.de>
* ALSA: hda - limit internal mic boost for Asus X202EDavid Henningsson2012-09-181-0/+29
| | | | | | | | | | | When the input gain for the internal mic is set to its maximum level, the background noise becomes so high - and any relevant signal clipped - that the setting becomes unusable. It is better to limit the amplification. BugLink: https://bugs.launchpad.net/bugs/1052460 Signed-off-by: David Henningsson <david.henningsson@canonical.com> Cc: <stable@vger.kernel.org> [v3.5+] Signed-off-by: Takashi Iwai <tiwai@suse.de>
* ALSA: hda - Clean up CONFIG_SND_HDA_POWER_SAVETakashi Iwai2012-08-301-3/+1
| | | | | | | | 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>
* ALSA: hda - Call snd_hda_jack_report_sync() generically in hda_codec.cTakashi Iwai2012-08-221-1/+0
| | | | | | | | | Instead of calling the jack sync in the init callback of each codec, call it generically at initialization and resume. By calling it at the last of resume sequence, a possible race between the jack sync and the unsol event enablement in the current code will be closed, too. Signed-off-by: Takashi Iwai <tiwai@suse.de>
* ALSA: hda - Fix pop noise in headphones on S3 for Asus X55A, X55VDavid Henningsson2012-08-091-0/+8
| | | | | | | | | | To turn off pin control for the pin was tested, and helped against this issue. BugLink: https://bugs.launchpad.net/bugs/1034779 Tested-by: Chih-Hsyuan Ho <chih.ho@canonical.com> Signed-off-by: David Henningsson <david.henningsson@canonical.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
OpenPOWER on IntegriCloud