Commit graph

5171 commits

Author SHA1 Message Date
Takashi Iwai e36e3b86c7 ALSA: Implement channel maps for standard onboard AC97 drivers
Just set the channel maps depending on the hardware availability.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2012-09-06 18:08:31 +02:00
Takashi Iwai 833a493b7e ALSA: ac97: Implement channel map workaround for ALC650
ALC650 has a channel swap option between surround and CLFE channels,
so we need to tweak the channel maps dynamically depending on the
register bit.

Now struct snd_ac97 can contain chmap pointers for playback and
capture.  The driver may store these and let ac97 driver changing the
channel mapping dynamically.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2012-09-06 18:08:30 +02:00
Takashi Iwai 53775b0d0c ALSA: hda - Fix channel maps for Nvidia 7x 8ch HDMI codecs
Some old Nvidia HDMI codecs with 8ch support only 2/8 or
2/6/8 channels and with the fixed CLFE-first map.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2012-09-06 18:08:30 +02:00
Takashi Iwai d45e6889ee ALSA: hda - Provide the proper channel mapping for generic HDMI driver
... instead of the standard fixed channel maps.
The generic HDMI is based on the audio infoframe, and its configuration
can be selected via CA bits.  Thus we need a translation between the
CA index and the verbose channel map list.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2012-09-06 18:08:26 +02:00
Takashi Iwai 9c9a5175e6 ALSA: hda - Add standard channel maps
Although HD-audio allows pair-wise channel configurations, only the
fixed channel positions are used in this version.  In future, this can
be changed and allow user to modify the channel positions.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2012-09-06 18:01:18 +02:00
Takashi Iwai 1a6003b525 ALSA: hda - Move non-PCM check to per_pin in patch_hdmi.c
Recently the check for non-PCM stream state was added to the generic
HDMI driver code.  But this check should be done rather to each pin
instead of each converter.  Otherwise when a different converter is
assigned at the next open, the audio infoframe can be inconsistent
with the setup using the previous converter.

For fixing this issue, this patch moves the state of the current
non-PCM status from per_cvt to per_pin.  (In addition an unused
argument cvt_nid is stripped from hdmi_setup_channel_mapping())

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2012-09-06 17:59:19 +02:00
David Henningsson 298efee7f5 ALSA: hda - fix control names for multiple speaker out on IDT/STAC
For multiple speaker outs, the names were previously
"Speaker,0", "Speaker,1", "Center"/"LFE", "Speaker,3". This is
inconsistent, confusing, and is not picked up correctly by PulseAudio.
Instead use "Front", "Surround", "Center"/"LFE", "Side" which
is more standard.

BugLink: https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1046734
Signed-off-by: David Henningsson <david.henningsson@canonical.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2012-09-06 12:01:55 +02:00
Wang Xingchao 2d7e887cbb ALSA: HDMI - Setup channel mapping for non_pcm audio
For HBR stream test, use straight channel mapping way.
when switched back to "speaker-test -c8", even the audio
infoframe is up-to-date, there should be correct channel mapping setup.

Signed-off-by: Wang Xingchao <xingchao.wang@intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2012-09-06 08:50:35 +02:00
Wang Xingchao 433968da4d ALSA: HDMI - Enable HBR feature on Intel chips
HDMI channel remapping apparently effects HBR packets on Intel's chips.
For compressed non-PCM audio, use "straight-through" channel mapping.
For uncompressed multi-channel pcm audio, use normal channel mapping.

Signed-off-by: Wang Xingchao <xingchao.wang@intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2012-09-06 08:50:33 +02:00
Wang Xingchao 72357c78b7 ALSA: HDMI - Fix channel_allocation array wrong order
The array channel_allocations[] is an ordered list, add function to get
correct order by ca_index.

Signed-off-by: Wang Xingchao <xingchao.wang@intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2012-09-06 08:50:31 +02:00
Wei Yongjun 292f2b6254 ALSA: emu10k1: use list_move_tail instead of list_del/list_add_tail
Using list_move_tail() instead of list_del() + list_add_tail().

Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2012-09-05 09:15:12 +02:00
Takashi Iwai d819387ef7 ALSA: hda - Clean up redundant FG checks
Just refactoring, no functional changes.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2012-08-31 07:58:28 -07:00
Takashi Iwai 08fa20ae20 ALSA: hda - Yet another fix for D3 stop-clock refcounting
The call of pm_notify callback in snd_hda_codec_free() should be with
the check of the current state whether pm_notify(false) is called or
not, instead of codec->power_on check.

For improving the code readability and fixing this inconsistency,
codec->d3_stop_clk_ok is renamed to codec->pm_down_notified, and this
flag is set only when runtime PM down is called.  The new name reflects
to a more direct purpose of the flag.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2012-08-31 07:50:28 -07:00
Takashi Iwai 5a798394c8 ALSA: cs5530: Fix resource leak in error path
Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=44741

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2012-08-30 13:21:00 -07:00
Takashi Iwai fbaf6a5a35 ALSA: korg1212: Fix reverted min/max ADC sense range
k1212MinADCSens and k1212MaxADCSens are defined wrongly.
The max must be greater than the min by obvious reason.

Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=46561

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2012-08-30 07:57:38 -07:00
Takashi Iwai 4b927345a3 ALSA: hda - Optimize bitfield usage in struct hda_codec
Move up a few bitfields to be packed into a single int.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2012-08-30 07:50:40 -07:00
Takashi Iwai 83012a7ccb ALSA: hda - Clean up CONFIG_SND_HDA_POWER_SAVE
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>
2012-08-30 07:50:13 -07:00
Takashi Iwai 432c641e01 ALSA: hda - Fix D3 clock stop check for codecs with own set_power_state op
When a codec provides its own set_power_state op, the D3-clock-stop
isn't checked correctly.  And the recent changes for repeating the
state-setting operation isn't applied to such a codec, too.

This patch fixes these issues by moving the call of codec's own op to
the place where the generic power-set operation is done, and move the
power-state synchronization code out of
snd_hda_set_power_state_to_all() so that it can be called always at
the end of power-up/down sequence, and updates the D3 clock-stop flag
properly.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2012-08-30 07:48:55 -07:00
Takashi Iwai 68467f51c1 ALSA: hda - Fix runtime PM leftover refcounts
When the HD-audio is removed, it leaves the refcounts when codecs are
powered up (usually yes) in the destructor.  For fixing the unbalance,
and cleaning up the code mess, this patch changes the following:
- change pm_notify callback to take the explicit power on/off state,
- check of D3 stop-clock and keep_link_on flags is moved to the caller
  side,
- call pm_notify callback in snd_hda_codec_new() and snd_hda_codec_free()
  so that the refcounts are proprely updated.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2012-08-30 07:48:49 -07:00
Takashi Iwai a184d4e459 Merge branch 'for-linus' into for-next
Need to merge the fixes regarding EPSS.

Conflicts:
	sound/pci/hda/hda_codec.c
2012-08-28 09:26:59 -07:00
Takashi Iwai c36b5b054a ALSA: hda - Don't trust codec EPSS bit for IDT 92HD83xx & co
These codecs seem reporting EPSS but require longer delay for the
proper D3 transition.  For example, D3_STOP_CLOCK_OK bit won't be set
correctly even after D3.

In this patch, codec->epss flag is overridden for avoid the
misbehavior.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2012-08-28 09:26:16 -07:00
Takashi Iwai 983f6b9381 ALSA: hda - Avoid unnecessary parameter read for EPSS
EPSS parameter should be static, so we can read it once and remember.
This also allows more easily to override the wrong EPSS capability
reported from a codec by changing the flag in the codec
initialization step.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2012-08-28 09:25:57 -07:00
Takashi Iwai 5d908ab941 ALSA: hda - Make clear built-in driver optimization
Use unsigned int to make clear that the codes required only for
modules will be reduced by the compiler optimization.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2012-08-28 09:12:09 -07:00
Markus Bollinger 8c3f1b1cbc ALSA: pcxhr: Add 8 new sound cards
add new sound cards VX442HR VX442e PCX442HR PCX442e VX822HR VX822e PCX822HR and PCX822e

Signed-off-by: Markus Bollinger <bollinger@digigram.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2012-08-27 16:10:29 +02:00
Mengdong Lin 5d6147f101 ALSA: hda - bug fix on references without checking CONFIG_SND_HDA_POWER_SAVE
The patch to support runtime PM introduced a bug:
Module parameter 'power_save_controller', and the codec flag 'd3_stop_clk'
'd3_stop_clk_ok' are defined only when HDA power save is enabled in config. But
there are references to them without checking macro CONFIG_SND_HDA_POWER_SAVE.

This patch is to fix the bug.

Signed-off-by: Mengdong Lin <mengdong.lin@intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2012-08-24 07:22:42 +02:00
Mengdong Lin b8dfc46241 ALSA: hda - add runtime PM support
Runtime PM can bring more power saving:
- When the controller is suspended, its parent device will also have a chance
  to suspend.
- PCI subsystem can choose the lowest power state the controller can signal
  wake up from. This state can be D3cold on platforms with ACPI PM support.
And runtime PM can provide a gerneral sysfs interface for a system policy
manager.

Runtime PM support is based on current HDA power saving implementation. The user
can enable runtime PM on platfroms that provide acceptable latency on transition
from D3 to D0.

Details:
- When both power saving and runtime PM are enabled:
  -- If a codec supports 'stop-clock' in D3, it will request suspending the
     controller after it enters D3 and request resuming the controller before
     back to D0. Thus the controller will be suspended only when all codecs are
     suspended and support stop-clock in D3.
  -- User IO operations and HW wakeup signal can resume the controller back to
     D0.
- If runtime PM is disabled, power saving just works as before.
- If power saving is disabled, the controller won't be suspended because the
  power usage counter can never be 0.

More about 'stop-clock' feature:
If a codec can support targeted pass-through operations in D3 state when there
is no BCLK present on the link, it will set CLKSTOP flag in the supported power
states and report PS-ClkStopOk when entering D3 state. Please refer to HDA spec
section 7.3.3.10 Power state and 7.3.4.12 Supported Power State.

[Fixed CONFIG_PM_RUNTIME dependency in hda_intel.c by tiwai]

Signed-off-by: Mengdong Lin <mengdong.lin@intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2012-08-23 14:21:32 +02:00
Takashi Iwai 8a5354140a ALSA: hda - Call snd_hda_jack_report_sync() generically in hda_codec.c
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>
2012-08-22 16:48:17 +02:00
David Henningsson 042b92c185 ALSA: hda - Do not set GPIOs for speakers on IDT if there are no speakers
This fixes an issue with a machine where there were no speakers,
but GPIO0 had to be data=1 for the headphone to be functioning.

I'm not sure if we need a more advanced patch to solve all possible cases,
but if so, this patch would still provide a minor optimisation.

BugLink: https://bugs.launchpad.net/bugs/1040077
Signed-off-by: David Henningsson <david.henningsson@canonical.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2012-08-22 16:26:05 +02:00
Takashi Iwai ddf83485d7 Merge branch 'for-linus' into for-next
Conflicts:
	sound/pci/hda/hda_codec.c

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2012-08-20 22:14:26 +02:00
Takashi Iwai 535b6c51fe ALSA: hda - Fix leftover codec->power_transition
When the codec turn-on operation is canceled by the immediate
power-on, the driver left the power_transition flag as is.
This caused the persistent avoidance of power-save behavior.

Cc: <stable@vger.kernel.org> [v3.5+]
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2012-08-20 21:25:22 +02:00
Takashi Iwai 099d53c308 ALSA: hda - Add missing ifdef CONFIG_SND_HDA_POWER_SAVE to tracepoints
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2012-08-20 18:04:40 +02:00
Takashi Iwai 65fcd41d37 ALSA: hda - Check the power state when power_save option is changed
... by calling the newly introduced snd_hda_power_sync().

I had to reimplement a wheel for adding the trigger at changing the
parameter -- the parameter set ops is overwritten to pass the integer
parameter, then trigger the power-state sync.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2012-08-20 11:46:06 +02:00
Takashi Iwai c376e2c72b ALSA: hda - Implement snd_hda_power_sync() helper function
Added a new helper function snd_hda_power_sync() to trigger the
power-saving manually.  It's an inline function call to
snd_hda_power_save() helper function.

Together with this addition, snd_hda_power_up*() and
snd_hda_power_down() functions are inlined to a call of the same
snd_hda_power_save() helper function.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2012-08-20 11:46:05 +02:00
Takashi Iwai fa2f5bf096 Merge branch 'topic/ca0132-fix' into for-linus
This is a series of fixes for CA0132, especially the missing SPDIF I/O
and the mixer build errors.
2012-08-20 11:38:31 +02:00
David Henningsson c41999a239 ALSA: hda - don't create dysfunctional mixer controls for ca0132
It's possible that these amps are settable somehow, e g through
secret codec verbs, but for now, don't create the controls (as
they won't be working anyway, and cause errors in amixer).

Cc: stable@kernel.org
BugLink: https://bugs.launchpad.net/bugs/1038651
Signed-off-by: David Henningsson <david.henningsson@canonical.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2012-08-20 11:33:23 +02:00
Takashi Iwai b244d33560 ALSA: hda - Add tracepoints at snd_hda_power_up/down entrances.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2012-08-20 11:24:29 +02:00
Julia Lawall b17cbdd85f ALSA: sound/pci/rme9652/hdspm.c: fix error return code
Convert a nonnegative error return code to a negative one, as returned
elsewhere in the function.

A simplified version of the semantic match that finds this problem is as
follows: (http://coccinelle.lip6.fr/)

// <smpl>
(
if@p1 (\(ret < 0\|ret != 0\))
 { ... return ret; }
|
ret@p1 = 0
)
... when != ret = e1
    when != &ret
*if(...)
{
  ... when != ret = e2
      when forall
 return ret;
}

// </smpl>

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2012-08-20 11:00:51 +02:00
Julia Lawall ae970eb45d ALSA: sound/pci/sis7019.c: fix error return code
Initialize rc before returning on failure, as done elsewhere in the
function.

A simplified version of the semantic match that finds this problem is as
follows: (http://coccinelle.lip6.fr/)

// <smpl>
(
if@p1 (\(ret < 0\|ret != 0\))
 { ... return ret; }
|
ret@p1 = 0
)
... when != ret = e1
    when != &ret
*if(...)
{
  ... when != ret = e2
      when forall
 return ret;
}

// </smpl>

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2012-08-20 10:57:51 +02:00
Julia Lawall 4d8ce1c996 ALSA: sound/pci/ctxfi/ctatc.c: fix error return code
Initialize err before returning on failure, as done elsewhere in the
function.

A simplified version of the semantic match that finds this problem is as
follows: (http://coccinelle.lip6.fr/)

// <smpl>
(
if@p1 (\(ret < 0\|ret != 0\))
 { ... return ret; }
|
ret@p1 = 0
)
... when != ret = e1
    when != &ret
*if(...)
{
  ... when != ret = e2
      when forall
 return ret;
}

// </smpl>

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2012-08-20 10:57:30 +02:00
David Henningsson 5e68fb3cab ALSA: hda - Don't send invalid volume knob command on IDT 92hd75bxx
Instead of blindly initializing a volume knob widget, first check
that there actually is a volume knob widget.

Signed-off-by: David Henningsson <david.henningsson@canonical.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2012-08-16 14:14:56 +02:00
Takashi Iwai 1c86845268 ALSA: hda - Add 3stack-automute model to AD1882 codec
Added a simple support of automute for the front HP jack to AD1882
stack model.  Such an addition is basically an exception -- we really
want to avoid the static quirk codes, but AD1882 parser isn't still
ready for moving to the BIOS auto-parser yet.  So, as a quick fix, I
merged it for now.

In near future, we really need the big clean up of patch_analog.c to
move on to the auto-parser...

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2012-08-15 11:50:05 +02:00
Takashi Iwai c7561cd804 ALSA: PCI: Replace CONFIG_PM with CONFIG_PM_SLEEP
Otherwise we may get compile warnings due to unused functions.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2012-08-14 18:12:04 +02:00
Takashi Iwai 7ccbde57ce ALSA: hda - Fix possible compile warnings regarding CONFIG_PM
Replace with a proper ifdef check of CONFIG_PM_SLEEP in hda_intel.c.
But other places in HD-audio driver are still marked with CONFIG_PM,
since these can be called for power-saving even without
CONFIG_PM_SLEEP.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2012-08-14 18:11:51 +02:00
Takashi Iwai 3bdcff70b6 ALSA: lx6464es: Add a missing error check
Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=44541

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2012-08-14 17:42:11 +02:00
David Henningsson 265d931a9e ALSA: hda - Fix 'Beep Playback Switch' with no underlying mute switch
Some Conexant devices (e g CX20590) have no mute capability on
their Beep widgets.
This patch makes sure we don't try setting mutes on those widgets.

Signed-off-by: David Henningsson <david.henningsson@canonical.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2012-08-14 10:22:31 +02:00
Wang Xingchao 088c820b73 ALSA: hda - fix Copyright debug message
As spec said, 1 indicates no copyright is asserted.

Signed-off-by: Wang Xingchao <xingchao.wang@intel.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2012-08-13 10:02:01 +02:00
Wang Xingchao 6152597971 ALSA: hda - show ICT/KAE control bits
Enable two debug options for S/PDIF Converter Control.
KAE: Keep Alive Enable; ICT: IEC Coding Type.

Signed-off-by: Wang Xingchao <xingchao.wang@intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2012-08-13 10:01:29 +02:00
Mengdong Lin e037cb4a54 ALSA : hda - bug fix on checking the supported power states of a codec
The return value of snd_hda_param_read() is -1 for an error, otherwise
it's the supported power states of a codec.

The supported power states is a 32-bit value. Bit 31 will be set to 1
if the codec supports EPSS, thus making "sup" negative. And the bit
28:5 is reserved as "0".
So a negative value other than -1 shall be further checked.

Please refer to High-Definition spec 7.3.4.12 "Supported Power
States", thanks!

Signed-off-by: Mengdong Lin <mengdong.lin@intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2012-08-10 14:11:58 +02:00
David Henningsson 14bc9c6dc6 ALSA: hda - Fix panned "Beep Playback Switch"
When "Beep Playback Switch" had a different value on left and right
channels (such as muting left but not right, or vice versa), this
could result in the right channel being ignored.

This patch enables beep to be sounding from right channel only, and
also give correct result back to userspace (e g amixer).

Signed-off-by: David Henningsson <david.henningsson@canonical.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2012-08-10 14:10:20 +02:00
Dan Carpenter de64c0ee7d ALSA: cs46xx - signedness bug in snd_cs46xx_codec_read()
This function returns its own error codes instead of normal negative
error codes.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2012-08-10 12:11:21 +02:00