Commit graph

298 commits

Author SHA1 Message Date
Takashi Iwai 0b6267376d ALSA: hda - Use snd_printd() in snd_hda_parse_pin_def_config()
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-26 14:10:44 +02:00
David Henningsson 07acecc111 ALSA: HDA: Add jack detection for HDMI
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-19 12:00:50 +02:00
Takashi Iwai dda144103c ALSA: hda - Constify some API function arguments
Also fixed the assignment of multiout.dac_nids to satisfy const.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2011-05-02 12:07:48 +02:00
Takashi Iwai 031024eea8 ALSA: hda - Constify some API function arguments
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2011-05-02 11:29:30 +02:00
Takashi Iwai a3ea8e8f24 Merge branch 'fix/hda' into topic/hda 2011-05-02 10:41:40 +02:00
Takashi Iwai c2de187e5b ALSA: hda - Show the line-out type in snd_hda_parse_pin_def_config()
Helpful for debugging.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2011-04-29 13:01:33 +02:00
Takashi Iwai 31d44b57c5 Merge branch 'fix/hda' into topic/hda 2011-04-26 15:05:39 +02:00
Takashi Iwai 6a9a6f233b Merge branch 'fix/hda' into for-linus 2011-04-21 12:44:38 +02:00
Mike Waychison 1c7276cfc0 ALSA: hda - Fix unused warnings when !SND_HDA_NEEDS_RESUME
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-20 21:24:31 +02:00
Andrew Morton 5b17b077eb ALSA: hda - sound/pci/hda/hda_codec.c: fix warning
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-15 08:41:22 +02:00
Takashi Iwai a12d3e1e1c ALSA: hda - Remember connection lists
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-04-07 15:55:15 +02:00
Lucas De Marchi 25985edced Fix common misspellings
Fixes generated by 'codespell' and manually reviewed.

Signed-off-by: Lucas De Marchi <lucas.demarchi@profusion.mobi>
2011-03-31 11:26:23 -03:00
Takashi Iwai cd372fb3be ALSA: hda - Make common input-jack helper functions
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-03-03 14:40:14 +01:00
Takashi Iwai ea73496324 ALSA: hda - consitify string arrays
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2011-01-18 07:43:17 +01:00
Takashi Iwai b2d0576055 ALSA: hda - Fix multi-headphone handling for Realtek codecs
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>
2011-01-10 14:51:32 +01:00
Takashi Iwai 1afe206ab6 ALSA: hda - Try to find an empty control index when it's occupied
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-12-23 10:22:55 +01:00
Takashi Iwai 0e7adbe263 ALSA: hda - Disable sticky PCM stream assignment for AD codecs
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-25 10:39:23 +02:00
Takashi Iwai 62b7e5e09b ALSA: hda - Add workarounds for CT-IBG controllers
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-22 17:15:47 +02:00
Takashi Iwai c08d91695b ALSA: tlv - Define numbers in sound/tlv.h
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2010-10-17 10:46:14 +02:00
Clemens Ladisch de8c85f784 ALSA: HDA: Sigmatel: work around incorrect master muting
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-10-17 10:45:30 +02:00
Takashi Iwai 9e5341b92d ALSA: hda - Introduce hda_call_check_power_status() helper
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-21 10:00:03 +02:00
Takashi Iwai 99ae28bea9 ALSA: hda - Make snd_hda_get_input_pin_attr() helper
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-17 14:42:34 +02:00
Takashi Iwai 41c89ef3aa ALSA: hda - Fix mic attribute check for internal mics
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-17 10:28:20 +02:00
Takashi Iwai 4a4d4a6985 ALSA: hda - Sort input pins in snd_hda_parse_pin_def_config()
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-09 22:22:02 +02:00
Takashi Iwai 990061c28a ALSA: hda - Add comments to new helper functions
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2010-09-09 22:08:44 +02:00
Takashi Iwai a1c9851583 ALSA: hda - Reduce redundant mic location prefix in input source labels
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-09 21:36:27 +02:00
Takashi Iwai 10a20af7c9 ALSA: hda - Improve the input source name labels
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>
2010-09-09 16:46:03 +02:00
Takashi Iwai 86e2959a10 ALSA: hda - Remove AUTO_PIN_FRONT_{MIC|LINE}
We can assign multiple pins to a single role now, let's reduce the
redundant FRONT_MIC and FRONT_LINE.  Also, autocfg->input_pins[] is
no longer used, so this is removed as well.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2010-09-09 16:46:01 +02:00
Takashi Iwai b5786e85cb ALSA: hda - Keep char arrays in input_mux items
Keep char array in the input_mux item itself instead of pointing to
an external string.  This is a preliminary work for improving the
input-mux name based on the pin role.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2010-09-09 16:45:58 +02:00
Takashi Iwai 03642c9a44 ALSA: hda - Clear left-over hp_pins in snd_hda_parse_pin_def_config()
In snd_hda_parse_def_config(), some unused values may remain in hp_pins[]
array during the headphone-reassignment workaround.  This patch clears
the unused array members.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2010-09-08 15:30:20 +02:00
Takashi Iwai eb7f80c179 Merge branch 'fix/hda' into topic/hda 2010-09-08 15:28:03 +02:00
Takashi Iwai 122661b678 ALSA: hda - Fix wrong HP pin detection in snd_hda_parse_pin_def_config()
snd_hda_parse_pin_def_config() has some workaround for re-assigning
some pins declared as headphones to line-outs.  This didn't work properly
for some cases because it used memmove() stupidly wrongly.

Reference: Novell bnc#637263
	https://bugzilla.novell.com/show_bug.cgi?id=637263

Cc: <stable@kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2010-09-08 14:59:26 +02:00
Takashi Iwai d7b1ae9d88 ALSA: hda - Add snd_hda_get_input_pin_label() helper function
Added snd_hda_get_input_pin_label() helper function to return the
string that can be used for control or capture-source ids.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2010-08-30 13:00:16 +02:00
Takashi Iwai 75e0eb24ee ALSA: hda - Add inputs[] to auto_pin_cfg struct
Added the new fields to contain all input-pins to struct auto_pin_cfg.
Unlike the existing input_pins[], this array contains all input pins
even if the multiple pins are assigned for a single role (i.e. two
front mics).  The former input_pins[] still remains for a while, but
will be removed in near future.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2010-08-30 12:56:55 +02:00
Takashi Iwai 3f50ac6a0e ALSA: hda - Fix stream and channel-ids codec-bus wide
The new sticky PCM parameter introduced the delayed clean-ups of
stream- and channel-id tags.  In the current implementation, this check
(adding dirty flag) and actual clean-ups are done only for the codec
chip.  However, with HD-audio architecture, multiple codecs can be
on a single bus, and the controller assign stream- and channel-ids in
the bus-wide.

In this patch, the stream-id and channel-id are checked over all codecs
connected to the corresponding bus.  Together with it, the mutex is
moved to struct hda_bus, as this becomes also bus-wide.

Reported-and-tested-by: Stephen Warren <swarren@nvidia.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2010-08-20 09:49:42 +02:00
Takashi Iwai f0cea79724 ALSA: hda - Fix dynamic ADC change working again
The commit eb541337b7
    ALSA: hda - Make converter setups sticky
changes the semantics of snd_hda_codec_cleanup_stream() not to clean up
the stream at that moment but delay the action.  This broke the codes
expecting that the clean-up is done immediately, such as dynamic ADC
changes in some codec drivers.

This patch fixes the issue by introducing a lower helper,
__snd_hda_codec_cleanup_stream(), to allow the immediate clean up.
The original snd_hda_codec_cleanup_stream() is kept as is now.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2010-08-13 11:56:53 +02:00
Takashi Iwai eb541337b7 ALSA: hda - Make converter setups sticky
So far, we reset the converter setups like the stream-tag, the
channel-id and format-id in prepare callbacks, and clear them in
cleanup callbacks.  This often causes a silence of the digital
receiver for a couple of seconds.

This patch tries to delay the converter setup changes as much as
possible.  The converter setups are cached and aren't reset as long
as the same values are used.  At suspend/resume, they are cleared
to be recovered properly, too.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2010-08-06 13:48:11 +02:00
Takashi Iwai 74bf40f079 Merge branch 'topic/misc' into for-linus 2010-08-05 11:17:04 +02:00
Takashi Iwai 92f10b3f5d ALSA: hda - Define AC_FMT_* constants
Define constants for the HD-audio stream format bits, and replace the
magic numbers in codes.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2010-08-03 14:21:00 +02:00
Anssi Hannula 32c168c892 ALSA: hda - Set Stream Type in Stream Format according to AES0
Set bit 15 (Stream Type) of HDA Stream Format to 1 (Non-PCM) when IEC958
channel status bit 1 (AES0 & 0x02) is set to 1 (non-audio).

This is a prequisite for HDMI HBR passthrough.

Signed-off-by: Anssi Hannula <anssi.hannula@iki.fi>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2010-08-03 12:53:27 +02:00
Takashi Iwai 5aacc2186c ALSA: hda - Make error messages more verbose
Add a prefix and more information for error messages regarding the
connection-list in hda_codec.c.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2010-07-30 10:36:29 +02:00
Takashi Iwai 7ccc3eface ALSA: hda - Fix max amp cap calculation for IDT/STAC codecs
The commit afbd9b8448
    ALSA: hda - Limit the amp value to write
introduced a regression for codec setups with amp offsets like IDT/STAC
codecs.  The limit value should be a raw value without offset calculation.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2010-07-26 17:00:15 +02:00
Jaroslav Kysela cd7643bfb7 ALSA: hda-intel - fix function_id rework (add missing bitmask)
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2010-07-20 12:13:25 +02:00
Jaroslav Kysela 79c944ad13 ALSA: hda-intel - do not mix audio and modem function IDs
The function IDs are different for audio and modem. Do not mix them.
Also, show the unsolicited bit in the function_id register.

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2010-07-19 16:46:56 +02:00
Takashi Iwai f8fb27bd4a Merge branch 'fix/hda' into topic/hda 2010-07-09 10:09:00 +02:00
Takashi Iwai afbd9b8448 ALSA: hda - Limit the amp value to write
Check the amp max value at put callbacks and set the upper limit
so that the driver won't write any invalid value over the defined
range.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2010-07-09 10:08:57 +02:00
Takashi Iwai ac0547dc62 ALSA: hda - Restore cleared pin controls on resume
Many codecs now clear the pin controls at suspend via snd_hda_shutup_pins()
for reducing the click noise at power-off.  But this leaves some pins
uninitialized, and they'll be never recovered after resume.

This patch adds the proper recovery of cleared pin controls on resume.
Also it adds a check of bus->shutdown so that pins won't be cleared at
module unloading.

Reference: Kernel bug 16339
	http://bugzilla.kernel.org/show_bug.cgi?id=16339

Cc: <stable@kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2010-07-09 08:42:29 +02:00
Takashi Iwai a68d5a5419 ALSA: hda - introduce snd_hda_codec_update_cache()
Add a new helper, snd_hda_codec_update_cache(), for reducing the unneeded
verbs.  This function checks the cached value and skips if it's identical
with the given one.  Otherwise it works like snd_hda_codec_write_cache().

The alc269 code uses this function as an example.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2010-03-30 18:03:44 +02:00
Takashi Iwai 4671264608 ALSA: hda - Report errors when invalid values are passed to snd_hda_amp_*()
The values should be in 8 bits.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2010-03-29 09:20:39 +02:00
Kailang Yang 6ff86a3f33 ALSA: hda - Take internal mic as Front Mic
Add new check for MIC. Do the internal DMIC as the Front MIC.
It could solve the default record source index issue.

[Fix the check properly using the bitmask by tiwai]

Signed-off-by: Kailang Yang <kailang@realtek.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2010-03-19 11:14:36 +01:00