aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci/hda/patch_hdmi.c (follow)
AgeCommit message (Collapse)AuthorFilesLines
2018-06-21ALSA: hda - Force to link down at runtime suspend on ATI/AMD HDMITakashi Iwai1-0/+5
Henning Kühn reported that the discrete AMD GPU on his hybrid graphics laptop no longer runtime-suspends due to the recent commit 07f4f97d7b4b ("vga_switcheroo: Use device link for HDA controller"). The root cause is that the HDMI codec on AMD GPU doesn't support CLKSTOP and EPSS, which are currently mandatory for powering down the HD-audio link at runtime suspend. Because the HD-audio link is still up, HD-audio controller driver blocks the transition to D3. For addressing the regression, this patch adds a new flag to indicate the forced link-down, and sets it for AMD HDMI codecs appropriately in the codec driver. Fixes: 07f4f97d7b4b ("vga_switcheroo: Use device link for HDA controller") Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=106957 Reported-by: Lukas Wunner <lukas@wunner.de> Reported-and-tested-by: Henning Kühn <prg@cooco.de> Cc: <stable@vger.kernel.org> # v4.17+ Signed-off-by: Takashi Iwai <tiwai@suse.de>
2018-05-28sound: Use octal not symbolic permissionsJoe Perches1-1/+1
Convert the S_<FOO> symbolic permissions to their octal equivalents as using octal and not symbolic permissions is preferred by many as more readable. see: https://lkml.org/lkml/2016/8/2/1945 Done with automated conversion via: $ ./scripts/checkpatch.pl -f --types=SYMBOLIC_PERMS --fix-inplace <files...> Miscellanea: o Wrapped one multi-line call to a single line Signed-off-by: Joe Perches <joe@perches.com> Acked-by: Vinod Koul <vkoul@kernel.org> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2018-04-25ALSA: hda - Skip jack and others for non-existing PCM streamsTakashi Iwai1-1/+8
When CONFIG_SND_DYNAMIC_MINORS isn't set, there are only limited number of devices available, and HD-audio, especially with HDMI/DP codec, will fail to create more than two devices. The driver warns about the lack of such devices and skips the PCM device creations, but the HDMI driver still tries to create the corresponding JACK, SPDIF and ELD controls even for the non-existing PCM substreams. This results in confusion on user-space, and even may break the operation. Similarly, Intel HDMI/DP codec builds the ELD notification from i915 graphics driver, and this may be broken if a notification is sent for the non-existing PCM stream. This patch adds the check of the existence of the assigned PCM substream in the both scenarios above, and skips the further operation if the PCM substream is not assigned. Fixes: 9152085defb6 ("ALSA: hda - add DP MST audio support") Cc: <stable@vger.kernel.org> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2017-12-07ALSA: hda - Add vendor id for Cannonlake HDMI codecGuneshwor Singh1-2/+4
Cannonlake HDMI codec has the same nid as Geminilake. This adds the codec entry for it. Signed-off-by: Guneshwor Singh <guneshwor.o.singh@intel.com> Cc: <stable@vger.kernel.org> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2017-09-20ALSA: hda - program ICT bits to support HBR audioSriram Periyasamy1-0/+21
On recent Intel platforms (Haswell, Broadwell, Skylake, ApolloLake, KabyLake, ...), the IEC Coding Type (ICT) bitfield in the Digital Converter Control #3 needs to be set explicitly for HDMI/DisplayPort High Bit Rate (HBR) audio playback to work. This was not required in earlier platforms when HBR was first introduced. The ICT bits are defined in Section 7.3.3.9 of the HDaudio 1.0a specification. Since the ICT bitfield was not specified for HDAudio 1.0 devices (before 2009), we only program it on machines more recent than Haswell. We tested that this fix is not needed on Baytrail-I (MinnowBoard Turbot) and believe by extension it also does not apply to Braswell. [ Moved AC_VERB_SET_DIGI_CONVERT_3 definition to the right place by tiwai ] Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=98797 Signed-off-by: Sriram Periyasamy <sriramx.periyasamy@intel.com> Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Signed-off-by: Subhransu S. Prusty <subhransu.s.prusty@intel.com> Acked-by: Vinod Koul <vinod.koul@intel.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2017-09-03ALSA: hda: Fix regression of hdmi eld control created based on invalid pcmWang YanQing1-6/+8
Commit fb087eaaef72 ("ALSA: hda - hdmi eld control created based on pcm") forget to filter out invalid pcm numbers, if there is only one invalid pcm number, then this issue causes we create eld control for invalid pcm silently, but when there are more than one invalid pcm numbers, then this issue bring probe error looks like below dmesg: " kernel: [ 1.647283] snd_hda_intel 0000:00:03.0: bound 0000:00:02.0 (ops 0xc2967540) kernel: [ 1.651192] snd_hda_intel 0000:00:03.0: Too many HDMI devices kernel: [ 1.651195] snd_hda_intel 0000:00:03.0: Consider building the kernel with CONFIG_SND_DYNAMIC_MINORS=y kernel: [ 1.651197] snd_hda_intel 0000:00:03.0: Too many HDMI devices kernel: [ 1.651199] snd_hda_intel 0000:00:03.0: Consider building the kernel with CONFIG_SND_DYNAMIC_MINORS=y kernel: [ 1.651201] snd_hda_intel 0000:00:03.0: Too many HDMI devices kernel: [ 1.651203] snd_hda_intel 0000:00:03.0: Consider building the kernel with CONFIG_SND_DYNAMIC_MINORS=y kernel: [ 1.651676] snd_hda_intel 0000:00:03.0: control 3:0:0:ELD:0 is already present kernel: [ 1.651787] snd_hda_codec_hdmi: probe of hdaudioC0D0 failed with error -16 " This patch add invalid pcm number filter before calling hdmi_create_eld_ctl. Fixes: fb087eaaef72 ("ALSA: hda - hdmi eld control created based on pcm") Signed-off-by: Wang YanQing <udknight@gmail.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2017-07-15ALSA: hda - Add missing NVIDIA GPU codec IDs to patch tableDaniel Dadap1-0/+27
Add codec IDs for several recently released, pending, and historical NVIDIA GPU audio controllers to the patch table, to allow the correct patch functions to be selected for them. Signed-off-by: Daniel Dadap <ddadap@nvidia.com> Reviewed-by: Andy Ritger <aritger@nvidia.com> Cc: <stable@vger.kernel.org> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2017-07-12ALSA: hda - Add hdmi id for a Geminilake variantSubhransu S. Prusty1-1/+4
Few GLK platform variants report a different vendor id. Add it. Also add the missing check for GLK in is_haswell_plus(). Signed-off-by: Subhransu S. Prusty <subhransu.s.prusty@intel.com> Acked-by: Vinod Koul <vinod.koul@intel.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2017-06-28Merge branch 'topic/hda-fix' into for-nextTakashi Iwai1-60/+34
2017-06-28ALSA: hda - Minor code refactoring for Intel HDMI codec parsersTakashi Iwai1-53/+34
No functional change, just a slight reduction of lines. Signed-off-by: Takashi Iwai <tiwai@suse.de>
2017-06-28ALSA: hda - Bind with i915 component before codec bindingTakashi Iwai1-12/+5
We used a on-demand i915 component binding for IvyBridge and SandyBridge HDMI codecs, but it has a potential problem of the nested module loading. For avoiding that situation, assure the i915 binding happening at the controller driver level for PCH controller devices, where the initialization is performed in a detached work, instead of calling from the codec driver probe. Signed-off-by: Takashi Iwai <tiwai@suse.de>
2017-06-09ALSA: hda: Constify hw_constraintsTakashi Iwai1-5/+5
snd_pcm_hw_constraint_list(), *_ratnums() and *_ratdens() receive the const pointers. Constify the corresponding static objects for better hardening. Signed-off-by: Takashi Iwai <tiwai@suse.de>
2017-04-13ALSA: hda: Move common haswell init to a helperAnder Conselvan De Oliveira1-6/+21
Geminilake vendor nid is different from other Skylake variants, but rest of the initialization code is same. So a variable is added in hdmi_spec to store the platform specific vendor nid and move the initialization code to a helper function to be used by both platform specific init. Fixes: 126cfa2f5e15 ("ALSA: hda: Add Geminilake HDMI codec ID") Signed-off-by: Ander Conselvan De Oliveira <ander.conselvan.de.oliveira@intel.com> Signed-off-by: Subhransu S. Prusty <subhransu.s.prusty@intel.com> Signed-off-by: Jaikrishna Nemallapudi <jaikrishnax.nemallapudi@intel.com> Cc: Senthilnathan Veppur <senthilnathanx.veppur@intel.com> Cc: Vinod Koul <vinod.koul@intel.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2017-03-20Merge branch 'topic/for-4.12' into for-nextTakashi Iwai1-1/+1
2017-03-01Merge tag 'sound-fix-4.11-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/soundLinus Torvalds1-0/+1
Pull sound fixes from Takashi Iwai: "A few last-minute fixes for rc1: - ALSA core timer and sequencer fixes for bugs spotted by syzkaller - a couple of trivial HD-audio fixups - additional PCI / codec IDs for Intel Geminilake - fixes for CT-XFi DMA mask bugs" * tag 'sound-fix-4.11-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound: ALSA: seq: Fix link corruption by event error handling ALSA: hda - Add subwoofer support for Dell Inspiron 17 7000 Gaming ALSA: ctxfi: Fallback DMA mask to 32bit ALSA: timer: Reject user params with too small ticks ALSA: hda: Add Geminilake HDMI codec ID ALSA: hda - Fix micmute hotkey problem for a lenovo AIO machine ALSA: hda - Add Geminilake PCI ID
2017-02-27ALSA: hda: Add Geminilake HDMI codec IDVinod Koul1-0/+1
Geminilake HDMI codec 0x280d is similar to previous platforms, so add it with similar ops as previous. Signed-off-by: Senthilnathan Veppur <senthilnathanx.veppur@intel.com> Signed-off-by: Vinod Koul <vinod.koul@intel.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2017-02-23Merge tag 'v4.10-rc8' into drm-nextDave Airlie1-0/+1
Linux 4.10-rc8 Backmerge Linus rc8 to fix some conflicts, but also to avoid pulling it in via a fixes pull from someone.
2017-02-21ALSA: pci: constify snd_kcontrol_new structuresBhumika Goyal1-1/+1
Declare snd_kcontrol_new structures as const as they are only passed as an argument to the function snd_ctl_new1. This argument is of type const, so snd_kcontrol_new structures having the same property can be made const too. Done using Coccinelle: @r1 disable optional_qualifier @ identifier i; position p; @@ static struct snd_kcontrol_new i@p = {...}; @ok1@ identifier r1.i; position p; expression e1; @@ snd_ctl_new1(&i@p,e1) @bad@ position p!={r1.p,ok1.p}; identifier r1.i; @@ i@p @depends on !bad disable optional_qualifier@ identifier r1.i; @@ +const struct snd_kcontrol_new i; Signed-off-by: Bhumika Goyal <bhumirks@gmail.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2017-02-09ALSA: hda - adding a new NV HDMI/DP codec ID in the driverHui Wang1-0/+1
Without this change, the HDMI/DP codec will be recognised as a generic codec, and there is no sound when playing through this codec. As suggested by NVidia side, after adding the new ID in the driver, the sound playing works well. Cc: <stable@vger.kernel.org> Signed-off-by: Hui Wang <hui.wang@canonical.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2017-01-12ALSA: hda - add DP MST audio supportLibin Yang1-52/+193
This patch adds the DP MST audio support on i915 platform and it will enable dyn_pcm_assign feature. DP MST supports several device entry on the same port and each device entry can map to one pcm stream. For example, on i915, there are 3 pins, and each pin has 3 device entries. This means there should be 3x3 pcms. However, there is only 3 pipe lines in i915. This means 3 pcms are actived at most at the same moment. We will create 5 pcms (pin number + dev entry num - 1) in this case. For the details, please refer commit a76056f2e57e ("ALSA: hda - hdmi dynamically bind PCM to pin when monitor hotplug") Each device entry is a virtual pin. It is described by pin_nid and dev_id in struct hdmi_spec_per_pin. Reviewed-by: Takashi Iwai <tiwai@suse.de> Signed-off-by: Libin Yang <libin.yang@linux.intel.com> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch> Link: http://patchwork.freedesktop.org/patch/msgid/1484208294-8637-3-git-send-email-libin.yang@intel.com
2016-09-22drm/i915/dp: DP audio API changes for MSTPandiyan, Dhinakaran1-3/+4
DP MST provides the capability to send multiple video and audio streams through a single port. This requires the API's between i915 and audio drivers to distinguish between multiple audio capable displays that can be connected to a port. Currently only the port identity is shared in the APIs. This patch adds support for MST with an additional parameter 'int pipe'. The existing parameter 'port' does not change it's meaning. pipe = MST : display pipe that the stream originates from Non-MST : -1 Affected APIs: struct i915_audio_component_ops - int (*sync_audio_rate)(struct device *, int port, int rate); + int (*sync_audio_rate)(struct device *, int port, int pipe, + int rate); - int (*get_eld)(struct device *, int port, bool *enabled, - unsigned char *buf, int max_bytes); + int (*get_eld)(struct device *, int port, int pipe, + bool *enabled, unsigned char *buf, int max_bytes); struct i915_audio_component_audio_ops - void (*pin_eld_notify)(void *audio_ptr, int port); + void (*pin_eld_notify)(void *audio_ptr, int port, int pipe); This patch makes dummy changes in the audio drivers (thanks Libin) for build to succeed. The audio side drivers will send the right 'pipe' values for MST in patches that will follow. v2: Renamed the new API parameter from 'dev_id' to 'pipe'. (Jim, Ville) Included Asoc driver API compatibility changes from Jeeja. Added WARN_ON() for invalid pipe in get_saved_encoder(). (Takashi) Added comment for av_enc_map[] definition. (Takashi) v3: Fixed logic error introduced while renaming 'dev_id' as 'pipe' (Ville) Renamed get_saved_encoder() to get_saved_enc() to reduce line length v4: Rebased. Parameter check for pipe < -1 values in get_saved_enc() (Ville) Switched to for_each_pipe() in get_saved_enc() (Ville) Renamed 'pipe' to 'dev_id' in audio side code (Takashi) v5: Included a comment for the dev_id arg. (Libin) Signed-off-by: Dhinakaran Pandiyan <dhinakaran.pandiyan@intel.com> Reviewed-by: Takashi Iwai <tiwai@suse.de> Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com> Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com> Link: http://patchwork.freedesktop.org/patch/msgid/1474488168-2343-1-git-send-email-dhinakaran.pandiyan@intel.com
2016-06-16ALSA: hda: fix some klockwork scan warningsLibin Yang1-0/+5
This patch fixes some warnings from klockwork. These warnings are not the real issues. The patch adds the sanity check. Signed-off-by: Libin Yang <libin.yang@linux.intel.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2016-05-16Merge branch 'for-next' into for-linusTakashi Iwai1-119/+267
2016-05-11ALSA: hda - Fix regression on ATI HDMI audioTakashi Iwai1-4/+3
The HDMI/DP audio output on ATI/AMD chips got broken due to the recent restructuring of chmap. Fortunately, Daniel Exner could bisect, and pointed the culprit commit [739ffee97ed5: ALSA: hda - Add hdmi chmap verb programming ops to chmap object]. This commit moved some ops from hdmi_ops to chmap_ops, and reassigned the ops in the embedded chmap object in hdmi_spec instead. Unfortunately, the reassignment of these ops in patch_atihdmi() were moved into an if block that is performed only for old chips. Thus, on newer chips, the generic ops is still used, which doesn't work for such ATI/AMD chips. This patch addresses the regression, simply by moving the assignment of chmap ops to the right place. Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=114981 Fixes: 739ffee97ed5 ('ALSA: hda - Add hdmi chmap verb programming ops to chmap object') Reported-and-tested-by: Daniel Exner <dex@dragonslave.de> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2016-04-26Merge branch 'for-linus' into for-nextTakashi Iwai1-5/+7
For taking back the recent change of HDA HDMI fixes for i915 HSW/BDW. Signed-off-by: Takashi Iwai <tiwai@suse.de>
2016-04-26ALSA: hda - Update BCLK also at hotplug for i915 HSW/BDWTakashi Iwai1-0/+1
The recent bug report suggests that BCLK setup for i915 HSW/BDW needs to be updated at each HDMI hotplug, not only at initialization and resume. That is, we need to update HSW_EM4 and HSW_EM5 registers at ELD notification, too. Otherwise the HDMI audio may be out of sync and played in a wrong pitch. However, the HDA codec driver has no access to the controller registers, and currently the code managing these registers is in hda_intel.c, i.e. local to the controller driver. For allowing the explicit BCLK update from the codec driver, as in this patch, the former haswell_set_bclk() in hda_intel.c is moved to hdac_i915.c and exposed as snd_hdac_i915_set_bclk(). This is called from both the HDA controller driver and intel_pin_eld_notify() in HDMI codec driver. Along with this change, snd_hdac_get_display_clk() gets dropped as it's no longer used. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=91410 Cc: <stable@vger.kernel.org> # v4.5+ Signed-off-by: Takashi Iwai <tiwai@suse.de>
2016-04-18ALSA - hda: hdmi check NULL pointer in hdmi_set_chmapLibin Yang1-0/+2
Make sure per_pin is not NULL before using it. Fixes: 9b3dc8aa3fb1 ('ALSA: hda - Register chmap obj as priv data instead of codec') Signed-off-by: Libin Yang <libin.yang@linux.intel.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2016-04-13ALSA: hda - Fix inconsistent monitor_present state until repollTakashi Iwai1-7/+4
While the previous commit fixed the missing monitor_present flag update, it may be still in an inconsistent state while the driver repolls: the flag itself is updated, but the eld_valid flag and the contents don't follow until the repoll finishes (and may be repeated for a few times). The basic problem is that pin_eld->monitor_present is updated in the caller side. This should have been updated only in update_eld(). So, the proper fix is to avoid accessing pin_eld but only spec->temp_eld. Signed-off-by: Takashi Iwai <tiwai@suse.de>
2016-04-13ALSA: hda - Fix regression of monitor_present flag in eld proc fileHyungwon Hwang1-0/+2
The commit [bd48128539ab: ALSA: hda - Fix forgotten HDMI monitor_present update] covered the missing update of monitor_present flag, but this caused a regression for devices without the i915 eld notifier. Since the old code supposed that pin_eld->monitor_present was updated by the caller side, the hdmi_present_sense_via_verbs() doesn't update the temporary eld->monitor_present but only pin_eld->monitor_present, which is now overridden in update_eld(). The fix is to update pin_eld->monitor_present as well before calling update_eld(). Note that this may still leave monitor_present flag in an inconsistent state when the driver repolls, but this is at least the old behavior. More proper fix will follow in the later patch. Fixes: bd48128539ab ('ALSA: hda - Fix forgotten HDMI monitor_present update') Signed-off-by: Hyungwon Hwang <hyungwon.hwang7@gmail.com> Cc: <stable@vger.kernel.org> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2016-04-04ALSA: hda - Update chmap tlv to report sink's capabilitySubhransu S. Prusty1-0/+13
The existing TLV callback implementation copies all of the cea_channel_speaker_allocation map table to the TLV container irrespective of what is reported by sink. This is of little use to the userspace application. With this patch, it parses the spk_alloc block as queried from the ELD, and copies only the corresponding mapping channel allocation entries from the cea channel speaker allocation table. Thus the user can parse the TLV container to identify sink's capability and set the channel map accordingly. It shouldn't impact the behavior in AMD chipset, as this makes use of already parsed spk alloc block to calculate the channel map. 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-28ALSA: hda - Enable i915 ELD notifier for Intel IronLake and BaytrailTakashi Iwai1-5/+17
Since we have the fixed pin-port mapping for Intel IronLake (IbexPeak) and Baytrail (ValleyView) platforms in the code side, now it's time to add the support in the codec driver side. This patch simply enables the i915 ELD notifier for these in addition with the fix of the mapping from the port to NID in the callback. Signed-off-by: Takashi Iwai <tiwai@suse.de>
2016-03-28ALSA: hda - Add the pin / port mapping on Intel ILK and VLVTakashi Iwai1-2/+2
Intel IronLake and ValleyView platforms have different HDMI widget pin and digital port mapping from other newer ones. The recent ones (HSW+) have NID 0x05 to 0x07 for port B to port D, while these chips have NID 0x04 to 0x06. For adapting this mapping, pass the codec object instead of the bus object to snd_hdac_sync_audio_rate() and snd_hdac_acomp_get_eld() so that they can check the codec ID and calculate the mapping properly. The changes in the HDMI codec driver side will follow in the later patch. Signed-off-by: Takashi Iwai <tiwai@suse.de>
2016-03-28ALSA: hda - Use eld notifier for Intel SandyBridge and IvyBridge HDMI/DPTakashi Iwai1-2/+39
Intel SandyBridge and IvyBridge (CougarPoint and PantherPoint platforms) have also the same digital port vs audio widget mapping (from port B = NID 0x05 to port D = NID 0x07) as Haswell & co. So, we can reuse the existing functions for HSW+ for these platforms without changing there, but just by re-adding the on-demand i915 binding in HDMI codec driver. Signed-off-by: Takashi Iwai <tiwai@suse.de>
2016-03-28ALSA: hda - Introduce pin_cvt_fixup() ops to hdmi parserTakashi Iwai1-32/+50
For reducing the splat of is_haswell_plus() or such macros, this patch introduces pin_cvt_fixup() ops to hdmi_spec. For HSW+ and VLV+ codecs, set this ops so that the driver can call the Intel-specific workarounds appropriately. A gratis bonus that we can remove the mux_id argument from hdmi_choose_cvt(), too, since the fixup function always refers the mux_idx from the given per_pin object. Signed-off-by: Takashi Iwai <tiwai@suse.de>
2016-03-28ALSA: hda - Override HDMI setup_stream ops for Intel HSW+Takashi Iwai1-3/+10
Instead of checking at each time with is_haswell_plus() macro, override the setup_stream ops itself for HSW+ chips. Signed-off-by: Takashi Iwai <tiwai@suse.de>
2016-03-28ALSA: hda - Apply AMP fix in hdmi_setup_audio_infoframe() genericallyTakashi Iwai1-1/+2
The need for reprogramming the AMP mute bit at each audio info frame setup isn't always specific to Intel chips. It's safer to set it generically for all codecs with the amp bit, as this verb execution itself isn't too much load. This eliminates one usage of is_haswell_plus() macro, after all. Signed-off-by: Takashi Iwai <tiwai@suse.de>
2016-03-28ALSA: hda - Split out Intel-specific codes from patch_generic_hdmi()Takashi Iwai1-79/+139
We have too many Intel-specific codes in patch_hdmi_generic() despite its function name. And this makes it difficult to adjust per chipset, e.g. for allowing the audio notifier on an old chipset, one would need to add an explicit if() check. This patch attempts some code refactoring and cleanups in this regard; the Intel-specific codes are moved out of patch_generic_hdmi() into the new functions, patch_i915_hsw_hdmi() and patch_i915_byt_hdmi(), depending on the chipset. The other old Intel chipsets keep using patch_generic_hdmi() without Intel hacks. The existing patch_generic_hdmi() is also split to a few components so that they can be called from the Intel codec parsers. There are still many is_haswell*() and is_valleyview*() macro usages in the code. They will be cleaned up later. For the time being, only the entry are concerned. Along with this change, the i915_bound flag and the on-demand i915 component binding have been removed as a cleanup, since there is no user at this moment. This will be added back later once when Cougar Point and else start using the i915 eld notifier. Signed-off-by: Takashi Iwai <tiwai@suse.de>
2016-03-21ALSA: hda - Fix missing ELD update at unpluggingTakashi Iwai1-2/+1
i915 get_eld ops may return an error when no encoder is connected, and currently we regard the error as fatal and skip the whole ELD handling. This ended up with the missing ELD update at unplugging. This patch fixes the issue by treating the error as the unplugged state, instead of skipping the rest. Reported-by: Libin Yang <libin.yang@linux.intel.com> Cc: <stable@vger.kernel.org> # v4.5 Signed-off-by: Takashi Iwai <tiwai@suse.de>
2016-03-20ALSA: hda - Workaround for unbalanced i915 power refcount by concurrent probeTakashi Iwai1-0/+6
The recent addition of on-demand i915 audio component binding in the codec driver seems leading to the unbalanced i915 power refcount, according to Intel CI tests. Typically, it gets a kernel WARNING like: WARNING: CPU: 3 PID: 173 at sound/hda/hdac_i915.c:91 snd_hdac_display_power+0xf1/0x110 [snd_hda_core]() Call Trace: [<ffffffff813fef15>] dump_stack+0x67/0x92 [<ffffffff81078a21>] warn_slowpath_common+0x81/0xc0 [<ffffffff81078b15>] warn_slowpath_null+0x15/0x20 [<ffffffffa00f77e1>] snd_hdac_display_power+0xf1/0x110 [snd_hda_core] [<ffffffffa015039d>] azx_intel_link_power+0xd/0x10 [snd_hda_intel] [<ffffffffa011e32a>] azx_link_power+0x1a/0x30 [snd_hda_codec] [<ffffffffa00f21f9>] snd_hdac_link_power+0x29/0x40 [snd_hda_core] [<ffffffffa01192a6>] hda_codec_runtime_suspend+0x76/0xa0 [snd_hda_codec] ..... The scenario is like below: - HD-audio driver and i915 driver are probed concurrently at the (almost) same time; HDA bus tries to bind with i915, but it fails because i915 initialization is still being processed. - Later on, HD-audio probes the HDMI codec, where it again tries to bind with i915. At this time, it succeeds. - At finishing the probe of HDA, it decreases the refcount as if it were already bound at the bus probe, since the component is bound now. This triggers a kernel WARNING due to the unbalance. As a workaround, in this patch, we just disable the on-demand i915 component binding in the codec driver. This essentially reverts back to the state of 4.4 kernel. We know that this is no real solution, but it's a minimalistic simple change that can be applied to 4.5.x kernel as stable. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=94566 Reported-by: Ville Syrjälä <ville.syrjala@linux.intel.com> Cc: <stable@vger.kernel.org> # v4.5 Signed-off-by: Takashi Iwai <tiwai@suse.de>
2016-03-18ALSA: hda - Fix spurious kernel WARNING on Baytrail HDMITakashi Iwai1-1/+2
snd_hdac_sync_audio_rate() call is mandatory only for HSW and later models, but we call the function unconditionally blindly assuming that the function doesn't do anything harmful. But since recently, the function checks the validity of the passed pin NID, and eventually spews the warning if an unexpected pin is passed. This is seen on old chips like Baytrail. The fix is to limit the call of this function again only for the chips with the proper binding. This can be identified by the same flag as the eld notifier. Reported-by: Ville Syrjälä <ville.syrjala@linux.intel.com> Tested-by: Ville Syrjälä <ville.syrjala@linux.intel.com> Cc: <stable@vger.kernel.org> # v4.5 Signed-off-by: Takashi Iwai <tiwai@suse.de>
2016-03-18ALSA: hda - Fix forgotten HDMI monitor_present updateTakashi Iwai1-0/+1
We forgot to copy monitor_present value when updating the ELD information. This won't change the ELD retrieval and the jack notification behavior, but appears only in the proc output. In that sense, it's no fatal error, but a bug is a bug is a bug. Cc: <stable@vger.kernel.org> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2016-03-18ALSA: hda - Really restrict i915 notifier to HSW+Takashi Iwai1-7/+17
The commit [b62232d429fa: ALSA: hda - Limit i915 HDMI binding only for HSW and later] tried to limit the usage of i915 audio notifier to the recent Intel models and switch to the old method on pre-Haswell models. However, it assumed that the i915 component binding hasn't been done on such models, and the assumption was wrong: namely, Baytrail had already the i915 component binding due to powerwell control. Thus, the workaround wasn't applied to Baytrail. For fixing this properly, this patch introduces a new flag indicating the usage of audio notifier and codec_has_acomp() refers to this flag instead of checking the existence of audio component. Reported-by: Ville Syrjälä <ville.syrjala@linux.intel.com> Cc: <stable@vger.kernel.org> # v4.5 Signed-off-by: Takashi Iwai <tiwai@suse.de>
2016-03-17ALSA: hda - Fix mutex deadlock at HDMI/DP hotplugTakashi Iwai1-2/+7
The recent change in HD-audio HDMI/DP codec driver for allowing the dynamic PCM binding introduced a new spec->pcm_mutex. One of the protected area by this mutex is hdmi_present_sense(). As reported by Intel CI tests, unfortunately, the new mutex causes a deadlock when the hotplug/unplug is triggered during the codec is in runtime suspend. The buggy code path is like the following: hdmi_unsol_event() -> ... -> hdmi_present_sense() ==> ** here taking pcm_mutex -> hdmi_present_sense_via_verbs() -> snd_hda_power_up_pm() -> ... (runtime resume calls) -> generic_hdmi_resume() -> hdmi_present_sense() ==> ** here taking pcm_mutex again! As we can see here, the problem is that the mutex is taken before snd_hda_power_up_pm() call that triggers the runtime resume. That is, the obvious solution is to move the power up/down call outside the mutex; it is exactly what this patch provides. The patch also clarifies why this bug wasn't caught beforehand. We used to have the i915 audio component for hotplug for all Intel chips, and in that code path, there is no power up required but the information is taken directly from the graphics side. However, we recently switched back to the old method for some old Intel chips due to regressions, and now the deadlock issue is surfaced. Fixes: a76056f2e57e ('ALSA: hda - hdmi dynamically bind PCM to pin when monitor hotplug') Reported-by: Ville Syrjälä <ville.syrjala@linux.intel.com> Tested-by: Ville Syrjälä <ville.syrjala@linux.intel.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2016-03-15ALSA: hda - Limit i915 HDMI binding only for HSW and laterTakashi Iwai1-2/+3
It turned out that the pre-HSW Intel chips are incompatible with the naive assumption we had -- the fixed mapping between the port and the HD-audio widget. This may result in the bad access, as captured by the recent patch to add a WARN_ON() for the port mapping check. As a quick workaround, disable the i915 audio component binding for all pre-Haswell models. Reported-by: Ville Syrjälä <ville.syrjala@linux.intel.com> Cc: <stable@vger.kernel.org> # v4.5 Signed-off-by: Takashi Iwai <tiwai@suse.de>
2016-03-14ALSA: hda - Fixes double fault in nvhdmi_chmap_cea_alloc_validate_get_typeSubhransu S. Prusty1-2/+6
nvhdmi_chmap_cea_alloc_validate_get_type calls itself recursively using chmap ops causing the double fault. Fixed by adding the default validate_get_type handling inside nvdia validate_get_type handler. Link: https://bugzilla.kernel.org/show_bug.cgi?id=114311 Fixes: 67b90cb ("ALSA: hda - Create common chmap object") Reported-by: Andreas Reis <andreas.reis@gmail.com> Signed-off-by: Subhransu S. Prusty <subhransu.s.prusty@intel.com> Tested-by: Andreas Reis <andreas.reis@gmail.com> Signed-off-by: Vinod Koul <vinod.koul@intel.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2016-03-14ALSA: hda - Add new GPU codec ID 0x10de0082 to snd-hdaAaron Plattner1-0/+1
Vendor ID 0x10de0082 is used by a yet-to-be-named GPU chip. This chip also has the 2-ch audio swapping bug, so patch_nvhdmi is appropriate here. Signed-off-by: Aaron Plattner <aplattner@nvidia.com> Cc: <stable@vger.kernel.org> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2016-03-14Merge branch 'for-linus' into for-nextTakashi Iwai1-0/+4
2016-03-10ALSA: hda - Don't handle ELD notify from invalid portTakashi Iwai1-0/+4
The current Intel HDMI codec driver supports only three fixed ports from port B to port D. However, i915 driver may assign a DP on other ports, e.g. port A, when no eDP is used. This incompatibility is caught later at pin_nid_to_pin_index() and results in a warning message like "HDMI: pin nid 4 not registered" at each time. This patch filters out such invalid events beforehand, so that the kernel won't be too grumbling. Reported-by: Stefan Assmann <sassmann@kpanic.de> 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. Prusty1-7/+7
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. Prusty1-688/+1
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>