summaryrefslogtreecommitdiffstats
path: root/sound/pci/hda/hda_generic.h
Commit message (Collapse)AuthorAgeFilesLines
* ALSA: hda - Make add_stereo_mix_input flag tristateTakashi Iwai2014-12-151-1/+8
| | | | | | | | | ... 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 - Allow multiple callbacks for jackTakashi Iwai2014-09-161-6/+6
| | | | | | | | | | | | | | | | | | | 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-6/+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 - Add TLV_DB_SCALE_MUTE bit for relevant controlsTakashi Iwai2014-09-031-0/+1
| | | | | | | | | | | | | | | | | | | | | | The DACs on Sigmatel/IDT codecs do mute at the lowest volume level, and in the earlier drivers, we passed TLV_DB_SCALE_MUTE bit for each volume control element like Speaker and Headphone as well as Master. Along with the translation to the generic parser, however, the TLV bit was lost for the slave controls (e.g. Speaker) but set only to Master. In theory this should have sufficed, but apps, particularly PA, do care the slave volume bits, so we seem to see a regression in the volume controls. This patch adds a flag to hda_gen_spec to specify the DAC mute feature, and adds the TLV bit properly for all relevant volume controls. Also, the TLV bit for vmaster is set in hda_generic.c, so that we can get rid of all tricks from the codec driver side. As the similar hack is applied to Conexant 5051 stuff, we can get rid of it as well. BugLink: https://bugs.launchpad.net/bugs/1357928 Signed-off-by: Takashi Iwai <tiwai@suse.de>
* Merge branch 'for-linus' into for-nextTakashi Iwai2014-02-121-0/+1
|\
| * ALSA: hda - Fix inconsistent Mic mute LEDTakashi Iwai2014-02-071-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | The current code for controlling mic mute LED in patch_sigmatel.c blindly assumes that there is a single capture switch. But, there can be multiple multiple ones, and each of them flips the state, ended up in an inconsistent state. For fixing this problem, this patch adds kcontrol to be passed to the hook function so that the callee can check which switch is being accessed. In stac_capture_led_hook(), the state is checked as a bitmask, and turns on the LED when all capture switches are off. Signed-off-by: Takashi Iwai <tiwai@suse.de>
* | ALSA: hda - Make snd_hda_gen_spec_free() staticTakashi Iwai2014-02-101-1/+0
|/ | | | | | | | 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 - Apply codec power_filter to FG nodesTakashi Iwai2014-01-131-0/+3
| | | | | | | Apply the codec->power_filter to the FG nodes in general for reducing hackish set_power_state ops override in patch_sigmatel.c. Signed-off-by: Takashi Iwai <tiwai@suse.de>
* ALSA: hda - Add static DAC/pin mapping for AD1986A codecTakashi Iwai2013-12-111-0/+3
| | | | | | | | | | | | | | | | | | | | AD1986A codec is a pretty old codec and has really many hidden restrictions. One of such is that each DAC is dedicated to certain pin although there are possible connections. Currently, the generic parser tries to assign individual DACs as much as possible, and this lead to two bad situations: connections where the sound actually doesn't work, and connections conflicting other channels. We may fix this by trying to find the best connections more harder, but as of now, it's easier to give some hints for paired DAC/pin connections and honor them if available, since such a hint is needed only for specific codecs (right now only AD1986A, and there will be unlikely any others in future). Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=64971 Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=66621 Cc: <stable@vger.kernel.org> Signed-off-by: Takashi Iwai <tiwai@suse.de>
* ALSA: hda - Introduce the bitmask for excluding output volumeTakashi Iwai2013-11-051-0/+3
| | | | | | | | | | | | | | | Add a bitmask to hda_gen_spec indicating NIDs to exclude from the possible volume controls. That is, when the bit is set, the NID corresponding to the bit won't be picked as an output volume control any longer. Basically this is just a band-aid for working around the issue found with CS4208 codec, where only the headphone pin has a volume AMP with different dB steps. Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=60811 Cc: <stable@vger.kernel.org> [v3.12+] Signed-off-by: Takashi Iwai <tiwai@suse.de>
* ALSA: hda - Fix invalid multi-io creation on VAIO-Z laptopsTakashi Iwai2013-07-291-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | VAIO-Z laptops need to use the specific DAC for the speaker output by some unknown reason although the codec itself supports the flexible connection. So we implemented a workaround by a new flag, no_primary_hp, for assigning the speaker pin first. This worked until 3.8 kernel, but it got broken because the driver learned for a better multi-io pin mapping, and not it can assign two mic pins for multi-io. Since the multi-io requires to be the primary output, the hp and two mic pins are assigned in prior to the speaker in the end. Although the machine has two mic pins, one of them is used as a noise- canceling headphone, thus it's no real retaskable mic jack. Thus, at best, we can disable the multi-io assignment and make the parser behavior back to the state before the multi-io. This patch adds again a new flag, no_multi_io, to indicate that the device has no multi-io capability, and set it in the fixup for VAIO-Z. The no_multi_io flag itself can be used generically, added via a helper line, too. Reported-by: Tormen <my.nl.abos@gmail.com> Reported-by: Adam Williamson <awilliam@redhat.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
* ALSA: hda - Add auto_mute_via_amp flag to generic parserTakashi Iwai2013-06-251-0/+4
| | | | | | | | | | | | | | | | | | | Add a new flag, auto_mute_via_amp, to determine the behavior of the headphone / line-out auto-mute. When this flag is set, the generic driver mutes the speaker and line outputs via the amp mute of each pin, instead of changing the pin control values. This is introduced for devices that don't work expectedly with the pin control values; for example, some devices are known to keep enabling the speaker outputs no matter which pin control values are set on the speaker pins. The driver doesn't check actually whether the pins have the output amp caps, but assumes that the proper mixer (mute) controls are created on all these pins. If not the case, you can't use this flag for your device. 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 - Allow codec drivers to give own badness tablesTakashi Iwai2013-03-221-0/+17
| | | | | | | | | | | 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>
* ALSA: hda - Move beep attach/detach calls in hda_generic.cTakashi Iwai2013-03-181-0/+3
| | | | | | | | | 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>
* ALSA: hda - Avoid automatic pin-ctl update for hp/mic when jack ctl existsTakashi Iwai2013-03-071-0/+1
| | | | | | | | | | | | | | | | | 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>
* ALSA: hda - Consolidate add_in_jack_modes and add_out_jack_modes hintsTakashi Iwai2013-03-071-2/+1
| | | | | | | | | | | 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>
* ALSA: hda - Add the generic Headphone Mic featureTakashi Iwai2013-03-071-1/+5
| | | | | | | | | | | | 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>
* ALSA: hda - Use generic array for loopback list managementTakashi Iwai2013-02-071-2/+1
| | | | Signed-off-by: Takashi Iwai <tiwai@suse.de>
* ALSA: hda - Enable loopback accounts for CONFIG_PM=n, tooTakashi Iwai2013-02-071-2/+1
| | | | | | | | | 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>
* ALSA: hda - Implement path-based power filter to the generic parserTakashi Iwai2013-01-241-0/+1
| | | | | | | | | | 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>
* ALSA: hda - Fix missing path between aamix and outputs in AD codecsTakashi Iwai2013-01-231-0/+2
| | | | | | | | | | | | 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>
* ALSA: hda - Set individual name to secondary analog PCM streamTakashi Iwai2013-01-221-0/+2
| | | | | | | | 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>
* ALSA: hda - Fix conflicts between Loopback Mixing and Independent HPTakashi Iwai2013-01-211-0/+1
| | | | | | | | | | | | | | | | | | | | 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>
* ALSA: hda - Correct more array rooms in hda_gen_specTakashi Iwai2013-01-181-4/+4
| | | | | | | | | Looking through the whole definitions, some fields have inappropriate array sizes, especially about the capture. The array assigned to each input (pin) should have HDA_MAX_NUM_INPUTS entries while the array assigned to each ADC should have AUTO_CFG_MAX_INS entries. Signed-off-by: Takashi Iwai <tiwai@suse.de>
* ALSA: hda - make sure there are enough input labels and pathsDavid Henningsson2013-01-181-3/+3
| | | | | | | | 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>
* ALSA: hda - Consolidate cap_sync_hook and capture_switch_hookTakashi Iwai2013-01-181-4/+2
| | | | | | | | | | | | | | | 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>
* ALSA: hda - Unify input label creations in generic parserTakashi Iwai2013-01-181-0/+2
| | | | | | | | | 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>
* ALSA: hda - Add PCM capture hook to hda_gen_specTakashi Iwai2013-01-171-1/+5
| | | | | | | 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>
* ALSA: hda - Record all detected ADCs in hda_gen_specTakashi Iwai2013-01-171-1/+3
| | | | | | | | | | 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>
* ALSA: hda - Move vmaster TLV parsing to snd_hda_gen_parse_auto_config()Takashi Iwai2013-01-171-0/+1
| | | | | | | | | 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>
* ALSA: hda - Add input jack mode enum controls to generic parserTakashi Iwai2013-01-171-0/+1
| | | | | | | | | | | | | | Just like the jack mode enum ctls for output jacks, add the support for similar enum ctls for input pins to control the bias Vref. The new controls will be added when spec->add_in_jack_modes is set either by the codec driver or by a hint string. Note that ground and 100% vrefs are excluded from the list for simplicity, currently. We may add a new flag to allow them, too. But I guess it's easier to put a value override in the pinfix in such a case. Signed-off-by: Takashi Iwai <tiwai@suse.de>
* ALSA: hda - Give more comments to hda_gen_spec flagsTakashi Iwai2013-01-161-8/+19
| | | | | | | Since we have many bit flags in hda_gen_spec, rearrange in sections and give more comments there. Signed-off-by: Takashi Iwai <tiwai@suse.de>
* ALSA: hda - Add suppress_auto_mute flag to hda_gen_specTakashi Iwai2013-01-161-0/+1
| | | | | | | | A new flag to skip the auto-mute handling in the generic parser, just like suppress_auto_mic flag. It has to be set before calling snd_hda_gen_parse_auto_config(). Signed-off-by: Takashi Iwai <tiwai@suse.de>
* ALSA: hda - Record the current speaker / LO mute status in hda_gen_specTakashi Iwai2013-01-161-0/+2
| | | | | | ... to be referred by the codec driver. Signed-off-by: Takashi Iwai <tiwai@suse.de>
* ALSA: hda - Add prefer_hp_amp flag to hda_gen_specTakashi Iwai2013-01-151-0/+1
| | | | | | | | Add a new flag to indicate whether HP amp is turned on as default for speaker or line-outs, and enable this for ALC260 codec, as many machines with this codec require the HP amp even for speakers. Signed-off-by: Takashi Iwai <tiwai@suse.de>
* ALSA: hda - Add capture_switch_hook to generic parserTakashi Iwai2013-01-141-0/+3
| | | | | | | Add a hook for the capture mixer switch. This will be used by IDT codecs for controlling the mic-mute LED. Signed-off-by: Takashi Iwai <tiwai@suse.de>
* ALSA: hda - Add output jack mode enum controlsTakashi Iwai2013-01-121-0/+1
| | | | | | | | Add the enum controls for changing the headphone amp bits of output jacks, such as "Headphone Jack Mode". This feature isn't enabled as default, so far, unless spec->add_out_jack_modes flag is set. Signed-off-by: Takashi Iwai <tiwai@suse.de>
* ALSA: hda - Allow aamix as a capture sourceTakashi Iwai2013-01-121-0/+1
| | | | | | | | | Since some codecs can choose the aamix as a capture source, we should support it as well. When spec->add_stereo_mix_input flag is set, the parser checks the availability of aamix as the input source, and adds the paths automatically when possible. Signed-off-by: Takashi Iwai <tiwai@suse.de>
* ALSA: hda - Add a flag to suppress mic auto-switchTakashi Iwai2013-01-121-0/+1
| | | | | | | Add a new flag spec->suppress_mic_auto_switch for codecs that don't support unsol events properly like VT1708. Signed-off-by: Takashi Iwai <tiwai@suse.de>
* ALSA: hda - Re-define snd_hda_parse_nid_path()Takashi Iwai2013-01-121-10/+2
| | | | | | | | | | | | This commit modifies the definition of snd_hda_parse_nid_path() slightly, now with_aa_mix argument is changed to anchor_nid, so that it can handle any NID generically as an anchor point to include or exclude. The with_aa_mix field in struct nid_path is removed again by this change. Signed-off-by: Takashi Iwai <tiwai@suse.de>
* ALSA: hda - Manage input paths via path indicesTakashi Iwai2013-01-121-0/+1
| | | | | | | ... like we did for output and loopback paths. It makes the code slightly easier. Signed-off-by: Takashi Iwai <tiwai@suse.de>
* ALSA: hda - Fix multi-io channel mode managementTakashi Iwai2013-01-121-2/+14
| | | | | | | | | | | The multi-io channels can vary not only from 1 to 6 but also may vary from 6 to 8 or such. At the same time, there are more speaker pins available than the primary output pins. So, we need three variables to check: the minimum channel counts for primary outputs, the current channel counts for primary outputs, and the minimum channel counts for all outputs. Signed-off-by: Takashi Iwai <tiwai@suse.de>
* ALSA: hda - Add snd_hda_gen_free() and snd_hda_gen_check_power_status()Takashi Iwai2013-01-121-0/+5
| | | | | | | Just to remove duplicated codes. Also fixed EXPORT_SYMBOL() in hda_generic.c. Signed-off-by: Takashi Iwai <tiwai@suse.de>
* ALSA: hda - Add pcm_playback_hook to hda_gen_specTakashi Iwai2013-01-121-0/+14
| | | | | | | | The new hook which is called at each PCM playback ops. It can be used to control the codec-specific power-saving feature in each codec driver. Signed-off-by: Takashi Iwai <tiwai@suse.de>
* ALSA: hda - Drop bind-volume workaroundTakashi Iwai2013-01-121-3/+0
| | | | | | | | | | | | | | | | | | | | | | | | The bind-volume workaround was introduced for simplifying the mixer abstraction in the case where one or more pins of multiple outputs lack of individual volume controls. This was essentially the case like Acer Aspire 5935, which has 5.1 speakers and 5.1 (multi-io) jacks although there are 5 DACs, so some of them must share a DAC. However, the recent code rewrite changed the DAC assignment policy to share with the same channel instead of binding to the front, thus binding the volumes for all channels makes little sense now, rather it's confusing. So in this patch, the ugly workaround is finally dropped and simply create the volume control corresponding to the parsed path position. For dual headphones or 2.1 speakers with a shared volume control, it's anyway bound to the same DAC if needed, so this change shouldn't bring any practical difference. And, as a good bonus, we can cut off the whole code handling the bind volume elements. Signed-off-by: Takashi Iwai <tiwai@suse.de>
* ALSA: hda - Add Loopback Mixing controlTakashi Iwai2013-01-121-0/+4
| | | | | | | | | | | | | | For codecs that have individual routes going through a loopback mixer (like VIA codecs), we need to provide an explicit switch to choose whether the output goes through mixer or directly from DAC. This patch adds the check for such paths and creates "Loopback Mixing" enum control when available. It won't influence on codecs like Realtek or others where the loopback mixer is connected independently from the primary output routes. Signed-off-by: Takashi Iwai <tiwai@suse.de>
* ALSA: hda - Initialize digital-input path properlyTakashi Iwai2013-01-121-0/+1
| | | | | | | | Call the path activation for the digital input pin properly, not only setting the pin control. Also add spec->digin_path for keeping the path index. Signed-off-by: Takashi Iwai <tiwai@suse.de>
* ALSA: hda - Manage using output/loopback path indicesTakashi Iwai2013-01-121-0/+9
| | | | | | | | | | | | | | | Instead of search for the path with the certain route at each time, keep the path index for each output and loopback, and just use it when referred. In this implementation, the path index number begins with one, not zero (although I've been writing in C over decades). It's just to make the check for uninitialized values easier. So far, the input paths aren't handled with indices yet, but still picked up via snd_hda_get_nid_path() at each time. Signed-off-by: Takashi Iwai <tiwai@suse.de>
* ALSA: hda - Check the existing path in snd_hda_add_new_path()Takashi Iwai2013-01-121-0/+1
| | | | | | | If the requested path has been already added, return the existing path instance instead of adding a duplicated instance. Signed-off-by: Takashi Iwai <tiwai@suse.de>