Commit Graph

490 Commits

Author SHA1 Message Date
Dylan Reid 8769b27861 ALSA: hda - Add pcm_mmap_prepare op.
Adding this op allows the X86 specific mmap operation to help in
hda_intel without needing a CONFIG_X86 in future non-PCI hda drivers.

Signed-off-by: Dylan Reid <dgreid@chromium.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2014-03-01 11:22:02 +01:00
Dylan Reid b419b35be4 ALSA: hda - Move snd page allocation to ops
Break out the allocation of pages for DMA and PCM buffers to ops in
the chip structure.  This is done to allow for architecture specific
work-arounds to be added.  Currently mark_pages_wc is used by
hda_intel.  This avoids needing to move that x86-specific code to a
common area shared with hda platform drivers.

Signed-off-by: Dylan Reid <dgreid@chromium.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2014-03-01 11:21:51 +01:00
Dylan Reid e62a42aebd ALSA: hda - Pass max_slots and power_save to codec_create
Passing the max slots and power save arguments to codec_create will
allow for its reuse by an hda_platform driver. It makes the function
independent of the module params in hda_intel and ready to move to
hda_shared in a following commit.

Signed-off-by: Dylan Reid <dgreid@chromium.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2014-03-01 11:21:43 +01:00
Dylan Reid 749ee287fc ALSA: hda - Add jackpoll_ms to struct azx
Keeping a pointer to the jackpoll_ms array in the chip will allow
azx_codec_create to be shared between hda_intel and hda_platform
drivers.  Also modify get_jackpoll_ms to make the jackpoll_ms member
optional, this way a platform driver can leave it out if it's not
needed.

Signed-off-by: Dylan Reid <dgreid@chromium.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2014-03-01 11:21:29 +01:00
Dylan Reid f563bf65d9 ALSA: hda - remove unused clear of STATESTS
Although the code was updated last year the "#if 0" surrounding it
dates back to the original git commit.  The function will be moved to
a new file, no need to carry the dead code.

Signed-off-by: Dylan Reid <dgreid@chromium.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2014-03-01 11:21:19 +01:00
Dylan Reid f46ea609d1 ALSA: hda - Add function pointer for disabling MSI
This is a PCI-only feature, but adding a callback for it in the chip
structure breaks the PCI dependency in the RIRB code allowing the
logic there to be re-used by the platform HDA driver.

Signed-off-by: Dylan Reid <dgreid@chromium.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2014-03-01 11:21:13 +01:00
Dylan Reid 8928756dbd ALSA: hda - Use device pointer from the card instead of pci
This removes calls to get the device via PCI from other parts of the
code that will be able to be re-used by the platform driver.

Signed-off-by: Dylan Reid <dgreid@chromium.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2014-03-01 11:21:04 +01:00
Dylan Reid 9cdc0115e4 ALSA: hda - Keep pointer to bdl_pos_fix in chip struct
This will allow for a platform hda driver to use it as well.  It
removes the dependency on the module param from hda_intel, which will
allow for azx_setup_periods to be shared.

Signed-off-by: Dylan Reid <dgreid@chromium.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2014-03-01 11:20:51 +01:00
Dylan Reid 4083081333 ALSA: hda - Allow different ops to read/write registers
The forthcoming platform hda driver needs to override the way
registers are read and written.  In preparation for that, introduce a
reg_ops struct that can be implemented differently by the new driver.
Change the existing macros to use the new structure, and move them to
hda_priv.h where they will be accessible to both PCI and platform
drivers.

Start with register access, but later commits will add more ops that
differ between PCI and platform.

Signed-off-by: Dylan Reid <dgreid@chromium.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2014-03-01 11:20:37 +01:00
Dylan Reid 2538a4f583 ALSA: hda - Move some definitions to new hda_priv.h
Later commits adding support for hda platform drivers will want to use
the same defines and structures. Put them in a place reachable by both
hda_intel and the new platform driver.

This is a mostly a direct copy with a few whitespace and comment
changes to make checkpatch happy.

Signed-off-by: Dylan Reid <dgreid@chromium.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2014-03-01 11:20:19 +01:00
David Henningsson ca460f8652 ALSA: hda - Fix CORB reset to follow specification
According to the HDA spec, we must write 1 to bit 15 on a CORBRP
reset, read back 1, then write 0, then read back 0. This must be
done while the DMA is not running.

We accidentaly ended up writing back the 0 by using a writel
instead of a writew to CORBWP.

This caused occasional controller failure on Bay Trail hardware.

[replaced error messages with dev_err() by tiwai]

Signed-off-by: David Henningsson <david.henningsson@canonical.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2014-02-28 14:03:30 +01:00
Takashi Iwai 4e76a8833f ALSA: hda - Replace with standard printk
Use dev_err() and co for messages from HD-audio controller and codec
drivers.  The codec drivers are mostly bound with codec objects, so
some helper macros, codec_err(), codec_info(), etc, are provided.
They merely wrap the corresponding dev_xxx().

There are a few places still calling snd_printk() and its variants
as they are called without the codec or device context.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2014-02-25 12:27:32 +01:00
Takashi Iwai 13aeaf6801 ALSA: hda - Create own device struct for each codec
As the HD-audio is treated individually in each codec driver, it's
more convenient to assign an own struct device to each codec object.
Then we'll be able to use dev_err() more easily for each codec, for
example.

For achieving it, this patch just creates an object "hdaudioCxDy".
It belongs to sound class instead of creating a new bus, just for
simplicity, at this stage.  No pm ops is implemented in the device
struct level but currently it's merely a container.  The PCM and hwdep
devices are now children of this codec device.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2014-02-25 12:12:54 +01:00
Takashi Iwai 60c5772b50 ALSA: pci: Convert to snd_card_new() with a device pointer
Also remove superfluous snd_card_set_dev() calls.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2014-02-12 11:17:52 +01:00
Takashi Iwai c4d1489390 Merge branch 'for-linus' into for-next 2014-02-12 10:34:27 +01:00
Takashi Iwai 8eeaa2f9e0 ALSA: Replace with IS_ENABLED()
Replace the lengthy #if defined(XXX) || defined(XXX_MODULE) with the
new IS_ENABLED() macro.

The patch still doesn't cover all ifdefs.  For example, the dependency
on CONFIG_GAMEPORT is still open-coded because this also has an extra
dependency on MODULE.  Similarly, an open-coded ifdef in pcm_oss.c and
some sequencer-related stuff are left untouched.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2014-02-10 11:42:00 +01:00
Takashi Iwai f8f1becfa4 ALSA: hda - Fix leftover ifdef checks after modularization
Since the commit [595fe1b702c3: ALSA: hda - Make
CONFIG_SND_HDA_CODEC_* tristate], the kconfig variables for the
generic parser and codec drivers can be "m" instead of boolean, but
some codes are left unchanged to check only #ifdef
CONFIG_SND_HDA_CODEC_XXX, which is no longer true for modules.
This patch fixes them by replacing with IS_ENABLED() macros.

Fixes: 595fe1b702 ('ALSA: hda - Make CONFIG_SND_HDA_CODEC_* tristate')
Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=70161
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2014-02-07 12:13:25 +01:00
David Henningsson 3d692451ea ALSA: hda - Do not accept responses from non-existing codecs
While looking into some spurious responses, I found that the addr value was
treated a bit inconsistent: values 8..0xf will be treated as codec 0 and
values 0..7 will be treated as no error regardless of whether there is a codec
there, or not.

With this patch, all non-existing codecs will be treated equally.
In addition, printing rp and wp could help figuring out if the wp value is
reported wrongly from the controller or if something else is wrong.

Signed-off-by: David Henningsson <david.henningsson@canonical.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2014-01-30 12:39:15 +01:00
Mengdong Lin 862d761818 ALSA: hda - add device ID for Broadwell display audio controller
This patch adds the device ID for Intel Broadwell display HD-Audio controller,
and applies Haswell properties to this device.

Signed-off-by: Mengdong Lin <mengdong.lin@intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2014-01-09 07:29:42 +01:00
Takashi Iwai 7546abfb8e ALSA: hda - Increment default stream numbers for AMD HDMI controllers
It turned out that some AMD HDMI controllers still don't provide
proper values in GCAP register (all zero), and the driver assigns only
one stream in that case, although the connected codec chip supports
more than one stream.

In this patch, the default max number of streams for AMD HDMI
controllers is increased to 8, which  should suffice for most use
cases.  The overhead by this increase is more azx_dev struct and BDL
allocations, so it's negligible.  Of course, if the controller
provides a proper GCAP register, the register value would be used.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2014-01-08 09:58:30 +01:00
Takashi Iwai d09476018b Merge branch 'for-linus' into for-next 2013-12-16 15:53:52 +01:00
David Henningsson 693e0cb052 ALSA: hda - Add enable_msi=0 workaround for four HP machines
While enabling these machines, we found we would sometimes lose an
interrupt if we change hardware volume during playback, and that
disabling msi fixed this issue. (Losing the interrupt caused underruns
and crackling audio, as the one second timeout is usually bigger than
the period size.)

The machines were all machines from HP, running AMD Hudson controller,
and Realtek ALC282 codec.

Cc: stable@vger.kernel.org
BugLink: https://bugs.launchpad.net/bugs/1260225
Signed-off-by: David Henningsson <david.henningsson@canonical.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2013-12-12 17:46:39 +01:00
Takashi Iwai e8648e5e33 ALSA: hda - Ignore small negative LPIB delay correction
Sometimes the hardware reports LPIB being advanced than POSBUF.
When this happens, the driver adjusts to a positive value by adding
the buffer size.  Then the driver detects it as an error (greater than
the period size), and stops the LPIB delay account from this point
on.

When I took a close look at these conditions, the values shown are all
very small numbers, and it'd be better to just ignore these values
instead of discontinuing the LPIB delay correction.

In this patch, the driver checks a negative delay value and ignores if
it's a significantly small error.  Currently the threshold is set to
64 frames, but could be smaller.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2013-12-06 17:28:49 +01:00
Takashi Iwai aad730d070 ALSA: hda - Always do delayed probes for HD-audio devices
HD-audio devices tend to take long time for finishing the whole
probing procedure.  In this patch, the time-consuming part of the
probing procedure, the codec probe and the rest initializations, are
moved in the work, so that they can be done asynchronously in parallel
with probes of other devices.

Since we already have this mechanism in the driver code for the
firmware and i915 request_symbol() stuff, we just need to enable it
always; the resultant patch even reduces more lines, which is an
additional bonus.

Credit goes to David Henningsson, who suggested this workaround.

Reported-by: Mengdong Lin <mengdong.lin@intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2013-12-02 15:17:39 +01:00
Takashi Iwai b95ff8e61a Merge branch 'for-linus' into for-next 2013-12-02 13:32:41 +01:00
Takashi Iwai 88d071fc9a ALSA: hda - Fix complete_all() timing in deferred probes
When the probe of snd-hda-intel driver is deferred due to f/w loading
or the nested module loading, complete_all() should be also delayed
until the initialization really finished.  Otherwise, vga-switcheroo
client would start switching before the actual init is done.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2013-12-02 13:23:40 +01:00
Takashi Iwai b1920c2110 ALSA: hda - Enable runtime PM on Panther Point
Now we fixed the long-standing bugs of runtime PM, let's enable
Panther Point again.  The runtime PM was disabled in the HDMI codec
driver due to the S3 issue, and this should have been fixed now.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2013-11-26 13:42:39 +01:00
Takashi Iwai 873ce8ad50 ALSA: hda - Drop bus->avoid_link_reset flag
Use bus->power_keep_link_on instead.  The controller shouldn't go to
D3 when the link isn't reset, so essentially avoiding the link reset
means avoiding the runtime PM.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2013-11-26 13:40:14 +01:00
Joe Perches 3b70a67da0 ALSA: hda_intel: ratelimit "spurious response" message
dmesg here has a 100+ consecutive lines of:

[ 1464.219446] hda-intel 0000:00:14.2: spurious response 0x0:0x0, last cmd=0x170500
[ 1464.219451] hda-intel 0000:00:14.2: spurious response 0x0:0x0, last cmd=0x170500
[ 1464.219454] hda-intel 0000:00:14.2: spurious response 0x0:0x0, last cmd=0x170500
...

Ratelimit the message to reduce the dmesg log noise.

Coalesce the format while at it.

Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2013-11-07 21:22:23 +01:00
Takashi Iwai fab1285a51 ALSA: hda - Name Haswell HDMI controllers better
"HDA Intel MID" is no correct name for Haswell HDMI controllers.
Give them a better name, "HDA Intel HDMI".

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2013-11-05 17:54:05 +01:00
Takashi Iwai 33499a15c2 ALSA: hda - Force buffer alignment for Haswell HDMI controllers
Haswell HDMI audio controllers seem to get stuck when unaligned buffer
size is used.  Let's enable the buffer alignment for the corresponding
entries.

Since AZX_DCAPS_INTEL_PCH contains AZX_DCAPS_BUFSIZE that disables the
buffer alignment forcibly, define AZX_DCAPS_INTEL_HASWELL and put the
necessary AZX_DCAPS bits there.

Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=60769
Reported-by: Alexander E. Patrakov <patrakov@gmail.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2013-11-05 17:38:20 +01:00
Clemens Ladisch bbaa0d6665 ALSA: hda: add device IDs for AMD Evergreen/Northern Islands HDMI
The device IDs of the AMD Cypress/Juniper/Redwood/Cedar/Cayman/Antilles/
Barts/Turks/Caicos HDMI HDA controllers weren't added explicitly
because the generic entry works, but it made the device appearing as
"Generic", and people are confused as if it's no proper HDMI
controller.  Add them so that the name shows up properly as "ATI HDMI"
instead of "Generic".

According to Takashi's tests and the lack of complaints, these devices
work fine without disabling snooping.

Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2013-11-05 10:26:56 +01:00
James Ralston 4eeca499be ALSA: hda - Add Device IDs for Intel Wildcat Point-LP PCH
This patch adds the HD Audio Device IDs for the Intel Wildcat Point-LP PCH.

Signed-off-by: James Ralston <james.d.ralston@intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2013-11-04 18:31:54 +01:00
Takashi Iwai 95f74c41b2 ALSA: hda - Fix mute LED on HP laptops in runtime suspend
When HP laptops with mute and mic-record LEDs go to runtime suspend,
these LEDs are turned on forcibly no matter whether GPIO pis are on or
off.  This strange behavior seems triggered by resetting the HD-audio
bus link at azx_rutime_suspend().  So, just add a new hda_bus flag to
avoid the link reset at runtime suspend and set it for these HP
machines.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2013-10-24 11:37:33 +02:00
Linus Torvalds decf7abcc9 sound fixes for 3.12-rc1
A few last-minute fixes for 3.12-rc1.  All patches are driver specific.
 
 - HD-audio fixes: MacBook 6,1/6,2 speaker fix, ASUS TX300 dock speaker
   fix, Toshiba Satellite irq fix, Haswell HDMI audio cleanups)
 
 - ASoC fixes: atmel irq fix, fsl DT fix, mc13783 spi fix, kirkwood
   compatible string change, etc
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2.0.19 (GNU/Linux)
 
 iQIcBAABAgAGBQJSMWJeAAoJEGwxgFQ9KSmkkLsP/RMeleT18hbZEhdSZsJaqErg
 p6Dk59fb28HrQrY/ECcZnBChGFgCagS316lBjuEkDtQmZdhYtIDHV9r/udV4MbFc
 rX4IVNv1JerpCyZu4pC0yngHiEX3NMBmu204RJBC8vzJt3fupTFIioliNQlmMuiR
 k6Kb9kGmNHLtA7LwshHwNs8JwXEJHUcnsBGdPB0BUy8BpZ8FVTIOvuBixpxv9kXm
 +n80KRhY/YBjpU+bTvGTgJhH7U3BXylU20q5cO2ukv8vW79LGNZ0XA5Rnerrlr/F
 fvDzg+liOEV8ijchfS9rhs28J+4ICHmFkY/rj7QFpVpP9xYfpqhvw93KmIACirDX
 DlJt63fOJuHbGEv5cGjAmdZXcKONoD9fG11CKDj46Fm4borNy7DdfmMLxNM3xo5q
 rxbgUWplCDHFRALXATJ3t8Occz71l2W+GjklmI7td8K5SD6JCzSI1GdR4YVVf76B
 Wd6AM3wpIGKdjCwZvT5jDBb/4O8ZMtOqEhxvBKI1eO4l+A3UbqWlBKyncfvpKBqY
 yHTBIOgF5QdtUMVSI0/hb64nzmOGHLAWxQoCZssvSFEV6P+jodrqGGayxvbM+6rU
 YR2w2omh+6UkacQvjyVWGehBHiYCECfl0kk9XmPVkIGgHmOdgvkv1/MMbPeEcoXv
 z2YGcgbOIBpNrLcgTev4
 =fKdg
 -----END PGP SIGNATURE-----

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

Pull sound fixes from Takashi Iwai:
 "A few last-minute fixes for 3.12-rc1.  All patches are driver
  specific.

   - HD-audio fixes: MacBook 6,1/6,2 speaker fix, ASUS TX300 dock
     speaker fix, Toshiba Satellite irq fix, Haswell HDMI audio
     cleanups)

   - ASoC fixes: atmel irq fix, fsl DT fix, mc13783 spi fix, kirkwood
     compatible string change, etc"

* tag 'sound-3.12' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound:
  ASoC: mc13783: add spi errata fix
  ASoC: rsnd: fixup flag name of rsnd_scu_platform_info
  ALSA: hda - Add CS4208 codec support for MacBook 6,1 and 6,2
  ALSA: hda - Add Toshiba Satellite C870 to MSI blacklist
  ASoC: fsl_spdif: Select regmap-mmio
  ALSA: hda - unmute pin amplifier in infoframe setup for Haswell
  ALSA: hda - define is_haswell() to check if a display audio codec is Haswell
  ALSA: hda - Add dock speaker support for ASUS TX300
  ASoC: kirkwood: change the compatible string of the kirkwood-i2s driver
  ASoC: atmel: disable error interrupt
  ASoC: fsl: imx-audmux: Do not call imx_audmux_parse_dt_defaults() on non-dt kernel
2013-09-12 08:52:41 -07:00
Takashi Iwai 83f7215135 ALSA: hda - Add Toshiba Satellite C870 to MSI blacklist
Toshiba Satellite C870 shows interrupt problems occasionally when
certain mixer controls like "Mic Switch" is toggled.  This seems
worked around by not using MSI.

Bugzilla: https://bugzilla.novell.com/show_bug.cgi?id=833585
Cc: <stable@vger.kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2013-09-09 10:20:48 +02:00
Linus Torvalds a09e9a7a4b Merge branch 'drm-next' of git://people.freedesktop.org/~airlied/linux
Pull drm tree changes from Dave Airlie:
 "This is the main drm pull request, I have some overlap with sound and
  arm-soc, the sound patch is acked and may conflict based on -next
  reports but should be a trivial fixup, which I'll leave to you!

  Highlights:

   - new drivers:

     MSM driver from Rob Clark

   - non-drm:

     switcheroo and hdmi audio driver support for secondary GPU
     poweroff, so drivers can use runtime PM to poweroff the GPUs.  This
     can save 5 or 6W on some optimus laptops.

   - drm core:

     combined GEM and TTM VMA manager
     per-filp mmap permission tracking
     initial rendernode support (via a runtime enable for now, until we get api stable),
     remove old proc support,
     lots of cleanups of legacy code
     hdmi vendor infoframes and 4k modes
     lots of gem/prime locking and races fixes
     async pageflip scaffolding
     drm bridge objects

   - i915:

     Haswell PC8+ support and eLLC support, HDMI 4K support, initial
     per-process VMA pieces, watermark reworks, convert to generic hdmi
     infoframes, encoder reworking, fastboot support,

   - radeon:

     CIK PM support, remove 3d blit code in favour of DMA engines,
     Berlin GPU support, HDMI audio fixes

   - nouveau:

     secondary GPU power down support for optimus laptops, lots of
     fixes, use MSI, VP3 engine support

   - exynos:

     runtime pm support for g2d, DT support, remove non-DT,

   - tda998x i2c driver:

     lots of fixes for sync issues

   - gma500:

     lots of cleanups

   - rcar:

     add LVDS support, fbdev emulation,

   - tegra:

     just minor fixes"

* 'drm-next' of git://people.freedesktop.org/~airlied/linux: (684 commits)
  drm/exynos: Fix build error with exynos_drm_connector.c
  drm/exynos: Remove non-DT support in exynos_drm_fimd
  drm/exynos: Remove non-DT support in exynos_hdmi
  drm/exynos: Remove non-DT support in exynos_drm_g2d
  drm/exynos: Remove non-DT support in exynos_hdmiphy
  drm/exynos: Remove non-DT support in exynos_ddc
  drm/exynos: Make Exynos DRM drivers depend on OF
  drm/exynos: Consider fallback option to allocation fail
  drm/exynos: fimd: move platform data parsing to separate function
  drm/exynos: fimd: get signal polarities from device tree
  drm/exynos: fimd: replace struct fb_videomode with videomode
  drm/exynos: check a pixel format to a particular window layer
  drm/exynos: fix fimd pixel format setting
  drm/exynos: Add NULL pointer check
  drm/exynos: Remove redundant error messages
  drm/exynos: Add missing of.h header include
  drm/exynos: Remove redundant NULL check in exynos_drm_buf
  drm/exynos: add device tree support for rotator
  drm/exynos: Add missing includes
  drm/exynos: add runtime pm interfaces to g2d driver
  ...
2013-09-05 10:17:26 -07:00
Dave Airlie 246efa4a07 snd/hda: add runtime suspend/resume on optimus support (v4)
Add support for HDMI audio device on VGA cards that powerdown
to D3cold using non-standard ACPI/PCI infrastructure (optimus).

This does a couple of things to make it work:

a) add a set of power ops for the hdmi domain, and enables them
via vga_switcheroo when we are a switcheroo controlled card. This
just replaces the runtime resume operation so that when the card
is in D3cold the userspace pci config space access via sysfs,
the vga switcheroon runtime resume gets called first and it calls
the GPU resume callback before calling the sound card runtime
resume.

b) standard ACPI/PCI stacks won't put a device into D3cold without
an ACPI handle, but since the hdmi audio devices on gpus don't have
an ACPI handle, we need to manually force the device into D3cold
after suspend from the switcheroo path only.

c) don't try and do runtime s/r when the GPU is off.

d) call runtime suspend/resume during switcheroo suspend/resume
this is to make sure the runtime stack knows to try and resume
the hdmi audio device for pci config space access.

v2: fix incorrect runtime call suspend->resume.

v3: rework irq handler to avoid false irq when we are resuming
but haven't runtime resumed yet, don't bother trying D3cold,
it won't work, just set it manually ourselves, move runtime s/r
calls outside the main s/r hook. enable dnyamic pm properly by
dropping reference.

v4: put back irq handler check just wrap it with cap check

Acked-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2013-08-29 13:30:29 +10:00
David Henningsson c841ad2a9b ALSA: hda - Try to allow haswell HDMI audio even without powerwell
If compiled without CONFIG_SND_HDA_I915, the audio driver cannot
request power well. However, if the power well is on for other
reasons, maybe audio can still work. Therefore, do not skip the
card completely if compiled without CONFIG_SND_HDA_I915.

Signed-off-by: David Henningsson <david.henningsson@canonical.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2013-08-19 15:46:17 +02:00
Wang Xingchao 7d4f606c50 ALSA: hda - WAKEEN feature enabling for runtime pm
With runtime power save feature enabled, Headphone hotplug
event will not be detected while controller/codec in D3. HDA has
feature WAKEEN to let codec wake up system if controller is in D3 or
system in S3.(HDA Spec 4.5.9.2/3). Codec can send out INT or wake up
controller depending on whether CIE or GIE enabled.(Figure 4, Interupt
structure).

The controller must be in RESET mode after enter runtime-suspend, otherwise
it will not be waken up even if codec send out wake-up event. And STATESTS
will be cleared after controller brought out of RESET mode.

This patch only enable WAKEEN for runtime-suspend(Controller D3) mode,
not for system S3 mode. with tool "evtest", Headphone hotplug events
could be cought and reported successfully.

[fixed an unused variable warning by tiwai]

Signed-off-by: Wang Xingchao <xingchao.wang@linux.intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2013-07-29 14:33:20 +02:00
Wang Xingchao da7db6ad4d ALSA: hda - use azx_writew() for 16-bit length register
Register STATESTS is 16-bit length, use correct API for read/write.

Signed-off-by: Wang Xingchao <xingchao.wang@linux.intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2013-07-24 15:59:32 +02:00
Linus Torvalds 2e17c5a97e Merge branch 'drm-next' of git://people.freedesktop.org/~airlied/linux
Pull drm updates from Dave Airlie:
 "Okay this is the big one, I was stalled on the fbdev pull req as I
  stupidly let fbdev guys merge a patch I required to fix a warning with
  some patches I had, they ended up merging the patch from the wrong
  place, but the warning should be fixed.  In future I'll just take the
  patch myself!

  Outside drm:

  There are some snd changes for the HDMI audio interactions on haswell,
  they've been acked for inclusion via my tree.  This relies on the
  wound/wait tree from Ingo which is already merged.

  Major changes:

  AMD finally released the dynamic power management code for all their
  GPUs from r600->present day, this is great, off by default for now but
  also a huge amount of code, in fact it is most of this pull request.

  Since it landed there has been a lot of community testing and Alex has
  sent a lot of fixes for any bugs found so far.  I suspect radeon might
  now be the biggest kernel driver ever :-P p.s.  radeon.dpm=1 to enable
  dynamic powermanagement for anyone.

  New drivers:

  Renesas r-car display unit.

  Other highlights:

   - core: GEM CMA prime support, use new w/w mutexs for TTM
     reservations, cursor hotspot, doc updates
   - dvo chips: chrontel 7010B support
   - i915: Haswell (fbc, ips, vecs, watermarks, audio powerwell),
     Valleyview (enabled by default, rc6), lots of pll reworking, 30bpp
     support (this time for sure)
   - nouveau: async buffer object deletion, context/register init
     updates, kernel vp2 engine support, GF117 support, GK110 accel
     support (with external nvidia ucode), context cleanups.
   - exynos: memory leak fixes, Add S3C64XX SoC series support, device
     tree updates, common clock framework support,
   - qxl: cursor hotspot support, multi-monitor support, suspend/resume
     support
   - mgag200: hw cursor support, g200 mode limiting
   - shmobile: prime support
   - tegra: fixes mostly

  I've been banging on this quite a lot due to the size of it, and it
  seems to okay on everything I've tested it on."

* 'drm-next' of git://people.freedesktop.org/~airlied/linux: (811 commits)
  drm/radeon/dpm: implement vblank_too_short callback for si
  drm/radeon/dpm: implement vblank_too_short callback for cayman
  drm/radeon/dpm: implement vblank_too_short callback for btc
  drm/radeon/dpm: implement vblank_too_short callback for evergreen
  drm/radeon/dpm: implement vblank_too_short callback for 7xx
  drm/radeon/dpm: add checks against vblank time
  drm/radeon/dpm: add helper to calculate vblank time
  drm/radeon: remove stray line in old pm code
  drm/radeon/dpm: fix display_gap programming on rv7xx
  drm/nvc0/gr: fix gpc firmware regression
  drm/nouveau: fix minor thinko causing bo moves to not be async on kepler
  drm/radeon/dpm: implement force performance level for TN
  drm/radeon/dpm: implement force performance level for ON/LN
  drm/radeon/dpm: implement force performance level for SI
  drm/radeon/dpm: implement force performance level for cayman
  drm/radeon/dpm: implement force performance levels for 7xx/eg/btc
  drm/radeon/dpm: add infrastructure to force performance levels
  drm/radeon: fix surface setup on r1xx
  drm/radeon: add support for 3d perf states on older asics
  drm/radeon: set default clocks for SI when DPM is disabled
  ...
2013-07-09 16:04:31 -07:00
Mengdong Lin 7295b26438 ALSA: hda - clean up code to reset hda link
This patch is a cleanup to the previous patch "reset hda link during system/
runtime suspend".

In this patch
- azx_enter_link_reset() and azx_exit_link_reset() are defined for entering and
  exiting the link reset respectively. azx_link_reset() is no longer used and
  replaced by azx_enter_link_reset().
- azx_reset() reuses the above two new functions for a link reset cycle

Signed-off-by: Mengdong Lin <mengdong.lin@intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2013-06-25 08:13:56 +02:00
Mengdong Lin 3af3f356e1 ALSA: hda - reset hda link during system/runtime suspend
If all the codecs report ClkStopOK (OK to stop bus clock) after being put to
D3, this patch will reset the HDA link before the controller is put to D3.

So the link will be in reset during system or runtime suspend, the bus clock
stops and the codecs are in D3(ClkStop) state.

This may help to reduce power consumption by dozens of mW on some peripheral
hda codecs.

Signed-off-by: Mengdong Lin <mengdong.lin@intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2013-06-24 10:06:04 +02:00
Wang Xingchao 99a2008d0b ALSA: hda - Add power-welll support for haswell HDA
For Intel Haswell chip, HDA controller and codec have
power well dependency from GPU side. This patch added support
to request/release power well in audio driver. Power save
feature should be enabled to get runtime power saving.

There's deadlock when request_module(i915) in azx_probe.
It looks like:
device_lock(audio pci device) -> azx_probe -> module_request
(or symbol_request) -> modprobe (userspace) -> i915 init ->
drm_pci_init -> pci_register_driver -> bus_add_driver -> driver_attach ->
which in turn tries all locks on pci bus, and when it tries the one on the
audio device, it will deadlock.

This patch introduce a work to store remaining probe stuff, and let
request_module run in safe work context.

Signed-off-by: Wang Xingchao <xingchao.wang@linux.intel.com>
Reviewed-by: Takashi Iwai <tiwai@suse.de>
Reviewed-by: Liam Girdwood <liam.r.girdwood@intel.com>
Reviewed-by: David Henningsson <david.henningsson@canonical.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2013-06-06 17:31:56 +02:00
Takashi Iwai 5c90680e42 ALSA: hda - Move azx_first_init() into azx_probe_continue()
This is a preliminary work for the upcoming Haswell HDMI audio fixes.

azx_first_init() function can be safely called after the f/w loader,
since the f/w loader doesn't require the sound hardware initialization
beforehand.  Moving it into azx_probe_continue() cleans up the code
flow a bit.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2013-06-06 17:31:52 +02:00
Wang Xingchao c67e2228b7 ALSA: hda - Fix runtime PM check
The device can support runtime PM no matter whether it support
signal wakeup or not. For some chips like Haswell which doesnot
support PME by default, this patch let haswell Display HD-A controller
enter runtime suspend, and bring more power saving whith power-well
feature enabled.

Signed-off-by: Wang Xingchao <xingchao.wang@linux.intel.com>
Reviewed-by: Takashi Iwai <tiwai@suse.de>
Reviewed-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2013-06-06 17:31:47 +02:00
Takashi Iwai 63e51fd708 ALSA: hda - Don't take unresponsive D3 transition too serious
When a codec is powered off, some systems don't respond properly after
D3 FG transition, while the driver still expects the response and
tries to fall back to different modes (polling and single-cmd).  When
the fallback happens, the driver stays in that mode, and falling back
to the single-cmd mode means it'll loose the unsol event handling,
too.

The unresponsiveness at D3 isn't too serious, thus this fallback is
mostly superfluous.  We can gracefully ignore the error there so that
the driver keeps the normal operation mode.

This patch adds a new bit flag for codec read/write, set in the power
transition stage, which is notified to the controller driver via a new
bus->no_response_fallback flag.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2013-06-06 14:20:19 +02:00
Takashi Iwai 20a24225d8 ALSA: PCI: Remove superfluous pci_set_drvdata(pci, NULL) at remove
As drvdata is cleared to NULL at probe failure or at removal by the
driver core, we don't have to call pci_set_drvdata(pci, NULL) any
longer in each driver.

The only remaining pci_set_drvdata(NULL) is in azx_firmware_cb() in
hda_intel.c.  Since this function itself releases the card instance,
we need to clear drvdata here as well, so that it won't be released
doubly in the remove callback.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2013-05-29 12:37:32 +02:00
Chew, Chiau Ee e44007e0f9 ALSA: hda - add PCI IDs for Intel BayTrail
Add HD Audio Device PCI ID for the Intel BayTrail platform.

Signed-off-by: Chew, Chiau Ee <chiau.ee.chew@intel.com>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2013-05-17 09:35:17 +02:00