summaryrefslogtreecommitdiff
path: root/sound/pci/hda/hda_generic.c
AgeCommit message (Collapse)Author
2013-05-16ALSA: hda - Check the activity of the NID to be powered downTakashi Iwai
When an inactive path is powered down with spec->power_down_unused flag, we should check the activity of each widget in the path whether it's still referred from any active path. Signed-off-by: Takashi Iwai <tiwai@suse.de>
2013-04-16ALSA: hda - Use the primary DAC for all aamix outputsTakashi Iwai
When setting up the aamix output paths, use the primary DAC instead of the individual DAC for each output as default. Otherwise multiple DACs will be turned on for a single aamix widget, which results in doubly or more volumes, because the duplicated signals will be sent through all these DACs for a single stream. Signed-off-by: Takashi Iwai <tiwai@suse.de>
2013-04-16ALSA: hda - Fix aamix activation with loopback control on VIA codecsTakashi Iwai
When we have a loopback mixer control, this should manage the state whether the output paths include the aamix or not. But the current code blindly initializes the output paths with aamix = true, thus the aamix is enabled unless the loopback mixer control is changed. Also, update_aamix_paths() called by the loopback mixer control put callback invokes snd_hda_activate_path() with aamix = true even for disabling the mixing. This leaves the aamix path even though the loopback control is turned off. This patch fixes these issues: - Introduced aamix_default() helper to indicate whether with_aamix is true or false as default - Fix the argument in update_aamix_paths() for disabling loopback Reported-by: Lydia Wang <LydiaWang@viatech.com.cn> Cc: <stable@vger.kernel.org> [v3.9+] Signed-off-by: Takashi Iwai <tiwai@suse.de>
2013-04-15Merge tag 'asoc-v3.10' of ↵Takashi Iwai
git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound into for-next ASoC: Updates for v3.10 A bunch of changes here, the most interesting one subsystem wise being Morimoto-san's work to create snd_soc_component which doesn't do much for now but will be pretty important going forwards: - Add a new component object type which will form the basis of moving to a more generic handling of SoC and off-SoC components, contributed by Kuninori Morimoto. - A fairly large set of cleanups for the dmaengine integration from Lars-Peter Clausen, starting to move towards being able to have a generic driver based on the library. - Performance optimisations to DAPM from Ryo Tsutsui. - Support for mixer control sharing in DAPM from Stephen Warren. - Multiplatform ARM cleanups from Arnd Bergmann. - New CODEC drivers for AK5385 and TAS5086 from Daniel Mack.
2013-04-11ALSA: hda - Handle Headphone Mic jack more genericDavid Henningsson
Now that we have a flag for headphone mics, we can use that flag in the jack creation instead of creating the jack manually. Signed-off-by: David Henningsson <david.henningsson@canonical.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2013-04-11ALSA: hda - allow "Headphone Mic" parser flagDavid Henningsson
This allows a specific mic to get the "Headphone Mic" name, in addition to the existing "Headset Mic" name. Also, it allows for a special mark: if the sequence number is set to 0xc, that's an indication to prefer it for headset mic, and if it's set to 0xd, that's an indication to prefer it for headphone mic. Signed-off-by: David Henningsson <david.henningsson@canonical.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2013-04-05ALSA: hda/generic - fix uninitialized variableJiri Slaby
changed is not initialized in path_power_down_sync, but it is expected to be false in case no change happened in the loop. So set it to false. Signed-off-by: Jiri Slaby <jslaby@suse.cz> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2013-03-22ALSA: hda - Lower the badness for independent HP penaltyTakashi Iwai
The lack of independent HP mode shouldn't be too bad, but currently its badness is set a bit too high. Let's lower it. Signed-off-by: Takashi Iwai <tiwai@suse.de>
2013-03-22ALSA: hda - Allow codec drivers to give own badness tablesTakashi Iwai
The standard badness values don't seem to fit to all preferences. Some configuration prefer the side output over the headphone, some want the speaker over the surround, etc. This patch moves the badness table pointers into hda_gen_spec, so that the codec driver can override them. Signed-off-by: Takashi Iwai <tiwai@suse.de>
2013-03-22Merge branch 'for-linus' into for-nextTakashi Iwai
Merge back for-linus branch for the badness table adjustment for VIA codecs * for-linus: ALSA: hda - Fix DAC assignment for independent HP ALSA: hda - Fix abuse of snd_hda_lock_devices() for DSP loader ALSA: hda - Fix typo in checking IEC958 emphasis bit ALSA: snd-usb: mixer: ignore -EINVAL in snd_usb_mixer_controls() ALSA: snd-usb: mixer: propagate errors up the call chain ALSA: usb: Parse UAC2 extension unit like for UAC1 ALSA: hda - Fix yet missing GPIO/EAPD setup in cirrus driver
2013-03-21ALSA: hda - Fix DAC assignment for independent HPTakashi Iwai
The generic parser should evaluate the availability of the independent HP when specified. Otherwise a DAC without the direct connection to the corresponding pin may be assigned for the HP, but the driver doesn't check it at all. The problem was actually seen on some machines with VT1708s or equivalent codec, where DAC0 is assigned to HP although it can be connected only via aamix. This patch adds the badness evaluation for the independent HP to make it working properly. Reported-by: Lydia Wang <LydiaWang@viatech.com.cn> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2013-03-18ALSA: hda - Move beep attach/detach calls in hda_generic.cTakashi Iwai
Instead of calling snd_hda_attach_beep_device() and snd_hda_detach_beep_device() in each codec driver, move them to the generic parser. The codec driver just needs to set spec->beep_nid for activating the digital beep. Signed-off-by: Takashi Iwai <tiwai@suse.de>
2013-03-11ALSA: hda - Don't re-initialize shared hp/mic pinctlTakashi Iwai
When a headphone pin is set up as a shared hp/mic pin, we rather want to keep it as a headphone primarily as default, but the driver overrides it always as a mic pin, just because the input controls are created after outputs. Add a check of pin NID and skip the re-initialization of pinctl for such a shared hp/mic pin. Reported-by: Jonathan Woithe <jwoithe@just42.net> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2013-03-07ALSA: hda - Avoid automatic pin-ctl update for hp/mic when jack ctl existsTakashi Iwai
When the headphone mic jack enum control is created (via explicitly specification by user), it doesn't make much sense to change the I/O direction dynamically per capture source change, since the I/O direction is rather controlled over the enum ctl. This also reduces the implicit dependency between the capture source and the hp mic jack enum ctls, which might confuse a program accessing the whole control elements at once like alsactl. In addition, this patch introduces update_hp_automute_hook() function to call the proper hook function. It's just to remove the open codes in multiple places in hda_generic.c. Signed-off-by: Takashi Iwai <tiwai@suse.de>
2013-03-07ALSA: hda - Consolidate add_in_jack_modes and add_out_jack_modes hintsTakashi Iwai
There is no big merit to distinguish these two hints. Instead, just have a single flag, add_jack_modes, for creating the jack mode enum ctls for both I/O directions. The hint string parser code is left and translated as add_jack_modes just for keeping compatibility. Signed-off-by: Takashi Iwai <tiwai@suse.de>
2013-03-07ALSA: hda - Allow to change I/O direction in hp/mic jack mode ctlTakashi Iwai
The previous commits added the capability to change the pin control of hp/mic shared jack, but it actually didn't work as expected when the value is changed from the output to the input, since I forgot to reset the pin I/O bit in that case. This patch fixes the problem. Signed-off-by: Takashi Iwai <tiwai@suse.de>
2013-03-07ALSA: hda - Handle shared hp/mic jack modeTakashi Iwai
When a headphone jack is configured as a shared hp/mic jack, the jack mode enum needs to handle both input and output directions. Signed-off-by: Takashi Iwai <tiwai@suse.de>
2013-03-07ALSA: hda - Add the generic Headphone Mic featureTakashi Iwai
This patch improves the generic parser code to allow to set up the headphone jack as a mic input. User can enable this feature by giving hp_mic hint string. The former shared hp/mic feature for the single built-in mic is still retained. This detection can be disabled now via hp_mic_detect hint string, too. Signed-off-by: Takashi Iwai <tiwai@suse.de>
2013-02-13ALSA: hda - Increase badness for missing multi-ioTakashi Iwai
The current badness value used for the missing multi-io seems too weak, and the multi-io tends to be skipped for desktop configurations when no enough DACs are available. It's because the total badness of the multi-io becomes often larger than the badness with assigning an individual DAC to a headphone jack. This is good for one side, but it seems that the surround outputs are more demanded by that. This patch increases the badness value for the missing multi-io slightly so that the multi-io would be preferred than the individual headphone DAC if they conflict. Through the tests with hda-emu, mostly only desktop configurations with ALC662/663 and CMI codecs are affected by this change, and all look reasonable. Reported-by: Raymond Yau <superquad.vortex2@gmail.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2013-02-07ALSA: hda - Use generic array for loopback list managementTakashi Iwai
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2013-02-07ALSA: hda - Enable loopback accounts for CONFIG_PM=n, tooTakashi Iwai
The loopback list is referred by the VIA codec driver no matter whether CONFIG_PM is set or not, thus we need to enable it always. Otherwise it gets compile errors. Reported-by: Randy Dunlap <rdunlap@infradead.org> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2013-01-25ALSA: Make snd_printd() and snd_printdd() inlineTakashi Iwai
Because currently snd_printd() and snd_printdd() macros are expanded to empty when CONFIG_SND_DEBUG=n, a compile warning like below appears sometimes, and we had to covert it by ugly ifdefs: sound/pci/hda/patch_sigmatel.c: In function ‘stac92hd71bxx_fixup_hp’: sound/pci/hda/patch_sigmatel.c:2434:24: warning: unused variable ‘spec’ [-Wunused-variable] For "fixing" these issues better, this patch replaces snd_printd() and snd_printdd() definitions with empty inline functions instead of macros. This should have the same effect but shut up warnings like above. But since we had already put ifdefs, changing to inline functions would trigger compile errors. So, such ifdefs is removed in this patch. In addition, snd_pci_quirk name field is defined only when CONFIG_SND_DEBUG_VERBOSE is set, and the reference to it in snd_printdd() argument triggers the build errors, too. For avoiding these errors, introduce a new macro snd_pci_quirk_name() that is defined no matter how the debug option is set. Reported-by: Stratos Karafotis <stratosk@semaphore.gr> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2013-01-24ALSA: hda - Implement path-based power filter to the generic parserTakashi Iwai
This patch adds a better power filter hook for powering down unused widgets in the generic parser. The feature is enabled by setting hda_gen_spec.power_down_unused flag. Signed-off-by: Takashi Iwai <tiwai@suse.de>
2013-01-24ALSA: hda - Fix wrong arguments for path deactivation checksTakashi Iwai
The arguments to call is_active_nid() in activate_amp() were swapped, and this resulted in the muted amp on some SPDIF output pins. Also, the index to be passed to is_active_nid() must be idx_to_check. Otherwise it checks the wrong connection in the case of implicit aamix connection paths. Signed-off-by: Takashi Iwai <tiwai@suse.de>
2013-01-23ALSA: hda - Small code refactoring about path re-initializationTakashi Iwai
Introduce a helper function to do the same thing. Signed-off-by: Takashi Iwai <tiwai@suse.de>
2013-01-23ALSA: hda - Fix missing path between aamix and outputs in AD codecsTakashi Iwai
AD1988 family and AD1882 codecs have another mixer widget (0x21) between the analog-loopback mixer widget (0x20) and the actual outputs. Due to this hole, the analog-loopbacks aren't sent properly to the output pins. As a band-aid fix, introduce another fields holding the aamix merge path, and activate it. Signed-off-by: Takashi Iwai <tiwai@suse.de>
2013-01-22ALSA: hda - Combine snd_hda_codec_flush_*_cache() to a single functionTakashi Iwai
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-22ALSA: hda - Fix missing call of cmd flush in capture volume put callbackTakashi Iwai
The capture volume put callback may call the node selection change, and its actual call won't be triggered unless flushed. In general, we always need to call both snd_hda_codec_flush_amp_cache() and snd_hda_codec_flush_cmd_cache() at the same place... Signed-off-by: Takashi Iwai <tiwai@suse.de>
2013-01-22ALSA: hda - Add missing exports to helper functionsTakashi Iwai
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2013-01-22ALSA: hda - Disable HP auto-mute during independent HP modeTakashi Iwai
Both the HP auto-mute and the independent HP mode conflict with each other. Make HP auto-mute disabled (only for the affected HP jack) during the driver is in HP independent mode. Signed-off-by: Takashi Iwai <tiwai@suse.de>
2013-01-22ALSA: hda - Set individual name to secondary analog PCM streamTakashi Iwai
It'd be better to give another name to the secondary (alt) analog PCM stream, which is dedicated for the independent HP out and extra inputs. Signed-off-by: Takashi Iwai <tiwai@suse.de>
2013-01-21ALSA: hda - Fix conflicts between Loopback Mixing and Independent HPTakashi Iwai
This patch eventually fixes two issues: - Handle the case where the primary output is a headphone and can have independent HP mode; so far we checked only the case where the headphone is the secondary output. - Fix the conflict of HP independent mode and aamix mode; when switched to aamix mode, the DAC might be also switched to another widget shared with other outputs. Then even if we disable the DAC for the original output, it doesn't change -- because the active route is from another (shared) DAC to HP pin through aamix. So, in such a case, we have to prohibit the switch to aamix for HP routes. This fixes issues appearing on VT codecs. Signed-off-by: Takashi Iwai <tiwai@suse.de>
2013-01-21ALSA: hda - Check aamix-output paths from other DACs, tooTakashi Iwai
Many codecs provide routes to multiple output pins through an aamix widget, but most of them do it only from a single DAC. However, the current generic parser checks only the aamix paths from the original (directly bound) DACs through aamix NID, and miss the path: primary DAC -> aamix -> target out pin This patch adds a more check for the routes like the above. Signed-off-by: Takashi Iwai <tiwai@suse.de>
2013-01-21ALSA: hda - Add missing badness evaluation for unresolved pathsTakashi Iwai
When a patch couldn't be resolved in try_assign_dacs() although the target DAC is expected, we forgot to add a proper badness value but continued. Signed-off-by: Takashi Iwai <tiwai@suse.de>
2013-01-21ALSA: hda - Set the pin targets after deciding output configTakashi Iwai
Since fill_and_eval_dacs() may be called repeatedly with different configurations, setting pinctls at each time there isn't optimal. We can set it better only once after deciding the output configuration in parse_output_paths(). Signed-off-by: Takashi Iwai <tiwai@suse.de>
2013-01-21ALSA: hda - Improve debug prints for output pathsTakashi Iwai
Print the information of outputs in a bit more details and concisely in a single place instead of printing the path at each time when detected. Signed-off-by: Takashi Iwai <tiwai@suse.de>
2013-01-18ALSA: hda - Fix the wrong adc_idx for capture sourceTakashi Iwai
The patch "ALSA: hda - fix wrong adc_idx in generic parser" fixed the adc_idx for the capture volume and capture switch controls. But also modified the adc_idx retrieval for the capture source controls wrongly. As multiple capture source controls are created in a single shot with counts > 1, the id.index doesn't contain the real value. The real index has to be taken via snd_ctl_get_ioffidx() as in the original code. This patch reverts the fixes partially to recover from the regression. Signed-off-by: Takashi Iwai <tiwai@suse.de>
2013-01-18ALSA: hda - don't compare with yourself in fill_input_pin_labelsDavid Henningsson
Just stumbled over this one while reading the code. Signed-off-by: David Henningsson <david.henningsson@canonical.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2013-01-18ALSA: hda - make sure there are enough input labels and pathsDavid Henningsson
I found a codec configuration which had six inputs, so the max of five was not appropriate. Signed-off-by: David Henningsson <david.henningsson@canonical.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2013-01-18ALSA: hda - Add boost to line inputs, tooTakashi Iwai
Although I commented that boost volumes would be added only for line-in and mic pins in the source code, the actual code excludes but for mic-in. Fix it to accept the line-ins, too. Signed-off-by: Takashi Iwai <tiwai@suse.de>
2013-01-18ALSA: hda - Consolidate cap_sync_hook and capture_switch_hookTakashi Iwai
Two hooks in hda_gen_spec, cap_sync_hook and capture_switch_hook, play very similar roles. The only differences are that the former is called more often (e.g. at init or switching capsrc) while the latter can take an on/off argument. As a more generic implementation, consolidate these two hooks, and pass snd_ctl_elem_value pointer as the second argument. If the secondary argument is non-NULL, it can take the on/off value, so the caller handles it like the former capture_switch_hook. If it's NULL, it's called in the init or capsrc switch case. Signed-off-by: Takashi Iwai <tiwai@suse.de>
2013-01-18ALSA: hda - Fix missing call of capture_switch_hookTakashi Iwai
When a standard capture switch without multiple binding is used, the call for capture_switch_hook isn't called properly. Replace the put ops to add the hook call in that case. Signed-off-by: Takashi Iwai <tiwai@suse.de>
2013-01-18ALSA: hda - Look for boost controls more deeplyTakashi Iwai
In the current generic parser code, we look for the (mic) boost controls only on input pins. But many codecs assign the boost volume to a widget connected to each input pin instead of the input amp of the pin itself. In this patch, the parser tries to look through more widgets connected to the pin and find a boost amp. Signed-off-by: Takashi Iwai <tiwai@suse.de>
2013-01-18ALSA: hda - Fix invalid mute in path activationTakashi Iwai
When an amp in the activation path is associated with mixer controls, activate_amp() tries to skip the initialization. It's good, but only if the mixer really initializes both mute and volume. Otherwise, either the mute of the volume is left uninitialized. This patch adds this missing check and properly initialize the partially controlled amps in an activation path. Signed-off-by: Takashi Iwai <tiwai@suse.de>
2013-01-18ALSA: hda - Unify input label creations in generic parserTakashi Iwai
There are a few places creating the labels and indices of kctls for each input pin in the current generic parser code. This is redundant and makes harder to maintain. Let's create the labels and indices at once and keep them in hda_gen_spec. Signed-off-by: Takashi Iwai <tiwai@suse.de>
2013-01-18ALSA: hda - Keep autocfg.input idx value in imux tableTakashi Iwai
Since the imux table entries can be a subset of autocfg.input table, the indices of these aren't always same. For passing the proper index value of autocfg.input at creating input ctl labels (via snd_hda_autocfg_input_label()), keep the corresponding autocfg.input idx value in the index field of each imux item, which isn't used in the generic driver. Also, this makes easier to check the invalid imux pin for stereo mix. Signed-off-by: Takashi Iwai <tiwai@suse.de>
2013-01-17ALSA: hda - Improve naming rule for primary outputTakashi Iwai
When the volume or mute control of the primary output is shared with other (headphone or speaker) outputs, we shouldn't name it as a specific output type but rather name it with the channel name or a generic name like "PCM". Also, this check should be performed individually for the volume and the mute controls because some codecs may have shared volumes but separate mute controls. Signed-off-by: Takashi Iwai <tiwai@suse.de>
2013-01-17ALSA: hda - Add PCM capture hook to hda_gen_specTakashi Iwai
Not only PCM playback, a hook for PCM capture would be required for power controls in codec drivers. Signed-off-by: Takashi Iwai <tiwai@suse.de>
2013-01-17ALSA: hda - Record all detected ADCs in hda_gen_specTakashi Iwai
Since the generic parser reduces the ADC list, copy the list of the all detected ADCs and keep it. This list can be later referred by the codec driver for finer power controls. Signed-off-by: Takashi Iwai <tiwai@suse.de>
2013-01-17ALSA: hda - Move vmaster TLV parsing to snd_hda_gen_parse_auto_config()Takashi Iwai
Add vmaster_tlv[] to hda_gen_spec and store the suggested TLV data in snd_hda_gen_parse_auto_config(). This allows the codec driver to correct the TLV data (e.g. mute capability) before actually creating vmaster instance. Signed-off-by: Takashi Iwai <tiwai@suse.de>