1
0
Fork 0
Commit Graph

7102 Commits (9581bada1f64003fd8cc7bc6cad3f0643877b439)

Author SHA1 Message Date
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
Takashi Iwai 0a59983873 Merge branch 'for-linus' into for-next
Back merge HD-audio quirks to for-next branch, so that we can apply
a couple of more quirks.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-04-08 11:30:49 +02:00
Kailang Yang a59d7199f6 ALSA: hda/realtek - Make more stable to get pin sense for ALC283
Pin sense will active when power pin is wake up.
Power pin will not wake up immediately during resume state.
Add some delay to wait for power pin activated.

Signed-off-by: Kailang Yang <kailang@realtek.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-04-08 11:29:45 +02:00
Libin Yang 2d846c7402 ALSA: hda_intel: add AZX_DCAPS_I915_POWERWELL for SKL and BSW
HDMI/DP codec on SKL/BSW is in the power well.
The power well must be turned on before probing the
HDMI/DP codec.

This is a temporary patch, which will power on the
powerwell by adding AZX_DCAPS_I915_POWERWELL for SKL
and BSW. After restructuring and new flag is added,
this patch will be reverted.

Signed-off-by: Libin Yang <libin.yang@intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-04-07 14:51:35 +02:00
Michael Gernoth f32c1c1b46 ALSA: emu10k1: add Audigy 5/Rx
The Audigy 5/Rx is essentially an Audigy 4 behind a PLX PCIe-
bridge with an additional TOSLINK output.

Signed-off-by: Michael Gernoth <michael@gernoth.net>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-04-05 21:10:04 +02:00
Joe Perches eab0fbfa41 ALSA: Use const struct ac97_quirk
Use const to reduce data by ~3Kb.

Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-04-05 08:41:05 +02:00
Sudip Mukherjee 751e221689 ALSA: hda: fix possible null dereference
we are dereferencing pcm first then checking pcm. instead now lets put
them in same if condition so that pcm is checked first.

Signed-off-by: Sudip Mukherjee <sudip@vectorindia.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-04-04 14:32:16 +02:00
Kailang Yang 7081adf3f9 ALSA: hda/realtek - Support Dell headset mode for ALC256
Dell new platform of ALC256 audio codec.
Support headset mode for Dell ALC256 platform.

Signed-off-by: Kailang Yang <kailang@realtek.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-04-04 12:53:23 +02:00
Takashi Iwai 382fd7becc ALSA: hda - Enable widget power saving for Realtek codecs
Recent Realtek codecs support the finer power state control on each
widget.  Let's enable the new feature.

Tested-by: Hui Wang <hui.wang@canonical.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-04-04 12:24:00 +02:00
Takashi Iwai d545a57c5f ALSA: hda - Sync node attributes at resume from widget power saving
So far we assumed that the node attributes like amp values remain
during the power state transition of the node itself.  While this is
true for IDT/STAC codecs I've tested, but some other codecs don't seem
behaving in that way.

This patch implements a partial sync mechanism specific to the given
widget node.  Now we've merged the regmap support, and it can be
easily written with regcache_sync_region().

Tested-by: Hui Wang <hui.wang@canonical.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-04-04 12:22:52 +02:00
Takashi Iwai 664bc5c559 Merge branch 'topic/hda-regmap' into for-next
This merges the support of regmap in HD-audio infrastructure.
Many in-house cache codes in HD-audio driver are relaced with the
more standard regmap base now.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-04-04 12:16:30 +02:00
Hui Wang af95b41426 ALSA: hda - Add one more node in the EAPD supporting candidate list
We have a HP machine which use the codec node 0x17 connecting the
internal speaker, and from the node capability, we saw the EAPD,
if we don't set the EAPD on for this node, the internal speaker
can't output any sound.

Cc: <stable@vger.kernel.org>
BugLink: https://bugs.launchpad.net/bugs/1436745
Signed-off-by: Hui Wang <hui.wang@canonical.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-03-26 11:04:30 +01:00
Libin Yang db48abf436 ALSA: hda_intel: apply the Seperate stream_tag for Sunrise Point
The total stream number of Sunrise Point's input and output stream
exceeds 15, which will cause some streams do not work because
of the overflow on SDxCTL.STRM field if using the legacy
stream tag allocation method.

This patch uses the new stream tag allocation method by add
the flag AZX_DCAPS_SEPARATE_STREAM_TAG for Skylake platform.

Signed-off-by: Libin Yang <libin.yang@intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-03-26 07:30:13 +01:00
W. Trevor King 4738465c37 ALSA: hda/via - Add beep controls to VIA codecs
My codec has a beep-generating node:

  $ cat /proc/asound/card1/codec#0
  Codec: VIA VT1802
  ...
  Vendor Id: 0x11068446
  Subsystem Id: 0x15587410
  Revision Id: 0x100000
  ...
  Node 0x22 [Beep Generator Widget] wcaps 0x70040c: Mono Amp-Out
    Amp-Out caps: ofs=0x0a, nsteps=0x12, stepsize=0x05, mute=1
    Amp-Out vals:  [0x0a]
    Power states:  D0 D1 D2 D3
    Power: setting=D0, actual=D0
  ...

But I was missing the:

  Control: name=...

entries that I need to manage this widget from alsamixer.  With this
patch (based on the similar Mono Amp-Out handling in
patch_conexant.c), I get a new:

  input: HDA Digital PCBeep as /devices/pci0000:00/0000:00:1b.0/sound/card1/hdaudioC1D0/input15

entry in dmesg and controls to manage that beep:

  $ cat /proc/asound/card1/codec#0 | grep -A5 Beep
  Node 0x22 [Beep Generator Widget] wcaps 0x70040c: Mono Amp-Out
    Control: name="Beep Playback Volume", index=0, device=0
      ControlAmp: chs=1, dir=Out, idx=0, ofs=0
    Control: name="Beep Playback Switch", index=0, device=0
      ControlAmp: chs=1, dir=Out, idx=0, ofs=0
    Amp-Out caps: ofs=0x0a, nsteps=0x12, stepsize=0x05, mute=1
    Amp-Out vals:  [0x12]
    Power states:  D0 D1 D2 D3
    Power: setting=D0, actual=D0

[rebased and modified for the latest tree by tiwai]

Signed-off-by: W. Trevor King <wking@tremily.us>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-03-25 08:59:00 +01:00
Takashi Iwai 44e39b9853 ALSA: hda - Remove superfluous hda_nid_t definition in hda_codec.h
Just forgotten to remove.  It's now in sound/hdaudio.h.

Reported-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-03-25 07:44:21 +01:00
Krzysztof Kozlowski 46d212cbe4 ALSA: asihpi: Fix duplicate const for clock sources
Replace duplicated const keyword for 'sampleclock_sources' with proper
array of const pointers to const strings.

Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-03-24 11:51:43 +01:00
Sebastian Wicki 80b311d311 ALSA: hda - Add dock support for Thinkpad T450s (17aa:5036)
This model uses the same dock port as the previous generation.

Signed-off-by: Sebastian Wicki <gandro@gmx.net>
Cc: <stable@vger.kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-03-23 17:39:20 +01:00
Dan Carpenter 77008b70fe ALSA: echoaudio: read past end of array
We need to cap "ucontrol->id.index / num_busses_in(chip)" so the we
don't read beyond the end of the array.

I also adding a check on "in" and changing the type in
snd_echo_mixer_put() from short to unsigned int. Those changes are done
for symmetry and are cosmetic.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-03-23 14:00:28 +01:00
Takashi Iwai a551d91473 ALSA: hda - Use regmap for command verb caches, too
Like the previous patches, this patch converts also to the regmap, at
this time, the cached verb writes are the target.  But this conversion
needs a bit more caution than before.

- In the old code, we just record any verbs as is, and restore them at
  resume.  For the regmap scheme, this doesn't work, since a few verbs
  like AMP or DIGI_CONVERT are asymmetrical.  Such verbs are converted
  either to the dedicated function (snd_hda_regmap_xxx_amp()) or
  changed to the unified verb.

- Some verbs have to be declared as vendor-specific ones before
  accessing via regmap.

Also, the minor optimization with codec->cached_write flag is dropped
in a few places, as this would confuse the operation.  Further
optimizations will be brought in the later patches, if any.

This conversion ends up with a drop of significant amount of codes,
mostly the helper codes that are no longer used.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-03-23 13:19:41 +01:00
Takashi Iwai faa75f8a2e ALSA: hda - Use regmap for parameter caches, too
The amp hash table was used for recording the cached reads of some
capability values like pin caps or amp caps.  Now all these are moved
to regmap as well.

One addition to the regmap helper is codec->caps_overwriting flag.
This is set in snd_hdac_override_parm(), and the regmap helper accepts
any register while this flag is set, so that it can overwrite even the
read-only verb like AC_VERB_PARAMETERS.  The flag is cleared
immediately in snd_hdac_override_parm(), as it's a once-off flag.

Along with these changes, the no longer needed amp hash and relevant
fields are removed from hda_codec struct now.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-03-23 13:19:40 +01:00
Takashi Iwai eeecd9d10d ALSA: hda - Use regmap for amp accesses
This patch converts the amp access functions to the regmap helpers.
The amp values were formerly cached in the own hash table.  Now it's
dropped by the regmap's cache.

The only tricky conversion is snd_hda_codec_amp_init().  This function
shouldn't do anything if the amp was already initialized.  For
achieving this behavior, a value is read once at first temporarily in
the cache-only mode.  Only if it returns an error,  i.e. the item
still doesn't exist in the cache, it proceeds to the update.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-03-23 13:19:39 +01:00
Takashi Iwai 9ba17b4d13 ALSA: hda - Implement uncached version of parameter reads
Sometimes we need the uncached reads, e.g. for refreshing the tree.
This patch provides the helper function for that and uses it for
refreshing widgets, reading subtrees and the whole proc reads.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-03-23 13:19:38 +01:00
Takashi Iwai 01ed3c06c6 ALSA: hda - Use regmap for codec parameter reads
Let's start converting the access functions to regmap.
The first one is the simplest, just converting the codec parameter
read helper function snd_hda_param_read().

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-03-23 13:19:37 +01:00
Takashi Iwai 4d75faa044 ALSA: hda - Add regmap support
This patch adds an infrastructure to support regmap-based verb
accesses.  Because o the asymmetric nature of HD-audio verbs,
especially the amp verbs, we need to translate the verbs as a sort of
pseudo registers to be mapped uniquely in regmap.

In this patch, a pseudo register is built from the NID, the
AC_VERB_GET_* and 8bit parameters, i.e. almost in the form to be sent
to HD-audio bus but without codec address field.  OTOH, for writing,
the same pseudo register is translated to AC_VERB_SET_* automatically.
The AC_VERB_SET_AMP_* verb is re-encoded from the corresponding
AC_VERB_GET_AMP_* verb and parameter at writing.

Some verbs has a single command for read but multiple for writes.  A
write for such a verb is split automatically to multiple verbs.

The patch provides also a few handy helper functions.  They are
designed to be accessible even without regmap.  When no regmap is set
up (e.g. before the codec device instantiation), the direct hardware
access is used.  Also, it tries to avoid the unnecessary power-up.
The power up/down sequence is performed only on demand.

The codec driver needs to call snd_hdac_regmap_exit() and
snd_hdac_regmap_exit() at probe and remove if it wants the regmap
access.

There is one flag added to hdac_device.  When the flag lazy_cache is
set, regmap helper ignores a write for a suspended device and returns
as if it was actually written.  It reduces the hardware access pretty
much, e.g. when adjusting the mixer volume while in idle.  This
assumes that the driver will sync the cache later at resume properly,
so use it carefully.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-03-23 13:19:36 +01:00
Takashi Iwai 71fc4c7ef5 ALSA: hda - Move generic array helpers to core lib
This will be used by the regmap support.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-03-23 13:19:35 +01:00
Takashi Iwai e311782acd ALSA: hda - Re-add tracepoints to HD-audio core driver
Now let's take the basic tracepoints back to the HD-audio driver.
The three bus tracepoints, hda_send_cmd, hda_get_response and
hda_unsol_event are revived but in a slightly different form.
Since we don't assign the card number there, print the bus device name
instead.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-03-23 13:17:58 +01:00
Takashi Iwai c4c2533f80 ALSA: hda - Fix possible runtime PM refcount unbalance
When the driver is unloaded before the codec is bound, it still keeps
the runtime PM refcount up, and results in the unbalance.  This patch
covers these cases by introducing a flag indicating the runtime PM
initialization and handling the codec registration procedure more
properly.  It also fixes the missing input beep device as a gratis,
too.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-03-23 13:17:48 +01:00
Takashi Iwai 0585244869 ALSA: hda - Support indirect execution of verbs
Add an overriding exec_verb op to struct hdac_device so that the call
via snd_hdac_exec_verb() can switch to a different route depending on
the setup.  The codec driver sets this field so that it can handle the
errors or applying quirks appropriately.  Furthermore, this mechanism
will be used for smooth transition for the regmap support in later
patches.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-03-23 13:17:37 +01:00
Takashi Iwai 3256be6537 ALSA: hda - Add widget sysfs tree
This patch changes the sysfs files assigned to the codec device on the
bus which were formerly identical with hwdep sysfs files.  Now it
shows only a few core parameter, vendor_id, subsystem_id, revision_id,
afg, mfg, vendor_name and chip_name.

In addition, now a widget tree is added to the bus device sysfs
directory for showing the widget topology and attributes.  It's just a
flat tree consisting of subdirectories named as the widget NID
including various attributes like widget capability bits.  The AFG
(usually NID 0x01) is always found there, and it contains always
amp_in_caps, amp_out_caps and power_caps files.  Each of these
attributes show a single value.  The rest are the widget nodes
belonging to that AFG.  Note that the child node might not start from
0x02 but from another value like 0x0a.

Each child node may contain caps, pin_caps, amp_in_caps, amp_out_caps,
power_caps and connections files.  The caps (representing the widget
capability bits) always contain a value.  The rest may contain
value(s) if the attribute exists on the node.  Only connections file
show multiple values while other attributes have zero or one single
value.

An example of ls -R output is like below:
% ls -R /sys/bus/hdaudio/devices/hdaudioC0D0/
/sys/bus/hdaudio/devices/hdaudioC0D0/widgets/:
01/  04/  07/  0a/  0d/  10/  13/  16/  19/  1c/  1f/  22/
02/  05/  08/  0b/  0e/  11/  14/  17/  1a/  1d/  20/  23/
03/  06/  09/  0c/  0f/  12/  15/  18/  1b/  1e/  21/

/sys/bus/hdaudio/devices/hdaudioC0D0/widgets/01:
amp_in_caps  amp_out_caps  power_caps

/sys/bus/hdaudio/devices/hdaudioC0D0/widgets/02:
amp_in_caps  amp_out_caps  caps  connections  pin_caps  pin_cfg
power_caps

/sys/bus/hdaudio/devices/hdaudioC0D0/widgets/03:
.....

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-03-23 13:17:27 +01:00
Takashi Iwai 7639a06c23 ALSA: hda - Move a part of hda_codec stuff into hdac_device
Now some codes and functionalities of hda_codec struct are moved to
hdac_device struct.  A few basic attributes like the codec address,
vendor ID number, FG numbers, etc are moved to hdac_device, and they
are accessed like codec->core.addr.  The basic verb exec functions are
moved, too.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-03-23 13:17:17 +01:00
Takashi Iwai d068ebc25e ALSA: hda - Move some codes up to hdac_bus struct
A few basic codes for communicating over HD-audio bus are moved to
struct hdac_bus now.  It has only command and get_response ops in
addition to the unsolicited event handling.

Note that the codec-side tracing support is disabled temporarily
during this transition due to the code shuffling.  It will be
re-enabled later once when all pieces are settled down.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-03-23 13:17:02 +01:00
Takashi Iwai e3d280fc6d ALSA: hda - Make snd_hda_bus_type public
Define the common hd-audio driver and device types to bind over
snd_hda_bus_type publicly.  This allows to implement other type of
device and driver code over hd-audio bus.

Now both struct hda_codec and struct hda_codec_driver inherit these
new struct hdac_device and struct hdac_driver, respectively.

The bus registration is done in subsys_initcall() to assure it
before any other driver registrations.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-03-23 13:15:51 +01:00
Takashi Iwai 967b1307b6 ALSA: hda - Rename power_mgmt flag with power_save_node
David suggested that the name "power_mgmt" is too ambiguous.  Rename
the flag with a bit clearer one "power_save_node".

Also, add the corresponding description to HD-Audio.txt, too.

Reported-by: David Henningsson <david.henningsson@canonical.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-03-20 18:31:18 +01:00
Takashi Iwai 6b275b1400 ALSA: hda - Fix power of pins used for mute LED with vrefs
Some pins are used for controlling the LED with the VREF value.
This patch changes the power behavior of such pins to be constantly
up.  A new state, pin_fixed, is introduced to nid_path to indicate
that the path contains the fixed pin.  This improves also the
readability a bit for other static routes, too.

Then a helper function snd_hda_gen_fix_pin_power() is called from the
codec driver for such fixed pins, and it will create fake paths
containing only these pins with pin_fixed=1 flag.

Reported-by: David Henningsson <david.henningsson@canonical.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-03-20 18:30:48 +01:00
Takashi Iwai fc0daafeb4 Merge branch 'topic/hda-power' into for-next 2015-03-20 09:08:01 +01:00
Takashi Iwai 5ccf835cc7 ALSA: hda - Adjust power of beep widget and outputs
As the widget PM may turn off the pins, this might lead to the silent
output for beep when no explicit paths are given.  This patch adds
fake output paths for the beep widget so that the output pins are
dynamically powered upon beep on/off.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-03-18 09:23:10 +01:00
Takashi Iwai 688b12cc3c ALSA: hda - Use the new power control for VIA codecs
VIA codecs used to have the own power controls but they were disabled
at transition to the generic parser due to the coding assuming the
fixed routes.  Now we get the proper support of equivalently fine
power management in the generic parser, and the old kludges can be
replaced with it.  This results in the reduction of lots of dead
codes.

The advanced PM feature is disabled as default like before for keeping
the compatible behavior.  It's enabled via "Dynamic Power-Control"
mixer element.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-03-18 09:22:35 +01:00
Takashi Iwai e6feb5d085 ALSA: hda - Support advanced power state controls
This patch enables the finer power state control of each widget
depending on the jack plug state and streaming state in addition to
the existing power_down_unused power optimization.  The new feature is
enabled only when codec->power_mgmt flag is set.

Two new flags, pin_enabled and stream_enabled, are introduced in
nid_path struct for marking the two individual power states: the pin
plug/unplug and DAC/ADC stream, respectively.  They can be set
statically in case they are static routes (e.g. some mixer paths),
too.

The power up and down events for each pin are triggered via the
standard hda_jack table.  The call order is hard-coded, relying on the
current implementation of jack event chain (a la FILO/stack order).

One point to be dealt carefully is that DAC/ADC cannot be powered
on/off while streaming.  They are pinned as long as the stream is
running.  For controlling the power of DAC/ADC, a new patch_ops is
added.  The generic parser provides the default callback for that.

As of this patch, only IDT/Sigmatel codec driver enables the flag.
The support on other codecs will follow.

An assumption we made in this code is that the widget state (e.g. amp,
pinctl, connections) remains after the widget power transition (not
about FG power transition).  This is true for IDT codecs, at least.
But if the widget state is lost at widget power transition, we'd need
to implement additional code to sync the cached amp/verbs for the
specific NID.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-03-18 09:22:28 +01:00
Clément Guedez 1aa9a4ea4f ALSA: ice1724: ESI W192M: Add sampling rate control of the ADC/DAC
Add sampling rate control for ADC/DAC for ESI W192M.
Allow to switch between 48K/96K/192K sampling rate.
All DAC need to be mute when changing samplerate.

Signed-off-by: Clément Guedez <klem.dev@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-03-18 08:07:00 +01:00
Clément Guedez ae8a9a1125 ALSA: ice1724: ESI W192M: Add text Line in/Mic for selecting input gain state
Add text Line in/Mic for selecting input gain state in mixer for ESI W192M.

Signed-off-by: Clément Guedez <klem.dev@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-03-18 08:06:25 +01:00
Clément Guedez 16ddbe738a ALSA: ice1724: ESI W192M: Add TLV support for control value in dB scale
Add TLV support to control volume using dB scale for input and ouput on ESI W192M.

Signed-off-by: Clément Guedez <klem.dev@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-03-18 08:05:48 +01:00
Clément Guedez f8a8b3a835 ALSA: ice1724: ESI W192M: Enable midi i/o of port envy24 chip as available
Enable midi i/o port of envy24 chip as their are available on ESI W192M soundcard.

Signed-off-by: Clément Guedez <klem.dev@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-03-18 08:05:30 +01:00
Clément Guedez 7127744a5e ALSA: ice1724: ESI W192M: Update eeprom structure to C99 standard
Update eeprom structure to C99 standard to be compliant with change in alsa.
It's just a notation change, no configuration change.

Signed-off-by: Clément Guedez <klem.dev@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-03-18 08:05:07 +01:00
Clément Guedez b56df151d3 ALSA: ice1724: ESI W192M: Correct copy/paste from prodigy driver
Correct copy/paste name from prodigy driver, no behaviour change, only name.

Signed-off-by: Clément Guedez <klem.dev@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-03-18 08:04:52 +01:00
Takashi Iwai fb83b63510 ALSA: hda - Simplify PCM setup overrides
This patch does two things:
- code refactoring with a local helper function,
- allow codec drivers to provide the specific PCM stream info pointers
  only for overriding the non-NULL entries, instead of copying the
  whole.

This simplifies the codec driver side (currently the only user is
alc269's 44kHz fixed rate).

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-03-17 20:57:20 +01:00
Takashi Iwai 2a557a861a Merge branch 'topic/hda-unbind' into for-next 2015-03-16 14:48:20 +01:00
Takashi Iwai 8f88f0256f Merge branch 'topic/hda-bus' into for-next 2015-03-16 14:48:16 +01:00
Takashi Iwai 34e72afe73 Merge branch 'for-linus' into for-next 2015-03-16 14:48:05 +01:00
Takashi Iwai cc261738ad ALSA: hda - Treat stereo-to-mono mix properly
The commit [ef403edb7558: ALSA: hda - Don't access stereo amps for
mono channel widgets] fixed the handling of mono widgets in general,
but it still misses an exceptional case: namely, a mono mixer widget
taking a single stereo input.  In this case, it has stereo volumes
although it's a mono widget, and thus we have to take care of both
left and right input channels, as stated in HD-audio spec ("7.1.3
Widget Interconnection Rules").

This patch covers this missing piece by adding proper checks of stereo
amps in both the generic parser and the proc output codes.

Reported-by: Raymond Yau <superquad.vortex2@gmail.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-03-16 14:44:03 +01:00
Takashi Iwai b2a0bafa75 ALSA: hda - Use shutdown driver ops instead of reboot notifier
The driver shutdown ops is simpler than registering reboot notifier
manually.  There should be no functional change by this -- the codec
driver calls its own callback while the bus driver just calls
azx_stop() like before.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-03-13 15:28:58 +01:00
Takashi Iwai ef403edb75 ALSA: hda - Don't access stereo amps for mono channel widgets
The current HDA generic parser initializes / modifies the amp values
always in stereo, but this seems causing the problem on ALC3229 codec
that has a few mono channel widgets: namely, these mono widgets react
to actions for both channels equally.

In the driver code, we do care the mono channel and create a control
only for the left channel (as defined in HD-audio spec) for such a
node.  When the control is updated, only the left channel value is
changed.  However, in the resume, the right channel value is also
restored from the initial value we took as stereo, and this overwrites
the left channel value.  This ends up being the silent output as the
right channel has been never touched and remains muted.

This patch covers the places where unconditional stereo amp accesses
are done and converts to the conditional accesses.

Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=94581
Cc: <stable@vger.kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-03-13 07:37:21 +01:00
Takashi Iwai 2ddee91abe ALSA: hda - Add workaround for MacBook Air 5,2 built-in mic
MacBook Air 5,2 has the same problem as MacBook Pro 8,1 where the
built-in mic records only the right channel.  Apply the same
workaround as MBP8,1 to spread the mono channel via a Cirrus codec
vendor-specific COEF setup.

Reported-and-tested-by: Vasil Zlatanov <vasil.zlatanov@gmail.com>
Cc: <stable@vger.kernel.org> # 3.9+
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-03-12 20:50:32 +01:00
Takashi Iwai bad994f5b4 ALSA: hda - Set single_adc_amp flag for CS420x codecs
CS420x codecs seem to deal only the single amps of ADC nodes even
though the nodes receive multiple inputs.  This leads to the
inconsistent amp value after S3/S4 resume, for example.

The fix is just to set codec->single_adc_amp flag.  Then the driver
handles these ADC amps as if single connections.

Reported-and-tested-by: Vasil Zlatanov <vasil.zlatanov@gmail.com>
Cc: <stable@vger.kernel.org> # 3.9+
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-03-12 20:28:04 +01:00
Takashi Iwai e6826ef145 Merge branch 'for-linus' into for-next 2015-03-12 07:38:46 +01:00
Takashi Iwai ddb6ca75b5 ALSA: hda - Fix built-in mic on Compaq Presario CQ60
Compaq Presario CQ60 laptop with CX20561 gives a wrong pin for the
built-in mic NID 0x17 instead of NID 0x1d, and it results in the
non-working mic.  This patch just remaps the pin correctly via fixup.

Bugzilla: https://bugzilla.opensuse.org/show_bug.cgi?id=920604
Cc: <stable@vger.kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-03-11 16:05:19 +01:00
Takashi Iwai 4aa01c408b Merge branch 'for-linus' into for-next
Merging the HD-audio fixes back to base devel branch for further
working on it.
2015-03-09 08:42:00 +01:00
Takashi Iwai a1f3f1ca66 ALSA: hda - Fix regression of HD-audio controller fallback modes
The commit [63e51fd708f5: ALSA: hda - Don't take unresponsive D3
transition too serious] introduced a conditional fallback behavior to
the HD-audio controller depending on the flag set.  However, it
introduced a silly bug, too, that the flag was evaluated in a reverse
way.  This resulted in a regression of HD-audio controller driver
where it can't go to the fallback mode at communication errors.

Unfortunately (or fortunately?) this didn't come up until recently
because the affected code path is an error handling that happens only
on an unstable hardware chip.  Most of recent chips work stably, thus
they didn't hit this problem.  Now, we've got a regression report with
a VIA chip, and this seems indeed requiring the fallback to the
polling mode, and finally the bug was revealed.

The fix is a oneliner to remove the wrong logical NOT in the check.
(Lesson learned - be careful about double negation.)

The bug should be backported to stable, but the patch won't be
applicable to 3.13 or earlier because of the code splits.  The stable
fix patches for earlier kernels will be posted later manually.

Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=94021
Fixes: 63e51fd708 ('ALSA: hda - Don't take unresponsive D3 transition too serious')
Cc: <stable@vger.kernel.org> # v3.14+
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-03-09 08:41:13 +01:00
Fabio Estevam 5371fc0ecd ALSA: ac97: ac97_patch: Simplify patch_vt1613_specific()
We can simplify the code by returning patch_build_controls() directly.

Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-03-06 17:47:27 +01:00
Maciej S. Szmigiero d6482288aa ALSA: ac97: Add VT1613 AC97 codec support
Patch to add an VT1613 AC97 codec support.

This codec has additional DC offset removal control,
headphone output and no video input.

Signed-off-by: Maciej Szmigiero <mail@maciej.szmigiero.name>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-03-06 17:01:30 +01:00
Takashi Iwai a52afea68f ASoC: Changes for v4.1
A selection of changes for v4.1 so far.  The main things are:
 
  - Move of jack registration to the card where it belongs.
  - Support for DAPM routes specified by both the machine driver and DT.
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
 
 iQEcBAABAgAGBQJU960DAAoJECTWi3JdVIfQkKIH/RDvxRn8dvKOPF5U9Uix3chH
 JWKkzqfsMP0EpmQTzCQPp0ShAyYcWSbYsopicynPxUem5vS4Z8+UmOgEEgkj59pK
 USbF6v1jCQXA6BcbKyUcRRBD9FtRkfVDc7mYbRs2CcwQz2CGCgee41cvPM+2BT+z
 QdNC9UJARSweGvE1IUJSfpfYOly+BJ2s0/28RaQ0PGt+I0auoYx7IMFgMSDjv2p6
 PY0kyQiwm3Kyj2uNXPZ5gEuPxlw/t8n4fbQNrBYAvxzN+EF5NrGdKE3N7MI1xRV/
 EkFhzy+uM3X9c37tb2lT2fgPFlBc9rgPuLPSyoQ6nxa5ghCqAlgRhzpxRem8hhU=
 =VlCw
 -----END PGP SIGNATURE-----

Merge tag 'asoc-v4.1' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound into for-next

ASoC: Changes for v4.1

A selection of changes for v4.1 so far.  The main things are:

 - Move of jack registration to the card where it belongs.
 - Support for DAPM routes specified by both the machine driver and DT.
2015-03-06 14:25:27 +01:00
Hui Wang 70658b9949 ALSA: hda - One more Dell macine needs DELL1_MIC_NO_PRESENCE quirk
Cc: <stable@vger.kernel.org>
BugLink: https://bugs.launchpad.net/bugs/1428947
Signed-off-by: Hui Wang <hui.wang@canonical.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-03-06 13:04:58 +01:00
Takashi Iwai d56db741b8 ALSA: hda - Release resources in device release callback
Move the destructor code to device release callback for the codec
object instead.  This is a safer place to release the resources than
dev_free callback in general.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-03-03 11:48:46 +01:00
Takashi Iwai 2f35c630f7 ALSA: hda - Use standard workqueue for unsol and jack events
The events that are handled by HD-audio drivers are no frequent and
urgent ones, so we can use the standard workqueue without any problem
nowadays.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-03-03 11:37:57 +01:00
Takashi Iwai bcd96557bd ALSA: hda - Build PCMs and controls at codec driver probe
This makes the code flow easier -- instead of the controller driver
calling snd_hda_build_pcms() and snd_hda_build_controls() explicitly,
the codec driver itself builds PCMs and controls at probe time.  Then
the controller driver only needs to call snd_card_register().

Also, this allows us the full bind/unbind control, too.  Even when a
codec driver is bound later, it automatically registers the new PCM
and controls by itself.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-03-03 11:28:36 +01:00
Takashi Iwai 9a6246ff78 ALSA: hda - Implement unbind more safely
Now we have all pieces ready, and put them into places:
- add the hda_pcm refcount to azx_pcm_open() and azx_pcm_close(),
- call the most of cleanup code in hda_codec_reset() from the codec
  driver remove,
- call the same code also from the hda_codec object free.

Then the codec driver can be unbound more safely now.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-03-03 11:28:12 +01:00
Takashi Iwai 61ca4107a1 ALSA: hda - Don't assume non-NULL PCM ops
The PCM ops might be set NULL, or cleared to NULL when the driver is
unbound.  Give a proper NULL check at each place to be more robust.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-03-03 11:26:27 +01:00
Takashi Iwai bbbc7e8502 ALSA: hda - Allocate hda_pcm objects dynamically
So far, the hda_codec object kept the hda_pcm list in an array, and
the codec driver was expected to assign the array.  However, this
makes the object life cycle management harder, because the assigned
array is freed at the codec driver detach while it might be still
accessed by the opened streams.

In this patch, we allocate each hda_pcm object dynamically and manage
it as a linked list.  Each object has a kref refcount, and both the
codec driver binder and the PCM open/close touches it, so that the
object won't be freed while in use.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-03-03 11:26:24 +01:00
Takashi Iwai f4de8fe6cf ALSA: hda - Remove superfluous memory allocation error messages
The memory allocators should have already given the kernel warning
messages, thus we don't have to annoy again.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-03-03 11:25:17 +01:00
Takashi Iwai 6efdd8513f ALSA: hda - Add card field to hda_codec struct
Allow the codec object to have an individual card pointer.  Not only
this simplifies the redirections in many places, also this will allow
us to make each codec assigned to a different card object.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-03-03 11:25:16 +01:00
Takashi Iwai 1a4ba30cce ALSA: hda - Split snd_hda_build_pcms()
snd_hda_build_pcms() does actually three things: let the codec driver
build up hda_pcm list, set the PCM default values, and call the
attach_pcm bus ops for each hda_pcm instance.  The former two are
basically independent from the bus implementation, so it'd make the
code a bit more readable.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-03-03 11:25:15 +01:00
Takashi Iwai 820cc6cf2c ALSA: hda - Clear pcm pointer assigned to hda_pcm at device removal
We leave the pcm field of struct hda_pcm at removal of each device, so
far.  This hasn't been a problem since unbinding the codec driver
isn't supposed to happen and another route via snd_hda_codec_reset()
clears all the once.  However, for a proper unbind implementation, we
need to care about it.

This patch does the thing above properly:

- Include struct hda_pcm pointer instead of struct hda_pcm_stream
  pointers in struct azx_dev.  This allows us to point the hda_pcm
  object at dev_free callback.

- Introduce to_hda_pcm_stream() macro for better readability.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-02-26 15:52:45 +01:00
Takashi Iwai 7e40b80da4 ALSA: hda - Remove channel mode helper functions
They are no longer used, let's kill them.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-02-26 15:37:10 +01:00
Takashi Iwai 777ae19468 ALSA: hda - Set parent of input beep devices
Set the card device as the parent like other sound devices instead of
leaving it empty.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-02-26 15:37:10 +01:00
Takashi Iwai 709949fbe9 ALSA: hda - Power down codec automatically at registration
So far, we let the controller driver power down the all codecs at the
end of probe.  But this can be done better in the codec's dev_register
callback.  This results in the reduction of duplicated codes in each
control driver.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-02-26 15:37:08 +01:00
Takashi Iwai 55ed9cd1fe ALSA: hda - Replace bus pm_notify with the standard runtime PM framework
Now the final bit of runtime PM cleanup: instead of manual
notification of the power up/down of the codec via hda_bus pm_notify
ops, use the standard runtime PM feature.

The child codec device will kick off the runtime PM of the parent
(PCI) device upon suspend/resume automatically.  For managing whether
the link can be really turned off, we use the bit flags
bus->codec_powered instead of the earlier bus->power_keep_link_on.
flag.  Each codec driver is responsible to set/clear the bit flag, and
the controller device can be turned off only when all these bits are
cleared.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-02-26 15:37:02 +01:00
Takashi Iwai bb573928e1 ALSA: hda - Drop power_save value indirection in hda_bus
We used to pass the power_save option value to hda_bus via a given
pointer.  This was needed to refer to the value from the HD-audio core
side.  However, after the transition to the runtime PM, this is no
longer needed.

This patch drops the power_save value indirection in hda_bus above,
and let the controller driver reprograms the autosuspend value
explicitly by a new helper, snd_hda_set_power_save().  Without this
call, the HD-audio core doesn't set up the autosuspend and flip the
runtime PM.  (User may still be able to set up via sysfs, though.)

Along with this change, the pointer argument of azx_bus_create() is
dropped as well.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-02-26 15:36:52 +01:00
Dan Carpenter 9603cded0e ALSA: cmipci: remove a stray space character
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-02-25 20:08:44 +01:00
Dan Carpenter 7f788e0cc0 ALSA: azt3328: some indenting cleanups
A few minor tweaks to make things line up correctly.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-02-25 20:08:35 +01:00
Takashi Iwai de5d0ad506 ALSA: hda - Disable runtime PM for Panther Point again
This is essentially a partial revert of the commit [b1920c21102a:
'ALSA: hda - Enable runtime PM on Panther Point'].  There was a bug
report showing the HD-audio bus hang during runtime PM on HP Spectre
XT.

Reported-by: Dang Sananikone <dang.sananikone@gmail.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-02-25 07:53:31 +01:00
Jaroslav Kysela 37ed398839 ALSA: hda: controller code - do not export static functions
It is a bad idea to export static functions. GCC for some platforms
shows errors like:

  error: __ksymtab_azx_get_response causes a section type conflict

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
Cc: <stable@vger.kernel.org> # v3.15+
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-02-24 14:14:55 +01:00
Takashi Iwai cc72da7d4d ALSA: hda - Use standard runtime PM for codec power-save control
Like the previous transition of suspend/resume, now move the
power-save code to the standard runtime PM.  As usual for runtime PM,
it's a bit tricky, but this simplified codes a lot in the end.

For keeping the usage compatibility, power_save module option still
controls the whole power-saving behavior on all codecs.  The value is
translated to pm_runtime_*_autosuspend() and pm_runtime_allow() /
pm_runtime_forbid() calls.

snd_hda_power_up() and snd_hda_power_down() are translated to
pm_runtime_get_sync() and pm_runtime_put_autosuspend(), respectively.
Since we can do call pm_runtime_get_sync() more reliably, the sync
version is used always and snd_hda_power_up_d3wait() is dropped.
Another slight difference is that snd_hda_power_up()/down() don't call
runtime_pm code during the suspend/resume transition phase.  Calling
them there isn't safe unlike our own code, resulted in unexpected
behavior (endless wakeups).

The hda_power_count tracepoint was removed, as it doesn't match well
with the new code.

Last but not least, we need to set ignore_children flag in the parent
dev.power field so that the runtime PM of the controller chip won't
get confused.  The notification is still done in the bus pm_notify
callback.  We'll get rid of this hack in the later patch.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-02-23 09:16:07 +01:00
Takashi Iwai 59ed1eade1 ALSA: hda - Move codec suspend/resume to codec driver
This patch moves the suspend/resume mechanisms down to each codec
driver level, as we have a proper codec driver bound on the bus now.
Then we get the asynchronous PM gratis without fiddling much in the
driver level.

As a soft-landing transition, implement the common suspend/resume pm
ops for hda_codec_driver and keep the each codec driver intact.  Only
the callers of suspend/resume in the controller side (azx_suspend()
and azx_resume()) are removed.

Another involved place is azx_bus_reset() calling the temporary
suspend and resume as a hackish method of bus reset.  The HD-audio
core provide a helper function snd_hda_bus_reset() instead.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-02-23 09:16:07 +01:00
Takashi Iwai d8a766a16e ALSA: hda - Bind codecs via standard bus
Now we create the standard HD-audio bus (/sys/bus/hdaudio), and bind
the codec driver with the codec device over there.  This is the first
step of the whole transition so that the changes to each codec driver
are kept as minimal as possible.

Each codec driver needs to register hda_codec_driver struct containing
the currently existing preset via the new helper macro
module_hda_codec_driver().  The old hda_codec_preset_list is replaced
with this infrastructure.  The generic parsers (for HDMI and other)
are also included in the preset with the special IDs to bind
uniquely.

In HD-audio core side, the device binding code is split to
hda_bind.c.  It provides the snd_hda_bus_type implementation to match
the codec driver with the given codec vendor ID.  It also manages the
module auto-loading by itself like before: when the matching isn't
found, it tries to probe the corresponding codec modules, and finally
falls back to the generic drivers.  (The special ID mentioned above is
set at this stage.)

The only visible change to outside is that the hdaudio sysfs entry now
appears in /sys/bus/devices, not as a sound class device.

More works to move the suspend/resume and remove ops will be
(hopefully) done in later patches.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-02-23 09:16:06 +01:00
Takashi Iwai 327ef4f025 ALSA: hda - Decouple PCM and hwdep devices from codec object
This is a preliminary patch for the hda_bus implementation, removing
the parent device setup to codec device.  Since the bus and the class
devices can't be crossed over, leave the sound devices to the default
parent device as is.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-02-23 09:16:06 +01:00
Takashi Iwai 72f770c6ac Merge branch 'topic/timestamp' into for-next 2015-02-23 09:15:02 +01:00
Takashi Iwai 8d085d3ca9 Merge branch 'topic/hda-cleanup' into for-next 2015-02-23 09:14:22 +01:00
Takashi Iwai 6176fadce2 Merge branch 'topic/seq-cleanup' into for-next 2015-02-23 09:13:47 +01:00
Takashi Iwai 66c21c5af6 Merge branch 'topic/cleanup' into for-next 2015-02-23 09:13:29 +01:00
Takashi Iwai 6426460e5d ALSA: hda - Add pin configs for ASUS mobo with IDT 92HD73XX codec
BIOS doesn't seem to set up pins for 5.1 and the SPDIF out, so we need
to give explicitly here.

Reported-and-tested-by: Misan Thropos <misanthropos@gmx.de>
Cc: <stable@vger.kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-02-23 08:46:04 +01:00
Pierre-Louis Bossart 9e94df3a62 ALSA: hda: replace .wallclock by .get_time_info
No real functional change, only take wall clock and system time
in same routine and add accuracy report.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-02-20 17:30:06 +01:00
Takashi Iwai 781c7b9615 ALSA: hda - Avoid unnecessary power-up at mixer amp changes
When the mixer amp is touched by control elements, we don't have to
power up always; if the codec was suspended at the time, we can just
update the amp cache and it's reflected to the hardware upon resume.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-02-20 10:37:48 +01:00
Takashi Iwai 96d2bd6e3c ALSA: hda - Split azx_codec_create() to two phases
azx_create_codec() function does actually two things: create a bus and
probe codecs.  For the future work, split this to two logical
functions, azx_bus_create() and azx_probe_codecs().

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-02-19 21:41:40 +01:00
Takashi Iwai b8f28d5364 ALSA: hda - Drop azx_mixer_create()
It's just an indirection, so let the caller directly calling
snd_hda_build_controls().

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-02-19 21:41:32 +01:00
Takashi Iwai 89a93fea61 ALSA: hda - Fold hda_priv.h into hda_controller.h
There is no big reason to keep them separately.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-02-19 21:41:25 +01:00
Takashi Iwai 364aa716f4 ALSA: hda - Introduce azx_has_pm_runtime() macro
For making the debugging of runtime PM easier, introduce
azx_has_pm_runtime() and use it in all places checking the runtime pm
driver capability.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-02-19 21:41:18 +01:00
Takashi Iwai 922c88a836 ALSA: hda - Embed struct hda_bus_unsolicited into struct hda_bus
There is no big merit to handle hda_bus_unsolicited object
individually, as it's tightly coupled with the hda_bus object itself.
Embedding it makes the code simpler in the end.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-02-17 14:46:40 +01:00
Takashi Iwai ef7449780e ALSA: hda - Drop hda_bus_template for snd_hda_bus_new()
Instead of copying from the given template, let the caller fills the
fields after creation.  This simplifies the code after all.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-02-17 14:23:57 +01:00
Adrian Knoth 0c8d948565 ALSA: hdspm - DRY cleanup of snd_pcm_ops
This commit removes code duplication between
snd_hdspm_{capture,playback}_ops. No semantic changes intended, this is
purely cosmetic.

Signed-off-by: Adrian Knoth <aknoth@google.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-02-17 07:40:36 +01:00
Adrian Knoth 8b73b86729 ALSA: hdspm - DRY cleanup in .release callback
This commit removes code duplication between
snd_hdspm_{capture,playback}_release. No semantic changes intended, this
is purely cosmetic.

Signed-off-by: Adrian Knoth <aknoth@google.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-02-17 07:40:30 +01:00
Adrian Knoth 5ecc5dc720 ALSA: hdspm - DRY cleanup in .open callbacks
This commit removes code duplication between
snd_hdspm_{capture,playback}_open. No semantic changes intended, this is
purely cosmetic.

Signed-off-by: Adrian Knoth <aknoth@google.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-02-17 07:40:24 +01:00
Eliot Blennerhassett 93ceaa303b ALSA: hda/tegra check correct return value from ioremap_resource
Signed-off-by: Eliot Blennerhassett <eliot@blennerhassett.gen.nz>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-02-14 08:57:15 +01:00
Adrian Knoth f0153c3d94 ALSA: hdspm - Constrain periods to 2 on older cards
RME RayDAT and AIO use a fixed buffer size of 16384 samples. With period
sizes of 32-4096, this translates to 4-512 periods.

The older RME cards have a variable buffer size but require exactly two
periods.

This patch enforces nperiods=2 on those cards.

Signed-off-by: Adrian Knoth <adi@drcomp.erfurt.thur.de>
Cc: <stable@vger.kernel.org> # 2.6.39+
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-02-13 17:22:58 +01:00
Hui Wang 7976eb49cb ALSA: hda - enable mute led quirk for one more hp machine.
Otherwise, the mute led can't work at all.

Tested-by: Taihsiang Ho <taihsiang.ho@canonical.com>
Cc: <stable@vger.kernel.org>
BugLink: https://bugs.launchpad.net/bugs/1410704
Signed-off-by: Hui Wang <hui.wang@canonical.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-02-13 12:51:58 +01:00
Takashi Iwai 056622053b ALSA: seq: Define driver object in each driver
This patch moves the driver object initialization and allocation to
each driver's module init/exit code like other normal drivers.  The
snd_seq_driver struct is now published in seq_device.h, and each
driver is responsible to define it with proper driver attributes
(name, probe and remove) with snd_seq_driver specific attributes as id
and argsize fields.  The helper functions snd_seq_driver_register(),
snd_seq_driver_unregister() and module_snd_seq_driver() are used for
simplifying codes.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-02-12 14:15:54 +01:00
Linus Torvalds a323ae93a7 sound updates for 3.20-rc1
In this batch, you can find lots of cleanups through the whole
 subsystem, as our good New Year's resolution.  Lots of LOCs and
 commits are about LINE6 driver that was promoted finally from staging
 tree, and as usual, there've been widely spread ASoC changes.
 
 Here some highlights:
 
 ALSA core changes
   - Embedding struct device into ALSA core structures
   - sequencer core cleanups / fixes
   - PCM msbits constraints cleanups / fixes
   - New SNDRV_PCM_TRIGGER_DRAIN command
   - PCM kerneldoc fixes, header cleanups
   - PCM code cleanups using more standard codes
   - Control notification ID fixes
 
 Driver cleanups
   - Cleanups of PCI PM callbacks
   - Timer helper usages cleanups
   - Simplification (e.g. argument reduction) of many driver codes
 
 HD-audio
   - Hotkey and LED support on HP laptops with Realtek codecs
   - Dock station support on HP laptops
   - Toshiba Satellite S50D fixup
   - Enhanced wallclock timestamp handling for HD-audio
   - Componentization to simplify the linkage between i915 and hd-audio
     drivers for Intel HDMI/DP
 
 USB-audio
   - Akai MPC Element support
   - Enhanced timestamp handling
 
 ASoC
   - Lots of refactoringin ASoC core, moving drivers to more data
     driven initialization and rationalizing a lot of DAPM usage
   - Much improved handling of CDCLK clocks on Samsung I2S controllers
   - Lots of driver specific cleanups and feature improvements
   - CODEC support for TI PCM514x and TLV320AIC3104 devices
   - Board support for Tegra systems with Realtek RT5677
   - New driver for Maxim max98357a
   - More enhancements / fixes for Intel SST driver
 
 Others
   - Promotion of LINE6 driver from staging along with lots of rewrites
     and cleanups
   - DT support for old non-ASoC atmel driver
   - oxygen cleanups, XIO2001 init, Studio Evolution SE6x support
   - Emu8000 DRAM size detection fix on ISA(!!) AWE64 boards
   - A few more ak411x fixes for ice1724 boards
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2
 
 iQIcBAABCAAGBQJU2ySIAAoJEGwxgFQ9KSmk/YMP/1v0r60aDt6VxlTbadt008R/
 jTEIzD4oGEMkhFQdlmN8MegZlx+05vxQUCGrVy8PLelhfy/mnj6z/iUt9ohE1PqK
 530eVr5FnlAbHs1JzP8Tm8Xbbtk8RXt5uvgohJvt7HBrc0Def9N/w37fUQ0ytO+s
 Ot/0Xm8BNsdJ90DfMVLc0Ok9cAFn4Z70gylE/PuGxbBBzxQh8PYPXtJ6Q/s5lKLV
 QC7VitJa0H7vsFYb+Ve7GU4cKMTt8uEPw8CdnQbDwb63ia93iWJJrlqKVUWYF2Gu
 K+mX5Igdb88ToXbMPrLKXe73IfFcdpWNTbj8IAv+Rp9fArylzz+3GAYmrqTAdare
 JEE5qAZTtJZEeD2vgNCnA4JpSbRzL0bHrEow21LnPONq3V9FB044NAeMSx3dI4j1
 fk+SnqrpJMtlCtgj2PuWzIcqRiJ25F/Qax/xFeZHo7FwLIBF7z5pLu9DP4CfUSXj
 fDEcB9aNF2VirJkQdbhHaPqTYVf2rHQ/ebDpDHBwkqFe865IHlJ8g8MrHnAFInKN
 jQlSTOqi9V3two53U1JIKcB6QcBH3vh60w2JsWsQadsr45YYQ/bvBHGYNpQ00C3U
 rbDBANhAHaF/hFncNnOQDsH65FqHj/ZlBQRhzX0LqxN4K0DM1FqGcLf2k6u/pzZU
 09+QlcIOOzN8lbvHR8Qx
 =/84r
 -----END PGP SIGNATURE-----

Merge tag 'sound-3.20-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound

Pull sound updates from Takashi Iwai:
 "In this batch, you can find lots of cleanups through the whole
  subsystem, as our good New Year's resolution.  Lots of LOCs and
  commits are about LINE6 driver that was promoted finally from staging
  tree, and as usual, there've been widely spread ASoC changes.

  Here some highlights:

  ALSA core changes
   - Embedding struct device into ALSA core structures
   - sequencer core cleanups / fixes
   - PCM msbits constraints cleanups / fixes
   - New SNDRV_PCM_TRIGGER_DRAIN command
   - PCM kerneldoc fixes, header cleanups
   - PCM code cleanups using more standard codes
   - Control notification ID fixes

  Driver cleanups
   - Cleanups of PCI PM callbacks
   - Timer helper usages cleanups
   - Simplification (e.g. argument reduction) of many driver codes

  HD-audio
   - Hotkey and LED support on HP laptops with Realtek codecs
   - Dock station support on HP laptops
   - Toshiba Satellite S50D fixup
   - Enhanced wallclock timestamp handling for HD-audio
   - Componentization to simplify the linkage between i915 and hd-audio
     drivers for Intel HDMI/DP

  USB-audio
   - Akai MPC Element support
   - Enhanced timestamp handling

  ASoC
   - Lots of refactoringin ASoC core, moving drivers to more data driven
     initialization and rationalizing a lot of DAPM usage
   - Much improved handling of CDCLK clocks on Samsung I2S controllers
   - Lots of driver specific cleanups and feature improvements
   - CODEC support for TI PCM514x and TLV320AIC3104 devices
   - Board support for Tegra systems with Realtek RT5677
   - New driver for Maxim max98357a
   - More enhancements / fixes for Intel SST driver

  Others
   - Promotion of LINE6 driver from staging along with lots of rewrites
     and cleanups
   - DT support for old non-ASoC atmel driver
   - oxygen cleanups, XIO2001 init, Studio Evolution SE6x support
   - Emu8000 DRAM size detection fix on ISA(!!) AWE64 boards
   - A few more ak411x fixes for ice1724 boards"

* tag 'sound-3.20-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound: (542 commits)
  ALSA: line6: toneport: Use explicit type for firmware version
  ALSA: line6: Use explicit type for serial number
  ALSA: line6: Return EIO if read/write not successful
  ALSA: line6: Return error if device not responding
  ALSA: line6: Add delay before reading status
  ASoC: Intel: Clean data after SST fw fetch
  ALSA: hda - Add docking station support for another HP machine
  ALSA: control: fix failure to return new numerical ID in 'replace' event data
  ALSA: usb: update trigger timestamp on first non-zero URB submitted
  ALSA: hda: read trigger_timestamp immediately after starting DMA
  ALSA: pcm: allow for trigger_tstamp snapshot in .trigger
  ALSA: pcm: don't override timestamp unconditionally
  ALSA: off by one bug in snd_riptide_joystick_probe()
  ASoC: rt5670: Set use_single_rw flag for regmap
  ASoC: rt286: Add rt288 codec support
  ASoC: max98357a: Fix build in !CONFIG_OF case
  ASoC: Intel: fix platform_no_drv_owner.cocci warnings
  ARM: dts: Switch Odroid X2/U2 to simple-audio-card
  ARM: dts: Exynos4 and Odroid X2/U3 sound device nodes update
  ALSA: control: fix failure to return numerical ID in 'add' event
  ...
2015-02-11 08:51:59 -08:00
TienFu Chen 3271cb2283 ALSA: hda - Add docking station support for another HP machine
BugLink: https://bugs.launchpad.net/bugs/1412800
Signed-off-by: TienFu Chen <tienfu.chen@canonical.com>
Signed-off-by: David Henningsson <david.henningsson@canonical.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-02-10 10:01:34 +01:00
Pierre-Louis Bossart ed610af86a ALSA: hda: read trigger_timestamp immediately after starting DMA
Make sure wallclock counter and trigger timestamp are read very
close to each other for better alignment.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-02-09 16:02:11 +01:00
Dan Carpenter e4940626de ALSA: off by one bug in snd_riptide_joystick_probe()
The problem here is that we check:

	if (dev >= SNDRV_CARDS)

Then we increment "dev".

       if (!joystick_port[dev++])

Then we use it as an offset into a array with SNDRV_CARDS elements.

	if (!request_region(joystick_port[dev], 8, "Riptide gameport")) {

This has 3 effects:
1) If you use the module option to specify the joystick port then it has
   to be shifted one space over.
2) The wrong error message will be printed on failure if you have over
   32 cards.
3) Static checkers will correctly complain that are off by one.

Fixes: db1005ec6f ('ALSA: riptide - Fix joystick resource handling')
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-02-09 14:57:15 +01:00
Takashi Iwai 4227de2a7e ALSA: hda - Set up GPIO for Toshiba Satellite S50D
Toshiba Satellite S50D laptop with an IDT codec uses the GPIO4 (0x10)
as the master EAPD.

Bugzilla: https://bugzilla.novell.com/show_bug.cgi?id=915858
Cc: <stable@vger.kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-02-05 22:12:07 +01:00
Takashi Iwai 3fe9cf390f Merge branch 'topic/snd-device' into for-next 2015-02-03 17:57:16 +01:00
Takashi Iwai ef46c7af93 ALSA: pcm: Embed struct device
Like previous patches, at this time we embed the struct device into
PCM object.  However, this needs a bit more caution: struct snd_pcm
doesn't own one device but two, for both playback and capture!  Thus
not struct snd_pcm but struct snd_pcm_str object contains the device.

Along with this change, pcm->dev field is dropped for avoiding
confusion.  It was meant to point to a non-standard parent.  But,
since now we can touch each struct device directly, we can manipulate
the parent field easily there, too.

Reviewed-by: Jaroslav Kysela <perex@perex.cz>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-02-02 14:42:42 +01:00
Takashi Iwai 7b46160000 ALSA: hwdep: Embed struct device
Like the previous patch, this one embeds the device object into hwdep
object.  For a proper object lifecycle, it's freed in the release
callback.

This also allows us to create sysfs entries via passing to the groups
field of the device without explicit function calls.  Since each
driver can see the device and touch its groups field directly, we
don't need to delegate in hwdep core any longer.  So, remove the
groups field from snd_hwdep, and let the user (in this case only
hda_hwdep.c) modify the device groups.

Reviewed-by: Jaroslav Kysela <perex@perex.cz>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-02-02 14:42:42 +01:00
Takashi Iwai d832f3dcb6 Merge branch 'topic/ak411x-fix' into for-next 2015-01-28 22:32:10 +01:00
Takashi Iwai 1293617cdd ALSA: ak411x: Add PM helper functions
Define snd_ak4114_suspend() and snd_ak4114_resume() functions to
handle PM properly, stopping and restarting the work at PM.
Currently only ice1712/juli.c deals with the PM and ak4114, so fix the
calls there appropriately.

The same PM functions are defined in ak4113.c, too, although they
aren't currently called yet (ice1712/quartet.c may be enhanced to
support PM later).

Acked-by: Jaroslav Kysela <perex@perex.cz>
Tested-by: Pavel Hofman <pavel.hofman@ivitera.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-01-28 22:30:12 +01:00
Takashi Iwai ba6211a2e8 ALSA: au88x0: Remove superfluous ifdef __KERNEL__
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-01-28 17:26:45 +01:00
Takashi Iwai 976412fbc9 ALSA: Include linux/uaccess.h and linux/bitopts.h instead of asm/*
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-01-28 17:25:07 +01:00
Takashi Iwai 6cbbfe1c8d ALSA: Include linux/io.h instead of asm/io.h
Nowadays it's recommended.  Replace all in a shot.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-01-28 16:49:33 +01:00
TienFu Chen b4b33f9d64 ALSA: hda - Enable docking station for an HP machine
On this machine we need to inform the driver where the docking
station pins are, because it has not been set up by BIOS.

Tested-by: TienFu Chen <tienfu.chen@canonical.com>
BugLink: https://bugs.launchpad.net/bugs/1412800
Signed-off-by: TienFu Chen <tienfu.chen@canonical.com>
Signed-off-by: David Henningsson <david.henningsson@canonical.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-01-20 15:09:19 +01:00
Takashi Iwai 04018e137c ALSA: hdspm: Use setup_timer() and mod_timer()
No functional change, refactoring with the standard helpers.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-01-19 11:34:45 +01:00
Takashi Iwai c41c009ed5 ALSA: hdsp: Use setup_timer() and mod_timer()
No functional change, refactoring with the standard helpers.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-01-19 11:34:36 +01:00
Takashi Iwai 3d6f0e0cb3 ALSA: korg1212: Use setup_timer() and mod_timer()
No functional change, refactoring with the standard helpers.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-01-19 11:34:18 +01:00
Takashi Iwai 8a3e7dfc90 ALSA: echoaudio: Use setup_timer() and mod_timer()
No functional change, refactoring with the standard helpers.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-01-19 11:33:20 +01:00
Takashi Iwai 6fec2b5723 ALSA: asihpi: Use setup_timer() and mod_timer()
No functional change, refactoring with the standard helpers.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-01-19 11:32:51 +01:00
Clemens Ladisch 53c098bfc5 ALSA: add Studio Evolution SE6X support
Add a driver for an embedded sound card.

Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-01-16 22:44:56 +01:00
Clemens Ladisch a5a3353367 ALSA: oxygen: add XIO2001 initialization
Configure the XIO2001 bridge on PCI Express cards so that it does less
needless prefetching.

Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-01-16 22:44:36 +01:00
Clemens Ladisch 0902fbb9cc ALSA: oxygen: add support for third analog input
Make it possible for cards to have three stereo analog input pairs.

Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-01-16 22:44:08 +01:00
Clemens Ladisch 20eb26a2ec ALSA: oxygen: do not create useless S/PDIF controls
Cards without S/PDIF output do not need those controls.

Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-01-16 22:43:50 +01:00
Masanari Iida 70462457ff ALSA: hda - Fix typo in hda_controller.c
This patch fix spelling typo in hda_controller.c.

Signed-off-by: Masanari Iida <standby24x7@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-01-15 12:04:21 +01:00
Takashi Iwai ffcd28d88e ALSA: hda - Select INPUT for Realtek HD-audio codec
The commit commit [33f4acd3b214: ALSA: hda - Enable mic mute hotkey
and LEDs for an HP machine] introduced a quirk for a HP machine
involving with the input event handling.  Although the relevant code
is protected via IS_ENABLED(CONFIG_INPUT), this doesn't suffice when
the audio driver is built in while the input is module.

As an easy workaround, this patch forcibly selects CONFIG_INPUT in
Kconfig.  This shouldn't be a practical problem since CONFIG_INPUT is
almost mandatory for all systems.  Also, this allows to remove the
ugly ifdefs in the code.

Fixes: 33f4acd3b2 ('ALSA: hda - Enable mic mute hotkey and LEDs for an HP machine')
Acked-by: David Henningsson <david.henningsson@canonical.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-01-15 10:21:50 +01:00
David S. Miller 3f3558bb51 Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
Conflicts:
	drivers/net/xen-netfront.c

Minor overlapping changes in xen-netfront.c, mostly to do
with some buffer management changes alongside the split
of stats into TX and RX.

Signed-off-by: David S. Miller <davem@davemloft.net>
2015-01-15 00:53:17 -05:00
Takashi Iwai 1d69970d27 Merge tag 'topic/i915-hda-componentized-2015-01-12' of git://anongit.freedesktop.org/drm-intel into for-next 2015-01-13 07:54:02 +01:00
Takashi Iwai 7bfb8575b8 Merge branch 'topic/line6' into for-next 2015-01-12 22:33:16 +01:00
Takashi Iwai 6c869d301b ALSA: rme*: Use snd_pcm_format_t
Fix sparse warnings below by using snd_pcm_format_t properly:
   sound/pci/rme32.c:682:60: sparse: incorrect type in argument 2 (different base types)
  sound/pci/rme96.c:1006:69: sparse: incorrect type in argument 2 (different base types)
   .....

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-01-12 16:59:02 +01:00
Imre Deak d7055bd653 ALSA: hda: add component support
Register a component master to be used to interface with the i915
driver. This is meant to replace the current interface which is based on
module symbol lookups.

Note that currently we keep the existing behavior and pin the i915
module while the hda driver is loaded. Using the component interface
allows us to remove this dependency once support for dynamically
enabling / disabling the HDMI functionality is added to the driver.

v2:
- change roles between the hda and i915 components (Daniel)
v3:
- rename display_component to audio_component (Daniel)
v4:
- move removal of i915_powerwell.h from this patch to the next (Takashi)
- request_module fails if module support isn't enabled, so ignore
  any error it returns and depend on the following NULL check of the
  component ops (Takashi)
- change over to using dev_* instead of pr_* (Takashi)

Signed-off-by: Imre Deak <imre.deak@intel.com>
Reviewed-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2015-01-12 02:48:23 +01:00
Imre Deak 926981ae33 ALSA: hda: pass intel_hda to all i915 interface functions
chip is already passed to most of the i915 interface functions. Unify
the interface by passing intel_hda instead of chip and passing it to all
functions. Passing intel_hda instead of chip makes more sense since this
is an intel specific interface. Also in an upcoming patch we will use
intel_hda in all of these functions so by passing intel_hda we can save
on some pointer casts from chip to intel_hda.

This will be needed by an upcoming patch adding component support.

No functional change.

v2-3: unchanged
v4:
- pass intel_hda instead of chip

Signed-off-by: Imre Deak <imre.deak@intel.com>
Reviewed-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2015-01-12 02:48:22 +01:00
Imre Deak 347de1f862 ALSA: hda: export struct hda_intel
This struct will be needed by the component code added in an upcoming
patch, so export it into a new hda_intel.h file. At the same time also
merge hda_i915.h into this new header, there is no reason to keep two
separate intel specific header file.

Suggested-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Imre Deak <imre.deak@intel.com>
Reviewed-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2015-01-12 02:48:21 +01:00
Rickard Strandqvist ace79a3592 ALSA: ice1712: wm8766: Remove some unused functions
Removes some functions that are not used anywhere:
snd_wm8766_set_power() snd_wm8766_set_master_mode()

This was partially found by using a static code analysis program called cppcheck.

Signed-off-by: Rickard Strandqvist <rickard_strandqvist@spectrumdigital.se>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-01-11 17:03:52 +01:00
Andy Shevchenko 12c243b833 ALSA: fm801: remove FSF address
The FSF address is subject to change. So, we remove it from the header.

While here, remove a line with my old and non-functional email from the
header. Moreover, nowadays we have a Git VCS that contains a history of
changes.

Signed-off-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-01-11 11:27:13 +01:00
Takashi Iwai 9e5947465d Merge branch 'topic/pci-cleanup' into for-next 2015-01-11 11:26:48 +01:00
David Henningsson 624afe4dc9 ALSA: hda - fixup input_free_device called after input_unregister_device
Input_unregister_device will internally free the device, so
input_free_device should not be called.

Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: David Henningsson <david.henningsson@canonical.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-01-11 11:26:12 +01:00
Takashi Iwai 3e41c9b5a1 ALSA: ymfpci: Simplify PM callbacks
This is a similar cleanup like the commit [3db084fd0af5: ALSA: fm801:
PCI core handles power state for us].

Since pci_set_power_state(), pci_save_state() and pci_restore_state()
are already done in the PCI core side, so we don't need to it doubly.

Also, pci_enable_device(), pci_disable_device() and pci_set_master()
calls in PM callbacks are superfluous nowadays, too, so get rid of
them as well.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-01-09 17:28:47 +01:00
Takashi Iwai de0c869c83 ALSA: vx222: Simplify PM callbacks
This is a similar cleanup like the commit [3db084fd0af5: ALSA: fm801:
PCI core handles power state for us].

Since pci_set_power_state(), pci_save_state() and pci_restore_state()
are already done in the PCI core side, so we don't need to it doubly.

Also, pci_enable_device(), pci_disable_device() and pci_set_master()
calls in PM callbacks are superfluous nowadays, too, so get rid of
them as well.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-01-09 17:28:47 +01:00