1
0
Fork 0
Commit Graph

7043 Commits (49bdb0440541ad1144ad08d5613f9a28bcd2a8dc)

Author SHA1 Message Date
Takashi Iwai 49fb189725 ALSA: hda - Set stream_pm ops automatically by generic parser
This allows user to test power_save_node feature via sysfs or patch
firmware even on the codecs that don't specify it.  It'll also save a
few lines.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-05-27 08:39:27 +02:00
Takashi Iwai e42e748efd ALSA: lx6464es: Use NULL for pointers
Spotted by sparse:
  sound/pci/lx6464es/lx6464es.c:415:47: warning: Using plain integer as NULL pointer
  sound/pci/lx6464es/lx6464es.c:417:48: warning: Using plain integer as NULL pointer

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-05-26 13:00:00 +02:00
Takashi Iwai 1983126f97 ALSA: lx6464es: Fix duplicated SSID entries
PCI_DEVICE() macro itself defines SSID entries while we override them
after that.  Replace with a more appropriate macro, PCI_DEVICE_SUB()
to define all ID values properly.

Spotted by sparse:
  sound/pci/lx6464es/lx6464es.c:60:11: warning: Initializer entry defined twice
  sound/pci/lx6464es/lx6464es.c:61:12:   also defined here
  sound/pci/lx6464es/lx6464es.c:64:11: warning: Initializer entry defined twice
  sound/pci/lx6464es/lx6464es.c:65:12:   also defined here

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-05-26 13:00:00 +02:00
Kailang Yang 823245026e ALSA: hda/realtek - Add ALC256 alias name for Dell
Add ALC3246 for Dell platform.

Signed-off-by: Kailang Yang <kailang@realtek.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-05-26 08:30:38 +02:00
Takashi Iwai 3530febb5c Revert "ALSA: hda - Add mute-LED mode control to Thinkpad"
This reverts commit 7290006d8c.

Through the regression report, it was revealed that the
tpacpi_led_set() call to thinkpad_acpi helper doesn't only toggle the
mute LED but actually mutes the sound.  This is contradiction to the
expectation, and rather confuses user.

According to Henrique, it's not trivial to judge which TP model
behaves "LED-only" and which model does whatever more intrusive, as
Lenovo's implementations vary model by model.  So, from the safety
reason, we should revert the patch for now.

Reported-by: Martin Steigerwald <martin@lichtvoll.de>
Cc: Pali Rohár <pali.rohar@gmail.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-05-24 08:32:37 +02:00
Takashi Iwai 219f47e4f9 ALSA: hda - Disable widget power-saving for ALC292 & co
We've got reports that ALC3226 (a Dell variant of ALC292) gives click
noises at transition from D3 to D0 when the widget power-saving is
enabled.  Further debugging session showed that avoiding it isn't
trivial, unfortunately, since paths are basically activated
dynamically while the pins have been already enabled.

This patch disables the widget power-saving for such codecs.

Reported-by: Jonathan McDowell <noodles@earth.li>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-05-20 06:56:23 +02:00
Takashi Iwai 48f4b3a2ec ALSA: hda - Reduce verbs by node power-saves
The widget (node) power-saves restore the widget states at each
transition from D3 to D0 on each node.  This was added in the commit
[d545a57c5f84:ALSA: hda - Sync node attributes at resume from widget
power saving].  However, the test was rater false-positive; this
wasn't needed for any codecs.

Since the resync may take significant number of additional verbs to be
executed, it's better to reduce it.  Let's disable it for now again.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-05-20 06:49:37 +02:00
Mengdong Lin 98d8fc6c5d ALSA: hda - Move hda_i915.c from sound/pci/hda to sound/hda
The file is moved to hda core and renamed to hdac_i915.c, so can be used
by both legacy HDA driver and new Skylake audio driver.

- Add snd_hdac_ prefix to the public APIs.
- The i915 audio component is moved to core bus and dynamically allocated.
- A static pointer hdac_acomp is used to help bind/unbind callbacks to get
  this component, because the sound card's private_data is used by the azx
  chip pointer, which is a legacy structure. It could be removed if private
  _data changes to some core structure which can be extended to find the
  bus.
- snd_hdac_get_display_clk() is added to get the display core clock for
  HSW/BDW.
- haswell_set_bclk() is moved to hda_intel.c because it needs to write the
  controller registers EM4/EM5, and only legacy HD-A needs it for HSW/BDW.
- Move definition of HSW/BDW-specific registers EM4/EM5 to hda_register.h
  and rename them to HSW_EM4/HSW_EM5, because other HD-A controllers have
  different layout for the extended mode registers.

Signed-off-by: Mengdong Lin <mengdong.lin@intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-05-20 06:16:36 +02:00
Takashi Iwai b016951e89 ALSA: hda - Add headset-mode* model options for ALC269 & co
Modern machines tend to have only one headset jack nowadays, and they
often need these quirks.  Let's allow them applicable via model
option for ease of debugging.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-05-19 10:20:13 +02:00
Gabriele Martino d5c016b56c ALSA: hda/ca0132: support for Alienware 15 Creative Sound Core3D-EX
This patch adds quirks detection to the Creative CA0132 codec, and the
quirk for Alienware 15 (2015).
Some quirks may need different pin configuration, so the relevant
compile-time configuration has been removed.
The pin configuration and related initialization verbs are generated at
runtime instead, in ca0132_config() and ca0132_prepare_verbs().

Signed-off-by: Gabriele Martino <g.martino@gmx.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-05-19 06:58:26 +02:00
Libin Yang 785d8c4be8 ALSA: hda - add hda_intel_trace.h
This patch creates hda_intel_trace.h to add some pm trace functions
used in hda_intel.c

Signed-off-by: Libin Yang <libin.yang@intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-05-18 10:06:44 +02:00
Libin Yang 184865085b ALSA: hda - rename hda_intel_trace.h to hda_controller_trace.h
This patch does:

1. Rename the hda_intel_trace.h to hda_controller_trace.h as
this trace is used in hda_controller.c

2. Add some trace function for pcm flow.

Signed-off-by: Libin Yang <libin.yang@intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-05-18 10:06:32 +02:00
Thierry Reding 5c03be00cd ALSA: hda/hdmi - Add Tegra210 support
Tegra210 contains a similar codec as Tegra124 and can be supported using
the same patch function.

Signed-off-by: Thierry Reding <treding@nvidia.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-05-18 10:03:45 +02:00
Thierry Reding e40bd3732c ALSA: hda/hdmi - Add Tegra114 support
Tegra114 contains the same codec as Tegra124 and can be supported using
the same patch function.

Signed-off-by: Thierry Reding <treding@nvidia.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-05-18 10:03:38 +02:00
Thierry Reding 1387f42abf ALSA: hda/hdmi - Add Tegra30 support
Tegra30 contains the same codec as Tegra124 and can be supported using
the same patch function.

Signed-off-by: Thierry Reding <treding@nvidia.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-05-18 10:03:32 +02:00
Thierry Reding 6a464a4ccb ALSA: hda/tegra - Improve error reporting
When probing, provide accurate error messages to help with debugging
failures.

Signed-off-by: Thierry Reding <treding@nvidia.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-05-18 10:03:25 +02:00
Thierry Reding 26e9a960b2 ALSA: hda/hdmi - Implement Tegra-specific patch
The HDMI codec on NVIDIA Tegra SoCs has a feature that doesn't exist on
the MCP or GPU variants. The highest bit in the vendor-defined scratch
registers can be used to trigger an interrupt in the HDMI codec, which
is signalled to the HDMI driver. This can be used to pass information,
such as the HDA format, to the HDMI driver so that it can reconfigure
itself accordingly.

While at it, change the name of the codec to Tegra124 since there are no
other SoCs in the Tegra12x family. There isn't really a Tegra12x family.

Signed-off-by: Thierry Reding <treding@nvidia.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-05-18 10:03:01 +02:00
Thierry Reding 88871dd25f ALSA: hda/tegra - Set CORBRP self-clear flag
This is set for the MCP variants of the NVIDIA HDA controller, which the
Tegra variant was derived from. This fixes the following warning at boot
time:

	[    2.486610] tegra-hda 70030000.hda: CORB reset timeout#1, CORBRP = 0

Signed-off-by: Thierry Reding <treding@nvidia.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-05-18 10:02:55 +02:00
Kailang Yang 977e627684 ALSA: hda/realtek - Support Dell headset mode for ALC298
Dell create new platform with ALC298 codec.
This patch will enable headset mode for ALC298/ALC3266 platform.

Signed-off-by: Kailang Yang <kailang@realtek.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-05-18 10:00:09 +02:00
Ansgar Hegerfeld 09ea997677 ALSA: hda/realtek - ALC292 dock fix for Thinkpad L450
The Lenovo ThinkPad L450 requires the ALC292_FIXUP_TPT440_DOCK fix in
order to get sound output on the docking stations audio port.

This patch was tested using a ThinkPad L450 (20DSS00B00) using kernel
4.0.3 and a ThinkPad Pro Dock.

Signed-off-by: Ansgar Hegerfeld <linux@hegerfeld.org>
Cc: <stable@vger.kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-05-18 08:22:29 +02:00
David Henningsson 6ffc0898b2 ALSA: hda - Add Conexant codecs CX20721, CX20722, CX20723 and CX20724
This patch adds support for Conexant HD Audio codecs
CX20721, CX20722, CX20723 and CX20724.

Cc: stable@vger.kernel.org
BugLink: https://bugs.launchpad.net/bugs/1454656
Signed-off-by: David Henningsson <david.henningsson@canonical.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-05-18 08:20:03 +02:00
David Henningsson 1f8b46cdc8 ALSA: hda - Fix headset mic and mic-in for a Dell desktop
ALC662 does not need any special verbs to change the jack functionality,
and enables mic in through the headphone jack mode by changing the
direction of the headphone pin node.

BugLink: https://bugs.launchpad.net/bugs/1454235
Signed-off-by: David Henningsson <david.henningsson@canonical.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-05-18 08:19:57 +02:00
Kailang Yang 1a5bc8d950 ALSA: hda/realtek - Support headset mode for ALC298
Support headset mode for ALC298 platform.

Signed-off-by: Kailang Yang <kailang@realtek.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-05-12 13:15:38 +02:00
David Henningsson fd8a1043cd ALSA: hda - Remove unused call to "get_pin" in patch_hdmi.c
Janitorial patch (no functional change)

Signed-off-by: David Henningsson <david.henningsson@canonical.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-05-11 14:30:40 +02:00
David Henningsson 9b5a4e395c ALSA: hda - Add headset mic quirk for Dell Inspiron 5548
This enables the headset microphone on Dell Inspiron 5548,
or at least some variants of it.

Cc: stable@vger.kernel.org
BugLink: https://bugs.launchpad.net/bugs/1452175
Signed-off-by: David Henningsson <david.henningsson@canonical.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-05-11 14:30:08 +02:00
Thierry Reding 3b90f40727 ALSA: hda/tegra - Fix oops
Commit a41d122449 ("ALSA: hda - Embed bus into controller object")
introduced a regression in the Tegra HDA driver that causes the
following oops during boot:

	[    2.333458] Unable to handle kernel NULL pointer dereference at virtual address 000004c4
	[    2.341537] pgd = c0004000
	[    2.344312] [000004c4] *pgd=00000000
	[    2.347898] Internal error: Oops: 5 [#1] PREEMPT SMP ARM
	[    2.353200] Modules linked in:
	[    2.356264] CPU: 0 PID: 1 Comm: swapper/0 Tainted: G        W       4.1.0-rc2-next-20150505-00344-g8577890defbf #79
	[    2.366682] Hardware name: NVIDIA Tegra SoC (Flattened Device Tree)
	[    2.372939] task: ee0d8b40 ti: ee0da000 task.ti: ee0da000
	[    2.378336] PC is at azx_bus_init+0x18/0xf4
	[    2.382516] LR is at hda_tegra_probe+0x6c/0x478
	[    2.387043] pc : [<c06156c4>]    lr : [<c061cf00>]    psr: 60000113
	[    2.387043] sp : ee0dbe38  ip : 00000000  fp : 00000000
	[    2.398501] r10: ed874c00  r9 : 000000fd  r8 : 00000000
	[    2.403717] r7 : ed874c10  r6 : 00000000  r5 : 00000000  r4 : ed016810
	[    2.410232] r3 : c08a2ad4  r2 : c08a1ea0  r1 : 00000000  r0 : ed016810
	[    2.416750] Flags: nZCv  IRQs on  FIQs on  Mode SVC_32  ISA ARM  Segment kernel
	[    2.424046] Control: 10c5387d  Table: 8000406a  DAC: 00000015
	[    2.429783] Process swapper/0 (pid: 1, stack limit = 0xee0da210)
	[    2.435778] Stack: (0xee0dbe38 to 0xee0dc000)
	[    2.440129] be20:                                                       00000000 ed016810
	[    2.448297] be40: 00000000 c061cf00 00000000 ee0dbe5c ed8735d0 c0a7bc48 ed02fd50 ed016000
	[    2.456462] be60: c1250164 ed874c10 c0c66bf8 fffffdfb 00000000 000000fd c0b8dc98 c046664c
	[    2.464628] be80: c0466608 c1250164 ed874c10 00000000 c0c66bf8 c0464eb4 ed874c10 c0c66bf8
	[    2.472793] bea0: ed874c44 c0c43458 00000000 c04650d0 00000000 c0c66bf8 c046503c c04633b4
	[    2.480959] bec0: ee11bea4 ed85f390 c0c66bf8 ed017ac0 00000000 c0464634 c0ab2b7c c0c66bf8
	[    2.489125] bee0: c0bfde20 c0c66bf8 c0bfde20 ed01ce40 c0b7b414 c04656e8 c04665b0 c0bfde20
	[    2.497291] bf00: c0bfde20 c0009770 ee0d8b40 c0c02488 60000113 00000000 00000000 00000003
	[    2.505458] bf20: 00000000 c0c02488 60000113 00000000 c0b54598 c0b16a90 ef7fcc57 c0041228
	[    2.513624] bf40: c0a9150c ef7fcc5f 00000006 00000006 00000000 c0bf1fa8 c0bf2354 00000006
	[    2.521790] bf60: c0b8dc90 c0c7c000 c0c7c000 c0b8dc98 00000000 c0b54dd8 00000006 00000006
	[    2.529956] bf80: c0b54598 00000000 00000000 c07ff08c 00000000 00000000 00000000 00000000
	[    2.538122] bfa0: 00000000 c07ff094 00000000 c000f5a0 00000000 00000000 00000000 00000000
	[    2.546286] bfc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
	[    2.554451] bfe0: 00000000 00000000 00000000 00000000 00000013 00000000 fffff7ff c013f264
	[    2.562624] [<c06156c4>] (azx_bus_init) from [<c061cf00>] (hda_tegra_probe+0x6c/0x478)
	[    2.570535] [<c061cf00>] (hda_tegra_probe) from [<c046664c>] (platform_drv_probe+0x44/0xa4)
	[    2.578879] [<c046664c>] (platform_drv_probe) from [<c0464eb4>] (driver_probe_device+0x174/0x2b8)
	[    2.587739] [<c0464eb4>] (driver_probe_device) from [<c04650d0>] (__driver_attach+0x94/0x98)
	[    2.596172] [<c04650d0>] (__driver_attach) from [<c04633b4>] (bus_for_each_dev+0x6c/0xa0)
	[    2.604342] [<c04633b4>] (bus_for_each_dev) from [<c0464634>] (bus_add_driver+0x148/0x1f0)
	[    2.612597] [<c0464634>] (bus_add_driver) from [<c04656e8>] (driver_register+0x78/0xf8)
	[    2.620593] [<c04656e8>] (driver_register) from [<c0009770>] (do_one_initcall+0x8c/0x1d4)
	[    2.628765] [<c0009770>] (do_one_initcall) from [<c0b54dd8>] (kernel_init_freeable+0x144/0x1e4)
	[    2.637459] [<c0b54dd8>] (kernel_init_freeable) from [<c07ff094>] (kernel_init+0x8/0xe8)
	[    2.645543] [<c07ff094>] (kernel_init) from [<c000f5a0>] (ret_from_fork+0x14/0x34)

This is caused by azx_bus_init() trying to dereference chip->card, which
for the Tegra driver doesn't get initialized until sometime later during
the call to hda_tegra_create().

Fix this by mimicking the behaviour of the Intel driver and defer HDA
bus initialization until right before the call to snd_device_new().

Fixes: a41d122449 ('ALSA: hda - Embed bus into controller object')
Signed-off-by: Thierry Reding <treding@nvidia.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-05-05 14:56:44 +02:00
Kailang Yang 2c674fac5b ALSA: hda/realtek - Add ALC298 alias name for Dell
Add ALC3266 for Dell platform.

Signed-off-by: Kailang Yang <kailang@realtek.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-05-05 14:51:44 +02:00
Lu, Han 0a67352153 ALSA: hda - reset display codec when power on
In SKL, HDMI/DP codec and PCH HD Audio Controller are in different power wells,
so it's necessary to reset display audio codecs when power well on, otherwise
display audio codecs will disappear when resume from low power state.
Reset steps when power on:
    enable codec wakeup -> azx_init_chip() -> disable codec wakeup

The callback for codec wakeup enable/disable is in drivers/gpu/drm/i915/.

Signed-off-by: Lu, Han <han.lu@intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-05-05 14:44:36 +02:00
Kailang Yang ec6bfca835 ALSA: hda/realtek - Fix typo for ALC286/ALC288
Delete more one break for ALC286/ALC288.

Signed-off-by: Kailang Yang <kailang@realtek.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-05-04 14:23:20 +02:00
Takashi Iwai bd5b2d4407 Merge branch 'topic/jack' into for-next 2015-05-02 10:02:30 +02:00
Jie Yang 973109cafc ALSA: jack: fix a randconfig build issue
Building errors reported such as below when 'CONFIG_INPUT=m':
    ...undefined reference to `input_xxx'...

Here change to enable SND_JACK selectively to fix the issue.

Also remove the config 'SND_HDA_INPUT_JACK' which won't be
used anymore.

Signed-off-by: Jie Yang <yang.jie@intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-05-02 10:02:17 +02:00
Takashi Iwai 88776f366e ALSA: hda - Add headphone quirk for Lifebook E752
Fujitsu Lifebook E752 laptop needs a similar quirk done for Lifebook
T731.  Otherwise the headphone is always muted.

Reported-and-tested-by: Christian Weber <we_chris@hotmail.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-05-01 09:20:34 +02:00
Takashi Iwai 71f881ce57 Merge branch 'topic/hda' into for-next 2015-04-30 08:27:18 +02:00
Takashi Iwai 31c648e0d3 ALSA: hda - Reduce ifdef CONFIG_SND_HDA_I915
We're providing dummy functions for CONFIG_SND_HDA_i915=n, thus ifdef
can be reduced.  (But hda_i915_init() has to be fixed to return zero.)

This automatically fixes a compile warning:
  sound/pci/hda/hda_intel.c: In function 'azx_probe_continue':
  sound/pci/hda/hda_intel.c:1966:1: warning: label 'i915_power_fail' defined but not used [-Wunused-label]

Reported-by: kbuild test robot <fengguang.wu@intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-04-30 08:22:41 +02:00
Takashi Iwai 85abf3ec5f Merge branch 'topic/hda' into for-next 2015-04-29 12:28:52 +02:00
Mengdong Lin 2bd1f73f42 ALSA: hda - remove controller dependency on i915 power well for Baytrail/Braswell
For Baytrail (Valleyview) and Braswell (Cherryview), only the HDMI codec is
in the display power well while the HD-A controller isn't. So the controller
flag 'need_i915_power' is not set to release the display power after probe,
and the codec flag 'link_power_control" is set to request/release the display
power via bus link_power ops.

Signed-off-by: Mengdong Lin <mengdong.lin@intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-04-29 12:27:54 +02:00
Mengdong Lin 795614dde4 ALSA: hda - divide controller and codec dependency on i915 gfx power well
This patch can improve power saving for Intel platforms on which only the
display audio codec is in the shared i915 power well:

- Add a flag "need_i915_power" to indicate whether the controller needs the
  i915 power well.

- The driver will always request the i915 power when probing the controller
  and codecs if AZX_DCAPS_I915_POWERWELL is set (either the controller or a
  codec needs this power).

- If the controller needs the i915 power, the power will be held after probe
  until the controller is runtime suspended or S3. If the controller doesn't
  need the power, the power will be released the after probe, and a codec
  that needs the power can request/release the power via bus link_power ops.

Background:
- For Haswell/Broadwell, which has a separate HD-A controller for display audio,
  both the controller and the display codec are in the i915 power well.

- For Baytrail/Braswell, the display and analog audio share the same HDA
  controller and link, and only the display codec is in the i915 power well.

- For Skylake, the display and analog audio share the same HDA controller but
  use separate links. Only the display codec is in the i915 power well. And in
  legacy mode we take the two links as one. So it can follow Baytrail/Braswell.

Signed-off-by: Mengdong Lin <mengdong.lin@intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-04-29 12:27:53 +02:00
Mengdong Lin 17eccb27fc ALSA: hda - implement link_power ops for i915 display power control
This patch implements the bus link_power ops to request/release i915 display
power well. It can be used by the display codec which shares this power well
with GPU on Intel platforms.

Signed-off-by: Mengdong Lin <mengdong.lin@intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-04-29 12:27:53 +02:00
Mengdong Lin a5e7e07c26 ALSA: hda - allow a codec to control the link power
A flag "link_power_control" is added to indicate whether a codec needs to
control the link power.  And a new bus ops link_power() is defined for the
codec to request to enable/disable the link power.

Signed-off-by: Mengdong Lin <mengdong.lin@intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-04-29 12:27:52 +02:00
Mengdong Lin d4b7b13e19 ALSA: hda - implement a refcount for i915 power well switch
This is to check the refcount of audio driver and reduce calling to i915.

Signed-off-by: Mengdong Lin <mengdong.lin@intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-04-29 12:27:52 +02:00
Takashi Iwai 49c4a4c524 Merge branch 'for-linus' into for-next
Conflicts:
	sound/pci/emu10k1/emu10k1_main.c

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-04-29 07:28:29 +02:00
Peter Zubaj 7241ea558c ALSA: emu10k1: Emu10k2 32 bit DMA mode
Looks like audigy emu10k2 (probably emu10k1 - sb live too) support two
modes for DMA. Second mode is useful for 64 bit os with more then 2 GB
of ram (fixes problems with big soundfont loading)

1) 32MB from 2 GB address space using 8192 pages (used now as default)
2) 16MB from 4 GB address space using 4096 pages

Mode is set using HCFG_EXPANDED_MEM flag in HCFG register.
Also format of emu10k2 page table is then different.

Signed-off-by: Peter Zubaj <pzubaj@marticonet.sk>
Tested-by: Takashi Iwai <tiwai@suse.de>
Cc: <stable@vger.kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-04-29 07:27:30 +02:00
Takashi Iwai 1962fcab4e Merge branch 'topic/jack' into for-next 2015-04-28 08:31:31 +02:00
Jie Yang 2ba2dfa1fc ALSA: hda - Update to use the new jack kctls method
Jack snd_kcontrols can now be created during snd_jack_new()
or by later calling snd_jack_add_new_kctls().

This patch creates the jacks during the initialisation stage
for both phantom and non phantom jacks.

Signed-off-by: Jie Yang <yang.jie@intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-04-27 21:37:42 +02:00
Jie Yang 4e3f0dc658 ALSA: jack: extend snd_jack_new to support phantom jack
Dont create input devices for phantom jacks.

Here, we extend snd_jack_new() to support phantom jack creating:
pass in a bool param for [non-]phantom flag, and a bool param
initial_jack to indicate whether we need to create a kctl at
this stage.

We can also add a kctl to the jack after its created meaning we
can now integrate the HDA and ASoC jacks.

Signed-off-by: Jie Yang <yang.jie@intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-04-27 21:37:41 +02:00
Jie Yang b8dd086674 ALSA: Jack: handle jack embedded kcontrol creating within ctljack
This patch adds a static method get_available_index() to
allocate the index of new jack kcontrols and also adds
jack_kctl_name_gen() which is used to ensure compatibility
with jack naming by removing " Jack" from some incorrectly
passed names.

Signed-off-by: Jie Yang <yang.jie@intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-04-27 21:37:41 +02:00
Jie Yang 9058cbe1ee ALSA: jack: implement kctl creating for jack devices
Currently the ALSA jack core registers only input devices for each jack
registered. These jack input devices are not readable by userspace devices
that run as non root. This patch series will implement kctls inside the
core jack part, including kctls creating, status changing report, for both
HD-Audio and ASoC jack. This allows non root userspace to read jack status
and act on it.

This patch adds a new API called snd_jack_add_new_kctl(), which will create
a kcontrol, add it to the card, and also attach it to the jack kctl list.

This patch also initialises the jack kctl list after jack is newed, and
reports kctl status when jack insertion/removal events occur.

snd_jack_new() is updated in the following patches to also support creating
phantom jacks and jack kcontrols. We then remove these duplicated features
from HDA jack and have jack kctls handled by core throughout HDA and ASoC.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Modified-by: Jie Yang <yang.jie@intel.com>
Signed-off-by: Jie Yang <yang.jie@intel.com>
Reveiwed-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-04-27 21:37:40 +02:00
Takashi Iwai f1a77547c2 Merge branch 'for-4.2' into for-next 2015-04-27 16:42:45 +02:00
Takashi Iwai 30e5f003ff ALSA: hda - Fix missing va_end() call in snd_hda_codec_pcm_new()
Reported by coverity CID 1296024.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-04-27 16:39:19 +02:00
Takashi Iwai d02260824e ALSA: emu10k1: Fix card shortname string buffer overflow
Some models provide too long string for the shortname that has 32bytes
including the terminator, and it results in a non-terminated string
exposed to the user-space.  This isn't too critical, though, as the
string is stopped at the succeeding longname string.

This patch fixes such entries by dropping "SB" prefix (it's enough to
fit within 32 bytes, so far).  Meanwhile, it also changes strcpy()
with strlcpy() to make sure that this kind of problem won't happen in
future, too.

Cc: <stable@vger.kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-04-27 13:00:09 +02:00
Takashi Iwai 8ab418d365 Merge branch 'topic/hda' into for-4.2 2015-04-27 12:25:42 +02:00
Takashi Iwai 7290006d8c ALSA: hda - Add mute-LED mode control to Thinkpad
This patch adds the missing flag to enable "Mute-LED Mode" mixer enum
ctl for Thinkpads that have also the software mute-LED control.

Reported-and-tested-by: Pali Rohár <pali.rohar@gmail.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-04-27 10:48:37 +02:00
Takashi Iwai ee52e56e7b ALSA: hda - Fix mute-LED fixed mode
The mute-LED mode control has the fixed on/off states that are
supposed to remain on/off regardless of the master switch.  However,
this doesn't work actually because the vmaster hook is called in the
vmaster code itself.

This patch fixes it by calling the hook indirectly after checking the
mute LED mode.

Reported-and-tested-by: Pali Rohár <pali.rohar@gmail.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-04-27 10:48:37 +02:00
Takashi Iwai 3e1b0c4a9d ALSA: hda - Fix click noise at start on Dell XPS13
Dell XPS13 produces a click noise at boot up, and Gabriele spotted out
that it's triggered by the initial pin control of the mic (NID 0x19).
This has to be set to Hi-Z Vref while the driver initializes to Vref
80% as a normal mic.

This patch fixes the generic parser code not to override the target
vref if it has been already set by the driver, and adds a proper
initialization of the target vref for this pin in the Realtek driver
side.

Reported-and-tested-by: Gabriele Mazzotta <gabriele.mzt@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-04-27 10:48:37 +02:00
Takashi Iwai c560a6797e ALSA: core: Remove child proc file elements recursively
This patch changes the way to manage the resource release of proc
files: namely, let snd_info_free_entry() freeing the whole children.

This makes it us possible to drop the snd_device_*() management.  Then
snd_card_proc_new() becomes merely a wrapper to
snd_info_create_card_entry().

Together with this change, now you need to call snd_info_free_entry()
for a proc entry created via snd_card_proc_new(), while it was freed
via snd_device_free() beforehand.

Acked-by: Jaroslav Kysela <perex@perex.cz>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-04-24 17:27:57 +02:00
Hui Wang e8191a8e47 ALSA: hda - fix headset mic detection problem for one more machine
We have two machines with alc256 codec in the pin quirk table, so
moving the common pins to ALC256_STANDARD_PINS.

Cc: stable@vger.kernel.org
BugLink: https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1447909
Signed-off-by: Hui Wang <hui.wang@canonical.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-04-24 07:47:08 +02:00
Kailang Yang d32b66668c ALSA: hda/realtek - Fix Headphone Mic doesn't recording for ALC256
Switch default pcbeep path to Line in path.

Signed-off-by: Kailang Yang <kailang@realtek.com>
Tested-by: Hui Wang <hui.wang@canonical.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-04-23 12:03:48 +02:00
David Henningsson 7d1b6e2932 ALSA: hda - fix "num_steps = 0" error on ALC256
The ALC256 does not have a mixer nid at 0x0b, and there's no
loopback path (the output pins are directly connected to the DACs).

This commit fixes an "num_steps = 0 for NID=0xb (ctl = Beep Playback Volume)"
error (and as a result, problems with amixer/alsamixer).

If there's pcbeep functionality, it certainly isn't controlled by setting an
amp on 0x0b, so disable beep functionality (at least for now).

Cc: stable@vger.kernel.org
BugLink: https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1446517
Signed-off-by: David Henningsson <david.henningsson@canonical.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-04-21 10:51:56 +02:00
Mengdong Lin 40cc2392f4 ALSA: hda - add AZX_DCAPS_I915_POWERWELL to Baytrail
This patch addes AZX_DCAPS_I915_POWERWELL to BYT (Baytrail).

Like Braswell and Skylake, the HDMI codec on Bytrail is also in the shared
power well with GPU. This power well must be turned on before we reset link
to probe the codec, to avoid communication failure with the codec.

The side effect is that this power is always ON in S0 because the BYT HDMI
codec does not support EPSS or D3ClkStop and so the controller doesn't enter
D3 at runtime, and the HDMI codec and analog codec share a single physical
HD-A link and so we cannot reset the HD-A link freely when we re-enable the
power to use the HDMI codec.

Next step is to test if an AGP reset or double AGP reset on BYT HDMI codec is
okay to bring the HDMI codec back to a functional state after restoring the
power. If okay, we can bind the power on/off with the HDMI codec PM without
interrupting the analog audio.

Signed-off-by: Mengdong Lin <mengdong.lin@intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-04-21 07:58:36 +02:00
Mengdong Lin f4c1a311d8 ALSA: hda - only sync BCLK to the display clock for Haswell & Broadwell
Only Intel Haswell and Broadwell have a separate HD-A controller (PCI device 3)
for display audio, which needs to get 24MHz HD-A link BCLK from the variable
display core clock through vendor specific registers EM4 & EM5. Other platforms
(Baytrail, Braswell and Skylake) don't have this feature.

So this patch checks the PCI device ID of the controller in haswell_set_bclk()
and only sync BCLK for HSW and BDW.

Signed-off-by: Mengdong Lin <mengdong.lin@intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-04-20 17:27:55 +02:00
Gabriele Mazzotta 9476d369d7 ALSA: hda - Mute headphone pin on suspend on XPS13 9333
Muting the headphone output pin right before the codec suspension
prevents pop noises when headphones are plugged in (except for a
barely audible click noise).
This solution allows to truly save some power when headphones are
plugged in unlike the previous solution (033b0a7ca9c:
"ALSA: hda - Pop noises fix for XPS13 9333")

Signed-off-by: Gabriele Mazzotta <gabriele.mzt@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-04-20 09:15:07 +02:00
Takashi Iwai 0dd76f36ef ALSA: hda - Replace open codes with snd_hdac_stream_set_params()
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-04-18 09:59:38 +02:00
Dan Carpenter f4d7703179 ALSA: hda - potential (but unlikely) uninitialized variable
This function is a bit unusual because it accepts negative values as
"conn_len".  It's theoretically possible for both "cache_len" and
"conn_len" to be -ENOSPC and in that case we would oops trying to run
memcmp() on the uninitialized "list" pointer.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-04-17 15:32:17 +02:00
Takashi Iwai 6d23c8f544 ALSA: hda - Move prepared flag into struct hdac_stream
This flag seems used commonly, so deserves to be located there.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-04-17 13:34:30 +02:00
Takashi Iwai 0a50575b64 ALSA: hda - Replace hda_bus_ops with static binding
Originally hda_bus takes its own ops (hda_bus_ops) to allow different
controller drivers giving individual implementations of PCM
attachment, etc.  But this never happened and we finally merged both
codec and controller helper codes.  Thus there is no merit to keep the
indirect accesses to functions via hda_bus_ops.

This patch replaces these calls with the direct local function calls
for simplification.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-04-16 23:40:09 +02:00
Takashi Iwai 7d4b5e978a ALSA: hda - Fix regression for slave SPDIF setups
The commit [a551d91473e5: ALSA: hda - Use regmap for command verb
caches, too] introduced a regression due to a typo in the conversion;
the IEC958 status bits of slave digital devices aren't updated
correctly.  This patch corrects it.

Fixes: a551d91473 ('ALSA: hda - Use regmap for command verb caches, too')
Reported-and-tested-by: Markus Trippelsdorf <markus@trippelsdorf.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-04-16 15:51:59 +02:00
Quentin Lambert 412b979ccc ALSA: remove deprecated use of pci api
Replace occurences of the pci api by appropriate call to the dma api.

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

@deprecated@
idexpression id;
position p;
@@

(
  pci_dma_supported@p ( id, ...)
|
  pci_alloc_consistent@p ( id, ...)
)

@bad1@
idexpression id;
position deprecated.p;
@@
...when != &id->dev
   when != pci_get_drvdata ( id )
   when != pci_enable_device ( id )
(
  pci_dma_supported@p ( id, ...)
|
  pci_alloc_consistent@p ( id, ...)
)

@depends on !bad1@
idexpression id;
expression direction;
position deprecated.p;
@@

(
- pci_dma_supported@p ( id,
+ dma_supported ( &id->dev,
...
+ , GFP_ATOMIC
  )
|
- pci_alloc_consistent@p ( id,
+ dma_alloc_coherent ( &id->dev,
...
+ , GFP_ATOMIC
  )
)

Signed-off-by: Quentin Lambert <lambert.quentin@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-04-16 12:19:52 +02:00
Takashi Iwai 1604eeee88 ALSA: hda - Drop azx_sd_read*/write*() macros
They are no longer used (only one place which can be replaced with a
proper helper function).  Let's drop.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-04-16 12:14:17 +02:00
Takashi Iwai 4cfe99c7f9 ALSA: hda/tegra - Fix build error and warning
I seem to have failed to run the build test properly...
   sound/pci/hda/hda_tegra.c: In function 'hda_tegra_dev_free':
   sound/pci/hda/hda_tegra.c:310:20: error: 'bus' undeclared (first use in this function)
         snd_hdac_bus_exit(bus);

Reported-by: kbuild test robot <fengguang.wu@intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-04-16 12:07:24 +02:00
Takashi Iwai 43db4a59ce ALSA: hda - Reenable tracepoints for controller
After correcting the fields to point the right members, tracepoints
can be reenabled again for the legacy controller code.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-04-16 11:45:26 +02:00
Scott Wood 3047755588 ALSA: intel8x0: Check pci_iomap() success for DEVICE_ALI
DEVICE_ALI previously would jump to port_inited after calling
pci_iomap(), bypassing the check for bmaddr being NULL.

Signed-off-by: Scott Wood <scottwood@freescale.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-04-16 10:15:44 +02:00
David Henningsson 828fa8ce5a ALSA: hda - simplify azx_has_pm_runtime
Because AZX_DCAPS_PM_RUNTIME is always defined as non-zero, the
initial part of the expression can be skipped.

Signed-off-by: David Henningsson <david.henningsson@canonical.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-04-16 10:13:47 +02:00
Takashi Iwai b7d023e114 ALSA: hda - Move PCM format and rate handling code to core library
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-04-16 08:47:28 +02:00
Takashi Iwai 602518a21b ALSA: hda - Minor refactoring
Move the small portion of the common sequence in hda_intel.c and
hda_tegra.c into hda_controller.c.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-04-16 08:47:28 +02:00
Takashi Iwai a41d122449 ALSA: hda - Embed bus into controller object
... and replace with the existing hda-core helper codes.
This reduces lots of lines, finally.

Since struct hda_bus is now embedded into struct azx,
snd_hda_bus_new() is moved and expanded from hda_codec.c to
hda_controller.c, accordingly.  Also private_free bus ops and
private_data field are removed because we no longer need to point azx
object from bus (we can use container_of())

The spin locks are consolidated into the single one, bus->reg_lock.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-04-16 08:47:22 +02:00
Takashi Iwai ccc98865aa ALSA: hda - Migrate more hdac_stream codes
... including dsp loader helpers.  Lots of codes removed.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-04-16 07:37:02 +02:00
Takashi Iwai 7833c3f85b ALSA: hda - Migrate hdac_stream into legacy driver
Embed hdac_stream object into azx_dev, and use a few basic helper
functions.  The most of helper codes for hdac_stream aren't still used
yet.

Also this commit disables the tracepoints temporarily due to build
problems.  It'll be enabled again later.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-04-16 07:36:16 +02:00
Takashi Iwai a43ff5baa5 ALSA: hda - Pass bus io_ops directly from the top-level driver
One less redirection again.  This also requires the change of the call
order in the toplevel divers.  Namely, the bus has to be created at
first before other initializations since the memory allocation ops are
called through bus object now.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-04-16 07:31:48 +02:00
Takashi Iwai 7e8be1b309 ALSA: hda - Move send_cmd / get_response to hdac_bus_ops
One less redirection.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-04-16 07:31:41 +02:00
Takashi Iwai fb3b07c289 ALSA: hda - Merge codec and controller helpers
There is no much merit to keep the HD-audio codec and controller
helper codes in separate modules any longer.  Let's merge them into a
single helper module.

This patch just changes Makefile entries to merge two individual
modules to one.  The only code change is the removal of superfluous
MODULE_*() macros in one side.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-04-16 07:31:31 +02:00
Takashi Iwai 8f3f600b52 ALSA: hda - Add DSP loader to core library code
Copied from the legacy driver code, no transition done yet.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-04-16 07:28:27 +02:00
Takashi Iwai 1475241272 ALSA: hda - Add the controller helper codes to hda-core module
This patch adds the controller helper codes to hda-core library.
The I/O access ops are added to the bus ops.  The CORB/RIRB, the basic
attributes like irq# and iomap address, some locks and the list of
streams are added to the bus object, together with the stream object
and its helpers.

Currently the codes are just copied from the legacy driver, so you can
find duplicated codes in both directories.  Only constants are removed
from the original hda_controller.h.  More integration work will follow
in the later patches.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-04-16 07:27:58 +02:00
Takashi Iwai cad372f1be ALSA: hda - Handle error from get_response bus ops directly
... and drop bus->rirb_error flag.  This makes the code simpler.

We treat -EAGAIN from get_response ops as a special meaning: it allows
the caller to retry after bus reset.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-04-14 14:54:57 +02:00
Jo-Philipp Wich f2aa111041 ALSA: hda/realtek - Enable the ALC292 dock fixup on the Thinkpad T450
The Lenovo Thinkpad T450 requires the ALC292_FIXUP_TPT440_DOCK as well in
order to get working sound output on the docking stations headphone jack.

Patch tested on a Thinkpad T450 (20BVCTO1WW) using kernel 4.0-rc7 in
conjunction with a ThinkPad Ultradock.

Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
Cc: <stable@vger.kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-04-13 13:23:40 +02:00
Takashi Iwai 9a4f35865f Merge branch 'for-next' into for-linus 2015-04-13 10:23:18 +02:00
Michael Gernoth 99dcab46b5 ALSA: emu10k1: add toggles for E-mu 1010 optical ports
The optical ports on the E-mu 1010 (and dock) can be configured
for ADAT- or S/PDIF-mode, which is currently hardcoded to ADAT.
Add two mixer elements to expose this setting.
Tested on an E-mu 1010 PCIe with connected Micro Dock.

Signed-off-by: Michael Gernoth <michael@gernoth.net>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-04-11 18:35:06 +02:00
Michael Gernoth fa863b2d5e ALSA: emu10k1: handle dock disconnects
When the dock on an E-mu 1010 card is disconnected, all outputs get
muted by the hardware. Add logic to detect a disconnect and unmute.

Signed-off-by: Michael Gernoth <michael@gernoth.net>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-04-11 17:29:19 +02:00
Yves-Alexis Perez c0278669fb ALSA: hda - Add dock support for ThinkPad X250 (17aa:2226)
This model uses the same dock port as the previous generation.

Signed-off-by: Yves-Alexis Perez <corsac@debian.org>
Cc: <stable@vger.kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-04-11 17:25:37 +02:00
Michael Gernoth 91bf0c2dcb ALSA: emu10k1: don't deadlock in proc-functions
The functions snd_emu10k1_proc_spdif_read and snd_emu1010_fpga_read
acquire the emu_lock before accessing the FPGA. The function used
to access the FPGA (snd_emu1010_fpga_read) also tries to take
the emu_lock which causes a deadlock.
Remove the outer locking in the proc-functions (guarding only the
already safe fpga read) to prevent this deadlock.

[removed superfluous flags variables too -- tiwai]

Signed-off-by: Michael Gernoth <michael@gernoth.net>
Cc: <stable@vger.kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-04-10 13:02:23 +02:00
Takashi Iwai f4d3129c2b ALSA: hda/realtek - Fix a typo
A comma was used instead of a semicolon, which may lead to a build
error.

Fixes: cffd396681 ('ALSA: hda/realtek - Fix the regression by widget power-saving')
Reported-by: kbuild test robot <fengguang.wu@intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-04-10 09:53:04 +02:00
Takashi Iwai cfd3113e7c ALSA: hda/via - Add missing stream_pm ops setup
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>
2015-04-09 15:23:59 +02:00
Takashi Iwai cffd396681 ALSA: hda/realtek - Fix the regression by widget power-saving
While enabling the widget power-saving for ALC269 & co, the important
setup was forgotten -- stream_pm ops.  Without this setup, the paths
for PCM won't be powered up at all.

Also, the power_filter callbacks used in ALC269 & co need to chain to
the default snd_hda_gen_path_power_filter().

Tested-by: Hui Wang <hui.wang@canonical.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-04-09 12:09:57 +02:00
Takashi Iwai 24fef9022a ALSA: hda/generic - Don't override power_filter when power_save_node is set
Currently the generic parser sets codec->power_filter when
power_save_node flag is set.  But this overrides the existing filter
that has been already set by the codec driver, thus it looses some
features.  Instead, set the default power_filter only when it's not
set yet.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-04-09 10:34:00 +02:00
Takashi Iwai b6c09b3c7b ALSA: hda/generic - Make snd_hda_gen_path_power_filter() always applicable
Add the check of power_save_node flag at the beginning of the function
so that it skips the rest if the flag isn't set.  In this way, we can
call this function safely no matter whether the widget power-saving is
really used or not.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-04-09 10:33:53 +02:00
Takashi Iwai d5ac0100a9 ALSA: hda/generic - Fix wrong initial power state for fixed pins
When the widget power-saving is enabled, the first automute hook
invocation checks through the whole pins and it also tries to
synchronize the power state.  However, this results in a wrong state
because it calls unconditionally snd_hda_jack_detect_state().
This patch adds a check of jack detectability before the actual jack
detection call.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-04-09 10:33:44 +02:00
Takashi Iwai 2206dc9492 ALSA: hda/generic - Check power state cap at updating the widget power
The new widget power-saving tries to apply the power change no matter
whether the node has a power cap or not.  It's bad (although most of
codecs chip just ignore it).  Check the capability properly
beforehand.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-04-09 10:33:16 +02:00
Takashi Iwai cc7016ab1a ALSA: hda - Fix headphone pin config for Lifebook T731
Some BIOS version of Fujitsu Lifebook T731 seems to set up the
headphone pin (0x21) without the assoc number 0x0f while it's set only
to the output on the docking port (0x1a).  With the recent commit
[03ad6a8c93b6: ALSA: hda - Fix "PCM" name being used on one DAC when
 there are two DACs], this resulted in the weird mixer element
mapping where the headphone on the laptop is assigned as a shared
volume with the speaker and the docking port is assigned as an
individual headphone.

This patch improves the situation by correcting the headphone pin
config to the more appropriate value.

Reported-and-tested-by: Taylor Smock <smocktaylor@gmail.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-04-08 20:52:52 +02:00
Takashi Iwai 664c715573 ALSA: hda - Work around races of power up/down with runtime PM
Currently, snd_hdac_power_up()/down() helpers checks whether the codec
is being in pm (suspend/resume), and skips the call of runtime get/put
during it.  This is needed as there are lots of power up/down
sequences called in the paths that are also used in the PM itself.  An
example is found in hda_codec.c::codec_exec_verb(), where this can
power up the codec while it may be called again in its power up
sequence, too.

The above works in most cases, but sometimes we really want to wait
for the real power up.  For example, the control element get/put may
want explicit power up so that the value change is assured to reach to
the hardware.   Using the current snd_hdac_power_up(), however,
results in a race, e.g. when it's called during the runtime suspend is
being performed.  In the worst case, as found in patch_ca0132.c, it
can even lead to the deadlock because the code assumes the power up
while it was skipped due to the check above.

For dealing with such cases, this patch makes snd_hdac_power_up() and
_down() to two variants: with and without in_pm flag check.  The
version with pm flag check is named as snd_hdac_power_up_pm() while
the version without pm flag check is still kept as
snd_hdac_power_up().  (Just because the usage of the former is fewer.)

Then finally, the patch replaces each call potentially done in PM with
the new _pm() variant.

In theory, we can implement a unified version -- if we can distinguish
the current context whether it's in the pm path.  But such an
implementation is cumbersome, so leave the code like this a bit messy
way for now...

Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=96271
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-04-08 13:50:42 +02:00
Kailang Yang e1e62b98eb ALSA: hda/realtek - Support Dell headset mode for ALC288
Dell create new platform with ALC288 codec.
This patch will enable headset mode for Dino platform.

[slight code refactoring and compile fix by tiwai]

Signed-off-by: Kailang Yang <kailang@realtek.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-04-08 11:37:51 +02:00
Kailang Yang f3b7033265 ALSA: hda/realtek - Support headset mode for ALC286/288
Support headset mode for ALC286 and ALC288 platforms.

Signed-off-by: Kailang Yang <kailang@realtek.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-04-08 11:30:59 +02:00