summaryrefslogtreecommitdiff
path: root/sound/hda
AgeCommit message (Collapse)Author
2016-03-08ALSA: hda - Fix unexpected resume through regmap code pathTakashi Iwai
HD-audio driver has a mechanism to trigger the runtime resume automatically at accessing the verbs. This auto-resume, however, causes the mutex deadlock when invoked from the regmap handler since the regmap keeps the mutex while auto-resuming. For avoiding that, there is some tricky check in the HDA regmap handler to return -EAGAIN error to back-off when the codec is powered down. Then the caller of regmap r/w will retry after properly turning on the codec power. This works in most cases, but there seems a slight race between the codec power check and the actual on-demand auto-resume trigger. This resulted in the lockdep splat, eventually leading to a real deadlock. This patch tries to address the race window by getting the runtime PM refcount at the check time using pm_runtime_get_if_in_use(). With this call, we can keep the power on only when the codec has been already turned on, and back off if not. For keeping the code consistency, the code touching the runtime PM is stored in hdac_device.c although it's used only locally in hdac_regmap.c. Reported-by: Jiri Slaby <jslaby@suse.cz> Cc: <stable@vger.kernel.org> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2016-03-07ALSA: hda - Use snd_hdac namespace prefix for chmap exported APIsSubhransu S. Prusty
Signed-off-by: Subhransu S. Prusty <subhransu.s.prusty@intel.com> Signed-off-by: Vinod Koul <vinod.koul@intel.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2016-03-07ALSA: hda - Move chmap support helpers/ops to coreSubhransu S. Prusty
Chmap helpers, ops, controls are moved to core. Signed-off-by: Subhransu S. Prusty <subhransu.s.prusty@intel.com> Signed-off-by: Vinod Koul <vinod.koul@intel.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2016-03-07ALSA: hda - Add hdmi chmap verb programming ops to chmap objectSubhransu S. Prusty
Add slot and channel count programming to hdmi_chmap object and move the chmap_ops to core. Use register_chmap_ops API to register for default ops. Override specific chmap ops in the driver. Signed-off-by: Subhransu S. Prusty <subhransu.s.prusty@intel.com> Signed-off-by: Vinod Koul <vinod.koul@intel.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2016-02-26ALSA: hda - Loop interrupt handling until really clearedTakashi Iwai
Currently the interrupt handler of HD-audio driver assumes that no irq update is needed while processing the irq. But in reality, it has been confirmed that the HW irq is issued even during the irq handling. Since we clear the irq status at the beginning, process the interrupt, then exits from the handler, the lately issued interrupt is left untouched without being properly processed. This patch changes the interrupt handler code to loop over the check-and-process. The handler tries repeatedly as long as the IRQ status are turned on, and either stream or CORB/RIRB is handled. For checking the stream handling, snd_hdac_bus_handle_stream_irq() returns a value indicating the stream indices bits. Other than that, the change is only in the irq handler itself. Reported-by: Libin Yang <libin.yang@linux.intel.com> Cc: <stable@vger.kernel.org> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2016-01-20ALSA: hda - Degrade i915 binding failure messageTakashi Iwai
Currently HD-audio driver on Intel Skylake or Broxteon gives an error message when binding with i915 audio component fails. However, this isn't any serious error on a system without Intel graphics. Indeed there are such systems, where a third-party codec (e.g. Creative) is put on the mobo while using other discrete GPU (e.g. Nvidia). Printing a kernel "error" message is overreaction in such a case. This patch downgrades the print level for that message. For systems that mandate the i915 binding (e.g. Haswell or Broadwell HDMI/DP), another kernel error message is shown in addition to make clear what went wrong. Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=111021 Signed-off-by: Takashi Iwai <tiwai@suse.de>
2016-01-11Merge tag 'asoc-v4.4-rc8' of ↵Takashi Iwai
git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound into for-next ASoC: Last updates for v4.5 A bunch more updates for v4.5, mainly driver work: - More topology API enhancements from Mengdong Lin working towards making everything more component based and being able to specify PCM links via topology. - Large sets driver updates from Cirrus, Intel (mainly more Skylake support) and Renesas. - New driver for AMD ACP - Rename PCM1792a driver to be generic pcm179x
2016-01-10ALSA: hdac: add snd_hdac_ext_bus_link_power_up_allVinod Koul
We have an API for powering down all links, we need a similar one for powering up links, so add for power up as well Signed-off-by: Jayachandran B <jayachandran.b@intel.com> Signed-off-by: Subhransu S. Prusty <subhransu.s.prusty@intel.com> Signed-off-by: Vinod Koul <vinod.koul@intel.com> Reviewed-by: Takashi Iwai <tiwai@suse.de> Signed-off-by: Mark Brown <broonie@kernel.org>
2016-01-10ALSA: hdac: Increase timeout value for link power checkJayachandran B
HW recommends 180us for worst case values for link power up delay, so change the current delay value from 50 (150us) to 150 (450us) Signed-off-by: Jayachandran B <jayachandran.b@intel.com> Signed-off-by: Vinod Koul <vinod.koul@intel.com> Reviewed-by: Takashi Iwai <tiwai@suse.de> Signed-off-by: Mark Brown <broonie@kernel.org>
2016-01-10ALSA: hdac: couple the hda DMA stream in cleanupJeeja KP
A stream is by default in coupled mode, in DSP operation we move it to decoupled mode. On cleanup HW expects that we leave it back to default state so couple the DMA on cleanup. Signed-off-by: Jeeja KP <jeeja.kp@intel.com> Signed-off-by: Vinod Koul <vinod.koul@intel.com> Reviewed-by: Takashi Iwai <tiwai@suse.de> Signed-off-by: Mark Brown <broonie@kernel.org>
2016-01-10ALSA: hdac: Add support for hda DMA Resume capabilityJeeja KP
Skylake sports new capability of DMA resume, DRSM where we can resume the DMA. This capability is defined by presence of AZX_DRSM_CAP_ID. If this capability is present, we use this capability. So we add: snd_hdac_ext_stream_drsm_enable() - DMA resume caps snd_hdac_ext_stream_set_dpibr() - set the DMA position snd_hdac_ext_stream_set_lpib() - set the lpib Signed-off-by: Jeeja KP <jeeja.kp@intel.com> Signed-off-by: Vinod Koul <vinod.koul@intel.com> Reviewed-by: Takashi Iwai <tiwai@suse.de> Signed-off-by: Mark Brown <broonie@kernel.org>
2015-12-10ALSA: hda - Move audio component accesses to hdac_i915.cTakashi Iwai
A couple of i915_audio_component ops have been added and accessed directly from patch_hdmi.c. Ideally all these should be factored out into hdac_i915.c. This patch does it, adds two new helper functions for setting N/CTS and fetching ELD bytes. One bonus is that the hackish widget vs port mapping is also moved to hdac_i915.c, so that it can be fixed / enhanced more cleanly. Reviewed-by: Vinod Koul <vinod.koul@intel.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-10-28ALSA: hda - Add / fix kernel doc commentsTakashi Iwai
Give some readable comment in kernel doc style for each exported function, as I promised in the previous meetings. While we're at it, fix the wrong comments, too. Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-10-20ALSA: hda - Advertise MODALIAS in ueventThierry Reding
By setting the MODALIAS variable in uevents, userspace helpers will be enabled to load modules via the module alias associated with a device. This information is required to automatically load HDA codec drivers instead of having to explicitly request the various modules in the HDA core code. [Note that currently the legacy HDA controller driver tries to bind codec modules manually. It's for supporting the fallback generic drivers. This new udev modalias support was added rather for ASoC HDA ext drivers, since this addition itself won't hurt the legacy HDA -- tiwai] [Use the common helper function to generate the modalias -- tiwai] Signed-off-by: Thierry Reding <treding@nvidia.com> Reviewed-by: Vinod Koul <vinod.koul@intel.com> Tested-by: Subhransu S Prusty <subhransu.s.prusty@intel.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-10-20ALSA: hda - Add hdaudio bus modalias supportSubhransu S. Prusty
This patch just adds modalias sysfs entry to each hdaudio bus entry. [rewritten to call the common helper function by tiwai] Signed-off-by: Subhransu S. Prusty <subhransu.s.prusty@intel.com> Reviewed-by: Vinod Koul <vinod.koul@intel.com> Tested-by: Subhransu S Prusty <subhransu.s.prusty@intel.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-10-20ALSA: hda - Add a common helper to give the codec modalias stringTakashi Iwai
This patch provide a new common helper function, snd_hdac_codec_modalias(), to give the codec modalias name string. This function will be used by multiple places in the later patches. Reviewed-by: Vinod Koul <vinod.koul@intel.com> Tested-by: Subhransu S Prusty <subhransu.s.prusty@intel.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-10-20ALSA: hda - Add hduadio support to DEVTABLESubhransu S. Prusty
For generating modalias entries automatically, move the definition of struct hda_device_id to linux/mod_devicetable.h and add the handling of this record in file2alias helper. The new modalias is represented with combination of vendor id, device id, and api version as "hdaudio:vNrNaN". This patch itself doesn't convert the existing modaliases. Since they were added manually, this patch won't give any regression by itself at this point. [Modified the modalias format to adapt the api_version field, and drop invalid ANY_ID definition by tiwai] Signed-off-by: Subhransu S. Prusty <subhransu.s.prusty@intel.com> Reviewed-by: Vinod Koul <vinod.koul@intel.com> Tested-by: Subhransu S Prusty <subhransu.s.prusty@intel.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-10-15ALSA: hda - consolidate chip rename functionsTakashi Iwai
A few multiple codec drivers do renaming the chip_name string but all these are open-coded and some of them have even no error check. Let's make common helpers to do it properly. Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-10-13Merge branch 'for-linus' into for-nextTakashi Iwai
2015-10-13ALSA: hdac: Explicitly add io.hVinod Koul
Compiling the hdac extended core on arm fails with below error: sound/hda/ext/hdac_ext_bus.c: In function 'hdac_ext_writel': >> sound/hda/ext/hdac_ext_bus.c:29:2: error: implicit declaration of >> function +'writel' [-Werror=implicit-function-declaration] writel(value, addr); ^ sound/hda/ext/hdac_ext_bus.c: In function 'hdac_ext_readl': >> sound/hda/ext/hdac_ext_bus.c:34:2: error: implicit declaration of >> function +'readl' [-Werror=implicit-function-declaration] return readl(addr); This is fixed by explicitly including io.h Fixes: 99463b3a3994 - ('ALSA: hda: provide default bus io ops extended hdac') Reported-by: kbuild test robot <lkp@intel.com> Suggested-by: Mark Brown <broonie@kernel.org> Signed-off-by: Vinod Koul <vinod.koul@intel.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-10-08ALSA: hdac: Copy codec helpers to coreSubhransu S. Prusty
The current codec helpers are local to hda code and needs to be moved to core so that other users can use it. The helpers to read/write the codec and to check the power state of widgets is copied Signed-off-by: Subhransu S. Prusty <subhransu.s.prusty@intel.com> Signed-off-by: Vinod Koul <vinod.koul@intel.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-10-05ALSA: hdac: Fix to check if stream not in use in releaseJeeja KP
if the stream is decoupled and both link and host are used, while releasing the stream, need to check if link and host stream are not in use. This patch adds fix to check if the host/link stream is in used before coupling it back when releasing the stream. Signed-off-by: Jeeja KP <jeeja.kp@intel.com> Signed-off-by: Vinod Koul <vinod.koul@intel.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-10-05ALSA: hdac: Fix incorrect update of stream id mappingSubhransu S. Prusty
Bits in LOSIDV need to be set to map the stream id for specific link. Fixing this by setting the required bits in the register. Signed-off-by: Subhransu S. Prusty <subhransu.s.prusty@intel.com> Signed-off-by: Vinod Koul <vinod.koul@intel.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-09-02ALSA: hda - allow codecs to access the i915 pin/ELD callbackDavid Henningsson
This lets the interested codec be notified when an i915 pin/ELD event happens. [tiwai: Fixed a trivial build error for CONFIG_SND_HDA_I915=n] Signed-off-by: David Henningsson <david.henningsson@canonical.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-08-26ALSA: hda - Fix widget sysfs tree corruption after refreshTakashi Iwai
When snd_hdac_refresh_widget_sysfs() is called before the first hda_widget_sysfs_init(), the next call overrides and eventually fails. This results in unexpected Oops, something like: BUG: unable to handle kernel NULL pointer dereference at 00000000000000c8 IP: [<ffffffff8180e2a3>] hdmi_chmap_ctl_info+0x23/0x40 The fix is to add a check of the existing sysfs tree. Also, for more safety, this patch adds the checks of device_is_registered() in snd-hdac_refresh_wdiget_sysfs(), too. Fixes: fa4f18b4f402 ('ALSA: hda - Refresh widgets sysfs at probing Haswell+ HDMI codecs') Bugizlla: https://bugzilla.kernel.org/show_bug.cgi?id=103431 Reported-by: Andreas Reis <andreas.reis@gmail.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-08-23ALSA: hdac: Add snd_hdac_get_hdac_stream()Jeeja KP
Add a helper to find the stream using stream tag and direction. This is useful for drivers to query stream based on stream tag and direction, fox example while downloading FW thru DSP loader code Signed-off-by: Jeeja KP <jeeja.kp@intel.com> Signed-off-by: Vinod Koul <vinod.koul@intel.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-08-23ALSA: hdac: fix the spbmaxfifo APIVinod Koul
spbmaxfifo API is actually a query function not a set function so name it snd_hdac_ext_stream_get_spbmaxfifo() Reported-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Signed-off-by: Vinod Koul <vinod.koul@intel.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-08-23ALSA: hdac: Fix size allocation for ext device allocationVinod Koul
While creating hdac_ext_device, we used hdev for sizeof insteadof edev, which resulted in eventual crash of the system Fix the size here Fixes: a512f5611646 ('ALSA: hdac: add hdac extended device') Reported-by: Subhransu S. Prusty <subhransu.s.prusty@intel.com> Signed-off-by: Vinod Koul <vinod.koul@intel.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-08-21ALSA: hdac: Remove the usage of key for host streamJeeja KP
hdac_ext_stream assign doesn't require key mapping as in case of hdac_stream. So for host stream, the key to device mapping needs to be removed. Signed-off-by: Jeeja KP <jeeja.kp@intel.com> Signed-off-by: Vinod Koul <vinod.koul@intel.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-08-21ALSA: hdac: Add support to enable SPIB for hdac ext streamJeeja KP
The drivers need to set the spib and maxfifios values, so add these new APIs snd_hdac_ext_stream_set_spib() and snd_hdac_ext_stream_set_spbmaxfifo() APIs For these APIs we also need to have spib and fifos pointer, so add these to hdac_ext_stream and initialize them at stream init Signed-off-by: Jeeja KP <jeeja.kp@intel.com> Signed-off-by: Vinod Koul <vinod.koul@intel.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-08-21ALSA: hdac: Add snd_hdac_ext_bus_link_power_down_all()Jeeja KP
New HDA controllers like Skylake sport multiple HDA links, so we need a helper to turn off all the links in one go while suspending the device so add snd_hdac_ext_bus_link_power_down_all() API Signed-off-by: Jeeja KP <jeeja.kp@intel.com> Signed-off-by: Vinod Koul <vinod.koul@intel.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-08-21ALSA: hdac: Fix to read the correct offset of spcap/link registerJeeja KP
SPCAP and Mutilink register offset were incorrect as offset needs to be based on capability offset. So correct the offset for read/write of spcap/link register. Signed-off-by: Jeeja KP <jeeja.kp@intel.com> Signed-off-by: Vinod Koul <vinod.koul@intel.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-08-21ALSA: hdac: add snd_hdac_refresh_widget_sysfs()Vinod Koul
Some codecs like Intel HDMI by default do not show up all the pins, they have to be manually enabled, so we need to refresh the codec widgets and then recreate the sysfs tree. So add new API snd_hdac_refresh_widget_sysfs() to do this. It should be be used by codec driver after sending magic verbs to codec Signed-off-by: Vinod Koul <vinod.koul@intel.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-08-21ALSA: hdac: add extended device driver registrationVinod Koul
This adds new extended driver objects and API for registering the extended devices. Signed-off-by: Subhransu S. Prusty <subhransu.s.prusty@intel.com> Signed-off-by: Vinod Koul <vinod.koul@intel.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-08-21ALSA: hdac: add hdac extended deviceVinod Koul
This adds based hdac extended device object which will be used by ASoC HDAC codecs Signed-off-by: Vinod Koul <vinod.koul@intel.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-08-21ALSA: hdac: Add API for removing hdac extended deviceVinod Koul
The HDAC extended device objects are created by HDAC extended bus on probe. When controller is removed they should be removed as well, so add API snd_hdac_ext_bus_device_remove for this Signed-off-by: Vinod Koul <vinod.koul@intel.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-08-11Merge branch 'for-linus' into for-nextTakashi Iwai
2015-08-04ALSA: HDA: Dont check return for snd_hdac_chip_readlJeeja KP
The snd_hdac_chip_readl return can never be less than zeros, so no point in checking for the return value This fixes following static checker warnings in snd_hdac_ext_bus_parse_capabilities sound/hda/ext/hdac_ext_controller.c:47 snd_hdac_ext_bus_parse_capabilities() warn: unsigned 'offset' is never less than zero. sound/hda/ext/hdac_ext_controller.c:54 snd_hdac_ext_bus_parse_capabilities() warn: unsigned 'cur_cap' is never less than zero. Signed-off-by: Jeeja KP <jeeja.kp@intel.com> Reported-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Vinod Koul <vinod.koul@intel.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-08-04ALSA: HDA: Fix stream assignment for host in decoupled modeJeeja KP
This fixes issue in assigning host stream in case of decoupled mode. The check to verify if the stream is already in use was wrong so fix that Signed-off-by: Jeeja KP <jeeja.kp@intel.com> Signed-off-by: Vinod Koul <vinod.koul@intel.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-07-27Merge branch 'for-linus' into for-nextTakashi Iwai
... to make easier developing HDA ext code.
2015-07-20ALSA: hda - Fix Skylake codec timeoutDavid Henningsson
When the controller is powered up but the HDMI codec is powered down on Skylake, the power well is turned off. When the codec is then powered up again, we need to poke the codec a little extra to make sure it wakes up. Otherwise we'll get sad "no response from codec" messages and broken audio. This also changes azx_runtime_resume to actually call snd_hdac_set_codec_wakeup for Skylake (before STATETS read). (Otherwise it would only have been called for Haswell and Broadwell, which both do not need it, so this probably was not the author's intention.) Signed-off-by: David Henningsson <david.henningsson@canonical.com> Reviewed-by: Libin Yang <libin.yang@intel.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-07-17ALSA: hda - Check the return value from pm_runtime_get/put*()Takashi Iwai
This patch changes the return type of snd_hdac_power_up/down() and variants to pass the error code from the underlying pm_runtime_get/put() calls. Currently they are ignored, but in most places, these should be handled properly. As an example, the regmap handler is updated to check the return value and accesses the register only when the wakeup succeeds. Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-07-09ALSA: hda: Delete an unnecessary check before the function call "kobject_put"Markus Elfring
The kobject_put() function tests whether its argument is NULL and then returns immediately. Thus the test around the call is not needed. This issue was detected by using the Coccinelle software. Signed-off-by: Markus Elfring <elfring@users.sourceforge.net> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-06-17ALSA: hda: provide default bus io ops extended hdacVinod Koul
A typical io ops use simple io accessors which can be common for most drivers, so provide a default ops which will be used if driver doesn't provide one Signed-off-by: Vinod Koul <vinod.koul@intel.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-06-17ALSA: hda: add hda link cleanup routineVinod Koul
In HDA extended bus the HDA link objects are created when multilink capabilities are parsed. We need a routine which free up these link objects for a bus. So add snd_hdac_link_free_all routine Signed-off-by: Jeeja KP <jeeja.kp@intel.com> Signed-off-by: Vinod Koul <vinod.koul@intel.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-06-17ALSA: hda: add hdac_ext stream creation and cleanup routinesVinod Koul
HDAC extended core should create streams for an extended bus and also free up those on cleanup. So introduce snd_hdac_ext_stream_init_all and snd_hdac_stream_free_all routines Signed-off-by: Jeeja KP <jeeja.kp@intel.com> Signed-off-by: Vinod Koul <vinod.koul@intel.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-06-16ALSA: HDAC: move SND_HDA_PREALLOC_SIZE to coreVinod Koul
Since this is common option for HDA driver to specfiy pre-allocated buffer, we should make this option availble to all HDA driver by moving this to HDA core Signed-off-by: Vinod Koul <vinod.koul@intel.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-06-12Merge branch 'for-linus' into for-nextTakashi Iwai
Yet another non-trivial conflicts resolution for the recent HD-audio fix. Conflicts: sound/pci/hda/hda_intel.c Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-06-11ALSA: hdac_ext: add extended stream capabilitiesJeeja KP
Now we have the bus and controller code added to find and initialize the extended capabilities. Now we need to use them in stream code to decouple stream, manage links etc So this patch adds the stream handling code for extended capabilities introduced in preceding patches Signed-off-by: Jeeja KP <jeeja.kp@intel.com> Signed-off-by: Vinod Koul <vinod.koul@intel.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-06-11ALSA: hdac_ext: add hdac extended controllerJeeja KP
The controller needs to support the new capabilities and allow reading, parsing and initializing of these capabilities, so this patch does it Signed-off-by: Jeeja KP <jeeja.kp@intel.com> Signed-off-by: Vinod Koul <vinod.koul@intel.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>