diff -Nru oem-audio-hda-daily-lts-xenial-dkms-0.201807310409~ubuntu14.04.1/debian/bzr-builder.manifest oem-audio-hda-daily-lts-xenial-dkms-0.201808040346~ubuntu14.04.1/debian/bzr-builder.manifest --- oem-audio-hda-daily-lts-xenial-dkms-0.201807310409~ubuntu14.04.1/debian/bzr-builder.manifest 2018-07-31 04:09:30.000000000 +0000 +++ oem-audio-hda-daily-lts-xenial-dkms-0.201808040346~ubuntu14.04.1/debian/bzr-builder.manifest 2018-08-04 03:46:29.000000000 +0000 @@ -1,6 +1,6 @@ -# bzr-builder format 0.3 deb-version 0.201807310409 +# bzr-builder format 0.3 deb-version 0.201808040346 lp:~ubuntu-audio-dev/alsa-driver/dkms-packaging-lts-x revid:luke.yelavich@canonical.com-20160502232130-i1lq1h350ktf9yj8 -nest base-pack lp:~ubuntu-audio-dev/alsa-driver/dkms-packaging dkms-packaging-base revid:hui.wang@canonical.com-20180731035700-zbd17thjqn2k3x1j -nest-part upstream_pci_hda lp:~hui.wang/alsa-driver/tiwai-trunk-fgit pci/hda hda-src-from-tree revid:git-v1:baf13208df10376d9e4588ad3524aeb3c9973bdf -nest-part upstream_hda_core lp:~hui.wang/alsa-driver/tiwai-trunk-fgit hda hda-src-from-tree/hdacore revid:git-v1:baf13208df10376d9e4588ad3524aeb3c9973bdf -nest-part upstream_include lp:~hui.wang/alsa-driver/tiwai-trunk-fgit include include-src-from-tree revid:git-v1:baf13208df10376d9e4588ad3524aeb3c9973bdf +nest base-pack lp:~ubuntu-audio-dev/alsa-driver/dkms-packaging dkms-packaging-base revid:hui.wang@canonical.com-20180804033838-zi0cknykxxufj5we +nest-part upstream_pci_hda lp:~hui.wang/alsa-driver/tiwai-trunk-ffgit pci/hda hda-src-from-tree revid:git-v1:948206c2f13996acbb5beac73504d9148914438e +nest-part upstream_hda_core lp:~hui.wang/alsa-driver/tiwai-trunk-ffgit hda hda-src-from-tree/hdacore revid:git-v1:948206c2f13996acbb5beac73504d9148914438e +nest-part upstream_include lp:~hui.wang/alsa-driver/tiwai-trunk-ffgit include include-src-from-tree revid:git-v1:948206c2f13996acbb5beac73504d9148914438e diff -Nru oem-audio-hda-daily-lts-xenial-dkms-0.201807310409~ubuntu14.04.1/debian/changelog oem-audio-hda-daily-lts-xenial-dkms-0.201808040346~ubuntu14.04.1/debian/changelog --- oem-audio-hda-daily-lts-xenial-dkms-0.201807310409~ubuntu14.04.1/debian/changelog 2018-07-31 04:09:30.000000000 +0000 +++ oem-audio-hda-daily-lts-xenial-dkms-0.201808040346~ubuntu14.04.1/debian/changelog 2018-08-04 03:46:29.000000000 +0000 @@ -1,8 +1,8 @@ -oem-audio-hda-daily-lts-xenial-dkms (0.201807310409~ubuntu14.04.1) trusty; urgency=low +oem-audio-hda-daily-lts-xenial-dkms (0.201808040346~ubuntu14.04.1) trusty; urgency=low * Auto build. - -- Launchpad Package Builder Tue, 31 Jul 2018 04:09:30 +0000 + -- Launchpad Package Builder Sat, 04 Aug 2018 03:46:29 +0000 oem-audio-hda-daily-lts-xenial-dkms (0.1) trusty; urgency=low diff -Nru oem-audio-hda-daily-lts-xenial-dkms-0.201807310409~ubuntu14.04.1/dkms-packaging-base/patches-artful/drm_audio_component.patch oem-audio-hda-daily-lts-xenial-dkms-0.201808040346~ubuntu14.04.1/dkms-packaging-base/patches-artful/drm_audio_component.patch --- oem-audio-hda-daily-lts-xenial-dkms-0.201807310409~ubuntu14.04.1/dkms-packaging-base/patches-artful/drm_audio_component.patch 1970-01-01 00:00:00.000000000 +0000 +++ oem-audio-hda-daily-lts-xenial-dkms-0.201808040346~ubuntu14.04.1/dkms-packaging-base/patches-artful/drm_audio_component.patch 2018-08-04 03:46:26.000000000 +0000 @@ -0,0 +1,265 @@ +Index: oem-audio-hda-daily-0.1/hdacore/hdac_component.c +=================================================================== +--- oem-audio-hda-daily-0.1.orig/hdacore/hdac_component.c ++++ oem-audio-hda-daily-0.1/hdacore/hdac_component.c +@@ -14,7 +14,7 @@ static void hdac_acomp_release(struct de + { + } + +-static struct drm_audio_component *hdac_get_acomp(struct device *dev) ++static struct i915_audio_component *hdac_get_acomp(struct device *dev) + { + return devres_find(dev, hdac_acomp_release, NULL, NULL); + } +@@ -34,7 +34,7 @@ static struct drm_audio_component *hdac_ + */ + int snd_hdac_set_codec_wakeup(struct hdac_bus *bus, bool enable) + { +- struct drm_audio_component *acomp = bus->audio_component; ++ struct i915_audio_component *acomp = bus->audio_component; + + if (!acomp || !acomp->ops) + return -ENODEV; +@@ -66,7 +66,7 @@ EXPORT_SYMBOL_GPL(snd_hdac_set_codec_wak + */ + int snd_hdac_display_power(struct hdac_bus *bus, bool enable) + { +- struct drm_audio_component *acomp = bus->audio_component; ++ struct i915_audio_component *acomp = bus->audio_component; + + if (!acomp || !acomp->ops) + return -ENODEV; +@@ -75,15 +75,15 @@ int snd_hdac_display_power(struct hdac_b + enable ? "enable" : "disable"); + + if (enable) { +- if (!bus->drm_power_refcount++) { ++ if (!bus->i915_power_refcount++) { + if (acomp->ops->get_power) + acomp->ops->get_power(acomp->dev); + snd_hdac_set_codec_wakeup(bus, true); + snd_hdac_set_codec_wakeup(bus, false); + } + } else { +- WARN_ON(!bus->drm_power_refcount); +- if (!--bus->drm_power_refcount) ++ WARN_ON(!bus->i915_power_refcount); ++ if (!--bus->i915_power_refcount) + if (acomp->ops->put_power) + acomp->ops->put_power(acomp->dev); + } +@@ -109,7 +109,7 @@ int snd_hdac_sync_audio_rate(struct hdac + int dev_id, int rate) + { + struct hdac_bus *bus = codec->bus; +- struct drm_audio_component *acomp = bus->audio_component; ++ struct i915_audio_component *acomp = bus->audio_component; + int port, pipe; + + if (!acomp || !acomp->ops || !acomp->ops->sync_audio_rate) +@@ -150,7 +150,7 @@ int snd_hdac_acomp_get_eld(struct hdac_d + bool *audio_enabled, char *buffer, int max_bytes) + { + struct hdac_bus *bus = codec->bus; +- struct drm_audio_component *acomp = bus->audio_component; ++ struct i915_audio_component *acomp = bus->audio_component; + int port, pipe; + + if (!acomp || !acomp->ops || !acomp->ops->get_eld) +@@ -170,7 +170,7 @@ EXPORT_SYMBOL_GPL(snd_hdac_acomp_get_eld + + static int hdac_component_master_bind(struct device *dev) + { +- struct drm_audio_component *acomp = hdac_get_acomp(dev); ++ struct i915_audio_component *acomp = hdac_get_acomp(dev); + int ret; + + if (WARN_ON(!acomp)) +@@ -209,7 +209,7 @@ out_unbind: + + static void hdac_component_master_unbind(struct device *dev) + { +- struct drm_audio_component *acomp = hdac_get_acomp(dev); ++ struct i915_audio_component *acomp = hdac_get_acomp(dev); + + if (acomp->audio_ops && acomp->audio_ops->master_unbind) + acomp->audio_ops->master_unbind(dev, acomp); +@@ -236,7 +236,7 @@ static const struct component_master_ops + * Returns zero for success or a negative error code. + */ + int snd_hdac_acomp_register_notifier(struct hdac_bus *bus, +- const struct drm_audio_component_audio_ops *aops) ++ const struct i915_audio_component_audio_ops *aops) + { + if (!bus->audio_component) + return -ENODEV; +@@ -265,13 +265,13 @@ EXPORT_SYMBOL_GPL(snd_hdac_acomp_registe + * Returns zero for success or a negative error code. + */ + int snd_hdac_acomp_init(struct hdac_bus *bus, +- const struct drm_audio_component_audio_ops *aops, ++ const struct i915_audio_component_audio_ops *aops, + int (*match_master)(struct device *, void *), + size_t extra_size) + { + struct component_match *match = NULL; + struct device *dev = bus->dev; +- struct drm_audio_component *acomp; ++ struct i915_audio_component *acomp; + int ret; + + if (WARN_ON(hdac_get_acomp(dev))) +@@ -316,13 +316,13 @@ EXPORT_SYMBOL_GPL(snd_hdac_acomp_init); + int snd_hdac_acomp_exit(struct hdac_bus *bus) + { + struct device *dev = bus->dev; +- struct drm_audio_component *acomp = bus->audio_component; ++ struct i915_audio_component *acomp = bus->audio_component; + + if (!acomp) + return 0; + +- WARN_ON(bus->drm_power_refcount); +- if (bus->drm_power_refcount > 0 && acomp->ops) ++ WARN_ON(bus->i915_power_refcount); ++ if (bus->i915_power_refcount > 0 && acomp->ops) + acomp->ops->put_power(acomp->dev); + + component_master_del(dev, &hdac_component_master_ops); +Index: oem-audio-hda-daily-0.1/hdacore/hdac_i915.c +=================================================================== +--- oem-audio-hda-daily-0.1.orig/hdacore/hdac_i915.c ++++ oem-audio-hda-daily-0.1/hdacore/hdac_i915.c +@@ -43,7 +43,7 @@ static struct completion bind_complete; + */ + void snd_hdac_i915_set_bclk(struct hdac_bus *bus) + { +- struct drm_audio_component *acomp = bus->audio_component; ++ struct i915_audio_component *acomp = bus->audio_component; + struct pci_dev *pci = to_pci_dev(bus->dev); + int cdclk_freq; + unsigned int bclk_m, bclk_n; +@@ -100,7 +100,7 @@ static bool i915_gfx_present(void) + } + + static int i915_master_bind(struct device *dev, +- struct drm_audio_component *acomp) ++ struct i915_audio_component *acomp) + { + complete_all(&bind_complete); + /* clear audio_ops here as it was needed only for completion call */ +@@ -108,8 +108,8 @@ static int i915_master_bind(struct devic + return 0; + } + +-static const struct drm_audio_component_audio_ops i915_init_ops = { +- .master_bind = i915_master_bind ++static const struct i915_audio_component_audio_ops i915_init_ops = { ++ /* .master_bind = i915_master_bind */ + }; + + /** +@@ -126,7 +126,7 @@ static const struct drm_audio_component_ + */ + int snd_hdac_i915_init(struct hdac_bus *bus) + { +- struct drm_audio_component *acomp; ++ struct i915_audio_component *acomp; + int err; + + if (!i915_gfx_present()) +Index: oem-audio-hda-daily-0.1/include/hda_component.h +=================================================================== +--- oem-audio-hda-daily-0.1.orig/include/hda_component.h ++++ oem-audio-hda-daily-0.1/include/hda_component.h +@@ -4,7 +4,7 @@ + #ifndef __SOUND_HDA_COMPONENT_H + #define __SOUND_HDA_COMPONENT_H + +-#include ++#include + + #ifdef CONFIG_SND_HDA_COMPONENT + int snd_hdac_set_codec_wakeup(struct hdac_bus *bus, bool enable); +@@ -14,12 +14,12 @@ int snd_hdac_sync_audio_rate(struct hdac + int snd_hdac_acomp_get_eld(struct hdac_device *codec, hda_nid_t nid, int dev_id, + bool *audio_enabled, char *buffer, int max_bytes); + int snd_hdac_acomp_init(struct hdac_bus *bus, +- const struct drm_audio_component_audio_ops *aops, ++ const struct i915_audio_component_audio_ops *aops, + int (*match_master)(struct device *, void *), + size_t extra_size); + int snd_hdac_acomp_exit(struct hdac_bus *bus); + int snd_hdac_acomp_register_notifier(struct hdac_bus *bus, +- const struct drm_audio_component_audio_ops *ops); ++ const struct i915_audio_component_audio_ops *ops); + #else + static inline int snd_hdac_set_codec_wakeup(struct hdac_bus *bus, bool enable) + { +@@ -41,7 +41,7 @@ static inline int snd_hdac_acomp_get_eld + return -ENODEV; + } + static inline int snd_hdac_acomp_init(struct hdac_bus *bus, +- const struct drm_audio_component_audio_ops *aops, ++ const struct i915_audio_component_audio_ops *aops, + int (*match_master)(struct device *, void *), + size_t extra_size) + { +@@ -52,7 +52,7 @@ static inline int snd_hdac_acomp_exit(st + return 0; + } + static inline int snd_hdac_acomp_register_notifier(struct hdac_bus *bus, +- const struct drm_audio_component_audio_ops *ops) ++ const struct i915_audio_component_audio_ops *ops) + { + return -ENODEV; + } +Index: oem-audio-hda-daily-0.1/include/hdaudio.h +=================================================================== +--- oem-audio-hda-daily-0.1.orig/include/hdaudio.h ++++ oem-audio-hda-daily-0.1/include/hdaudio.h +@@ -362,8 +362,8 @@ struct hdac_bus { + struct mutex cmd_mutex; + + /* DRM component interface */ +- struct drm_audio_component *audio_component; +- int drm_power_refcount; ++ struct i915_audio_component *audio_component; ++ int i915_power_refcount; + + /* parameters required for enhanced capabilities */ + int num_streams; +Index: oem-audio-hda-daily-0.1/patch_hdmi.c +=================================================================== +--- oem-audio-hda-daily-0.1.orig/patch_hdmi.c ++++ oem-audio-hda-daily-0.1/patch_hdmi.c +@@ -177,7 +177,7 @@ struct hdmi_spec { + + /* i915/powerwell (Haswell+/Valleyview+) specific */ + bool use_acomp_notifier; /* use i915 eld_notify callback for hotplug */ +- struct drm_audio_component_audio_ops drm_audio_ops; ++ struct i915_audio_component_audio_ops i915_audio_ops; + + struct hdac_chmap chmap; + hda_nid_t vendor_nid; +@@ -2533,16 +2533,16 @@ static void register_i915_notifier(struc + struct hdmi_spec *spec = codec->spec; + + spec->use_acomp_notifier = true; +- spec->drm_audio_ops.audio_ptr = codec; ++ spec->i915_audio_ops.audio_ptr = codec; + /* intel_audio_codec_enable() or intel_audio_codec_disable() + * will call pin_eld_notify with using audio_ptr pointer + * We need make sure audio_ptr is really setup + */ + wmb(); +- spec->drm_audio_ops.pin2port = intel_pin2port; +- spec->drm_audio_ops.pin_eld_notify = intel_pin_eld_notify; ++ /* spec->i915_audio_ops.pin2port = intel_pin2port; */ ++ spec->i915_audio_ops.pin_eld_notify = intel_pin_eld_notify; + snd_hdac_acomp_register_notifier(&codec->bus->core, +- &spec->drm_audio_ops); ++ &spec->i915_audio_ops); + } + + /* setup_stream ops override for HSW+ */ diff -Nru oem-audio-hda-daily-lts-xenial-dkms-0.201807310409~ubuntu14.04.1/dkms-packaging-base/patches-artful/remove_hdacore_ext.patch oem-audio-hda-daily-lts-xenial-dkms-0.201808040346~ubuntu14.04.1/dkms-packaging-base/patches-artful/remove_hdacore_ext.patch --- oem-audio-hda-daily-lts-xenial-dkms-0.201807310409~ubuntu14.04.1/dkms-packaging-base/patches-artful/remove_hdacore_ext.patch 1970-01-01 00:00:00.000000000 +0000 +++ oem-audio-hda-daily-lts-xenial-dkms-0.201808040346~ubuntu14.04.1/dkms-packaging-base/patches-artful/remove_hdacore_ext.patch 2018-08-04 03:46:26.000000000 +0000 @@ -0,0 +1,10 @@ +Index: oem-audio-hda-daily-0.1/hdacore/Makefile +=================================================================== +--- oem-audio-hda-daily-0.1.orig/hdacore/Makefile ++++ oem-audio-hda-daily-0.1/hdacore/Makefile +@@ -12,4 +12,4 @@ snd-hda-core-$(CONFIG_SND_HDA_I915) += h + obj-$(CONFIG_SND_HDA_CORE) += snd-hda-core.o + + #extended hda +-obj-$(CONFIG_SND_HDA_EXT_CORE) += ext/ ++#obj-$(CONFIG_SND_HDA_EXT_CORE) += ext/ diff -Nru oem-audio-hda-daily-lts-xenial-dkms-0.201807310409~ubuntu14.04.1/dkms-packaging-base/patches-artful/series oem-audio-hda-daily-lts-xenial-dkms-0.201808040346~ubuntu14.04.1/dkms-packaging-base/patches-artful/series --- oem-audio-hda-daily-lts-xenial-dkms-0.201807310409~ubuntu14.04.1/dkms-packaging-base/patches-artful/series 2018-07-31 04:09:17.000000000 +0000 +++ oem-audio-hda-daily-lts-xenial-dkms-0.201808040346~ubuntu14.04.1/dkms-packaging-base/patches-artful/series 2018-08-04 03:46:26.000000000 +0000 @@ -4,3 +4,6 @@ include_dir.patch add_PCI_CLASS_MULTIMEDIA_HD_AUDIO.patch fix_nospec_header.patch +drm_audio_component.patch +vga_switchroo.patch +remove_hdacore_ext.patch diff -Nru oem-audio-hda-daily-lts-xenial-dkms-0.201807310409~ubuntu14.04.1/dkms-packaging-base/patches-artful/vga_switchroo.patch oem-audio-hda-daily-lts-xenial-dkms-0.201808040346~ubuntu14.04.1/dkms-packaging-base/patches-artful/vga_switchroo.patch --- oem-audio-hda-daily-lts-xenial-dkms-0.201807310409~ubuntu14.04.1/dkms-packaging-base/patches-artful/vga_switchroo.patch 1970-01-01 00:00:00.000000000 +0000 +++ oem-audio-hda-daily-lts-xenial-dkms-0.201808040346~ubuntu14.04.1/dkms-packaging-base/patches-artful/vga_switchroo.patch 2018-08-04 03:46:26.000000000 +0000 @@ -0,0 +1,13 @@ +Index: oem-audio-hda-daily-0.1/hda_intel.c +=================================================================== +--- oem-audio-hda-daily-0.1.orig/hda_intel.c ++++ oem-audio-hda-daily-0.1/hda_intel.c +@@ -1328,7 +1328,7 @@ static int register_vga_switcheroo(struc + return 0; + + p = get_bound_vga(chip->pci); +- err = vga_switcheroo_register_audio_client(chip->pci, &azx_vs_ops, p); ++ err = vga_switcheroo_register_audio_client(chip->pci, &azx_vs_ops, VGA_SWITCHEROO_DIS); + pci_dev_put(p); + + if (err < 0) diff -Nru oem-audio-hda-daily-lts-xenial-dkms-0.201807310409~ubuntu14.04.1/dkms-packaging-base/patches-xenial/call_i915_bpo_for_xenial.patch oem-audio-hda-daily-lts-xenial-dkms-0.201808040346~ubuntu14.04.1/dkms-packaging-base/patches-xenial/call_i915_bpo_for_xenial.patch --- oem-audio-hda-daily-lts-xenial-dkms-0.201807310409~ubuntu14.04.1/dkms-packaging-base/patches-xenial/call_i915_bpo_for_xenial.patch 2018-07-31 04:09:17.000000000 +0000 +++ oem-audio-hda-daily-lts-xenial-dkms-0.201808040346~ubuntu14.04.1/dkms-packaging-base/patches-xenial/call_i915_bpo_for_xenial.patch 2018-08-04 03:46:26.000000000 +0000 @@ -2,7 +2,7 @@ =================================================================== --- oem-audio-hda-daily-0.1.orig/hda_intel.c +++ oem-audio-hda-daily-0.1/hda_intel.c -@@ -2207,6 +2207,10 @@ static int azx_probe_continue(struct azx +@@ -2253,6 +2253,10 @@ static int azx_probe_continue(struct azx /* bind with i915 if needed */ if (chip->driver_caps & AZX_DCAPS_I915_COMPONENT) { @@ -17,9 +17,9 @@ =================================================================== --- oem-audio-hda-daily-0.1.orig/hdacore/hdac_i915.c +++ oem-audio-hda-daily-0.1/hdacore/hdac_i915.c -@@ -312,6 +312,11 @@ static int hdac_component_master_match(s - return !strcmp(dev->driver->name, "i915"); - } +@@ -112,6 +112,11 @@ static const struct drm_audio_component_ + .master_bind = i915_master_bind + }; +static int hdac_component_master_match_bpo(struct device *dev, void *data) +{ @@ -27,24 +27,13 @@ +} + /** - * snd_hdac_i915_register_notifier - Register i915 audio component ops - * @aops: i915 audio component ops -@@ -395,9 +400,9 @@ int snd_hdac_i915_init(struct hdac_bus * - dev_dbg(dev, "bound to i915 component master\n"); - + * snd_hdac_i915_init - Initialize i915 audio component + * @bus: HDA core bus +@@ -154,3 +159,46 @@ int snd_hdac_i915_init(struct hdac_bus * return 0; --out_master_del: -+ out_master_del: - component_master_del(dev, &hdac_component_master_ops); --out_err: -+ out_err: - kfree(acomp); - bus->audio_component = NULL; - hdac_acomp = NULL; -@@ -407,6 +412,51 @@ out_err: } EXPORT_SYMBOL_GPL(snd_hdac_i915_init); - ++ +int snd_hdac_i915_init_bpo(struct hdac_bus *bus) +{ + struct component_match *match = NULL; @@ -77,9 +66,9 @@ + dev_dbg(dev, "bound to i915_bpo component master\n"); + + return 0; -+ out_master_del: ++out_master_del: + component_master_del(dev, &hdac_component_master_ops); -+ out_err: ++out_err: + kfree(acomp); + bus->audio_component = NULL; + dev_err(dev, "failed to add i915_bpo component master (%d)\n", ret); @@ -87,25 +76,19 @@ + return ret; +} +EXPORT_SYMBOL_GPL(snd_hdac_i915_init_bpo); -+ -+ -+ - /** - * snd_hdac_i915_exit - Finalize i915 audio component - * @bus: HDA core bus Index: oem-audio-hda-daily-0.1/include/hda_i915.h =================================================================== --- oem-audio-hda-daily-0.1.orig/include/hda_i915.h +++ oem-audio-hda-daily-0.1/include/hda_i915.h -@@ -15,6 +15,7 @@ int snd_hdac_sync_audio_rate(struct hdac - int snd_hdac_acomp_get_eld(struct hdac_device *codec, hda_nid_t nid, int dev_id, - bool *audio_enabled, char *buffer, int max_bytes); +@@ -10,6 +10,7 @@ + #ifdef CONFIG_SND_HDA_I915 + void snd_hdac_i915_set_bclk(struct hdac_bus *bus); int snd_hdac_i915_init(struct hdac_bus *bus); +int snd_hdac_i915_init_bpo(struct hdac_bus *bus); - int snd_hdac_i915_exit(struct hdac_bus *bus); - int snd_hdac_i915_register_notifier(const struct i915_audio_component_audio_ops *); #else -@@ -44,6 +45,10 @@ static inline int snd_hdac_i915_init(str + static inline void snd_hdac_i915_set_bclk(struct hdac_bus *bus) + { +@@ -18,6 +19,10 @@ static inline int snd_hdac_i915_init(str { return -ENODEV; } @@ -113,6 +96,6 @@ +{ + return -ENODEV; +} + #endif static inline int snd_hdac_i915_exit(struct hdac_bus *bus) { - return 0; diff -Nru oem-audio-hda-daily-lts-xenial-dkms-0.201807310409~ubuntu14.04.1/dkms-packaging-base/patches-xenial/drm_audio_component.patch oem-audio-hda-daily-lts-xenial-dkms-0.201808040346~ubuntu14.04.1/dkms-packaging-base/patches-xenial/drm_audio_component.patch --- oem-audio-hda-daily-lts-xenial-dkms-0.201807310409~ubuntu14.04.1/dkms-packaging-base/patches-xenial/drm_audio_component.patch 1970-01-01 00:00:00.000000000 +0000 +++ oem-audio-hda-daily-lts-xenial-dkms-0.201808040346~ubuntu14.04.1/dkms-packaging-base/patches-xenial/drm_audio_component.patch 2018-08-04 03:46:26.000000000 +0000 @@ -0,0 +1,265 @@ +Index: oem-audio-hda-daily-0.1/hdacore/hdac_component.c +=================================================================== +--- oem-audio-hda-daily-0.1.orig/hdacore/hdac_component.c ++++ oem-audio-hda-daily-0.1/hdacore/hdac_component.c +@@ -14,7 +14,7 @@ static void hdac_acomp_release(struct de + { + } + +-static struct drm_audio_component *hdac_get_acomp(struct device *dev) ++static struct i915_audio_component *hdac_get_acomp(struct device *dev) + { + return devres_find(dev, hdac_acomp_release, NULL, NULL); + } +@@ -34,7 +34,7 @@ static struct drm_audio_component *hdac_ + */ + int snd_hdac_set_codec_wakeup(struct hdac_bus *bus, bool enable) + { +- struct drm_audio_component *acomp = bus->audio_component; ++ struct i915_audio_component *acomp = bus->audio_component; + + if (!acomp || !acomp->ops) + return -ENODEV; +@@ -66,7 +66,7 @@ EXPORT_SYMBOL_GPL(snd_hdac_set_codec_wak + */ + int snd_hdac_display_power(struct hdac_bus *bus, bool enable) + { +- struct drm_audio_component *acomp = bus->audio_component; ++ struct i915_audio_component *acomp = bus->audio_component; + + if (!acomp || !acomp->ops) + return -ENODEV; +@@ -75,15 +75,15 @@ int snd_hdac_display_power(struct hdac_b + enable ? "enable" : "disable"); + + if (enable) { +- if (!bus->drm_power_refcount++) { ++ if (!bus->i915_power_refcount++) { + if (acomp->ops->get_power) + acomp->ops->get_power(acomp->dev); + snd_hdac_set_codec_wakeup(bus, true); + snd_hdac_set_codec_wakeup(bus, false); + } + } else { +- WARN_ON(!bus->drm_power_refcount); +- if (!--bus->drm_power_refcount) ++ WARN_ON(!bus->i915_power_refcount); ++ if (!--bus->i915_power_refcount) + if (acomp->ops->put_power) + acomp->ops->put_power(acomp->dev); + } +@@ -109,7 +109,7 @@ int snd_hdac_sync_audio_rate(struct hdac + int dev_id, int rate) + { + struct hdac_bus *bus = codec->bus; +- struct drm_audio_component *acomp = bus->audio_component; ++ struct i915_audio_component *acomp = bus->audio_component; + int port, pipe; + + if (!acomp || !acomp->ops || !acomp->ops->sync_audio_rate) +@@ -150,7 +150,7 @@ int snd_hdac_acomp_get_eld(struct hdac_d + bool *audio_enabled, char *buffer, int max_bytes) + { + struct hdac_bus *bus = codec->bus; +- struct drm_audio_component *acomp = bus->audio_component; ++ struct i915_audio_component *acomp = bus->audio_component; + int port, pipe; + + if (!acomp || !acomp->ops || !acomp->ops->get_eld) +@@ -170,7 +170,7 @@ EXPORT_SYMBOL_GPL(snd_hdac_acomp_get_eld + + static int hdac_component_master_bind(struct device *dev) + { +- struct drm_audio_component *acomp = hdac_get_acomp(dev); ++ struct i915_audio_component *acomp = hdac_get_acomp(dev); + int ret; + + if (WARN_ON(!acomp)) +@@ -209,7 +209,7 @@ out_unbind: + + static void hdac_component_master_unbind(struct device *dev) + { +- struct drm_audio_component *acomp = hdac_get_acomp(dev); ++ struct i915_audio_component *acomp = hdac_get_acomp(dev); + + if (acomp->audio_ops && acomp->audio_ops->master_unbind) + acomp->audio_ops->master_unbind(dev, acomp); +@@ -236,7 +236,7 @@ static const struct component_master_ops + * Returns zero for success or a negative error code. + */ + int snd_hdac_acomp_register_notifier(struct hdac_bus *bus, +- const struct drm_audio_component_audio_ops *aops) ++ const struct i915_audio_component_audio_ops *aops) + { + if (!bus->audio_component) + return -ENODEV; +@@ -265,13 +265,13 @@ EXPORT_SYMBOL_GPL(snd_hdac_acomp_registe + * Returns zero for success or a negative error code. + */ + int snd_hdac_acomp_init(struct hdac_bus *bus, +- const struct drm_audio_component_audio_ops *aops, ++ const struct i915_audio_component_audio_ops *aops, + int (*match_master)(struct device *, void *), + size_t extra_size) + { + struct component_match *match = NULL; + struct device *dev = bus->dev; +- struct drm_audio_component *acomp; ++ struct i915_audio_component *acomp; + int ret; + + if (WARN_ON(hdac_get_acomp(dev))) +@@ -316,13 +316,13 @@ EXPORT_SYMBOL_GPL(snd_hdac_acomp_init); + int snd_hdac_acomp_exit(struct hdac_bus *bus) + { + struct device *dev = bus->dev; +- struct drm_audio_component *acomp = bus->audio_component; ++ struct i915_audio_component *acomp = bus->audio_component; + + if (!acomp) + return 0; + +- WARN_ON(bus->drm_power_refcount); +- if (bus->drm_power_refcount > 0 && acomp->ops) ++ WARN_ON(bus->i915_power_refcount); ++ if (bus->i915_power_refcount > 0 && acomp->ops) + acomp->ops->put_power(acomp->dev); + + component_master_del(dev, &hdac_component_master_ops); +Index: oem-audio-hda-daily-0.1/hdacore/hdac_i915.c +=================================================================== +--- oem-audio-hda-daily-0.1.orig/hdacore/hdac_i915.c ++++ oem-audio-hda-daily-0.1/hdacore/hdac_i915.c +@@ -43,7 +43,7 @@ static struct completion bind_complete; + */ + void snd_hdac_i915_set_bclk(struct hdac_bus *bus) + { +- struct drm_audio_component *acomp = bus->audio_component; ++ struct i915_audio_component *acomp = bus->audio_component; + struct pci_dev *pci = to_pci_dev(bus->dev); + int cdclk_freq; + unsigned int bclk_m, bclk_n; +@@ -100,7 +100,7 @@ static bool i915_gfx_present(void) + } + + static int i915_master_bind(struct device *dev, +- struct drm_audio_component *acomp) ++ struct i915_audio_component *acomp) + { + complete_all(&bind_complete); + /* clear audio_ops here as it was needed only for completion call */ +@@ -108,8 +108,8 @@ static int i915_master_bind(struct devic + return 0; + } + +-static const struct drm_audio_component_audio_ops i915_init_ops = { +- .master_bind = i915_master_bind ++static const struct i915_audio_component_audio_ops i915_init_ops = { ++ /* .master_bind = i915_master_bind */ + }; + + /** +@@ -126,7 +126,7 @@ static const struct drm_audio_component_ + */ + int snd_hdac_i915_init(struct hdac_bus *bus) + { +- struct drm_audio_component *acomp; ++ struct i915_audio_component *acomp; + int err; + + if (!i915_gfx_present()) +Index: oem-audio-hda-daily-0.1/include/hda_component.h +=================================================================== +--- oem-audio-hda-daily-0.1.orig/include/hda_component.h ++++ oem-audio-hda-daily-0.1/include/hda_component.h +@@ -4,7 +4,7 @@ + #ifndef __SOUND_HDA_COMPONENT_H + #define __SOUND_HDA_COMPONENT_H + +-#include ++#include + + #ifdef CONFIG_SND_HDA_COMPONENT + int snd_hdac_set_codec_wakeup(struct hdac_bus *bus, bool enable); +@@ -14,12 +14,12 @@ int snd_hdac_sync_audio_rate(struct hdac + int snd_hdac_acomp_get_eld(struct hdac_device *codec, hda_nid_t nid, int dev_id, + bool *audio_enabled, char *buffer, int max_bytes); + int snd_hdac_acomp_init(struct hdac_bus *bus, +- const struct drm_audio_component_audio_ops *aops, ++ const struct i915_audio_component_audio_ops *aops, + int (*match_master)(struct device *, void *), + size_t extra_size); + int snd_hdac_acomp_exit(struct hdac_bus *bus); + int snd_hdac_acomp_register_notifier(struct hdac_bus *bus, +- const struct drm_audio_component_audio_ops *ops); ++ const struct i915_audio_component_audio_ops *ops); + #else + static inline int snd_hdac_set_codec_wakeup(struct hdac_bus *bus, bool enable) + { +@@ -41,7 +41,7 @@ static inline int snd_hdac_acomp_get_eld + return -ENODEV; + } + static inline int snd_hdac_acomp_init(struct hdac_bus *bus, +- const struct drm_audio_component_audio_ops *aops, ++ const struct i915_audio_component_audio_ops *aops, + int (*match_master)(struct device *, void *), + size_t extra_size) + { +@@ -52,7 +52,7 @@ static inline int snd_hdac_acomp_exit(st + return 0; + } + static inline int snd_hdac_acomp_register_notifier(struct hdac_bus *bus, +- const struct drm_audio_component_audio_ops *ops) ++ const struct i915_audio_component_audio_ops *ops) + { + return -ENODEV; + } +Index: oem-audio-hda-daily-0.1/include/hdaudio.h +=================================================================== +--- oem-audio-hda-daily-0.1.orig/include/hdaudio.h ++++ oem-audio-hda-daily-0.1/include/hdaudio.h +@@ -362,8 +362,8 @@ struct hdac_bus { + struct mutex cmd_mutex; + + /* DRM component interface */ +- struct drm_audio_component *audio_component; +- int drm_power_refcount; ++ struct i915_audio_component *audio_component; ++ int i915_power_refcount; + + /* parameters required for enhanced capabilities */ + int num_streams; +Index: oem-audio-hda-daily-0.1/patch_hdmi.c +=================================================================== +--- oem-audio-hda-daily-0.1.orig/patch_hdmi.c ++++ oem-audio-hda-daily-0.1/patch_hdmi.c +@@ -177,7 +177,7 @@ struct hdmi_spec { + + /* i915/powerwell (Haswell+/Valleyview+) specific */ + bool use_acomp_notifier; /* use i915 eld_notify callback for hotplug */ +- struct drm_audio_component_audio_ops drm_audio_ops; ++ struct i915_audio_component_audio_ops i915_audio_ops; + + struct hdac_chmap chmap; + hda_nid_t vendor_nid; +@@ -2533,16 +2533,16 @@ static void register_i915_notifier(struc + struct hdmi_spec *spec = codec->spec; + + spec->use_acomp_notifier = true; +- spec->drm_audio_ops.audio_ptr = codec; ++ spec->i915_audio_ops.audio_ptr = codec; + /* intel_audio_codec_enable() or intel_audio_codec_disable() + * will call pin_eld_notify with using audio_ptr pointer + * We need make sure audio_ptr is really setup + */ + wmb(); +- spec->drm_audio_ops.pin2port = intel_pin2port; +- spec->drm_audio_ops.pin_eld_notify = intel_pin_eld_notify; ++ /* spec->i915_audio_ops.pin2port = intel_pin2port; */ ++ spec->i915_audio_ops.pin_eld_notify = intel_pin_eld_notify; + snd_hdac_acomp_register_notifier(&codec->bus->core, +- &spec->drm_audio_ops); ++ &spec->i915_audio_ops); + } + + /* setup_stream ops override for HSW+ */ diff -Nru oem-audio-hda-daily-lts-xenial-dkms-0.201807310409~ubuntu14.04.1/dkms-packaging-base/patches-xenial/remove_hdacore_ext.patch oem-audio-hda-daily-lts-xenial-dkms-0.201808040346~ubuntu14.04.1/dkms-packaging-base/patches-xenial/remove_hdacore_ext.patch --- oem-audio-hda-daily-lts-xenial-dkms-0.201807310409~ubuntu14.04.1/dkms-packaging-base/patches-xenial/remove_hdacore_ext.patch 1970-01-01 00:00:00.000000000 +0000 +++ oem-audio-hda-daily-lts-xenial-dkms-0.201808040346~ubuntu14.04.1/dkms-packaging-base/patches-xenial/remove_hdacore_ext.patch 2018-08-04 03:46:26.000000000 +0000 @@ -0,0 +1,10 @@ +Index: oem-audio-hda-daily-0.1/hdacore/Makefile +=================================================================== +--- oem-audio-hda-daily-0.1.orig/hdacore/Makefile ++++ oem-audio-hda-daily-0.1/hdacore/Makefile +@@ -12,4 +12,4 @@ snd-hda-core-$(CONFIG_SND_HDA_I915) += h + obj-$(CONFIG_SND_HDA_CORE) += snd-hda-core.o + + #extended hda +-obj-$(CONFIG_SND_HDA_EXT_CORE) += ext/ ++#obj-$(CONFIG_SND_HDA_EXT_CORE) += ext/ diff -Nru oem-audio-hda-daily-lts-xenial-dkms-0.201807310409~ubuntu14.04.1/dkms-packaging-base/patches-xenial/series oem-audio-hda-daily-lts-xenial-dkms-0.201808040346~ubuntu14.04.1/dkms-packaging-base/patches-xenial/series --- oem-audio-hda-daily-lts-xenial-dkms-0.201807310409~ubuntu14.04.1/dkms-packaging-base/patches-xenial/series 2018-07-31 04:09:17.000000000 +0000 +++ oem-audio-hda-daily-lts-xenial-dkms-0.201808040346~ubuntu14.04.1/dkms-packaging-base/patches-xenial/series 2018-08-04 03:46:26.000000000 +0000 @@ -5,9 +5,12 @@ kbuild_modname_fix.patch acpi_dev_present.patch call_i915_bpo_for_xenial.patch -mst-sync-audio-rate-get-eld.patch +#mst-sync-audio-rate-get-eld.patch remove-para-pipe-for-mst.patch restore-cacheflush.patch restore-dell-led-wmi-helper.patch add_PCI_CLASS_MULTIMEDIA_HD_AUDIO.patch fix_nospec_header.patch +drm_audio_component.patch +vga_switchroo.patch +remove_hdacore_ext.patch diff -Nru oem-audio-hda-daily-lts-xenial-dkms-0.201807310409~ubuntu14.04.1/dkms-packaging-base/patches-xenial/vga_switchroo.patch oem-audio-hda-daily-lts-xenial-dkms-0.201808040346~ubuntu14.04.1/dkms-packaging-base/patches-xenial/vga_switchroo.patch --- oem-audio-hda-daily-lts-xenial-dkms-0.201807310409~ubuntu14.04.1/dkms-packaging-base/patches-xenial/vga_switchroo.patch 1970-01-01 00:00:00.000000000 +0000 +++ oem-audio-hda-daily-lts-xenial-dkms-0.201808040346~ubuntu14.04.1/dkms-packaging-base/patches-xenial/vga_switchroo.patch 2018-08-04 03:46:26.000000000 +0000 @@ -0,0 +1,13 @@ +Index: oem-audio-hda-daily-0.1/hda_intel.c +=================================================================== +--- oem-audio-hda-daily-0.1.orig/hda_intel.c ++++ oem-audio-hda-daily-0.1/hda_intel.c +@@ -1328,7 +1328,7 @@ static int register_vga_switcheroo(struc + return 0; + + p = get_bound_vga(chip->pci); +- err = vga_switcheroo_register_audio_client(chip->pci, &azx_vs_ops, p); ++ err = vga_switcheroo_register_audio_client(chip->pci, &azx_vs_ops, VGA_SWITCHEROO_DIS); + pci_dev_put(p); + + if (err < 0) diff -Nru oem-audio-hda-daily-lts-xenial-dkms-0.201807310409~ubuntu14.04.1/dkms-packaging-base/patches-yakkety/drm_audio_component.patch oem-audio-hda-daily-lts-xenial-dkms-0.201808040346~ubuntu14.04.1/dkms-packaging-base/patches-yakkety/drm_audio_component.patch --- oem-audio-hda-daily-lts-xenial-dkms-0.201807310409~ubuntu14.04.1/dkms-packaging-base/patches-yakkety/drm_audio_component.patch 1970-01-01 00:00:00.000000000 +0000 +++ oem-audio-hda-daily-lts-xenial-dkms-0.201808040346~ubuntu14.04.1/dkms-packaging-base/patches-yakkety/drm_audio_component.patch 2018-08-04 03:46:26.000000000 +0000 @@ -0,0 +1,265 @@ +Index: oem-audio-hda-daily-0.1/hdacore/hdac_component.c +=================================================================== +--- oem-audio-hda-daily-0.1.orig/hdacore/hdac_component.c ++++ oem-audio-hda-daily-0.1/hdacore/hdac_component.c +@@ -14,7 +14,7 @@ static void hdac_acomp_release(struct de + { + } + +-static struct drm_audio_component *hdac_get_acomp(struct device *dev) ++static struct i915_audio_component *hdac_get_acomp(struct device *dev) + { + return devres_find(dev, hdac_acomp_release, NULL, NULL); + } +@@ -34,7 +34,7 @@ static struct drm_audio_component *hdac_ + */ + int snd_hdac_set_codec_wakeup(struct hdac_bus *bus, bool enable) + { +- struct drm_audio_component *acomp = bus->audio_component; ++ struct i915_audio_component *acomp = bus->audio_component; + + if (!acomp || !acomp->ops) + return -ENODEV; +@@ -66,7 +66,7 @@ EXPORT_SYMBOL_GPL(snd_hdac_set_codec_wak + */ + int snd_hdac_display_power(struct hdac_bus *bus, bool enable) + { +- struct drm_audio_component *acomp = bus->audio_component; ++ struct i915_audio_component *acomp = bus->audio_component; + + if (!acomp || !acomp->ops) + return -ENODEV; +@@ -75,15 +75,15 @@ int snd_hdac_display_power(struct hdac_b + enable ? "enable" : "disable"); + + if (enable) { +- if (!bus->drm_power_refcount++) { ++ if (!bus->i915_power_refcount++) { + if (acomp->ops->get_power) + acomp->ops->get_power(acomp->dev); + snd_hdac_set_codec_wakeup(bus, true); + snd_hdac_set_codec_wakeup(bus, false); + } + } else { +- WARN_ON(!bus->drm_power_refcount); +- if (!--bus->drm_power_refcount) ++ WARN_ON(!bus->i915_power_refcount); ++ if (!--bus->i915_power_refcount) + if (acomp->ops->put_power) + acomp->ops->put_power(acomp->dev); + } +@@ -109,7 +109,7 @@ int snd_hdac_sync_audio_rate(struct hdac + int dev_id, int rate) + { + struct hdac_bus *bus = codec->bus; +- struct drm_audio_component *acomp = bus->audio_component; ++ struct i915_audio_component *acomp = bus->audio_component; + int port, pipe; + + if (!acomp || !acomp->ops || !acomp->ops->sync_audio_rate) +@@ -150,7 +150,7 @@ int snd_hdac_acomp_get_eld(struct hdac_d + bool *audio_enabled, char *buffer, int max_bytes) + { + struct hdac_bus *bus = codec->bus; +- struct drm_audio_component *acomp = bus->audio_component; ++ struct i915_audio_component *acomp = bus->audio_component; + int port, pipe; + + if (!acomp || !acomp->ops || !acomp->ops->get_eld) +@@ -170,7 +170,7 @@ EXPORT_SYMBOL_GPL(snd_hdac_acomp_get_eld + + static int hdac_component_master_bind(struct device *dev) + { +- struct drm_audio_component *acomp = hdac_get_acomp(dev); ++ struct i915_audio_component *acomp = hdac_get_acomp(dev); + int ret; + + if (WARN_ON(!acomp)) +@@ -209,7 +209,7 @@ out_unbind: + + static void hdac_component_master_unbind(struct device *dev) + { +- struct drm_audio_component *acomp = hdac_get_acomp(dev); ++ struct i915_audio_component *acomp = hdac_get_acomp(dev); + + if (acomp->audio_ops && acomp->audio_ops->master_unbind) + acomp->audio_ops->master_unbind(dev, acomp); +@@ -236,7 +236,7 @@ static const struct component_master_ops + * Returns zero for success or a negative error code. + */ + int snd_hdac_acomp_register_notifier(struct hdac_bus *bus, +- const struct drm_audio_component_audio_ops *aops) ++ const struct i915_audio_component_audio_ops *aops) + { + if (!bus->audio_component) + return -ENODEV; +@@ -265,13 +265,13 @@ EXPORT_SYMBOL_GPL(snd_hdac_acomp_registe + * Returns zero for success or a negative error code. + */ + int snd_hdac_acomp_init(struct hdac_bus *bus, +- const struct drm_audio_component_audio_ops *aops, ++ const struct i915_audio_component_audio_ops *aops, + int (*match_master)(struct device *, void *), + size_t extra_size) + { + struct component_match *match = NULL; + struct device *dev = bus->dev; +- struct drm_audio_component *acomp; ++ struct i915_audio_component *acomp; + int ret; + + if (WARN_ON(hdac_get_acomp(dev))) +@@ -316,13 +316,13 @@ EXPORT_SYMBOL_GPL(snd_hdac_acomp_init); + int snd_hdac_acomp_exit(struct hdac_bus *bus) + { + struct device *dev = bus->dev; +- struct drm_audio_component *acomp = bus->audio_component; ++ struct i915_audio_component *acomp = bus->audio_component; + + if (!acomp) + return 0; + +- WARN_ON(bus->drm_power_refcount); +- if (bus->drm_power_refcount > 0 && acomp->ops) ++ WARN_ON(bus->i915_power_refcount); ++ if (bus->i915_power_refcount > 0 && acomp->ops) + acomp->ops->put_power(acomp->dev); + + component_master_del(dev, &hdac_component_master_ops); +Index: oem-audio-hda-daily-0.1/hdacore/hdac_i915.c +=================================================================== +--- oem-audio-hda-daily-0.1.orig/hdacore/hdac_i915.c ++++ oem-audio-hda-daily-0.1/hdacore/hdac_i915.c +@@ -43,7 +43,7 @@ static struct completion bind_complete; + */ + void snd_hdac_i915_set_bclk(struct hdac_bus *bus) + { +- struct drm_audio_component *acomp = bus->audio_component; ++ struct i915_audio_component *acomp = bus->audio_component; + struct pci_dev *pci = to_pci_dev(bus->dev); + int cdclk_freq; + unsigned int bclk_m, bclk_n; +@@ -100,7 +100,7 @@ static bool i915_gfx_present(void) + } + + static int i915_master_bind(struct device *dev, +- struct drm_audio_component *acomp) ++ struct i915_audio_component *acomp) + { + complete_all(&bind_complete); + /* clear audio_ops here as it was needed only for completion call */ +@@ -108,8 +108,8 @@ static int i915_master_bind(struct devic + return 0; + } + +-static const struct drm_audio_component_audio_ops i915_init_ops = { +- .master_bind = i915_master_bind ++static const struct i915_audio_component_audio_ops i915_init_ops = { ++ /* .master_bind = i915_master_bind */ + }; + + /** +@@ -126,7 +126,7 @@ static const struct drm_audio_component_ + */ + int snd_hdac_i915_init(struct hdac_bus *bus) + { +- struct drm_audio_component *acomp; ++ struct i915_audio_component *acomp; + int err; + + if (!i915_gfx_present()) +Index: oem-audio-hda-daily-0.1/include/hda_component.h +=================================================================== +--- oem-audio-hda-daily-0.1.orig/include/hda_component.h ++++ oem-audio-hda-daily-0.1/include/hda_component.h +@@ -4,7 +4,7 @@ + #ifndef __SOUND_HDA_COMPONENT_H + #define __SOUND_HDA_COMPONENT_H + +-#include ++#include + + #ifdef CONFIG_SND_HDA_COMPONENT + int snd_hdac_set_codec_wakeup(struct hdac_bus *bus, bool enable); +@@ -14,12 +14,12 @@ int snd_hdac_sync_audio_rate(struct hdac + int snd_hdac_acomp_get_eld(struct hdac_device *codec, hda_nid_t nid, int dev_id, + bool *audio_enabled, char *buffer, int max_bytes); + int snd_hdac_acomp_init(struct hdac_bus *bus, +- const struct drm_audio_component_audio_ops *aops, ++ const struct i915_audio_component_audio_ops *aops, + int (*match_master)(struct device *, void *), + size_t extra_size); + int snd_hdac_acomp_exit(struct hdac_bus *bus); + int snd_hdac_acomp_register_notifier(struct hdac_bus *bus, +- const struct drm_audio_component_audio_ops *ops); ++ const struct i915_audio_component_audio_ops *ops); + #else + static inline int snd_hdac_set_codec_wakeup(struct hdac_bus *bus, bool enable) + { +@@ -41,7 +41,7 @@ static inline int snd_hdac_acomp_get_eld + return -ENODEV; + } + static inline int snd_hdac_acomp_init(struct hdac_bus *bus, +- const struct drm_audio_component_audio_ops *aops, ++ const struct i915_audio_component_audio_ops *aops, + int (*match_master)(struct device *, void *), + size_t extra_size) + { +@@ -52,7 +52,7 @@ static inline int snd_hdac_acomp_exit(st + return 0; + } + static inline int snd_hdac_acomp_register_notifier(struct hdac_bus *bus, +- const struct drm_audio_component_audio_ops *ops) ++ const struct i915_audio_component_audio_ops *ops) + { + return -ENODEV; + } +Index: oem-audio-hda-daily-0.1/include/hdaudio.h +=================================================================== +--- oem-audio-hda-daily-0.1.orig/include/hdaudio.h ++++ oem-audio-hda-daily-0.1/include/hdaudio.h +@@ -362,8 +362,8 @@ struct hdac_bus { + struct mutex cmd_mutex; + + /* DRM component interface */ +- struct drm_audio_component *audio_component; +- int drm_power_refcount; ++ struct i915_audio_component *audio_component; ++ int i915_power_refcount; + + /* parameters required for enhanced capabilities */ + int num_streams; +Index: oem-audio-hda-daily-0.1/patch_hdmi.c +=================================================================== +--- oem-audio-hda-daily-0.1.orig/patch_hdmi.c ++++ oem-audio-hda-daily-0.1/patch_hdmi.c +@@ -177,7 +177,7 @@ struct hdmi_spec { + + /* i915/powerwell (Haswell+/Valleyview+) specific */ + bool use_acomp_notifier; /* use i915 eld_notify callback for hotplug */ +- struct drm_audio_component_audio_ops drm_audio_ops; ++ struct i915_audio_component_audio_ops i915_audio_ops; + + struct hdac_chmap chmap; + hda_nid_t vendor_nid; +@@ -2533,16 +2533,16 @@ static void register_i915_notifier(struc + struct hdmi_spec *spec = codec->spec; + + spec->use_acomp_notifier = true; +- spec->drm_audio_ops.audio_ptr = codec; ++ spec->i915_audio_ops.audio_ptr = codec; + /* intel_audio_codec_enable() or intel_audio_codec_disable() + * will call pin_eld_notify with using audio_ptr pointer + * We need make sure audio_ptr is really setup + */ + wmb(); +- spec->drm_audio_ops.pin2port = intel_pin2port; +- spec->drm_audio_ops.pin_eld_notify = intel_pin_eld_notify; ++ /* spec->i915_audio_ops.pin2port = intel_pin2port; */ ++ spec->i915_audio_ops.pin_eld_notify = intel_pin_eld_notify; + snd_hdac_acomp_register_notifier(&codec->bus->core, +- &spec->drm_audio_ops); ++ &spec->i915_audio_ops); + } + + /* setup_stream ops override for HSW+ */ diff -Nru oem-audio-hda-daily-lts-xenial-dkms-0.201807310409~ubuntu14.04.1/dkms-packaging-base/patches-yakkety/remove_hdacore_ext.patch oem-audio-hda-daily-lts-xenial-dkms-0.201808040346~ubuntu14.04.1/dkms-packaging-base/patches-yakkety/remove_hdacore_ext.patch --- oem-audio-hda-daily-lts-xenial-dkms-0.201807310409~ubuntu14.04.1/dkms-packaging-base/patches-yakkety/remove_hdacore_ext.patch 1970-01-01 00:00:00.000000000 +0000 +++ oem-audio-hda-daily-lts-xenial-dkms-0.201808040346~ubuntu14.04.1/dkms-packaging-base/patches-yakkety/remove_hdacore_ext.patch 2018-08-04 03:46:26.000000000 +0000 @@ -0,0 +1,10 @@ +Index: oem-audio-hda-daily-0.1/hdacore/Makefile +=================================================================== +--- oem-audio-hda-daily-0.1.orig/hdacore/Makefile ++++ oem-audio-hda-daily-0.1/hdacore/Makefile +@@ -12,4 +12,4 @@ snd-hda-core-$(CONFIG_SND_HDA_I915) += h + obj-$(CONFIG_SND_HDA_CORE) += snd-hda-core.o + + #extended hda +-obj-$(CONFIG_SND_HDA_EXT_CORE) += ext/ ++#obj-$(CONFIG_SND_HDA_EXT_CORE) += ext/ diff -Nru oem-audio-hda-daily-lts-xenial-dkms-0.201807310409~ubuntu14.04.1/dkms-packaging-base/patches-yakkety/series oem-audio-hda-daily-lts-xenial-dkms-0.201808040346~ubuntu14.04.1/dkms-packaging-base/patches-yakkety/series --- oem-audio-hda-daily-lts-xenial-dkms-0.201807310409~ubuntu14.04.1/dkms-packaging-base/patches-yakkety/series 2018-07-31 04:09:17.000000000 +0000 +++ oem-audio-hda-daily-lts-xenial-dkms-0.201808040346~ubuntu14.04.1/dkms-packaging-base/patches-yakkety/series 2018-08-04 03:46:26.000000000 +0000 @@ -8,3 +8,6 @@ restore-dell-led-wmi-helper.patch add_PCI_CLASS_MULTIMEDIA_HD_AUDIO.patch fix_nospec_header.patch +drm_audio_component.patch +vga_switchroo.patch +remove_hdacore_ext.patch diff -Nru oem-audio-hda-daily-lts-xenial-dkms-0.201807310409~ubuntu14.04.1/dkms-packaging-base/patches-yakkety/vga_switchroo.patch oem-audio-hda-daily-lts-xenial-dkms-0.201808040346~ubuntu14.04.1/dkms-packaging-base/patches-yakkety/vga_switchroo.patch --- oem-audio-hda-daily-lts-xenial-dkms-0.201807310409~ubuntu14.04.1/dkms-packaging-base/patches-yakkety/vga_switchroo.patch 1970-01-01 00:00:00.000000000 +0000 +++ oem-audio-hda-daily-lts-xenial-dkms-0.201808040346~ubuntu14.04.1/dkms-packaging-base/patches-yakkety/vga_switchroo.patch 2018-08-04 03:46:26.000000000 +0000 @@ -0,0 +1,13 @@ +Index: oem-audio-hda-daily-0.1/hda_intel.c +=================================================================== +--- oem-audio-hda-daily-0.1.orig/hda_intel.c ++++ oem-audio-hda-daily-0.1/hda_intel.c +@@ -1328,7 +1328,7 @@ static int register_vga_switcheroo(struc + return 0; + + p = get_bound_vga(chip->pci); +- err = vga_switcheroo_register_audio_client(chip->pci, &azx_vs_ops, p); ++ err = vga_switcheroo_register_audio_client(chip->pci, &azx_vs_ops, VGA_SWITCHEROO_DIS); + pci_dev_put(p); + + if (err < 0) diff -Nru oem-audio-hda-daily-lts-xenial-dkms-0.201807310409~ubuntu14.04.1/dkms-packaging-base/patches-zesty/drm_audio_component.patch oem-audio-hda-daily-lts-xenial-dkms-0.201808040346~ubuntu14.04.1/dkms-packaging-base/patches-zesty/drm_audio_component.patch --- oem-audio-hda-daily-lts-xenial-dkms-0.201807310409~ubuntu14.04.1/dkms-packaging-base/patches-zesty/drm_audio_component.patch 1970-01-01 00:00:00.000000000 +0000 +++ oem-audio-hda-daily-lts-xenial-dkms-0.201808040346~ubuntu14.04.1/dkms-packaging-base/patches-zesty/drm_audio_component.patch 2018-08-04 03:46:26.000000000 +0000 @@ -0,0 +1,265 @@ +Index: oem-audio-hda-daily-0.1/hdacore/hdac_component.c +=================================================================== +--- oem-audio-hda-daily-0.1.orig/hdacore/hdac_component.c ++++ oem-audio-hda-daily-0.1/hdacore/hdac_component.c +@@ -14,7 +14,7 @@ static void hdac_acomp_release(struct de + { + } + +-static struct drm_audio_component *hdac_get_acomp(struct device *dev) ++static struct i915_audio_component *hdac_get_acomp(struct device *dev) + { + return devres_find(dev, hdac_acomp_release, NULL, NULL); + } +@@ -34,7 +34,7 @@ static struct drm_audio_component *hdac_ + */ + int snd_hdac_set_codec_wakeup(struct hdac_bus *bus, bool enable) + { +- struct drm_audio_component *acomp = bus->audio_component; ++ struct i915_audio_component *acomp = bus->audio_component; + + if (!acomp || !acomp->ops) + return -ENODEV; +@@ -66,7 +66,7 @@ EXPORT_SYMBOL_GPL(snd_hdac_set_codec_wak + */ + int snd_hdac_display_power(struct hdac_bus *bus, bool enable) + { +- struct drm_audio_component *acomp = bus->audio_component; ++ struct i915_audio_component *acomp = bus->audio_component; + + if (!acomp || !acomp->ops) + return -ENODEV; +@@ -75,15 +75,15 @@ int snd_hdac_display_power(struct hdac_b + enable ? "enable" : "disable"); + + if (enable) { +- if (!bus->drm_power_refcount++) { ++ if (!bus->i915_power_refcount++) { + if (acomp->ops->get_power) + acomp->ops->get_power(acomp->dev); + snd_hdac_set_codec_wakeup(bus, true); + snd_hdac_set_codec_wakeup(bus, false); + } + } else { +- WARN_ON(!bus->drm_power_refcount); +- if (!--bus->drm_power_refcount) ++ WARN_ON(!bus->i915_power_refcount); ++ if (!--bus->i915_power_refcount) + if (acomp->ops->put_power) + acomp->ops->put_power(acomp->dev); + } +@@ -109,7 +109,7 @@ int snd_hdac_sync_audio_rate(struct hdac + int dev_id, int rate) + { + struct hdac_bus *bus = codec->bus; +- struct drm_audio_component *acomp = bus->audio_component; ++ struct i915_audio_component *acomp = bus->audio_component; + int port, pipe; + + if (!acomp || !acomp->ops || !acomp->ops->sync_audio_rate) +@@ -150,7 +150,7 @@ int snd_hdac_acomp_get_eld(struct hdac_d + bool *audio_enabled, char *buffer, int max_bytes) + { + struct hdac_bus *bus = codec->bus; +- struct drm_audio_component *acomp = bus->audio_component; ++ struct i915_audio_component *acomp = bus->audio_component; + int port, pipe; + + if (!acomp || !acomp->ops || !acomp->ops->get_eld) +@@ -170,7 +170,7 @@ EXPORT_SYMBOL_GPL(snd_hdac_acomp_get_eld + + static int hdac_component_master_bind(struct device *dev) + { +- struct drm_audio_component *acomp = hdac_get_acomp(dev); ++ struct i915_audio_component *acomp = hdac_get_acomp(dev); + int ret; + + if (WARN_ON(!acomp)) +@@ -209,7 +209,7 @@ out_unbind: + + static void hdac_component_master_unbind(struct device *dev) + { +- struct drm_audio_component *acomp = hdac_get_acomp(dev); ++ struct i915_audio_component *acomp = hdac_get_acomp(dev); + + if (acomp->audio_ops && acomp->audio_ops->master_unbind) + acomp->audio_ops->master_unbind(dev, acomp); +@@ -236,7 +236,7 @@ static const struct component_master_ops + * Returns zero for success or a negative error code. + */ + int snd_hdac_acomp_register_notifier(struct hdac_bus *bus, +- const struct drm_audio_component_audio_ops *aops) ++ const struct i915_audio_component_audio_ops *aops) + { + if (!bus->audio_component) + return -ENODEV; +@@ -265,13 +265,13 @@ EXPORT_SYMBOL_GPL(snd_hdac_acomp_registe + * Returns zero for success or a negative error code. + */ + int snd_hdac_acomp_init(struct hdac_bus *bus, +- const struct drm_audio_component_audio_ops *aops, ++ const struct i915_audio_component_audio_ops *aops, + int (*match_master)(struct device *, void *), + size_t extra_size) + { + struct component_match *match = NULL; + struct device *dev = bus->dev; +- struct drm_audio_component *acomp; ++ struct i915_audio_component *acomp; + int ret; + + if (WARN_ON(hdac_get_acomp(dev))) +@@ -316,13 +316,13 @@ EXPORT_SYMBOL_GPL(snd_hdac_acomp_init); + int snd_hdac_acomp_exit(struct hdac_bus *bus) + { + struct device *dev = bus->dev; +- struct drm_audio_component *acomp = bus->audio_component; ++ struct i915_audio_component *acomp = bus->audio_component; + + if (!acomp) + return 0; + +- WARN_ON(bus->drm_power_refcount); +- if (bus->drm_power_refcount > 0 && acomp->ops) ++ WARN_ON(bus->i915_power_refcount); ++ if (bus->i915_power_refcount > 0 && acomp->ops) + acomp->ops->put_power(acomp->dev); + + component_master_del(dev, &hdac_component_master_ops); +Index: oem-audio-hda-daily-0.1/hdacore/hdac_i915.c +=================================================================== +--- oem-audio-hda-daily-0.1.orig/hdacore/hdac_i915.c ++++ oem-audio-hda-daily-0.1/hdacore/hdac_i915.c +@@ -43,7 +43,7 @@ static struct completion bind_complete; + */ + void snd_hdac_i915_set_bclk(struct hdac_bus *bus) + { +- struct drm_audio_component *acomp = bus->audio_component; ++ struct i915_audio_component *acomp = bus->audio_component; + struct pci_dev *pci = to_pci_dev(bus->dev); + int cdclk_freq; + unsigned int bclk_m, bclk_n; +@@ -100,7 +100,7 @@ static bool i915_gfx_present(void) + } + + static int i915_master_bind(struct device *dev, +- struct drm_audio_component *acomp) ++ struct i915_audio_component *acomp) + { + complete_all(&bind_complete); + /* clear audio_ops here as it was needed only for completion call */ +@@ -108,8 +108,8 @@ static int i915_master_bind(struct devic + return 0; + } + +-static const struct drm_audio_component_audio_ops i915_init_ops = { +- .master_bind = i915_master_bind ++static const struct i915_audio_component_audio_ops i915_init_ops = { ++ /* .master_bind = i915_master_bind */ + }; + + /** +@@ -126,7 +126,7 @@ static const struct drm_audio_component_ + */ + int snd_hdac_i915_init(struct hdac_bus *bus) + { +- struct drm_audio_component *acomp; ++ struct i915_audio_component *acomp; + int err; + + if (!i915_gfx_present()) +Index: oem-audio-hda-daily-0.1/include/hda_component.h +=================================================================== +--- oem-audio-hda-daily-0.1.orig/include/hda_component.h ++++ oem-audio-hda-daily-0.1/include/hda_component.h +@@ -4,7 +4,7 @@ + #ifndef __SOUND_HDA_COMPONENT_H + #define __SOUND_HDA_COMPONENT_H + +-#include ++#include + + #ifdef CONFIG_SND_HDA_COMPONENT + int snd_hdac_set_codec_wakeup(struct hdac_bus *bus, bool enable); +@@ -14,12 +14,12 @@ int snd_hdac_sync_audio_rate(struct hdac + int snd_hdac_acomp_get_eld(struct hdac_device *codec, hda_nid_t nid, int dev_id, + bool *audio_enabled, char *buffer, int max_bytes); + int snd_hdac_acomp_init(struct hdac_bus *bus, +- const struct drm_audio_component_audio_ops *aops, ++ const struct i915_audio_component_audio_ops *aops, + int (*match_master)(struct device *, void *), + size_t extra_size); + int snd_hdac_acomp_exit(struct hdac_bus *bus); + int snd_hdac_acomp_register_notifier(struct hdac_bus *bus, +- const struct drm_audio_component_audio_ops *ops); ++ const struct i915_audio_component_audio_ops *ops); + #else + static inline int snd_hdac_set_codec_wakeup(struct hdac_bus *bus, bool enable) + { +@@ -41,7 +41,7 @@ static inline int snd_hdac_acomp_get_eld + return -ENODEV; + } + static inline int snd_hdac_acomp_init(struct hdac_bus *bus, +- const struct drm_audio_component_audio_ops *aops, ++ const struct i915_audio_component_audio_ops *aops, + int (*match_master)(struct device *, void *), + size_t extra_size) + { +@@ -52,7 +52,7 @@ static inline int snd_hdac_acomp_exit(st + return 0; + } + static inline int snd_hdac_acomp_register_notifier(struct hdac_bus *bus, +- const struct drm_audio_component_audio_ops *ops) ++ const struct i915_audio_component_audio_ops *ops) + { + return -ENODEV; + } +Index: oem-audio-hda-daily-0.1/include/hdaudio.h +=================================================================== +--- oem-audio-hda-daily-0.1.orig/include/hdaudio.h ++++ oem-audio-hda-daily-0.1/include/hdaudio.h +@@ -362,8 +362,8 @@ struct hdac_bus { + struct mutex cmd_mutex; + + /* DRM component interface */ +- struct drm_audio_component *audio_component; +- int drm_power_refcount; ++ struct i915_audio_component *audio_component; ++ int i915_power_refcount; + + /* parameters required for enhanced capabilities */ + int num_streams; +Index: oem-audio-hda-daily-0.1/patch_hdmi.c +=================================================================== +--- oem-audio-hda-daily-0.1.orig/patch_hdmi.c ++++ oem-audio-hda-daily-0.1/patch_hdmi.c +@@ -177,7 +177,7 @@ struct hdmi_spec { + + /* i915/powerwell (Haswell+/Valleyview+) specific */ + bool use_acomp_notifier; /* use i915 eld_notify callback for hotplug */ +- struct drm_audio_component_audio_ops drm_audio_ops; ++ struct i915_audio_component_audio_ops i915_audio_ops; + + struct hdac_chmap chmap; + hda_nid_t vendor_nid; +@@ -2533,16 +2533,16 @@ static void register_i915_notifier(struc + struct hdmi_spec *spec = codec->spec; + + spec->use_acomp_notifier = true; +- spec->drm_audio_ops.audio_ptr = codec; ++ spec->i915_audio_ops.audio_ptr = codec; + /* intel_audio_codec_enable() or intel_audio_codec_disable() + * will call pin_eld_notify with using audio_ptr pointer + * We need make sure audio_ptr is really setup + */ + wmb(); +- spec->drm_audio_ops.pin2port = intel_pin2port; +- spec->drm_audio_ops.pin_eld_notify = intel_pin_eld_notify; ++ /* spec->i915_audio_ops.pin2port = intel_pin2port; */ ++ spec->i915_audio_ops.pin_eld_notify = intel_pin_eld_notify; + snd_hdac_acomp_register_notifier(&codec->bus->core, +- &spec->drm_audio_ops); ++ &spec->i915_audio_ops); + } + + /* setup_stream ops override for HSW+ */ diff -Nru oem-audio-hda-daily-lts-xenial-dkms-0.201807310409~ubuntu14.04.1/dkms-packaging-base/patches-zesty/remove_hdacore_ext.patch oem-audio-hda-daily-lts-xenial-dkms-0.201808040346~ubuntu14.04.1/dkms-packaging-base/patches-zesty/remove_hdacore_ext.patch --- oem-audio-hda-daily-lts-xenial-dkms-0.201807310409~ubuntu14.04.1/dkms-packaging-base/patches-zesty/remove_hdacore_ext.patch 1970-01-01 00:00:00.000000000 +0000 +++ oem-audio-hda-daily-lts-xenial-dkms-0.201808040346~ubuntu14.04.1/dkms-packaging-base/patches-zesty/remove_hdacore_ext.patch 2018-08-04 03:46:26.000000000 +0000 @@ -0,0 +1,10 @@ +Index: oem-audio-hda-daily-0.1/hdacore/Makefile +=================================================================== +--- oem-audio-hda-daily-0.1.orig/hdacore/Makefile ++++ oem-audio-hda-daily-0.1/hdacore/Makefile +@@ -12,4 +12,4 @@ snd-hda-core-$(CONFIG_SND_HDA_I915) += h + obj-$(CONFIG_SND_HDA_CORE) += snd-hda-core.o + + #extended hda +-obj-$(CONFIG_SND_HDA_EXT_CORE) += ext/ ++#obj-$(CONFIG_SND_HDA_EXT_CORE) += ext/ diff -Nru oem-audio-hda-daily-lts-xenial-dkms-0.201807310409~ubuntu14.04.1/dkms-packaging-base/patches-zesty/series oem-audio-hda-daily-lts-xenial-dkms-0.201808040346~ubuntu14.04.1/dkms-packaging-base/patches-zesty/series --- oem-audio-hda-daily-lts-xenial-dkms-0.201807310409~ubuntu14.04.1/dkms-packaging-base/patches-zesty/series 2018-07-31 04:09:17.000000000 +0000 +++ oem-audio-hda-daily-lts-xenial-dkms-0.201808040346~ubuntu14.04.1/dkms-packaging-base/patches-zesty/series 2018-08-04 03:46:26.000000000 +0000 @@ -6,3 +6,6 @@ restore-dell-led-wmi-helper.patch add_PCI_CLASS_MULTIMEDIA_HD_AUDIO.patch fix_nospec_header.patch +drm_audio_component.patch +vga_switchroo.patch +remove_hdacore_ext.patch diff -Nru oem-audio-hda-daily-lts-xenial-dkms-0.201807310409~ubuntu14.04.1/dkms-packaging-base/patches-zesty/vga_switchroo.patch oem-audio-hda-daily-lts-xenial-dkms-0.201808040346~ubuntu14.04.1/dkms-packaging-base/patches-zesty/vga_switchroo.patch --- oem-audio-hda-daily-lts-xenial-dkms-0.201807310409~ubuntu14.04.1/dkms-packaging-base/patches-zesty/vga_switchroo.patch 1970-01-01 00:00:00.000000000 +0000 +++ oem-audio-hda-daily-lts-xenial-dkms-0.201808040346~ubuntu14.04.1/dkms-packaging-base/patches-zesty/vga_switchroo.patch 2018-08-04 03:46:26.000000000 +0000 @@ -0,0 +1,13 @@ +Index: oem-audio-hda-daily-0.1/hda_intel.c +=================================================================== +--- oem-audio-hda-daily-0.1.orig/hda_intel.c ++++ oem-audio-hda-daily-0.1/hda_intel.c +@@ -1328,7 +1328,7 @@ static int register_vga_switcheroo(struc + return 0; + + p = get_bound_vga(chip->pci); +- err = vga_switcheroo_register_audio_client(chip->pci, &azx_vs_ops, p); ++ err = vga_switcheroo_register_audio_client(chip->pci, &azx_vs_ops, VGA_SWITCHEROO_DIS); + pci_dev_put(p); + + if (err < 0) diff -Nru oem-audio-hda-daily-lts-xenial-dkms-0.201807310409~ubuntu14.04.1/hda-src-from-tree/dell_wmi_helper.c oem-audio-hda-daily-lts-xenial-dkms-0.201808040346~ubuntu14.04.1/hda-src-from-tree/dell_wmi_helper.c --- oem-audio-hda-daily-lts-xenial-dkms-0.201807310409~ubuntu14.04.1/hda-src-from-tree/dell_wmi_helper.c 2018-07-31 04:09:28.000000000 +0000 +++ oem-audio-hda-daily-lts-xenial-dkms-0.201808040346~ubuntu14.04.1/hda-src-from-tree/dell_wmi_helper.c 2018-08-04 03:46:28.000000000 +0000 @@ -6,111 +6,18 @@ #if IS_ENABLED(CONFIG_DELL_LAPTOP) #include -enum { - MICMUTE_LED_ON, - MICMUTE_LED_OFF, - MICMUTE_LED_FOLLOW_CAPTURE, - MICMUTE_LED_FOLLOW_MUTE, -}; - -static int dell_led_mode = MICMUTE_LED_FOLLOW_MUTE; -static int dell_capture; -static int dell_led_value; static int (*dell_micmute_led_set_func)(int); -static void (*dell_old_cap_hook)(struct hda_codec *, - struct snd_kcontrol *, - struct snd_ctl_elem_value *); -static void call_micmute_led_update(void) +static void dell_micmute_update(struct hda_codec *codec) { - int val; + struct hda_gen_spec *spec = codec->spec; - switch (dell_led_mode) { - case MICMUTE_LED_ON: - val = 1; - break; - case MICMUTE_LED_OFF: - val = 0; - break; - case MICMUTE_LED_FOLLOW_CAPTURE: - val = dell_capture; - break; - case MICMUTE_LED_FOLLOW_MUTE: - default: - val = !dell_capture; - break; - } - - if (val == dell_led_value) - return; - dell_led_value = val; - dell_micmute_led_set_func(dell_led_value); -} - -static void update_dell_wmi_micmute_led(struct hda_codec *codec, - struct snd_kcontrol *kcontrol, - struct snd_ctl_elem_value *ucontrol) -{ - if (dell_old_cap_hook) - dell_old_cap_hook(codec, kcontrol, ucontrol); - - if (!ucontrol || !dell_micmute_led_set_func) - return; - if (strcmp("Capture Switch", ucontrol->id.name) == 0 && ucontrol->id.index == 0) { - /* TODO: How do I verify if it's a mono or stereo here? */ - dell_capture = (ucontrol->value.integer.value[0] || - ucontrol->value.integer.value[1]); - call_micmute_led_update(); - } -} - -static int dell_mic_mute_led_mode_info(struct snd_kcontrol *kcontrol, - struct snd_ctl_elem_info *uinfo) -{ - static const char * const texts[] = { - "On", "Off", "Follow Capture", "Follow Mute", - }; - - return snd_ctl_enum_info(uinfo, 1, ARRAY_SIZE(texts), texts); + dell_micmute_led_set_func(spec->micmute_led.led_value); } -static int dell_mic_mute_led_mode_get(struct snd_kcontrol *kcontrol, - struct snd_ctl_elem_value *ucontrol) -{ - ucontrol->value.enumerated.item[0] = dell_led_mode; - return 0; -} - -static int dell_mic_mute_led_mode_put(struct snd_kcontrol *kcontrol, - struct snd_ctl_elem_value *ucontrol) -{ - unsigned int mode; - - mode = ucontrol->value.enumerated.item[0]; - if (mode > MICMUTE_LED_FOLLOW_MUTE) - mode = MICMUTE_LED_FOLLOW_MUTE; - if (mode == dell_led_mode) - return 0; - dell_led_mode = mode; - call_micmute_led_update(); - return 1; -} - -static const struct snd_kcontrol_new dell_mic_mute_mode_ctls[] = { - { - .iface = SNDRV_CTL_ELEM_IFACE_MIXER, - .name = "Mic Mute-LED Mode", - .info = dell_mic_mute_led_mode_info, - .get = dell_mic_mute_led_mode_get, - .put = dell_mic_mute_led_mode_put, - }, - {} -}; - static void alc_fixup_dell_wmi(struct hda_codec *codec, const struct hda_fixup *fix, int action) { - struct alc_spec *spec = codec->spec; bool removefunc = false; if (action == HDA_FIXUP_ACT_PROBE) { @@ -121,25 +28,14 @@ return; } - removefunc = true; - if (dell_micmute_led_set_func(false) >= 0) { - dell_led_value = 0; - if (spec->gen.num_adc_nids > 1 && !spec->gen.dyn_adc_switch) - codec_dbg(codec, "Skipping micmute LED control due to several ADCs"); - else { - dell_old_cap_hook = spec->gen.cap_sync_hook; - spec->gen.cap_sync_hook = update_dell_wmi_micmute_led; - removefunc = false; - add_mixer(spec, dell_mic_mute_mode_ctls); - } - } - + removefunc = (dell_micmute_led_set_func(false) < 0) || + (snd_hda_gen_add_micmute_led(codec, + dell_micmute_update) <= 0); } if (dell_micmute_led_set_func && (action == HDA_FIXUP_ACT_FREE || removefunc)) { symbol_put(dell_micmute_led_set); dell_micmute_led_set_func = NULL; - dell_old_cap_hook = NULL; } } diff -Nru oem-audio-hda-daily-lts-xenial-dkms-0.201807310409~ubuntu14.04.1/hda-src-from-tree/hda_codec.c oem-audio-hda-daily-lts-xenial-dkms-0.201808040346~ubuntu14.04.1/hda-src-from-tree/hda_codec.c --- oem-audio-hda-daily-lts-xenial-dkms-0.201807310409~ubuntu14.04.1/hda-src-from-tree/hda_codec.c 2018-07-31 04:09:28.000000000 +0000 +++ oem-audio-hda-daily-lts-xenial-dkms-0.201808040346~ubuntu14.04.1/hda-src-from-tree/hda_codec.c 2018-08-04 03:46:28.000000000 +0000 @@ -37,15 +37,8 @@ #include "hda_jack.h" #include -#ifdef CONFIG_PM -#define codec_in_pm(codec) atomic_read(&(codec)->core.in_pm) -#define hda_codec_is_power_on(codec) \ - (!pm_runtime_suspended(hda_codec_dev(codec))) -#else -#define codec_in_pm(codec) 0 -#define hda_codec_is_power_on(codec) 1 -#endif - +#define codec_in_pm(codec) snd_hdac_is_in_pm(&codec->core) +#define hda_codec_is_power_on(codec) snd_hdac_is_power_on(&codec->core) #define codec_has_epss(codec) \ ((codec)->core.power_caps & AC_PWRST_EPSS) #define codec_has_clkstop(codec) \ @@ -158,7 +151,7 @@ len = snd_hda_get_raw_connections(codec, nid, list, ARRAY_SIZE(list)); if (len == -ENOSPC) { len = snd_hda_get_num_raw_conns(codec, nid); - result = kmalloc(sizeof(hda_nid_t) * len, GFP_KERNEL); + result = kmalloc_array(len, sizeof(hda_nid_t), GFP_KERNEL); if (!result) return -ENOMEM; len = snd_hda_get_raw_connections(codec, nid, result, len); @@ -438,7 +431,7 @@ int i; hda_nid_t nid; - codec->wcaps = kmalloc(codec->core.num_nodes * 4, GFP_KERNEL); + codec->wcaps = kmalloc_array(codec->core.num_nodes, 4, GFP_KERNEL); if (!codec->wcaps) return -ENOMEM; nid = codec->core.start_nid; @@ -858,6 +851,39 @@ kfree(codec); } +#define DEV_NAME_LEN 31 + +static int snd_hda_codec_device_init(struct hda_bus *bus, struct snd_card *card, + unsigned int codec_addr, struct hda_codec **codecp) +{ + char name[DEV_NAME_LEN]; + struct hda_codec *codec; + int err; + + dev_dbg(card->dev, "%s: entry\n", __func__); + + if (snd_BUG_ON(!bus)) + return -EINVAL; + if (snd_BUG_ON(codec_addr > HDA_MAX_CODEC_ADDRESS)) + return -EINVAL; + + codec = kzalloc(sizeof(*codec), GFP_KERNEL); + if (!codec) + return -ENOMEM; + + sprintf(name, "hdaudioC%dD%d", card->number, codec_addr); + err = snd_hdac_device_init(&codec->core, &bus->core, name, codec_addr); + if (err < 0) { + kfree(codec); + return err; + } + + codec->core.type = HDA_DEV_LEGACY; + *codecp = codec; + + return err; +} + /** * snd_hda_codec_new - create a HDA codec * @bus: the bus to assign @@ -869,7 +895,19 @@ int snd_hda_codec_new(struct hda_bus *bus, struct snd_card *card, unsigned int codec_addr, struct hda_codec **codecp) { - struct hda_codec *codec; + int ret; + + ret = snd_hda_codec_device_init(bus, card, codec_addr, codecp); + if (ret < 0) + return ret; + + return snd_hda_codec_device_new(bus, card, codec_addr, *codecp); +} +EXPORT_SYMBOL_GPL(snd_hda_codec_new); + +int snd_hda_codec_device_new(struct hda_bus *bus, struct snd_card *card, + unsigned int codec_addr, struct hda_codec *codec) +{ char component[31]; hda_nid_t fg; int err; @@ -879,25 +917,14 @@ .dev_free = snd_hda_codec_dev_free, }; + dev_dbg(card->dev, "%s: entry\n", __func__); + if (snd_BUG_ON(!bus)) return -EINVAL; if (snd_BUG_ON(codec_addr > HDA_MAX_CODEC_ADDRESS)) return -EINVAL; - codec = kzalloc(sizeof(*codec), GFP_KERNEL); - if (!codec) - return -ENOMEM; - - sprintf(component, "hdaudioC%dD%d", card->number, codec_addr); - err = snd_hdac_device_init(&codec->core, &bus->core, component, - codec_addr); - if (err < 0) { - kfree(codec); - return err; - } - codec->core.dev.release = snd_hda_codec_dev_release; - codec->core.type = HDA_DEV_LEGACY; codec->core.exec_verb = codec_exec_verb; codec->bus = bus; @@ -957,15 +984,13 @@ if (err < 0) goto error; - if (codecp) - *codecp = codec; return 0; error: put_device(hda_codec_dev(codec)); return err; } -EXPORT_SYMBOL_GPL(snd_hda_codec_new); +EXPORT_SYMBOL_GPL(snd_hda_codec_device_new); /** * snd_hda_codec_update_widgets - Refresh widget caps and pin defaults @@ -2846,14 +2871,13 @@ { unsigned int state; - atomic_inc(&codec->core.in_pm); - + snd_hdac_enter_pm(&codec->core); if (codec->patch_ops.suspend) codec->patch_ops.suspend(codec); hda_cleanup_all_streams(codec); state = hda_set_power_state(codec, AC_PWRST_D3); update_power_acct(codec, true); - atomic_dec(&codec->core.in_pm); + snd_hdac_leave_pm(&codec->core); return state; } @@ -2862,8 +2886,7 @@ */ static void hda_call_codec_resume(struct hda_codec *codec) { - atomic_inc(&codec->core.in_pm); - + snd_hdac_enter_pm(&codec->core); if (codec->core.regmap) regcache_mark_dirty(codec->core.regmap); @@ -2886,7 +2909,7 @@ hda_jackpoll_work(&codec->jackpoll_work.work); else snd_hda_jack_report_sync(codec); - atomic_dec(&codec->core.in_pm); + snd_hdac_leave_pm(&codec->core); } static int hda_codec_runtime_suspend(struct device *dev) @@ -2899,8 +2922,9 @@ list_for_each_entry(pcm, &codec->pcm_list_head, list) snd_pcm_suspend_all(pcm->pcm); state = hda_call_codec_suspend(codec); - if (codec_has_clkstop(codec) && codec_has_epss(codec) && - (state & AC_PWRST_CLK_STOP_OK)) + if (codec->link_down_at_suspend || + (codec_has_clkstop(codec) && codec_has_epss(codec) && + (state & AC_PWRST_CLK_STOP_OK))) snd_hdac_codec_link_down(&codec->core); snd_hdac_link_power(&codec->core, false); return 0; @@ -2991,6 +3015,7 @@ sync_power_up_states(codec); return 0; } +EXPORT_SYMBOL_GPL(snd_hda_codec_build_controls); /* * PCM stuff @@ -3196,6 +3221,7 @@ return 0; } +EXPORT_SYMBOL_GPL(snd_hda_codec_parse_pcms); /* assign all PCMs of the given codec */ int snd_hda_codec_build_pcms(struct hda_codec *codec) @@ -3251,8 +3277,8 @@ for (; knew->name; knew++) { struct snd_kcontrol *kctl; int addr = 0, idx = 0; - if (knew->iface == -1) /* skip this codec private value */ - continue; + if (knew->iface == (__force snd_ctl_elem_iface_t)-1) + continue; /* skip this codec private value */ for (;;) { kctl = snd_ctl_new1(knew, codec); if (!kctl) @@ -3842,7 +3868,7 @@ * This function is a helper to set a pin ctl value more safely. * It corrects the pin ctl value via snd_hda_correct_pin_ctl(), stores the * value in pin target array via snd_hda_codec_set_pin_target(), then - * actually writes the value via either snd_hda_codec_update_cache() or + * actually writes the value via either snd_hda_codec_write_cache() or * snd_hda_codec_write() depending on @cached flag. */ int _snd_hda_set_pin_ctl(struct hda_codec *codec, hda_nid_t pin, @@ -3851,7 +3877,7 @@ val = snd_hda_correct_pin_ctl(codec, pin, val); snd_hda_codec_set_pin_target(codec, pin, val); if (cached) - return snd_hda_codec_update_cache(codec, pin, 0, + return snd_hda_codec_write_cache(codec, pin, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, val); else return snd_hda_codec_write(codec, pin, 0, diff -Nru oem-audio-hda-daily-lts-xenial-dkms-0.201807310409~ubuntu14.04.1/hda-src-from-tree/hda_codec.h oem-audio-hda-daily-lts-xenial-dkms-0.201808040346~ubuntu14.04.1/hda-src-from-tree/hda_codec.h --- oem-audio-hda-daily-lts-xenial-dkms-0.201807310409~ubuntu14.04.1/hda-src-from-tree/hda_codec.h 2018-07-31 04:09:28.000000000 +0000 +++ oem-audio-hda-daily-lts-xenial-dkms-0.201808040346~ubuntu14.04.1/hda-src-from-tree/hda_codec.h 2018-08-04 03:46:28.000000000 +0000 @@ -84,6 +84,7 @@ */ typedef int (*hda_codec_patch_t)(struct hda_codec *); +#define HDA_CODEC_ID_SKIP_PROBE 0x00000001 #define HDA_CODEC_ID_GENERIC_HDMI 0x00000101 #define HDA_CODEC_ID_GENERIC 0x00000201 @@ -258,6 +259,7 @@ unsigned int power_save_node:1; /* advanced PM for each widget */ unsigned int auto_runtime_pm:1; /* enable automatic codec runtime pm */ unsigned int force_pin_prefix:1; /* Add location prefix */ + unsigned int link_down_at_suspend:1; /* link down at runtime suspend */ #ifdef CONFIG_PM unsigned long power_on_acct; unsigned long power_off_acct; @@ -307,6 +309,8 @@ */ int snd_hda_codec_new(struct hda_bus *bus, struct snd_card *card, unsigned int codec_addr, struct hda_codec **codecp); +int snd_hda_codec_device_new(struct hda_bus *bus, struct snd_card *card, + unsigned int codec_addr, struct hda_codec *codec); int snd_hda_codec_configure(struct hda_codec *codec); int snd_hda_codec_update_widgets(struct hda_codec *codec); @@ -381,9 +385,6 @@ return snd_hdac_regmap_write(&codec->core, nid, verb, parm); } -#define snd_hda_codec_update_cache(codec, nid, flags, verb, parm) \ - snd_hda_codec_write_cache(codec, nid, flags, verb, parm) - /* the struct for codec->pin_configs */ struct hda_pincfg { hda_nid_t nid; diff -Nru oem-audio-hda-daily-lts-xenial-dkms-0.201807310409~ubuntu14.04.1/hda-src-from-tree/hdacore/ext/hdac_ext_bus.c oem-audio-hda-daily-lts-xenial-dkms-0.201808040346~ubuntu14.04.1/hda-src-from-tree/hdacore/ext/hdac_ext_bus.c --- oem-audio-hda-daily-lts-xenial-dkms-0.201807310409~ubuntu14.04.1/hda-src-from-tree/hdacore/ext/hdac_ext_bus.c 2018-07-31 04:09:29.000000000 +0000 +++ oem-audio-hda-daily-lts-xenial-dkms-0.201808040346~ubuntu14.04.1/hda-src-from-tree/hdacore/ext/hdac_ext_bus.c 2018-08-04 03:46:28.000000000 +0000 @@ -87,9 +87,10 @@ * * Returns 0 if successful, or a negative error code. */ -int snd_hdac_ext_bus_init(struct hdac_ext_bus *ebus, struct device *dev, +int snd_hdac_ext_bus_init(struct hdac_bus *bus, struct device *dev, const struct hdac_bus_ops *ops, - const struct hdac_io_ops *io_ops) + const struct hdac_io_ops *io_ops, + const struct hdac_ext_bus_ops *ext_ops) { int ret; static int idx; @@ -98,15 +99,16 @@ if (io_ops == NULL) io_ops = &hdac_ext_default_io; - ret = snd_hdac_bus_init(&ebus->bus, dev, ops, io_ops); + ret = snd_hdac_bus_init(bus, dev, ops, io_ops); if (ret < 0) return ret; - INIT_LIST_HEAD(&ebus->hlink_list); - ebus->idx = idx++; + bus->ext_ops = ext_ops; + INIT_LIST_HEAD(&bus->hlink_list); + bus->idx = idx++; - mutex_init(&ebus->lock); - ebus->cmd_dma_state = true; + mutex_init(&bus->lock); + bus->cmd_dma_state = true; return 0; } @@ -116,10 +118,10 @@ * snd_hdac_ext_bus_exit - clean up a HD-audio extended bus * @ebus: the pointer to extended bus object */ -void snd_hdac_ext_bus_exit(struct hdac_ext_bus *ebus) +void snd_hdac_ext_bus_exit(struct hdac_bus *bus) { - snd_hdac_bus_exit(&ebus->bus); - WARN_ON(!list_empty(&ebus->hlink_list)); + snd_hdac_bus_exit(bus); + WARN_ON(!list_empty(&bus->hlink_list)); } EXPORT_SYMBOL_GPL(snd_hdac_ext_bus_exit); @@ -135,21 +137,15 @@ * * Returns zero for success or a negative error code. */ -int snd_hdac_ext_bus_device_init(struct hdac_ext_bus *ebus, int addr) +int snd_hdac_ext_bus_device_init(struct hdac_bus *bus, int addr, + struct hdac_device *hdev) { - struct hdac_ext_device *edev; - struct hdac_device *hdev = NULL; - struct hdac_bus *bus = ebus_to_hbus(ebus); char name[15]; int ret; - edev = kzalloc(sizeof(*edev), GFP_KERNEL); - if (!edev) - return -ENOMEM; - hdev = &edev->hdev; - edev->ebus = ebus; + hdev->bus = bus; - snprintf(name, sizeof(name), "ehdaudio%dD%d", ebus->idx, addr); + snprintf(name, sizeof(name), "ehdaudio%dD%d", bus->idx, addr); ret = snd_hdac_device_init(hdev, bus, name, addr); if (ret < 0) { @@ -176,10 +172,8 @@ */ void snd_hdac_ext_bus_device_exit(struct hdac_device *hdev) { - struct hdac_ext_device *edev = to_ehdac_device(hdev); - snd_hdac_device_exit(hdev); - kfree(edev); + kfree(hdev); } EXPORT_SYMBOL_GPL(snd_hdac_ext_bus_device_exit); @@ -188,14 +182,14 @@ * * @ebus: HD-audio extended bus */ -void snd_hdac_ext_bus_device_remove(struct hdac_ext_bus *ebus) +void snd_hdac_ext_bus_device_remove(struct hdac_bus *bus) { struct hdac_device *codec, *__codec; /* * we need to remove all the codec devices objects created in the * snd_hdac_ext_bus_device_init */ - list_for_each_entry_safe(codec, __codec, &ebus->bus.codec_list, list) { + list_for_each_entry_safe(codec, __codec, &bus->codec_list, list) { snd_hdac_device_unregister(codec); put_device(&codec->dev); } @@ -204,35 +198,31 @@ #define dev_to_hdac(dev) (container_of((dev), \ struct hdac_device, dev)) -static inline struct hdac_ext_driver *get_edrv(struct device *dev) +static inline struct hdac_driver *get_hdrv(struct device *dev) { struct hdac_driver *hdrv = drv_to_hdac_driver(dev->driver); - struct hdac_ext_driver *edrv = to_ehdac_driver(hdrv); - - return edrv; + return hdrv; } -static inline struct hdac_ext_device *get_edev(struct device *dev) +static inline struct hdac_device *get_hdev(struct device *dev) { struct hdac_device *hdev = dev_to_hdac_dev(dev); - struct hdac_ext_device *edev = to_ehdac_device(hdev); - - return edev; + return hdev; } static int hda_ext_drv_probe(struct device *dev) { - return (get_edrv(dev))->probe(get_edev(dev)); + return (get_hdrv(dev))->probe(get_hdev(dev)); } static int hdac_ext_drv_remove(struct device *dev) { - return (get_edrv(dev))->remove(get_edev(dev)); + return (get_hdrv(dev))->remove(get_hdev(dev)); } static void hdac_ext_drv_shutdown(struct device *dev) { - return (get_edrv(dev))->shutdown(get_edev(dev)); + return (get_hdrv(dev))->shutdown(get_hdev(dev)); } /** @@ -240,20 +230,20 @@ * * @drv: ext hda driver structure */ -int snd_hda_ext_driver_register(struct hdac_ext_driver *drv) +int snd_hda_ext_driver_register(struct hdac_driver *drv) { - drv->hdac.type = HDA_DEV_ASOC; - drv->hdac.driver.bus = &snd_hda_bus_type; + drv->type = HDA_DEV_ASOC; + drv->driver.bus = &snd_hda_bus_type; /* we use default match */ if (drv->probe) - drv->hdac.driver.probe = hda_ext_drv_probe; + drv->driver.probe = hda_ext_drv_probe; if (drv->remove) - drv->hdac.driver.remove = hdac_ext_drv_remove; + drv->driver.remove = hdac_ext_drv_remove; if (drv->shutdown) - drv->hdac.driver.shutdown = hdac_ext_drv_shutdown; + drv->driver.shutdown = hdac_ext_drv_shutdown; - return driver_register(&drv->hdac.driver); + return driver_register(&drv->driver); } EXPORT_SYMBOL_GPL(snd_hda_ext_driver_register); @@ -262,8 +252,8 @@ * * @drv: ext hda driver structure */ -void snd_hda_ext_driver_unregister(struct hdac_ext_driver *drv) +void snd_hda_ext_driver_unregister(struct hdac_driver *drv) { - driver_unregister(&drv->hdac.driver); + driver_unregister(&drv->driver); } EXPORT_SYMBOL_GPL(snd_hda_ext_driver_unregister); diff -Nru oem-audio-hda-daily-lts-xenial-dkms-0.201807310409~ubuntu14.04.1/hda-src-from-tree/hdacore/ext/hdac_ext_controller.c oem-audio-hda-daily-lts-xenial-dkms-0.201808040346~ubuntu14.04.1/hda-src-from-tree/hdacore/ext/hdac_ext_controller.c --- oem-audio-hda-daily-lts-xenial-dkms-0.201807310409~ubuntu14.04.1/hda-src-from-tree/hdacore/ext/hdac_ext_controller.c 2018-07-31 04:09:29.000000000 +0000 +++ oem-audio-hda-daily-lts-xenial-dkms-0.201808040346~ubuntu14.04.1/hda-src-from-tree/hdacore/ext/hdac_ext_controller.c 2018-08-04 03:46:28.000000000 +0000 @@ -39,9 +39,8 @@ * @ebus: HD-audio extended core bus * @enable: flag to turn on/off the capability */ -void snd_hdac_ext_bus_ppcap_enable(struct hdac_ext_bus *ebus, bool enable) +void snd_hdac_ext_bus_ppcap_enable(struct hdac_bus *bus, bool enable) { - struct hdac_bus *bus = &ebus->bus; if (!bus->ppcap) { dev_err(bus->dev, "Address of PP capability is NULL"); @@ -60,9 +59,8 @@ * @ebus: HD-audio extended core bus * @enable: flag to enable/disable interrupt */ -void snd_hdac_ext_bus_ppcap_int_enable(struct hdac_ext_bus *ebus, bool enable) +void snd_hdac_ext_bus_ppcap_int_enable(struct hdac_bus *bus, bool enable) { - struct hdac_bus *bus = &ebus->bus; if (!bus->ppcap) { dev_err(bus->dev, "Address of PP capability is NULL\n"); @@ -89,12 +87,11 @@ * in hlink_list of extended hdac bus * Note: this will be freed on bus exit by driver */ -int snd_hdac_ext_bus_get_ml_capabilities(struct hdac_ext_bus *ebus) +int snd_hdac_ext_bus_get_ml_capabilities(struct hdac_bus *bus) { int idx; u32 link_count; struct hdac_ext_link *hlink; - struct hdac_bus *bus = &ebus->bus; link_count = readl(bus->mlcap + AZX_REG_ML_MLCD) + 1; @@ -114,7 +111,7 @@ /* since link in On, update the ref */ hlink->ref_count = 1; - list_add_tail(&hlink->list, &ebus->hlink_list); + list_add_tail(&hlink->list, &bus->hlink_list); } return 0; @@ -127,12 +124,12 @@ * @ebus: HD-audio ext core bus */ -void snd_hdac_link_free_all(struct hdac_ext_bus *ebus) +void snd_hdac_link_free_all(struct hdac_bus *bus) { struct hdac_ext_link *l; - while (!list_empty(&ebus->hlink_list)) { - l = list_first_entry(&ebus->hlink_list, struct hdac_ext_link, list); + while (!list_empty(&bus->hlink_list)) { + l = list_first_entry(&bus->hlink_list, struct hdac_ext_link, list); list_del(&l->list); kfree(l); } @@ -144,7 +141,7 @@ * @ebus: HD-audio extended core bus * @codec_name: codec name */ -struct hdac_ext_link *snd_hdac_ext_bus_get_link(struct hdac_ext_bus *ebus, +struct hdac_ext_link *snd_hdac_ext_bus_get_link(struct hdac_bus *bus, const char *codec_name) { int i; @@ -153,10 +150,10 @@ if (sscanf(codec_name, "ehdaudio%dD%d", &bus_idx, &addr) != 2) return NULL; - if (ebus->idx != bus_idx) + if (bus->idx != bus_idx) return NULL; - list_for_each_entry(hlink, &ebus->hlink_list, list) { + list_for_each_entry(hlink, &bus->hlink_list, list) { for (i = 0; i < HDA_MAX_CODECS; i++) { if (hlink->lsdiid & (0x1 << addr)) return hlink; @@ -219,12 +216,12 @@ * snd_hdac_ext_bus_link_power_up_all -power up all hda link * @ebus: HD-audio extended bus */ -int snd_hdac_ext_bus_link_power_up_all(struct hdac_ext_bus *ebus) +int snd_hdac_ext_bus_link_power_up_all(struct hdac_bus *bus) { struct hdac_ext_link *hlink = NULL; int ret; - list_for_each_entry(hlink, &ebus->hlink_list, list) { + list_for_each_entry(hlink, &bus->hlink_list, list) { snd_hdac_updatel(hlink->ml_addr, AZX_REG_ML_LCTL, 0, AZX_MLCTL_SPA); ret = check_hdac_link_power_active(hlink, true); @@ -240,12 +237,12 @@ * snd_hdac_ext_bus_link_power_down_all -power down all hda link * @ebus: HD-audio extended bus */ -int snd_hdac_ext_bus_link_power_down_all(struct hdac_ext_bus *ebus) +int snd_hdac_ext_bus_link_power_down_all(struct hdac_bus *bus) { struct hdac_ext_link *hlink = NULL; int ret; - list_for_each_entry(hlink, &ebus->hlink_list, list) { + list_for_each_entry(hlink, &bus->hlink_list, list) { snd_hdac_updatel(hlink->ml_addr, AZX_REG_ML_LCTL, AZX_MLCTL_SPA, 0); ret = check_hdac_link_power_active(hlink, false); if (ret < 0) @@ -256,39 +253,48 @@ } EXPORT_SYMBOL_GPL(snd_hdac_ext_bus_link_power_down_all); -int snd_hdac_ext_bus_link_get(struct hdac_ext_bus *ebus, +int snd_hdac_ext_bus_link_get(struct hdac_bus *bus, struct hdac_ext_link *link) { int ret = 0; - mutex_lock(&ebus->lock); + mutex_lock(&bus->lock); /* * if we move from 0 to 1, count will be 1 so power up this link * as well, also check the dma status and trigger that */ if (++link->ref_count == 1) { - if (!ebus->cmd_dma_state) { - snd_hdac_bus_init_cmd_io(&ebus->bus); - ebus->cmd_dma_state = true; + if (!bus->cmd_dma_state) { + snd_hdac_bus_init_cmd_io(bus); + bus->cmd_dma_state = true; } ret = snd_hdac_ext_bus_link_power_up(link); + + /* + * wait for 521usec for codec to report status + * HDA spec section 4.3 - Codec Discovery + */ + udelay(521); + bus->codec_mask = snd_hdac_chip_readw(bus, STATESTS); + dev_dbg(bus->dev, "codec_mask = 0x%lx\n", bus->codec_mask); + snd_hdac_chip_writew(bus, STATESTS, bus->codec_mask); } - mutex_unlock(&ebus->lock); + mutex_unlock(&bus->lock); return ret; } EXPORT_SYMBOL_GPL(snd_hdac_ext_bus_link_get); -int snd_hdac_ext_bus_link_put(struct hdac_ext_bus *ebus, +int snd_hdac_ext_bus_link_put(struct hdac_bus *bus, struct hdac_ext_link *link) { int ret = 0; struct hdac_ext_link *hlink; bool link_up = false; - mutex_lock(&ebus->lock); + mutex_lock(&bus->lock); /* * if we move from 1 to 0, count will be 0 @@ -301,7 +307,7 @@ * now check if all links are off, if so turn off * cmd dma as well */ - list_for_each_entry(hlink, &ebus->hlink_list, list) { + list_for_each_entry(hlink, &bus->hlink_list, list) { if (hlink->ref_count) { link_up = true; break; @@ -309,12 +315,12 @@ } if (!link_up) { - snd_hdac_bus_stop_cmd_io(&ebus->bus); - ebus->cmd_dma_state = false; + snd_hdac_bus_stop_cmd_io(bus); + bus->cmd_dma_state = false; } } - mutex_unlock(&ebus->lock); + mutex_unlock(&bus->lock); return ret; } EXPORT_SYMBOL_GPL(snd_hdac_ext_bus_link_put); diff -Nru oem-audio-hda-daily-lts-xenial-dkms-0.201807310409~ubuntu14.04.1/hda-src-from-tree/hdacore/ext/hdac_ext_stream.c oem-audio-hda-daily-lts-xenial-dkms-0.201808040346~ubuntu14.04.1/hda-src-from-tree/hdacore/ext/hdac_ext_stream.c --- oem-audio-hda-daily-lts-xenial-dkms-0.201807310409~ubuntu14.04.1/hda-src-from-tree/hdacore/ext/hdac_ext_stream.c 2018-07-31 04:09:29.000000000 +0000 +++ oem-audio-hda-daily-lts-xenial-dkms-0.201808040346~ubuntu14.04.1/hda-src-from-tree/hdacore/ext/hdac_ext_stream.c 2018-08-04 03:46:28.000000000 +0000 @@ -25,7 +25,7 @@ /** * snd_hdac_ext_stream_init - initialize each stream (aka device) - * @ebus: HD-audio ext core bus + * @bus: HD-audio core bus * @stream: HD-audio ext core stream object to initialize * @idx: stream index number * @direction: stream direction (SNDRV_PCM_STREAM_PLAYBACK or SNDRV_PCM_STREAM_CAPTURE) @@ -34,18 +34,16 @@ * initialize the stream, if ppcap is enabled then init those and then * invoke hdac stream initialization routine */ -void snd_hdac_ext_stream_init(struct hdac_ext_bus *ebus, +void snd_hdac_ext_stream_init(struct hdac_bus *bus, struct hdac_ext_stream *stream, int idx, int direction, int tag) { - struct hdac_bus *bus = &ebus->bus; - if (bus->ppcap) { stream->pphc_addr = bus->ppcap + AZX_PPHC_BASE + AZX_PPHC_INTERVAL * idx; stream->pplc_addr = bus->ppcap + AZX_PPLC_BASE + - AZX_PPLC_MULTI * ebus->num_streams + + AZX_PPLC_MULTI * bus->num_streams + AZX_PPLC_INTERVAL * idx; } @@ -71,12 +69,12 @@ /** * snd_hdac_ext_stream_init_all - create and initialize the stream objects * for an extended hda bus - * @ebus: HD-audio ext core bus + * @bus: HD-audio core bus * @start_idx: start index for streams * @num_stream: number of streams to initialize * @dir: direction of streams */ -int snd_hdac_ext_stream_init_all(struct hdac_ext_bus *ebus, int start_idx, +int snd_hdac_ext_stream_init_all(struct hdac_bus *bus, int start_idx, int num_stream, int dir) { int stream_tag = 0; @@ -88,7 +86,7 @@ if (!stream) return -ENOMEM; tag = ++stream_tag; - snd_hdac_ext_stream_init(ebus, stream, idx, dir, tag); + snd_hdac_ext_stream_init(bus, stream, idx, dir, tag); idx++; } @@ -100,17 +98,16 @@ /** * snd_hdac_stream_free_all - free hdac extended stream objects * - * @ebus: HD-audio ext core bus + * @bus: HD-audio core bus */ -void snd_hdac_stream_free_all(struct hdac_ext_bus *ebus) +void snd_hdac_stream_free_all(struct hdac_bus *bus) { struct hdac_stream *s, *_s; struct hdac_ext_stream *stream; - struct hdac_bus *bus = ebus_to_hbus(ebus); list_for_each_entry_safe(s, _s, &bus->stream_list, list) { stream = stream_to_hdac_ext_stream(s); - snd_hdac_ext_stream_decouple(ebus, stream, false); + snd_hdac_ext_stream_decouple(bus, stream, false); list_del(&s->list); kfree(stream); } @@ -119,15 +116,14 @@ /** * snd_hdac_ext_stream_decouple - decouple the hdac stream - * @ebus: HD-audio ext core bus + * @bus: HD-audio core bus * @stream: HD-audio ext core stream object to initialize * @decouple: flag to decouple */ -void snd_hdac_ext_stream_decouple(struct hdac_ext_bus *ebus, +void snd_hdac_ext_stream_decouple(struct hdac_bus *bus, struct hdac_ext_stream *stream, bool decouple) { struct hdac_stream *hstream = &stream->hstream; - struct hdac_bus *bus = &ebus->bus; u32 val; int mask = AZX_PPCTL_PROCEN(hstream->index); @@ -251,19 +247,18 @@ EXPORT_SYMBOL_GPL(snd_hdac_ext_link_clear_stream_id); static struct hdac_ext_stream * -hdac_ext_link_stream_assign(struct hdac_ext_bus *ebus, +hdac_ext_link_stream_assign(struct hdac_bus *bus, struct snd_pcm_substream *substream) { struct hdac_ext_stream *res = NULL; struct hdac_stream *stream = NULL; - struct hdac_bus *hbus = &ebus->bus; - if (!hbus->ppcap) { - dev_err(hbus->dev, "stream type not supported\n"); + if (!bus->ppcap) { + dev_err(bus->dev, "stream type not supported\n"); return NULL; } - list_for_each_entry(stream, &hbus->stream_list, list) { + list_for_each_entry(stream, &bus->stream_list, list) { struct hdac_ext_stream *hstream = container_of(stream, struct hdac_ext_stream, hstream); @@ -277,34 +272,33 @@ } if (!hstream->link_locked) { - snd_hdac_ext_stream_decouple(ebus, hstream, true); + snd_hdac_ext_stream_decouple(bus, hstream, true); res = hstream; break; } } if (res) { - spin_lock_irq(&hbus->reg_lock); + spin_lock_irq(&bus->reg_lock); res->link_locked = 1; res->link_substream = substream; - spin_unlock_irq(&hbus->reg_lock); + spin_unlock_irq(&bus->reg_lock); } return res; } static struct hdac_ext_stream * -hdac_ext_host_stream_assign(struct hdac_ext_bus *ebus, +hdac_ext_host_stream_assign(struct hdac_bus *bus, struct snd_pcm_substream *substream) { struct hdac_ext_stream *res = NULL; struct hdac_stream *stream = NULL; - struct hdac_bus *hbus = &ebus->bus; - if (!hbus->ppcap) { - dev_err(hbus->dev, "stream type not supported\n"); + if (!bus->ppcap) { + dev_err(bus->dev, "stream type not supported\n"); return NULL; } - list_for_each_entry(stream, &hbus->stream_list, list) { + list_for_each_entry(stream, &bus->stream_list, list) { struct hdac_ext_stream *hstream = container_of(stream, struct hdac_ext_stream, hstream); @@ -313,17 +307,17 @@ if (!stream->opened) { if (!hstream->decoupled) - snd_hdac_ext_stream_decouple(ebus, hstream, true); + snd_hdac_ext_stream_decouple(bus, hstream, true); res = hstream; break; } } if (res) { - spin_lock_irq(&hbus->reg_lock); + spin_lock_irq(&bus->reg_lock); res->hstream.opened = 1; res->hstream.running = 0; res->hstream.substream = substream; - spin_unlock_irq(&hbus->reg_lock); + spin_unlock_irq(&bus->reg_lock); } return res; @@ -331,7 +325,7 @@ /** * snd_hdac_ext_stream_assign - assign a stream for the PCM - * @ebus: HD-audio ext core bus + * @bus: HD-audio core bus * @substream: PCM substream to assign * @type: type of stream (coupled, host or link stream) * @@ -346,27 +340,26 @@ * the same stream object when it's used beforehand. when a stream is * decoupled, it becomes a host stream and link stream. */ -struct hdac_ext_stream *snd_hdac_ext_stream_assign(struct hdac_ext_bus *ebus, +struct hdac_ext_stream *snd_hdac_ext_stream_assign(struct hdac_bus *bus, struct snd_pcm_substream *substream, int type) { struct hdac_ext_stream *hstream = NULL; struct hdac_stream *stream = NULL; - struct hdac_bus *hbus = &ebus->bus; switch (type) { case HDAC_EXT_STREAM_TYPE_COUPLED: - stream = snd_hdac_stream_assign(hbus, substream); + stream = snd_hdac_stream_assign(bus, substream); if (stream) hstream = container_of(stream, struct hdac_ext_stream, hstream); return hstream; case HDAC_EXT_STREAM_TYPE_HOST: - return hdac_ext_host_stream_assign(ebus, substream); + return hdac_ext_host_stream_assign(bus, substream); case HDAC_EXT_STREAM_TYPE_LINK: - return hdac_ext_link_stream_assign(ebus, substream); + return hdac_ext_link_stream_assign(bus, substream); default: return NULL; @@ -384,7 +377,6 @@ void snd_hdac_ext_stream_release(struct hdac_ext_stream *stream, int type) { struct hdac_bus *bus = stream->hstream.bus; - struct hdac_ext_bus *ebus = hbus_to_ebus(bus); switch (type) { case HDAC_EXT_STREAM_TYPE_COUPLED: @@ -393,13 +385,13 @@ case HDAC_EXT_STREAM_TYPE_HOST: if (stream->decoupled && !stream->link_locked) - snd_hdac_ext_stream_decouple(ebus, stream, false); + snd_hdac_ext_stream_decouple(bus, stream, false); snd_hdac_stream_release(&stream->hstream); break; case HDAC_EXT_STREAM_TYPE_LINK: if (stream->decoupled && !stream->hstream.opened) - snd_hdac_ext_stream_decouple(ebus, stream, false); + snd_hdac_ext_stream_decouple(bus, stream, false); spin_lock_irq(&bus->reg_lock); stream->link_locked = 0; stream->link_substream = NULL; @@ -415,16 +407,15 @@ /** * snd_hdac_ext_stream_spbcap_enable - enable SPIB for a stream - * @ebus: HD-audio ext core bus + * @bus: HD-audio core bus * @enable: flag to enable/disable SPIB * @index: stream index for which SPIB need to be enabled */ -void snd_hdac_ext_stream_spbcap_enable(struct hdac_ext_bus *ebus, +void snd_hdac_ext_stream_spbcap_enable(struct hdac_bus *bus, bool enable, int index) { u32 mask = 0; u32 register_mask = 0; - struct hdac_bus *bus = &ebus->bus; if (!bus->spbcap) { dev_err(bus->dev, "Address of SPB capability is NULL\n"); @@ -446,14 +437,13 @@ /** * snd_hdac_ext_stream_set_spib - sets the spib value of a stream - * @ebus: HD-audio ext core bus + * @bus: HD-audio core bus * @stream: hdac_ext_stream * @value: spib value to set */ -int snd_hdac_ext_stream_set_spib(struct hdac_ext_bus *ebus, +int snd_hdac_ext_stream_set_spib(struct hdac_bus *bus, struct hdac_ext_stream *stream, u32 value) { - struct hdac_bus *bus = &ebus->bus; if (!bus->spbcap) { dev_err(bus->dev, "Address of SPB capability is NULL\n"); @@ -468,15 +458,14 @@ /** * snd_hdac_ext_stream_get_spbmaxfifo - gets the spib value of a stream - * @ebus: HD-audio ext core bus + * @bus: HD-audio core bus * @stream: hdac_ext_stream * * Return maxfifo for the stream */ -int snd_hdac_ext_stream_get_spbmaxfifo(struct hdac_ext_bus *ebus, +int snd_hdac_ext_stream_get_spbmaxfifo(struct hdac_bus *bus, struct hdac_ext_stream *stream) { - struct hdac_bus *bus = &ebus->bus; if (!bus->spbcap) { dev_err(bus->dev, "Address of SPB capability is NULL\n"); @@ -490,11 +479,10 @@ /** * snd_hdac_ext_stop_streams - stop all stream if running - * @ebus: HD-audio ext core bus + * @bus: HD-audio core bus */ -void snd_hdac_ext_stop_streams(struct hdac_ext_bus *ebus) +void snd_hdac_ext_stop_streams(struct hdac_bus *bus) { - struct hdac_bus *bus = ebus_to_hbus(ebus); struct hdac_stream *stream; if (bus->chip_init) { @@ -507,16 +495,15 @@ /** * snd_hdac_ext_stream_drsm_enable - enable DMA resume for a stream - * @ebus: HD-audio ext core bus + * @bus: HD-audio core bus * @enable: flag to enable/disable DRSM * @index: stream index for which DRSM need to be enabled */ -void snd_hdac_ext_stream_drsm_enable(struct hdac_ext_bus *ebus, +void snd_hdac_ext_stream_drsm_enable(struct hdac_bus *bus, bool enable, int index) { u32 mask = 0; u32 register_mask = 0; - struct hdac_bus *bus = &ebus->bus; if (!bus->drsmcap) { dev_err(bus->dev, "Address of DRSM capability is NULL\n"); @@ -538,14 +525,13 @@ /** * snd_hdac_ext_stream_set_dpibr - sets the dpibr value of a stream - * @ebus: HD-audio ext core bus + * @bus: HD-audio core bus * @stream: hdac_ext_stream * @value: dpib value to set */ -int snd_hdac_ext_stream_set_dpibr(struct hdac_ext_bus *ebus, +int snd_hdac_ext_stream_set_dpibr(struct hdac_bus *bus, struct hdac_ext_stream *stream, u32 value) { - struct hdac_bus *bus = &ebus->bus; if (!bus->drsmcap) { dev_err(bus->dev, "Address of DRSM capability is NULL\n"); @@ -560,7 +546,7 @@ /** * snd_hdac_ext_stream_set_lpib - sets the lpib value of a stream - * @ebus: HD-audio ext core bus + * @bus: HD-audio core bus * @stream: hdac_ext_stream * @value: lpib value to set */ diff -Nru oem-audio-hda-daily-lts-xenial-dkms-0.201807310409~ubuntu14.04.1/hda-src-from-tree/hdacore/hdac_component.c oem-audio-hda-daily-lts-xenial-dkms-0.201808040346~ubuntu14.04.1/hda-src-from-tree/hdacore/hdac_component.c --- oem-audio-hda-daily-lts-xenial-dkms-0.201807310409~ubuntu14.04.1/hda-src-from-tree/hdacore/hdac_component.c 1970-01-01 00:00:00.000000000 +0000 +++ oem-audio-hda-daily-lts-xenial-dkms-0.201808040346~ubuntu14.04.1/hda-src-from-tree/hdacore/hdac_component.c 2018-08-04 03:46:28.000000000 +0000 @@ -0,0 +1,335 @@ +// SPDX-License-Identifier: GPL-2.0 +// hdac_component.c - routines for sync between HD-A core and DRM driver + +#include +#include +#include +#include +#include +#include +#include +#include + +static void hdac_acomp_release(struct device *dev, void *res) +{ +} + +static struct drm_audio_component *hdac_get_acomp(struct device *dev) +{ + return devres_find(dev, hdac_acomp_release, NULL, NULL); +} + +/** + * snd_hdac_set_codec_wakeup - Enable / disable HDMI/DP codec wakeup + * @bus: HDA core bus + * @enable: enable or disable the wakeup + * + * This function is supposed to be used only by a HD-audio controller + * driver that needs the interaction with graphics driver. + * + * This function should be called during the chip reset, also called at + * resume for updating STATESTS register read. + * + * Returns zero for success or a negative error code. + */ +int snd_hdac_set_codec_wakeup(struct hdac_bus *bus, bool enable) +{ + struct drm_audio_component *acomp = bus->audio_component; + + if (!acomp || !acomp->ops) + return -ENODEV; + + if (!acomp->ops->codec_wake_override) + return 0; + + dev_dbg(bus->dev, "%s codec wakeup\n", + enable ? "enable" : "disable"); + + acomp->ops->codec_wake_override(acomp->dev, enable); + + return 0; +} +EXPORT_SYMBOL_GPL(snd_hdac_set_codec_wakeup); + +/** + * snd_hdac_display_power - Power up / down the power refcount + * @bus: HDA core bus + * @enable: power up or down + * + * This function is supposed to be used only by a HD-audio controller + * driver that needs the interaction with graphics driver. + * + * This function manages a refcount and calls the get_power() and + * put_power() ops accordingly, toggling the codec wakeup, too. + * + * Returns zero for success or a negative error code. + */ +int snd_hdac_display_power(struct hdac_bus *bus, bool enable) +{ + struct drm_audio_component *acomp = bus->audio_component; + + if (!acomp || !acomp->ops) + return -ENODEV; + + dev_dbg(bus->dev, "display power %s\n", + enable ? "enable" : "disable"); + + if (enable) { + if (!bus->drm_power_refcount++) { + if (acomp->ops->get_power) + acomp->ops->get_power(acomp->dev); + snd_hdac_set_codec_wakeup(bus, true); + snd_hdac_set_codec_wakeup(bus, false); + } + } else { + WARN_ON(!bus->drm_power_refcount); + if (!--bus->drm_power_refcount) + if (acomp->ops->put_power) + acomp->ops->put_power(acomp->dev); + } + + return 0; +} +EXPORT_SYMBOL_GPL(snd_hdac_display_power); + +/** + * snd_hdac_sync_audio_rate - Set N/CTS based on the sample rate + * @codec: HDA codec + * @nid: the pin widget NID + * @dev_id: device identifier + * @rate: the sample rate to set + * + * This function is supposed to be used only by a HD-audio controller + * driver that needs the interaction with graphics driver. + * + * This function sets N/CTS value based on the given sample rate. + * Returns zero for success, or a negative error code. + */ +int snd_hdac_sync_audio_rate(struct hdac_device *codec, hda_nid_t nid, + int dev_id, int rate) +{ + struct hdac_bus *bus = codec->bus; + struct drm_audio_component *acomp = bus->audio_component; + int port, pipe; + + if (!acomp || !acomp->ops || !acomp->ops->sync_audio_rate) + return -ENODEV; + port = nid; + if (acomp->audio_ops && acomp->audio_ops->pin2port) { + port = acomp->audio_ops->pin2port(codec, nid); + if (port < 0) + return -EINVAL; + } + pipe = dev_id; + return acomp->ops->sync_audio_rate(acomp->dev, port, pipe, rate); +} +EXPORT_SYMBOL_GPL(snd_hdac_sync_audio_rate); + +/** + * snd_hdac_acomp_get_eld - Get the audio state and ELD via component + * @codec: HDA codec + * @nid: the pin widget NID + * @dev_id: device identifier + * @audio_enabled: the pointer to store the current audio state + * @buffer: the buffer pointer to store ELD bytes + * @max_bytes: the max bytes to be stored on @buffer + * + * This function is supposed to be used only by a HD-audio controller + * driver that needs the interaction with graphics driver. + * + * This function queries the current state of the audio on the given + * digital port and fetches the ELD bytes onto the given buffer. + * It returns the number of bytes for the total ELD data, zero for + * invalid ELD, or a negative error code. + * + * The return size is the total bytes required for the whole ELD bytes, + * thus it may be over @max_bytes. If it's over @max_bytes, it implies + * that only a part of ELD bytes have been fetched. + */ +int snd_hdac_acomp_get_eld(struct hdac_device *codec, hda_nid_t nid, int dev_id, + bool *audio_enabled, char *buffer, int max_bytes) +{ + struct hdac_bus *bus = codec->bus; + struct drm_audio_component *acomp = bus->audio_component; + int port, pipe; + + if (!acomp || !acomp->ops || !acomp->ops->get_eld) + return -ENODEV; + + port = nid; + if (acomp->audio_ops && acomp->audio_ops->pin2port) { + port = acomp->audio_ops->pin2port(codec, nid); + if (port < 0) + return -EINVAL; + } + pipe = dev_id; + return acomp->ops->get_eld(acomp->dev, port, pipe, audio_enabled, + buffer, max_bytes); +} +EXPORT_SYMBOL_GPL(snd_hdac_acomp_get_eld); + +static int hdac_component_master_bind(struct device *dev) +{ + struct drm_audio_component *acomp = hdac_get_acomp(dev); + int ret; + + if (WARN_ON(!acomp)) + return -EINVAL; + + ret = component_bind_all(dev, acomp); + if (ret < 0) + return ret; + + if (WARN_ON(!(acomp->dev && acomp->ops))) { + ret = -EINVAL; + goto out_unbind; + } + + /* pin the module to avoid dynamic unbinding, but only if given */ + if (!try_module_get(acomp->ops->owner)) { + ret = -ENODEV; + goto out_unbind; + } + + if (acomp->audio_ops && acomp->audio_ops->master_bind) { + ret = acomp->audio_ops->master_bind(dev, acomp); + if (ret < 0) + goto module_put; + } + + return 0; + + module_put: + module_put(acomp->ops->owner); +out_unbind: + component_unbind_all(dev, acomp); + + return ret; +} + +static void hdac_component_master_unbind(struct device *dev) +{ + struct drm_audio_component *acomp = hdac_get_acomp(dev); + + if (acomp->audio_ops && acomp->audio_ops->master_unbind) + acomp->audio_ops->master_unbind(dev, acomp); + module_put(acomp->ops->owner); + component_unbind_all(dev, acomp); + WARN_ON(acomp->ops || acomp->dev); +} + +static const struct component_master_ops hdac_component_master_ops = { + .bind = hdac_component_master_bind, + .unbind = hdac_component_master_unbind, +}; + +/** + * snd_hdac_acomp_register_notifier - Register audio component ops + * @bus: HDA core bus + * @aops: audio component ops + * + * This function is supposed to be used only by a HD-audio controller + * driver that needs the interaction with graphics driver. + * + * This function sets the given ops to be called by the graphics driver. + * + * Returns zero for success or a negative error code. + */ +int snd_hdac_acomp_register_notifier(struct hdac_bus *bus, + const struct drm_audio_component_audio_ops *aops) +{ + if (!bus->audio_component) + return -ENODEV; + + bus->audio_component->audio_ops = aops; + return 0; +} +EXPORT_SYMBOL_GPL(snd_hdac_acomp_register_notifier); + +/** + * snd_hdac_acomp_init - Initialize audio component + * @bus: HDA core bus + * @match_master: match function for finding components + * @extra_size: Extra bytes to allocate + * + * This function is supposed to be used only by a HD-audio controller + * driver that needs the interaction with graphics driver. + * + * This function initializes and sets up the audio component to communicate + * with graphics driver. + * + * Unlike snd_hdac_i915_init(), this function doesn't synchronize with the + * binding with the DRM component. Each caller needs to sync via master_bind + * audio_ops. + * + * Returns zero for success or a negative error code. + */ +int snd_hdac_acomp_init(struct hdac_bus *bus, + const struct drm_audio_component_audio_ops *aops, + int (*match_master)(struct device *, void *), + size_t extra_size) +{ + struct component_match *match = NULL; + struct device *dev = bus->dev; + struct drm_audio_component *acomp; + int ret; + + if (WARN_ON(hdac_get_acomp(dev))) + return -EBUSY; + + acomp = devres_alloc(hdac_acomp_release, sizeof(*acomp) + extra_size, + GFP_KERNEL); + if (!acomp) + return -ENOMEM; + acomp->audio_ops = aops; + bus->audio_component = acomp; + devres_add(dev, acomp); + + component_match_add(dev, &match, match_master, bus); + ret = component_master_add_with_match(dev, &hdac_component_master_ops, + match); + if (ret < 0) + goto out_err; + + return 0; + +out_err: + bus->audio_component = NULL; + devres_destroy(dev, hdac_acomp_release, NULL, NULL); + dev_info(dev, "failed to add audio component master (%d)\n", ret); + + return ret; +} +EXPORT_SYMBOL_GPL(snd_hdac_acomp_init); + +/** + * snd_hdac_acomp_exit - Finalize audio component + * @bus: HDA core bus + * + * This function is supposed to be used only by a HD-audio controller + * driver that needs the interaction with graphics driver. + * + * This function releases the audio component that has been used. + * + * Returns zero for success or a negative error code. + */ +int snd_hdac_acomp_exit(struct hdac_bus *bus) +{ + struct device *dev = bus->dev; + struct drm_audio_component *acomp = bus->audio_component; + + if (!acomp) + return 0; + + WARN_ON(bus->drm_power_refcount); + if (bus->drm_power_refcount > 0 && acomp->ops) + acomp->ops->put_power(acomp->dev); + + component_master_del(dev, &hdac_component_master_ops); + + bus->audio_component = NULL; + devres_destroy(dev, hdac_acomp_release, NULL, NULL); + + return 0; +} +EXPORT_SYMBOL_GPL(snd_hdac_acomp_exit); diff -Nru oem-audio-hda-daily-lts-xenial-dkms-0.201807310409~ubuntu14.04.1/hda-src-from-tree/hdacore/hdac_device.c oem-audio-hda-daily-lts-xenial-dkms-0.201808040346~ubuntu14.04.1/hda-src-from-tree/hdacore/hdac_device.c --- oem-audio-hda-daily-lts-xenial-dkms-0.201807310409~ubuntu14.04.1/hda-src-from-tree/hdacore/hdac_device.c 2018-07-31 04:09:29.000000000 +0000 +++ oem-audio-hda-daily-lts-xenial-dkms-0.201808040346~ubuntu14.04.1/hda-src-from-tree/hdacore/hdac_device.c 2018-08-04 03:46:28.000000000 +0000 @@ -738,7 +738,7 @@ */ unsigned int snd_hdac_calc_stream_format(unsigned int rate, unsigned int channels, - unsigned int format, + snd_pcm_format_t format, unsigned int maxbps, unsigned short spdif_ctls) { diff -Nru oem-audio-hda-daily-lts-xenial-dkms-0.201807310409~ubuntu14.04.1/hda-src-from-tree/hdacore/hdac_i915.c oem-audio-hda-daily-lts-xenial-dkms-0.201808040346~ubuntu14.04.1/hda-src-from-tree/hdacore/hdac_i915.c --- oem-audio-hda-daily-lts-xenial-dkms-0.201807310409~ubuntu14.04.1/hda-src-from-tree/hdacore/hdac_i915.c 2018-07-31 04:09:29.000000000 +0000 +++ oem-audio-hda-daily-lts-xenial-dkms-0.201808040346~ubuntu14.04.1/hda-src-from-tree/hdacore/hdac_i915.c 2018-08-04 03:46:28.000000000 +0000 @@ -15,88 +15,12 @@ #include #include #include -#include -#include #include #include #include #include -static struct i915_audio_component *hdac_acomp; - -/** - * snd_hdac_set_codec_wakeup - Enable / disable HDMI/DP codec wakeup - * @bus: HDA core bus - * @enable: enable or disable the wakeup - * - * This function is supposed to be used only by a HD-audio controller - * driver that needs the interaction with i915 graphics. - * - * This function should be called during the chip reset, also called at - * resume for updating STATESTS register read. - * - * Returns zero for success or a negative error code. - */ -int snd_hdac_set_codec_wakeup(struct hdac_bus *bus, bool enable) -{ - struct i915_audio_component *acomp = bus->audio_component; - - if (!acomp || !acomp->ops) - return -ENODEV; - - if (!acomp->ops->codec_wake_override) { - dev_warn(bus->dev, - "Invalid codec wake callback\n"); - return 0; - } - - dev_dbg(bus->dev, "%s codec wakeup\n", - enable ? "enable" : "disable"); - - acomp->ops->codec_wake_override(acomp->dev, enable); - - return 0; -} -EXPORT_SYMBOL_GPL(snd_hdac_set_codec_wakeup); - -/** - * snd_hdac_display_power - Power up / down the power refcount - * @bus: HDA core bus - * @enable: power up or down - * - * This function is supposed to be used only by a HD-audio controller - * driver that needs the interaction with i915 graphics. - * - * This function manages a refcount and calls the i915 get_power() and - * put_power() ops accordingly, toggling the codec wakeup, too. - * - * Returns zero for success or a negative error code. - */ -int snd_hdac_display_power(struct hdac_bus *bus, bool enable) -{ - struct i915_audio_component *acomp = bus->audio_component; - - if (!acomp || !acomp->ops) - return -ENODEV; - - dev_dbg(bus->dev, "display power %s\n", - enable ? "enable" : "disable"); - - if (enable) { - if (!bus->i915_power_refcount++) { - acomp->ops->get_power(acomp->dev); - snd_hdac_set_codec_wakeup(bus, true); - snd_hdac_set_codec_wakeup(bus, false); - } - } else { - WARN_ON(!bus->i915_power_refcount); - if (!--bus->i915_power_refcount) - acomp->ops->put_power(acomp->dev); - } - - return 0; -} -EXPORT_SYMBOL_GPL(snd_hdac_display_power); +static struct completion bind_complete; #define CONTROLLER_IN_GPU(pci) (((pci)->device == 0x0a0c) || \ ((pci)->device == 0x0c0c) || \ @@ -119,7 +43,7 @@ */ void snd_hdac_i915_set_bclk(struct hdac_bus *bus) { - struct i915_audio_component *acomp = bus->audio_component; + struct drm_audio_component *acomp = bus->audio_component; struct pci_dev *pci = to_pci_dev(bus->dev); int cdclk_freq; unsigned int bclk_m, bclk_n; @@ -158,181 +82,11 @@ } EXPORT_SYMBOL_GPL(snd_hdac_i915_set_bclk); -/* There is a fixed mapping between audio pin node and display port. - * on SNB, IVY, HSW, BSW, SKL, BXT, KBL: - * Pin Widget 5 - PORT B (port = 1 in i915 driver) - * Pin Widget 6 - PORT C (port = 2 in i915 driver) - * Pin Widget 7 - PORT D (port = 3 in i915 driver) - * - * on VLV, ILK: - * Pin Widget 4 - PORT B (port = 1 in i915 driver) - * Pin Widget 5 - PORT C (port = 2 in i915 driver) - * Pin Widget 6 - PORT D (port = 3 in i915 driver) - */ -static int pin2port(struct hdac_device *codec, hda_nid_t pin_nid) -{ - int base_nid; - - switch (codec->vendor_id) { - case 0x80860054: /* ILK */ - case 0x80862804: /* ILK */ - case 0x80862882: /* VLV */ - base_nid = 3; - break; - default: - base_nid = 4; - break; - } - - if (WARN_ON(pin_nid <= base_nid || pin_nid > base_nid + 3)) - return -1; - return pin_nid - base_nid; -} - -/** - * snd_hdac_sync_audio_rate - Set N/CTS based on the sample rate - * @codec: HDA codec - * @nid: the pin widget NID - * @dev_id: device identifier - * @rate: the sample rate to set - * - * This function is supposed to be used only by a HD-audio controller - * driver that needs the interaction with i915 graphics. - * - * This function sets N/CTS value based on the given sample rate. - * Returns zero for success, or a negative error code. - */ -int snd_hdac_sync_audio_rate(struct hdac_device *codec, hda_nid_t nid, - int dev_id, int rate) -{ - struct hdac_bus *bus = codec->bus; - struct i915_audio_component *acomp = bus->audio_component; - int port, pipe; - - if (!acomp || !acomp->ops || !acomp->ops->sync_audio_rate) - return -ENODEV; - port = pin2port(codec, nid); - if (port < 0) - return -EINVAL; - pipe = dev_id; - return acomp->ops->sync_audio_rate(acomp->dev, port, pipe, rate); -} -EXPORT_SYMBOL_GPL(snd_hdac_sync_audio_rate); - -/** - * snd_hdac_acomp_get_eld - Get the audio state and ELD via component - * @codec: HDA codec - * @nid: the pin widget NID - * @dev_id: device identifier - * @audio_enabled: the pointer to store the current audio state - * @buffer: the buffer pointer to store ELD bytes - * @max_bytes: the max bytes to be stored on @buffer - * - * This function is supposed to be used only by a HD-audio controller - * driver that needs the interaction with i915 graphics. - * - * This function queries the current state of the audio on the given - * digital port and fetches the ELD bytes onto the given buffer. - * It returns the number of bytes for the total ELD data, zero for - * invalid ELD, or a negative error code. - * - * The return size is the total bytes required for the whole ELD bytes, - * thus it may be over @max_bytes. If it's over @max_bytes, it implies - * that only a part of ELD bytes have been fetched. - */ -int snd_hdac_acomp_get_eld(struct hdac_device *codec, hda_nid_t nid, int dev_id, - bool *audio_enabled, char *buffer, int max_bytes) -{ - struct hdac_bus *bus = codec->bus; - struct i915_audio_component *acomp = bus->audio_component; - int port, pipe; - - if (!acomp || !acomp->ops || !acomp->ops->get_eld) - return -ENODEV; - - port = pin2port(codec, nid); - if (port < 0) - return -EINVAL; - - pipe = dev_id; - return acomp->ops->get_eld(acomp->dev, port, pipe, audio_enabled, - buffer, max_bytes); -} -EXPORT_SYMBOL_GPL(snd_hdac_acomp_get_eld); - -static int hdac_component_master_bind(struct device *dev) -{ - struct i915_audio_component *acomp = hdac_acomp; - int ret; - - ret = component_bind_all(dev, acomp); - if (ret < 0) - return ret; - - if (WARN_ON(!(acomp->dev && acomp->ops && acomp->ops->get_power && - acomp->ops->put_power && acomp->ops->get_cdclk_freq))) { - ret = -EINVAL; - goto out_unbind; - } - - /* - * Atm, we don't support dynamic unbinding initiated by the child - * component, so pin its containing module until we unbind. - */ - if (!try_module_get(acomp->ops->owner)) { - ret = -ENODEV; - goto out_unbind; - } - - return 0; - -out_unbind: - component_unbind_all(dev, acomp); - - return ret; -} - -static void hdac_component_master_unbind(struct device *dev) +static int i915_component_master_match(struct device *dev, void *data) { - struct i915_audio_component *acomp = hdac_acomp; - - module_put(acomp->ops->owner); - component_unbind_all(dev, acomp); - WARN_ON(acomp->ops || acomp->dev); -} - -static const struct component_master_ops hdac_component_master_ops = { - .bind = hdac_component_master_bind, - .unbind = hdac_component_master_unbind, -}; - -static int hdac_component_master_match(struct device *dev, void *data) -{ - /* i915 is the only supported component */ return !strcmp(dev->driver->name, "i915"); } -/** - * snd_hdac_i915_register_notifier - Register i915 audio component ops - * @aops: i915 audio component ops - * - * This function is supposed to be used only by a HD-audio controller - * driver that needs the interaction with i915 graphics. - * - * This function sets the given ops to be called by the i915 graphics driver. - * - * Returns zero for success or a negative error code. - */ -int snd_hdac_i915_register_notifier(const struct i915_audio_component_audio_ops *aops) -{ - if (!hdac_acomp) - return -ENODEV; - - hdac_acomp->audio_ops = aops; - return 0; -} -EXPORT_SYMBOL_GPL(snd_hdac_i915_register_notifier); - /* check whether intel graphics is present */ static bool i915_gfx_present(void) { @@ -345,6 +99,19 @@ return pci_dev_present(ids); } +static int i915_master_bind(struct device *dev, + struct drm_audio_component *acomp) +{ + complete_all(&bind_complete); + /* clear audio_ops here as it was needed only for completion call */ + acomp->audio_ops = NULL; + return 0; +} + +static const struct drm_audio_component_audio_ops i915_init_ops = { + .master_bind = i915_master_bind +}; + /** * snd_hdac_i915_init - Initialize i915 audio component * @bus: HDA core bus @@ -359,83 +126,31 @@ */ int snd_hdac_i915_init(struct hdac_bus *bus) { - struct component_match *match = NULL; - struct device *dev = bus->dev; - struct i915_audio_component *acomp; - int ret; - - if (WARN_ON(hdac_acomp)) - return -EBUSY; + struct drm_audio_component *acomp; + int err; if (!i915_gfx_present()) return -ENODEV; - acomp = kzalloc(sizeof(*acomp), GFP_KERNEL); - if (!acomp) - return -ENOMEM; - bus->audio_component = acomp; - hdac_acomp = acomp; - - component_match_add(dev, &match, hdac_component_master_match, bus); - ret = component_master_add_with_match(dev, &hdac_component_master_ops, - match); - if (ret < 0) - goto out_err; - - /* - * Atm, we don't support deferring the component binding, so make sure - * i915 is loaded and that the binding successfully completes. - */ - request_module("i915"); + init_completion(&bind_complete); + err = snd_hdac_acomp_init(bus, &i915_init_ops, + i915_component_master_match, + sizeof(struct i915_audio_component) - sizeof(*acomp)); + if (err < 0) + return err; + acomp = bus->audio_component; + if (!acomp) + return -ENODEV; if (!acomp->ops) { - ret = -ENODEV; - goto out_master_del; + request_module("i915"); + /* 10s timeout */ + wait_for_completion_timeout(&bind_complete, 10 * 1000); + } + if (!acomp->ops) { + snd_hdac_acomp_exit(bus); + return -ENODEV; } - dev_dbg(dev, "bound to i915 component master\n"); - return 0; -out_master_del: - component_master_del(dev, &hdac_component_master_ops); -out_err: - kfree(acomp); - bus->audio_component = NULL; - hdac_acomp = NULL; - dev_info(dev, "failed to add i915 component master (%d)\n", ret); - - return ret; } EXPORT_SYMBOL_GPL(snd_hdac_i915_init); - -/** - * snd_hdac_i915_exit - Finalize i915 audio component - * @bus: HDA core bus - * - * This function is supposed to be used only by a HD-audio controller - * driver that needs the interaction with i915 graphics. - * - * This function releases the i915 audio component that has been used. - * - * Returns zero for success or a negative error code. - */ -int snd_hdac_i915_exit(struct hdac_bus *bus) -{ - struct device *dev = bus->dev; - struct i915_audio_component *acomp = bus->audio_component; - - if (!acomp) - return 0; - - WARN_ON(bus->i915_power_refcount); - if (bus->i915_power_refcount > 0 && acomp->ops) - acomp->ops->put_power(acomp->dev); - - component_master_del(dev, &hdac_component_master_ops); - - kfree(acomp); - bus->audio_component = NULL; - hdac_acomp = NULL; - - return 0; -} -EXPORT_SYMBOL_GPL(snd_hdac_i915_exit); diff -Nru oem-audio-hda-daily-lts-xenial-dkms-0.201807310409~ubuntu14.04.1/hda-src-from-tree/hdacore/hdac_stream.c oem-audio-hda-daily-lts-xenial-dkms-0.201808040346~ubuntu14.04.1/hda-src-from-tree/hdacore/hdac_stream.c --- oem-audio-hda-daily-lts-xenial-dkms-0.201807310409~ubuntu14.04.1/hda-src-from-tree/hdacore/hdac_stream.c 2018-07-31 04:09:29.000000000 +0000 +++ oem-audio-hda-daily-lts-xenial-dkms-0.201808040346~ubuntu14.04.1/hda-src-from-tree/hdacore/hdac_stream.c 2018-08-04 03:46:28.000000000 +0000 @@ -621,7 +621,7 @@ unsigned int byte_size, struct snd_dma_buffer *bufp) { struct hdac_bus *bus = azx_dev->bus; - u32 *bdl; + __le32 *bdl; int err; snd_hdac_dsp_lock(azx_dev); @@ -651,7 +651,7 @@ snd_hdac_stream_writel(azx_dev, SD_BDLPU, 0); azx_dev->frags = 0; - bdl = (u32 *)azx_dev->bdl.area; + bdl = (__le32 *)azx_dev->bdl.area; err = setup_bdle(bus, bufp, azx_dev, &bdl, 0, byte_size, 0); if (err < 0) goto error; diff -Nru oem-audio-hda-daily-lts-xenial-dkms-0.201807310409~ubuntu14.04.1/hda-src-from-tree/hdacore/Kconfig oem-audio-hda-daily-lts-xenial-dkms-0.201808040346~ubuntu14.04.1/hda-src-from-tree/hdacore/Kconfig --- oem-audio-hda-daily-lts-xenial-dkms-0.201807310409~ubuntu14.04.1/hda-src-from-tree/hdacore/Kconfig 2018-07-31 04:09:29.000000000 +0000 +++ oem-audio-hda-daily-lts-xenial-dkms-0.201808040346~ubuntu14.04.1/hda-src-from-tree/hdacore/Kconfig 2018-08-04 03:46:28.000000000 +0000 @@ -5,11 +5,12 @@ config SND_HDA_DSP_LOADER bool +config SND_HDA_COMPONENT + bool + config SND_HDA_I915 bool - default y - depends on DRM_I915 - depends on SND_HDA_CORE + select SND_HDA_COMPONENT config SND_HDA_EXT_CORE tristate diff -Nru oem-audio-hda-daily-lts-xenial-dkms-0.201807310409~ubuntu14.04.1/hda-src-from-tree/hdacore/Makefile oem-audio-hda-daily-lts-xenial-dkms-0.201808040346~ubuntu14.04.1/hda-src-from-tree/hdacore/Makefile --- oem-audio-hda-daily-lts-xenial-dkms-0.201807310409~ubuntu14.04.1/hda-src-from-tree/hdacore/Makefile 2018-07-31 04:09:29.000000000 +0000 +++ oem-audio-hda-daily-lts-xenial-dkms-0.201808040346~ubuntu14.04.1/hda-src-from-tree/hdacore/Makefile 2018-08-04 03:46:28.000000000 +0000 @@ -6,6 +6,7 @@ CFLAGS_trace.o := -I$(src) # for sync with i915 gfx driver +snd-hda-core-$(CONFIG_SND_HDA_COMPONENT) += hdac_component.o snd-hda-core-$(CONFIG_SND_HDA_I915) += hdac_i915.o obj-$(CONFIG_SND_HDA_CORE) += snd-hda-core.o diff -Nru oem-audio-hda-daily-lts-xenial-dkms-0.201807310409~ubuntu14.04.1/hda-src-from-tree/hda_generic.c oem-audio-hda-daily-lts-xenial-dkms-0.201808040346~ubuntu14.04.1/hda-src-from-tree/hda_generic.c --- oem-audio-hda-daily-lts-xenial-dkms-0.201807310409~ubuntu14.04.1/hda-src-from-tree/hda_generic.c 2018-07-31 04:09:28.000000000 +0000 +++ oem-audio-hda-daily-lts-xenial-dkms-0.201808040346~ubuntu14.04.1/hda-src-from-tree/hda_generic.c 2018-08-04 03:46:28.000000000 +0000 @@ -209,7 +209,7 @@ */ #define update_pin_ctl(codec, pin, val) \ - snd_hda_codec_update_cache(codec, pin, 0, \ + snd_hda_codec_write_cache(codec, pin, 0, \ AC_VERB_SET_PIN_WIDGET_CONTROL, val) /* restore the pinctl based on the cached value */ @@ -898,7 +898,7 @@ hda_nid_t nid = path->path[i]; if (enable && path->multi[i]) - snd_hda_codec_update_cache(codec, nid, 0, + snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, path->idx[i]); if (has_amp_in(codec, path, i)) @@ -930,7 +930,7 @@ return; if (codec->inv_eapd) enable = !enable; - snd_hda_codec_update_cache(codec, pin, 0, + snd_hda_codec_write_cache(codec, pin, 0, AC_VERB_SET_EAPD_BTLENABLE, enable ? 0x02 : 0x00); } @@ -3900,6 +3900,142 @@ } /* + * mic mute LED hook helpers + */ +enum { + MICMUTE_LED_ON, + MICMUTE_LED_OFF, + MICMUTE_LED_FOLLOW_CAPTURE, + MICMUTE_LED_FOLLOW_MUTE, +}; + +static void call_micmute_led_update(struct hda_codec *codec) +{ + struct hda_gen_spec *spec = codec->spec; + unsigned int val; + + switch (spec->micmute_led.led_mode) { + case MICMUTE_LED_ON: + val = 1; + break; + case MICMUTE_LED_OFF: + val = 0; + break; + case MICMUTE_LED_FOLLOW_CAPTURE: + val = !!spec->micmute_led.capture; + break; + case MICMUTE_LED_FOLLOW_MUTE: + default: + val = !spec->micmute_led.capture; + break; + } + + if (val == spec->micmute_led.led_value) + return; + spec->micmute_led.led_value = val; + if (spec->micmute_led.update) + spec->micmute_led.update(codec); +} + +static void update_micmute_led(struct hda_codec *codec, + struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_value *ucontrol) +{ + struct hda_gen_spec *spec = codec->spec; + unsigned int mask; + + if (spec->micmute_led.old_hook) + spec->micmute_led.old_hook(codec, kcontrol, ucontrol); + + if (!ucontrol) + return; + mask = 1U << snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); + if (!strcmp("Capture Switch", ucontrol->id.name)) { + /* TODO: How do I verify if it's a mono or stereo here? */ + if (ucontrol->value.integer.value[0] || + ucontrol->value.integer.value[1]) + spec->micmute_led.capture |= mask; + else + spec->micmute_led.capture &= ~mask; + call_micmute_led_update(codec); + } +} + +static int micmute_led_mode_info(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_info *uinfo) +{ + static const char * const texts[] = { + "On", "Off", "Follow Capture", "Follow Mute", + }; + + return snd_ctl_enum_info(uinfo, 1, ARRAY_SIZE(texts), texts); +} + +static int micmute_led_mode_get(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_value *ucontrol) +{ + struct hda_codec *codec = snd_kcontrol_chip(kcontrol); + struct hda_gen_spec *spec = codec->spec; + + ucontrol->value.enumerated.item[0] = spec->micmute_led.led_mode; + return 0; +} + +static int micmute_led_mode_put(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_value *ucontrol) +{ + struct hda_codec *codec = snd_kcontrol_chip(kcontrol); + struct hda_gen_spec *spec = codec->spec; + unsigned int mode; + + mode = ucontrol->value.enumerated.item[0]; + if (mode > MICMUTE_LED_FOLLOW_MUTE) + mode = MICMUTE_LED_FOLLOW_MUTE; + if (mode == spec->micmute_led.led_mode) + return 0; + spec->micmute_led.led_mode = mode; + call_micmute_led_update(codec); + return 1; +} + +static const struct snd_kcontrol_new micmute_led_mode_ctl = { + .iface = SNDRV_CTL_ELEM_IFACE_MIXER, + .name = "Mic Mute-LED Mode", + .info = micmute_led_mode_info, + .get = micmute_led_mode_get, + .put = micmute_led_mode_put, +}; + +/** + * snd_hda_gen_add_micmute_led - helper for setting up mic mute LED hook + * @codec: the HDA codec + * @hook: the callback for updating LED + * + * Called from the codec drivers for offering the mic mute LED controls. + * When established, it sets up cap_sync_hook and triggers the callback at + * each time when the capture mixer switch changes. The callback is supposed + * to update the LED accordingly. + * + * Returns 0 if the hook is established or a negative error code. + */ +int snd_hda_gen_add_micmute_led(struct hda_codec *codec, + void (*hook)(struct hda_codec *)) +{ + struct hda_gen_spec *spec = codec->spec; + + spec->micmute_led.led_mode = MICMUTE_LED_FOLLOW_MUTE; + spec->micmute_led.capture = 0; + spec->micmute_led.led_value = 0; + spec->micmute_led.old_hook = spec->cap_sync_hook; + spec->micmute_led.update = hook; + spec->cap_sync_hook = update_micmute_led; + if (!snd_hda_gen_add_kctl(spec, NULL, &micmute_led_mode_ctl)) + return -ENOMEM; + return 0; +} +EXPORT_SYMBOL_GPL(snd_hda_gen_add_micmute_led); + +/* * parse digital I/Os and set up NIDs in BIOS auto-parse mode */ static void parse_digital(struct hda_codec *codec) @@ -5837,7 +5973,7 @@ hda_nid_t nid = pin->nid; if (is_jack_detectable(codec, nid) && !snd_hda_jack_tbl_get(codec, nid)) - snd_hda_codec_update_cache(codec, nid, 0, + snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_UNSOLICITED_ENABLE, 0); } } diff -Nru oem-audio-hda-daily-lts-xenial-dkms-0.201807310409~ubuntu14.04.1/hda-src-from-tree/hda_generic.h oem-audio-hda-daily-lts-xenial-dkms-0.201808040346~ubuntu14.04.1/hda-src-from-tree/hda_generic.h --- oem-audio-hda-daily-lts-xenial-dkms-0.201807310409~ubuntu14.04.1/hda-src-from-tree/hda_generic.h 2018-07-31 04:09:28.000000000 +0000 +++ oem-audio-hda-daily-lts-xenial-dkms-0.201808040346~ubuntu14.04.1/hda-src-from-tree/hda_generic.h 2018-08-04 03:46:28.000000000 +0000 @@ -86,6 +86,16 @@ extern const struct badness_table hda_main_out_badness; extern const struct badness_table hda_extra_out_badness; +struct hda_micmute_hook { + unsigned int led_mode; + unsigned int capture; + unsigned int led_value; + void (*update)(struct hda_codec *codec); + void (*old_hook)(struct hda_codec *codec, + struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_value *ucontrol); +}; + struct hda_gen_spec { char stream_name_analog[32]; /* analog PCM stream */ const struct hda_pcm_stream *stream_analog_playback; @@ -276,6 +286,9 @@ struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol); + /* mic mute LED hook; called via cap_sync_hook */ + struct hda_micmute_hook micmute_led; + /* PCM hooks */ void (*pcm_playback_hook)(struct hda_pcm_stream *hinfo, struct hda_codec *codec, @@ -342,4 +355,7 @@ void snd_hda_gen_stream_pm(struct hda_codec *codec, hda_nid_t nid, bool on); int snd_hda_gen_fix_pin_power(struct hda_codec *codec, hda_nid_t pin); +int snd_hda_gen_add_micmute_led(struct hda_codec *codec, + void (*hook)(struct hda_codec *)); + #endif /* __SOUND_HDA_GENERIC_H */ diff -Nru oem-audio-hda-daily-lts-xenial-dkms-0.201807310409~ubuntu14.04.1/hda-src-from-tree/hda_intel.c oem-audio-hda-daily-lts-xenial-dkms-0.201808040346~ubuntu14.04.1/hda-src-from-tree/hda_intel.c --- oem-audio-hda-daily-lts-xenial-dkms-0.201807310409~ubuntu14.04.1/hda-src-from-tree/hda_intel.c 2018-07-31 04:09:28.000000000 +0000 +++ oem-audio-hda-daily-lts-xenial-dkms-0.201808040346~ubuntu14.04.1/hda-src-from-tree/hda_intel.c 2018-08-04 03:46:28.000000000 +0000 @@ -1319,15 +1319,16 @@ static int register_vga_switcheroo(struct azx *chip) { struct hda_intel *hda = container_of(chip, struct hda_intel, chip); + struct pci_dev *p; int err; if (!hda->use_vga_switcheroo) return 0; - /* FIXME: currently only handling DIS controller - * is there any machine with two switchable HDMI audio controllers? - */ - err = vga_switcheroo_register_audio_client(chip->pci, &azx_vs_ops, - VGA_SWITCHEROO_DIS); + + p = get_bound_vga(chip->pci); + err = vga_switcheroo_register_audio_client(chip->pci, &azx_vs_ops, p); + pci_dev_put(p); + if (err < 0) return err; hda->vga_switcheroo_registered = 1; @@ -1429,7 +1430,7 @@ p = pci_get_domain_bus_and_slot(pci_domain_nr(pci->bus), pci->bus->number, 0); if (p) { - if ((p->class >> 8) == PCI_CLASS_DISPLAY_VGA) + if ((p->class >> 16) == PCI_BASE_CLASS_DISPLAY) return p; pci_dev_put(p); } @@ -2207,7 +2208,7 @@ */ static struct snd_pci_quirk power_save_blacklist[] = { /* https://bugzilla.redhat.com/show_bug.cgi?id=1525104 */ - SND_PCI_QUIRK(0x1849, 0x0c0c, "Asrock B85M-ITX", 0), + SND_PCI_QUIRK(0x1849, 0xc892, "Asrock B85M-ITX", 0), /* https://bugzilla.redhat.com/show_bug.cgi?id=1525104 */ SND_PCI_QUIRK(0x1849, 0x7662, "Asrock H81M-HDS", 0), /* https://bugzilla.redhat.com/show_bug.cgi?id=1525104 */ @@ -2535,7 +2536,8 @@ .driver_data = AZX_DRIVER_GENERIC | AZX_DCAPS_PRESET_ATI_SB }, /* AMD Raven */ { PCI_DEVICE(0x1022, 0x15e3), - .driver_data = AZX_DRIVER_GENERIC | AZX_DCAPS_PRESET_ATI_SB }, + .driver_data = AZX_DRIVER_GENERIC | AZX_DCAPS_PRESET_ATI_SB | + AZX_DCAPS_PM_RUNTIME }, /* ATI HDMI */ { PCI_DEVICE(0x1002, 0x0002), .driver_data = AZX_DRIVER_ATIHDMI_NS | AZX_DCAPS_PRESET_ATI_HDMI_NS }, diff -Nru oem-audio-hda-daily-lts-xenial-dkms-0.201807310409~ubuntu14.04.1/hda-src-from-tree/hda_proc.c oem-audio-hda-daily-lts-xenial-dkms-0.201808040346~ubuntu14.04.1/hda-src-from-tree/hda_proc.c --- oem-audio-hda-daily-lts-xenial-dkms-0.201807310409~ubuntu14.04.1/hda-src-from-tree/hda_proc.c 2018-07-31 04:09:28.000000000 +0000 +++ oem-audio-hda-daily-lts-xenial-dkms-0.201808040346~ubuntu14.04.1/hda-src-from-tree/hda_proc.c 2018-08-04 03:46:28.000000000 +0000 @@ -825,8 +825,9 @@ if (wid_caps & AC_WCAP_CONN_LIST) { conn_len = snd_hda_get_num_raw_conns(codec, nid); if (conn_len > 0) { - conn = kmalloc(sizeof(hda_nid_t) * conn_len, - GFP_KERNEL); + conn = kmalloc_array(conn_len, + sizeof(hda_nid_t), + GFP_KERNEL); if (!conn) return; if (snd_hda_get_raw_connections(codec, nid, conn, diff -Nru oem-audio-hda-daily-lts-xenial-dkms-0.201807310409~ubuntu14.04.1/hda-src-from-tree/include/hda_component.h oem-audio-hda-daily-lts-xenial-dkms-0.201808040346~ubuntu14.04.1/hda-src-from-tree/include/hda_component.h --- oem-audio-hda-daily-lts-xenial-dkms-0.201807310409~ubuntu14.04.1/hda-src-from-tree/include/hda_component.h 1970-01-01 00:00:00.000000000 +0000 +++ oem-audio-hda-daily-lts-xenial-dkms-0.201808040346~ubuntu14.04.1/hda-src-from-tree/include/hda_component.h 2018-08-04 03:46:43.000000000 +0000 @@ -0,0 +1,61 @@ +// SPDX-License-Identifier: GPL-2.0 +// HD-Audio helpers to sync with DRM driver + +#ifndef __SOUND_HDA_COMPONENT_H +#define __SOUND_HDA_COMPONENT_H + +#include + +#ifdef CONFIG_SND_HDA_COMPONENT +int snd_hdac_set_codec_wakeup(struct hdac_bus *bus, bool enable); +int snd_hdac_display_power(struct hdac_bus *bus, bool enable); +int snd_hdac_sync_audio_rate(struct hdac_device *codec, hda_nid_t nid, + int dev_id, int rate); +int snd_hdac_acomp_get_eld(struct hdac_device *codec, hda_nid_t nid, int dev_id, + bool *audio_enabled, char *buffer, int max_bytes); +int snd_hdac_acomp_init(struct hdac_bus *bus, + const struct drm_audio_component_audio_ops *aops, + int (*match_master)(struct device *, void *), + size_t extra_size); +int snd_hdac_acomp_exit(struct hdac_bus *bus); +int snd_hdac_acomp_register_notifier(struct hdac_bus *bus, + const struct drm_audio_component_audio_ops *ops); +#else +static inline int snd_hdac_set_codec_wakeup(struct hdac_bus *bus, bool enable) +{ + return 0; +} +static inline int snd_hdac_display_power(struct hdac_bus *bus, bool enable) +{ + return 0; +} +static inline int snd_hdac_sync_audio_rate(struct hdac_device *codec, + hda_nid_t nid, int dev_id, int rate) +{ + return 0; +} +static inline int snd_hdac_acomp_get_eld(struct hdac_device *codec, hda_nid_t nid, + int dev_id, bool *audio_enabled, + char *buffer, int max_bytes) +{ + return -ENODEV; +} +static inline int snd_hdac_acomp_init(struct hdac_bus *bus, + const struct drm_audio_component_audio_ops *aops, + int (*match_master)(struct device *, void *), + size_t extra_size) +{ + return -ENODEV; +} +static inline int snd_hdac_acomp_exit(struct hdac_bus *bus) +{ + return 0; +} +static inline int snd_hdac_acomp_register_notifier(struct hdac_bus *bus, + const struct drm_audio_component_audio_ops *ops) +{ + return -ENODEV; +} +#endif + +#endif /* __SOUND_HDA_COMPONENT_H */ diff -Nru oem-audio-hda-daily-lts-xenial-dkms-0.201807310409~ubuntu14.04.1/hda-src-from-tree/include/hda_i915.h oem-audio-hda-daily-lts-xenial-dkms-0.201808040346~ubuntu14.04.1/hda-src-from-tree/include/hda_i915.h --- oem-audio-hda-daily-lts-xenial-dkms-0.201807310409~ubuntu14.04.1/hda-src-from-tree/include/hda_i915.h 2018-07-31 04:09:47.000000000 +0000 +++ oem-audio-hda-daily-lts-xenial-dkms-0.201808040346~ubuntu14.04.1/hda-src-from-tree/include/hda_i915.h 2018-08-04 03:46:43.000000000 +0000 @@ -5,54 +5,23 @@ #ifndef __SOUND_HDA_I915_H #define __SOUND_HDA_I915_H -#include +#include "hda_component.h" #ifdef CONFIG_SND_HDA_I915 -int snd_hdac_set_codec_wakeup(struct hdac_bus *bus, bool enable); -int snd_hdac_display_power(struct hdac_bus *bus, bool enable); void snd_hdac_i915_set_bclk(struct hdac_bus *bus); -int snd_hdac_sync_audio_rate(struct hdac_device *codec, hda_nid_t nid, - int dev_id, int rate); -int snd_hdac_acomp_get_eld(struct hdac_device *codec, hda_nid_t nid, int dev_id, - bool *audio_enabled, char *buffer, int max_bytes); int snd_hdac_i915_init(struct hdac_bus *bus); -int snd_hdac_i915_exit(struct hdac_bus *bus); -int snd_hdac_i915_register_notifier(const struct i915_audio_component_audio_ops *); #else -static inline int snd_hdac_set_codec_wakeup(struct hdac_bus *bus, bool enable) -{ - return 0; -} -static inline int snd_hdac_display_power(struct hdac_bus *bus, bool enable) -{ - return 0; -} static inline void snd_hdac_i915_set_bclk(struct hdac_bus *bus) { } -static inline int snd_hdac_sync_audio_rate(struct hdac_device *codec, - hda_nid_t nid, int dev_id, int rate) -{ - return 0; -} -static inline int snd_hdac_acomp_get_eld(struct hdac_device *codec, hda_nid_t nid, - int dev_id, bool *audio_enabled, - char *buffer, int max_bytes) -{ - return -ENODEV; -} static inline int snd_hdac_i915_init(struct hdac_bus *bus) { return -ENODEV; } +#endif static inline int snd_hdac_i915_exit(struct hdac_bus *bus) { - return 0; + return snd_hdac_acomp_exit(bus); } -static inline int snd_hdac_i915_register_notifier(const struct i915_audio_component_audio_ops *ops) -{ - return -ENODEV; -} -#endif #endif /* __SOUND_HDA_I915_H */ diff -Nru oem-audio-hda-daily-lts-xenial-dkms-0.201807310409~ubuntu14.04.1/hda-src-from-tree/include/hdaudio_ext.h oem-audio-hda-daily-lts-xenial-dkms-0.201808040346~ubuntu14.04.1/hda-src-from-tree/include/hdaudio_ext.h --- oem-audio-hda-daily-lts-xenial-dkms-0.201807310409~ubuntu14.04.1/hda-src-from-tree/include/hdaudio_ext.h 2018-07-31 04:09:47.000000000 +0000 +++ oem-audio-hda-daily-lts-xenial-dkms-0.201808040346~ubuntu14.04.1/hda-src-from-tree/include/hdaudio_ext.h 2018-08-04 03:46:43.000000000 +0000 @@ -4,38 +4,16 @@ #include -/** - * hdac_ext_bus: HDAC extended bus for extended HDA caps - * - * @bus: hdac bus - * @num_streams: streams supported - * @hlink_list: link list of HDA links - * @lock: lock for link mgmt - * @cmd_dma_state: state of cmd DMAs: CORB and RIRB - */ -struct hdac_ext_bus { - struct hdac_bus bus; - int num_streams; - int idx; - - struct list_head hlink_list; - - struct mutex lock; - bool cmd_dma_state; -}; - -int snd_hdac_ext_bus_init(struct hdac_ext_bus *sbus, struct device *dev, +int snd_hdac_ext_bus_init(struct hdac_bus *bus, struct device *dev, const struct hdac_bus_ops *ops, - const struct hdac_io_ops *io_ops); + const struct hdac_io_ops *io_ops, + const struct hdac_ext_bus_ops *ext_ops); -void snd_hdac_ext_bus_exit(struct hdac_ext_bus *sbus); -int snd_hdac_ext_bus_device_init(struct hdac_ext_bus *sbus, int addr); +void snd_hdac_ext_bus_exit(struct hdac_bus *bus); +int snd_hdac_ext_bus_device_init(struct hdac_bus *bus, int addr, + struct hdac_device *hdev); void snd_hdac_ext_bus_device_exit(struct hdac_device *hdev); -void snd_hdac_ext_bus_device_remove(struct hdac_ext_bus *ebus); - -#define ebus_to_hbus(ebus) (&(ebus)->bus) -#define hbus_to_ebus(_bus) \ - container_of(_bus, struct hdac_ext_bus, bus) +void snd_hdac_ext_bus_device_remove(struct hdac_bus *bus); #define HDA_CODEC_REV_EXT_ENTRY(_vid, _rev, _name, drv_data) \ { .vendor_id = (_vid), .rev_id = (_rev), .name = (_name), \ @@ -44,14 +22,14 @@ #define HDA_CODEC_EXT_ENTRY(_vid, _revid, _name, _drv_data) \ HDA_CODEC_REV_EXT_ENTRY(_vid, _revid, _name, _drv_data) -void snd_hdac_ext_bus_ppcap_enable(struct hdac_ext_bus *chip, bool enable); -void snd_hdac_ext_bus_ppcap_int_enable(struct hdac_ext_bus *chip, bool enable); +void snd_hdac_ext_bus_ppcap_enable(struct hdac_bus *chip, bool enable); +void snd_hdac_ext_bus_ppcap_int_enable(struct hdac_bus *chip, bool enable); -void snd_hdac_ext_stream_spbcap_enable(struct hdac_ext_bus *chip, +void snd_hdac_ext_stream_spbcap_enable(struct hdac_bus *chip, bool enable, int index); -int snd_hdac_ext_bus_get_ml_capabilities(struct hdac_ext_bus *bus); -struct hdac_ext_link *snd_hdac_ext_bus_get_link(struct hdac_ext_bus *bus, +int snd_hdac_ext_bus_get_ml_capabilities(struct hdac_bus *bus); +struct hdac_ext_link *snd_hdac_ext_bus_get_link(struct hdac_bus *bus, const char *codec_name); enum hdac_ext_stream_type { @@ -100,28 +78,28 @@ #define stream_to_hdac_ext_stream(s) \ container_of(s, struct hdac_ext_stream, hstream) -void snd_hdac_ext_stream_init(struct hdac_ext_bus *bus, +void snd_hdac_ext_stream_init(struct hdac_bus *bus, struct hdac_ext_stream *stream, int idx, int direction, int tag); -int snd_hdac_ext_stream_init_all(struct hdac_ext_bus *ebus, int start_idx, +int snd_hdac_ext_stream_init_all(struct hdac_bus *bus, int start_idx, int num_stream, int dir); -void snd_hdac_stream_free_all(struct hdac_ext_bus *ebus); -void snd_hdac_link_free_all(struct hdac_ext_bus *ebus); -struct hdac_ext_stream *snd_hdac_ext_stream_assign(struct hdac_ext_bus *bus, +void snd_hdac_stream_free_all(struct hdac_bus *bus); +void snd_hdac_link_free_all(struct hdac_bus *bus); +struct hdac_ext_stream *snd_hdac_ext_stream_assign(struct hdac_bus *bus, struct snd_pcm_substream *substream, int type); void snd_hdac_ext_stream_release(struct hdac_ext_stream *azx_dev, int type); -void snd_hdac_ext_stream_decouple(struct hdac_ext_bus *bus, +void snd_hdac_ext_stream_decouple(struct hdac_bus *bus, struct hdac_ext_stream *azx_dev, bool decouple); -void snd_hdac_ext_stop_streams(struct hdac_ext_bus *sbus); +void snd_hdac_ext_stop_streams(struct hdac_bus *bus); -int snd_hdac_ext_stream_set_spib(struct hdac_ext_bus *ebus, +int snd_hdac_ext_stream_set_spib(struct hdac_bus *bus, struct hdac_ext_stream *stream, u32 value); -int snd_hdac_ext_stream_get_spbmaxfifo(struct hdac_ext_bus *ebus, +int snd_hdac_ext_stream_get_spbmaxfifo(struct hdac_bus *bus, struct hdac_ext_stream *stream); -void snd_hdac_ext_stream_drsm_enable(struct hdac_ext_bus *ebus, +void snd_hdac_ext_stream_drsm_enable(struct hdac_bus *bus, bool enable, int index); -int snd_hdac_ext_stream_set_dpibr(struct hdac_ext_bus *ebus, +int snd_hdac_ext_stream_set_dpibr(struct hdac_bus *bus, struct hdac_ext_stream *stream, u32 value); int snd_hdac_ext_stream_set_lpib(struct hdac_ext_stream *stream, u32 value); @@ -144,17 +122,15 @@ int snd_hdac_ext_bus_link_power_up(struct hdac_ext_link *link); int snd_hdac_ext_bus_link_power_down(struct hdac_ext_link *link); -int snd_hdac_ext_bus_link_power_up_all(struct hdac_ext_bus *ebus); -int snd_hdac_ext_bus_link_power_down_all(struct hdac_ext_bus *ebus); +int snd_hdac_ext_bus_link_power_up_all(struct hdac_bus *bus); +int snd_hdac_ext_bus_link_power_down_all(struct hdac_bus *bus); void snd_hdac_ext_link_set_stream_id(struct hdac_ext_link *link, int stream); void snd_hdac_ext_link_clear_stream_id(struct hdac_ext_link *link, int stream); -int snd_hdac_ext_bus_link_get(struct hdac_ext_bus *ebus, - struct hdac_ext_link *link); -int snd_hdac_ext_bus_link_put(struct hdac_ext_bus *ebus, - struct hdac_ext_link *link); +int snd_hdac_ext_bus_link_get(struct hdac_bus *bus, struct hdac_ext_link *link); +int snd_hdac_ext_bus_link_put(struct hdac_bus *bus, struct hdac_ext_link *link); /* update register macro */ #define snd_hdac_updatel(addr, reg, mask, val) \ @@ -181,53 +157,12 @@ u32 maxbps; }; -#define HDA_MAX_NIDS 16 - -/** - * struct hdac_ext_device - HDAC Ext device - * - * @hdac: hdac core device - * @nid_list - the dai map which matches the dai-name with the nid - * @map_cur_idx - the idx in use in dai_map - * @ops - the hda codec ops common to all codec drivers - * @pvt_data - private data, for asoc contains asoc codec object - */ -struct hdac_ext_device { - struct hdac_device hdev; - struct hdac_ext_bus *ebus; - - /* soc-dai to nid map */ - struct hda_dai_map nid_list[HDA_MAX_NIDS]; - unsigned int map_cur_idx; - - /* codec ops */ - struct hdac_ext_codec_ops ops; - - struct snd_card *card; - void *scodec; - void *private_data; -}; - struct hdac_ext_dma_params { u32 format; u8 stream_tag; }; -#define to_ehdac_device(dev) (container_of((dev), \ - struct hdac_ext_device, hdev)) -/* - * HD-audio codec base driver - */ -struct hdac_ext_driver { - struct hdac_driver hdac; - - int (*probe)(struct hdac_ext_device *dev); - int (*remove)(struct hdac_ext_device *dev); - void (*shutdown)(struct hdac_ext_device *dev); -}; - -int snd_hda_ext_driver_register(struct hdac_ext_driver *drv); -void snd_hda_ext_driver_unregister(struct hdac_ext_driver *drv); -#define to_ehdac_driver(_drv) container_of(_drv, struct hdac_ext_driver, hdac) +int snd_hda_ext_driver_register(struct hdac_driver *drv); +void snd_hda_ext_driver_unregister(struct hdac_driver *drv); #endif /* __SOUND_HDAUDIO_EXT_H */ diff -Nru oem-audio-hda-daily-lts-xenial-dkms-0.201807310409~ubuntu14.04.1/hda-src-from-tree/include/hdaudio.h oem-audio-hda-daily-lts-xenial-dkms-0.201808040346~ubuntu14.04.1/hda-src-from-tree/include/hdaudio.h --- oem-audio-hda-daily-lts-xenial-dkms-0.201807310409~ubuntu14.04.1/hda-src-from-tree/include/hdaudio.h 2018-07-31 04:09:47.000000000 +0000 +++ oem-audio-hda-daily-lts-xenial-dkms-0.201808040346~ubuntu14.04.1/hda-src-from-tree/include/hdaudio.h 2018-08-04 03:46:43.000000000 +0000 @@ -8,8 +8,10 @@ #include #include +#include #include #include +#include #include #include #include @@ -132,7 +134,7 @@ hda_nid_t *start_id); unsigned int snd_hdac_calc_stream_format(unsigned int rate, unsigned int channels, - unsigned int format, + snd_pcm_format_t format, unsigned int maxbps, unsigned short spdif_ctls); int snd_hdac_query_supported_pcm(struct hdac_device *codec, hda_nid_t nid, @@ -171,12 +173,38 @@ int snd_hdac_power_up_pm(struct hdac_device *codec); int snd_hdac_power_down_pm(struct hdac_device *codec); int snd_hdac_keep_power_up(struct hdac_device *codec); + +/* call this at entering into suspend/resume callbacks in codec driver */ +static inline void snd_hdac_enter_pm(struct hdac_device *codec) +{ + atomic_inc(&codec->in_pm); +} + +/* call this at leaving from suspend/resume callbacks in codec driver */ +static inline void snd_hdac_leave_pm(struct hdac_device *codec) +{ + atomic_dec(&codec->in_pm); +} + +static inline bool snd_hdac_is_in_pm(struct hdac_device *codec) +{ + return atomic_read(&codec->in_pm); +} + +static inline bool snd_hdac_is_power_on(struct hdac_device *codec) +{ + return !pm_runtime_suspended(&codec->dev); +} #else static inline int snd_hdac_power_up(struct hdac_device *codec) { return 0; } static inline int snd_hdac_power_down(struct hdac_device *codec) { return 0; } static inline int snd_hdac_power_up_pm(struct hdac_device *codec) { return 0; } static inline int snd_hdac_power_down_pm(struct hdac_device *codec) { return 0; } static inline int snd_hdac_keep_power_up(struct hdac_device *codec) { return 0; } +static inline void snd_hdac_enter_pm(struct hdac_device *codec) {} +static inline void snd_hdac_leave_pm(struct hdac_device *codec) {} +static inline bool snd_hdac_is_in_pm(struct hdac_device *codec) { return 0; } +static inline bool snd_hdac_is_power_on(struct hdac_device *codec) { return 1; } #endif /* @@ -188,6 +216,11 @@ const struct hda_device_id *id_table; int (*match)(struct hdac_device *dev, struct hdac_driver *drv); void (*unsol_event)(struct hdac_device *dev, unsigned int event); + + /* fields used by ext bus APIs */ + int (*probe)(struct hdac_device *dev); + int (*remove)(struct hdac_device *dev); + void (*shutdown)(struct hdac_device *dev); }; #define drv_to_hdac_driver(_drv) container_of(_drv, struct hdac_driver, driver) @@ -209,6 +242,14 @@ }; /* + * ops used for ASoC HDA codec drivers + */ +struct hdac_ext_bus_ops { + int (*hdev_attach)(struct hdac_device *hdev); + int (*hdev_detach)(struct hdac_device *hdev); +}; + +/* * Lowlevel I/O operators */ struct hdac_io_ops { @@ -250,11 +291,17 @@ * @mlcap: MultiLink capabilities pointer * @gtscap: gts capabilities pointer * @drsmcap: dma resume capabilities pointer + * @num_streams: streams supported + * @idx: HDA link index + * @hlink_list: link list of HDA links + * @lock: lock for link mgmt + * @cmd_dma_state: state of cmd DMAs: CORB and RIRB */ struct hdac_bus { struct device *dev; const struct hdac_bus_ops *ops; const struct hdac_io_ops *io_ops; + const struct hdac_ext_bus_ops *ext_ops; /* h/w resources */ unsigned long addr; @@ -314,9 +361,19 @@ spinlock_t reg_lock; struct mutex cmd_mutex; - /* i915 component interface */ - struct i915_audio_component *audio_component; - int i915_power_refcount; + /* DRM component interface */ + struct drm_audio_component *audio_component; + int drm_power_refcount; + + /* parameters required for enhanced capabilities */ + int num_streams; + int idx; + + struct list_head hlink_list; + + struct mutex lock; + bool cmd_dma_state; + }; int snd_hdac_bus_init(struct hdac_bus *bus, struct device *dev, diff -Nru oem-audio-hda-daily-lts-xenial-dkms-0.201807310409~ubuntu14.04.1/hda-src-from-tree/patch_analog.c oem-audio-hda-daily-lts-xenial-dkms-0.201808040346~ubuntu14.04.1/hda-src-from-tree/patch_analog.c --- oem-audio-hda-daily-lts-xenial-dkms-0.201807310409~ubuntu14.04.1/hda-src-from-tree/patch_analog.c 2018-07-31 04:09:28.000000000 +0000 +++ oem-audio-hda-daily-lts-xenial-dkms-0.201808040346~ubuntu14.04.1/hda-src-from-tree/patch_analog.c 2018-08-04 03:46:28.000000000 +0000 @@ -148,7 +148,7 @@ return; if (codec->inv_eapd) enabled = !enabled; - snd_hda_codec_update_cache(codec, spec->eapd_nid, 0, + snd_hda_codec_write_cache(codec, spec->eapd_nid, 0, AC_VERB_SET_EAPD_BTLENABLE, enabled ? 0x02 : 0x00); } @@ -991,7 +991,7 @@ if (spec->eapd_nid) ad_vmaster_eapd_hook(private_data, enabled); - snd_hda_codec_update_cache(codec, 0x01, 0, + snd_hda_codec_write_cache(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, enabled ? 0x00 : 0x02); } diff -Nru oem-audio-hda-daily-lts-xenial-dkms-0.201807310409~ubuntu14.04.1/hda-src-from-tree/patch_ca0132.c oem-audio-hda-daily-lts-xenial-dkms-0.201808040346~ubuntu14.04.1/hda-src-from-tree/patch_ca0132.c --- oem-audio-hda-daily-lts-xenial-dkms-0.201807310409~ubuntu14.04.1/hda-src-from-tree/patch_ca0132.c 2018-07-31 04:09:28.000000000 +0000 +++ oem-audio-hda-daily-lts-xenial-dkms-0.201808040346~ubuntu14.04.1/hda-src-from-tree/patch_ca0132.c 2018-08-04 03:46:28.000000000 +0000 @@ -991,6 +991,7 @@ enum { QUIRK_NONE, QUIRK_ALIENWARE, + QUIRK_ALIENWARE_M17XR4, QUIRK_SBZ, QUIRK_R3DI, }; @@ -1040,13 +1041,15 @@ }; static const struct snd_pci_quirk ca0132_quirks[] = { + SND_PCI_QUIRK(0x1028, 0x057b, "Alienware M17x R4", QUIRK_ALIENWARE_M17XR4), SND_PCI_QUIRK(0x1028, 0x0685, "Alienware 15 2015", QUIRK_ALIENWARE), SND_PCI_QUIRK(0x1028, 0x0688, "Alienware 17 2015", QUIRK_ALIENWARE), SND_PCI_QUIRK(0x1028, 0x0708, "Alienware 15 R2 2016", QUIRK_ALIENWARE), SND_PCI_QUIRK(0x1102, 0x0010, "Sound Blaster Z", QUIRK_SBZ), SND_PCI_QUIRK(0x1102, 0x0023, "Sound Blaster Z", QUIRK_SBZ), SND_PCI_QUIRK(0x1458, 0xA016, "Recon3Di", QUIRK_R3DI), - SND_PCI_QUIRK(0x1458, 0xA036, "Recon3Di", QUIRK_R3DI), + SND_PCI_QUIRK(0x1458, 0xA026, "Gigabyte G1.Sniper Z97", QUIRK_R3DI), + SND_PCI_QUIRK(0x1458, 0xA036, "Gigabyte GA-Z170X-Gaming 7", QUIRK_R3DI), {} }; @@ -5513,8 +5516,7 @@ sprintf(namestr, "FX: %s %s Volume", pfx, dirstr[dir]); - knew.tlv.c = 0; - knew.tlv.p = 0; + knew.tlv.c = NULL; switch (nid) { case XBASS_XOVER: @@ -5663,7 +5665,7 @@ * I think this has to do with the pin for rear surround being 0x11, * and the center/lfe being 0x10. Usually the pin order is the opposite. */ -const struct snd_pcm_chmap_elem ca0132_alt_chmaps[] = { +static const struct snd_pcm_chmap_elem ca0132_alt_chmaps[] = { { .channels = 2, .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR } }, { .channels = 4, @@ -5966,7 +5968,7 @@ info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adcs[0]; /* With the DSP enabled, desktops don't use this ADC. */ - if (spec->use_alt_functions) { + if (!spec->use_alt_functions) { info = snd_hda_codec_pcm_new(codec, "CA0132 Analog Mic-In2"); if (!info) return -ENOMEM; @@ -6130,7 +6132,10 @@ * Bit 6: set to select Data2, clear for Data1 * Bit 7: set to enable DMic, clear for AMic */ - val = 0x23; + if (spec->quirk == QUIRK_ALIENWARE_M17XR4) + val = 0x33; + else + val = 0x23; /* keep a copy of dmic ctl val for enable/disable dmic purpuse */ spec->dmic_ctl = val; snd_hda_codec_write(codec, spec->input_pins[0], 0, @@ -7223,7 +7228,7 @@ snd_hda_sequence_write(codec, spec->base_init_verbs); - if (spec->quirk != QUIRK_NONE) + if (spec->use_alt_functions) ca0132_alt_init(codec); ca0132_download_dsp(codec); @@ -7237,8 +7242,9 @@ case QUIRK_R3DI: r3di_setup_defaults(codec); break; - case QUIRK_NONE: - case QUIRK_ALIENWARE: + case QUIRK_SBZ: + break; + default: ca0132_setup_defaults(codec); ca0132_init_analog_mic2(codec); ca0132_init_dmic(codec); @@ -7343,7 +7349,6 @@ static void ca0132_config(struct hda_codec *codec) { struct ca0132_spec *spec = codec->spec; - struct auto_pin_cfg *cfg = &spec->autocfg; spec->dacs[0] = 0x2; spec->dacs[1] = 0x3; @@ -7405,12 +7410,7 @@ /* SPDIF I/O */ spec->dig_out = 0x05; spec->multiout.dig_out_nid = spec->dig_out; - cfg->dig_out_pins[0] = 0x0c; - cfg->dig_outs = 1; - cfg->dig_out_type[0] = HDA_PCM_TYPE_SPDIF; spec->dig_in = 0x09; - cfg->dig_in_pin = 0x0e; - cfg->dig_in_type = HDA_PCM_TYPE_SPDIF; break; case QUIRK_R3DI: codec_dbg(codec, "%s: QUIRK_R3DI applied.\n", __func__); @@ -7438,9 +7438,6 @@ /* SPDIF I/O */ spec->dig_out = 0x05; spec->multiout.dig_out_nid = spec->dig_out; - cfg->dig_out_pins[0] = 0x0c; - cfg->dig_outs = 1; - cfg->dig_out_type[0] = HDA_PCM_TYPE_SPDIF; break; default: spec->num_outputs = 2; @@ -7463,12 +7460,7 @@ /* SPDIF I/O */ spec->dig_out = 0x05; spec->multiout.dig_out_nid = spec->dig_out; - cfg->dig_out_pins[0] = 0x0c; - cfg->dig_outs = 1; - cfg->dig_out_type[0] = HDA_PCM_TYPE_SPDIF; spec->dig_in = 0x09; - cfg->dig_in_pin = 0x0e; - cfg->dig_in_type = HDA_PCM_TYPE_SPDIF; break; } } @@ -7476,44 +7468,36 @@ static int ca0132_prepare_verbs(struct hda_codec *codec) { /* Verbs + terminator (an empty element) */ -#define NUM_SPEC_VERBS 4 +#define NUM_SPEC_VERBS 2 struct ca0132_spec *spec = codec->spec; spec->chip_init_verbs = ca0132_init_verbs0; if (spec->quirk == QUIRK_SBZ) spec->sbz_init_verbs = sbz_init_verbs; - spec->spec_init_verbs = kzalloc(sizeof(struct hda_verb) * NUM_SPEC_VERBS, GFP_KERNEL); + spec->spec_init_verbs = kcalloc(NUM_SPEC_VERBS, + sizeof(struct hda_verb), + GFP_KERNEL); if (!spec->spec_init_verbs) return -ENOMEM; - /* HP jack autodetection */ - spec->spec_init_verbs[0].nid = spec->unsol_tag_hp; - spec->spec_init_verbs[0].param = AC_VERB_SET_UNSOLICITED_ENABLE; - spec->spec_init_verbs[0].verb = AC_USRSP_EN | spec->unsol_tag_hp; - - /* MIC1 jack autodetection */ - spec->spec_init_verbs[1].nid = spec->unsol_tag_amic1; - spec->spec_init_verbs[1].param = AC_VERB_SET_UNSOLICITED_ENABLE; - spec->spec_init_verbs[1].verb = AC_USRSP_EN | spec->unsol_tag_amic1; - /* config EAPD */ - spec->spec_init_verbs[2].nid = 0x0b; - spec->spec_init_verbs[2].param = 0x78D; - spec->spec_init_verbs[2].verb = 0x00; + spec->spec_init_verbs[0].nid = 0x0b; + spec->spec_init_verbs[0].param = 0x78D; + spec->spec_init_verbs[0].verb = 0x00; /* Previously commented configuration */ /* - spec->spec_init_verbs[3].nid = 0x0b; - spec->spec_init_verbs[3].param = AC_VERB_SET_EAPD_BTLENABLE; + spec->spec_init_verbs[2].nid = 0x0b; + spec->spec_init_verbs[2].param = AC_VERB_SET_EAPD_BTLENABLE; + spec->spec_init_verbs[2].verb = 0x02; + + spec->spec_init_verbs[3].nid = 0x10; + spec->spec_init_verbs[3].param = 0x78D; spec->spec_init_verbs[3].verb = 0x02; spec->spec_init_verbs[4].nid = 0x10; - spec->spec_init_verbs[4].param = 0x78D; + spec->spec_init_verbs[4].param = AC_VERB_SET_EAPD_BTLENABLE; spec->spec_init_verbs[4].verb = 0x02; - - spec->spec_init_verbs[5].nid = 0x10; - spec->spec_init_verbs[5].param = AC_VERB_SET_EAPD_BTLENABLE; - spec->spec_init_verbs[5].verb = 0x02; */ /* Terminator: spec->spec_init_verbs[NUM_SPEC_VERBS-1] */ diff -Nru oem-audio-hda-daily-lts-xenial-dkms-0.201807310409~ubuntu14.04.1/hda-src-from-tree/patch_cirrus.c oem-audio-hda-daily-lts-xenial-dkms-0.201808040346~ubuntu14.04.1/hda-src-from-tree/patch_cirrus.c --- oem-audio-hda-daily-lts-xenial-dkms-0.201807310409~ubuntu14.04.1/hda-src-from-tree/patch_cirrus.c 2018-07-31 04:09:28.000000000 +0000 +++ oem-audio-hda-daily-lts-xenial-dkms-0.201808040346~ubuntu14.04.1/hda-src-from-tree/patch_cirrus.c 2018-08-04 03:46:28.000000000 +0000 @@ -1096,25 +1096,6 @@ return 0; } -static int cs421x_build_controls(struct hda_codec *codec) -{ - struct cs_spec *spec = codec->spec; - int err; - - err = snd_hda_gen_build_controls(codec); - if (err < 0) - return err; - - if (spec->gen.autocfg.speaker_outs && - spec->vendor_nid == CS4210_VENDOR_NID) { - err = snd_hda_ctl_add(codec, 0, - snd_ctl_new1(&cs421x_speaker_boost_ctl, codec)); - if (err < 0) - return err; - } - return 0; -} - static void fix_volume_caps(struct hda_codec *codec, hda_nid_t dac) { unsigned int caps; @@ -1144,6 +1125,14 @@ return err; parse_cs421x_digital(codec); + + if (spec->gen.autocfg.speaker_outs && + spec->vendor_nid == CS4210_VENDOR_NID) { + if (!snd_hda_gen_add_kctl(&spec->gen, NULL, + &cs421x_speaker_boost_ctl)) + return -ENOMEM; + } + return 0; } @@ -1175,7 +1164,7 @@ #endif static const struct hda_codec_ops cs421x_patch_ops = { - .build_controls = cs421x_build_controls, + .build_controls = snd_hda_gen_build_controls, .build_pcms = snd_hda_gen_build_pcms, .init = cs421x_init, .free = cs_free, diff -Nru oem-audio-hda-daily-lts-xenial-dkms-0.201807310409~ubuntu14.04.1/hda-src-from-tree/patch_conexant.c oem-audio-hda-daily-lts-xenial-dkms-0.201808040346~ubuntu14.04.1/hda-src-from-tree/patch_conexant.c --- oem-audio-hda-daily-lts-xenial-dkms-0.201807310409~ubuntu14.04.1/hda-src-from-tree/patch_conexant.c 2018-07-31 04:09:28.000000000 +0000 +++ oem-audio-hda-daily-lts-xenial-dkms-0.201808040346~ubuntu14.04.1/hda-src-from-tree/patch_conexant.c 2018-08-04 03:46:28.000000000 +0000 @@ -37,8 +37,6 @@ struct conexant_spec { struct hda_gen_spec gen; - unsigned int beep_amp; - /* extra EAPD pins */ unsigned int num_eapds; hda_nid_t eapds[4]; @@ -62,65 +60,48 @@ #ifdef CONFIG_SND_HDA_INPUT_BEEP -static inline void set_beep_amp(struct conexant_spec *spec, hda_nid_t nid, - int idx, int dir) -{ - spec->gen.beep_nid = nid; - spec->beep_amp = HDA_COMPOSE_AMP_VAL(nid, 1, idx, dir); -} -/* additional beep mixers; the actual parameters are overwritten at build */ +/* additional beep mixers; private_value will be overwritten */ static const struct snd_kcontrol_new cxt_beep_mixer[] = { HDA_CODEC_VOLUME_MONO("Beep Playback Volume", 0, 1, 0, HDA_OUTPUT), HDA_CODEC_MUTE_BEEP_MONO("Beep Playback Switch", 0, 1, 0, HDA_OUTPUT), - { } /* end */ }; -/* create beep controls if needed */ -static int add_beep_ctls(struct hda_codec *codec) +static int set_beep_amp(struct conexant_spec *spec, hda_nid_t nid, + int idx, int dir) { - struct conexant_spec *spec = codec->spec; - int err; + struct snd_kcontrol_new *knew; + unsigned int beep_amp = HDA_COMPOSE_AMP_VAL(nid, 1, idx, dir); + int i; - if (spec->beep_amp) { - const struct snd_kcontrol_new *knew; - for (knew = cxt_beep_mixer; knew->name; knew++) { - struct snd_kcontrol *kctl; - kctl = snd_ctl_new1(knew, codec); - if (!kctl) - return -ENOMEM; - kctl->private_value = spec->beep_amp; - err = snd_hda_ctl_add(codec, 0, kctl); - if (err < 0) - return err; - } + spec->gen.beep_nid = nid; + for (i = 0; i < ARRAY_SIZE(cxt_beep_mixer); i++) { + knew = snd_hda_gen_add_kctl(&spec->gen, NULL, + &cxt_beep_mixer[i]); + if (!knew) + return -ENOMEM; + knew->private_value = beep_amp; } return 0; } -#else -#define set_beep_amp(spec, nid, idx, dir) /* NOP */ -#define add_beep_ctls(codec) 0 -#endif - -/* - * Automatic parser for CX20641 & co - */ -#ifdef CONFIG_SND_HDA_INPUT_BEEP -static void cx_auto_parse_beep(struct hda_codec *codec) +static int cx_auto_parse_beep(struct hda_codec *codec) { struct conexant_spec *spec = codec->spec; hda_nid_t nid; for_each_hda_codec_node(nid, codec) - if (get_wcaps_type(get_wcaps(codec, nid)) == AC_WID_BEEP) { - set_beep_amp(spec, nid, 0, HDA_OUTPUT); - break; - } + if (get_wcaps_type(get_wcaps(codec, nid)) == AC_WID_BEEP) + return set_beep_amp(spec, nid, 0, HDA_OUTPUT); + return 0; } #else -#define cx_auto_parse_beep(codec) +#define cx_auto_parse_beep(codec) 0 #endif +/* + * Automatic parser for CX20641 & co + */ + /* parse EAPDs */ static void cx_auto_parse_eapd(struct hda_codec *codec) { @@ -179,21 +160,6 @@ enabled ? 0x00 : 0x02); } -static int cx_auto_build_controls(struct hda_codec *codec) -{ - int err; - - err = snd_hda_gen_build_controls(codec); - if (err < 0) - return err; - - err = add_beep_ctls(codec); - if (err < 0) - return err; - - return 0; -} - static int cx_auto_init(struct hda_codec *codec) { struct conexant_spec *spec = codec->spec; @@ -211,6 +177,7 @@ struct conexant_spec *spec = codec->spec; switch (codec->core.vendor_id) { + case 0x14f12008: /* CX8200 */ case 0x14f150f2: /* CX20722 */ case 0x14f150f4: /* CX20724 */ break; @@ -218,13 +185,14 @@ return; } - /* Turn the CX20722 codec into D3 to avoid spurious noises + /* Turn the problematic codec into D3 to avoid spurious noises from the internal speaker during (and after) reboot */ cx_auto_turn_eapd(codec, spec->num_eapds, spec->eapds, false); snd_hda_codec_set_power_to_all(codec, codec->core.afg, AC_PWRST_D3); snd_hda_codec_write(codec, codec->core.afg, 0, AC_VERB_SET_POWER_STATE, AC_PWRST_D3); + msleep(10); } static void cx_auto_free(struct hda_codec *codec) @@ -234,7 +202,7 @@ } static const struct hda_codec_ops cx_auto_patch_ops = { - .build_controls = cx_auto_build_controls, + .build_controls = snd_hda_gen_build_controls, .build_pcms = snd_hda_gen_build_pcms, .init = cx_auto_init, .reboot_notify = cx_auto_reboot_notify, @@ -343,6 +311,7 @@ snd_hdac_regmap_add_vendor_verb(&codec->core, 0x410); break; case HDA_FIXUP_ACT_PROBE: + WARN_ON(spec->gen.cap_sync_hook); spec->gen.cap_sync_hook = cxt_update_headset_mode_hook; spec->gen.automute_hook = cxt_update_headset_mode; break; @@ -374,7 +343,7 @@ * control. */ #define update_mic_pin(codec, nid, val) \ - snd_hda_codec_update_cache(codec, nid, 0, \ + snd_hda_codec_write_cache(codec, nid, 0, \ AC_VERB_SET_PIN_WIDGET_CONTROL, val) static const struct hda_input_mux olpc_xo_dc_bias = { @@ -695,16 +664,12 @@ } /* turn on/off mic-mute LED via GPIO per capture hook */ -static void cxt_fixup_gpio_mic_mute_hook(struct hda_codec *codec, - struct snd_kcontrol *kcontrol, - struct snd_ctl_elem_value *ucontrol) +static void cxt_gpio_micmute_update(struct hda_codec *codec) { struct conexant_spec *spec = codec->spec; - if (ucontrol) - cxt_update_gpio_led(codec, spec->gpio_mic_led_mask, - ucontrol->value.integer.value[0] || - ucontrol->value.integer.value[1]); + cxt_update_gpio_led(codec, spec->gpio_mic_led_mask, + spec->gen.micmute_led.led_value); } @@ -721,11 +686,11 @@ if (action == HDA_FIXUP_ACT_PRE_PROBE) { spec->gen.vmaster_mute.hook = cxt_fixup_gpio_mute_hook; - spec->gen.cap_sync_hook = cxt_fixup_gpio_mic_mute_hook; spec->gpio_led = 0; spec->mute_led_polarity = 0; spec->gpio_mute_led_mask = 0x01; spec->gpio_mic_led_mask = 0x02; + snd_hda_gen_add_micmute_led(codec, cxt_gpio_micmute_update); } snd_hda_add_verbs(codec, gpio_init); if (spec->gpio_led) @@ -958,10 +923,13 @@ SND_PCI_QUIRK(0x103c, 0x8079, "HP EliteBook 840 G3", CXT_FIXUP_HP_DOCK), SND_PCI_QUIRK(0x103c, 0x807C, "HP EliteBook 820 G3", CXT_FIXUP_HP_DOCK), SND_PCI_QUIRK(0x103c, 0x80FD, "HP ProBook 640 G2", CXT_FIXUP_HP_DOCK), + SND_PCI_QUIRK(0x103c, 0x83b3, "HP EliteBook 830 G5", CXT_FIXUP_HP_DOCK), + SND_PCI_QUIRK(0x103c, 0x83d3, "HP ProBook 640 G4", CXT_FIXUP_HP_DOCK), SND_PCI_QUIRK(0x103c, 0x8174, "HP Spectre x360", CXT_FIXUP_HP_SPECTRE), SND_PCI_QUIRK(0x103c, 0x8115, "HP Z1 Gen3", CXT_FIXUP_HP_GATE_MIC), SND_PCI_QUIRK(0x103c, 0x814f, "HP ZBook 15u G3", CXT_FIXUP_MUTE_LED_GPIO), SND_PCI_QUIRK(0x103c, 0x822e, "HP ProBook 440 G4", CXT_FIXUP_MUTE_LED_GPIO), + SND_PCI_QUIRK(0x103c, 0x836e, "HP ProBook 455 G5", CXT_FIXUP_MUTE_LED_GPIO), SND_PCI_QUIRK(0x103c, 0x8299, "HP 800 G3 SFF", CXT_FIXUP_HP_MIC_NO_PRESENCE), SND_PCI_QUIRK(0x103c, 0x829a, "HP 800 G3 DM", CXT_FIXUP_HP_MIC_NO_PRESENCE), SND_PCI_QUIRK(0x103c, 0x8455, "HP Z2 G4", CXT_FIXUP_HP_MIC_NO_PRESENCE), @@ -1034,7 +1002,6 @@ codec->spec = spec; codec->patch_ops = cx_auto_patch_ops; - cx_auto_parse_beep(codec); cx_auto_parse_eapd(codec); spec->gen.own_eapd_ctl = 1; if (spec->dynamic_eapd) @@ -1094,6 +1061,10 @@ if (err < 0) goto error; + err = cx_auto_parse_beep(codec); + if (err < 0) + goto error; + /* Some laptops with Conexant chips show stalls in S3 resume, * which falls into the single-cmd mode. * Better to make reset, then. diff -Nru oem-audio-hda-daily-lts-xenial-dkms-0.201807310409~ubuntu14.04.1/hda-src-from-tree/patch_hdmi.c oem-audio-hda-daily-lts-xenial-dkms-0.201808040346~ubuntu14.04.1/hda-src-from-tree/patch_hdmi.c --- oem-audio-hda-daily-lts-xenial-dkms-0.201807310409~ubuntu14.04.1/hda-src-from-tree/patch_hdmi.c 2018-07-31 04:09:28.000000000 +0000 +++ oem-audio-hda-daily-lts-xenial-dkms-0.201808040346~ubuntu14.04.1/hda-src-from-tree/patch_hdmi.c 2018-08-04 03:46:28.000000000 +0000 @@ -33,6 +33,7 @@ #include #include #include +#include #include #include #include @@ -176,13 +177,13 @@ /* i915/powerwell (Haswell+/Valleyview+) specific */ bool use_acomp_notifier; /* use i915 eld_notify callback for hotplug */ - struct i915_audio_component_audio_ops i915_audio_ops; + struct drm_audio_component_audio_ops drm_audio_ops; struct hdac_chmap chmap; hda_nid_t vendor_nid; }; -#ifdef CONFIG_SND_HDA_I915 +#ifdef CONFIG_SND_HDA_COMPONENT static inline bool codec_has_acomp(struct hda_codec *codec) { struct hdmi_spec *spec = codec->spec; @@ -338,13 +339,13 @@ if (!per_pin) { /* no pin is bound to the pcm */ uinfo->count = 0; - mutex_unlock(&spec->pcm_lock); - return 0; + goto unlock; } eld = &per_pin->sink_eld; uinfo->count = eld->eld_valid ? eld->eld_size : 0; - mutex_unlock(&spec->pcm_lock); + unlock: + mutex_unlock(&spec->pcm_lock); return 0; } @@ -356,6 +357,7 @@ struct hdmi_spec_per_pin *per_pin; struct hdmi_eld *eld; int pcm_idx; + int err = 0; pcm_idx = kcontrol->private_value; mutex_lock(&spec->pcm_lock); @@ -364,16 +366,15 @@ /* no pin is bound to the pcm */ memset(ucontrol->value.bytes.data, 0, ARRAY_SIZE(ucontrol->value.bytes.data)); - mutex_unlock(&spec->pcm_lock); - return 0; + goto unlock; } - eld = &per_pin->sink_eld; + eld = &per_pin->sink_eld; if (eld->eld_size > ARRAY_SIZE(ucontrol->value.bytes.data) || eld->eld_size > ELD_MAX_SIZE) { - mutex_unlock(&spec->pcm_lock); snd_BUG(); - return -EINVAL; + err = -EINVAL; + goto unlock; } memset(ucontrol->value.bytes.data, 0, @@ -381,9 +382,10 @@ if (eld->eld_valid) memcpy(ucontrol->value.bytes.data, eld->eld_buffer, eld->eld_size); - mutex_unlock(&spec->pcm_lock); - return 0; + unlock: + mutex_unlock(&spec->pcm_lock); + return err; } static const struct snd_kcontrol_new eld_bytes_ctl = { @@ -764,8 +766,10 @@ if (pin_idx < 0) return; + mutex_lock(&spec->pcm_lock); if (hdmi_present_sense(get_pin(spec, pin_idx), 1)) snd_hda_jack_report_sync(codec); + mutex_unlock(&spec->pcm_lock); } static void jack_callback(struct hda_codec *codec, @@ -1206,8 +1210,8 @@ pin_idx = hinfo_to_pin_index(codec, hinfo); if (!spec->dyn_pcm_assign) { if (snd_BUG_ON(pin_idx < 0)) { - mutex_unlock(&spec->pcm_lock); - return -EINVAL; + err = -EINVAL; + goto unlock; } } else { /* no pin is assigned to the PCM @@ -1215,16 +1219,13 @@ */ if (pin_idx < 0) { err = hdmi_pcm_open_no_pin(hinfo, codec, substream); - mutex_unlock(&spec->pcm_lock); - return err; + goto unlock; } } err = hdmi_choose_cvt(codec, pin_idx, &cvt_idx); - if (err < 0) { - mutex_unlock(&spec->pcm_lock); - return err; - } + if (err < 0) + goto unlock; per_cvt = get_cvt(spec, cvt_idx); /* Claim converter */ @@ -1261,12 +1262,11 @@ per_cvt->assigned = 0; hinfo->nid = 0; snd_hda_spdif_ctls_unassign(codec, pcm_idx); - mutex_unlock(&spec->pcm_lock); - return -ENODEV; + err = -ENODEV; + goto unlock; } } - mutex_unlock(&spec->pcm_lock); /* Store the updated parameters */ runtime->hw.channels_min = hinfo->channels_min; runtime->hw.channels_max = hinfo->channels_max; @@ -1275,7 +1275,9 @@ snd_pcm_hw_constraint_step(substream->runtime, 0, SNDRV_PCM_HW_PARAM_CHANNELS, 2); - return 0; + unlock: + mutex_unlock(&spec->pcm_lock); + return err; } /* @@ -1628,21 +1630,23 @@ static bool hdmi_present_sense(struct hdmi_spec_per_pin *per_pin, int repoll) { struct hda_codec *codec = per_pin->codec; - struct hdmi_spec *spec = codec->spec; int ret; /* no temporary power up/down needed for component notifier */ - if (!codec_has_acomp(codec)) - snd_hda_power_up_pm(codec); + if (!codec_has_acomp(codec)) { + ret = snd_hda_power_up_pm(codec); + if (ret < 0 && pm_runtime_suspended(hda_codec_dev(codec))) { + snd_hda_power_down_pm(codec); + return false; + } + } - mutex_lock(&spec->pcm_lock); if (codec_has_acomp(codec)) { sync_eld_via_acomp(codec, per_pin); ret = false; /* don't call snd_hda_jack_report_sync() */ } else { ret = hdmi_present_sense_via_verbs(per_pin, repoll); } - mutex_unlock(&spec->pcm_lock); if (!codec_has_acomp(codec)) snd_hda_power_down_pm(codec); @@ -1654,12 +1658,16 @@ { struct hdmi_spec_per_pin *per_pin = container_of(to_delayed_work(work), struct hdmi_spec_per_pin, work); + struct hda_codec *codec = per_pin->codec; + struct hdmi_spec *spec = codec->spec; if (per_pin->repoll_count++ > 6) per_pin->repoll_count = 0; + mutex_lock(&spec->pcm_lock); if (hdmi_present_sense(per_pin, per_pin->repoll_count)) snd_hda_jack_report_sync(per_pin->codec); + mutex_unlock(&spec->pcm_lock); } static void intel_haswell_fixup_connect_list(struct hda_codec *codec, @@ -1858,7 +1866,7 @@ struct snd_pcm_runtime *runtime = substream->runtime; bool non_pcm; int pinctl; - int err; + int err = 0; mutex_lock(&spec->pcm_lock); pin_idx = hinfo_to_pin_index(codec, hinfo); @@ -1870,13 +1878,12 @@ pin_cvt_fixup(codec, NULL, cvt_nid); snd_hda_codec_setup_stream(codec, cvt_nid, stream_tag, 0, format); - mutex_unlock(&spec->pcm_lock); - return 0; + goto unlock; } if (snd_BUG_ON(pin_idx < 0)) { - mutex_unlock(&spec->pcm_lock); - return -EINVAL; + err = -EINVAL; + goto unlock; } per_pin = get_pin(spec, pin_idx); pin_nid = per_pin->pin_nid; @@ -1915,6 +1922,7 @@ /* snd_hda_set_dev_select() has been called before */ err = spec->ops.setup_stream(codec, cvt_nid, pin_nid, stream_tag, format); + unlock: mutex_unlock(&spec->pcm_lock); return err; } @@ -1936,6 +1944,7 @@ struct hdmi_spec_per_cvt *per_cvt; struct hdmi_spec_per_pin *per_pin; int pinctl; + int err = 0; if (hinfo->nid) { pcm_idx = hinfo_to_pcm_index(codec, hinfo); @@ -1954,14 +1963,12 @@ snd_hda_spdif_ctls_unassign(codec, pcm_idx); clear_bit(pcm_idx, &spec->pcm_in_use); pin_idx = hinfo_to_pin_index(codec, hinfo); - if (spec->dyn_pcm_assign && pin_idx < 0) { - mutex_unlock(&spec->pcm_lock); - return 0; - } + if (spec->dyn_pcm_assign && pin_idx < 0) + goto unlock; if (snd_BUG_ON(pin_idx < 0)) { - mutex_unlock(&spec->pcm_lock); - return -EINVAL; + err = -EINVAL; + goto unlock; } per_pin = get_pin(spec, pin_idx); @@ -1980,10 +1987,11 @@ per_pin->setup = false; per_pin->channels = 0; mutex_unlock(&per_pin->lock); + unlock: mutex_unlock(&spec->pcm_lock); } - return 0; + return err; } static const struct hda_pcm_ops generic_ops = { @@ -2279,7 +2287,7 @@ int pin_idx, pcm_idx; if (codec_has_acomp(codec)) - snd_hdac_i915_register_notifier(NULL); + snd_hdac_acomp_register_notifier(&codec->bus->core, NULL); for (pin_idx = 0; pin_idx < spec->num_pins; pin_idx++) { struct hdmi_spec_per_pin *per_pin = get_pin(spec, pin_idx); @@ -2462,6 +2470,38 @@ snd_hda_codec_set_power_to_all(codec, fg, power_state); } +/* There is a fixed mapping between audio pin node and display port. + * on SNB, IVY, HSW, BSW, SKL, BXT, KBL: + * Pin Widget 5 - PORT B (port = 1 in i915 driver) + * Pin Widget 6 - PORT C (port = 2 in i915 driver) + * Pin Widget 7 - PORT D (port = 3 in i915 driver) + * + * on VLV, ILK: + * Pin Widget 4 - PORT B (port = 1 in i915 driver) + * Pin Widget 5 - PORT C (port = 2 in i915 driver) + * Pin Widget 6 - PORT D (port = 3 in i915 driver) + */ +static int intel_base_nid(struct hda_codec *codec) +{ + switch (codec->core.vendor_id) { + case 0x80860054: /* ILK */ + case 0x80862804: /* ILK */ + case 0x80862882: /* VLV */ + return 4; + default: + return 5; + } +} + +static int intel_pin2port(void *audio_ptr, int pin_nid) +{ + int base_nid = intel_base_nid(audio_ptr); + + if (WARN_ON(pin_nid < base_nid || pin_nid >= base_nid + 3)) + return -1; + return pin_nid - base_nid + 1; /* intel port is 1-based */ +} + static void intel_pin_eld_notify(void *audio_ptr, int port, int pipe) { struct hda_codec *codec = audio_ptr; @@ -2472,16 +2512,7 @@ if (port < 1 || port > 3) return; - switch (codec->core.vendor_id) { - case 0x80860054: /* ILK */ - case 0x80862804: /* ILK */ - case 0x80862882: /* VLV */ - pin_nid = port + 0x03; - break; - default: - pin_nid = port + 0x04; - break; - } + pin_nid = port + intel_base_nid(codec) - 1; /* intel port is 1-based */ /* skip notification during system suspend (but not in runtime PM); * the state will be updated at resume @@ -2489,7 +2520,7 @@ if (snd_power_get_state(codec->card) != SNDRV_CTL_POWER_D0) return; /* ditto during suspend/resume process itself */ - if (atomic_read(&(codec)->core.in_pm)) + if (snd_hdac_is_in_pm(&codec->core)) return; snd_hdac_i915_set_bclk(&codec->bus->core); @@ -2502,14 +2533,16 @@ struct hdmi_spec *spec = codec->spec; spec->use_acomp_notifier = true; - spec->i915_audio_ops.audio_ptr = codec; + spec->drm_audio_ops.audio_ptr = codec; /* intel_audio_codec_enable() or intel_audio_codec_disable() * will call pin_eld_notify with using audio_ptr pointer * We need make sure audio_ptr is really setup */ wmb(); - spec->i915_audio_ops.pin_eld_notify = intel_pin_eld_notify; - snd_hdac_i915_register_notifier(&spec->i915_audio_ops); + spec->drm_audio_ops.pin2port = intel_pin2port; + spec->drm_audio_ops.pin_eld_notify = intel_pin_eld_notify; + snd_hdac_acomp_register_notifier(&codec->bus->core, + &spec->drm_audio_ops); } /* setup_stream ops override for HSW+ */ @@ -2542,6 +2575,8 @@ /* requires i915 binding */ if (!codec->bus->core.audio_component) { codec_info(codec, "No i915 binding for Intel HDMI/DP codec\n"); + /* set probe_id here to prevent generic fallback binding */ + codec->probe_id = HDA_CODEC_ID_SKIP_PROBE; return -ENODEV; } @@ -3741,6 +3776,11 @@ spec->chmap.channels_max = max(spec->chmap.channels_max, 8u); + /* AMD GPUs have neither EPSS nor CLKSTOP bits, hence preventing + * the link-down as is. Tell the core to allow it. + */ + codec->link_down_at_suspend = 1; + return 0; } diff -Nru oem-audio-hda-daily-lts-xenial-dkms-0.201807310409~ubuntu14.04.1/hda-src-from-tree/patch_realtek.c oem-audio-hda-daily-lts-xenial-dkms-0.201808040346~ubuntu14.04.1/hda-src-from-tree/patch_realtek.c --- oem-audio-hda-daily-lts-xenial-dkms-0.201807310409~ubuntu14.04.1/hda-src-from-tree/patch_realtek.c 2018-07-31 04:09:28.000000000 +0000 +++ oem-audio-hda-daily-lts-xenial-dkms-0.201808040346~ubuntu14.04.1/hda-src-from-tree/patch_realtek.c 2018-08-04 03:46:28.000000000 +0000 @@ -43,11 +43,9 @@ /* extra amp-initialization sequence types */ enum { + ALC_INIT_UNDEFINED, ALC_INIT_NONE, ALC_INIT_DEFAULT, - ALC_INIT_GPIO1, - ALC_INIT_GPIO2, - ALC_INIT_GPIO3, }; enum { @@ -85,19 +83,20 @@ struct hda_gen_spec gen; /* must be at head */ /* codec parameterization */ - const struct snd_kcontrol_new *mixers[5]; /* mixer arrays */ - unsigned int num_mixers; - unsigned int beep_amp; /* beep amp value, set via set_beep_amp() */ - struct alc_customize_define cdefine; unsigned int parse_flags; /* flag for snd_hda_parse_pin_defcfg() */ + /* GPIO bits */ + unsigned int gpio_mask; + unsigned int gpio_dir; + unsigned int gpio_data; + bool gpio_write_delay; /* add a delay before writing gpio_data */ + /* mute LED for HP laptops, see alc269_fixup_mic_mute_hook() */ int mute_led_polarity; hda_nid_t mute_led_nid; hda_nid_t cap_mute_led_nid; - unsigned int gpio_led; /* used for alc269_fixup_hp_gpio_led() */ unsigned int gpio_mute_led_mask; unsigned int gpio_mic_led_mask; @@ -205,41 +204,87 @@ } /* - * Append the given mixer and verb elements for the later use - * The mixer array is referred in build_controls(), and init_verbs are - * called in init(). + * GPIO setup tables, used in initialization */ -static void add_mixer(struct alc_spec *spec, const struct snd_kcontrol_new *mix) + +/* Enable GPIO mask and set output */ +static void alc_setup_gpio(struct hda_codec *codec, unsigned int mask) { - if (snd_BUG_ON(spec->num_mixers >= ARRAY_SIZE(spec->mixers))) + struct alc_spec *spec = codec->spec; + + spec->gpio_mask |= mask; + spec->gpio_dir |= mask; + spec->gpio_data |= mask; +} + +static void alc_write_gpio_data(struct hda_codec *codec) +{ + struct alc_spec *spec = codec->spec; + + snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, + spec->gpio_data); +} + +static void alc_update_gpio_data(struct hda_codec *codec, unsigned int mask, + bool on) +{ + struct alc_spec *spec = codec->spec; + unsigned int oldval = spec->gpio_data; + + if (on) + spec->gpio_data |= mask; + else + spec->gpio_data &= ~mask; + if (oldval != spec->gpio_data) + alc_write_gpio_data(codec); +} + +static void alc_write_gpio(struct hda_codec *codec) +{ + struct alc_spec *spec = codec->spec; + + if (!spec->gpio_mask) return; - spec->mixers[spec->num_mixers++] = mix; + + snd_hda_codec_write(codec, codec->core.afg, 0, + AC_VERB_SET_GPIO_MASK, spec->gpio_mask); + snd_hda_codec_write(codec, codec->core.afg, 0, + AC_VERB_SET_GPIO_DIRECTION, spec->gpio_dir); + if (spec->gpio_write_delay) + msleep(1); + alc_write_gpio_data(codec); } -/* - * GPIO setup tables, used in initialization - */ -/* Enable GPIO mask and set output */ -static const struct hda_verb alc_gpio1_init_verbs[] = { - {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, - {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, - {0x01, AC_VERB_SET_GPIO_DATA, 0x01}, - { } -}; +static void alc_fixup_gpio(struct hda_codec *codec, int action, + unsigned int mask) +{ + if (action == HDA_FIXUP_ACT_PRE_PROBE) + alc_setup_gpio(codec, mask); +} -static const struct hda_verb alc_gpio2_init_verbs[] = { - {0x01, AC_VERB_SET_GPIO_MASK, 0x02}, - {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x02}, - {0x01, AC_VERB_SET_GPIO_DATA, 0x02}, - { } -}; +static void alc_fixup_gpio1(struct hda_codec *codec, + const struct hda_fixup *fix, int action) +{ + alc_fixup_gpio(codec, action, 0x01); +} -static const struct hda_verb alc_gpio3_init_verbs[] = { - {0x01, AC_VERB_SET_GPIO_MASK, 0x03}, - {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03}, - {0x01, AC_VERB_SET_GPIO_DATA, 0x03}, - { } -}; +static void alc_fixup_gpio2(struct hda_codec *codec, + const struct hda_fixup *fix, int action) +{ + alc_fixup_gpio(codec, action, 0x02); +} + +static void alc_fixup_gpio3(struct hda_codec *codec, + const struct hda_fixup *fix, int action) +{ + alc_fixup_gpio(codec, action, 0x03); +} + +static void alc_fixup_gpio4(struct hda_codec *codec, + const struct hda_fixup *fix, int action) +{ + alc_fixup_gpio(codec, action, 0x04); +} /* * Fix hardware PLL issue @@ -447,16 +492,8 @@ { alc_fill_eapd_coef(codec); alc_auto_setup_eapd(codec, true); + alc_write_gpio(codec); switch (type) { - case ALC_INIT_GPIO1: - snd_hda_sequence_write(codec, alc_gpio1_init_verbs); - break; - case ALC_INIT_GPIO2: - snd_hda_sequence_write(codec, alc_gpio2_init_verbs); - break; - case ALC_INIT_GPIO3: - snd_hda_sequence_write(codec, alc_gpio3_init_verbs); - break; case ALC_INIT_DEFAULT: switch (codec->core.vendor_id) { case 0x10ec0260: @@ -656,20 +693,22 @@ * 7~6 : Reserved */ tmp = (ass & 0x38) >> 3; /* external Amp control */ - switch (tmp) { - case 1: - spec->init_amp = ALC_INIT_GPIO1; - break; - case 3: - spec->init_amp = ALC_INIT_GPIO2; - break; - case 7: - spec->init_amp = ALC_INIT_GPIO3; - break; - case 5: - default: - spec->init_amp = ALC_INIT_DEFAULT; - break; + if (spec->init_amp == ALC_INIT_UNDEFINED) { + switch (tmp) { + case 1: + alc_setup_gpio(codec, 0x01); + break; + case 3: + alc_setup_gpio(codec, 0x02); + break; + case 7: + alc_setup_gpio(codec, 0x03); + break; + case 5: + default: + spec->init_amp = ALC_INIT_DEFAULT; + break; + } } /* is laptop or Desktop and enable the function "Mute internal speaker @@ -722,47 +761,14 @@ } -#ifdef CONFIG_SND_HDA_INPUT_BEEP -/* additional beep mixers; the actual parameters are overwritten at build */ -static const struct snd_kcontrol_new alc_beep_mixer[] = { - HDA_CODEC_VOLUME("Beep Playback Volume", 0, 0, HDA_INPUT), - HDA_CODEC_MUTE_BEEP("Beep Playback Switch", 0, 0, HDA_INPUT), - { } /* end */ -}; -#endif - static int alc_build_controls(struct hda_codec *codec) { - struct alc_spec *spec = codec->spec; - int i, err; + int err; err = snd_hda_gen_build_controls(codec); if (err < 0) return err; - for (i = 0; i < spec->num_mixers; i++) { - err = snd_hda_add_new_ctls(codec, spec->mixers[i]); - if (err < 0) - return err; - } - -#ifdef CONFIG_SND_HDA_INPUT_BEEP - /* create beep controls if needed */ - if (spec->beep_amp) { - const struct snd_kcontrol_new *knew; - for (knew = alc_beep_mixer; knew->name; knew++) { - struct snd_kcontrol *kctl; - kctl = snd_ctl_new1(knew, codec); - if (!kctl) - return -ENOMEM; - kctl->private_value = spec->beep_amp; - err = snd_hda_ctl_add(codec, 0, kctl); - if (err < 0) - return err; - } - } -#endif - snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_BUILD); return 0; } @@ -793,6 +799,9 @@ { struct alc_spec *spec = codec->spec; + if (!snd_hda_get_bool_hint(codec, "shutup")) + return; /* disabled explicitly by hints */ + if (spec && spec->shutup) spec->shutup(codec); else @@ -970,8 +979,30 @@ * Digital-beep handlers */ #ifdef CONFIG_SND_HDA_INPUT_BEEP -#define set_beep_amp(spec, nid, idx, dir) \ - ((spec)->beep_amp = HDA_COMPOSE_AMP_VAL(nid, 3, idx, dir)) + +/* additional beep mixers; private_value will be overwritten */ +static const struct snd_kcontrol_new alc_beep_mixer[] = { + HDA_CODEC_VOLUME("Beep Playback Volume", 0, 0, HDA_INPUT), + HDA_CODEC_MUTE_BEEP("Beep Playback Switch", 0, 0, HDA_INPUT), +}; + +/* set up and create beep controls */ +static int set_beep_amp(struct alc_spec *spec, hda_nid_t nid, + int idx, int dir) +{ + struct snd_kcontrol_new *knew; + unsigned int beep_amp = HDA_COMPOSE_AMP_VAL(nid, 3, idx, dir); + int i; + + for (i = 0; i < ARRAY_SIZE(alc_beep_mixer); i++) { + knew = snd_hda_gen_add_kctl(&spec->gen, NULL, + &alc_beep_mixer[i]); + if (!knew) + return -ENOMEM; + knew->private_value = beep_amp; + } + return 0; +} static const struct snd_pci_quirk beep_white_list[] = { SND_PCI_QUIRK(0x1043, 0x103c, "ASUS", 1), @@ -996,7 +1027,7 @@ return spec->cdefine.enable_pcbeep; } #else -#define set_beep_amp(spec, nid, idx, dir) /* NOP */ +#define set_beep_amp(spec, nid, idx, dir) 0 #define has_cdefine_beep(codec) 0 #endif @@ -1101,12 +1132,12 @@ static const struct hda_fixup alc880_fixups[] = { [ALC880_FIXUP_GPIO1] = { - .type = HDA_FIXUP_VERBS, - .v.verbs = alc_gpio1_init_verbs, + .type = HDA_FIXUP_FUNC, + .v.func = alc_fixup_gpio1, }, [ALC880_FIXUP_GPIO2] = { - .type = HDA_FIXUP_VERBS, - .v.verbs = alc_gpio2_init_verbs, + .type = HDA_FIXUP_FUNC, + .v.func = alc_fixup_gpio2, }, [ALC880_FIXUP_MEDION_RIM] = { .type = HDA_FIXUP_VERBS, @@ -1498,8 +1529,11 @@ if (err < 0) goto error; - if (!spec->gen.no_analog) - set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); + if (!spec->gen.no_analog) { + err = set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); + if (err < 0) + goto error; + } snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE); @@ -1541,8 +1575,8 @@ static void alc260_gpio1_automute(struct hda_codec *codec) { struct alc_spec *spec = codec->spec; - snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, - spec->gen.hp_jack_present); + + alc_update_gpio_data(codec, 0x01, spec->gen.hp_jack_present); } static void alc260_fixup_gpio1_toggle(struct hda_codec *codec, @@ -1559,7 +1593,7 @@ spec->gen.autocfg.hp_pins[0] = 0x0f; /* copy it for automute */ snd_hda_jack_detect_enable_callback(codec, 0x0f, snd_hda_gen_hp_automute); - snd_hda_add_verbs(codec, alc_gpio1_init_verbs); + alc_setup_gpio(codec, 0x01); } } @@ -1586,8 +1620,6 @@ switch (action) { case HDA_FIXUP_ACT_PRE_PROBE: snd_hda_apply_pincfgs(codec, pincfgs); - break; - case HDA_FIXUP_ACT_PROBE: spec->init_amp = ALC_INIT_NONE; break; } @@ -1597,7 +1629,7 @@ const struct hda_fixup *fix, int action) { struct alc_spec *spec = codec->spec; - if (action == HDA_FIXUP_ACT_PROBE) + if (action == HDA_FIXUP_ACT_PRE_PROBE) spec->init_amp = ALC_INIT_NONE; } @@ -1635,8 +1667,8 @@ }, }, [ALC260_FIXUP_GPIO1] = { - .type = HDA_FIXUP_VERBS, - .v.verbs = alc_gpio1_init_verbs, + .type = HDA_FIXUP_FUNC, + .v.func = alc_fixup_gpio1, }, [ALC260_FIXUP_GPIO1_TOGGLE] = { .type = HDA_FIXUP_FUNC, @@ -1748,8 +1780,11 @@ if (err < 0) goto error; - if (!spec->gen.no_analog) - set_beep_amp(spec, 0x07, 0x05, HDA_INPUT); + if (!spec->gen.no_analog) { + err = set_beep_amp(spec, 0x07, 0x05, HDA_INPUT); + if (err < 0) + goto error; + } snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE); @@ -1821,47 +1856,14 @@ alc_update_coef_idx(codec, 7, 0, 0x2030); } -/* toggle speaker-output according to the hp-jack state */ -static void alc882_gpio_mute(struct hda_codec *codec, int pin, int muted) -{ - unsigned int gpiostate, gpiomask, gpiodir; - - gpiostate = snd_hda_codec_read(codec, codec->core.afg, 0, - AC_VERB_GET_GPIO_DATA, 0); - - if (!muted) - gpiostate |= (1 << pin); - else - gpiostate &= ~(1 << pin); - - gpiomask = snd_hda_codec_read(codec, codec->core.afg, 0, - AC_VERB_GET_GPIO_MASK, 0); - gpiomask |= (1 << pin); - - gpiodir = snd_hda_codec_read(codec, codec->core.afg, 0, - AC_VERB_GET_GPIO_DIRECTION, 0); - gpiodir |= (1 << pin); - - - snd_hda_codec_write(codec, codec->core.afg, 0, - AC_VERB_SET_GPIO_MASK, gpiomask); - snd_hda_codec_write(codec, codec->core.afg, 0, - AC_VERB_SET_GPIO_DIRECTION, gpiodir); - - msleep(1); - - snd_hda_codec_write(codec, codec->core.afg, 0, - AC_VERB_SET_GPIO_DATA, gpiostate); -} - /* set up GPIO at initialization */ static void alc885_fixup_macpro_gpio(struct hda_codec *codec, const struct hda_fixup *fix, int action) { - if (action != HDA_FIXUP_ACT_INIT) - return; - alc882_gpio_mute(codec, 0, 0); - alc882_gpio_mute(codec, 1, 0); + struct alc_spec *spec = codec->spec; + + spec->gpio_write_delay = true; + alc_fixup_gpio3(codec, fix, action); } /* Fix the connection of some pins for ALC889: @@ -2140,20 +2142,20 @@ } }, [ALC882_FIXUP_GPIO1] = { - .type = HDA_FIXUP_VERBS, - .v.verbs = alc_gpio1_init_verbs, + .type = HDA_FIXUP_FUNC, + .v.func = alc_fixup_gpio1, }, [ALC882_FIXUP_GPIO2] = { - .type = HDA_FIXUP_VERBS, - .v.verbs = alc_gpio2_init_verbs, + .type = HDA_FIXUP_FUNC, + .v.func = alc_fixup_gpio2, }, [ALC882_FIXUP_GPIO3] = { - .type = HDA_FIXUP_VERBS, - .v.verbs = alc_gpio3_init_verbs, + .type = HDA_FIXUP_FUNC, + .v.func = alc_fixup_gpio3, }, [ALC882_FIXUP_ASUS_W2JC] = { - .type = HDA_FIXUP_VERBS, - .v.verbs = alc_gpio1_init_verbs, + .type = HDA_FIXUP_FUNC, + .v.func = alc_fixup_gpio1, .chained = true, .chain_id = ALC882_FIXUP_EAPD, }, @@ -2363,6 +2365,7 @@ SND_PCI_QUIRK_VENDOR(0x1462, "MSI", ALC882_FIXUP_GPIO3), SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", ALC882_FIXUP_ABIT_AW9D_MAX), SND_PCI_QUIRK(0x1558, 0x9501, "Clevo P950HR", ALC1220_FIXUP_CLEVO_P950), + SND_PCI_QUIRK(0x1558, 0x95e1, "Clevo P95xER", ALC1220_FIXUP_CLEVO_P950), SND_PCI_QUIRK(0x1558, 0x95e2, "Clevo P950ER", ALC1220_FIXUP_CLEVO_P950), SND_PCI_QUIRK_VENDOR(0x1558, "Clevo laptop", ALC882_FIXUP_EAPD), SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_FIXUP_EAPD), @@ -2372,12 +2375,37 @@ }; static const struct hda_model_fixup alc882_fixup_models[] = { + {.id = ALC882_FIXUP_ABIT_AW9D_MAX, .name = "abit-aw9d"}, + {.id = ALC882_FIXUP_LENOVO_Y530, .name = "lenovo-y530"}, + {.id = ALC882_FIXUP_ACER_ASPIRE_7736, .name = "acer-aspire-7736"}, + {.id = ALC882_FIXUP_ASUS_W90V, .name = "asus-w90v"}, + {.id = ALC889_FIXUP_CD, .name = "cd"}, + {.id = ALC889_FIXUP_FRONT_HP_NO_PRESENCE, .name = "no-front-hp"}, + {.id = ALC889_FIXUP_VAIO_TT, .name = "vaio-tt"}, + {.id = ALC888_FIXUP_EEE1601, .name = "eee1601"}, + {.id = ALC882_FIXUP_EAPD, .name = "alc882-eapd"}, + {.id = ALC883_FIXUP_EAPD, .name = "alc883-eapd"}, + {.id = ALC882_FIXUP_GPIO1, .name = "gpio1"}, + {.id = ALC882_FIXUP_GPIO2, .name = "gpio2"}, + {.id = ALC882_FIXUP_GPIO3, .name = "gpio3"}, + {.id = ALC889_FIXUP_COEF, .name = "alc889-coef"}, + {.id = ALC882_FIXUP_ASUS_W2JC, .name = "asus-w2jc"}, {.id = ALC882_FIXUP_ACER_ASPIRE_4930G, .name = "acer-aspire-4930g"}, {.id = ALC882_FIXUP_ACER_ASPIRE_8930G, .name = "acer-aspire-8930g"}, {.id = ALC883_FIXUP_ACER_EAPD, .name = "acer-aspire"}, + {.id = ALC885_FIXUP_MACPRO_GPIO, .name = "macpro-gpio"}, + {.id = ALC889_FIXUP_DAC_ROUTE, .name = "dac-route"}, + {.id = ALC889_FIXUP_MBP_VREF, .name = "mbp-vref"}, + {.id = ALC889_FIXUP_IMAC91_VREF, .name = "imac91-vref"}, + {.id = ALC889_FIXUP_MBA11_VREF, .name = "mba11-vref"}, + {.id = ALC889_FIXUP_MBA21_VREF, .name = "mba21-vref"}, + {.id = ALC889_FIXUP_MP11_VREF, .name = "mp11-vref"}, + {.id = ALC889_FIXUP_MP41_VREF, .name = "mp41-vref"}, {.id = ALC882_FIXUP_INV_DMIC, .name = "inv-dmic"}, {.id = ALC882_FIXUP_NO_PRIMARY_HP, .name = "no-primary-hp"}, + {.id = ALC887_FIXUP_ASUS_BASS, .name = "asus-bass"}, {.id = ALC1220_FIXUP_GB_DUAL_CODECS, .name = "dual-codecs"}, + {.id = ALC1220_FIXUP_CLEVO_P950, .name = "clevo-p950"}, {} }; @@ -2431,8 +2459,11 @@ if (err < 0) goto error; - if (!spec->gen.no_analog && spec->gen.beep_nid) - set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); + if (!spec->gen.no_analog && spec->gen.beep_nid) { + err = set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); + if (err < 0) + goto error; + } snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE); @@ -2542,6 +2573,7 @@ SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu Lifebook S7110", ALC262_FIXUP_FSC_S7110), SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FIXUP_BENQ), SND_PCI_QUIRK(0x10f1, 0x2915, "Tyan Thunder n6650W", ALC262_FIXUP_TYAN), + SND_PCI_QUIRK(0x1734, 0x1141, "FSC ESPRIMO U9210", ALC262_FIXUP_FSC_H270), SND_PCI_QUIRK(0x1734, 0x1147, "FSC Celsius H270", ALC262_FIXUP_FSC_H270), SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000", ALC262_FIXUP_LENOVO_3000), SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_FIXUP_BENQ), @@ -2552,6 +2584,14 @@ static const struct hda_model_fixup alc262_fixup_models[] = { {.id = ALC262_FIXUP_INV_DMIC, .name = "inv-dmic"}, + {.id = ALC262_FIXUP_FSC_H270, .name = "fsc-h270"}, + {.id = ALC262_FIXUP_FSC_S7110, .name = "fsc-s7110"}, + {.id = ALC262_FIXUP_HP_Z200, .name = "hp-z200"}, + {.id = ALC262_FIXUP_TYAN, .name = "tyan"}, + {.id = ALC262_FIXUP_LENOVO_3000, .name = "lenovo-3000"}, + {.id = ALC262_FIXUP_BENQ, .name = "benq"}, + {.id = ALC262_FIXUP_BENQ_T31, .name = "benq-t31"}, + {.id = ALC262_FIXUP_INTEL_BAYLEYBAY, .name = "bayleybay"}, {} }; @@ -2593,8 +2633,11 @@ if (err < 0) goto error; - if (!spec->gen.no_analog && spec->gen.beep_nid) - set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); + if (!spec->gen.no_analog && spec->gen.beep_nid) { + err = set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); + if (err < 0) + goto error; + } snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE); @@ -2640,7 +2683,6 @@ .put = alc268_beep_switch_put, .private_value = HDA_COMPOSE_AMP_VAL(0x0f, 3, 1, HDA_INPUT) }, - { } }; /* set PCBEEP vol = 0, mute connections */ @@ -2681,6 +2723,7 @@ static const struct hda_model_fixup alc268_fixup_models[] = { {.id = ALC268_FIXUP_INV_DMIC, .name = "inv-dmic"}, {.id = ALC268_FIXUP_HP_EAPD, .name = "hp-eapd"}, + {.id = ALC268_FIXUP_SPDIF, .name = "spdif"}, {} }; @@ -2708,7 +2751,7 @@ static int patch_alc268(struct hda_codec *codec) { struct alc_spec *spec; - int err; + int i, err; /* ALC268 has no aa-loopback mixer */ err = alc_alloc_spec(codec, 0); @@ -2730,7 +2773,13 @@ if (err > 0 && !spec->gen.no_analog && spec->gen.autocfg.speaker_pins[0] != 0x1d) { - add_mixer(spec, alc268_beep_mixer); + for (i = 0; i < ARRAY_SIZE(alc268_beep_mixer); i++) { + if (!snd_hda_gen_add_kctl(&spec->gen, NULL, + &alc268_beep_mixer[i])) { + err = -ENOMEM; + goto error; + } + } snd_hda_add_verbs(codec, alc268_beep_init_verbs); if (!query_amp_caps(codec, 0x1d, HDA_INPUT)) /* override the amp caps for beep generator */ @@ -3449,9 +3498,8 @@ * suspend, and won't restore the data after resume, so we restore it * in the driver. */ - if (spec->gpio_led) - snd_hda_codec_write(codec, codec->core.afg, 0, AC_VERB_SET_GPIO_DATA, - spec->gpio_led); + if (spec->gpio_data) + alc_write_gpio_data(codec); if (spec->has_alc5505_dsp) alc5505_dsp_resume(codec); @@ -3691,18 +3739,10 @@ bool enabled) { struct alc_spec *spec = codec->spec; - unsigned int oldval = spec->gpio_led; if (spec->mute_led_polarity) enabled = !enabled; - - if (enabled) - spec->gpio_led &= ~mask; - else - spec->gpio_led |= mask; - if (spec->gpio_led != oldval) - snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, - spec->gpio_led); + alc_update_gpio_data(codec, mask, !enabled); /* muted -> LED on */ } /* turn on/off mute LED via GPIO per vmaster hook */ @@ -3715,104 +3755,79 @@ } /* turn on/off mic-mute LED via GPIO per capture hook */ -static void alc_fixup_gpio_mic_mute_hook(struct hda_codec *codec, - struct snd_kcontrol *kcontrol, - struct snd_ctl_elem_value *ucontrol) +static void alc_gpio_micmute_update(struct hda_codec *codec) { struct alc_spec *spec = codec->spec; - if (ucontrol) - alc_update_gpio_led(codec, spec->gpio_mic_led_mask, - ucontrol->value.integer.value[0] || - ucontrol->value.integer.value[1]); + alc_update_gpio_led(codec, spec->gpio_mic_led_mask, + spec->gen.micmute_led.led_value); } -static void alc269_fixup_hp_gpio_led(struct hda_codec *codec, - const struct hda_fixup *fix, int action) +/* setup mute and mic-mute GPIO bits, add hooks appropriately */ +static void alc_fixup_hp_gpio_led(struct hda_codec *codec, + int action, + unsigned int mute_mask, + unsigned int micmute_mask) { struct alc_spec *spec = codec->spec; - static const struct hda_verb gpio_init[] = { - { 0x01, AC_VERB_SET_GPIO_MASK, 0x18 }, - { 0x01, AC_VERB_SET_GPIO_DIRECTION, 0x18 }, - {} - }; - if (action == HDA_FIXUP_ACT_PRE_PROBE) { + alc_fixup_gpio(codec, action, mute_mask | micmute_mask); + + if (action != HDA_FIXUP_ACT_PRE_PROBE) + return; + if (mute_mask) { + spec->gpio_mute_led_mask = mute_mask; spec->gen.vmaster_mute.hook = alc_fixup_gpio_mute_hook; - spec->gen.cap_sync_hook = alc_fixup_gpio_mic_mute_hook; - spec->gpio_led = 0; - spec->mute_led_polarity = 0; - spec->gpio_mute_led_mask = 0x08; - spec->gpio_mic_led_mask = 0x10; - snd_hda_add_verbs(codec, gpio_init); + } + if (micmute_mask) { + spec->gpio_mic_led_mask = micmute_mask; + snd_hda_gen_add_micmute_led(codec, alc_gpio_micmute_update); } } -static void alc286_fixup_hp_gpio_led(struct hda_codec *codec, +static void alc269_fixup_hp_gpio_led(struct hda_codec *codec, const struct hda_fixup *fix, int action) { - struct alc_spec *spec = codec->spec; - static const struct hda_verb gpio_init[] = { - { 0x01, AC_VERB_SET_GPIO_MASK, 0x22 }, - { 0x01, AC_VERB_SET_GPIO_DIRECTION, 0x22 }, - {} - }; + alc_fixup_hp_gpio_led(codec, action, 0x08, 0x10); +} - if (action == HDA_FIXUP_ACT_PRE_PROBE) { - spec->gen.vmaster_mute.hook = alc_fixup_gpio_mute_hook; - spec->gen.cap_sync_hook = alc_fixup_gpio_mic_mute_hook; - spec->gpio_led = 0; - spec->mute_led_polarity = 0; - spec->gpio_mute_led_mask = 0x02; - spec->gpio_mic_led_mask = 0x20; - snd_hda_add_verbs(codec, gpio_init); - } +static void alc286_fixup_hp_gpio_led(struct hda_codec *codec, + const struct hda_fixup *fix, int action) +{ + alc_fixup_hp_gpio_led(codec, action, 0x02, 0x20); } /* turn on/off mic-mute LED per capture hook */ -static void alc269_fixup_hp_cap_mic_mute_hook(struct hda_codec *codec, - struct snd_kcontrol *kcontrol, - struct snd_ctl_elem_value *ucontrol) +static void alc_cap_micmute_update(struct hda_codec *codec) { struct alc_spec *spec = codec->spec; - unsigned int pinval, enable, disable; + unsigned int pinval; + if (!spec->cap_mute_led_nid) + return; pinval = snd_hda_codec_get_pin_target(codec, spec->cap_mute_led_nid); pinval &= ~AC_PINCTL_VREFEN; - enable = pinval | AC_PINCTL_VREF_80; - disable = pinval | AC_PINCTL_VREF_HIZ; - - if (!ucontrol) - return; - - if (ucontrol->value.integer.value[0] || - ucontrol->value.integer.value[1]) - pinval = disable; + if (spec->gen.micmute_led.led_value) + pinval |= AC_PINCTL_VREF_80; else - pinval = enable; - - if (spec->cap_mute_led_nid) - snd_hda_set_pin_ctl_cache(codec, spec->cap_mute_led_nid, pinval); + pinval |= AC_PINCTL_VREF_HIZ; + snd_hda_set_pin_ctl_cache(codec, spec->cap_mute_led_nid, pinval); } static void alc269_fixup_hp_gpio_mic1_led(struct hda_codec *codec, const struct hda_fixup *fix, int action) { struct alc_spec *spec = codec->spec; - static const struct hda_verb gpio_init[] = { - { 0x01, AC_VERB_SET_GPIO_MASK, 0x08 }, - { 0x01, AC_VERB_SET_GPIO_DIRECTION, 0x08 }, - {} - }; + alc_fixup_hp_gpio_led(codec, action, 0x08, 0); if (action == HDA_FIXUP_ACT_PRE_PROBE) { - spec->gen.vmaster_mute.hook = alc_fixup_gpio_mute_hook; - spec->gen.cap_sync_hook = alc269_fixup_hp_cap_mic_mute_hook; - spec->gpio_led = 0; - spec->mute_led_polarity = 0; - spec->gpio_mute_led_mask = 0x08; + /* Like hp_gpio_mic1_led, but also needs GPIO4 low to + * enable headphone amp + */ + spec->gpio_mask |= 0x10; + spec->gpio_dir |= 0x10; spec->cap_mute_led_nid = 0x18; - snd_hda_add_verbs(codec, gpio_init); + snd_hda_gen_add_micmute_led(codec, alc_cap_micmute_update); codec->power_filter = led_power_filter; } } @@ -3820,22 +3835,12 @@ static void alc280_fixup_hp_gpio4(struct hda_codec *codec, const struct hda_fixup *fix, int action) { - /* Like hp_gpio_mic1_led, but also needs GPIO4 low to enable headphone amp */ struct alc_spec *spec = codec->spec; - static const struct hda_verb gpio_init[] = { - { 0x01, AC_VERB_SET_GPIO_MASK, 0x18 }, - { 0x01, AC_VERB_SET_GPIO_DIRECTION, 0x18 }, - {} - }; + alc_fixup_hp_gpio_led(codec, action, 0x08, 0); if (action == HDA_FIXUP_ACT_PRE_PROBE) { - spec->gen.vmaster_mute.hook = alc_fixup_gpio_mute_hook; - spec->gen.cap_sync_hook = alc269_fixup_hp_cap_mic_mute_hook; - spec->gpio_led = 0; - spec->mute_led_polarity = 0; - spec->gpio_mute_led_mask = 0x08; spec->cap_mute_led_nid = 0x18; - snd_hda_add_verbs(codec, gpio_init); + snd_hda_gen_add_micmute_led(codec, alc_cap_micmute_update); codec->power_filter = led_power_filter; } } @@ -3885,38 +3890,29 @@ return 0; } +/* GPIO1 = set according to SKU external amp + * GPIO2 = mic mute hotkey + * GPIO3 = mute LED + * GPIO4 = mic mute LED + */ static void alc280_fixup_hp_gpio2_mic_hotkey(struct hda_codec *codec, const struct hda_fixup *fix, int action) { - /* GPIO1 = set according to SKU external amp - GPIO2 = mic mute hotkey - GPIO3 = mute LED - GPIO4 = mic mute LED */ - static const struct hda_verb gpio_init[] = { - { 0x01, AC_VERB_SET_GPIO_MASK, 0x1e }, - { 0x01, AC_VERB_SET_GPIO_DIRECTION, 0x1a }, - { 0x01, AC_VERB_SET_GPIO_DATA, 0x02 }, - {} - }; - struct alc_spec *spec = codec->spec; + alc_fixup_hp_gpio_led(codec, action, 0x08, 0x10); if (action == HDA_FIXUP_ACT_PRE_PROBE) { + spec->init_amp = ALC_INIT_DEFAULT; if (alc_register_micmute_input_device(codec) != 0) return; - snd_hda_add_verbs(codec, gpio_init); + spec->gpio_mask |= 0x06; + spec->gpio_dir |= 0x02; + spec->gpio_data |= 0x02; snd_hda_codec_write_cache(codec, codec->core.afg, 0, AC_VERB_SET_GPIO_UNSOLICITED_RSP_MASK, 0x04); snd_hda_jack_detect_enable_callback(codec, codec->core.afg, gpio2_mic_hotkey_event); - - spec->gen.vmaster_mute.hook = alc_fixup_gpio_mute_hook; - spec->gen.cap_sync_hook = alc_fixup_gpio_mic_mute_hook; - spec->gpio_led = 0; - spec->mute_led_polarity = 0; - spec->gpio_mute_led_mask = 0x08; - spec->gpio_mic_led_mask = 0x10; return; } @@ -3924,40 +3920,28 @@ return; switch (action) { - case HDA_FIXUP_ACT_PROBE: - spec->init_amp = ALC_INIT_DEFAULT; - break; case HDA_FIXUP_ACT_FREE: input_unregister_device(spec->kb_dev); spec->kb_dev = NULL; } } +/* Line2 = mic mute hotkey + * GPIO2 = mic mute LED + */ static void alc233_fixup_lenovo_line2_mic_hotkey(struct hda_codec *codec, const struct hda_fixup *fix, int action) { - /* Line2 = mic mute hotkey - GPIO2 = mic mute LED */ - static const struct hda_verb gpio_init[] = { - { 0x01, AC_VERB_SET_GPIO_MASK, 0x04 }, - { 0x01, AC_VERB_SET_GPIO_DIRECTION, 0x04 }, - {} - }; - struct alc_spec *spec = codec->spec; + alc_fixup_hp_gpio_led(codec, action, 0, 0x04); if (action == HDA_FIXUP_ACT_PRE_PROBE) { + spec->init_amp = ALC_INIT_DEFAULT; if (alc_register_micmute_input_device(codec) != 0) return; - snd_hda_add_verbs(codec, gpio_init); snd_hda_jack_detect_enable_callback(codec, 0x1b, gpio2_mic_hotkey_event); - - spec->gen.cap_sync_hook = alc_fixup_gpio_mic_mute_hook; - spec->gpio_led = 0; - spec->mute_led_polarity = 0; - spec->gpio_mic_led_mask = 0x04; return; } @@ -3965,9 +3949,6 @@ return; switch (action) { - case HDA_FIXUP_ACT_PROBE: - spec->init_amp = ALC_INIT_DEFAULT; - break; case HDA_FIXUP_ACT_FREE: input_unregister_device(spec->kb_dev); spec->kb_dev = NULL; @@ -3983,14 +3964,10 @@ { struct alc_spec *spec = codec->spec; + alc269_fixup_hp_mute_led_micx(codec, fix, action, 0x1a); if (action == HDA_FIXUP_ACT_PRE_PROBE) { - spec->gen.vmaster_mute.hook = alc269_fixup_mic_mute_hook; - spec->gen.cap_sync_hook = alc269_fixup_hp_cap_mic_mute_hook; - spec->mute_led_polarity = 0; - spec->mute_led_nid = 0x1a; spec->cap_mute_led_nid = 0x18; - spec->gen.vmaster_mute_enum = 1; - codec->power_filter = led_power_filter; + snd_hda_gen_add_micmute_led(codec, alc_cap_micmute_update); } } @@ -4838,6 +4815,7 @@ spec->headphone_mic_pin = cfg->inputs[i].pin; } + WARN_ON(spec->gen.cap_sync_hook); spec->gen.cap_sync_hook = alc_update_headset_mode_hook; spec->gen.automute_hook = alc_update_headset_mode; spec->gen.hp_automute_hook = alc_update_headset_jack_cb; @@ -4929,13 +4907,10 @@ struct hda_jack_callback *jack) { struct alc_spec *spec = codec->spec; - int present; alc_update_headset_jack_cb(codec, jack); /* Headset Mic enable or disable, only for Dell Dino */ - present = spec->gen.hp_jack_present ? 0x40 : 0; - snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, - present); + alc_update_gpio_data(codec, 0x40, spec->gen.hp_jack_present); } static void alc_fixup_headset_mode_dell_alc288(struct hda_codec *codec, @@ -4944,6 +4919,9 @@ alc_fixup_headset_mode(codec, fix, action); if (action == HDA_FIXUP_ACT_PROBE) { struct alc_spec *spec = codec->spec; + /* toggled via hp_automute_hook */ + spec->gpio_mask |= 0x40; + spec->gpio_dir |= 0x40; spec->gen.hp_automute_hook = alc288_update_headset_jack_cb; } } @@ -4964,7 +4942,7 @@ static void alc_fixup_no_shutup(struct hda_codec *codec, const struct hda_fixup *fix, int action) { - if (action == HDA_FIXUP_ACT_PROBE) { + if (action == HDA_FIXUP_ACT_PRE_PROBE) { struct alc_spec *spec = codec->spec; spec->shutup = alc_no_shutup; } @@ -4992,7 +4970,6 @@ struct alc_spec *spec = codec->spec; if (action == HDA_FIXUP_ACT_PRE_PROBE) { - spec->shutup = alc_no_shutup; /* reduce click noise */ spec->reboot_notify = alc_d3_at_reboot; /* reduce noise */ spec->parse_flags = HDA_PINCFG_NO_HP_FIXUP; codec->power_save_node = 0; /* avoid click noises */ @@ -5047,10 +5024,9 @@ * it causes a click noise at start up */ snd_hda_codec_set_pin_target(codec, 0x19, PIN_VREFHIZ); + spec->shutup = alc_shutup_dell_xps13; break; case HDA_FIXUP_ACT_PROBE: - spec->shutup = alc_shutup_dell_xps13; - /* Make the internal mic the default input source. */ for (i = 0; i < imux->num_items; i++) { if (spec->gen.imux_pins[i] == 0x12) { @@ -5227,13 +5203,6 @@ const struct hda_fixup *fix, int action) { struct alc_spec *spec = codec->spec; - /* TX300 needs to set up GPIO2 for the speaker amp */ - static const struct hda_verb gpio2_verbs[] = { - { 0x01, AC_VERB_SET_GPIO_MASK, 0x04 }, - { 0x01, AC_VERB_SET_GPIO_DIRECTION, 0x04 }, - { 0x01, AC_VERB_SET_GPIO_DATA, 0x04 }, - {} - }; static const struct hda_pintbl dock_pins[] = { { 0x1b, 0x21114000 }, /* dock speaker pin */ {} @@ -5241,13 +5210,18 @@ switch (action) { case HDA_FIXUP_ACT_PRE_PROBE: - snd_hda_add_verbs(codec, gpio2_verbs); + spec->init_amp = ALC_INIT_DEFAULT; + /* TX300 needs to set up GPIO2 for the speaker amp */ + alc_setup_gpio(codec, 0x04); snd_hda_apply_pincfgs(codec, dock_pins); spec->gen.auto_mute_via_amp = 1; spec->gen.automute_hook = asus_tx300_automute; snd_hda_jack_detect_enable_callback(codec, 0x1b, snd_hda_gen_hp_automute); break; + case HDA_FIXUP_ACT_PROBE: + spec->init_amp = ALC_INIT_DEFAULT; + break; case HDA_FIXUP_ACT_BUILD: /* this is a bit tricky; give more sane names for the main * (tablet) speaker and the dock speaker, respectively @@ -5321,30 +5295,26 @@ int action) { struct alc_spec *spec = codec->spec; - static const struct hda_verb gpio_init[] = { - { 0x01, AC_VERB_SET_GPIO_MASK, 0x18 }, - { 0x01, AC_VERB_SET_GPIO_DIRECTION, 0x18 }, - {} - }; + alc_fixup_hp_gpio_led(codec, action, 0x08, 0); if (action == HDA_FIXUP_ACT_PRE_PROBE) { - /* Set the hooks to turn the headphone amp on/off - * as needed - */ - spec->gen.vmaster_mute.hook = alc_fixup_gpio_mute_hook; + /* amp at GPIO4; toggled via alc280_hp_gpio4_automute_hook() */ + spec->gpio_mask |= 0x10; + spec->gpio_dir |= 0x10; spec->gen.hp_automute_hook = alc280_hp_gpio4_automute_hook; + } +} - /* The GPIOs are currently off */ - spec->gpio_led = 0; - - /* GPIO3 is connected to the output mute LED, - * high is on, low is off - */ - spec->mute_led_polarity = 0; - spec->gpio_mute_led_mask = 0x08; +static void alc275_fixup_gpio4_off(struct hda_codec *codec, + const struct hda_fixup *fix, + int action) +{ + struct alc_spec *spec = codec->spec; - /* Initialize GPIO configuration */ - snd_hda_add_verbs(codec, gpio_init); + if (action == HDA_FIXUP_ACT_PRE_PROBE) { + spec->gpio_mask |= 0x04; + spec->gpio_dir |= 0x04; + /* set data bit low */ } } @@ -5391,6 +5361,13 @@ /* for hda_fixup_thinkpad_acpi() */ #include "thinkpad_helper.c" +static void alc_fixup_thinkpad_acpi(struct hda_codec *codec, + const struct hda_fixup *fix, int action) +{ + alc_fixup_no_shutup(codec, fix, action); /* reduce click noise */ + hda_fixup_thinkpad_acpi(codec, fix, action); +} + /* for dell wmi mic mute led */ #include "dell_wmi_helper.c" @@ -5481,7 +5458,6 @@ ALC280_FIXUP_HP_9480M, ALC288_FIXUP_DELL_HEADSET_MODE, ALC288_FIXUP_DELL1_MIC_NO_PRESENCE, - ALC288_FIXUP_DELL_XPS_13_GPIO6, ALC288_FIXUP_DELL_XPS_13, ALC288_FIXUP_DISABLE_AAMIX, ALC292_FIXUP_DELL_E7X, @@ -5529,13 +5505,8 @@ } }, [ALC275_FIXUP_SONY_VAIO_GPIO2] = { - .type = HDA_FIXUP_VERBS, - .v.verbs = (const struct hda_verb[]) { - {0x01, AC_VERB_SET_GPIO_MASK, 0x04}, - {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x04}, - {0x01, AC_VERB_SET_GPIO_DATA, 0x00}, - { } - }, + .type = HDA_FIXUP_FUNC, + .v.func = alc275_fixup_gpio4_off, .chained = true, .chain_id = ALC269_FIXUP_SONY_VAIO }, @@ -5943,7 +5914,7 @@ }, [ALC269_FIXUP_THINKPAD_ACPI] = { .type = HDA_FIXUP_FUNC, - .v.func = hda_fixup_thinkpad_acpi, + .v.func = alc_fixup_thinkpad_acpi, .chained = true, .chain_id = ALC269_FIXUP_SKU_IGNORE, }, @@ -6102,22 +6073,11 @@ .chained = true, .chain_id = ALC288_FIXUP_DELL_HEADSET_MODE }, - [ALC288_FIXUP_DELL_XPS_13_GPIO6] = { - .type = HDA_FIXUP_VERBS, - .v.verbs = (const struct hda_verb[]) { - {0x01, AC_VERB_SET_GPIO_MASK, 0x40}, - {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x40}, - {0x01, AC_VERB_SET_GPIO_DATA, 0x00}, - { } - }, - .chained = true, - .chain_id = ALC288_FIXUP_DELL1_MIC_NO_PRESENCE - }, [ALC288_FIXUP_DISABLE_AAMIX] = { .type = HDA_FIXUP_FUNC, .v.func = alc_fixup_disable_aamix, .chained = true, - .chain_id = ALC288_FIXUP_DELL_XPS_13_GPIO6 + .chain_id = ALC288_FIXUP_DELL1_MIC_NO_PRESENCE }, [ALC288_FIXUP_DELL_XPS_13] = { .type = HDA_FIXUP_FUNC, @@ -6280,14 +6240,9 @@ .chain_id = ALC256_FIXUP_ASUS_HEADSET_MODE }, [ALC256_FIXUP_ASUS_AIO_GPIO2] = { - .type = HDA_FIXUP_VERBS, - .v.verbs = (const struct hda_verb[]) { - /* Set up GPIO2 for the speaker amp */ - { 0x01, AC_VERB_SET_GPIO_MASK, 0x04 }, - { 0x01, AC_VERB_SET_GPIO_DIRECTION, 0x04 }, - { 0x01, AC_VERB_SET_GPIO_DATA, 0x04 }, - {} - }, + .type = HDA_FIXUP_FUNC, + /* Set up GPIO2 for the speaker amp */ + .v.func = alc_fixup_gpio4, }, [ALC233_FIXUP_ASUS_MIC_NO_PRESENCE] = { .type = HDA_FIXUP_PINS, @@ -6559,6 +6514,7 @@ SND_PCI_QUIRK(0x10cf, 0x1629, "Lifebook U7x7", ALC255_FIXUP_LIFEBOOK_U7x7_HEADSET_MIC), SND_PCI_QUIRK(0x10cf, 0x1845, "Lifebook U904", ALC269_FIXUP_LIFEBOOK_EXTMIC), SND_PCI_QUIRK(0x10ec, 0x10f2, "Intel Reference board", ALC700_FIXUP_INTEL_REFERENCE), + SND_PCI_QUIRK(0x10f7, 0x8338, "Panasonic CF-SZ6", ALC269_FIXUP_HEADSET_MODE), SND_PCI_QUIRK(0x144d, 0xc109, "Samsung Ativ book 9 (NP900X3G)", ALC269_FIXUP_INV_DMIC), SND_PCI_QUIRK(0x144d, 0xc740, "Samsung Ativ book 8 (NP870Z5G)", ALC269_FIXUP_ATIV_BOOK_8), SND_PCI_QUIRK(0x1458, 0xfa53, "Gigabyte BXBT-2807", ALC283_FIXUP_HEADSET_MIC), @@ -6600,8 +6556,8 @@ SND_PCI_QUIRK(0x17aa, 0x30bb, "ThinkCentre AIO", ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY), SND_PCI_QUIRK(0x17aa, 0x30e2, "ThinkCentre AIO", ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY), SND_PCI_QUIRK(0x17aa, 0x310c, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION), + SND_PCI_QUIRK(0x17aa, 0x312a, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION), SND_PCI_QUIRK(0x17aa, 0x312f, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION), - SND_PCI_QUIRK(0x17aa, 0x3138, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION), SND_PCI_QUIRK(0x17aa, 0x313c, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION), SND_PCI_QUIRK(0x17aa, 0x3902, "Lenovo E50-80", ALC269_FIXUP_DMIC_THINKPAD_ACPI), SND_PCI_QUIRK(0x17aa, 0x3977, "IdeaPad S210", ALC283_FIXUP_INT_MIC), @@ -6701,13 +6657,95 @@ {.id = ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED, .name = "hp-dock-gpio-mic1-led"}, {.id = ALC269_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "dell-headset-multi"}, {.id = ALC269_FIXUP_DELL2_MIC_NO_PRESENCE, .name = "dell-headset-dock"}, + {.id = ALC269_FIXUP_DELL3_MIC_NO_PRESENCE, .name = "dell-headset3"}, + {.id = ALC269_FIXUP_DELL4_MIC_NO_PRESENCE, .name = "dell-headset4"}, {.id = ALC283_FIXUP_CHROME_BOOK, .name = "alc283-dac-wcaps"}, {.id = ALC283_FIXUP_SENSE_COMBO_JACK, .name = "alc283-sense-combo"}, {.id = ALC292_FIXUP_TPT440_DOCK, .name = "tpt440-dock"}, {.id = ALC292_FIXUP_TPT440, .name = "tpt440"}, {.id = ALC292_FIXUP_TPT460, .name = "tpt460"}, + {.id = ALC298_FIXUP_TPT470_DOCK, .name = "tpt470-dock"}, {.id = ALC233_FIXUP_LENOVO_MULTI_CODECS, .name = "dual-codecs"}, {.id = ALC700_FIXUP_INTEL_REFERENCE, .name = "alc700-ref"}, + {.id = ALC269_FIXUP_SONY_VAIO, .name = "vaio"}, + {.id = ALC269_FIXUP_DELL_M101Z, .name = "dell-m101z"}, + {.id = ALC269_FIXUP_ASUS_G73JW, .name = "asus-g73jw"}, + {.id = ALC269_FIXUP_LENOVO_EAPD, .name = "lenovo-eapd"}, + {.id = ALC275_FIXUP_SONY_HWEQ, .name = "sony-hweq"}, + {.id = ALC269_FIXUP_PCM_44K, .name = "pcm44k"}, + {.id = ALC269_FIXUP_LIFEBOOK, .name = "lifebook"}, + {.id = ALC269_FIXUP_LIFEBOOK_EXTMIC, .name = "lifebook-extmic"}, + {.id = ALC269_FIXUP_LIFEBOOK_HP_PIN, .name = "lifebook-hp-pin"}, + {.id = ALC255_FIXUP_LIFEBOOK_U7x7_HEADSET_MIC, .name = "lifebook-u7x7"}, + {.id = ALC269VB_FIXUP_AMIC, .name = "alc269vb-amic"}, + {.id = ALC269VB_FIXUP_DMIC, .name = "alc269vb-dmic"}, + {.id = ALC269_FIXUP_HP_MUTE_LED_MIC1, .name = "hp-mute-led-mic1"}, + {.id = ALC269_FIXUP_HP_MUTE_LED_MIC2, .name = "hp-mute-led-mic2"}, + {.id = ALC269_FIXUP_HP_MUTE_LED_MIC3, .name = "hp-mute-led-mic3"}, + {.id = ALC269_FIXUP_HP_GPIO_MIC1_LED, .name = "hp-gpio-mic1"}, + {.id = ALC269_FIXUP_HP_LINE1_MIC1_LED, .name = "hp-line1-mic1"}, + {.id = ALC269_FIXUP_NO_SHUTUP, .name = "noshutup"}, + {.id = ALC286_FIXUP_SONY_MIC_NO_PRESENCE, .name = "sony-nomic"}, + {.id = ALC269_FIXUP_ASPIRE_HEADSET_MIC, .name = "aspire-headset-mic"}, + {.id = ALC269_FIXUP_ASUS_X101, .name = "asus-x101"}, + {.id = ALC271_FIXUP_HP_GATE_MIC_JACK, .name = "acer-ao7xx"}, + {.id = ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572, .name = "acer-aspire-e1"}, + {.id = ALC269_FIXUP_ACER_AC700, .name = "acer-ac700"}, + {.id = ALC269_FIXUP_LIMIT_INT_MIC_BOOST, .name = "limit-mic-boost"}, + {.id = ALC269VB_FIXUP_ASUS_ZENBOOK, .name = "asus-zenbook"}, + {.id = ALC269VB_FIXUP_ASUS_ZENBOOK_UX31A, .name = "asus-zenbook-ux31a"}, + {.id = ALC269VB_FIXUP_ORDISSIMO_EVE2, .name = "ordissimo"}, + {.id = ALC282_FIXUP_ASUS_TX300, .name = "asus-tx300"}, + {.id = ALC283_FIXUP_INT_MIC, .name = "alc283-int-mic"}, + {.id = ALC290_FIXUP_MONO_SPEAKERS_HSJACK, .name = "mono-speakers"}, + {.id = ALC290_FIXUP_SUBWOOFER_HSJACK, .name = "alc290-subwoofer"}, + {.id = ALC269_FIXUP_THINKPAD_ACPI, .name = "thinkpad"}, + {.id = ALC269_FIXUP_DMIC_THINKPAD_ACPI, .name = "dmic-thinkpad"}, + {.id = ALC255_FIXUP_ACER_MIC_NO_PRESENCE, .name = "alc255-acer"}, + {.id = ALC255_FIXUP_ASUS_MIC_NO_PRESENCE, .name = "alc255-asus"}, + {.id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "alc255-dell1"}, + {.id = ALC255_FIXUP_DELL2_MIC_NO_PRESENCE, .name = "alc255-dell2"}, + {.id = ALC293_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "alc293-dell1"}, + {.id = ALC283_FIXUP_HEADSET_MIC, .name = "alc283-headset"}, + {.id = ALC255_FIXUP_DELL_WMI_MIC_MUTE_LED, .name = "alc255-dell-mute"}, + {.id = ALC282_FIXUP_ASPIRE_V5_PINS, .name = "aspire-v5"}, + {.id = ALC280_FIXUP_HP_GPIO4, .name = "hp-gpio4"}, + {.id = ALC286_FIXUP_HP_GPIO_LED, .name = "hp-gpio-led"}, + {.id = ALC280_FIXUP_HP_GPIO2_MIC_HOTKEY, .name = "hp-gpio2-hotkey"}, + {.id = ALC280_FIXUP_HP_DOCK_PINS, .name = "hp-dock-pins"}, + {.id = ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED, .name = "hp-dock-gpio-mic"}, + {.id = ALC280_FIXUP_HP_9480M, .name = "hp-9480m"}, + {.id = ALC288_FIXUP_DELL_HEADSET_MODE, .name = "alc288-dell-headset"}, + {.id = ALC288_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "alc288-dell1"}, + {.id = ALC288_FIXUP_DELL_XPS_13, .name = "alc288-dell-xps13"}, + {.id = ALC292_FIXUP_DELL_E7X, .name = "dell-e7x"}, + {.id = ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK, .name = "alc293-dell"}, + {.id = ALC298_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "alc298-dell1"}, + {.id = ALC298_FIXUP_DELL_AIO_MIC_NO_PRESENCE, .name = "alc298-dell-aio"}, + {.id = ALC275_FIXUP_DELL_XPS, .name = "alc275-dell-xps"}, + {.id = ALC256_FIXUP_DELL_XPS_13_HEADPHONE_NOISE, .name = "alc256-dell-xps13"}, + {.id = ALC293_FIXUP_LENOVO_SPK_NOISE, .name = "lenovo-spk-noise"}, + {.id = ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY, .name = "lenovo-hotkey"}, + {.id = ALC255_FIXUP_DELL_SPK_NOISE, .name = "dell-spk-noise"}, + {.id = ALC225_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "alc255-dell1"}, + {.id = ALC295_FIXUP_DISABLE_DAC3, .name = "alc295-disable-dac3"}, + {.id = ALC280_FIXUP_HP_HEADSET_MIC, .name = "alc280-hp-headset"}, + {.id = ALC221_FIXUP_HP_FRONT_MIC, .name = "alc221-hp-mic"}, + {.id = ALC298_FIXUP_SPK_VOLUME, .name = "alc298-spk-volume"}, + {.id = ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER, .name = "dell-inspiron-7559"}, + {.id = ALC269_FIXUP_ATIV_BOOK_8, .name = "ativ-book"}, + {.id = ALC221_FIXUP_HP_MIC_NO_PRESENCE, .name = "alc221-hp-mic"}, + {.id = ALC256_FIXUP_ASUS_HEADSET_MODE, .name = "alc256-asus-headset"}, + {.id = ALC256_FIXUP_ASUS_MIC, .name = "alc256-asus-mic"}, + {.id = ALC256_FIXUP_ASUS_AIO_GPIO2, .name = "alc256-asus-aio"}, + {.id = ALC233_FIXUP_ASUS_MIC_NO_PRESENCE, .name = "alc233-asus"}, + {.id = ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE, .name = "alc233-eapd"}, + {.id = ALC294_FIXUP_LENOVO_MIC_LOCATION, .name = "alc294-lenovo-mic"}, + {.id = ALC225_FIXUP_DELL_WYSE_MIC_NO_PRESENCE, .name = "alc225-wyse"}, + {.id = ALC274_FIXUP_DELL_AIO_LINEOUT_VERB, .name = "alc274-dell-aio"}, + {.id = ALC255_FIXUP_DUMMY_LINEOUT_VERB, .name = "alc255-dummy-lineout"}, + {.id = ALC255_FIXUP_DELL_HEADSET_MIC, .name = "alc255-dell-headset"}, + {.id = ALC295_FIXUP_HP_X360, .name = "alc295-hp-x360"}, {} }; #define ALC225_STANDARD_PINS \ @@ -6779,6 +6817,17 @@ {0x14, 0x90170110}, {0x19, 0x02a11030}, {0x21, 0x02211020}), + SND_HDA_PIN_QUIRK(0x10ec0235, 0x17aa, "Lenovo", ALC294_FIXUP_LENOVO_MIC_LOCATION, + {0x14, 0x90170110}, + {0x19, 0x02a11030}, + {0x1a, 0x02a11040}, + {0x1b, 0x01014020}, + {0x21, 0x0221101f}), + SND_HDA_PIN_QUIRK(0x10ec0235, 0x17aa, "Lenovo", ALC294_FIXUP_LENOVO_MIC_LOCATION, + {0x14, 0x90170110}, + {0x19, 0x02a11020}, + {0x1a, 0x02a11030}, + {0x21, 0x0221101f}), SND_HDA_PIN_QUIRK(0x10ec0236, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE, {0x12, 0x90a60140}, {0x14, 0x90170110}, @@ -6960,7 +7009,7 @@ {0x12, 0x90a60130}, {0x19, 0x03a11020}, {0x21, 0x0321101f}), - SND_HDA_PIN_QUIRK(0x10ec0288, 0x1028, "Dell", ALC288_FIXUP_DELL_XPS_13_GPIO6, + SND_HDA_PIN_QUIRK(0x10ec0288, 0x1028, "Dell", ALC288_FIXUP_DELL1_MIC_NO_PRESENCE, {0x12, 0x90a60120}, {0x14, 0x90170110}, {0x21, 0x0321101f}), @@ -7117,18 +7166,6 @@ spec->shutup = alc_default_shutup; spec->init_hook = alc_default_init; - snd_hda_pick_fixup(codec, alc269_fixup_models, - alc269_fixup_tbl, alc269_fixups); - snd_hda_pick_pin_fixup(codec, alc269_pin_fixup_tbl, alc269_fixups); - snd_hda_pick_fixup(codec, NULL, alc269_fixup_vendor_tbl, - alc269_fixups); - snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE); - - alc_auto_parse_customize_define(codec); - - if (has_cdefine_beep(codec)) - spec->gen.beep_nid = 0x01; - switch (codec->core.vendor_id) { case 0x10ec0269: spec->codec_variant = ALC269_TYPE_ALC269VA; @@ -7248,13 +7285,28 @@ spec->init_hook = alc5505_dsp_init; } + snd_hda_pick_fixup(codec, alc269_fixup_models, + alc269_fixup_tbl, alc269_fixups); + snd_hda_pick_pin_fixup(codec, alc269_pin_fixup_tbl, alc269_fixups); + snd_hda_pick_fixup(codec, NULL, alc269_fixup_vendor_tbl, + alc269_fixups); + snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE); + + alc_auto_parse_customize_define(codec); + + if (has_cdefine_beep(codec)) + spec->gen.beep_nid = 0x01; + /* automatic parse from the BIOS config */ err = alc269_parse_auto_config(codec); if (err < 0) goto error; - if (!spec->gen.no_analog && spec->gen.beep_nid && spec->gen.mixer_nid) - set_beep_amp(spec, spec->gen.mixer_nid, 0x04, HDA_INPUT); + if (!spec->gen.no_analog && spec->gen.beep_nid && spec->gen.mixer_nid) { + err = set_beep_amp(spec, spec->gen.mixer_nid, 0x04, HDA_INPUT); + if (err < 0) + goto error; + } snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE); @@ -7383,8 +7435,11 @@ if (err < 0) goto error; - if (!spec->gen.no_analog) - set_beep_amp(spec, 0x23, 0, HDA_OUTPUT); + if (!spec->gen.no_analog) { + err = set_beep_amp(spec, 0x23, 0, HDA_OUTPUT); + if (err < 0) + goto error; + } snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE); @@ -7424,16 +7479,21 @@ } } +/* reset GPIO1 */ +static void alc660vd_fixup_asus_gpio1(struct hda_codec *codec, + const struct hda_fixup *fix, int action) +{ + struct alc_spec *spec = codec->spec; + + if (action == HDA_FIXUP_ACT_PRE_PROBE) + spec->gpio_mask |= 0x02; + alc_fixup_gpio(codec, action, 0x01); +} + static const struct hda_fixup alc861vd_fixups[] = { [ALC660VD_FIX_ASUS_GPIO1] = { - .type = HDA_FIXUP_VERBS, - .v.verbs = (const struct hda_verb[]) { - /* reset GPIO1 */ - {0x01, AC_VERB_SET_GPIO_MASK, 0x03}, - {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, - {0x01, AC_VERB_SET_GPIO_DATA, 0x01}, - { } - } + .type = HDA_FIXUP_FUNC, + .v.func = alc660vd_fixup_asus_gpio1, }, [ALC861VD_FIX_DALLAS] = { .type = HDA_FIXUP_FUNC, @@ -7472,8 +7532,11 @@ if (err < 0) goto error; - if (!spec->gen.no_analog) - set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); + if (!spec->gen.no_analog) { + err = set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); + if (err < 0) + goto error; + } snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE); @@ -7554,7 +7617,7 @@ unsigned int power_state) { struct alc_spec *spec = codec->spec; - if (nid == codec->core.afg && power_state == AC_PWRST_D3 && spec->gpio_led) + if (nid == codec->core.afg && power_state == AC_PWRST_D3 && spec->gpio_data) return AC_PWRST_D0; return power_state; } @@ -7563,18 +7626,10 @@ const struct hda_fixup *fix, int action) { struct alc_spec *spec = codec->spec; - static const struct hda_verb gpio_init[] = { - { 0x01, AC_VERB_SET_GPIO_MASK, 0x01 }, - { 0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01 }, - {} - }; + alc_fixup_hp_gpio_led(codec, action, 0x01, 0); if (action == HDA_FIXUP_ACT_PRE_PROBE) { - spec->gen.vmaster_mute.hook = alc_fixup_gpio_mute_hook; - spec->gpio_led = 0; spec->mute_led_polarity = 1; - spec->gpio_mute_led_mask = 0x01; - snd_hda_add_verbs(codec, gpio_init); codec->power_filter = gpio_led_power_filter; } } @@ -8087,7 +8142,10 @@ }; static const struct hda_model_fixup alc662_fixup_models[] = { + {.id = ALC662_FIXUP_ASPIRE, .name = "aspire"}, + {.id = ALC662_FIXUP_IDEAPAD, .name = "ideapad"}, {.id = ALC272_FIXUP_MARIO, .name = "mario"}, + {.id = ALC662_FIXUP_HP_RP5800, .name = "hp-rp5800"}, {.id = ALC662_FIXUP_ASUS_MODE1, .name = "asus-mode1"}, {.id = ALC662_FIXUP_ASUS_MODE2, .name = "asus-mode2"}, {.id = ALC662_FIXUP_ASUS_MODE3, .name = "asus-mode3"}, @@ -8096,8 +8154,23 @@ {.id = ALC662_FIXUP_ASUS_MODE6, .name = "asus-mode6"}, {.id = ALC662_FIXUP_ASUS_MODE7, .name = "asus-mode7"}, {.id = ALC662_FIXUP_ASUS_MODE8, .name = "asus-mode8"}, + {.id = ALC662_FIXUP_ZOTAC_Z68, .name = "zotac-z68"}, {.id = ALC662_FIXUP_INV_DMIC, .name = "inv-dmic"}, + {.id = ALC662_FIXUP_DELL_MIC_NO_PRESENCE, .name = "alc662-headset-multi"}, {.id = ALC668_FIXUP_DELL_MIC_NO_PRESENCE, .name = "dell-headset-multi"}, + {.id = ALC662_FIXUP_HEADSET_MODE, .name = "alc662-headset"}, + {.id = ALC668_FIXUP_HEADSET_MODE, .name = "alc668-headset"}, + {.id = ALC662_FIXUP_BASS_16, .name = "bass16"}, + {.id = ALC662_FIXUP_BASS_1A, .name = "bass1a"}, + {.id = ALC668_FIXUP_AUTO_MUTE, .name = "automute"}, + {.id = ALC668_FIXUP_DELL_XPS13, .name = "dell-xps13"}, + {.id = ALC662_FIXUP_ASUS_Nx50, .name = "asus-nx50"}, + {.id = ALC668_FIXUP_ASUS_Nx51, .name = "asus-nx51"}, + {.id = ALC891_FIXUP_HEADSET_MODE, .name = "alc891-headset"}, + {.id = ALC891_FIXUP_DELL_MIC_NO_PRESENCE, .name = "alc891-headset-multi"}, + {.id = ALC662_FIXUP_ACER_VERITON, .name = "acer-veriton"}, + {.id = ALC892_FIXUP_ASROCK_MOBO, .name = "asrock-mobo"}, + {.id = ALC662_FIXUP_USI_HEADSET_MODE, .name = "usi-headset"}, {.id = ALC662_FIXUP_LENOVO_MULTI_CODECS, .name = "dual-codecs"}, {} }; @@ -8191,18 +8264,20 @@ if (!spec->gen.no_analog && spec->gen.beep_nid) { switch (codec->core.vendor_id) { case 0x10ec0662: - set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); + err = set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); break; case 0x10ec0272: case 0x10ec0663: case 0x10ec0665: case 0x10ec0668: - set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT); + err = set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT); break; case 0x10ec0273: - set_beep_amp(spec, 0x0b, 0x03, HDA_INPUT); + err = set_beep_amp(spec, 0x0b, 0x03, HDA_INPUT); break; } + if (err < 0) + goto error; } snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE); diff -Nru oem-audio-hda-daily-lts-xenial-dkms-0.201807310409~ubuntu14.04.1/hda-src-from-tree/patch_sigmatel.c oem-audio-hda-daily-lts-xenial-dkms-0.201808040346~ubuntu14.04.1/hda-src-from-tree/patch_sigmatel.c --- oem-audio-hda-daily-lts-xenial-dkms-0.201807310409~ubuntu14.04.1/hda-src-from-tree/patch_sigmatel.c 2018-07-31 04:09:28.000000000 +0000 +++ oem-audio-hda-daily-lts-xenial-dkms-0.201808040346~ubuntu14.04.1/hda-src-from-tree/patch_sigmatel.c 2018-08-04 03:46:28.000000000 +0000 @@ -332,33 +332,15 @@ } /* hook for controlling mic-mute LED GPIO */ -static void stac_capture_led_hook(struct hda_codec *codec, - struct snd_kcontrol *kcontrol, - struct snd_ctl_elem_value *ucontrol) +static void stac_capture_led_update(struct hda_codec *codec) { struct sigmatel_spec *spec = codec->spec; - unsigned int mask; - bool cur_mute, prev_mute; - if (!kcontrol || !ucontrol) - return; - - mask = 1U << snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); - prev_mute = !spec->mic_enabled; - if (ucontrol->value.integer.value[0] || - ucontrol->value.integer.value[1]) - spec->mic_enabled |= mask; + if (spec->gen.micmute_led.led_value) + spec->gpio_data |= spec->mic_mute_led_gpio; else - spec->mic_enabled &= ~mask; - cur_mute = !spec->mic_enabled; - if (cur_mute != prev_mute) { - if (cur_mute) - spec->gpio_data |= spec->mic_mute_led_gpio; - else - spec->gpio_data &= ~spec->mic_mute_led_gpio; - stac_gpio_set(codec, spec->gpio_mask, - spec->gpio_dir, spec->gpio_data); - } + spec->gpio_data &= ~spec->mic_mute_led_gpio; + stac_gpio_set(codec, spec->gpio_mask, spec->gpio_dir, spec->gpio_data); } static int stac_vrefout_set(struct hda_codec *codec, @@ -4656,8 +4638,7 @@ spec->gpio_dir |= spec->mic_mute_led_gpio; spec->mic_enabled = 0; spec->gpio_data |= spec->mic_mute_led_gpio; - - spec->gen.cap_sync_hook = stac_capture_led_hook; + snd_hda_gen_add_micmute_led(codec, stac_capture_led_update); } } diff -Nru oem-audio-hda-daily-lts-xenial-dkms-0.201807310409~ubuntu14.04.1/hda-src-from-tree/patch_via.c oem-audio-hda-daily-lts-xenial-dkms-0.201808040346~ubuntu14.04.1/hda-src-from-tree/patch_via.c --- oem-audio-hda-daily-lts-xenial-dkms-0.201807310409~ubuntu14.04.1/hda-src-from-tree/patch_via.c 2018-07-31 04:09:28.000000000 +0000 +++ oem-audio-hda-daily-lts-xenial-dkms-0.201808040346~ubuntu14.04.1/hda-src-from-tree/patch_via.c 2018-08-04 03:46:28.000000000 +0000 @@ -90,13 +90,6 @@ struct via_spec { struct hda_gen_spec gen; - /* codec parameterization */ - const struct snd_kcontrol_new *mixers[6]; - unsigned int num_mixers; - - const struct hda_verb *init_verbs[5]; - unsigned int num_iverbs; - /* HP mode source */ unsigned int dmic_enabled; enum VIA_HDA_CODEC codec_type; @@ -107,8 +100,6 @@ /* work to check hp jack state */ int hp_work_active; int vt1708_jack_detect; - - unsigned int beep_amp; }; static enum VIA_HDA_CODEC get_codec_type(struct hda_codec *codec); @@ -262,69 +253,51 @@ return 1; } -static const struct snd_kcontrol_new via_pin_power_ctl_enum[] = { - { +static const struct snd_kcontrol_new via_pin_power_ctl_enum = { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = "Dynamic Power-Control", .info = via_pin_power_ctl_info, .get = via_pin_power_ctl_get, .put = via_pin_power_ctl_put, - }, - {} /* terminator */ }; #ifdef CONFIG_SND_HDA_INPUT_BEEP -static inline void set_beep_amp(struct via_spec *spec, hda_nid_t nid, - int idx, int dir) -{ - spec->gen.beep_nid = nid; - spec->beep_amp = HDA_COMPOSE_AMP_VAL(nid, 1, idx, dir); -} - /* additional beep mixers; the actual parameters are overwritten at build */ -static const struct snd_kcontrol_new cxt_beep_mixer[] = { +static const struct snd_kcontrol_new via_beep_mixer[] = { HDA_CODEC_VOLUME_MONO("Beep Playback Volume", 0, 1, 0, HDA_OUTPUT), HDA_CODEC_MUTE_BEEP_MONO("Beep Playback Switch", 0, 1, 0, HDA_OUTPUT), - { } /* end */ }; -/* create beep controls if needed */ -static int add_beep_ctls(struct hda_codec *codec) +static int set_beep_amp(struct via_spec *spec, hda_nid_t nid, + int idx, int dir) { - struct via_spec *spec = codec->spec; - int err; + struct snd_kcontrol_new *knew; + unsigned int beep_amp = HDA_COMPOSE_AMP_VAL(nid, 1, idx, dir); + int i; - if (spec->beep_amp) { - const struct snd_kcontrol_new *knew; - for (knew = cxt_beep_mixer; knew->name; knew++) { - struct snd_kcontrol *kctl; - kctl = snd_ctl_new1(knew, codec); - if (!kctl) - return -ENOMEM; - kctl->private_value = spec->beep_amp; - err = snd_hda_ctl_add(codec, 0, kctl); - if (err < 0) - return err; - } + spec->gen.beep_nid = nid; + for (i = 0; i < ARRAY_SIZE(via_beep_mixer); i++) { + knew = snd_hda_gen_add_kctl(&spec->gen, NULL, + &via_beep_mixer[i]); + if (!knew) + return -ENOMEM; + knew->private_value = beep_amp; } return 0; } -static void auto_parse_beep(struct hda_codec *codec) +static int auto_parse_beep(struct hda_codec *codec) { struct via_spec *spec = codec->spec; hda_nid_t nid; for_each_hda_codec_node(nid, codec) - if (get_wcaps_type(get_wcaps(codec, nid)) == AC_WID_BEEP) { - set_beep_amp(spec, nid, 0, HDA_OUTPUT); - break; - } + if (get_wcaps_type(get_wcaps(codec, nid)) == AC_WID_BEEP) + return set_beep_amp(spec, nid, 0, HDA_OUTPUT); + return 0; } #else -#define set_beep_amp(spec, nid, idx, dir) /* NOP */ -#define add_beep_ctls(codec) 0 -#define auto_parse_beep(codec) +#define auto_parse_beep(codec) 0 #endif /* check AA path's mute status */ @@ -403,30 +376,6 @@ return __analog_low_current_mode(codec, false); } -static int via_build_controls(struct hda_codec *codec) -{ - struct via_spec *spec = codec->spec; - int err, i; - - err = snd_hda_gen_build_controls(codec); - if (err < 0) - return err; - - err = add_beep_ctls(codec); - if (err < 0) - return err; - - spec->mixers[spec->num_mixers++] = via_pin_power_ctl_enum; - - for (i = 0; i < spec->num_mixers; i++) { - err = snd_hda_add_new_ctls(codec, spec->mixers[i]); - if (err < 0) - return err; - } - - return 0; -} - static void via_playback_pcm_hook(struct hda_pcm_stream *hinfo, struct hda_codec *codec, struct snd_pcm_substream *substream, @@ -481,7 +430,7 @@ static int via_init(struct hda_codec *codec); static const struct hda_codec_ops via_patch_ops = { - .build_controls = via_build_controls, + .build_controls = snd_hda_gen_build_controls, .build_pcms = snd_hda_gen_build_pcms, .init = via_init, .free = via_free, @@ -545,16 +494,13 @@ return 1; } -static const struct snd_kcontrol_new vt1708_jack_detect_ctl[] = { - { +static const struct snd_kcontrol_new vt1708_jack_detect_ctl = { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = "Jack Detect", .count = 1, .info = snd_ctl_boolean_mono_info, .get = vt1708_jack_detect_get, .put = vt1708_jack_detect_put, - }, - {} /* terminator */ }; static const struct badness_table via_main_out_badness = { @@ -586,12 +532,17 @@ if (err < 0) return err; - auto_parse_beep(codec); - err = snd_hda_gen_parse_auto_config(codec, &spec->gen.autocfg); if (err < 0) return err; + err = auto_parse_beep(codec); + if (err < 0) + return err; + + if (!snd_hda_gen_add_kctl(&spec->gen, NULL, &via_pin_power_ctl_enum)) + return -ENOMEM; + /* disable widget PM at start for compatibility */ codec->power_save_node = 0; spec->gen.power_down_unused = 0; @@ -600,12 +551,6 @@ static int via_init(struct hda_codec *codec) { - struct via_spec *spec = codec->spec; - int i; - - for (i = 0; i < spec->num_iverbs; i++) - snd_hda_sequence_write(codec, spec->init_verbs[i]); - /* init power states */ __analog_low_current_mode(codec, true); @@ -623,7 +568,7 @@ int err; int old_interval = codec->jackpoll_interval; codec->jackpoll_interval = msecs_to_jiffies(100); - err = via_build_controls(codec); + err = snd_hda_gen_build_controls(codec); codec->jackpoll_interval = old_interval; return err; } @@ -684,22 +629,29 @@ vt1708_set_pinconfig_connect(codec, VT1708_HP_PIN_NID); vt1708_set_pinconfig_connect(codec, VT1708_CD_PIN_NID); + err = snd_hda_add_verbs(codec, vt1708_init_verbs); + if (err < 0) + goto error; + /* automatic parse from the BIOS config */ err = via_parse_auto_config(codec); - if (err < 0) { - via_free(codec); - return err; - } + if (err < 0) + goto error; /* add jack detect on/off control */ - spec->mixers[spec->num_mixers++] = vt1708_jack_detect_ctl; - - spec->init_verbs[spec->num_iverbs++] = vt1708_init_verbs; + if (!snd_hda_gen_add_kctl(&spec->gen, NULL, &vt1708_jack_detect_ctl)) { + err = -ENOMEM; + goto error; + } /* clear jackpoll_interval again; it's set dynamically */ codec->jackpoll_interval = 0; return 0; + + error: + via_free(codec); + return err; } static int patch_vt1709(struct hda_codec *codec) @@ -715,12 +667,14 @@ spec->gen.mixer_nid = 0x18; err = via_parse_auto_config(codec); - if (err < 0) { - via_free(codec); - return err; - } + if (err < 0) + goto error; return 0; + + error: + via_free(codec); + return err; } static int patch_vt1708S(struct hda_codec *codec); @@ -741,12 +695,14 @@ /* automatic parse from the BIOS config */ err = via_parse_auto_config(codec); - if (err < 0) { - via_free(codec); - return err; - } + if (err < 0) + goto error; return 0; + + error: + via_free(codec); + return err; } /* Patch for VT1708S */ @@ -791,16 +747,20 @@ if (codec->core.vendor_id == 0x11064397) snd_hda_codec_set_name(codec, "VT1705"); + err = snd_hda_add_verbs(codec, vt1708S_init_verbs); + if (err < 0) + goto error; + /* automatic parse from the BIOS config */ err = via_parse_auto_config(codec); - if (err < 0) { - via_free(codec); - return err; - } - - spec->init_verbs[spec->num_iverbs++] = vt1708S_init_verbs; + if (err < 0) + goto error; return 0; + + error: + via_free(codec); + return err; } /* Patch for VT1702 */ @@ -832,16 +792,20 @@ (0x5 << AC_AMPCAP_STEP_SIZE_SHIFT) | (1 << AC_AMPCAP_MUTE_SHIFT)); + err = snd_hda_add_verbs(codec, vt1702_init_verbs); + if (err < 0) + goto error; + /* automatic parse from the BIOS config */ err = via_parse_auto_config(codec); - if (err < 0) { - via_free(codec); - return err; - } - - spec->init_verbs[spec->num_iverbs++] = vt1702_init_verbs; + if (err < 0) + goto error; return 0; + + error: + via_free(codec); + return err; } /* Patch for VT1718S */ @@ -904,16 +868,20 @@ override_mic_boost(codec, 0x29, 0, 3, 40); add_secret_dac_path(codec); + err = snd_hda_add_verbs(codec, vt1718S_init_verbs); + if (err < 0) + goto error; + /* automatic parse from the BIOS config */ err = via_parse_auto_config(codec); - if (err < 0) { - via_free(codec); - return err; - } - - spec->init_verbs[spec->num_iverbs++] = vt1718S_init_verbs; + if (err < 0) + goto error; return 0; + + error: + via_free(codec); + return err; } /* Patch for VT1716S */ @@ -955,9 +923,9 @@ return 1; } -static const struct snd_kcontrol_new vt1716s_dmic_mixer[] = { - HDA_CODEC_VOLUME("Digital Mic Capture Volume", 0x22, 0x0, HDA_INPUT), - { +static const struct snd_kcontrol_new vt1716s_dmic_mixer_vol = + HDA_CODEC_VOLUME("Digital Mic Capture Volume", 0x22, 0x0, HDA_INPUT); +static const struct snd_kcontrol_new vt1716s_dmic_mixer_sw = { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = "Digital Mic Capture Switch", .subdevice = HDA_SUBDEV_NID_FLAG | 0x26, @@ -965,16 +933,12 @@ .info = vt1716s_dmic_info, .get = vt1716s_dmic_get, .put = vt1716s_dmic_put, - }, - {} /* end */ }; /* mono-out mixer elements */ -static const struct snd_kcontrol_new vt1716S_mono_out_mixer[] = { - HDA_CODEC_MUTE("Mono Playback Switch", 0x2a, 0x0, HDA_OUTPUT), - { } /* end */ -}; +static const struct snd_kcontrol_new vt1716S_mono_out_mixer = + HDA_CODEC_MUTE("Mono Playback Switch", 0x2a, 0x0, HDA_OUTPUT); static const struct hda_verb vt1716S_init_verbs[] = { /* Enable Boost Volume backdoor */ @@ -1000,19 +964,27 @@ override_mic_boost(codec, 0x1a, 0, 3, 40); override_mic_boost(codec, 0x1e, 0, 3, 40); + err = snd_hda_add_verbs(codec, vt1716S_init_verbs); + if (err < 0) + goto error; + /* automatic parse from the BIOS config */ err = via_parse_auto_config(codec); - if (err < 0) { - via_free(codec); - return err; - } - - spec->init_verbs[spec->num_iverbs++] = vt1716S_init_verbs; + if (err < 0) + goto error; - spec->mixers[spec->num_mixers++] = vt1716s_dmic_mixer; - spec->mixers[spec->num_mixers++] = vt1716S_mono_out_mixer; + if (!snd_hda_gen_add_kctl(&spec->gen, NULL, &vt1716s_dmic_mixer_vol) || + !snd_hda_gen_add_kctl(&spec->gen, NULL, &vt1716s_dmic_mixer_sw) || + !snd_hda_gen_add_kctl(&spec->gen, NULL, &vt1716S_mono_out_mixer)) { + err = -ENOMEM; + goto error; + } return 0; + + error: + via_free(codec); + return err; } /* for vt2002P */ @@ -1107,19 +1079,23 @@ snd_hda_pick_fixup(codec, NULL, vt2002p_fixups, via_fixups); snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE); - /* automatic parse from the BIOS config */ - err = via_parse_auto_config(codec); - if (err < 0) { - via_free(codec); - return err; - } - if (spec->codec_type == VT1802) - spec->init_verbs[spec->num_iverbs++] = vt1802_init_verbs; + err = snd_hda_add_verbs(codec, vt1802_init_verbs); else - spec->init_verbs[spec->num_iverbs++] = vt2002P_init_verbs; + err = snd_hda_add_verbs(codec, vt2002P_init_verbs); + if (err < 0) + goto error; + + /* automatic parse from the BIOS config */ + err = via_parse_auto_config(codec); + if (err < 0) + goto error; return 0; + + error: + via_free(codec); + return err; } /* for vt1812 */ @@ -1148,16 +1124,20 @@ override_mic_boost(codec, 0x29, 0, 3, 40); add_secret_dac_path(codec); + err = snd_hda_add_verbs(codec, vt1812_init_verbs); + if (err < 0) + goto error; + /* automatic parse from the BIOS config */ err = via_parse_auto_config(codec); - if (err < 0) { - via_free(codec); - return err; - } - - spec->init_verbs[spec->num_iverbs++] = vt1812_init_verbs; + if (err < 0) + goto error; return 0; + + error: + via_free(codec); + return err; } /* patch for vt3476 */ @@ -1185,16 +1165,20 @@ spec->gen.mixer_nid = 0x3f; add_secret_dac_path(codec); + err = snd_hda_add_verbs(codec, vt3476_init_verbs); + if (err < 0) + goto error; + /* automatic parse from the BIOS config */ err = via_parse_auto_config(codec); - if (err < 0) { - via_free(codec); - return err; - } - - spec->init_verbs[spec->num_iverbs++] = vt3476_init_verbs; + if (err < 0) + goto error; return 0; + + error: + via_free(codec); + return err; } /* diff -Nru oem-audio-hda-daily-lts-xenial-dkms-0.201807310409~ubuntu14.04.1/hda-src-from-tree/thinkpad_helper.c oem-audio-hda-daily-lts-xenial-dkms-0.201808040346~ubuntu14.04.1/hda-src-from-tree/thinkpad_helper.c --- oem-audio-hda-daily-lts-xenial-dkms-0.201807310409~ubuntu14.04.1/hda-src-from-tree/thinkpad_helper.c 2018-07-31 04:09:28.000000000 +0000 +++ oem-audio-hda-daily-lts-xenial-dkms-0.201808040346~ubuntu14.04.1/hda-src-from-tree/thinkpad_helper.c 2018-08-04 03:46:28.000000000 +0000 @@ -27,17 +27,11 @@ led_set_func(TPACPI_LED_MUTE, !enabled); } -static void update_tpacpi_micmute_led(struct hda_codec *codec, - struct snd_kcontrol *kcontrol, - struct snd_ctl_elem_value *ucontrol) +static void update_tpacpi_micmute(struct hda_codec *codec) { - if (!ucontrol || !led_set_func) - return; - if (strcmp("Capture Switch", ucontrol->id.name) == 0 && ucontrol->id.index == 0) { - /* TODO: How do I verify if it's a mono or stereo here? */ - bool val = ucontrol->value.integer.value[0] || ucontrol->value.integer.value[1]; - led_set_func(TPACPI_LED_MICMUTE, !val); - } + struct hda_gen_spec *spec = codec->spec; + + led_set_func(TPACPI_LED_MICMUTE, spec->micmute_led.led_value); } static void hda_fixup_thinkpad_acpi(struct hda_codec *codec, @@ -63,15 +57,10 @@ spec->vmaster_mute.hook = update_tpacpi_mute_led; removefunc = false; } - if (led_set_func(TPACPI_LED_MICMUTE, false) >= 0) { - if (spec->num_adc_nids > 1 && !spec->dyn_adc_switch) - codec_dbg(codec, - "Skipping micmute LED control due to several ADCs"); - else { - spec->cap_sync_hook = update_tpacpi_micmute_led; - removefunc = false; - } - } + if (led_set_func(TPACPI_LED_MICMUTE, false) >= 0 && + snd_hda_gen_add_micmute_led(codec, + update_tpacpi_micmute) > 0) + removefunc = false; } if (led_set_func && (action == HDA_FIXUP_ACT_FREE || removefunc)) { diff -Nru oem-audio-hda-daily-lts-xenial-dkms-0.201807310409~ubuntu14.04.1/patches-xenial/call_i915_bpo_for_xenial.patch oem-audio-hda-daily-lts-xenial-dkms-0.201808040346~ubuntu14.04.1/patches-xenial/call_i915_bpo_for_xenial.patch --- oem-audio-hda-daily-lts-xenial-dkms-0.201807310409~ubuntu14.04.1/patches-xenial/call_i915_bpo_for_xenial.patch 2018-07-31 04:09:47.000000000 +0000 +++ oem-audio-hda-daily-lts-xenial-dkms-0.201808040346~ubuntu14.04.1/patches-xenial/call_i915_bpo_for_xenial.patch 2018-08-04 03:46:43.000000000 +0000 @@ -2,7 +2,7 @@ =================================================================== --- oem-audio-hda-daily-0.1.orig/hda_intel.c +++ oem-audio-hda-daily-0.1/hda_intel.c -@@ -2207,6 +2207,10 @@ static int azx_probe_continue(struct azx +@@ -2253,6 +2253,10 @@ static int azx_probe_continue(struct azx /* bind with i915 if needed */ if (chip->driver_caps & AZX_DCAPS_I915_COMPONENT) { @@ -17,9 +17,9 @@ =================================================================== --- oem-audio-hda-daily-0.1.orig/hdacore/hdac_i915.c +++ oem-audio-hda-daily-0.1/hdacore/hdac_i915.c -@@ -312,6 +312,11 @@ static int hdac_component_master_match(s - return !strcmp(dev->driver->name, "i915"); - } +@@ -112,6 +112,11 @@ static const struct drm_audio_component_ + .master_bind = i915_master_bind + }; +static int hdac_component_master_match_bpo(struct device *dev, void *data) +{ @@ -27,24 +27,13 @@ +} + /** - * snd_hdac_i915_register_notifier - Register i915 audio component ops - * @aops: i915 audio component ops -@@ -395,9 +400,9 @@ int snd_hdac_i915_init(struct hdac_bus * - dev_dbg(dev, "bound to i915 component master\n"); - + * snd_hdac_i915_init - Initialize i915 audio component + * @bus: HDA core bus +@@ -154,3 +159,46 @@ int snd_hdac_i915_init(struct hdac_bus * return 0; --out_master_del: -+ out_master_del: - component_master_del(dev, &hdac_component_master_ops); --out_err: -+ out_err: - kfree(acomp); - bus->audio_component = NULL; - hdac_acomp = NULL; -@@ -407,6 +412,51 @@ out_err: } EXPORT_SYMBOL_GPL(snd_hdac_i915_init); - ++ +int snd_hdac_i915_init_bpo(struct hdac_bus *bus) +{ + struct component_match *match = NULL; @@ -77,9 +66,9 @@ + dev_dbg(dev, "bound to i915_bpo component master\n"); + + return 0; -+ out_master_del: ++out_master_del: + component_master_del(dev, &hdac_component_master_ops); -+ out_err: ++out_err: + kfree(acomp); + bus->audio_component = NULL; + dev_err(dev, "failed to add i915_bpo component master (%d)\n", ret); @@ -87,25 +76,19 @@ + return ret; +} +EXPORT_SYMBOL_GPL(snd_hdac_i915_init_bpo); -+ -+ -+ - /** - * snd_hdac_i915_exit - Finalize i915 audio component - * @bus: HDA core bus Index: oem-audio-hda-daily-0.1/include/hda_i915.h =================================================================== --- oem-audio-hda-daily-0.1.orig/include/hda_i915.h +++ oem-audio-hda-daily-0.1/include/hda_i915.h -@@ -15,6 +15,7 @@ int snd_hdac_sync_audio_rate(struct hdac - int snd_hdac_acomp_get_eld(struct hdac_device *codec, hda_nid_t nid, int dev_id, - bool *audio_enabled, char *buffer, int max_bytes); +@@ -10,6 +10,7 @@ + #ifdef CONFIG_SND_HDA_I915 + void snd_hdac_i915_set_bclk(struct hdac_bus *bus); int snd_hdac_i915_init(struct hdac_bus *bus); +int snd_hdac_i915_init_bpo(struct hdac_bus *bus); - int snd_hdac_i915_exit(struct hdac_bus *bus); - int snd_hdac_i915_register_notifier(const struct i915_audio_component_audio_ops *); #else -@@ -44,6 +45,10 @@ static inline int snd_hdac_i915_init(str + static inline void snd_hdac_i915_set_bclk(struct hdac_bus *bus) + { +@@ -18,6 +19,10 @@ static inline int snd_hdac_i915_init(str { return -ENODEV; } @@ -113,6 +96,6 @@ +{ + return -ENODEV; +} + #endif static inline int snd_hdac_i915_exit(struct hdac_bus *bus) { - return 0; diff -Nru oem-audio-hda-daily-lts-xenial-dkms-0.201807310409~ubuntu14.04.1/patches-xenial/drm_audio_component.patch oem-audio-hda-daily-lts-xenial-dkms-0.201808040346~ubuntu14.04.1/patches-xenial/drm_audio_component.patch --- oem-audio-hda-daily-lts-xenial-dkms-0.201807310409~ubuntu14.04.1/patches-xenial/drm_audio_component.patch 1970-01-01 00:00:00.000000000 +0000 +++ oem-audio-hda-daily-lts-xenial-dkms-0.201808040346~ubuntu14.04.1/patches-xenial/drm_audio_component.patch 2018-08-04 03:46:43.000000000 +0000 @@ -0,0 +1,265 @@ +Index: oem-audio-hda-daily-0.1/hdacore/hdac_component.c +=================================================================== +--- oem-audio-hda-daily-0.1.orig/hdacore/hdac_component.c ++++ oem-audio-hda-daily-0.1/hdacore/hdac_component.c +@@ -14,7 +14,7 @@ static void hdac_acomp_release(struct de + { + } + +-static struct drm_audio_component *hdac_get_acomp(struct device *dev) ++static struct i915_audio_component *hdac_get_acomp(struct device *dev) + { + return devres_find(dev, hdac_acomp_release, NULL, NULL); + } +@@ -34,7 +34,7 @@ static struct drm_audio_component *hdac_ + */ + int snd_hdac_set_codec_wakeup(struct hdac_bus *bus, bool enable) + { +- struct drm_audio_component *acomp = bus->audio_component; ++ struct i915_audio_component *acomp = bus->audio_component; + + if (!acomp || !acomp->ops) + return -ENODEV; +@@ -66,7 +66,7 @@ EXPORT_SYMBOL_GPL(snd_hdac_set_codec_wak + */ + int snd_hdac_display_power(struct hdac_bus *bus, bool enable) + { +- struct drm_audio_component *acomp = bus->audio_component; ++ struct i915_audio_component *acomp = bus->audio_component; + + if (!acomp || !acomp->ops) + return -ENODEV; +@@ -75,15 +75,15 @@ int snd_hdac_display_power(struct hdac_b + enable ? "enable" : "disable"); + + if (enable) { +- if (!bus->drm_power_refcount++) { ++ if (!bus->i915_power_refcount++) { + if (acomp->ops->get_power) + acomp->ops->get_power(acomp->dev); + snd_hdac_set_codec_wakeup(bus, true); + snd_hdac_set_codec_wakeup(bus, false); + } + } else { +- WARN_ON(!bus->drm_power_refcount); +- if (!--bus->drm_power_refcount) ++ WARN_ON(!bus->i915_power_refcount); ++ if (!--bus->i915_power_refcount) + if (acomp->ops->put_power) + acomp->ops->put_power(acomp->dev); + } +@@ -109,7 +109,7 @@ int snd_hdac_sync_audio_rate(struct hdac + int dev_id, int rate) + { + struct hdac_bus *bus = codec->bus; +- struct drm_audio_component *acomp = bus->audio_component; ++ struct i915_audio_component *acomp = bus->audio_component; + int port, pipe; + + if (!acomp || !acomp->ops || !acomp->ops->sync_audio_rate) +@@ -150,7 +150,7 @@ int snd_hdac_acomp_get_eld(struct hdac_d + bool *audio_enabled, char *buffer, int max_bytes) + { + struct hdac_bus *bus = codec->bus; +- struct drm_audio_component *acomp = bus->audio_component; ++ struct i915_audio_component *acomp = bus->audio_component; + int port, pipe; + + if (!acomp || !acomp->ops || !acomp->ops->get_eld) +@@ -170,7 +170,7 @@ EXPORT_SYMBOL_GPL(snd_hdac_acomp_get_eld + + static int hdac_component_master_bind(struct device *dev) + { +- struct drm_audio_component *acomp = hdac_get_acomp(dev); ++ struct i915_audio_component *acomp = hdac_get_acomp(dev); + int ret; + + if (WARN_ON(!acomp)) +@@ -209,7 +209,7 @@ out_unbind: + + static void hdac_component_master_unbind(struct device *dev) + { +- struct drm_audio_component *acomp = hdac_get_acomp(dev); ++ struct i915_audio_component *acomp = hdac_get_acomp(dev); + + if (acomp->audio_ops && acomp->audio_ops->master_unbind) + acomp->audio_ops->master_unbind(dev, acomp); +@@ -236,7 +236,7 @@ static const struct component_master_ops + * Returns zero for success or a negative error code. + */ + int snd_hdac_acomp_register_notifier(struct hdac_bus *bus, +- const struct drm_audio_component_audio_ops *aops) ++ const struct i915_audio_component_audio_ops *aops) + { + if (!bus->audio_component) + return -ENODEV; +@@ -265,13 +265,13 @@ EXPORT_SYMBOL_GPL(snd_hdac_acomp_registe + * Returns zero for success or a negative error code. + */ + int snd_hdac_acomp_init(struct hdac_bus *bus, +- const struct drm_audio_component_audio_ops *aops, ++ const struct i915_audio_component_audio_ops *aops, + int (*match_master)(struct device *, void *), + size_t extra_size) + { + struct component_match *match = NULL; + struct device *dev = bus->dev; +- struct drm_audio_component *acomp; ++ struct i915_audio_component *acomp; + int ret; + + if (WARN_ON(hdac_get_acomp(dev))) +@@ -316,13 +316,13 @@ EXPORT_SYMBOL_GPL(snd_hdac_acomp_init); + int snd_hdac_acomp_exit(struct hdac_bus *bus) + { + struct device *dev = bus->dev; +- struct drm_audio_component *acomp = bus->audio_component; ++ struct i915_audio_component *acomp = bus->audio_component; + + if (!acomp) + return 0; + +- WARN_ON(bus->drm_power_refcount); +- if (bus->drm_power_refcount > 0 && acomp->ops) ++ WARN_ON(bus->i915_power_refcount); ++ if (bus->i915_power_refcount > 0 && acomp->ops) + acomp->ops->put_power(acomp->dev); + + component_master_del(dev, &hdac_component_master_ops); +Index: oem-audio-hda-daily-0.1/hdacore/hdac_i915.c +=================================================================== +--- oem-audio-hda-daily-0.1.orig/hdacore/hdac_i915.c ++++ oem-audio-hda-daily-0.1/hdacore/hdac_i915.c +@@ -43,7 +43,7 @@ static struct completion bind_complete; + */ + void snd_hdac_i915_set_bclk(struct hdac_bus *bus) + { +- struct drm_audio_component *acomp = bus->audio_component; ++ struct i915_audio_component *acomp = bus->audio_component; + struct pci_dev *pci = to_pci_dev(bus->dev); + int cdclk_freq; + unsigned int bclk_m, bclk_n; +@@ -100,7 +100,7 @@ static bool i915_gfx_present(void) + } + + static int i915_master_bind(struct device *dev, +- struct drm_audio_component *acomp) ++ struct i915_audio_component *acomp) + { + complete_all(&bind_complete); + /* clear audio_ops here as it was needed only for completion call */ +@@ -108,8 +108,8 @@ static int i915_master_bind(struct devic + return 0; + } + +-static const struct drm_audio_component_audio_ops i915_init_ops = { +- .master_bind = i915_master_bind ++static const struct i915_audio_component_audio_ops i915_init_ops = { ++ /* .master_bind = i915_master_bind */ + }; + + /** +@@ -126,7 +126,7 @@ static const struct drm_audio_component_ + */ + int snd_hdac_i915_init(struct hdac_bus *bus) + { +- struct drm_audio_component *acomp; ++ struct i915_audio_component *acomp; + int err; + + if (!i915_gfx_present()) +Index: oem-audio-hda-daily-0.1/include/hda_component.h +=================================================================== +--- oem-audio-hda-daily-0.1.orig/include/hda_component.h ++++ oem-audio-hda-daily-0.1/include/hda_component.h +@@ -4,7 +4,7 @@ + #ifndef __SOUND_HDA_COMPONENT_H + #define __SOUND_HDA_COMPONENT_H + +-#include ++#include + + #ifdef CONFIG_SND_HDA_COMPONENT + int snd_hdac_set_codec_wakeup(struct hdac_bus *bus, bool enable); +@@ -14,12 +14,12 @@ int snd_hdac_sync_audio_rate(struct hdac + int snd_hdac_acomp_get_eld(struct hdac_device *codec, hda_nid_t nid, int dev_id, + bool *audio_enabled, char *buffer, int max_bytes); + int snd_hdac_acomp_init(struct hdac_bus *bus, +- const struct drm_audio_component_audio_ops *aops, ++ const struct i915_audio_component_audio_ops *aops, + int (*match_master)(struct device *, void *), + size_t extra_size); + int snd_hdac_acomp_exit(struct hdac_bus *bus); + int snd_hdac_acomp_register_notifier(struct hdac_bus *bus, +- const struct drm_audio_component_audio_ops *ops); ++ const struct i915_audio_component_audio_ops *ops); + #else + static inline int snd_hdac_set_codec_wakeup(struct hdac_bus *bus, bool enable) + { +@@ -41,7 +41,7 @@ static inline int snd_hdac_acomp_get_eld + return -ENODEV; + } + static inline int snd_hdac_acomp_init(struct hdac_bus *bus, +- const struct drm_audio_component_audio_ops *aops, ++ const struct i915_audio_component_audio_ops *aops, + int (*match_master)(struct device *, void *), + size_t extra_size) + { +@@ -52,7 +52,7 @@ static inline int snd_hdac_acomp_exit(st + return 0; + } + static inline int snd_hdac_acomp_register_notifier(struct hdac_bus *bus, +- const struct drm_audio_component_audio_ops *ops) ++ const struct i915_audio_component_audio_ops *ops) + { + return -ENODEV; + } +Index: oem-audio-hda-daily-0.1/include/hdaudio.h +=================================================================== +--- oem-audio-hda-daily-0.1.orig/include/hdaudio.h ++++ oem-audio-hda-daily-0.1/include/hdaudio.h +@@ -362,8 +362,8 @@ struct hdac_bus { + struct mutex cmd_mutex; + + /* DRM component interface */ +- struct drm_audio_component *audio_component; +- int drm_power_refcount; ++ struct i915_audio_component *audio_component; ++ int i915_power_refcount; + + /* parameters required for enhanced capabilities */ + int num_streams; +Index: oem-audio-hda-daily-0.1/patch_hdmi.c +=================================================================== +--- oem-audio-hda-daily-0.1.orig/patch_hdmi.c ++++ oem-audio-hda-daily-0.1/patch_hdmi.c +@@ -177,7 +177,7 @@ struct hdmi_spec { + + /* i915/powerwell (Haswell+/Valleyview+) specific */ + bool use_acomp_notifier; /* use i915 eld_notify callback for hotplug */ +- struct drm_audio_component_audio_ops drm_audio_ops; ++ struct i915_audio_component_audio_ops i915_audio_ops; + + struct hdac_chmap chmap; + hda_nid_t vendor_nid; +@@ -2533,16 +2533,16 @@ static void register_i915_notifier(struc + struct hdmi_spec *spec = codec->spec; + + spec->use_acomp_notifier = true; +- spec->drm_audio_ops.audio_ptr = codec; ++ spec->i915_audio_ops.audio_ptr = codec; + /* intel_audio_codec_enable() or intel_audio_codec_disable() + * will call pin_eld_notify with using audio_ptr pointer + * We need make sure audio_ptr is really setup + */ + wmb(); +- spec->drm_audio_ops.pin2port = intel_pin2port; +- spec->drm_audio_ops.pin_eld_notify = intel_pin_eld_notify; ++ /* spec->i915_audio_ops.pin2port = intel_pin2port; */ ++ spec->i915_audio_ops.pin_eld_notify = intel_pin_eld_notify; + snd_hdac_acomp_register_notifier(&codec->bus->core, +- &spec->drm_audio_ops); ++ &spec->i915_audio_ops); + } + + /* setup_stream ops override for HSW+ */ diff -Nru oem-audio-hda-daily-lts-xenial-dkms-0.201807310409~ubuntu14.04.1/patches-xenial/remove_hdacore_ext.patch oem-audio-hda-daily-lts-xenial-dkms-0.201808040346~ubuntu14.04.1/patches-xenial/remove_hdacore_ext.patch --- oem-audio-hda-daily-lts-xenial-dkms-0.201807310409~ubuntu14.04.1/patches-xenial/remove_hdacore_ext.patch 1970-01-01 00:00:00.000000000 +0000 +++ oem-audio-hda-daily-lts-xenial-dkms-0.201808040346~ubuntu14.04.1/patches-xenial/remove_hdacore_ext.patch 2018-08-04 03:46:43.000000000 +0000 @@ -0,0 +1,10 @@ +Index: oem-audio-hda-daily-0.1/hdacore/Makefile +=================================================================== +--- oem-audio-hda-daily-0.1.orig/hdacore/Makefile ++++ oem-audio-hda-daily-0.1/hdacore/Makefile +@@ -12,4 +12,4 @@ snd-hda-core-$(CONFIG_SND_HDA_I915) += h + obj-$(CONFIG_SND_HDA_CORE) += snd-hda-core.o + + #extended hda +-obj-$(CONFIG_SND_HDA_EXT_CORE) += ext/ ++#obj-$(CONFIG_SND_HDA_EXT_CORE) += ext/ diff -Nru oem-audio-hda-daily-lts-xenial-dkms-0.201807310409~ubuntu14.04.1/patches-xenial/series oem-audio-hda-daily-lts-xenial-dkms-0.201808040346~ubuntu14.04.1/patches-xenial/series --- oem-audio-hda-daily-lts-xenial-dkms-0.201807310409~ubuntu14.04.1/patches-xenial/series 2018-07-31 04:09:47.000000000 +0000 +++ oem-audio-hda-daily-lts-xenial-dkms-0.201808040346~ubuntu14.04.1/patches-xenial/series 2018-08-04 03:46:43.000000000 +0000 @@ -5,9 +5,12 @@ kbuild_modname_fix.patch acpi_dev_present.patch call_i915_bpo_for_xenial.patch -mst-sync-audio-rate-get-eld.patch +#mst-sync-audio-rate-get-eld.patch remove-para-pipe-for-mst.patch restore-cacheflush.patch restore-dell-led-wmi-helper.patch add_PCI_CLASS_MULTIMEDIA_HD_AUDIO.patch fix_nospec_header.patch +drm_audio_component.patch +vga_switchroo.patch +remove_hdacore_ext.patch diff -Nru oem-audio-hda-daily-lts-xenial-dkms-0.201807310409~ubuntu14.04.1/patches-xenial/vga_switchroo.patch oem-audio-hda-daily-lts-xenial-dkms-0.201808040346~ubuntu14.04.1/patches-xenial/vga_switchroo.patch --- oem-audio-hda-daily-lts-xenial-dkms-0.201807310409~ubuntu14.04.1/patches-xenial/vga_switchroo.patch 1970-01-01 00:00:00.000000000 +0000 +++ oem-audio-hda-daily-lts-xenial-dkms-0.201808040346~ubuntu14.04.1/patches-xenial/vga_switchroo.patch 2018-08-04 03:46:43.000000000 +0000 @@ -0,0 +1,13 @@ +Index: oem-audio-hda-daily-0.1/hda_intel.c +=================================================================== +--- oem-audio-hda-daily-0.1.orig/hda_intel.c ++++ oem-audio-hda-daily-0.1/hda_intel.c +@@ -1328,7 +1328,7 @@ static int register_vga_switcheroo(struc + return 0; + + p = get_bound_vga(chip->pci); +- err = vga_switcheroo_register_audio_client(chip->pci, &azx_vs_ops, p); ++ err = vga_switcheroo_register_audio_client(chip->pci, &azx_vs_ops, VGA_SWITCHEROO_DIS); + pci_dev_put(p); + + if (err < 0)