Home Home > GIT Browse > stable
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKernel Build Daemon <kbuild@suse.de>2018-07-03 07:00:20 +0200
committerKernel Build Daemon <kbuild@suse.de>2018-07-03 07:00:20 +0200
commit197c6c3021bb04d5378400120a786b1b25e0d475 (patch)
tree33063c392c346dfcf31d7a8e4806a3154c4aed76
parent03d2a463286b45d66a7003003d6aa7d83a02a7a9 (diff)
parentd9fe4474a4531bc07e02fc872ec826ed51bd4cd0 (diff)
Merge branch 'SLE12-SP3' into SLE12-SP3-AZURErpm-4.4.138-4.7
-rw-r--r--blacklist.conf2
-rw-r--r--patches.arch/ACPI-utils-Rename-acpi_dev_present.patch18
-rw-r--r--patches.arch/s390-sles12sp3-17-01-01-zfcp-missing-SCSI-trace-result-eh_host_reset.patch285
-rw-r--r--patches.arch/s390-sles12sp3-17-01-02-zfcp-missing-SCSI-trace-retry-abort-TMF.patch247
-rw-r--r--patches.arch/s390-sles12sp3-17-01-03-zfcp-misleading-REC-trig-trace-erp-setup-failed.patch262
-rw-r--r--patches.arch/s390-sles12sp3-17-01-04-zfcp-missing-REC-trig-trace-t_rport_io-early-ret.patch257
-rw-r--r--patches.arch/s390-sles12sp3-17-01-05-zfcp-missing-REC-trig-trace-t_rport_io-ERP_FAILED.patch273
-rw-r--r--patches.arch/s390-sles12sp3-17-01-06-zfcp-missing-REC-trig-trace-all-objects-ERP_FAILED.patch330
-rw-r--r--patches.arch/s390-sles12sp3-17-01-07-zfcp-missing-REC-trig-trace-enqueue-no-ERP-thread.patch203
-rw-r--r--patches.drivers/ALSA-hda-Clean-up-ALC299-init-code38
-rw-r--r--patches.drivers/ALSA-hda-Enable-power_save_node-for-CX2072234
-rw-r--r--patches.drivers/ALSA-hda-Fix-a-wrong-FIXUP-for-alc289-on-Dell-machin39
-rw-r--r--patches.drivers/ALSA-hda-Fix-forget-to-free-resource-in-error-handli44
-rw-r--r--patches.drivers/ALSA-hda-Fix-incorrect-usage-of-IS_REACHABLE37
-rw-r--r--patches.drivers/ALSA-hda-Use-acpi_dev_present.patch53
-rw-r--r--patches.drivers/ALSA-hda-add-a-new-condition-to-check-if-it-is-think40
-rw-r--r--patches.drivers/ALSA-hda-add-dock-and-led-support-for-HP-EliteBook-835
-rw-r--r--patches.drivers/ALSA-hda-add-dock-and-led-support-for-HP-ProBook-64035
-rw-r--r--patches.drivers/ALSA-hda-fix-some-klockwork-scan-warnings59
-rw-r--r--patches.drivers/ALSA-hda-patch_sigmatel-Add-AmigaOne-X1000-pinconfig97
-rw-r--r--patches.drivers/ALSA-hda-realtek-Add-a-quirk-for-FSC-ESPRIMO-U921034
-rw-r--r--patches.drivers/ALSA-hda-realtek-Add-headset-mode-support-for-Dell-272
-rw-r--r--patches.drivers/ALSA-hda-realtek-Add-support-headset-mode-for-DELL-W55
-rw-r--r--patches.drivers/ALSA-hda-realtek-Clevo-P950ER-ALC1220-Fixup29
-rw-r--r--patches.drivers/ALSA-hda-realtek-Enable-Thinkpad-Dock-device-for-ALC108
-rw-r--r--patches.drivers/ALSA-hda-realtek-Enable-mic-mute-hotkey-for-several-44
-rw-r--r--patches.drivers/ALSA-hda-realtek-Fix-Dell-headset-Mic-can-t-record57
-rw-r--r--patches.drivers/ALSA-hda-realtek-Fix-mic-and-headset-jack-sense-on-A34
-rw-r--r--patches.drivers/ALSA-hda-realtek-Fix-pop-noise-on-Lenovo-P50-co63
-rw-r--r--patches.drivers/ALSA-hda-realtek-Fix-the-problem-of-two-front-mics-o56
-rw-r--r--patches.drivers/ALSA-hda-realtek-Fixup-for-HP-x360-laptops-with-B-O-170
-rw-r--r--patches.drivers/ALSA-hda-realtek-Fixup-mute-led-on-HP-Spectre-x36077
-rw-r--r--patches.drivers/ALSA-hda-realtek-Limit-mic-boost-on-T48035
-rw-r--r--patches.drivers/ALSA-hda-realtek-Make-dock-sound-work-on-ThinkPad-L536
-rw-r--r--patches.drivers/ALSA-hda-realtek-Refactor-alc269_fixup_hp_mute_led_m81
-rw-r--r--patches.drivers/ALSA-hda-realtek-Reorder-ALC269-ASUS-quirk-entries47
-rw-r--r--patches.drivers/ALSA-hda-realtek-Support-headset-mode-for-ALC215-ALC96
-rw-r--r--patches.drivers/ALSA-hda-realtek-Update-ALC255-depop-optimize35
-rw-r--r--patches.drivers/ALSA-hda-realtek-adjust-the-location-of-one-mic33
-rw-r--r--patches.drivers/ALSA-hda-realtek-change-the-location-for-one-of-two232
-rw-r--r--patches.drivers/ALSA-hda-realtek-update-ALC215-depop-optimize34
-rw-r--r--patches.drivers/ALSA-hda-realtek-update-ALC225-depop-optimize154
-rw-r--r--patches.drivers/ALSA-hda-silence-uninitialized-variable-warning-in-a33
-rw-r--r--patches.drivers/iwlmvm-tdls-Check-TDLS-channel-switch-support50
-rw-r--r--patches.drivers/iwlwifi-fix-non_shared_ant-for-9000-devices31
-rw-r--r--patches.drivers/mac80211-Fix-condition-validating-WMM-IE35
-rw-r--r--patches.drivers/platform-x86-thinkpad_acpi-Adding-new-hotkey-ID-for-48
-rw-r--r--patches.drivers/thinkpad_acpi-Add-support-for-HKEY-version-0x200173
-rw-r--r--patches.fixes/ceph-fix-dentry-leak-in-splice_dentry.patch28
-rw-r--r--series.conf50
50 files changed, 4215 insertions, 3 deletions
diff --git a/blacklist.conf b/blacklist.conf
index 363f6dbe6a..b0e56755f7 100644
--- a/blacklist.conf
+++ b/blacklist.conf
@@ -400,3 +400,5 @@ a86b06d1ccd218a6a50d6a3a88fbd2abcd0eaa94 # AFS is unsupported, backport non-triv
fbfcd0199170984bd3c2812e49ed0fe7b226959a # we don't care about alpha
fc218544fbc800d1c91348ec834cacfb257348f7 # requires major changes to libceph from 4.17
16001c10725e11b73b8518f42e414506bf73c291 # Preliminary patches are missing
+ab1068d6866e28bf6427ceaea681a381e5870a4a # iwlwifi: not applicable
+dc82e52492f684dcd5ed9e4773e72dbf2203d75e # ALSA core: breaks kABI
diff --git a/patches.arch/ACPI-utils-Rename-acpi_dev_present.patch b/patches.arch/ACPI-utils-Rename-acpi_dev_present.patch
index fac2ab3768..73035745fa 100644
--- a/patches.arch/ACPI-utils-Rename-acpi_dev_present.patch
+++ b/patches.arch/ACPI-utils-Rename-acpi_dev_present.patch
@@ -24,9 +24,10 @@ Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
[mb: just rename the function]
Signed-off-by: Matthias Brugger <mbrugger@suse.com>
---
- drivers/acpi/utils.c | 6 +++---
- include/acpi/acpi_bus.h | 2 +-
- 2 files changed, 4 insertions(+), 4 deletions(-)
+ drivers/acpi/utils.c | 6 +++---
+ include/acpi/acpi_bus.h | 2 +-
+ sound/pci/hda/thinkpad_helper.c | 2 +-
+ 3 files changed, 5 insertions(+), 5 deletions(-)
--- a/drivers/acpi/utils.c
+++ b/drivers/acpi/utils.c
@@ -68,3 +69,14 @@ Signed-off-by: Matthias Brugger <mbrugger@suse.com>
#ifdef CONFIG_ACPI
+--- a/sound/pci/hda/thinkpad_helper.c
++++ b/sound/pci/hda/thinkpad_helper.c
+@@ -13,7 +13,7 @@ static void (*old_vmaster_hook)(void *,
+ static bool is_thinkpad(struct hda_codec *codec)
+ {
+ return (codec->core.subsystem_id >> 16 == 0x17aa) &&
+- (acpi_dev_present("LEN0068") || acpi_dev_present("IBM0068"));
++ (acpi_dev_found("LEN0068") || acpi_dev_found("IBM0068"));
+ }
+
+ static void update_tpacpi_mute_led(void *private_data, int enabled)
diff --git a/patches.arch/s390-sles12sp3-17-01-01-zfcp-missing-SCSI-trace-result-eh_host_reset.patch b/patches.arch/s390-sles12sp3-17-01-01-zfcp-missing-SCSI-trace-result-eh_host_reset.patch
new file mode 100644
index 0000000000..caaab64252
--- /dev/null
+++ b/patches.arch/s390-sles12sp3-17-01-01-zfcp-missing-SCSI-trace-result-eh_host_reset.patch
@@ -0,0 +1,285 @@
+From: Steffen Maier <maier@linux.ibm.com>
+Subject: scsi: zfcp: fix missing SCSI trace for result of eh_host_reset_handler
+Patch-mainline: v4.18-rc1
+Git-commit: df30781699f53e4fd4c494c6f7dd16e3d5c21d30
+References: bnc#1099713, LTC#168765
+
+Description: zfcp: fix tracing regressions, part 3
+Symptom: Cannot determine result of eh_host_reset_handler.
+
+ Cannot see if and when zfcp retries abort or task management
+ functions (LUN/target reset) while synchronizing scsi_eh and
+ zfcp-internal recovery.
+
+ Confusing zfcp ERP trace record if a SCSI device is deleted
+ during scsi_eh host reset.
+
+ Cannot determine that our terminate_rport_io callback was
+ invoked if it returned early.
+
+ Cannot determine that our terminate_rport_io callback was
+ invoked if a long fast_io_fail_tmo was configured (typically
+ longer than 12 seconds, e.g. 27 seconds).
+
+ Cannot determine if something wanted to enqueue zfcp recovery
+ for an object (adapter/port regular/unit) in ERP_FAILED state.
+
+ Cannot determine if something wanted to enqueue zfcp recovery
+ but no zfcp ERP thread was running.
+Problem: v2.6.35 commit a1dbfddd02d2 ("[SCSI] zfcp: Pass return code
+ from fc_block_scsi_eh to scsi eh") introduced the first
+ return with something other than the previously hardcoded
+ single SUCCESS return path.
+
+ Due to zfcp_erp_wait() and fc_block_scsi_eh() time can pass
+ between the start of our eh callback and an actual send/recv
+ of an abort / TMF request.
+
+ If a SCSI device is deleted during scsi_eh host reset, we
+ cannot get a reference to the SCSI device anymore since
+ scsi_device_get returns !=0 by design. Assuming the recovery
+ of adapter and port(s) was successful,
+ zfcp_erp_strategy_followup_success() attempts to trigger a
+ LUN reset for the half-gone SCSI device. However,
+ zfcp_erp_setup_act() returns NULL as it cannot get the
+ reference. Hence, zfcp_erp_action_enqueue() takes an early
+ goto out and _NO_ recovery actually happens, but it writes a
+ confusing trace record which states that zfcp will do a LUN
+ recovery as "ERP need" is ZFCP_ERP_ACTION_REOPEN_LUN == 1 and
+ equals "ERP want".
+ Before v2.6.38 commit ae0904f60fab ("[SCSI] zfcp: Redesign of
+ the debug tracing for recovery actions.") we could detect
+ this case because the "erp_action" field in the trace was
+ NULL. The rework removed erp_action as argument and field
+ from the trace.
+
+ If we get an fc_rport in terminate_rport_io() for which we
+ cannot find a match within zfcp_get_port_by_wwpn(), the
+ latter can return NULL. v2.6.30 commit 70932935b61e ("[SCSI]
+ zfcp: Fix oops when port disappears") introduced an early
+ return without adding a trace record for this case.
+
+ After target cable pull: The ADISC for "link" test times out
+ after typically 4 seconds. The open port recovery times out
+ after typically 8 seconds, causing zfcp_port.status to
+ contain ERP_FAILED. zfcp_scsi_terminate_rport_io() tries to
+ enqueue forced port recovery, but due to ERP_FAILED this
+ resulted in a silent early return.
+
+ Trying to enqueue recovery for adapter / port regular / LUN
+ resulted in silent early returns.
+
+ Trying to enqueue recovery if no ERP thread was running
+ resulted in silent early returns.
+Solution: Write trace record in zfcp area SCSI and re-use SCSI result
+ field to contain the return value of eh_host_reset_handler.
+
+ Add a trace before calling the two blocking functions
+ zfcp_erp_wait() and fc_block_scsi_eh().
+
+ Introduce an eyecatcher "flag" to mark the "ERP need" as 'not
+ needed' but still keep the information which erp_action type,
+ that zfcp_erp_required_act() had decided upon, is needed.
+ 0xc_ is chosen to be visibly different from 0x0_ in "ERP
+ want".
+
+ Write trace record in zfcp area REC with "ERP need" none.
+
+ Write trace record in zfcp area REC with "ERP need" 0xe0.
+
+ zfcp_erp_action_enqueue() already had two early outs which
+ re-used the one zfcp_dbf_rec_trig() call. All ERP trigger
+ functions finally run through zfcp_erp_action_enqueue(). So
+ move the special handling for ZFCP_STATUS_COMMON_ERP_FAILED
+ into zfcp_erp_action_enqueue() and add another early out with
+ new trace marker for pseudo ERP need in this case. This
+ removes all early returns from all ERP trigger functions so
+ we always end up at zfcp_dbf_rec_trig().
+
+ Write trace record in zfcp area REC with "ERP need" 0xc0.
+Reproduction: If NPIV is not enabled with subchannel, ensure that your
+ subchannel is the only one active on the entire channel.
+ Set eh_deadline to a short enough time interval, e.g. 5
+ seconds (before FCP device online: scsi_mod.eh_deadline=5).
+ Enable RSCN suppression on the SAN switch port beyond the
+ first link, i.e. towards the storage target. Disable that
+ switch port. Send one SCSI command to the single path SCSI
+ disk of that port in the background (because it will block
+ for a while) e.g. via "dd if=/dev/sd... of=/dev/null
+ iflag=direct count=1 &". After <SCSI command timeout>
+ seconds, the command runs into the timeout. Due to the short
+ eh_deadline, the SCSI midlayer immediately performs SCSI host
+ reset. After the corresponding adapter recovery, the new
+ trace record "schrh_r" appears.
+
+ Difficult to reproduce as we need to have a SCSI command time
+ out once (abort) or twice (scsi_eh), and timely have to
+ prevent sending of the abort or TMF. Examples to prevent
+ sending is severe memory pressure, or zfcp-internal recovery
+ of the zfcp unit (e.g. write 0 to failed sysfs attribute) or
+ of the target port (depending on potentially escalated
+ scsi_eh scope) so the zfcp object is blocked.
+
+ Difficult to reproduce as we need to get into scsi_eh, fully
+ escalate to host reset, and something has to timely delete a
+ SCSI device of this Scsi_Host.
+
+ Disable auto port REscan with zfcp.no_auto_port_rescan=1. Let
+ always enabled zfcp auto port scan attach a target remote
+ port without attaching LUNs to it (zfcp.allow_lun_scan=0 and
+ no explicit zfcp unit_add). Use zfcp port_remove to remove
+ such target port again. After fast_io_fail_tmo or
+ dev_loss_tmo, the new trace record "sctrpin" can appear.
+
+ If NPIV is not enabled with subchannel, ensure that your
+ subchannel is the only one active on the entire channel.
+ Configure a large enough fast_io_fail_tmo, e.g. 27 seconds.
+ Pull cable at target side. Wait until fast_io_fail_tmo runs
+ out and with the fix a zfcp trace "sctrpi1" with "ERP need"
+ 0xe0 must appear in the REC area. (for shared non-NPIV
+ subchannels, only the first subchannel, that happens to
+ complete the corresponding code path, ends up in this
+ particular case)
+
+ Difficult to reproduce as we need a "soft" recovery trigger
+ that does not clear ERP_FAILED (as opposed to e.g. failed
+ sysfs attribute).
+
+ No known reproduction.
+
+Upstream-Description:
+
+ scsi: zfcp: fix missing SCSI trace for result of eh_host_reset_handler
+
+ For problem determination we need to see whether and why we were successful
+ or not. This allows deduction of scsi_eh escalation.
+
+ Example trace record formatted with zfcpdbf from s390-tools:
+
+ Timestamp : ...
+ Area : SCSI
+ Subarea : 00
+ Level : 1
+ Exception : -
+ CPU ID : ..
+ Caller : 0x...
+ Record ID : 1
+ Tag : schrh_r SCSI host reset handler result
+ Request ID : 0x0000000000000000 none (invalid)
+ SCSI ID : 0xffffffff none (invalid)
+ SCSI LUN : 0xffffffff none (invalid)
+ SCSI LUN high : 0xffffffff none (invalid)
+ SCSI result : 0x00002002 field re-used for midlayer value: SUCCESS
+ or in other cases: 0x2009 == FAST_IO_FAIL
+ SCSI retries : 0xff none (invalid)
+ SCSI allowed : 0xff none (invalid)
+ SCSI scribble : 0xffffffffffffffff none (invalid)
+ SCSI opcode : ffffffff ffffffff ffffffff ffffffff none (invalid)
+ FCP rsp inf cod: 0xff none (invalid)
+ FCP rsp IU : 00000000 00000000 00000000 00000000 none (invalid)
+ 00000000 00000000
+
+ v2.6.35 commit a1dbfddd02d2 ("[SCSI] zfcp: Pass return code from
+ fc_block_scsi_eh to scsi eh") introduced the first return with something
+ other than the previously hardcoded single SUCCESS return path.
+
+ Signed-off-by: Steffen Maier <maier@linux.ibm.com>
+ Fixes: a1dbfddd02d2 ("[SCSI] zfcp: Pass return code from fc_block_scsi_eh to scsi eh")
+ Cc: <stable@vger.kernel.org> #2.6.38+
+ Reviewed-by: Jens Remus <jremus@linux.ibm.com>
+ Reviewed-by: Benjamin Block <bblock@linux.ibm.com>
+ Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
+
+
+Signed-off-by: Steffen Maier <maier@linux.ibm.com>
+Acked-by: Johannes Thumshirn <jthumshirn@suse.de>
+---
+ drivers/s390/scsi/zfcp_dbf.c | 40 ++++++++++++++++++++++++++++++++++++++++
+ drivers/s390/scsi/zfcp_ext.h | 2 ++
+ drivers/s390/scsi/zfcp_scsi.c | 11 ++++++-----
+ 3 files changed, 48 insertions(+), 5 deletions(-)
+
+--- a/drivers/s390/scsi/zfcp_dbf.c
++++ b/drivers/s390/scsi/zfcp_dbf.c
+@@ -625,6 +625,46 @@ void zfcp_dbf_scsi(char *tag, int level,
+ spin_unlock_irqrestore(&dbf->scsi_lock, flags);
+ }
+
++/**
++ * zfcp_dbf_scsi_eh() - Trace event for special cases of scsi_eh callbacks.
++ * @tag: Identifier for event.
++ * @adapter: Pointer to zfcp adapter as context for this event.
++ * @scsi_id: SCSI ID/target to indicate scope of task management function (TMF).
++ * @ret: Return value of calling function.
++ *
++ * This SCSI trace variant does not depend on any of:
++ * scsi_cmnd, zfcp_fsf_req, scsi_device.
++ */
++void zfcp_dbf_scsi_eh(char *tag, struct zfcp_adapter *adapter,
++ unsigned int scsi_id, int ret)
++{
++ struct zfcp_dbf *dbf = adapter->dbf;
++ struct zfcp_dbf_scsi *rec = &dbf->scsi_buf;
++ unsigned long flags;
++ static int const level = 1;
++
++ if (unlikely(!debug_level_enabled(adapter->dbf->scsi, level)))
++ return;
++
++ spin_lock_irqsave(&dbf->scsi_lock, flags);
++ memset(rec, 0, sizeof(*rec));
++
++ memcpy(rec->tag, tag, ZFCP_DBF_TAG_LEN);
++ rec->id = ZFCP_DBF_SCSI_CMND;
++ rec->scsi_result = ret; /* re-use field, int is 4 bytes and fits */
++ rec->scsi_retries = ~0;
++ rec->scsi_allowed = ~0;
++ rec->fcp_rsp_info = ~0;
++ rec->scsi_id = scsi_id;
++ rec->scsi_lun = (u32)ZFCP_DBF_INVALID_LUN;
++ rec->scsi_lun_64_hi = (u32)(ZFCP_DBF_INVALID_LUN >> 32);
++ rec->host_scribble = ~0;
++ memset(rec->scsi_opcode, 0xff, ZFCP_DBF_SCSI_OPCODE);
++
++ debug_event(dbf->scsi, level, rec, sizeof(*rec));
++ spin_unlock_irqrestore(&dbf->scsi_lock, flags);
++}
++
+ static debug_info_t *zfcp_dbf_reg(const char *name, int size, int rec_size)
+ {
+ struct debug_info *d;
+--- a/drivers/s390/scsi/zfcp_ext.h
++++ b/drivers/s390/scsi/zfcp_ext.h
+@@ -52,6 +52,8 @@ extern void zfcp_dbf_san_res(char *, str
+ extern void zfcp_dbf_san_in_els(char *, struct zfcp_fsf_req *);
+ extern void zfcp_dbf_scsi(char *, int, struct scsi_cmnd *,
+ struct zfcp_fsf_req *);
++extern void zfcp_dbf_scsi_eh(char *tag, struct zfcp_adapter *adapter,
++ unsigned int scsi_id, int ret);
+
+ /* zfcp_erp.c */
+ extern void zfcp_erp_set_adapter_status(struct zfcp_adapter *, u32);
+--- a/drivers/s390/scsi/zfcp_scsi.c
++++ b/drivers/s390/scsi/zfcp_scsi.c
+@@ -322,15 +322,16 @@ static int zfcp_scsi_eh_host_reset_handl
+ {
+ struct zfcp_scsi_dev *zfcp_sdev = sdev_to_zfcp(scpnt->device);
+ struct zfcp_adapter *adapter = zfcp_sdev->port->adapter;
+- int ret;
++ int ret = SUCCESS, fc_ret;
+
+ zfcp_erp_adapter_reopen(adapter, 0, "schrh_1");
+ zfcp_erp_wait(adapter);
+- ret = fc_block_scsi_eh(scpnt);
+- if (ret)
+- return ret;
++ fc_ret = fc_block_scsi_eh(scpnt);
++ if (fc_ret)
++ ret = fc_ret;
+
+- return SUCCESS;
++ zfcp_dbf_scsi_eh("schrh_r", adapter, ~0, ret);
++ return ret;
+ }
+
+ struct scsi_transport_template *zfcp_scsi_transport_template;
diff --git a/patches.arch/s390-sles12sp3-17-01-02-zfcp-missing-SCSI-trace-retry-abort-TMF.patch b/patches.arch/s390-sles12sp3-17-01-02-zfcp-missing-SCSI-trace-retry-abort-TMF.patch
new file mode 100644
index 0000000000..376f100f4a
--- /dev/null
+++ b/patches.arch/s390-sles12sp3-17-01-02-zfcp-missing-SCSI-trace-retry-abort-TMF.patch
@@ -0,0 +1,247 @@
+From: Steffen Maier <maier@linux.ibm.com>
+Subject: scsi: zfcp: fix missing SCSI trace for retry of abort / scsi_eh TMF
+Patch-mainline: v4.18-rc1
+Git-commit: 81979ae63e872ef650a7197f6ce6590059d37172
+References: bnc#1099713, LTC#168765
+
+Description: zfcp: fix tracing regressions, part 3
+Symptom: Cannot determine result of eh_host_reset_handler.
+
+ Cannot see if and when zfcp retries abort or task management
+ functions (LUN/target reset) while synchronizing scsi_eh and
+ zfcp-internal recovery.
+
+ Confusing zfcp ERP trace record if a SCSI device is deleted
+ during scsi_eh host reset.
+
+ Cannot determine that our terminate_rport_io callback was
+ invoked if it returned early.
+
+ Cannot determine that our terminate_rport_io callback was
+ invoked if a long fast_io_fail_tmo was configured (typically
+ longer than 12 seconds, e.g. 27 seconds).
+
+ Cannot determine if something wanted to enqueue zfcp recovery
+ for an object (adapter/port regular/unit) in ERP_FAILED state.
+
+ Cannot determine if something wanted to enqueue zfcp recovery
+ but no zfcp ERP thread was running.
+Problem: v2.6.35 commit a1dbfddd02d2 ("[SCSI] zfcp: Pass return code
+ from fc_block_scsi_eh to scsi eh") introduced the first
+ return with something other than the previously hardcoded
+ single SUCCESS return path.
+
+ Due to zfcp_erp_wait() and fc_block_scsi_eh() time can pass
+ between the start of our eh callback and an actual send/recv
+ of an abort / TMF request.
+
+ If a SCSI device is deleted during scsi_eh host reset, we
+ cannot get a reference to the SCSI device anymore since
+ scsi_device_get returns !=0 by design. Assuming the recovery
+ of adapter and port(s) was successful,
+ zfcp_erp_strategy_followup_success() attempts to trigger a
+ LUN reset for the half-gone SCSI device. However,
+ zfcp_erp_setup_act() returns NULL as it cannot get the
+ reference. Hence, zfcp_erp_action_enqueue() takes an early
+ goto out and _NO_ recovery actually happens, but it writes a
+ confusing trace record which states that zfcp will do a LUN
+ recovery as "ERP need" is ZFCP_ERP_ACTION_REOPEN_LUN == 1 and
+ equals "ERP want".
+ Before v2.6.38 commit ae0904f60fab ("[SCSI] zfcp: Redesign of
+ the debug tracing for recovery actions.") we could detect
+ this case because the "erp_action" field in the trace was
+ NULL. The rework removed erp_action as argument and field
+ from the trace.
+
+ If we get an fc_rport in terminate_rport_io() for which we
+ cannot find a match within zfcp_get_port_by_wwpn(), the
+ latter can return NULL. v2.6.30 commit 70932935b61e ("[SCSI]
+ zfcp: Fix oops when port disappears") introduced an early
+ return without adding a trace record for this case.
+
+ After target cable pull: The ADISC for "link" test times out
+ after typically 4 seconds. The open port recovery times out
+ after typically 8 seconds, causing zfcp_port.status to
+ contain ERP_FAILED. zfcp_scsi_terminate_rport_io() tries to
+ enqueue forced port recovery, but due to ERP_FAILED this
+ resulted in a silent early return.
+
+ Trying to enqueue recovery for adapter / port regular / LUN
+ resulted in silent early returns.
+
+ Trying to enqueue recovery if no ERP thread was running
+ resulted in silent early returns.
+Solution: Write trace record in zfcp area SCSI and re-use SCSI result
+ field to contain the return value of eh_host_reset_handler.
+
+ Add a trace before calling the two blocking functions
+ zfcp_erp_wait() and fc_block_scsi_eh().
+
+ Introduce an eyecatcher "flag" to mark the "ERP need" as 'not
+ needed' but still keep the information which erp_action type,
+ that zfcp_erp_required_act() had decided upon, is needed.
+ 0xc_ is chosen to be visibly different from 0x0_ in "ERP
+ want".
+
+ Write trace record in zfcp area REC with "ERP need" none.
+
+ Write trace record in zfcp area REC with "ERP need" 0xe0.
+
+ zfcp_erp_action_enqueue() already had two early outs which
+ re-used the one zfcp_dbf_rec_trig() call. All ERP trigger
+ functions finally run through zfcp_erp_action_enqueue(). So
+ move the special handling for ZFCP_STATUS_COMMON_ERP_FAILED
+ into zfcp_erp_action_enqueue() and add another early out with
+ new trace marker for pseudo ERP need in this case. This
+ removes all early returns from all ERP trigger functions so
+ we always end up at zfcp_dbf_rec_trig().
+
+ Write trace record in zfcp area REC with "ERP need" 0xc0.
+Reproduction: If NPIV is not enabled with subchannel, ensure that your
+ subchannel is the only one active on the entire channel.
+ Set eh_deadline to a short enough time interval, e.g. 5
+ seconds (before FCP device online: scsi_mod.eh_deadline=5).
+ Enable RSCN suppression on the SAN switch port beyond the
+ first link, i.e. towards the storage target. Disable that
+ switch port. Send one SCSI command to the single path SCSI
+ disk of that port in the background (because it will block
+ for a while) e.g. via "dd if=/dev/sd... of=/dev/null
+ iflag=direct count=1 &". After <SCSI command timeout>
+ seconds, the command runs into the timeout. Due to the short
+ eh_deadline, the SCSI midlayer immediately performs SCSI host
+ reset. After the corresponding adapter recovery, the new
+ trace record "schrh_r" appears.
+
+ Difficult to reproduce as we need to have a SCSI command time
+ out once (abort) or twice (scsi_eh), and timely have to
+ prevent sending of the abort or TMF. Examples to prevent
+ sending is severe memory pressure, or zfcp-internal recovery
+ of the zfcp unit (e.g. write 0 to failed sysfs attribute) or
+ of the target port (depending on potentially escalated
+ scsi_eh scope) so the zfcp object is blocked.
+
+ Difficult to reproduce as we need to get into scsi_eh, fully
+ escalate to host reset, and something has to timely delete a
+ SCSI device of this Scsi_Host.
+
+ Disable auto port REscan with zfcp.no_auto_port_rescan=1. Let
+ always enabled zfcp auto port scan attach a target remote
+ port without attaching LUNs to it (zfcp.allow_lun_scan=0 and
+ no explicit zfcp unit_add). Use zfcp port_remove to remove
+ such target port again. After fast_io_fail_tmo or
+ dev_loss_tmo, the new trace record "sctrpin" can appear.
+
+ If NPIV is not enabled with subchannel, ensure that your
+ subchannel is the only one active on the entire channel.
+ Configure a large enough fast_io_fail_tmo, e.g. 27 seconds.
+ Pull cable at target side. Wait until fast_io_fail_tmo runs
+ out and with the fix a zfcp trace "sctrpi1" with "ERP need"
+ 0xe0 must appear in the REC area. (for shared non-NPIV
+ subchannels, only the first subchannel, that happens to
+ complete the corresponding code path, ends up in this
+ particular case)
+
+ Difficult to reproduce as we need a "soft" recovery trigger
+ that does not clear ERP_FAILED (as opposed to e.g. failed
+ sysfs attribute).
+
+ No known reproduction.
+
+Upstream-Description:
+
+ scsi: zfcp: fix missing SCSI trace for retry of abort / scsi_eh TMF
+
+ We already have a SCSI trace for the end of abort and scsi_eh TMF. Due to
+ zfcp_erp_wait() and fc_block_scsi_eh() time can pass between the start of
+ our eh callback and an actual send/recv of an abort / TMF request. In order
+ to see the temporal sequence including any abort / TMF send retries, add a
+ trace before the above two blocking functions. This supports problem
+ determination with scsi_eh and parallel zfcp ERP.
+
+ No need to explicitly trace the beginning of our eh callback, since we
+ typically can send an abort / TMF and see its HBA response (in the worst
+ case, it's a pseudo response on dismiss all of adapter recovery, e.g. due to
+ an FSF request timeout [fsrth_1] of the abort / TMF). If we cannot send, we
+ now get a trace record for the first "abrt_wt" or "[lt]r_wait" which denotes
+ almost the beginning of the callback.
+
+ No need to explicitly trace the wakeup after the above two blocking
+ functions because the next retry loop causes another trace in any case and
+ that is sufficient.
+
+ Example trace records formatted with zfcpdbf from s390-tools:
+
+ Timestamp : ...
+ Area : SCSI
+ Subarea : 00
+ Level : 1
+ Exception : -
+ CPU ID : ..
+ Caller : 0x...
+ Record ID : 1
+ Tag : abrt_wt abort, before zfcp_erp_wait()
+ Request ID : 0x0000000000000000 none (invalid)
+ SCSI ID : 0x<scsi_id>
+ SCSI LUN : 0x<scsi_lun>
+ SCSI LUN high : 0x<scsi_lun_high>
+ SCSI result : 0x<scsi_result_of_cmd_to_be_aborted>
+ SCSI retries : 0x<retries_of_cmd_to_be_aborted>
+ SCSI allowed : 0x<allowed_retries_of_cmd_to_be_aborted>
+ SCSI scribble : 0x<req_id_of_cmd_to_be_aborted>
+ SCSI opcode : <CDB_of_cmd_to_be_aborted>
+ FCP rsp inf cod: 0x.. none (invalid)
+ FCP rsp IU : ... none (invalid)
+
+ Timestamp : ...
+ Area : SCSI
+ Subarea : 00
+ Level : 1
+ Exception : -
+ CPU ID : ..
+ Caller : 0x...
+ Record ID : 1
+ Tag : lr_wait LUN reset, before zfcp_erp_wait()
+ Request ID : 0x0000000000000000 none (invalid)
+ SCSI ID : 0x<scsi_id>
+ SCSI LUN : 0x<scsi_lun>
+ SCSI LUN high : 0x<scsi_lun_high>
+ SCSI result : 0x... unrelated
+ SCSI retries : 0x.. unrelated
+ SCSI allowed : 0x.. unrelated
+ SCSI scribble : 0x... unrelated
+ SCSI opcode : ... unrelated
+ FCP rsp inf cod: 0x.. none (invalid)
+ FCP rsp IU : ... none (invalid)
+
+ Signed-off-by: Steffen Maier <maier@linux.ibm.com>
+ Fixes: 63caf367e1c9 ("[SCSI] zfcp: Improve reliability of SCSI eh handlers in zfcp")
+ Fixes: af4de36d911a ("[SCSI] zfcp: Block scsi_eh thread for rport state BLOCKED")
+ Cc: <stable@vger.kernel.org> #2.6.38+
+ Reviewed-by: Benjamin Block <bblock@linux.ibm.com>
+ Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
+
+
+Signed-off-by: Steffen Maier <maier@linux.ibm.com>
+Acked-by: Johannes Thumshirn <jthumshirn@suse.de>
+---
+ drivers/s390/scsi/zfcp_scsi.c | 2 ++
+ 1 file changed, 2 insertions(+)
+
+--- a/drivers/s390/scsi/zfcp_scsi.c
++++ b/drivers/s390/scsi/zfcp_scsi.c
+@@ -180,6 +180,7 @@ static int zfcp_scsi_eh_abort_handler(st
+ if (abrt_req)
+ break;
+
++ zfcp_dbf_scsi_abort("abrt_wt", scpnt, NULL);
+ zfcp_erp_wait(adapter);
+ ret = fc_block_scsi_eh(scpnt);
+ if (ret) {
+@@ -276,6 +277,7 @@ static int zfcp_task_mgmt_function(struc
+ if (fsf_req)
+ break;
+
++ zfcp_dbf_scsi_devreset("wait", scpnt, tm_flags, NULL);
+ zfcp_erp_wait(adapter);
+ ret = fc_block_scsi_eh(scpnt);
+ if (ret) {
diff --git a/patches.arch/s390-sles12sp3-17-01-03-zfcp-misleading-REC-trig-trace-erp-setup-failed.patch b/patches.arch/s390-sles12sp3-17-01-03-zfcp-misleading-REC-trig-trace-erp-setup-failed.patch
new file mode 100644
index 0000000000..dcb7a3a8bb
--- /dev/null
+++ b/patches.arch/s390-sles12sp3-17-01-03-zfcp-misleading-REC-trig-trace-erp-setup-failed.patch
@@ -0,0 +1,262 @@
+From: Steffen Maier <maier@linux.ibm.com>
+Subject: scsi: zfcp: fix misleading REC trigger trace where erp_action setup failed
+Patch-mainline: v4.18-rc1
+Git-commit: 512857a795cbbda5980efa4cdb3c0b6602330408
+References: bnc#1099713, LTC#168765
+
+Description: zfcp: fix tracing regressions, part 3
+Symptom: Cannot determine result of eh_host_reset_handler.
+
+ Cannot see if and when zfcp retries abort or task management
+ functions (LUN/target reset) while synchronizing scsi_eh and
+ zfcp-internal recovery.
+
+ Confusing zfcp ERP trace record if a SCSI device is deleted
+ during scsi_eh host reset.
+
+ Cannot determine that our terminate_rport_io callback was
+ invoked if it returned early.
+
+ Cannot determine that our terminate_rport_io callback was
+ invoked if a long fast_io_fail_tmo was configured (typically
+ longer than 12 seconds, e.g. 27 seconds).
+
+ Cannot determine if something wanted to enqueue zfcp recovery
+ for an object (adapter/port regular/unit) in ERP_FAILED state.
+
+ Cannot determine if something wanted to enqueue zfcp recovery
+ but no zfcp ERP thread was running.
+Problem: v2.6.35 commit a1dbfddd02d2 ("[SCSI] zfcp: Pass return code
+ from fc_block_scsi_eh to scsi eh") introduced the first
+ return with something other than the previously hardcoded
+ single SUCCESS return path.
+
+ Due to zfcp_erp_wait() and fc_block_scsi_eh() time can pass
+ between the start of our eh callback and an actual send/recv
+ of an abort / TMF request.
+
+ If a SCSI device is deleted during scsi_eh host reset, we
+ cannot get a reference to the SCSI device anymore since
+ scsi_device_get returns !=0 by design. Assuming the recovery
+ of adapter and port(s) was successful,
+ zfcp_erp_strategy_followup_success() attempts to trigger a
+ LUN reset for the half-gone SCSI device. However,
+ zfcp_erp_setup_act() returns NULL as it cannot get the
+ reference. Hence, zfcp_erp_action_enqueue() takes an early
+ goto out and _NO_ recovery actually happens, but it writes a
+ confusing trace record which states that zfcp will do a LUN
+ recovery as "ERP need" is ZFCP_ERP_ACTION_REOPEN_LUN == 1 and
+ equals "ERP want".
+ Before v2.6.38 commit ae0904f60fab ("[SCSI] zfcp: Redesign of
+ the debug tracing for recovery actions.") we could detect
+ this case because the "erp_action" field in the trace was
+ NULL. The rework removed erp_action as argument and field
+ from the trace.
+
+ If we get an fc_rport in terminate_rport_io() for which we
+ cannot find a match within zfcp_get_port_by_wwpn(), the
+ latter can return NULL. v2.6.30 commit 70932935b61e ("[SCSI]
+ zfcp: Fix oops when port disappears") introduced an early
+ return without adding a trace record for this case.
+
+ After target cable pull: The ADISC for "link" test times out
+ after typically 4 seconds. The open port recovery times out
+ after typically 8 seconds, causing zfcp_port.status to
+ contain ERP_FAILED. zfcp_scsi_terminate_rport_io() tries to
+ enqueue forced port recovery, but due to ERP_FAILED this
+ resulted in a silent early return.
+
+ Trying to enqueue recovery for adapter / port regular / LUN
+ resulted in silent early returns.
+
+ Trying to enqueue recovery if no ERP thread was running
+ resulted in silent early returns.
+Solution: Write trace record in zfcp area SCSI and re-use SCSI result
+ field to contain the return value of eh_host_reset_handler.
+
+ Add a trace before calling the two blocking functions
+ zfcp_erp_wait() and fc_block_scsi_eh().
+
+ Introduce an eyecatcher "flag" to mark the "ERP need" as 'not
+ needed' but still keep the information which erp_action type,
+ that zfcp_erp_required_act() had decided upon, is needed.
+ 0xc_ is chosen to be visibly different from 0x0_ in "ERP
+ want".
+
+ Write trace record in zfcp area REC with "ERP need" none.
+
+ Write trace record in zfcp area REC with "ERP need" 0xe0.
+
+ zfcp_erp_action_enqueue() already had two early outs which
+ re-used the one zfcp_dbf_rec_trig() call. All ERP trigger
+ functions finally run through zfcp_erp_action_enqueue(). So
+ move the special handling for ZFCP_STATUS_COMMON_ERP_FAILED
+ into zfcp_erp_action_enqueue() and add another early out with
+ new trace marker for pseudo ERP need in this case. This
+ removes all early returns from all ERP trigger functions so
+ we always end up at zfcp_dbf_rec_trig().
+
+ Write trace record in zfcp area REC with "ERP need" 0xc0.
+Reproduction: If NPIV is not enabled with subchannel, ensure that your
+ subchannel is the only one active on the entire channel.
+ Set eh_deadline to a short enough time interval, e.g. 5
+ seconds (before FCP device online: scsi_mod.eh_deadline=5).
+ Enable RSCN suppression on the SAN switch port beyond the
+ first link, i.e. towards the storage target. Disable that
+ switch port. Send one SCSI command to the single path SCSI
+ disk of that port in the background (because it will block
+ for a while) e.g. via "dd if=/dev/sd... of=/dev/null
+ iflag=direct count=1 &". After <SCSI command timeout>
+ seconds, the command runs into the timeout. Due to the short
+ eh_deadline, the SCSI midlayer immediately performs SCSI host
+ reset. After the corresponding adapter recovery, the new
+ trace record "schrh_r" appears.
+
+ Difficult to reproduce as we need to have a SCSI command time
+ out once (abort) or twice (scsi_eh), and timely have to
+ prevent sending of the abort or TMF. Examples to prevent
+ sending is severe memory pressure, or zfcp-internal recovery
+ of the zfcp unit (e.g. write 0 to failed sysfs attribute) or
+ of the target port (depending on potentially escalated
+ scsi_eh scope) so the zfcp object is blocked.
+
+ Difficult to reproduce as we need to get into scsi_eh, fully
+ escalate to host reset, and something has to timely delete a
+ SCSI device of this Scsi_Host.
+
+ Disable auto port REscan with zfcp.no_auto_port_rescan=1. Let
+ always enabled zfcp auto port scan attach a target remote
+ port without attaching LUNs to it (zfcp.allow_lun_scan=0 and
+ no explicit zfcp unit_add). Use zfcp port_remove to remove
+ such target port again. After fast_io_fail_tmo or
+ dev_loss_tmo, the new trace record "sctrpin" can appear.
+
+ If NPIV is not enabled with subchannel, ensure that your
+ subchannel is the only one active on the entire channel.
+ Configure a large enough fast_io_fail_tmo, e.g. 27 seconds.
+ Pull cable at target side. Wait until fast_io_fail_tmo runs
+ out and with the fix a zfcp trace "sctrpi1" with "ERP need"
+ 0xe0 must appear in the REC area. (for shared non-NPIV
+ subchannels, only the first subchannel, that happens to
+ complete the corresponding code path, ends up in this
+ particular case)
+
+ Difficult to reproduce as we need a "soft" recovery trigger
+ that does not clear ERP_FAILED (as opposed to e.g. failed
+ sysfs attribute).
+
+ No known reproduction.
+
+Upstream-Description:
+
+ scsi: zfcp: fix misleading REC trigger trace where erp_action setup failed
+
+ If a SCSI device is deleted during scsi_eh host reset, we cannot get a
+ reference to the SCSI device anymore since scsi_device_get returns !=0 by
+ design. Assuming the recovery of adapter and port(s) was successful,
+ zfcp_erp_strategy_followup_success() attempts to trigger a LUN reset for the
+ half-gone SCSI device. Unfortunately, it causes the following confusing
+ trace record which states that zfcp will do a LUN recovery as "ERP need" is
+ ZFCP_ERP_ACTION_REOPEN_LUN == 1 and equals "ERP want".
+
+ Old example trace record formatted with zfcpdbf from s390-tools:
+
+ Tag: : ersfs_3 ERP, trigger, unit reopen, port reopen succeeded
+ LUN : 0x<FCP_LUN>
+ WWPN : 0x<WWPN>
+ D_ID : 0x<N_Port-ID>
+ Adapter status : 0x5400050b
+ Port status : 0x54000001
+ LUN status : 0x40000000 ZFCP_STATUS_COMMON_RUNNING
+ but not ZFCP_STATUS_COMMON_UNBLOCKED as it
+ was closed on close part of adapter reopen
+ ERP want : 0x01
+ ERP need : 0x01 misleading
+
+ However, zfcp_erp_setup_act() returns NULL as it cannot get the reference.
+ Hence, zfcp_erp_action_enqueue() takes an early goto out and _NO_ recovery
+ actually happens.
+
+ We always do want the recovery trigger trace record even if no erp_action
+ could be enqueued as in this case. For other cases where we did not enqueue
+ an erp_action, 'need' has always been zero to indicate this. In order to
+ indicate above goto out, introduce an eyecatcher "flag" to mark the "ERP
+ need" as 'not needed' but still keep the information which erp_action type,
+ that zfcp_erp_required_act() had decided upon, is needed. 0xc_ is chosen to
+ be visibly different from 0x0_ in "ERP want".
+
+ New example trace record formatted with zfcpdbf from s390-tools:
+
+ Tag: : ersfs_3 ERP, trigger, unit reopen, port reopen succeeded
+ LUN : 0x<FCP_LUN>
+ WWPN : 0x<WWPN>
+ D_ID : 0x<N_Port-ID>
+ Adapter status : 0x5400050b
+ Port status : 0x54000001
+ LUN status : 0x40000000
+ ERP want : 0x01
+ ERP need : 0xc1 would need LUN ERP, but no action set up
+ ^
+
+ Before v2.6.38 commit ae0904f60fab ("[SCSI] zfcp: Redesign of the debug
+ tracing for recovery actions.") we could detect this case because the
+ "erp_action" field in the trace was NULL. The rework removed erp_action as
+ argument and field from the trace.
+
+ This patch here is for tracing. A fix to allow LUN recovery in the case at
+ hand is a topic for a separate patch.
+
+ See also commit fdbd1c5e27da ("[SCSI] zfcp: Allow running unit/LUN shutdown
+ without acquiring reference") for a similar case and background info.
+
+ Signed-off-by: Steffen Maier <maier@linux.ibm.com>
+ Fixes: ae0904f60fab ("[SCSI] zfcp: Redesign of the debug tracing for recovery actions.")
+ Cc: <stable@vger.kernel.org> #2.6.38+
+ Reviewed-by: Benjamin Block <bblock@linux.ibm.com>
+ Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
+
+
+Signed-off-by: Steffen Maier <maier@linux.ibm.com>
+Acked-by: Johannes Thumshirn <jthumshirn@suse.de>
+---
+ drivers/s390/scsi/zfcp_erp.c | 16 +++++++++++++++-
+ 1 file changed, 15 insertions(+), 1 deletion(-)
+
+--- a/drivers/s390/scsi/zfcp_erp.c
++++ b/drivers/s390/scsi/zfcp_erp.c
+@@ -34,11 +34,23 @@ enum zfcp_erp_steps {
+ ZFCP_ERP_STEP_LUN_OPENING = 0x2000,
+ };
+
++/**
++ * enum zfcp_erp_act_type - Type of ERP action object.
++ * @ZFCP_ERP_ACTION_REOPEN_LUN: LUN recovery.
++ * @ZFCP_ERP_ACTION_REOPEN_PORT: Port recovery.
++ * @ZFCP_ERP_ACTION_REOPEN_PORT_FORCED: Forced port recovery.
++ * @ZFCP_ERP_ACTION_REOPEN_ADAPTER: Adapter recovery.
++ * @ZFCP_ERP_ACTION_NONE: Eyecatcher pseudo flag to bitwise or-combine with
++ * either of the other enum values.
++ * Used to indicate that an ERP action could not be
++ * set up despite a detected need for some recovery.
++ */
+ enum zfcp_erp_act_type {
+ ZFCP_ERP_ACTION_REOPEN_LUN = 1,
+ ZFCP_ERP_ACTION_REOPEN_PORT = 2,
+ ZFCP_ERP_ACTION_REOPEN_PORT_FORCED = 3,
+ ZFCP_ERP_ACTION_REOPEN_ADAPTER = 4,
++ ZFCP_ERP_ACTION_NONE = 0xc0,
+ };
+
+ enum zfcp_erp_act_state {
+@@ -256,8 +268,10 @@ static int zfcp_erp_action_enqueue(int w
+ goto out;
+
+ act = zfcp_erp_setup_act(need, act_status, adapter, port, sdev);
+- if (!act)
++ if (!act) {
++ need |= ZFCP_ERP_ACTION_NONE; /* marker for trace */
+ goto out;
++ }
+ atomic_or(ZFCP_STATUS_ADAPTER_ERP_PENDING, &adapter->status);
+ ++adapter->erp_total_count;
+ list_add_tail(&act->list, &adapter->erp_ready_head);
diff --git a/patches.arch/s390-sles12sp3-17-01-04-zfcp-missing-REC-trig-trace-t_rport_io-early-ret.patch b/patches.arch/s390-sles12sp3-17-01-04-zfcp-missing-REC-trig-trace-t_rport_io-early-ret.patch
new file mode 100644
index 0000000000..8918e0956b
--- /dev/null
+++ b/patches.arch/s390-sles12sp3-17-01-04-zfcp-missing-REC-trig-trace-t_rport_io-early-ret.patch
@@ -0,0 +1,257 @@
+From: Steffen Maier <maier@linux.ibm.com>
+Subject: scsi: zfcp: fix missing REC trigger trace on terminate_rport_io early return
+Patch-mainline: v4.18-rc1
+Git-commit: 96d9270499471545048ed8a6d7f425a49762283d
+References: bnc#1099713, LTC#168765
+
+Description: zfcp: fix tracing regressions, part 3
+Symptom: Cannot determine result of eh_host_reset_handler.
+
+ Cannot see if and when zfcp retries abort or task management
+ functions (LUN/target reset) while synchronizing scsi_eh and
+ zfcp-internal recovery.
+
+ Confusing zfcp ERP trace record if a SCSI device is deleted
+ during scsi_eh host reset.
+
+ Cannot determine that our terminate_rport_io callback was
+ invoked if it returned early.
+
+ Cannot determine that our terminate_rport_io callback was
+ invoked if a long fast_io_fail_tmo was configured (typically
+ longer than 12 seconds, e.g. 27 seconds).
+
+ Cannot determine if something wanted to enqueue zfcp recovery
+ for an object (adapter/port regular/unit) in ERP_FAILED state.
+
+ Cannot determine if something wanted to enqueue zfcp recovery
+ but no zfcp ERP thread was running.
+Problem: v2.6.35 commit a1dbfddd02d2 ("[SCSI] zfcp: Pass return code
+ from fc_block_scsi_eh to scsi eh") introduced the first
+ return with something other than the previously hardcoded
+ single SUCCESS return path.
+
+ Due to zfcp_erp_wait() and fc_block_scsi_eh() time can pass
+ between the start of our eh callback and an actual send/recv
+ of an abort / TMF request.
+
+ If a SCSI device is deleted during scsi_eh host reset, we
+ cannot get a reference to the SCSI device anymore since
+ scsi_device_get returns !=0 by design. Assuming the recovery
+ of adapter and port(s) was successful,
+ zfcp_erp_strategy_followup_success() attempts to trigger a
+ LUN reset for the half-gone SCSI device. However,
+ zfcp_erp_setup_act() returns NULL as it cannot get the
+ reference. Hence, zfcp_erp_action_enqueue() takes an early
+ goto out and _NO_ recovery actually happens, but it writes a
+ confusing trace record which states that zfcp will do a LUN
+ recovery as "ERP need" is ZFCP_ERP_ACTION_REOPEN_LUN == 1 and
+ equals "ERP want".
+ Before v2.6.38 commit ae0904f60fab ("[SCSI] zfcp: Redesign of
+ the debug tracing for recovery actions.") we could detect
+ this case because the "erp_action" field in the trace was
+ NULL. The rework removed erp_action as argument and field
+ from the trace.
+
+ If we get an fc_rport in terminate_rport_io() for which we
+ cannot find a match within zfcp_get_port_by_wwpn(), the
+ latter can return NULL. v2.6.30 commit 70932935b61e ("[SCSI]
+ zfcp: Fix oops when port disappears") introduced an early
+ return without adding a trace record for this case.
+
+ After target cable pull: The ADISC for "link" test times out
+ after typically 4 seconds. The open port recovery times out
+ after typically 8 seconds, causing zfcp_port.status to
+ contain ERP_FAILED. zfcp_scsi_terminate_rport_io() tries to
+ enqueue forced port recovery, but due to ERP_FAILED this
+ resulted in a silent early return.
+
+ Trying to enqueue recovery for adapter / port regular / LUN
+ resulted in silent early returns.
+
+ Trying to enqueue recovery if no ERP thread was running
+ resulted in silent early returns.
+Solution: Write trace record in zfcp area SCSI and re-use SCSI result
+ field to contain the return value of eh_host_reset_handler.
+
+ Add a trace before calling the two blocking functions
+ zfcp_erp_wait() and fc_block_scsi_eh().
+
+ Introduce an eyecatcher "flag" to mark the "ERP need" as 'not
+ needed' but still keep the information which erp_action type,
+ that zfcp_erp_required_act() had decided upon, is needed.
+ 0xc_ is chosen to be visibly different from 0x0_ in "ERP
+ want".
+
+ Write trace record in zfcp area REC with "ERP need" none.
+
+ Write trace record in zfcp area REC with "ERP need" 0xe0.
+
+ zfcp_erp_action_enqueue() already had two early outs which
+ re-used the one zfcp_dbf_rec_trig() call. All ERP trigger
+ functions finally run through zfcp_erp_action_enqueue(). So
+ move the special handling for ZFCP_STATUS_COMMON_ERP_FAILED
+ into zfcp_erp_action_enqueue() and add another early out with
+ new trace marker for pseudo ERP need in this case. This
+ removes all early returns from all ERP trigger functions so
+ we always end up at zfcp_dbf_rec_trig().
+
+ Write trace record in zfcp area REC with "ERP need" 0xc0.
+Reproduction: If NPIV is not enabled with subchannel, ensure that your
+ subchannel is the only one active on the entire channel.
+ Set eh_deadline to a short enough time interval, e.g. 5
+ seconds (before FCP device online: scsi_mod.eh_deadline=5).
+ Enable RSCN suppression on the SAN switch port beyond the
+ first link, i.e. towards the storage target. Disable that
+ switch port. Send one SCSI command to the single path SCSI
+ disk of that port in the background (because it will block
+ for a while) e.g. via "dd if=/dev/sd... of=/dev/null
+ iflag=direct count=1 &". After <SCSI command timeout>
+ seconds, the command runs into the timeout. Due to the short
+ eh_deadline, the SCSI midlayer immediately performs SCSI host
+ reset. After the corresponding adapter recovery, the new
+ trace record "schrh_r" appears.
+
+ Difficult to reproduce as we need to have a SCSI command time
+ out once (abort) or twice (scsi_eh), and timely have to
+ prevent sending of the abort or TMF. Examples to prevent
+ sending is severe memory pressure, or zfcp-internal recovery
+ of the zfcp unit (e.g. write 0 to failed sysfs attribute) or
+ of the target port (depending on potentially escalated
+ scsi_eh scope) so the zfcp object is blocked.
+
+ Difficult to reproduce as we need to get into scsi_eh, fully
+ escalate to host reset, and something has to timely delete a
+ SCSI device of this Scsi_Host.
+
+ Disable auto port REscan with zfcp.no_auto_port_rescan=1. Let
+ always enabled zfcp auto port scan attach a target remote
+ port without attaching LUNs to it (zfcp.allow_lun_scan=0 and
+ no explicit zfcp unit_add). Use zfcp port_remove to remove
+ such target port again. After fast_io_fail_tmo or
+ dev_loss_tmo, the new trace record "sctrpin" can appear.
+
+ If NPIV is not enabled with subchannel, ensure that your
+ subchannel is the only one active on the entire channel.
+ Configure a large enough fast_io_fail_tmo, e.g. 27 seconds.
+ Pull cable at target side. Wait until fast_io_fail_tmo runs
+ out and with the fix a zfcp trace "sctrpi1" with "ERP need"
+ 0xe0 must appear in the REC area. (for shared non-NPIV
+ subchannels, only the first subchannel, that happens to
+ complete the corresponding code path, ends up in this
+ particular case)
+
+ Difficult to reproduce as we need a "soft" recovery trigger
+ that does not clear ERP_FAILED (as opposed to e.g. failed
+ sysfs attribute).
+
+ No known reproduction.
+
+Upstream-Description:
+
+ scsi: zfcp: fix missing REC trigger trace on terminate_rport_io early return
+
+ get_device() and its internally used kobject_get() only return NULL if they
+ get passed NULL as argument. zfcp_get_port_by_wwpn() loops over
+ adapter->port_list so the iteration variable port is always non-NULL.
+ Struct device is embedded in struct zfcp_port so &port->dev is always
+ non-NULL. This is the argument to get_device(). However, if we get an
+ fc_rport in terminate_rport_io() for which we cannot find a match within
+ zfcp_get_port_by_wwpn(), the latter can return NULL. v2.6.30 commit
+ 70932935b61e ("[SCSI] zfcp: Fix oops when port disappears") introduced an
+ early return without adding a trace record for this case. Even if we don't
+ need recovery in this case, for debugging we should still see that our
+ callback was invoked originally by scsi_transport_fc.
+
+ Example trace record formatted with zfcpdbf from s390-tools:
+
+ Timestamp : ...
+ Area : REC
+ Subarea : 00
+ Level : 1
+ Exception : -
+ CPU ID : ..
+ Caller : 0x...
+ Record ID : 1
+ Tag : sctrpin SCSI terminate rport I/O, no zfcp port
+ LUN : 0xffffffffffffffff none (invalid)
+ WWPN : 0x<wwpn> WWPN
+ D_ID : 0x<n_port_id> N_Port-ID
+ Adapter status : 0x...
+ Port status : 0xffffffff unknown (-1)
+ LUN status : 0x00000000 none (invalid)
+ Ready count : 0x...
+ Running count : 0x...
+ ERP want : 0x03 ZFCP_ERP_ACTION_REOPEN_PORT_FORCED
+ ERP need : 0xc0 ZFCP_ERP_ACTION_NONE
+
+ Signed-off-by: Steffen Maier <maier@linux.ibm.com>
+ Fixes: 70932935b61e ("[SCSI] zfcp: Fix oops when port disappears")
+ Cc: <stable@vger.kernel.org> #2.6.38+
+ Reviewed-by: Benjamin Block <bblock@linux.ibm.com>
+ Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
+
+
+Signed-off-by: Steffen Maier <maier@linux.ibm.com>
+Acked-by: Johannes Thumshirn <jthumshirn@suse.de>
+---
+ drivers/s390/scsi/zfcp_erp.c | 20 ++++++++++++++++++++
+ drivers/s390/scsi/zfcp_ext.h | 3 +++
+ drivers/s390/scsi/zfcp_scsi.c | 5 +++++
+ 3 files changed, 28 insertions(+)
+
+--- a/drivers/s390/scsi/zfcp_erp.c
++++ b/drivers/s390/scsi/zfcp_erp.c
+@@ -282,6 +282,26 @@ static int zfcp_erp_action_enqueue(int w
+ return retval;
+ }
+
++void zfcp_erp_port_forced_no_port_dbf(char *id, struct zfcp_adapter *adapter,
++ u64 port_name, u32 port_id)
++{
++ unsigned long flags;
++ static /* don't waste stack */ struct zfcp_port tmpport;
++
++ write_lock_irqsave(&adapter->erp_lock, flags);
++ /* Stand-in zfcp port with fields just good enough for
++ * zfcp_dbf_rec_trig() and zfcp_dbf_set_common().
++ * Under lock because tmpport is static.
++ */
++ atomic_set(&tmpport.status, -1); /* unknown */
++ tmpport.wwpn = port_name;
++ tmpport.d_id = port_id;
++ zfcp_dbf_rec_trig(id, adapter, &tmpport, NULL,
++ ZFCP_ERP_ACTION_REOPEN_PORT_FORCED,
++ ZFCP_ERP_ACTION_NONE);
++ write_unlock_irqrestore(&adapter->erp_lock, flags);
++}
++
+ static int _zfcp_erp_adapter_reopen(struct zfcp_adapter *adapter,
+ int clear_mask, char *id)
+ {
+--- a/drivers/s390/scsi/zfcp_ext.h
++++ b/drivers/s390/scsi/zfcp_ext.h
+@@ -58,6 +58,9 @@ extern void zfcp_dbf_scsi_eh(char *tag,
+ /* zfcp_erp.c */
+ extern void zfcp_erp_set_adapter_status(struct zfcp_adapter *, u32);
+ extern void zfcp_erp_clear_adapter_status(struct zfcp_adapter *, u32);
++extern void zfcp_erp_port_forced_no_port_dbf(char *id,
++ struct zfcp_adapter *adapter,
++ u64 port_name, u32 port_id);
+ extern void zfcp_erp_adapter_reopen(struct zfcp_adapter *, int, char *);
+ extern void zfcp_erp_adapter_shutdown(struct zfcp_adapter *, int, char *);
+ extern void zfcp_erp_set_port_status(struct zfcp_port *, u32);
+--- a/drivers/s390/scsi/zfcp_scsi.c
++++ b/drivers/s390/scsi/zfcp_scsi.c
+@@ -603,6 +603,11 @@ static void zfcp_scsi_terminate_rport_io
+ if (port) {
+ zfcp_erp_port_forced_reopen(port, 0, "sctrpi1");
+ put_device(&port->dev);
++ } else {
++ zfcp_erp_port_forced_no_port_dbf(
++ "sctrpin", adapter,
++ rport->port_name /* zfcp_scsi_rport_register */,
++ rport->port_id /* zfcp_scsi_rport_register */);
+ }
+ }
+
diff --git a/patches.arch/s390-sles12sp3-17-01-05-zfcp-missing-REC-trig-trace-t_rport_io-ERP_FAILED.patch b/patches.arch/s390-sles12sp3-17-01-05-zfcp-missing-REC-trig-trace-t_rport_io-ERP_FAILED.patch
new file mode 100644
index 0000000000..089dd76604
--- /dev/null
+++ b/patches.arch/s390-sles12sp3-17-01-05-zfcp-missing-REC-trig-trace-t_rport_io-ERP_FAILED.patch
@@ -0,0 +1,273 @@
+From: Steffen Maier <maier@linux.ibm.com>
+Subject: scsi: zfcp: fix missing REC trigger trace on terminate_rport_io for ERP_FAILED
+Patch-mainline: v4.18-rc1
+Git-commit: d70aab55924b44f213fec2b900b095430b33eec6
+References: bnc#1099713, LTC#168765
+
+Description: zfcp: fix tracing regressions, part 3
+Symptom: Cannot determine result of eh_host_reset_handler.
+
+ Cannot see if and when zfcp retries abort or task management
+ functions (LUN/target reset) while synchronizing scsi_eh and
+ zfcp-internal recovery.
+
+ Confusing zfcp ERP trace record if a SCSI device is deleted
+ during scsi_eh host reset.
+
+ Cannot determine that our terminate_rport_io callback was
+ invoked if it returned early.
+
+ Cannot determine that our terminate_rport_io callback was
+ invoked if a long fast_io_fail_tmo was configured (typically
+ longer than 12 seconds, e.g. 27 seconds).
+
+ Cannot determine if something wanted to enqueue zfcp recovery
+ for an object (adapter/port regular/unit) in ERP_FAILED state.
+
+ Cannot determine if something wanted to enqueue zfcp recovery
+ but no zfcp ERP thread was running.
+Problem: v2.6.35 commit a1dbfddd02d2 ("[SCSI] zfcp: Pass return code
+ from fc_block_scsi_eh to scsi eh") introduced the first
+ return with something other than the previously hardcoded
+ single SUCCESS return path.
+
+ Due to zfcp_erp_wait() and fc_block_scsi_eh() time can pass
+ between the start of our eh callback and an actual send/recv
+ of an abort / TMF request.
+
+ If a SCSI device is deleted during scsi_eh host reset, we
+ cannot get a reference to the SCSI device anymore since
+ scsi_device_get returns !=0 by design. Assuming the recovery
+ of adapter and port(s) was successful,
+ zfcp_erp_strategy_followup_success() attempts to trigger a
+ LUN reset for the half-gone SCSI device. However,
+ zfcp_erp_setup_act() returns NULL as it cannot get the
+ reference. Hence, zfcp_erp_action_enqueue() takes an early
+ goto out and _NO_ recovery actually happens, but it writes a
+ confusing trace record which states that zfcp will do a LUN
+ recovery as "ERP need" is ZFCP_ERP_ACTION_REOPEN_LUN == 1 and
+ equals "ERP want".
+ Before v2.6.38 commit ae0904f60fab ("[SCSI] zfcp: Redesign of
+ the debug tracing for recovery actions.") we could detect
+ this case because the "erp_action" field in the trace was
+ NULL. The rework removed erp_action as argument and field
+ from the trace.
+
+ If we get an fc_rport in terminate_rport_io() for which we
+ cannot find a match within zfcp_get_port_by_wwpn(), the
+ latter can return NULL. v2.6.30 commit 70932935b61e ("[SCSI]
+ zfcp: Fix oops when port disappears") introduced an early
+ return without adding a trace record for this case.
+
+ After target cable pull: The ADISC for "link" test times out
+ after typically 4 seconds. The open port recovery times out
+ after typically 8 seconds, causing zfcp_port.status to
+ contain ERP_FAILED. zfcp_scsi_terminate_rport_io() tries to
+ enqueue forced port recovery, but due to ERP_FAILED this
+ resulted in a silent early return.
+
+ Trying to enqueue recovery for adapter / port regular / LUN
+ resulted in silent early returns.
+
+ Trying to enqueue recovery if no ERP thread was running
+ resulted in silent early returns.
+Solution: Write trace record in zfcp area SCSI and re-use SCSI result
+ field to contain the return value of eh_host_reset_handler.
+
+ Add a trace before calling the two blocking functions
+ zfcp_erp_wait() and fc_block_scsi_eh().
+
+ Introduce an eyecatcher "flag" to mark the "ERP need" as 'not
+ needed' but still keep the information which erp_action type,
+ that zfcp_erp_required_act() had decided upon, is needed.
+ 0xc_ is chosen to be visibly different from 0x0_ in "ERP
+ want".
+
+ Write trace record in zfcp area REC with "ERP need" none.
+
+ Write trace record in zfcp area REC with "ERP need" 0xe0.
+
+ zfcp_erp_action_enqueue() already had two early outs which
+ re-used the one zfcp_dbf_rec_trig() call. All ERP trigger
+ functions finally run through zfcp_erp_action_enqueue(). So
+ move the special handling for ZFCP_STATUS_COMMON_ERP_FAILED
+ into zfcp_erp_action_enqueue() and add another early out with
+ new trace marker for pseudo ERP need in this case. This
+ removes all early returns from all ERP trigger functions so
+ we always end up at zfcp_dbf_rec_trig().
+
+ Write trace record in zfcp area REC with "ERP need" 0xc0.
+Reproduction: If NPIV is not enabled with subchannel, ensure that your
+ subchannel is the only one active on the entire channel.
+ Set eh_deadline to a short enough time interval, e.g. 5
+ seconds (before FCP device online: scsi_mod.eh_deadline=5).
+ Enable RSCN suppression on the SAN switch port beyond the
+ first link, i.e. towards the storage target. Disable that
+ switch port. Send one SCSI command to the single path SCSI
+ disk of that port in the background (because it will block
+ for a while) e.g. via "dd if=/dev/sd... of=/dev/null
+ iflag=direct count=1 &". After <SCSI command timeout>
+ seconds, the command runs into the timeout. Due to the short
+ eh_deadline, the SCSI midlayer immediately performs SCSI host
+ reset. After the corresponding adapter recovery, the new
+ trace record "schrh_r" appears.
+
+ Difficult to reproduce as we need to have a SCSI command time
+ out once (abort) or twice (scsi_eh), and timely have to
+ prevent sending of the abort or TMF. Examples to prevent
+ sending is severe memory pressure, or zfcp-internal recovery
+ of the zfcp unit (e.g. write 0 to failed sysfs attribute) or
+ of the target port (depending on potentially escalated
+ scsi_eh scope) so the zfcp object is blocked.
+
+ Difficult to reproduce as we need to get into scsi_eh, fully
+ escalate to host reset, and something has to timely delete a
+ SCSI device of this Scsi_Host.
+
+ Disable auto port REscan with zfcp.no_auto_port_rescan=1. Let
+ always enabled zfcp auto port scan attach a target remote
+ port without attaching LUNs to it (zfcp.allow_lun_scan=0 and
+ no explicit zfcp unit_add). Use zfcp port_remove to remove
+ such target port again. After fast_io_fail_tmo or
+ dev_loss_tmo, the new trace record "sctrpin" can appear.
+
+ If NPIV is not enabled with subchannel, ensure that your
+ subchannel is the only one active on the entire channel.
+ Configure a large enough fast_io_fail_tmo, e.g. 27 seconds.
+ Pull cable at target side. Wait until fast_io_fail_tmo runs
+ out and with the fix a zfcp trace "sctrpi1" with "ERP need"
+ 0xe0 must appear in the REC area. (for shared non-NPIV
+ subchannels, only the first subchannel, that happens to
+ complete the corresponding code path, ends up in this
+ particular case)
+
+ Difficult to reproduce as we need a "soft" recovery trigger
+ that does not clear ERP_FAILED (as opposed to e.g. failed
+ sysfs attribute).
+
+ No known reproduction.
+
+Upstream-Description:
+
+ scsi: zfcp: fix missing REC trigger trace on terminate_rport_io for ERP_FAILED
+
+ For problem determination we always want to see when we were invoked on the
+ terminate_rport_io callback whether we perform something or not.
+
+ Temporal event sequence of interest with a long fast_io_fail_tmo of 27 sec:
+
+ loose remote port
+
+ t workqueue
+ [s] zfcp_q_<dev> IRQ zfcperp<dev>
+
+ === ================== =================== ============================
+
+ 0 recv RSCN
+ q p.test_link_work
+ block rport
+ start fast_io_fail_tmo
+ send ADISC ELS
+ 4 recv ADISC fail
+ block zfcp_port
+ port forced reopen
+ send open port
+ 12 recv open port fail
+ q p.gid_pn_work
+ zfcp_erp_wakeup
+ (zfcp_erp_wait would return)
+ GID_PN fail
+
+ Before this point, we got a SCSI trace with tag "sctrpi1" on fast_io_fail,
+ e.g. with the typical 5 sec setting.
+
+ port.status |= ERP_FAILED
+
+ If fast_io_fail_tmo triggers after this point, we missed a SCSI trace.
+
+ workqueue
+ fc_dl_<host>
+ ==================
+ 27 fc_timeout_fail_rport_io
+ fc_terminate_rport_io
+ zfcp_scsi_terminate_rport_io
+ zfcp_erp_port_forced_reopen
+ _zfcp_erp_port_forced_reopen
+ if (port.status & ERP_FAILED)
+ return;
+
+ Therefore, write a trace before above early return.
+
+ Example trace record formatted with zfcpdbf from s390-tools:
+
+ Timestamp : ...
+ Area : REC
+ Subarea : 00
+ Level : 1
+ Exception : -
+ CPU ID : ..
+ Caller : 0x...
+ Record ID : 1 ZFCP_DBF_REC_TRIG
+ Tag : sctrpi1 SCSI terminate rport I/O
+ LUN : 0xffffffffffffffff none (invalid)
+ WWPN : 0x<wwpn>
+ D_ID : 0x<n_port_id>
+ Adapter status : 0x...
+ Port status : 0x...
+ LUN status : 0x00000000 none (invalid)
+ Ready count : 0x...
+ Running count : 0x...
+ ERP want : 0x03 ZFCP_ERP_ACTION_REOPEN_PORT_FORCED
+ ERP need : 0xe0 ZFCP_ERP_ACTION_FAILED
+
+ Signed-off-by: Steffen Maier <maier@linux.ibm.com>
+ Cc: <stable@vger.kernel.org> #2.6.38+
+ Reviewed-by: Benjamin Block <bblock@linux.ibm.com>
+ Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
+
+
+Signed-off-by: Steffen Maier <maier@linux.ibm.com>
+Acked-by: Johannes Thumshirn <jthumshirn@suse.de>
+---
+ drivers/s390/scsi/zfcp_erp.c | 13 +++++++++++--
+ 1 file changed, 11 insertions(+), 2 deletions(-)
+
+--- a/drivers/s390/scsi/zfcp_erp.c
++++ b/drivers/s390/scsi/zfcp_erp.c
+@@ -41,9 +41,13 @@ enum zfcp_erp_steps {
+ * @ZFCP_ERP_ACTION_REOPEN_PORT_FORCED: Forced port recovery.
+ * @ZFCP_ERP_ACTION_REOPEN_ADAPTER: Adapter recovery.
+ * @ZFCP_ERP_ACTION_NONE: Eyecatcher pseudo flag to bitwise or-combine with
+- * either of the other enum values.
++ * either of the first four enum values.
+ * Used to indicate that an ERP action could not be
+ * set up despite a detected need for some recovery.
++ * @ZFCP_ERP_ACTION_FAILED: Eyecatcher pseudo flag to bitwise or-combine with
++ * either of the first four enum values.
++ * Used to indicate that ERP not needed because
++ * the object has ZFCP_STATUS_COMMON_ERP_FAILED.
+ */
+ enum zfcp_erp_act_type {
+ ZFCP_ERP_ACTION_REOPEN_LUN = 1,
+@@ -51,6 +55,7 @@ enum zfcp_erp_act_type {
+ ZFCP_ERP_ACTION_REOPEN_PORT_FORCED = 3,
+ ZFCP_ERP_ACTION_REOPEN_ADAPTER = 4,
+ ZFCP_ERP_ACTION_NONE = 0xc0,
++ ZFCP_ERP_ACTION_FAILED = 0xe0,
+ };
+
+ enum zfcp_erp_act_state {
+@@ -378,8 +383,12 @@ static void _zfcp_erp_port_forced_reopen
+ zfcp_erp_port_block(port, clear);
+ zfcp_scsi_schedule_rport_block(port);
+
+- if (atomic_read(&port->status) & ZFCP_STATUS_COMMON_ERP_FAILED)
++ if (atomic_read(&port->status) & ZFCP_STATUS_COMMON_ERP_FAILED) {
++ zfcp_dbf_rec_trig(id, port->adapter, port, NULL,
++ ZFCP_ERP_ACTION_REOPEN_PORT_FORCED,
++ ZFCP_ERP_ACTION_FAILED);
+ return;
++ }
+
+ zfcp_erp_action_enqueue(ZFCP_ERP_ACTION_REOPEN_PORT_FORCED,
+ port->adapter, port, NULL, id, 0);
diff --git a/patches.arch/s390-sles12sp3-17-01-06-zfcp-missing-REC-trig-trace-all-objects-ERP_FAILED.patch b/patches.arch/s390-sles12sp3-17-01-06-zfcp-missing-REC-trig-trace-all-objects-ERP_FAILED.patch
new file mode 100644
index 0000000000..91c51f7c8f
--- /dev/null
+++ b/patches.arch/s390-sles12sp3-17-01-06-zfcp-missing-REC-trig-trace-all-objects-ERP_FAILED.patch
@@ -0,0 +1,330 @@
+From: Steffen Maier <maier@linux.ibm.com>
+Subject: scsi: zfcp: fix missing REC trigger trace for all objects in ERP_FAILED
+Patch-mainline: v4.18-rc1
+Git-commit: 8c3d20aada70042a39c6a6625be037c1472ca610
+References: bnc#1099713, LTC#168765
+
+Description: zfcp: fix tracing regressions, part 3
+Symptom: Cannot determine result of eh_host_reset_handler.
+
+ Cannot see if and when zfcp retries abort or task management
+ functions (LUN/target reset) while synchronizing scsi_eh and
+ zfcp-internal recovery.
+
+ Confusing zfcp ERP trace record if a SCSI device is deleted
+ during scsi_eh host reset.
+
+ Cannot determine that our terminate_rport_io callback was
+ invoked if it returned early.
+
+ Cannot determine that our terminate_rport_io callback was
+ invoked if a long fast_io_fail_tmo was configured (typically
+ longer than 12 seconds, e.g. 27 seconds).
+
+ Cannot determine if something wanted to enqueue zfcp recovery
+ for an object (adapter/port regular/unit) in ERP_FAILED state.
+
+ Cannot determine if something wanted to enqueue zfcp recovery
+ but no zfcp ERP thread was running.
+Problem: v2.6.35 commit a1dbfddd02d2 ("[SCSI] zfcp: Pass return code
+ from fc_block_scsi_eh to scsi eh") introduced the first
+ return with something other than the previously hardcoded
+ single SUCCESS return path.
+
+ Due to zfcp_erp_wait() and fc_block_scsi_eh() time can pass
+ between the start of our eh callback and an actual send/recv
+ of an abort / TMF request.
+
+ If a SCSI device is deleted during scsi_eh host reset, we
+ cannot get a reference to the SCSI device anymore since
+ scsi_device_get returns !=0 by design. Assuming the recovery
+ of adapter and port(s) was successful,
+ zfcp_erp_strategy_followup_success() attempts to trigger a
+ LUN reset for the half-gone SCSI device. However,
+ zfcp_erp_setup_act() returns NULL as it cannot get the
+ reference. Hence, zfcp_erp_action_enqueue() takes an early
+ goto out and _NO_ recovery actually happens, but it writes a
+ confusing trace record which states that zfcp will do a LUN
+ recovery as "ERP need" is ZFCP_ERP_ACTION_REOPEN_LUN == 1 and
+ equals "ERP want".
+ Before v2.6.38 commit ae0904f60fab ("[SCSI] zfcp: Redesign of
+ the debug tracing for recovery actions.") we could detect
+ this case because the "erp_action" field in the trace was
+ NULL. The rework removed erp_action as argument and field
+ from the trace.
+
+ If we get an fc_rport in terminate_rport_io() for which we
+ cannot find a match within zfcp_get_port_by_wwpn(), the
+ latter can return NULL. v2.6.30 commit 70932935b61e ("[SCSI]
+ zfcp: Fix oops when port disappears") introduced an early
+ return without adding a trace record for this case.
+
+ After target cable pull: The ADISC for "link" test times out
+ after typically 4 seconds. The open port recovery times out
+ after typically 8 seconds, causing zfcp_port.status to
+ contain ERP_FAILED. zfcp_scsi_terminate_rport_io() tries to
+ enqueue forced port recovery, but due to ERP_FAILED this
+ resulted in a silent early return.
+
+ Trying to enqueue recovery for adapter / port regular / LUN
+ resulted in silent early returns.
+
+ Trying to enqueue recovery if no ERP thread was running
+ resulted in silent early returns.
+Solution: Write trace record in zfcp area SCSI and re-use SCSI result
+ field to contain the return value of eh_host_reset_handler.
+
+ Add a trace before calling the two blocking functions
+ zfcp_erp_wait() and fc_block_scsi_eh().
+
+ Introduce an eyecatcher "flag" to mark the "ERP need" as 'not
+ needed' but still keep the information which erp_action type,
+ that zfcp_erp_required_act() had decided upon, is needed.
+ 0xc_ is chosen to be visibly different from 0x0_ in "ERP
+ want".
+
+ Write trace record in zfcp area REC with "ERP need" none.
+
+ Write trace record in zfcp area REC with "ERP need" 0xe0.
+
+ zfcp_erp_action_enqueue() already had two early outs which
+ re-used the one zfcp_dbf_rec_trig() call. All ERP trigger
+ functions finally run through zfcp_erp_action_enqueue(). So
+ move the special handling for ZFCP_STATUS_COMMON_ERP_FAILED
+ into zfcp_erp_action_enqueue() and add another early out with
+ new trace marker for pseudo ERP need in this case. This
+ removes all early returns from all ERP trigger functions so
+ we always end up at zfcp_dbf_rec_trig().
+
+ Write trace record in zfcp area REC with "ERP need" 0xc0.
+Reproduction: If NPIV is not enabled with subchannel, ensure that your
+ subchannel is the only one active on the entire channel.
+ Set eh_deadline to a short enough time interval, e.g. 5
+ seconds (before FCP device online: scsi_mod.eh_deadline=5).
+ Enable RSCN suppression on the SAN switch port beyond the
+ first link, i.e. towards the storage target. Disable that
+ switch port. Send one SCSI command to the single path SCSI
+ disk of that port in the background (because it will block
+ for a while) e.g. via "dd if=/dev/sd... of=/dev/null
+ iflag=direct count=1 &". After <SCSI command timeout>
+ seconds, the command runs into the timeout. Due to the short
+ eh_deadline, the SCSI midlayer immediately performs SCSI host
+ reset. After the corresponding adapter recovery, the new
+ trace record "schrh_r" appears.
+
+ Difficult to reproduce as we need to have a SCSI command time
+ out once (abort) or twice (scsi_eh), and timely have to
+ prevent sending of the abort or TMF. Examples to prevent
+ sending is severe memory pressure, or zfcp-internal recovery
+ of the zfcp unit (e.g. write 0 to failed sysfs attribute) or
+ of the target port (depending on potentially escalated
+ scsi_eh scope) so the zfcp object is blocked.
+
+ Difficult to reproduce as we need to get into scsi_eh, fully
+ escalate to host reset, and something has to timely delete a
+ SCSI device of this Scsi_Host.
+
+ Disable auto port REscan with zfcp.no_auto_port_rescan=1. Let
+ always enabled zfcp auto port scan attach a target remote
+ port without attaching LUNs to it (zfcp.allow_lun_scan=0 and
+ no explicit zfcp unit_add). Use zfcp port_remove to remove
+ such target port again. After fast_io_fail_tmo or
+ dev_loss_tmo, the new trace record "sctrpin" can appear.
+
+ If NPIV is not enabled with subchannel, ensure that your
+ subchannel is the only one active on the entire channel.
+ Configure a large enough fast_io_fail_tmo, e.g. 27 seconds.
+ Pull cable at target side. Wait until fast_io_fail_tmo runs
+ out and with the fix a zfcp trace "sctrpi1" with "ERP need"
+ 0xe0 must appear in the REC area. (for shared non-NPIV
+ subchannels, only the first subchannel, that happens to
+ complete the corresponding code path, ends up in this
+ particular case)
+
+ Difficult to reproduce as we need a "soft" recovery trigger
+ that does not clear ERP_FAILED (as opposed to e.g. failed
+ sysfs attribute).
+
+ No known reproduction.
+
+Upstream-Description:
+
+ scsi: zfcp: fix missing REC trigger trace for all objects in ERP_FAILED
+
+ That other commit introduced an inconsistency because it would trace on
+ ERP_FAILED for all callers of port forced reopen triggers (not just
+ terminate_rport_io), but it would not trace on ERP_FAILED for all callers of
+ other ERP triggers such as adapter, port regular, LUN.
+
+ Therefore, generalize that other commit. zfcp_erp_action_enqueue() already
+ had two early outs which re-used the one zfcp_dbf_rec_trig() call. All ERP
+ trigger functions finally run through zfcp_erp_action_enqueue(). So move
+ the special handling for ZFCP_STATUS_COMMON_ERP_FAILED into
+ zfcp_erp_action_enqueue() and add another early out with new trace marker
+ for pseudo ERP need in this case. This removes all early returns from all
+ ERP trigger functions so we always end up at zfcp_dbf_rec_trig().
+
+ Example trace record formatted with zfcpdbf from s390-tools:
+
+ Timestamp : ...
+ Area : REC
+ Subarea : 00
+ Level : 1
+ Exception : -
+ CPU ID : ..
+ Caller : 0x...
+ Record ID : 1 ZFCP_DBF_REC_TRIG
+ Tag : .......
+ LUN : 0x...
+ WWPN : 0x...
+ D_ID : 0x...
+ Adapter status : 0x...
+ Port status : 0x...
+ LUN status : 0x...
+ Ready count : 0x...
+ Running count : 0x...
+ ERP want : 0x0. ZFCP_ERP_ACTION_REOPEN_...
+ ERP need : 0xe0 ZFCP_ERP_ACTION_FAILED
+
+ Signed-off-by: Steffen Maier <maier@linux.ibm.com>
+ Cc: <stable@vger.kernel.org> #2.6.38+
+ Reviewed-by: Benjamin Block <bblock@linux.ibm.com>
+ Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
+
+
+Signed-off-by: Steffen Maier <maier@linux.ibm.com>
+Acked-by: Johannes Thumshirn <jthumshirn@suse.de>
+---
+ drivers/s390/scsi/zfcp_erp.c | 79 +++++++++++++++++++++++++++----------------
+ 1 file changed, 51 insertions(+), 28 deletions(-)
+
+--- a/drivers/s390/scsi/zfcp_erp.c
++++ b/drivers/s390/scsi/zfcp_erp.c
+@@ -142,6 +142,49 @@ static void zfcp_erp_action_dismiss_adap
+ }
+ }
+
++static int zfcp_erp_handle_failed(int want, struct zfcp_adapter *adapter,
++ struct zfcp_port *port,
++ struct scsi_device *sdev)
++{
++ int need = want;
++ struct zfcp_scsi_dev *zsdev;
++
++ switch (want) {
++ case ZFCP_ERP_ACTION_REOPEN_LUN:
++ zsdev = sdev_to_zfcp(sdev);
++ if (atomic_read(&zsdev->status) & ZFCP_STATUS_COMMON_ERP_FAILED)
++ need = 0;
++ break;
++ case ZFCP_ERP_ACTION_REOPEN_PORT_FORCED:
++ if (atomic_read(&port->status) & ZFCP_STATUS_COMMON_ERP_FAILED)
++ need = 0;
++ break;
++ case ZFCP_ERP_ACTION_REOPEN_PORT:
++ if (atomic_read(&port->status) &
++ ZFCP_STATUS_COMMON_ERP_FAILED) {
++ need = 0;
++ /* ensure propagation of failed status to new devices */
++ zfcp_erp_set_port_status(
++ port, ZFCP_STATUS_COMMON_ERP_FAILED);
++ }
++ break;
++ case ZFCP_ERP_ACTION_REOPEN_ADAPTER:
++ if (atomic_read(&adapter->status) &
++ ZFCP_STATUS_COMMON_ERP_FAILED) {
++ need = 0;
++ /* ensure propagation of failed status to new devices */
++ zfcp_erp_set_adapter_status(
++ adapter, ZFCP_STATUS_COMMON_ERP_FAILED);
++ }
++ break;
++ default:
++ need = 0;
++ break;
++ }
++
++ return need;
++}
++
+ static int zfcp_erp_required_act(int want, struct zfcp_adapter *adapter,
+ struct zfcp_port *port,
+ struct scsi_device *sdev)
+@@ -265,6 +308,12 @@ static int zfcp_erp_action_enqueue(int w
+ int retval = 1, need;
+ struct zfcp_erp_action *act;
+
++ need = zfcp_erp_handle_failed(want, adapter, port, sdev);
++ if (!need) {
++ need = ZFCP_ERP_ACTION_FAILED; /* marker for trace */
++ goto out;
++ }
++
+ if (!adapter->erp_thread)
+ return -EIO;
+
+@@ -313,12 +362,6 @@ static int _zfcp_erp_adapter_reopen(stru
+ zfcp_erp_adapter_block(adapter, clear_mask);
+ zfcp_scsi_schedule_rports_block(adapter);
+
+- /* ensure propagation of failed status to new devices */
+- if (atomic_read(&adapter->status) & ZFCP_STATUS_COMMON_ERP_FAILED) {
+- zfcp_erp_set_adapter_status(adapter,
+- ZFCP_STATUS_COMMON_ERP_FAILED);
+- return -EIO;
+- }
+ return zfcp_erp_action_enqueue(ZFCP_ERP_ACTION_REOPEN_ADAPTER,
+ adapter, NULL, NULL, id, 0);
+ }
+@@ -337,12 +380,8 @@ void zfcp_erp_adapter_reopen(struct zfcp
+ zfcp_scsi_schedule_rports_block(adapter);
+
+ write_lock_irqsave(&adapter->erp_lock, flags);
+- if (atomic_read(&adapter->status) & ZFCP_STATUS_COMMON_ERP_FAILED)
+- zfcp_erp_set_adapter_status(adapter,
+- ZFCP_STATUS_COMMON_ERP_FAILED);
+- else
+- zfcp_erp_action_enqueue(ZFCP_ERP_ACTION_REOPEN_ADAPTER, adapter,
+- NULL, NULL, id, 0);
++ zfcp_erp_action_enqueue(ZFCP_ERP_ACTION_REOPEN_ADAPTER, adapter,
++ NULL, NULL, id, 0);
+ write_unlock_irqrestore(&adapter->erp_lock, flags);
+ }
+
+@@ -383,13 +422,6 @@ static void _zfcp_erp_port_forced_reopen
+ zfcp_erp_port_block(port, clear);
+ zfcp_scsi_schedule_rport_block(port);
+
+- if (atomic_read(&port->status) & ZFCP_STATUS_COMMON_ERP_FAILED) {
+- zfcp_dbf_rec_trig(id, port->adapter, port, NULL,
+- ZFCP_ERP_ACTION_REOPEN_PORT_FORCED,
+- ZFCP_ERP_ACTION_FAILED);
+- return;
+- }
+-
+ zfcp_erp_action_enqueue(ZFCP_ERP_ACTION_REOPEN_PORT_FORCED,
+ port->adapter, port, NULL, id, 0);
+ }
+@@ -415,12 +447,6 @@ static int _zfcp_erp_port_reopen(struct
+ zfcp_erp_port_block(port, clear);
+ zfcp_scsi_schedule_rport_block(port);
+
+- if (atomic_read(&port->status) & ZFCP_STATUS_COMMON_ERP_FAILED) {
+- /* ensure propagation of failed status to new devices */
+- zfcp_erp_set_port_status(port, ZFCP_STATUS_COMMON_ERP_FAILED);
+- return -EIO;
+- }
+-
+ return zfcp_erp_action_enqueue(ZFCP_ERP_ACTION_REOPEN_PORT,
+ port->adapter, port, NULL, id, 0);
+ }
+@@ -460,9 +486,6 @@ static void _zfcp_erp_lun_reopen(struct
+
+ zfcp_erp_lun_block(sdev, clear);
+
+- if (atomic_read(&zfcp_sdev->status) & ZFCP_STATUS_COMMON_ERP_FAILED)
+- return;
+-
+ zfcp_erp_action_enqueue(ZFCP_ERP_ACTION_REOPEN_LUN, adapter,
+ zfcp_sdev->port, sdev, id, act_status);
+ }
diff --git a/patches.arch/s390-sles12sp3-17-01-07-zfcp-missing-REC-trig-trace-enqueue-no-ERP-thread.patch b/patches.arch/s390-sles12sp3-17-01-07-zfcp-missing-REC-trig-trace-enqueue-no-ERP-thread.patch
new file mode 100644
index 0000000000..2ce1ede321
--- /dev/null
+++ b/patches.arch/s390-sles12sp3-17-01-07-zfcp-missing-REC-trig-trace-enqueue-no-ERP-thread.patch
@@ -0,0 +1,203 @@
+From: Steffen Maier <maier@linux.ibm.com>
+Subject: scsi: zfcp: fix missing REC trigger trace on enqueue without ERP thread
+Patch-mainline: v4.18-rc1
+Git-commit: 6a76550841d412330bd86aed3238d1888ba70f0e
+References: bnc#1099713, LTC#168765
+
+Description: zfcp: fix tracing regressions, part 3
+Symptom: Cannot determine result of eh_host_reset_handler.
+
+ Cannot see if and when zfcp retries abort or task management
+ functions (LUN/target reset) while synchronizing scsi_eh and
+ zfcp-internal recovery.
+
+ Confusing zfcp ERP trace record if a SCSI device is deleted
+ during scsi_eh host reset.
+
+ Cannot determine that our terminate_rport_io callback was
+ invoked if it returned early.
+
+ Cannot determine that our terminate_rport_io callback was
+ invoked if a long fast_io_fail_tmo was configured (typically
+ longer than 12 seconds, e.g. 27 seconds).
+
+ Cannot determine if something wanted to enqueue zfcp recovery
+ for an object (adapter/port regular/unit) in ERP_FAILED state.
+
+ Cannot determine if something wanted to enqueue zfcp recovery
+ but no zfcp ERP thread was running.
+Problem: v2.6.35 commit a1dbfddd02d2 ("[SCSI] zfcp: Pass return code
+ from fc_block_scsi_eh to scsi eh") introduced the first
+ return with something other than the previously hardcoded
+ single SUCCESS return path.
+
+ Due to zfcp_erp_wait() and fc_block_scsi_eh() time can pass
+ between the start of our eh callback and an actual send/recv
+ of an abort / TMF request.
+
+ If a SCSI device is deleted during scsi_eh host reset, we
+ cannot get a reference to the SCSI device anymore since
+ scsi_device_get returns !=0 by design. Assuming the recovery
+ of adapter and port(s) was successful,
+ zfcp_erp_strategy_followup_success() attempts to trigger a
+ LUN reset for the half-gone SCSI device. However,
+ zfcp_erp_setup_act() returns NULL as it cannot get the
+ reference. Hence, zfcp_erp_action_enqueue() takes an early
+ goto out and _NO_ recovery actually happens, but it writes a
+ confusing trace record which states that zfcp will do a LUN
+ recovery as "ERP need" is ZFCP_ERP_ACTION_REOPEN_LUN == 1 and
+ equals "ERP want".
+ Before v2.6.38 commit ae0904f60fab ("[SCSI] zfcp: Redesign of
+ the debug tracing for recovery actions.") we could detect
+ this case because the "erp_action" field in the trace was
+ NULL. The rework removed erp_action as argument and field
+ from the trace.
+
+ If we get an fc_rport in terminate_rport_io() for which we
+ cannot find a match within zfcp_get_port_by_wwpn(), the
+ latter can return NULL. v2.6.30 commit 70932935b61e ("[SCSI]
+ zfcp: Fix oops when port disappears") introduced an early
+ return without adding a trace record for this case.
+
+ After target cable pull: The ADISC for "link" test times out
+ after typically 4 seconds. The open port recovery times out
+ after typically 8 seconds, causing zfcp_port.status to
+ contain ERP_FAILED. zfcp_scsi_terminate_rport_io() tries to
+ enqueue forced port recovery, but due to ERP_FAILED this
+ resulted in a silent early return.
+
+ Trying to enqueue recovery for adapter / port regular / LUN
+ resulted in silent early returns.
+
+ Trying to enqueue recovery if no ERP thread was running
+ resulted in silent early returns.
+Solution: Write trace record in zfcp area SCSI and re-use SCSI result
+ field to contain the return value of eh_host_reset_handler.
+
+ Add a trace before calling the two blocking functions
+ zfcp_erp_wait() and fc_block_scsi_eh().
+
+ Introduce an eyecatcher "flag" to mark the "ERP need" as 'not
+ needed' but still keep the information which erp_action type,
+ that zfcp_erp_required_act() had decided upon, is needed.
+ 0xc_ is chosen to be visibly different from 0x0_ in "ERP
+ want".
+
+ Write trace record in zfcp area REC with "ERP need" none.
+
+ Write trace record in zfcp area REC with "ERP need" 0xe0.
+
+ zfcp_erp_action_enqueue() already had two early outs which
+ re-used the one zfcp_dbf_rec_trig() call. All ERP trigger
+ functions finally run through zfcp_erp_action_enqueue(). So
+ move the special handling for ZFCP_STATUS_COMMON_ERP_FAILED
+ into zfcp_erp_action_enqueue() and add another early out with
+ new trace marker for pseudo ERP need in this case. This
+ removes all early returns from all ERP trigger functions so
+ we always end up at zfcp_dbf_rec_trig().
+
+ Write trace record in zfcp area REC with "ERP need" 0xc0.
+Reproduction: If NPIV is not enabled with subchannel, ensure that your
+ subchannel is the only one active on the entire channel.
+ Set eh_deadline to a short enough time interval, e.g. 5
+ seconds (before FCP device online: scsi_mod.eh_deadline=5).
+ Enable RSCN suppression on the SAN switch port beyond the
+ first link, i.e. towards the storage target. Disable that
+ switch port. Send one SCSI command to the single path SCSI
+ disk of that port in the background (because it will block
+ for a while) e.g. via "dd if=/dev/sd... of=/dev/null
+ iflag=direct count=1 &". After <SCSI command timeout>
+ seconds, the command runs into the timeout. Due to the short
+ eh_deadline, the SCSI midlayer immediately performs SCSI host
+ reset. After the corresponding adapter recovery, the new
+ trace record "schrh_r" appears.
+
+ Difficult to reproduce as we need to have a SCSI command time
+ out once (abort) or twice (scsi_eh), and timely have to
+ prevent sending of the abort or TMF. Examples to prevent
+ sending is severe memory pressure, or zfcp-internal recovery
+ of the zfcp unit (e.g. write 0 to failed sysfs attribute) or
+ of the target port (depending on potentially escalated
+ scsi_eh scope) so the zfcp object is blocked.
+
+ Difficult to reproduce as we need to get into scsi_eh, fully
+ escalate to host reset, and something has to timely delete a
+ SCSI device of this Scsi_Host.
+
+ Disable auto port REscan with zfcp.no_auto_port_rescan=1. Let
+ always enabled zfcp auto port scan attach a target remote
+ port without attaching LUNs to it (zfcp.allow_lun_scan=0 and
+ no explicit zfcp unit_add). Use zfcp port_remove to remove
+ such target port again. After fast_io_fail_tmo or
+ dev_loss_tmo, the new trace record "sctrpin" can appear.
+
+ If NPIV is not enabled with subchannel, ensure that your
+ subchannel is the only one active on the entire channel.
+ Configure a large enough fast_io_fail_tmo, e.g. 27 seconds.
+ Pull cable at target side. Wait until fast_io_fail_tmo runs
+ out and with the fix a zfcp trace "sctrpi1" with "ERP need"
+ 0xe0 must appear in the REC area. (for shared non-NPIV
+ subchannels, only the first subchannel, that happens to
+ complete the corresponding code path, ends up in this
+ particular case)
+
+ Difficult to reproduce as we need a "soft" recovery trigger
+ that does not clear ERP_FAILED (as opposed to e.g. failed
+ sysfs attribute).
+
+ No known reproduction.
+
+Upstream-Description:
+
+ scsi: zfcp: fix missing REC trigger trace on enqueue without ERP thread
+
+ Example trace record formatted with zfcpdbf from s390-tools:
+
+ Timestamp : ...
+ Area : REC
+ Subarea : 00
+ Level : 1
+ Exception : -
+ CPU ID : ..
+ Caller : 0x...
+ Record ID : 1 ZFCP_DBF_REC_TRIG
+ Tag : .......
+ LUN : 0x...
+ WWPN : 0x...
+ D_ID : 0x...
+ Adapter status : 0x...
+ Port status : 0x...
+ LUN status : 0x...
+ Ready count : 0x...
+ Running count : 0x...
+ ERP want : 0x0. ZFCP_ERP_ACTION_REOPEN_...
+ ERP need : 0xc0 ZFCP_ERP_ACTION_NONE
+
+ Signed-off-by: Steffen Maier <maier@linux.ibm.com>
+ Cc: <stable@vger.kernel.org> #2.6.38+
+ Reviewed-by: Benjamin Block <bblock@linux.ibm.com>
+ Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
+
+
+Signed-off-by: Steffen Maier <maier@linux.ibm.com>
+Acked-by: Johannes Thumshirn <jthumshirn@suse.de>
+---
+ drivers/s390/scsi/zfcp_erp.c | 7 +++++--
+ 1 file changed, 5 insertions(+), 2 deletions(-)
+
+--- a/drivers/s390/scsi/zfcp_erp.c
++++ b/drivers/s390/scsi/zfcp_erp.c
+@@ -314,8 +314,11 @@ static int zfcp_erp_action_enqueue(int w
+ goto out;
+ }
+
+- if (!adapter->erp_thread)
+- return -EIO;
++ if (!adapter->erp_thread) {
++ need = ZFCP_ERP_ACTION_NONE; /* marker for trace */
++ retval = -EIO;
++ goto out;
++ }
+
+ need = zfcp_erp_required_act(want, adapter, port, sdev);
+ if (!need)
diff --git a/patches.drivers/ALSA-hda-Clean-up-ALC299-init-code b/patches.drivers/ALSA-hda-Clean-up-ALC299-init-code
new file mode 100644
index 0000000000..2ea619ec8f
--- /dev/null
+++ b/patches.drivers/ALSA-hda-Clean-up-ALC299-init-code
@@ -0,0 +1,38 @@
+From c1350bff69d13369c3316f5d5e580021c2196f90 Mon Sep 17 00:00:00 2001
+From: Takashi Iwai <tiwai@suse.de>
+Date: Wed, 27 Dec 2017 09:03:45 +0100
+Subject: [PATCH] ALSA: hda - Clean up ALC299 init code
+Git-commit: c1350bff69d13369c3316f5d5e580021c2196f90
+Patch-mainline: v4.16-rc1
+References: bsc#1099810
+
+ALC299 is compatible with ALC225/295, thus it doesn't have to assign
+its own model. Merge together with ALC225/295 code.
+
+Signed-off-by: Takashi Iwai <tiwai@suse.de>
+
+---
+ sound/pci/hda/patch_realtek.c | 5 +----
+ 1 file changed, 1 insertion(+), 4 deletions(-)
+
+diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
+index 8fd2d9c62c96..b2037131eed9 100644
+--- a/sound/pci/hda/patch_realtek.c
++++ b/sound/pci/hda/patch_realtek.c
+@@ -6923,12 +6923,9 @@ static int patch_alc269(struct hda_codec *codec)
+ break;
+ case 0x10ec0225:
+ case 0x10ec0295:
+- spec->codec_variant = ALC269_TYPE_ALC225;
+- spec->gen.mixer_nid = 0; /* no loopback on ALC225 ALC295 */
+- break;
+ case 0x10ec0299:
+ spec->codec_variant = ALC269_TYPE_ALC225;
+- spec->gen.mixer_nid = 0; /* no loopback on ALC299 */
++ spec->gen.mixer_nid = 0; /* no loopback on ALC225, ALC295 and ALC299 */
+ break;
+ case 0x10ec0234:
+ case 0x10ec0274:
+--
+2.18.0
+
diff --git a/patches.drivers/ALSA-hda-Enable-power_save_node-for-CX20722 b/patches.drivers/ALSA-hda-Enable-power_save_node-for-CX20722
new file mode 100644
index 0000000000..c1c78b4dff
--- /dev/null
+++ b/patches.drivers/ALSA-hda-Enable-power_save_node-for-CX20722
@@ -0,0 +1,34 @@
+From b03d61d646c596efd02db64df43d287ea596b663 Mon Sep 17 00:00:00 2001
+From: David Henningsson <david.henningsson@canonical.com>
+Date: Thu, 3 Dec 2015 15:46:57 +0100
+Subject: [PATCH] ALSA: hda - Enable power_save_node for CX20722
+Git-commit: b03d61d646c596efd02db64df43d287ea596b663
+Patch-mainline: v4.5-rc1
+References: bsc#1099810
+
+I've tested it on one device and it works fine, no clicks.
+
+Signed-off-by: David Henningsson <david.henningsson@canonical.com>
+Signed-off-by: Takashi Iwai <tiwai@suse.de>
+
+---
+ sound/pci/hda/patch_conexant.c | 3 +++
+ 1 file changed, 3 insertions(+)
+
+diff --git a/sound/pci/hda/patch_conexant.c b/sound/pci/hda/patch_conexant.c
+index c8b8ef5246a6..19b3deba23e4 100644
+--- a/sound/pci/hda/patch_conexant.c
++++ b/sound/pci/hda/patch_conexant.c
+@@ -901,6 +901,9 @@ static int patch_conexant_auto(struct hda_codec *codec)
+ snd_hda_pick_fixup(codec, cxt5051_fixup_models,
+ cxt5051_fixups, cxt_fixups);
+ break;
++ case 0x14f150f2:
++ codec->power_save_node = 1;
++ /* Fall through */
+ default:
+ codec->pin_amp_workaround = 1;
+ snd_hda_pick_fixup(codec, cxt5066_fixup_models,
+--
+2.18.0
+
diff --git a/patches.drivers/ALSA-hda-Fix-a-wrong-FIXUP-for-alc289-on-Dell-machin b/patches.drivers/ALSA-hda-Fix-a-wrong-FIXUP-for-alc289-on-Dell-machin
new file mode 100644
index 0000000000..e6f3086be1
--- /dev/null
+++ b/patches.drivers/ALSA-hda-Fix-a-wrong-FIXUP-for-alc289-on-Dell-machin
@@ -0,0 +1,39 @@
+From d5078193e56bb24f4593f00102a3b5e07bb84ee0 Mon Sep 17 00:00:00 2001
+From: Hui Wang <hui.wang@canonical.com>
+Date: Fri, 2 Mar 2018 13:05:36 +0800
+Subject: [PATCH] ALSA: hda - Fix a wrong FIXUP for alc289 on Dell machines
+Git-commit: d5078193e56bb24f4593f00102a3b5e07bb84ee0
+Patch-mainline: v4.16-rc5
+References: bsc#1099810
+
+With the alc289, the Pin 0x1b is Headphone-Mic, so we should assign
+ALC269_FIXUP_DELL4_MIC_NO_PRESENCE rather than
+ALC225_FIXUP_DELL1_MIC_NO_PRESENCE to it. And this change is suggested
+by Kailang of Realtek and is verified on the machine.
+
+Fixes: 3f2f7c553d07 ("ALSA: hda - Fix headset mic detection problem for two Dell machines")
+Cc: Kailang Yang <kailang@realtek.com>
+Cc: <stable@vger.kernel.org>
+Signed-off-by: Hui Wang <hui.wang@canonical.com>
+Signed-off-by: Takashi Iwai <tiwai@suse.de>
+
+---
+ sound/pci/hda/patch_realtek.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
+index b9c93fa0a51c..7a9a86702927 100644
+--- a/sound/pci/hda/patch_realtek.c
++++ b/sound/pci/hda/patch_realtek.c
+@@ -6872,7 +6872,7 @@ static const struct snd_hda_pin_quirk alc269_pin_fixup_tbl[] = {
+ {0x12, 0x90a60120},
+ {0x14, 0x90170110},
+ {0x21, 0x0321101f}),
+- SND_HDA_PIN_QUIRK(0x10ec0289, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
++ SND_HDA_PIN_QUIRK(0x10ec0289, 0x1028, "Dell", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE,
+ {0x12, 0xb7a60130},
+ {0x14, 0x90170110},
+ {0x21, 0x04211020}),
+--
+2.18.0
+
diff --git a/patches.drivers/ALSA-hda-Fix-forget-to-free-resource-in-error-handli b/patches.drivers/ALSA-hda-Fix-forget-to-free-resource-in-error-handli
new file mode 100644
index 0000000000..2cb09dd82c
--- /dev/null
+++ b/patches.drivers/ALSA-hda-Fix-forget-to-free-resource-in-error-handli
@@ -0,0 +1,44 @@
+From 284b4c9289766c6294d4c6292aea565f78215b0e Mon Sep 17 00:00:00 2001
+From: Wang YanQing <udknight@gmail.com>
+Date: Mon, 4 Sep 2017 23:17:09 +0800
+Subject: [PATCH] ALSA: hda: Fix forget to free resource in error handling code path in hda_codec_driver_probe
+Git-commit: 284b4c9289766c6294d4c6292aea565f78215b0e
+Patch-mainline: v4.14-rc1
+References: bsc#1099810
+
+When hda_codec_driver_probe meet error and return failure, we need
+to free resource with patch_ops.free, or we will get resource leak.
+
+Signed-off-by: Wang YanQing <udknight@gmail.com>
+Signed-off-by: Takashi Iwai <tiwai@suse.de>
+
+---
+ sound/pci/hda/hda_bind.c | 5 ++++-
+ 1 file changed, 4 insertions(+), 1 deletion(-)
+
+diff --git a/sound/pci/hda/hda_bind.c b/sound/pci/hda/hda_bind.c
+index 6efadbfb3fe3..d361bb77ca00 100644
+--- a/sound/pci/hda/hda_bind.c
++++ b/sound/pci/hda/hda_bind.c
+@@ -100,7 +100,7 @@ static int hda_codec_driver_probe(struct device *dev)
+ if (patch) {
+ err = patch(codec);
+ if (err < 0)
+- goto error_module;
++ goto error_module_put;
+ }
+
+ err = snd_hda_codec_build_pcms(codec);
+@@ -120,6 +120,9 @@ static int hda_codec_driver_probe(struct device *dev)
+ return 0;
+
+ error_module:
++ if (codec->patch_ops.free)
++ codec->patch_ops.free(codec);
++ error_module_put:
+ module_put(owner);
+
+ error:
+--
+2.18.0
+
diff --git a/patches.drivers/ALSA-hda-Fix-incorrect-usage-of-IS_REACHABLE b/patches.drivers/ALSA-hda-Fix-incorrect-usage-of-IS_REACHABLE
new file mode 100644
index 0000000000..e72cbaf86e
--- /dev/null
+++ b/patches.drivers/ALSA-hda-Fix-incorrect-usage-of-IS_REACHABLE
@@ -0,0 +1,37 @@
+From 6a30abaa40b62aed46ef12ea4c16c48565bdb376 Mon Sep 17 00:00:00 2001
+From: Takashi Iwai <tiwai@suse.de>
+Date: Fri, 27 Apr 2018 17:17:35 +0200
+Subject: [PATCH] ALSA: hda - Fix incorrect usage of IS_REACHABLE()
+Git-commit: 6a30abaa40b62aed46ef12ea4c16c48565bdb376
+Patch-mainline: v4.17-rc4
+References: bsc#1099810
+
+The commit c469652bb5e8 ("ALSA: hda - Use IS_REACHABLE() for
+dependency on input") simplified the dependencies with IS_REACHABLE()
+macro, but it broke due to its incorrect usage: it should have been
+IS_REACHABLE(CONFIG_INPUT) instead of IS_REACHABLE(INPUT).
+
+Fixes: c469652bb5e8 ("ALSA: hda - Use IS_REACHABLE() for dependency on input")
+Cc: <stable@vger.kernel.org>
+Signed-off-by: Takashi Iwai <tiwai@suse.de>
+
+---
+ sound/pci/hda/patch_realtek.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
+index 8c238e51bb5a..2dd34dd77447 100644
+--- a/sound/pci/hda/patch_realtek.c
++++ b/sound/pci/hda/patch_realtek.c
+@@ -3832,7 +3832,7 @@ static void alc280_fixup_hp_gpio4(struct hda_codec *codec,
+ }
+ }
+
+-#if IS_REACHABLE(INPUT)
++#if IS_REACHABLE(CONFIG_INPUT)
+ static void gpio2_mic_hotkey_event(struct hda_codec *codec,
+ struct hda_jack_callback *event)
+ {
+--
+2.18.0
+
diff --git a/patches.drivers/ALSA-hda-Use-acpi_dev_present.patch b/patches.drivers/ALSA-hda-Use-acpi_dev_present.patch
new file mode 100644
index 0000000000..c8c300656a
--- /dev/null
+++ b/patches.drivers/ALSA-hda-Use-acpi_dev_present.patch
@@ -0,0 +1,53 @@
+From c3a900581e1137bdc2efc25325d99fcc9bb9ab1e Mon Sep 17 00:00:00 2001
+From: Lukas Wunner <lukas@wunner.de>
+Date: Thu, 14 Jan 2016 22:05:03 +0100
+Subject: [PATCH] ALSA: hda - Use acpi_dev_present()
+Git-commit: c3a900581e1137bdc2efc25325d99fcc9bb9ab1e
+Patch-mainline: v4.6-rc1
+References: bsc#1099810
+
+Use shiny new acpi_dev_present() and remove all the boilerplate
+to search for a particular ACPI device. No functional change.
+Cf. 2d12b6b381ba ("ACPI / utils: Add acpi_dev_present()").
+
+Signed-off-by: Lukas Wunner <lukas@wunner.de>
+Acked-by: Hui Wang <hui.wang@canonical.com>
+Signed-off-by: Takashi Iwai <tiwai@suse.de>
+
+---
+ sound/pci/hda/thinkpad_helper.c | 17 ++---------------
+ 1 file changed, 2 insertions(+), 15 deletions(-)
+
+diff --git a/sound/pci/hda/thinkpad_helper.c b/sound/pci/hda/thinkpad_helper.c
+index 0a4ad5feb82e..59ab6cee1ad8 100644
+--- a/sound/pci/hda/thinkpad_helper.c
++++ b/sound/pci/hda/thinkpad_helper.c
+@@ -10,23 +10,10 @@
+ static int (*led_set_func)(int, bool);
+ static void (*old_vmaster_hook)(void *, int);
+
+-static acpi_status acpi_check_cb(acpi_handle handle, u32 lvl, void *context,
+- void **rv)
+-{
+- bool *found = context;
+- *found = true;
+- return AE_OK;
+-}
+-
+ static bool is_thinkpad(struct hda_codec *codec)
+ {
+- bool found = false;
+- if (codec->core.subsystem_id >> 16 != 0x17aa)
+- return false;
+- if (ACPI_SUCCESS(acpi_get_devices("LEN0068", acpi_check_cb, &found, NULL)) && found)
+- return true;
+- found = false;
+- return ACPI_SUCCESS(acpi_get_devices("IBM0068", acpi_check_cb, &found, NULL)) && found;
++ return (codec->core.subsystem_id >> 16 == 0x17aa) &&
++ (acpi_dev_present("LEN0068") || acpi_dev_present("IBM0068"));
+ }
+
+ static void update_tpacpi_mute_led(void *private_data, int enabled)
+--
+2.18.0
+
diff --git a/patches.drivers/ALSA-hda-add-a-new-condition-to-check-if-it-is-think b/patches.drivers/ALSA-hda-add-a-new-condition-to-check-if-it-is-think
new file mode 100644
index 0000000000..a61c9104b1
--- /dev/null
+++ b/patches.drivers/ALSA-hda-add-a-new-condition-to-check-if-it-is-think
@@ -0,0 +1,40 @@
+From 2ecb704a1290edb5e3d53a75529192e7ed2a1a28 Mon Sep 17 00:00:00 2001
+From: Hui Wang <hui.wang@canonical.com>
+Date: Thu, 10 Nov 2016 13:20:05 +0800
+Subject: [PATCH] ALSA: hda - add a new condition to check if it is thinkpad
+Git-commit: 2ecb704a1290edb5e3d53a75529192e7ed2a1a28
+Patch-mainline: v4.9-rc6
+References: bsc#1099810
+
+Latest Thinkpad laptops use the HKEY_HID LEN0268 instead of the
+LEN0068, as a result neither audio mute led nor mic mute led can work
+any more.
+
+After adding the new HKEY_HID into the is_thinkpad(), both of them
+works well as before.
+
+Cc: <stable@vger.kernel.org>
+Signed-off-by: Hui Wang <hui.wang@canonical.com>
+Signed-off-by: Takashi Iwai <tiwai@suse.de>
+
+---
+ sound/pci/hda/thinkpad_helper.c | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/sound/pci/hda/thinkpad_helper.c b/sound/pci/hda/thinkpad_helper.c
+index 6a23302297c9..4d9d320a7971 100644
+--- a/sound/pci/hda/thinkpad_helper.c
++++ b/sound/pci/hda/thinkpad_helper.c
+@@ -13,7 +13,8 @@ static void (*old_vmaster_hook)(void *, int);
+ static bool is_thinkpad(struct hda_codec *codec)
+ {
+ return (codec->core.subsystem_id >> 16 == 0x17aa) &&
+- (acpi_dev_found("LEN0068") || acpi_dev_found("IBM0068"));
++ (acpi_dev_found("LEN0068") || acpi_dev_found("LEN0268") ||
++ acpi_dev_found("IBM0068"));
+ }
+
+ static void update_tpacpi_mute_led(void *private_data, int enabled)
+--
+2.18.0
+
diff --git a/patches.drivers/ALSA-hda-add-dock-and-led-support-for-HP-EliteBook-8 b/patches.drivers/ALSA-hda-add-dock-and-led-support-for-HP-EliteBook-8
new file mode 100644
index 0000000000..033ec3423d
--- /dev/null
+++ b/patches.drivers/ALSA-hda-add-dock-and-led-support-for-HP-EliteBook-8
@@ -0,0 +1,35 @@
+From 2861751f67b91e1d24e68010ced96614fb3140f4 Mon Sep 17 00:00:00 2001
+From: Dennis Wassenberg <dennis.wassenberg@secunet.com>
+Date: Tue, 12 Jun 2018 07:10:59 +0200
+Subject: [PATCH] ALSA: hda: add dock and led support for HP EliteBook 830 G5
+Git-commit: 2861751f67b91e1d24e68010ced96614fb3140f4
+Patch-mainline: v4.18-rc1
+References: bsc#1099810
+
+This patch adds missing initialisation for HP 2013 UltraSlim Dock
+Line-In/Out PINs and activates keyboard mute/micmute leds
+for HP EliteBook 830 G5
+
+Signed-off-by: Dennis Wassenberg <dennis.wassenberg@secunet.com>
+Cc: <stable@vger.kernel.org>
+Signed-off-by: Takashi Iwai <tiwai@suse.de>
+
+---
+ sound/pci/hda/patch_conexant.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/sound/pci/hda/patch_conexant.c b/sound/pci/hda/patch_conexant.c
+index dbf9910c5269..2655f9d92fd2 100644
+--- a/sound/pci/hda/patch_conexant.c
++++ b/sound/pci/hda/patch_conexant.c
+@@ -958,6 +958,7 @@ static const struct snd_pci_quirk cxt5066_fixups[] = {
+ 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, 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),
+--
+2.18.0
+
diff --git a/patches.drivers/ALSA-hda-add-dock-and-led-support-for-HP-ProBook-640 b/patches.drivers/ALSA-hda-add-dock-and-led-support-for-HP-ProBook-640
new file mode 100644
index 0000000000..44c6c156fc
--- /dev/null
+++ b/patches.drivers/ALSA-hda-add-dock-and-led-support-for-HP-ProBook-640
@@ -0,0 +1,35 @@
+From 7eef32c1ef895a3a96463f9cbd04203007cd5555 Mon Sep 17 00:00:00 2001
+From: Dennis Wassenberg <dennis.wassenberg@secunet.com>
+Date: Tue, 12 Jun 2018 07:11:11 +0200
+Subject: [PATCH] ALSA: hda: add dock and led support for HP ProBook 640 G4
+Git-commit: 7eef32c1ef895a3a96463f9cbd04203007cd5555
+Patch-mainline: v4.18-rc1
+References: bsc#1099810
+
+This patch adds missing initialisation for HP 2013 UltraSlim Dock
+Line-In/Out PINs and activates keyboard mute/micmute leds
+for HP ProBook 640 G4
+
+Signed-off-by: Dennis Wassenberg <dennis.wassenberg@secunet.com>
+Cc: <stable@vger.kernel.org>
+Signed-off-by: Takashi Iwai <tiwai@suse.de>
+
+---
+ sound/pci/hda/patch_conexant.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/sound/pci/hda/patch_conexant.c b/sound/pci/hda/patch_conexant.c
+index 2655f9d92fd2..e7fcfc3b8885 100644
+--- a/sound/pci/hda/patch_conexant.c
++++ b/sound/pci/hda/patch_conexant.c
+@@ -959,6 +959,7 @@ static const struct snd_pci_quirk cxt5066_fixups[] = {
+ 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),
+--
+2.18.0
+
diff --git a/patches.drivers/ALSA-hda-fix-some-klockwork-scan-warnings b/patches.drivers/ALSA-hda-fix-some-klockwork-scan-warnings
new file mode 100644
index 0000000000..584cc6ef61
--- /dev/null
+++ b/patches.drivers/ALSA-hda-fix-some-klockwork-scan-warnings
@@ -0,0 +1,59 @@
+From 960a581e22d93a784db843110ad1e6249c1542a5 Mon Sep 17 00:00:00 2001
+From: Libin Yang <libin.yang@linux.intel.com>
+Date: Thu, 16 Jun 2016 11:13:25 +0800
+Subject: [PATCH] ALSA: hda: fix some klockwork scan warnings
+Git-commit: 960a581e22d93a784db843110ad1e6249c1542a5
+Patch-mainline: v4.8-rc1
+References: bsc#1099810
+
+This patch fixes some warnings from klockwork.
+
+These warnings are not the real issues. The patch
+adds the sanity check.
+
+Signed-off-by: Libin Yang <libin.yang@linux.intel.com>
+Signed-off-by: Takashi Iwai <tiwai@suse.de>
+
+---
+ sound/pci/hda/hda_codec.c | 8 +++++++-
+ sound/pci/hda/patch_hdmi.c | 5 +++++
+ 2 files changed, 12 insertions(+), 1 deletion(-)
+
+--- a/sound/pci/hda/hda_codec.c
++++ b/sound/pci/hda/hda_codec.c
+@@ -3584,6 +3584,12 @@ static void setup_dig_out_stream(struct
+ bool reset;
+
+ spdif = snd_hda_spdif_out_of_nid(codec, nid);
++ /* Add sanity check to pass klockwork check.
++ * This should never happen.
++ */
++ if (WARN_ON(spdif == NULL))
++ return;
++
+ curr_fmt = snd_hda_codec_read(codec, nid, 0,
+ AC_VERB_GET_STREAM_FORMAT, 0);
+ reset = codec->spdif_status_reset &&
+@@ -3768,7 +3774,7 @@ int snd_hda_multi_out_analog_prepare(str
+ spdif = snd_hda_spdif_out_of_nid(codec, mout->dig_out_nid);
+ if (mout->dig_out_nid && mout->share_spdif &&
+ mout->dig_out_used != HDA_DIG_EXCLUSIVE) {
+- if (chs == 2 &&
++ if (chs == 2 && spdif != NULL &&
+ snd_hda_is_supported_format(codec, mout->dig_out_nid,
+ format) &&
+ !(spdif->status & IEC958_AES0_NONAUDIO)) {
+--- a/sound/pci/hda/patch_hdmi.c
++++ b/sound/pci/hda/patch_hdmi.c
+@@ -1827,6 +1827,11 @@ static bool check_non_pcm_per_cvt(struct
+
+ mutex_lock(&codec->spdif_mutex);
+ spdif = snd_hda_spdif_out_of_nid(codec, cvt_nid);
++ /* Add sanity check to pass klockwork check.
++ * This should never happen.
++ */
++ if (WARN_ON(spdif == NULL))
++ return true;
+ non_pcm = !!(spdif->status & IEC958_AES0_NONAUDIO);
+ mutex_unlock(&codec->spdif_mutex);
+ return non_pcm;
diff --git a/patches.drivers/ALSA-hda-patch_sigmatel-Add-AmigaOne-X1000-pinconfig b/patches.drivers/ALSA-hda-patch_sigmatel-Add-AmigaOne-X1000-pinconfig
new file mode 100644
index 0000000000..cf4eca646f
--- /dev/null
+++ b/patches.drivers/ALSA-hda-patch_sigmatel-Add-AmigaOne-X1000-pinconfig
@@ -0,0 +1,97 @@
+From 078502b5842a52f6faf7edf178fb2ad22fa16b96 Mon Sep 17 00:00:00 2001
+From: Darren Stevens <darren@stevens-zone.net>
+Date: Mon, 13 Feb 2017 21:11:03 +0000
+Subject: [PATCH] ALSA: hda/patch_sigmatel: Add AmigaOne X1000 pinconfigs
+Git-commit: 078502b5842a52f6faf7edf178fb2ad22fa16b96
+Patch-mainline: v4.11-rc1
+References: bsc#1099810
+
+The AmigaOne X1000 has a Sigmatel STAC92HD700 attached to the HD Audio
+on an ATI SB600. Add the required settings to enable sound.
+
+Signed-off-by: Darren Stevens <darren@stevens-zone.net>
+Signed-off-by: Takashi Iwai <tiwai@suse.de>
+
+---
+ sound/pci/hda/patch_sigmatel.c | 30 ++++++++++++++++++++++++++++++
+ 1 file changed, 30 insertions(+)
+
+diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c
+index 37b70f8e878f..faa3d38bac0b 100644
+--- a/sound/pci/hda/patch_sigmatel.c
++++ b/sound/pci/hda/patch_sigmatel.c
+@@ -166,6 +166,7 @@ enum {
+ STAC_D965_VERBS,
+ STAC_DELL_3ST,
+ STAC_DELL_BIOS,
++ STAC_NEMO_DEFAULT,
+ STAC_DELL_BIOS_AMIC,
+ STAC_DELL_BIOS_SPDIF,
+ STAC_927X_DELL_DMIC,
+@@ -1360,6 +1361,27 @@ static const struct hda_pintbl oqo9200_pin_configs[] = {
+ {}
+ };
+
++/*
++ * STAC 92HD700
++ * 18881000 Amigaone X1000
++ */
++static const struct hda_pintbl nemo_pin_configs[] = {
++ { 0x0a, 0x02214020 }, /* Front panel HP socket */
++ { 0x0b, 0x02a19080 }, /* Front Mic */
++ { 0x0c, 0x0181304e }, /* Line in */
++ { 0x0d, 0x01014010 }, /* Line out */
++ { 0x0e, 0x01a19040 }, /* Rear Mic */
++ { 0x0f, 0x01011012 }, /* Rear speakers */
++ { 0x10, 0x01016011 }, /* Center speaker */
++ { 0x11, 0x01012014 }, /* Side speakers (7.1) */
++ { 0x12, 0x103301f0 }, /* Motherboard CD line in connector */
++ { 0x13, 0x411111f0 }, /* Unused */
++ { 0x14, 0x411111f0 }, /* Unused */
++ { 0x21, 0x01442170 }, /* S/PDIF line out */
++ { 0x22, 0x411111f0 }, /* Unused */
++ { 0x23, 0x411111f0 }, /* Unused */
++ {}
++};
+
+ static void stac9200_fixup_panasonic(struct hda_codec *codec,
+ const struct hda_fixup *fix, int action)
+@@ -3883,6 +3905,10 @@ static const struct hda_fixup stac927x_fixups[] = {
+ .type = HDA_FIXUP_PINS,
+ .v.pins = d965_5st_no_fp_pin_configs,
+ },
++ [STAC_NEMO_DEFAULT] = {
++ .type = HDA_FIXUP_PINS,
++ .v.pins = nemo_pin_configs,
++ },
+ [STAC_DELL_3ST] = {
+ .type = HDA_FIXUP_PINS,
+ .v.pins = dell_3st_pin_configs,
+@@ -3939,6 +3965,7 @@ static const struct hda_model_fixup stac927x_models[] = {
+ { .id = STAC_D965_5ST_NO_FP, .name = "5stack-no-fp" },
+ { .id = STAC_DELL_3ST, .name = "dell-3stack" },
+ { .id = STAC_DELL_BIOS, .name = "dell-bios" },
++ { .id = STAC_NEMO_DEFAULT, .name = "nemo-default" },
+ { .id = STAC_DELL_BIOS_AMIC, .name = "dell-bios-amic" },
+ { .id = STAC_927X_VOLKNOB, .name = "volknob" },
+ {}
+@@ -3977,6 +4004,8 @@ static const struct snd_pci_quirk stac927x_fixup_tbl[] = {
+ "Intel D965", STAC_D965_5ST),
+ SND_PCI_QUIRK_MASK(PCI_VENDOR_ID_INTEL, 0xff00, 0x2500,
+ "Intel D965", STAC_D965_5ST),
++ /* Nemo */
++ SND_PCI_QUIRK(0x1888, 0x1000, "AmigaOne X1000", STAC_NEMO_DEFAULT),
+ /* volume-knob fixes */
+ SND_PCI_QUIRK_VENDOR(0x10cf, "FSC", STAC_927X_VOLKNOB),
+ {} /* terminator */
+@@ -5036,6 +5065,7 @@ static const struct hda_device_id snd_hda_id_sigmatel[] = {
+ HDA_CODEC_ENTRY(0x83847683, "STAC9221D A2", patch_stac922x),
+ HDA_CODEC_ENTRY(0x83847618, "STAC9227", patch_stac927x),
+ HDA_CODEC_ENTRY(0x83847619, "STAC9227", patch_stac927x),
++ HDA_CODEC_ENTRY(0x83847638, "STAC92HD700", patch_stac927x),
+ HDA_CODEC_ENTRY(0x83847616, "STAC9228", patch_stac927x),
+ HDA_CODEC_ENTRY(0x83847617, "STAC9228", patch_stac927x),
+ HDA_CODEC_ENTRY(0x83847614, "STAC9229", patch_stac927x),
+--
+2.18.0
+
diff --git a/patches.drivers/ALSA-hda-realtek-Add-a-quirk-for-FSC-ESPRIMO-U9210 b/patches.drivers/ALSA-hda-realtek-Add-a-quirk-for-FSC-ESPRIMO-U9210
new file mode 100644
index 0000000000..2517a15124
--- /dev/null
+++ b/patches.drivers/ALSA-hda-realtek-Add-a-quirk-for-FSC-ESPRIMO-U9210
@@ -0,0 +1,34 @@
+From 275ec0cb946cb75ac8977f662e608fce92f8b8a8 Mon Sep 17 00:00:00 2001
+From: Takashi Iwai <tiwai@suse.de>
+Date: Fri, 22 Jun 2018 12:17:45 +0200
+Subject: [PATCH] ALSA: hda/realtek - Add a quirk for FSC ESPRIMO U9210
+Git-commit: 275ec0cb946cb75ac8977f662e608fce92f8b8a8
+Patch-mainline: v4.18-rc3
+References: bsc#1099810
+
+Fujitsu Seimens ESPRIMO Mobile U9210 requires the same fixup as H270
+for the correct pin configs.
+
+Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=200107
+Cc: <stable@vger.kernel.org>
+Signed-off-by: Takashi Iwai <tiwai@suse.de>
+
+---
+ sound/pci/hda/patch_realtek.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
+index 487ceb9fd038..70bf4c30548a 100644
+--- a/sound/pci/hda/patch_realtek.c
++++ b/sound/pci/hda/patch_realtek.c
+@@ -2545,6 +2545,7 @@ static const struct snd_pci_quirk alc262_fixup_tbl[] = {
+ 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),
+--
+2.18.0
+
diff --git a/patches.drivers/ALSA-hda-realtek-Add-headset-mode-support-for-Dell-2 b/patches.drivers/ALSA-hda-realtek-Add-headset-mode-support-for-Dell-2
new file mode 100644
index 0000000000..1762ba173a
--- /dev/null
+++ b/patches.drivers/ALSA-hda-realtek-Add-headset-mode-support-for-Dell-2
@@ -0,0 +1,72 @@
+From ae104a21e52b1f9aab342cf6924405177b720069 Mon Sep 17 00:00:00 2001
+From: Kailang Yang <kailang@realtek.com>
+Date: Mon, 5 Feb 2018 16:07:20 +0800
+Subject: [PATCH] ALSA: hda/realtek - Add headset mode support for Dell laptop
+Git-commit: ae104a21e52b1f9aab342cf6924405177b720069
+Patch-mainline: v4.16-rc5
+References: bsc#1099810
+
+This platform was only one phone Jack.
+Add dummy lineout verb to fix automute mode disable.
+This just the workaround.
+
+[ More background information:
+ since the platform has only a headphone jack without speaker, the
+ driver doesn't create the auto-mute control. Meanwhile we do update
+ the headset mode via the automute hook in the driver, thus with this
+ setup, the headset won't be updated any longer.
+
+ By adding a dummy line-out pin here, the auto-mute is added by the
+ driver, and the headset update is triggered properly.
+
+ Note that this is different from the other
+ ALC274_FIXUP_DELL_AIO_LINEOUT_VERB, which has the real line-out pin,
+ while this quirk adds a dummy line-out pin. -- tiwai ]
+
+Signed-off-by: Kailang Yang <kailang@realtek.com>
+Cc: <stable@vger.kernel.org>
+Signed-off-by: Takashi Iwai <tiwai@suse.de>
+
+---
+ sound/pci/hda/patch_realtek.c | 11 +++++++++++
+ 1 file changed, 11 insertions(+)
+
+diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
+index 6a3f9bca6c3e..d1e575b20cd4 100644
+--- a/sound/pci/hda/patch_realtek.c
++++ b/sound/pci/hda/patch_realtek.c
+@@ -5485,6 +5485,7 @@ enum {
+ ALC274_FIXUP_DELL_BIND_DACS,
+ ALC274_FIXUP_DELL_AIO_LINEOUT_VERB,
+ ALC298_FIXUP_TPT470_DOCK,
++ ALC255_FIXUP_DUMMY_LINEOUT_VERB,
+ };
+
+ static const struct hda_fixup alc269_fixups[] = {
+@@ -6332,6 +6333,15 @@ static const struct hda_fixup alc269_fixups[] = {
+ .chained = true,
+ .chain_id = ALC293_FIXUP_LENOVO_SPK_NOISE
+ },
++ [ALC255_FIXUP_DUMMY_LINEOUT_VERB] = {
++ .type = HDA_FIXUP_PINS,
++ .v.pins = (const struct hda_pintbl[]) {
++ { 0x14, 0x0201101f },
++ { }
++ },
++ .chained = true,
++ .chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE
++ },
+ };
+
+ static const struct snd_pci_quirk alc269_fixup_tbl[] = {
+@@ -6385,6 +6395,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {
+ SND_PCI_QUIRK(0x1028, 0x082a, "Dell XPS 13 9360", ALC256_FIXUP_DELL_XPS_13_HEADPHONE_NOISE),
+ SND_PCI_QUIRK(0x1028, 0x084b, "Dell", ALC274_FIXUP_DELL_AIO_LINEOUT_VERB),
+ SND_PCI_QUIRK(0x1028, 0x084e, "Dell", ALC274_FIXUP_DELL_AIO_LINEOUT_VERB),
++ SND_PCI_QUIRK(0x1028, 0x0873, "Dell Precision 3930", ALC255_FIXUP_DUMMY_LINEOUT_VERB),
+ SND_PCI_QUIRK(0x1028, 0x164a, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
+ SND_PCI_QUIRK(0x1028, 0x164b, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
+ SND_PCI_QUIRK(0x103c, 0x1586, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC2),
+--
+2.18.0
+
diff --git a/patches.drivers/ALSA-hda-realtek-Add-support-headset-mode-for-DELL-W b/patches.drivers/ALSA-hda-realtek-Add-support-headset-mode-for-DELL-W
new file mode 100644
index 0000000000..10ee67aaba
--- /dev/null
+++ b/patches.drivers/ALSA-hda-realtek-Add-support-headset-mode-for-DELL-W
@@ -0,0 +1,55 @@
+From 5f36413526677b11d3226ebf064f471894ea2e5d Mon Sep 17 00:00:00 2001
+From: Kailang Yang <kailang@realtek.com>
+Date: Tue, 25 Jul 2017 16:28:16 +0800
+Subject: [PATCH] ALSA: hda/realtek - Add support headset mode for DELL WYSE
+Git-commit: 5f36413526677b11d3226ebf064f471894ea2e5d
+Patch-mainline: v4.16-rc5
+References: bsc#1099810
+
+Enable headset mode support for WYSE platform.
+
+Signed-off-by: Kailang Yang <kailang@realtek.com>
+Cc: <stable@vger.kernel.org>
+Signed-off-by: Takashi Iwai <tiwai@suse.de>
+
+---
+ sound/pci/hda/patch_realtek.c | 14 ++++++++++++++
+ 1 file changed, 14 insertions(+)
+
+--- a/sound/pci/hda/patch_realtek.c
++++ b/sound/pci/hda/patch_realtek.c
+@@ -5374,6 +5374,7 @@ enum {
+ ALC233_FIXUP_ASUS_MIC_NO_PRESENCE,
+ ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE,
+ ALC294_FIXUP_LENOVO_MIC_LOCATION,
++ ALC225_FIXUP_DELL_WYSE_MIC_NO_PRESENCE,
+ ALC700_FIXUP_INTEL_REFERENCE,
+ ALC274_FIXUP_DELL_BIND_DACS,
+ ALC274_FIXUP_DELL_AIO_LINEOUT_VERB,
+@@ -6176,6 +6177,18 @@ static const struct hda_fixup alc269_fix
+ { }
+ },
+ },
++ [ALC225_FIXUP_DELL_WYSE_MIC_NO_PRESENCE] = {
++ .type = HDA_FIXUP_PINS,
++ .v.pins = (const struct hda_pintbl[]) {
++ { 0x16, 0x0101102f }, /* Rear Headset HP */
++ { 0x19, 0x02a1913c }, /* use as Front headset mic, without its own jack detect */
++ { 0x1a, 0x01a19030 }, /* Rear Headset MIC */
++ { 0x1b, 0x02011020 },
++ { }
++ },
++ .chained = true,
++ .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
++ },
+ [ALC700_FIXUP_INTEL_REFERENCE] = {
+ .type = HDA_FIXUP_VERBS,
+ .v.verbs = (const struct hda_verb[]) {
+@@ -6256,6 +6269,7 @@ static const struct snd_pci_quirk alc269
+ SND_PCI_QUIRK(0x1028, 0x075d, "Dell AIO", ALC298_FIXUP_SPK_VOLUME),
+ SND_PCI_QUIRK(0x1028, 0x07b0, "Dell Precision 7520", ALC295_FIXUP_DISABLE_DAC3),
+ SND_PCI_QUIRK(0x1028, 0x0798, "Dell Inspiron 17 7000 Gaming", ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER),
++ SND_PCI_QUIRK(0x1028, 0x080c, "Dell WYSE", ALC225_FIXUP_DELL_WYSE_MIC_NO_PRESENCE),
+ SND_PCI_QUIRK(0x1028, 0x082a, "Dell XPS 13 9360", ALC256_FIXUP_DELL_XPS_13_HEADPHONE_NOISE),
+ SND_PCI_QUIRK(0x1028, 0x084b, "Dell", ALC274_FIXUP_DELL_AIO_LINEOUT_VERB),
+ SND_PCI_QUIRK(0x1028, 0x084e, "Dell", ALC274_FIXUP_DELL_AIO_LINEOUT_VERB),
diff --git a/patches.drivers/ALSA-hda-realtek-Clevo-P950ER-ALC1220-Fixup b/patches.drivers/ALSA-hda-realtek-Clevo-P950ER-ALC1220-Fixup
new file mode 100644
index 0000000000..cc0a02c245
--- /dev/null
+++ b/patches.drivers/ALSA-hda-realtek-Clevo-P950ER-ALC1220-Fixup
@@ -0,0 +1,29 @@
+From 2f0d520a1a73555ac51c19cd494493f60b4c1cea Mon Sep 17 00:00:00 2001
+From: Jeremy Soller <jeremy@system76.com>
+Date: Mon, 7 May 2018 09:28:45 -0600
+Subject: [PATCH] ALSA: hda/realtek - Clevo P950ER ALC1220 Fixup
+Git-commit: 2f0d520a1a73555ac51c19cd494493f60b4c1cea
+Patch-mainline: v4.17-rc6
+References: bsc#1099810
+
+This adds support for the P950ER, which has the same required fixup as
+the P950HR, but has a different PCI ID.
+
+Signed-off-by: Jeremy Soller <jeremy@system76.com>
+Cc: <stable@vger.kernel.org>
+Signed-off-by: Takashi Iwai <tiwai@suse.de>
+
+---
+ sound/pci/hda/patch_realtek.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+--- a/sound/pci/hda/patch_realtek.c
++++ b/sound/pci/hda/patch_realtek.c
+@@ -2304,6 +2304,7 @@ static const struct snd_pci_quirk alc882
+ SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte EP45-DS3/Z87X-UD3H", ALC889_FIXUP_FRONT_HP_NO_PRESENCE),
+ 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, 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),
+ SND_PCI_QUIRK(0x17aa, 0x3a0d, "Lenovo Y530", ALC882_FIXUP_LENOVO_Y530),
diff --git a/patches.drivers/ALSA-hda-realtek-Enable-Thinkpad-Dock-device-for-ALC b/patches.drivers/ALSA-hda-realtek-Enable-Thinkpad-Dock-device-for-ALC
new file mode 100644
index 0000000000..d3128cfc8b
--- /dev/null
+++ b/patches.drivers/ALSA-hda-realtek-Enable-Thinkpad-Dock-device-for-ALC
@@ -0,0 +1,108 @@
+From 61fcf8ece9b6b09450250c4ca40cc3b81a96a68d Mon Sep 17 00:00:00 2001
+From: Kailang Yang <kailang@realtek.com>
+Date: Fri, 2 Feb 2018 15:26:46 +0800
+Subject: [PATCH] ALSA: hda/realtek - Enable Thinkpad Dock device for ALC298 platform
+Git-commit: 61fcf8ece9b6b09450250c4ca40cc3b81a96a68d
+Patch-mainline: v4.16-rc2
+References: bsc#1099810
+
+Thinkpad Dock device support for ALC298 platform.
+It need to use SSID for the quirk table.
+Because IdeaPad also has ALC298 platform.
+Use verb for the quirk table will confuse.
+
+Signed-off-by: Kailang Yang <kailang@realtek.com>
+Cc: <stable@vger.kernel.org>
+Signed-off-by: Takashi Iwai <tiwai@suse.de>
+
+---
+ sound/pci/hda/patch_realtek.c | 42 +++++++++++++++++++++++++++++++++++
+ 1 file changed, 42 insertions(+)
+
+diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
+index 0c61751caa0a..32938ca8e5e3 100644
+--- a/sound/pci/hda/patch_realtek.c
++++ b/sound/pci/hda/patch_realtek.c
+@@ -4972,6 +4972,28 @@ static void alc_fixup_tpt440_dock(struct hda_codec *codec,
+ }
+ }
+
++static void alc_fixup_tpt470_dock(struct hda_codec *codec,
++ const struct hda_fixup *fix, int action)
++{
++ static const struct hda_pintbl pincfgs[] = {
++ { 0x17, 0x21211010 }, /* dock headphone */
++ { 0x19, 0x21a11010 }, /* dock mic */
++ { }
++ };
++ struct alc_spec *spec = codec->spec;
++
++ if (action == HDA_FIXUP_ACT_PRE_PROBE) {
++ spec->parse_flags = HDA_PINCFG_NO_HP_FIXUP;
++ /* Enable DOCK device */
++ snd_hda_codec_write(codec, 0x17, 0,
++ AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, 0);
++ /* Enable DOCK device */
++ snd_hda_codec_write(codec, 0x19, 0,
++ AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, 0);
++ snd_hda_apply_pincfgs(codec, pincfgs);
++ }
++}
++
+ static void alc_shutup_dell_xps13(struct hda_codec *codec)
+ {
+ struct alc_spec *spec = codec->spec;
+@@ -5446,6 +5468,7 @@ enum {
+ ALC700_FIXUP_INTEL_REFERENCE,
+ ALC274_FIXUP_DELL_BIND_DACS,
+ ALC274_FIXUP_DELL_AIO_LINEOUT_VERB,
++ ALC298_FIXUP_TPT470_DOCK,
+ };
+
+ static const struct hda_fixup alc269_fixups[] = {
+@@ -6271,6 +6294,12 @@ static const struct hda_fixup alc269_fixups[] = {
+ .chained = true,
+ .chain_id = ALC274_FIXUP_DELL_BIND_DACS
+ },
++ [ALC298_FIXUP_TPT470_DOCK] = {
++ .type = HDA_FIXUP_FUNC,
++ .v.func = alc_fixup_tpt470_dock,
++ .chained = true,
++ .chain_id = ALC293_FIXUP_LENOVO_SPK_NOISE
++ },
+ };
+
+ static const struct snd_pci_quirk alc269_fixup_tbl[] = {
+@@ -6452,8 +6481,16 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {
+ SND_PCI_QUIRK(0x17aa, 0x2218, "Thinkpad X1 Carbon 2nd", ALC292_FIXUP_TPT440_DOCK),
+ SND_PCI_QUIRK(0x17aa, 0x2223, "ThinkPad T550", ALC292_FIXUP_TPT440_DOCK),
+ SND_PCI_QUIRK(0x17aa, 0x2226, "ThinkPad X250", ALC292_FIXUP_TPT440_DOCK),
++ SND_PCI_QUIRK(0x17aa, 0x222d, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
++ SND_PCI_QUIRK(0x17aa, 0x222e, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
+ SND_PCI_QUIRK(0x17aa, 0x2231, "Thinkpad T560", ALC292_FIXUP_TPT460),
+ SND_PCI_QUIRK(0x17aa, 0x2233, "Thinkpad", ALC292_FIXUP_TPT460),
++ SND_PCI_QUIRK(0x17aa, 0x2245, "Thinkpad T470", ALC298_FIXUP_TPT470_DOCK),
++ SND_PCI_QUIRK(0x17aa, 0x2246, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
++ SND_PCI_QUIRK(0x17aa, 0x2247, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
++ SND_PCI_QUIRK(0x17aa, 0x224b, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
++ SND_PCI_QUIRK(0x17aa, 0x224c, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
++ SND_PCI_QUIRK(0x17aa, 0x224d, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
+ 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),
+@@ -6474,7 +6511,12 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {
+ SND_PCI_QUIRK(0x17aa, 0x5050, "Thinkpad T560p", ALC292_FIXUP_TPT460),
+ SND_PCI_QUIRK(0x17aa, 0x5051, "Thinkpad L460", ALC292_FIXUP_TPT460),
+ SND_PCI_QUIRK(0x17aa, 0x5053, "Thinkpad T460", ALC292_FIXUP_TPT460),
++ SND_PCI_QUIRK(0x17aa, 0x505d, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
++ SND_PCI_QUIRK(0x17aa, 0x505f, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
++ SND_PCI_QUIRK(0x17aa, 0x5062, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
+ SND_PCI_QUIRK(0x17aa, 0x5109, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
++ SND_PCI_QUIRK(0x17aa, 0x511e, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
++ SND_PCI_QUIRK(0x17aa, 0x511f, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
+ SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_FIXUP_PCM_44K),
+ SND_PCI_QUIRK(0x17aa, 0x9e54, "LENOVO NB", ALC269_FIXUP_LENOVO_EAPD),
+ SND_PCI_QUIRK(0x1b7d, 0xa831, "Ordissimo EVE2 ", ALC269VB_FIXUP_ORDISSIMO_EVE2), /* Also known as Malata PC-B1303 */
+--
+2.18.0
+
diff --git a/patches.drivers/ALSA-hda-realtek-Enable-mic-mute-hotkey-for-several- b/patches.drivers/ALSA-hda-realtek-Enable-mic-mute-hotkey-for-several-
new file mode 100644
index 0000000000..9f49122d97
--- /dev/null
+++ b/patches.drivers/ALSA-hda-realtek-Enable-mic-mute-hotkey-for-several-
@@ -0,0 +1,44 @@
+From 986376b68dcc95bb7df60ad30c2353c1f7578fa5 Mon Sep 17 00:00:00 2001
+From: Hui Wang <hui.wang@canonical.com>
+Date: Wed, 30 May 2018 12:33:07 +0800
+Subject: [PATCH] ALSA: hda/realtek - Enable mic-mute hotkey for several Lenovo AIOs
+Git-commit: 986376b68dcc95bb7df60ad30c2353c1f7578fa5
+Patch-mainline: v4.18-rc1
+References: bsc#1099810
+
+We have several Lenovo AIOs like M810z, M820z and M920z, they have
+the same design for mic-mute hotkey and led and they use the same
+codec with the same pin configuration, so use the pin conf table to
+apply fix to all of them.
+
+Fixes: 29693efcea0f ("ALSA: hda - Fix micmute hotkey problem for a lenovo AIO machine")
+Cc: <stable@vger.kernel.org>
+Signed-off-by: Hui Wang <hui.wang@canonical.com>
+Signed-off-by: Takashi Iwai <tiwai@suse.de>
+
+---
+ sound/pci/hda/patch_realtek.c | 6 +++++-
+ 1 file changed, 5 insertions(+), 1 deletion(-)
+
+--- a/sound/pci/hda/patch_realtek.c
++++ b/sound/pci/hda/patch_realtek.c
+@@ -6276,7 +6276,6 @@ static const struct snd_pci_quirk alc269
+ 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, 0x313c, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
+- SND_PCI_QUIRK(0x17aa, 0x3112, "ThinkCentre AIO", ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY),
+ SND_PCI_QUIRK(0x17aa, 0x3902, "Lenovo E50-80", ALC269_FIXUP_DMIC_THINKPAD_ACPI),
+ SND_PCI_QUIRK(0x17aa, 0x3977, "IdeaPad S210", ALC283_FIXUP_INT_MIC),
+ SND_PCI_QUIRK(0x17aa, 0x3978, "IdeaPad Y410P", ALC269_FIXUP_NO_SHUTUP),
+@@ -6441,6 +6440,11 @@ static const struct snd_hda_pin_quirk al
+ {0x1b, 0x01111010},
+ {0x1e, 0x01451130},
+ {0x21, 0x02211020}),
++ SND_HDA_PIN_QUIRK(0x10ec0235, 0x17aa, "Lenovo", ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY,
++ {0x12, 0x90a60140},
++ {0x14, 0x90170110},
++ {0x19, 0x02a11030},
++ {0x21, 0x02211020}),
+ SND_HDA_PIN_QUIRK(0x10ec0236, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
+ {0x12, 0x90a60140},
+ {0x14, 0x90170110},
diff --git a/patches.drivers/ALSA-hda-realtek-Fix-Dell-headset-Mic-can-t-record b/patches.drivers/ALSA-hda-realtek-Fix-Dell-headset-Mic-can-t-record
new file mode 100644
index 0000000000..0dd91dddfd
--- /dev/null
+++ b/patches.drivers/ALSA-hda-realtek-Fix-Dell-headset-Mic-can-t-record
@@ -0,0 +1,57 @@
+From f0ba9d699e5ca2bcd07f70185d18720c4f1b597c Mon Sep 17 00:00:00 2001
+From: Kailang Yang <kailang@realtek.com>
+Date: Fri, 16 Mar 2018 11:46:08 +0800
+Subject: [PATCH] ALSA: hda/realtek - Fix Dell headset Mic can't record
+Git-commit: f0ba9d699e5ca2bcd07f70185d18720c4f1b597c
+Patch-mainline: v4.16-rc7
+References: bsc#1099810
+
+This platform was hardware fixed type for CTIA type for headset port.
+Assigned 0x19 verb will fix can't record issue.
+
+Signed-off-by: Kailang Yang <kailang@realtek.com>
+Cc: <stable@vger.kernel.org>
+Signed-off-by: Takashi Iwai <tiwai@suse.de>
+
+---
+ sound/pci/hda/patch_realtek.c | 10 ++++++++++
+ 1 file changed, 10 insertions(+)
+
+diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
+index 5ef056f2aecc..619d1f92b6eb 100644
+--- a/sound/pci/hda/patch_realtek.c
++++ b/sound/pci/hda/patch_realtek.c
+@@ -5501,6 +5501,7 @@ enum {
+ ALC274_FIXUP_DELL_AIO_LINEOUT_VERB,
+ ALC298_FIXUP_TPT470_DOCK,
+ ALC255_FIXUP_DUMMY_LINEOUT_VERB,
++ ALC255_FIXUP_DELL_HEADSET_MIC,
+ };
+
+ static const struct hda_fixup alc269_fixups[] = {
+@@ -6361,6 +6362,13 @@ static const struct hda_fixup alc269_fixups[] = {
+ .chained = true,
+ .chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE
+ },
++ [ALC255_FIXUP_DELL_HEADSET_MIC] = {
++ .type = HDA_FIXUP_PINS,
++ .v.pins = (const struct hda_pintbl[]) {
++ { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
++ { }
++ },
++ },
+ };
+
+ static const struct snd_pci_quirk alc269_fixup_tbl[] = {
+@@ -6415,6 +6423,8 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {
+ SND_PCI_QUIRK(0x1028, 0x082a, "Dell XPS 13 9360", ALC256_FIXUP_DELL_XPS_13_HEADPHONE_NOISE),
+ SND_PCI_QUIRK(0x1028, 0x084b, "Dell", ALC274_FIXUP_DELL_AIO_LINEOUT_VERB),
+ SND_PCI_QUIRK(0x1028, 0x084e, "Dell", ALC274_FIXUP_DELL_AIO_LINEOUT_VERB),
++ SND_PCI_QUIRK(0x1028, 0x0871, "Dell Precision 3630", ALC255_FIXUP_DELL_HEADSET_MIC),
++ SND_PCI_QUIRK(0x1028, 0x0872, "Dell Precision 3630", ALC255_FIXUP_DELL_HEADSET_MIC),
+ SND_PCI_QUIRK(0x1028, 0x0873, "Dell Precision 3930", ALC255_FIXUP_DUMMY_LINEOUT_VERB),
+ SND_PCI_QUIRK(0x1028, 0x164a, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
+ SND_PCI_QUIRK(0x1028, 0x164b, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
+--
+2.18.0
+
diff --git a/patches.drivers/ALSA-hda-realtek-Fix-mic-and-headset-jack-sense-on-A b/patches.drivers/ALSA-hda-realtek-Fix-mic-and-headset-jack-sense-on-A
new file mode 100644
index 0000000000..ef78c533ee
--- /dev/null
+++ b/patches.drivers/ALSA-hda-realtek-Fix-mic-and-headset-jack-sense-on-A
@@ -0,0 +1,34 @@
+From 28e8af8a163ed6afe9498f1d499a5061c2214755 Mon Sep 17 00:00:00 2001
+From: Chris Chiu <chiu@endlessm.com>
+Date: Mon, 5 Jun 2017 15:05:30 -0600
+Subject: [PATCH] ALSA: hda/realtek: Fix mic and headset jack sense on Asus X705UD
+Git-commit: 28e8af8a163ed6afe9498f1d499a5061c2214755
+Patch-mainline: v4.12-rc5
+References: bsc#1099810
+
+The ASUS X705UD laptop requires the known fixup ALC256_FIXUP_ASUS_MIC
+in order to fix headphone jack sensing and to enable use of the internal
+microphone.
+
+Unfortunately jack sensing for the headset mic is still not working.
+
+[rearranged the position to keep the PCI SSID order -- tiwai]
+
+Signed-off-by: Chris Chiu <chiu@endlessm.com>
+Signed-off-by: Daniel Drake <drake@endlessm.com>
+Signed-off-by: Takashi Iwai <tiwai@suse.de>
+
+---
+ sound/pci/hda/patch_realtek.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+--- a/sound/pci/hda/patch_realtek.c
++++ b/sound/pci/hda/patch_realtek.c
+@@ -6434,6 +6434,7 @@ static const struct snd_pci_quirk alc269
+ SND_PCI_QUIRK(0x1043, 0x1517, "Asus Zenbook UX31A", ALC269VB_FIXUP_ASUS_ZENBOOK_UX31A),
+ SND_PCI_QUIRK(0x1043, 0x16e3, "ASUS UX50", ALC269_FIXUP_STEREO_DMIC),
+ SND_PCI_QUIRK(0x1043, 0x1a13, "Asus G73Jw", ALC269_FIXUP_ASUS_G73JW),
++ SND_PCI_QUIRK(0x1043, 0x1a30, "ASUS X705UD", ALC256_FIXUP_ASUS_MIC),
+ SND_PCI_QUIRK(0x1043, 0x1b13, "Asus U41SV", ALC269_FIXUP_INV_DMIC),
+ SND_PCI_QUIRK(0x1043, 0x1bbd, "ASUS Z550MA", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE),
+ SND_PCI_QUIRK(0x1043, 0x1c23, "Asus X55U", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
diff --git a/patches.drivers/ALSA-hda-realtek-Fix-pop-noise-on-Lenovo-P50-co b/patches.drivers/ALSA-hda-realtek-Fix-pop-noise-on-Lenovo-P50-co
new file mode 100644
index 0000000000..a8309fadfe
--- /dev/null
+++ b/patches.drivers/ALSA-hda-realtek-Fix-pop-noise-on-Lenovo-P50-co
@@ -0,0 +1,63 @@
+From d5a6cabf02210b896a60eee7c04c670ee9ba6dca Mon Sep 17 00:00:00 2001
+From: Takashi Iwai <tiwai@suse.de>
+Date: Wed, 13 Jun 2018 12:43:10 +0200
+Subject: [PATCH] ALSA: hda/realtek - Fix pop noise on Lenovo P50 & co
+Git-commit: d5a6cabf02210b896a60eee7c04c670ee9ba6dca
+Patch-mainline: v4.18-rc3
+References: bsc#1099810
+
+Some Lenovo laptops, e.g. Lenovo P50, showed the pop noise at resume
+or runtime resume. It turned out to be reduced by applying
+alc_no_shutup() just like TPT440 quirk does.
+
+Since there are many Lenovo models showing the same behavior, put this
+workaround in ALC269_FIXUP_THINKPAD_ACPI entry so that it's applied
+commonly to all such Lenovo machines.
+
+Reported-by: Hans de Goede <hdegoede@redhat.com>
+Tested-by: Benjamin Berg <bberg@redhat.com>
+Cc: <stable@vger.kernel.org>
+Signed-off-by: Takashi Iwai <tiwai@suse.de>
+
+---
+ sound/pci/hda/patch_realtek.c | 10 ++++++++--
+ 1 file changed, 8 insertions(+), 2 deletions(-)
+
+diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
+index e9bd33ea538f..487ceb9fd038 100644
+--- a/sound/pci/hda/patch_realtek.c
++++ b/sound/pci/hda/patch_realtek.c
+@@ -4995,7 +4995,6 @@ static void alc_fixup_tpt440_dock(struct hda_codec *codec,
+ 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 */
+@@ -5394,6 +5393,13 @@ static void alc274_fixup_bind_dacs(struct hda_codec *codec,
+ /* 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"
+
+@@ -5946,7 +5952,7 @@ static const struct hda_fixup alc269_fixups[] = {
+ },
+ [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,
+ },
+--
+2.18.0
+
diff --git a/patches.drivers/ALSA-hda-realtek-Fix-the-problem-of-two-front-mics-o b/patches.drivers/ALSA-hda-realtek-Fix-the-problem-of-two-front-mics-o
new file mode 100644
index 0000000000..914a9b7a14
--- /dev/null
+++ b/patches.drivers/ALSA-hda-realtek-Fix-the-problem-of-two-front-mics-o
@@ -0,0 +1,56 @@
+From e41fc8c5bd41b96bfae5ce4c66bee6edabc932e8 Mon Sep 17 00:00:00 2001
+From: Hui Wang <hui.wang@canonical.com>
+Date: Mon, 25 Jun 2018 14:40:56 +0800
+Subject: [PATCH] ALSA: hda/realtek - Fix the problem of two front mics on more machines
+Git-commit: e41fc8c5bd41b96bfae5ce4c66bee6edabc932e8
+Patch-mainline: v4.18-rc3
+References: bsc#1099810
+
+We have 3 more Lenovo machines, they all have 2 front mics on them,
+so they need the fixup to change the location for one of two mics.
+
+Among these 3 Lenovo machines, one of them has the same pin cfg as the
+machine with subid 0x17aa3138, so use the pin cfg table to apply fixup
+for them. The rest machines don't share the same pin cfg, so far use
+the subid to apply fixup for them.
+
+Fixes: a3dafb2200bf ("ALSA: hda/realtek - adjust the location of one mic")
+Cc: <stable@vger.kernel.org>
+Signed-off-by: Hui Wang <hui.wang@canonical.com>
+Signed-off-by: Takashi Iwai <tiwai@suse.de>
+
+---
+ sound/pci/hda/patch_realtek.c | 9 ++++++++-
+ 1 file changed, 8 insertions(+), 1 deletion(-)
+
+diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
+index 70bf4c30548a..5ad6c7e5f92e 100644
+--- a/sound/pci/hda/patch_realtek.c
++++ b/sound/pci/hda/patch_realtek.c
+@@ -6610,8 +6610,9 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {
+ 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, 0x3136, "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),
+@@ -6789,6 +6790,12 @@ static const struct snd_hda_pin_quirk alc269_pin_fixup_tbl[] = {
+ {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(0x10ec0236, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
+ {0x12, 0x90a60140},
+ {0x14, 0x90170110},
+--
+2.18.0
+
diff --git a/patches.drivers/ALSA-hda-realtek-Fixup-for-HP-x360-laptops-with-B-O- b/patches.drivers/ALSA-hda-realtek-Fixup-for-HP-x360-laptops-with-B-O-
new file mode 100644
index 0000000000..761c2e08ed
--- /dev/null
+++ b/patches.drivers/ALSA-hda-realtek-Fixup-for-HP-x360-laptops-with-B-O-
@@ -0,0 +1,170 @@
+From bbf8ff6b1d2ae749d962fd9ff743164fe13abf5d Mon Sep 17 00:00:00 2001
+From: Tom Briden <tom@decompile.me.uk>
+Date: Tue, 29 May 2018 17:34:20 +0100
+Subject: [PATCH] ALSA: hda/realtek - Fixup for HP x360 laptops with B&O speakers
+Git-commit: bbf8ff6b1d2ae749d962fd9ff743164fe13abf5d
+Patch-mainline: v4.18-rc1
+References: bsc#1099810
+
+Added a new helper file for these fixups due to requiring a huge number
+of coefs being set to get the top speakers to work, as well as
+setting pin 0x17 for the top speakers and the correct input source
+of 0x17 for volume control
+
+[ Note: this is a revised work based on Tom's fixup patch with the
+ replacement of the full COEF tables provided by Realtek.
+ Also, the fixup function has a proper HDA_FIXUP_ACT_* handling now.
+ The credit for the new COEF table goes to Kailang -- tiwai ]
+
+Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=189331
+Cc: Kailang Yang <kailang@realtek.com>
+Signed-off-by: Tom Briden <tom@decompile.me.uk>
+Tested-by: Tom Briden <tom@decompile.me.uk>
+Signed-off-by: Takashi Iwai <tiwai@suse.de>
+
+---
+ sound/pci/hda/hp_x360_helper.c | 95 +++++++++++++++++++++++++++++++++++++++++
+ sound/pci/hda/patch_realtek.c | 12 ++++-
+ 2 files changed, 106 insertions(+), 1 deletion(-)
+ create mode 100644 sound/pci/hda/hp_x360_helper.c
+
+--- /dev/null
++++ b/sound/pci/hda/hp_x360_helper.c
+@@ -0,0 +1,95 @@
++// SPDX-License-Identifier: GPL-2.0
++/* Fixes for HP X360 laptops with top B&O speakers
++ * to be included from codec driver
++ */
++
++static void alc295_fixup_hp_top_speakers(struct hda_codec *codec,
++ const struct hda_fixup *fix, int action)
++{
++ static const struct hda_pintbl pincfgs[] = {
++ { 0x17, 0x90170110 },
++ { }
++ };
++ static const struct coef_fw alc295_hp_speakers_coefs[] = {
++ WRITE_COEF(0x24, 0x0012), WRITE_COEF(0x26, 0x0000), WRITE_COEF(0x28, 0x0000), WRITE_COEF(0x29, 0xb024),
++ WRITE_COEF(0x24, 0x0012), WRITE_COEF(0x26, 0x003f), WRITE_COEF(0x28, 0x1000), WRITE_COEF(0x29, 0xb024),
++ WRITE_COEF(0x24, 0x0012), WRITE_COEF(0x26, 0x0004), WRITE_COEF(0x28, 0x0600), WRITE_COEF(0x29, 0xb024),
++ WRITE_COEF(0x24, 0x0012), WRITE_COEF(0x26, 0x006a), WRITE_COEF(0x28, 0x0006), WRITE_COEF(0x29, 0xb024),
++ WRITE_COEF(0x24, 0x0012), WRITE_COEF(0x26, 0x006c), WRITE_COEF(0x28, 0xc0c0), WRITE_COEF(0x29, 0xb024),
++ WRITE_COEF(0x24, 0x0012), WRITE_COEF(0x26, 0x0008), WRITE_COEF(0x28, 0xb000), WRITE_COEF(0x29, 0xb024),
++ WRITE_COEF(0x24, 0x0012), WRITE_COEF(0x26, 0x002e), WRITE_COEF(0x28, 0x0800), WRITE_COEF(0x29, 0xb024),
++ WRITE_COEF(0x24, 0x0012), WRITE_COEF(0x26, 0x006a), WRITE_COEF(0x28, 0x00c1), WRITE_COEF(0x29, 0xb024),
++ WRITE_COEF(0x24, 0x0012), WRITE_COEF(0x26, 0x006c), WRITE_COEF(0x28, 0x0320), WRITE_COEF(0x29, 0xb024),
++ WRITE_COEF(0x24, 0x0012), WRITE_COEF(0x26, 0x0039), WRITE_COEF(0x28, 0x0000), WRITE_COEF(0x29, 0xb024),
++ WRITE_COEF(0x24, 0x0012), WRITE_COEF(0x26, 0x003b), WRITE_COEF(0x28, 0xffff), WRITE_COEF(0x29, 0xb024),
++ WRITE_COEF(0x24, 0x0012), WRITE_COEF(0x26, 0x003c), WRITE_COEF(0x28, 0xffd0), WRITE_COEF(0x29, 0xb024),
++ WRITE_COEF(0x24, 0x0012), WRITE_COEF(0x26, 0x003a), WRITE_COEF(0x28, 0x1dfe), WRITE_COEF(0x29, 0xb024),
++ WRITE_COEF(0x24, 0x0012), WRITE_COEF(0x26, 0x0080), WRITE_COEF(0x28, 0x0880), WRITE_COEF(0x29, 0xb024),
++ WRITE_COEF(0x24, 0x0012), WRITE_COEF(0x26, 0x003a), WRITE_COEF(0x28, 0x0dfe), WRITE_COEF(0x29, 0xb024),
++ WRITE_COEF(0x24, 0x0012), WRITE_COEF(0x26, 0x0018), WRITE_COEF(0x28, 0x0219), WRITE_COEF(0x29, 0xb024),
++ WRITE_COEF(0x24, 0x0012), WRITE_COEF(0x26, 0x006a), WRITE_COEF(0x28, 0x005d), WRITE_COEF(0x29, 0xb024),
++ WRITE_COEF(0x24, 0x0012), WRITE_COEF(0x26, 0x006c), WRITE_COEF(0x28, 0x9142), WRITE_COEF(0x29, 0xb024),
++ WRITE_COEF(0x24, 0x0012), WRITE_COEF(0x26, 0x00c0), WRITE_COEF(0x28, 0x01ce), WRITE_COEF(0x29, 0xb024),
++ WRITE_COEF(0x24, 0x0012), WRITE_COEF(0x26, 0x00c1), WRITE_COEF(0x28, 0xed0c), WRITE_COEF(0x29, 0xb024),
++ WRITE_COEF(0x24, 0x0012), WRITE_COEF(0x26, 0x00c2), WRITE_COEF(0x28, 0x1c00), WRITE_COEF(0x29, 0xb024),
++ WRITE_COEF(0x24, 0x0012), WRITE_COEF(0x26, 0x00c3), WRITE_COEF(0x28, 0x0000), WRITE_COEF(0x29, 0xb024),
++ WRITE_COEF(0x24, 0x0012), WRITE_COEF(0x26, 0x00c4), WRITE_COEF(0x28, 0x0200), WRITE_COEF(0x29, 0xb024),
++ WRITE_COEF(0x24, 0x0012), WRITE_COEF(0x26, 0x00c5), WRITE_COEF(0x28, 0x0000), WRITE_COEF(0x29, 0xb024),
++ WRITE_COEF(0x24, 0x0012), WRITE_COEF(0x26, 0x00c6), WRITE_COEF(0x28, 0x0399), WRITE_COEF(0x29, 0xb024),
++ WRITE_COEF(0x24, 0x0012), WRITE_COEF(0x26, 0x00c7), WRITE_COEF(0x28, 0x2330), WRITE_COEF(0x29, 0xb024),
++ WRITE_COEF(0x24, 0x0012), WRITE_COEF(0x26, 0x00c8), WRITE_COEF(0x28, 0x1e5d), WRITE_COEF(0x29, 0xb024),
++ WRITE_COEF(0x24, 0x0012), WRITE_COEF(0x26, 0x00c9), WRITE_COEF(0x28, 0x6eff), WRITE_COEF(0x29, 0xb024),
++ WRITE_COEF(0x24, 0x0012), WRITE_COEF(0x26, 0x00ca), WRITE_COEF(0x28, 0x01c0), WRITE_COEF(0x29, 0xb024),
++ WRITE_COEF(0x24, 0x0012), WRITE_COEF(0x26, 0x00cb), WRITE_COEF(0x28, 0xed0c), WRITE_COEF(0x29, 0xb024),
++ WRITE_COEF(0x24, 0x0012), WRITE_COEF(0x26, 0x00cc), WRITE_COEF(0x28, 0x1c00), WRITE_COEF(0x29, 0xb024),
++ WRITE_COEF(0x24, 0x0012), WRITE_COEF(0x26, 0x00cd), WRITE_COEF(0x28, 0x0000), WRITE_COEF(0x29, 0xb024),
++ WRITE_COEF(0x24, 0x0012), WRITE_COEF(0x26, 0x00ce), WRITE_COEF(0x28, 0x0200), WRITE_COEF(0x29, 0xb024),
++ WRITE_COEF(0x24, 0x0012), WRITE_COEF(0x26, 0x00cf), WRITE_COEF(0x28, 0x0000), WRITE_COEF(0x29, 0xb024),
++ WRITE_COEF(0x24, 0x0012), WRITE_COEF(0x26, 0x00d0), WRITE_COEF(0x28, 0x0399), WRITE_COEF(0x29, 0xb024),
++ WRITE_COEF(0x24, 0x0012), WRITE_COEF(0x26, 0x00d1), WRITE_COEF(0x28, 0x2330), WRITE_COEF(0x29, 0xb024),
++ WRITE_COEF(0x24, 0x0012), WRITE_COEF(0x26, 0x00d2), WRITE_COEF(0x28, 0x1e5d), WRITE_COEF(0x29, 0xb024),
++ WRITE_COEF(0x24, 0x0012), WRITE_COEF(0x26, 0x00d3), WRITE_COEF(0x28, 0x6eff), WRITE_COEF(0x29, 0xb024),
++ WRITE_COEF(0x24, 0x0012), WRITE_COEF(0x26, 0x0062), WRITE_COEF(0x28, 0x8000), WRITE_COEF(0x29, 0xb024),
++ WRITE_COEF(0x24, 0x0012), WRITE_COEF(0x26, 0x0063), WRITE_COEF(0x28, 0x5f5f), WRITE_COEF(0x29, 0xb024),
++ WRITE_COEF(0x24, 0x0012), WRITE_COEF(0x26, 0x0064), WRITE_COEF(0x28, 0x1000), WRITE_COEF(0x29, 0xb024),
++ WRITE_COEF(0x24, 0x0012), WRITE_COEF(0x26, 0x0065), WRITE_COEF(0x28, 0x0000), WRITE_COEF(0x29, 0xb024),
++ WRITE_COEF(0x24, 0x0012), WRITE_COEF(0x26, 0x0066), WRITE_COEF(0x28, 0x4004), WRITE_COEF(0x29, 0xb024),
++ WRITE_COEF(0x24, 0x0012), WRITE_COEF(0x26, 0x0067), WRITE_COEF(0x28, 0x0802), WRITE_COEF(0x29, 0xb024),
++ WRITE_COEF(0x24, 0x0012), WRITE_COEF(0x26, 0x0068), WRITE_COEF(0x28, 0x890f), WRITE_COEF(0x29, 0xb024),
++ WRITE_COEF(0x24, 0x0012), WRITE_COEF(0x26, 0x0069), WRITE_COEF(0x28, 0xe021), WRITE_COEF(0x29, 0xb024),
++ WRITE_COEF(0x24, 0x0012), WRITE_COEF(0x26, 0x0070), WRITE_COEF(0x28, 0x8012), WRITE_COEF(0x29, 0xb024),
++ WRITE_COEF(0x24, 0x0012), WRITE_COEF(0x26, 0x0071), WRITE_COEF(0x28, 0x3450), WRITE_COEF(0x29, 0xb024),
++ WRITE_COEF(0x24, 0x0012), WRITE_COEF(0x26, 0x0072), WRITE_COEF(0x28, 0x0123), WRITE_COEF(0x29, 0xb024),
++ WRITE_COEF(0x24, 0x0012), WRITE_COEF(0x26, 0x0073), WRITE_COEF(0x28, 0x4543), WRITE_COEF(0x29, 0xb024),
++ WRITE_COEF(0x24, 0x0012), WRITE_COEF(0x26, 0x0074), WRITE_COEF(0x28, 0x2100), WRITE_COEF(0x29, 0xb024),
++ WRITE_COEF(0x24, 0x0012), WRITE_COEF(0x26, 0x0075), WRITE_COEF(0x28, 0x4321), WRITE_COEF(0x29, 0xb024),
++ WRITE_COEF(0x24, 0x0012), WRITE_COEF(0x26, 0x0076), WRITE_COEF(0x28, 0x0000), WRITE_COEF(0x29, 0xb024),
++ WRITE_COEF(0x24, 0x0012), WRITE_COEF(0x26, 0x0050), WRITE_COEF(0x28, 0x8200), WRITE_COEF(0x29, 0xb024),
++ WRITE_COEF(0x24, 0x0012), WRITE_COEF(0x26, 0x003a), WRITE_COEF(0x28, 0x1dfe), WRITE_COEF(0x29, 0xb024),
++ WRITE_COEF(0x24, 0x0012), WRITE_COEF(0x26, 0x0051), WRITE_COEF(0x28, 0x0707), WRITE_COEF(0x29, 0xb024),
++ WRITE_COEF(0x24, 0x0012), WRITE_COEF(0x26, 0x0052), WRITE_COEF(0x28, 0x4090), WRITE_COEF(0x29, 0xb024),
++ WRITE_COEF(0x24, 0x0012), WRITE_COEF(0x26, 0x006a), WRITE_COEF(0x28, 0x0090), WRITE_COEF(0x29, 0xb024),
++ WRITE_COEF(0x24, 0x0012), WRITE_COEF(0x26, 0x006c), WRITE_COEF(0x28, 0x721f), WRITE_COEF(0x29, 0xb024),
++ WRITE_COEF(0x24, 0x0012), WRITE_COEF(0x26, 0x0012), WRITE_COEF(0x28, 0xebeb), WRITE_COEF(0x29, 0xb024),
++ WRITE_COEF(0x24, 0x0012), WRITE_COEF(0x26, 0x009e), WRITE_COEF(0x28, 0x0000), WRITE_COEF(0x29, 0xb024),
++ WRITE_COEF(0x24, 0x0012), WRITE_COEF(0x26, 0x0060), WRITE_COEF(0x28, 0x2213), WRITE_COEF(0x29, 0xb024),
++ WRITE_COEF(0x24, 0x0012), WRITE_COEF(0x26, 0x006a), WRITE_COEF(0x28, 0x0006), WRITE_COEF(0x29, 0xb024),
++ WRITE_COEF(0x24, 0x0012), WRITE_COEF(0x26, 0x006c), WRITE_COEF(0x28, 0x0000), WRITE_COEF(0x29, 0xb024),
++ WRITE_COEF(0x24, 0x0012), WRITE_COEF(0x26, 0x003f), WRITE_COEF(0x28, 0x3000), WRITE_COEF(0x29, 0xb024),
++ WRITE_COEF(0x24, 0x0012), WRITE_COEF(0x26, 0x0004), WRITE_COEF(0x28, 0x0500), WRITE_COEF(0x29, 0xb024),
++ WRITE_COEF(0x24, 0x0012), WRITE_COEF(0x26, 0x0040), WRITE_COEF(0x28, 0x800c), WRITE_COEF(0x29, 0xb024),
++ WRITE_COEF(0x24, 0x0012), WRITE_COEF(0x26, 0x0046), WRITE_COEF(0x28, 0xc22e), WRITE_COEF(0x29, 0xb024),
++ WRITE_COEF(0x24, 0x0012), WRITE_COEF(0x26, 0x004b), WRITE_COEF(0x28, 0x0000), WRITE_COEF(0x29, 0xb024),
++ WRITE_COEF(0x24, 0x0012), WRITE_COEF(0x26, 0x0050), WRITE_COEF(0x28, 0x82ec), WRITE_COEF(0x29, 0xb024),
++ };
++
++ switch (action) {
++ case HDA_FIXUP_ACT_PRE_PROBE:
++ snd_hda_apply_pincfgs(codec, pincfgs);
++ alc295_fixup_disable_dac3(codec, fix, action);
++ break;
++ case HDA_FIXUP_ACT_INIT:
++ alc_process_coef_fw(codec, alc295_hp_speakers_coefs);
++ break;
++ }
++}
+--- a/sound/pci/hda/patch_realtek.c
++++ b/sound/pci/hda/patch_realtek.c
+@@ -5300,6 +5300,9 @@ static void alc_fixup_thinkpad_acpi(stru
+ /* for dell wmi mic mute led */
+ #include "dell_wmi_helper.c"
+
++/* for alc295_fixup_hp_top_speakers */
++#include "hp_x360_helper.c"
++
+ enum {
+ ALC269_FIXUP_SONY_VAIO,
+ ALC275_FIXUP_SONY_VAIO_GPIO2,
+@@ -5419,6 +5422,7 @@ enum {
+ ALC298_FIXUP_TPT470_DOCK,
+ ALC255_FIXUP_DUMMY_LINEOUT_VERB,
+ ALC255_FIXUP_DELL_HEADSET_MIC,
++ ALC295_FIXUP_HP_X360,
+ };
+
+ static const struct hda_fixup alc269_fixups[] = {
+@@ -6286,6 +6290,12 @@ static const struct hda_fixup alc269_fix
+ { }
+ },
+ },
++ [ALC295_FIXUP_HP_X360] = {
++ .type = HDA_FIXUP_FUNC,
++ .v.func = alc295_fixup_hp_top_speakers,
++ .chained = true,
++ .chain_id = ALC269_FIXUP_HP_MUTE_LED_MIC3
++ }
+ };
+
+ static const struct snd_pci_quirk alc269_fixup_tbl[] = {
+@@ -6405,7 +6415,7 @@ static const struct snd_pci_quirk alc269
+ SND_PCI_QUIRK(0x103c, 0x2337, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
+ SND_PCI_QUIRK(0x103c, 0x221c, "HP EliteBook 755 G2", ALC280_FIXUP_HP_HEADSET_MIC),
+ SND_PCI_QUIRK(0x103c, 0x8256, "HP", ALC221_FIXUP_HP_FRONT_MIC),
+- SND_PCI_QUIRK(0x103c, 0x827e, "HP x360", ALC269_FIXUP_HP_MUTE_LED_MIC3),
++ SND_PCI_QUIRK(0x103c, 0x827e, "HP x360", ALC295_FIXUP_HP_X360),
+ SND_PCI_QUIRK(0x103c, 0x82bf, "HP", ALC221_FIXUP_HP_MIC_NO_PRESENCE),
+ SND_PCI_QUIRK(0x103c, 0x82c0, "HP", ALC221_FIXUP_HP_MIC_NO_PRESENCE),
+ SND_PCI_QUIRK(0x1043, 0x103e, "ASUS X540SA", ALC256_FIXUP_ASUS_MIC),
diff --git a/patches.drivers/ALSA-hda-realtek-Fixup-mute-led-on-HP-Spectre-x360 b/patches.drivers/ALSA-hda-realtek-Fixup-mute-led-on-HP-Spectre-x360
new file mode 100644
index 0000000000..e947cb3f26
--- /dev/null
+++ b/patches.drivers/ALSA-hda-realtek-Fixup-mute-led-on-HP-Spectre-x360
@@ -0,0 +1,77 @@
+From 7f783bd5e215a014a3c98df64bef24c2dc736def Mon Sep 17 00:00:00 2001
+From: Tom Briden <tom@decompile.me.uk>
+Date: Sat, 25 Mar 2017 10:12:01 +0000
+Subject: [PATCH] ALSA: hda/realtek - Fixup mute led on HP Spectre x360
+Git-commit: 7f783bd5e215a014a3c98df64bef24c2dc736def
+Patch-mainline: v4.18-rc1
+References: bsc#1099810
+
+This patch adds the mute LED control for HP Spectre x360 Kabylake
+model. The mute LED is controlled via VREF bits on NID 0x1b, so we
+need a new fixup function.
+
+Note that this doesn't fix the other issues like the missing speaker
+output on the machine. They will be addressed by later patches.
+
+Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=189331
+Signed-off-by: Tom Briden <tom@decompile.me.uk>
+Signed-off-by: Takashi Iwai <tiwai@suse.de>
+
+---
+ sound/pci/hda/patch_realtek.c | 19 +++++++++++++++++++
+ 1 file changed, 19 insertions(+)
+
+diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
+index 3af93841abe1..6369964c117a 100644
+--- a/sound/pci/hda/patch_realtek.c
++++ b/sound/pci/hda/patch_realtek.c
+@@ -3679,6 +3679,19 @@ static void alc269_fixup_hp_mute_led_mic2(struct hda_codec *codec,
+ }
+ }
+
++static void alc269_fixup_hp_mute_led_mic3(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->mute_led_polarity = 0;
++ spec->mute_led_nid = 0x1b;
++ spec->gen.vmaster_mute.hook = alc269_fixup_mic_mute_hook;
++ spec->gen.vmaster_mute_enum = 1;
++ codec->power_filter = led_power_filter;
++ }
++}
++
+ /* update LED status via GPIO */
+ static void alc_update_gpio_led(struct hda_codec *codec, unsigned int mask,
+ bool enabled)
+@@ -5413,6 +5426,7 @@ enum {
+ ALC269_FIXUP_HP_MUTE_LED,
+ ALC269_FIXUP_HP_MUTE_LED_MIC1,
+ ALC269_FIXUP_HP_MUTE_LED_MIC2,
++ ALC269_FIXUP_HP_MUTE_LED_MIC3,
+ ALC269_FIXUP_HP_GPIO_LED,
+ ALC269_FIXUP_HP_GPIO_MIC1_LED,
+ ALC269_FIXUP_HP_LINE1_MIC1_LED,
+@@ -5672,6 +5686,10 @@ static const struct hda_fixup alc269_fixups[] = {
+ .type = HDA_FIXUP_FUNC,
+ .v.func = alc269_fixup_hp_mute_led_mic2,
+ },
++ [ALC269_FIXUP_HP_MUTE_LED_MIC3] = {
++ .type = HDA_FIXUP_FUNC,
++ .v.func = alc269_fixup_hp_mute_led_mic3,
++ },
+ [ALC269_FIXUP_HP_GPIO_LED] = {
+ .type = HDA_FIXUP_FUNC,
+ .v.func = alc269_fixup_hp_gpio_led,
+@@ -6494,6 +6512,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {
+ SND_PCI_QUIRK(0x103c, 0x2337, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
+ SND_PCI_QUIRK(0x103c, 0x221c, "HP EliteBook 755 G2", ALC280_FIXUP_HP_HEADSET_MIC),
+ SND_PCI_QUIRK(0x103c, 0x8256, "HP", ALC221_FIXUP_HP_FRONT_MIC),
++ SND_PCI_QUIRK(0x103c, 0x827e, "HP x360", ALC269_FIXUP_HP_MUTE_LED_MIC3),
+ SND_PCI_QUIRK(0x103c, 0x82bf, "HP", ALC221_FIXUP_HP_MIC_NO_PRESENCE),
+ SND_PCI_QUIRK(0x103c, 0x82c0, "HP", ALC221_FIXUP_HP_MIC_NO_PRESENCE),
+ SND_PCI_QUIRK(0x1043, 0x103e, "ASUS X540SA", ALC256_FIXUP_ASUS_MIC),
+--
+2.18.0
+
diff --git a/patches.drivers/ALSA-hda-realtek-Limit-mic-boost-on-T480 b/patches.drivers/ALSA-hda-realtek-Limit-mic-boost-on-T480
new file mode 100644
index 0000000000..b83f2b965f
--- /dev/null
+++ b/patches.drivers/ALSA-hda-realtek-Limit-mic-boost-on-T480
@@ -0,0 +1,35 @@
+From 85981dfd6b0a0fd9ed87ca4a525981b67c21f098 Mon Sep 17 00:00:00 2001
+From: Benjamin Berg <bberg@redhat.com>
+Date: Wed, 14 Feb 2018 13:29:39 +0100
+Subject: [PATCH] ALSA: hda/realtek: Limit mic boost on T480
+Git-commit: 85981dfd6b0a0fd9ed87ca4a525981b67c21f098
+Patch-mainline: v4.16-rc5
+References: bsc#1099810
+
+The internal mic boost on the T480 is too high. Fix this by applying the
+ALC269_FIXUP_LIMIT_INT_MIC_BOOST fixup to the machine to limit the gain.
+
+Signed-off-by: Benjamin Berg <bberg@redhat.com>
+Tested-by: Benjamin Berg <bberg@redhat.com>
+Cc: <stable@vger.kernel.org>
+Signed-off-by: Takashi Iwai <tiwai@suse.de>
+
+---
+ sound/pci/hda/patch_realtek.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
+index d1e575b20cd4..85d9efe343d2 100644
+--- a/sound/pci/hda/patch_realtek.c
++++ b/sound/pci/hda/patch_realtek.c
+@@ -6536,6 +6536,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {
+ SND_PCI_QUIRK(0x17aa, 0x224b, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
+ SND_PCI_QUIRK(0x17aa, 0x224c, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
+ SND_PCI_QUIRK(0x17aa, 0x224d, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
++ SND_PCI_QUIRK(0x17aa, 0x225d, "Thinkpad T480", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
+ 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),
+--
+2.18.0
+
diff --git a/patches.drivers/ALSA-hda-realtek-Make-dock-sound-work-on-ThinkPad-L5 b/patches.drivers/ALSA-hda-realtek-Make-dock-sound-work-on-ThinkPad-L5
new file mode 100644
index 0000000000..408538136e
--- /dev/null
+++ b/patches.drivers/ALSA-hda-realtek-Make-dock-sound-work-on-ThinkPad-L5
@@ -0,0 +1,36 @@
+From e4c07b3b66b7d6a24c2fe3b1ddeff5cd9b378b3a Mon Sep 17 00:00:00 2001
+From: Dennis Wassenberg <dennis.wassenberg@secunet.com>
+Date: Thu, 8 Mar 2018 13:17:54 +0100
+Subject: [PATCH] ALSA: hda/realtek - Make dock sound work on ThinkPad L570
+Git-commit: e4c07b3b66b7d6a24c2fe3b1ddeff5cd9b378b3a
+Patch-mainline: v4.16-rc5
+References: bsc#1099810
+
+One version of Lenovo Thinkpad T570 did not use ALC298
+(like other Kaby Lake devices). Instead it uses ALC292.
+In order to make the Lenovo dock working with that codec
+the dock quirk for ALC292 will be used.
+
+Signed-off-by: Dennis Wassenberg <dennis.wassenberg@secunet.com>
+Cc: <stable@vger.kernel.org>
+Signed-off-by: Takashi Iwai <tiwai@suse.de>
+
+---
+ sound/pci/hda/patch_realtek.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
+index 60f1b9524957..9af301c6bba2 100644
+--- a/sound/pci/hda/patch_realtek.c
++++ b/sound/pci/hda/patch_realtek.c
+@@ -6549,6 +6549,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {
+ SND_PCI_QUIRK(0x17aa, 0x2245, "Thinkpad T470", ALC298_FIXUP_TPT470_DOCK),
+ SND_PCI_QUIRK(0x17aa, 0x2246, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
+ SND_PCI_QUIRK(0x17aa, 0x2247, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
++ SND_PCI_QUIRK(0x17aa, 0x2249, "Thinkpad", ALC292_FIXUP_TPT460),
+ SND_PCI_QUIRK(0x17aa, 0x224b, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
+ SND_PCI_QUIRK(0x17aa, 0x224c, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
+ SND_PCI_QUIRK(0x17aa, 0x224d, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
+--
+2.18.0
+
diff --git a/patches.drivers/ALSA-hda-realtek-Refactor-alc269_fixup_hp_mute_led_m b/patches.drivers/ALSA-hda-realtek-Refactor-alc269_fixup_hp_mute_led_m
new file mode 100644
index 0000000000..896d0e1aa5
--- /dev/null
+++ b/patches.drivers/ALSA-hda-realtek-Refactor-alc269_fixup_hp_mute_led_m
@@ -0,0 +1,81 @@
+From 85c467dc03a283ada739acce89f071a40310d962 Mon Sep 17 00:00:00 2001
+From: Takashi Iwai <tiwai@suse.de>
+Date: Tue, 29 May 2018 11:38:38 +0200
+Subject: [PATCH] ALSA: hda/realtek - Refactor alc269_fixup_hp_mute_led_mic*()
+Git-commit: 85c467dc03a283ada739acce89f071a40310d962
+Patch-mainline: v4.18-rc1
+References: bsc#1099810
+
+Just a code refactoring to use the common helper for the all three
+functions.
+
+Signed-off-by: Takashi Iwai <tiwai@suse.de>
+
+---
+ sound/pci/hda/patch_realtek.c | 32 +++++++++++++-------------------
+ 1 file changed, 13 insertions(+), 19 deletions(-)
+
+diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
+index 6369964c117a..4a9ea34b11b5 100644
+--- a/sound/pci/hda/patch_realtek.c
++++ b/sound/pci/hda/patch_realtek.c
+@@ -3653,43 +3653,37 @@ static void alc269_fixup_hp_mute_led(struct hda_codec *codec,
+ }
+ }
+
+-static void alc269_fixup_hp_mute_led_mic1(struct hda_codec *codec,
+- const struct hda_fixup *fix, int action)
++static void alc269_fixup_hp_mute_led_micx(struct hda_codec *codec,
++ const struct hda_fixup *fix,
++ int action, hda_nid_t pin)
+ {
+ struct alc_spec *spec = codec->spec;
++
+ if (action == HDA_FIXUP_ACT_PRE_PROBE) {
+ spec->mute_led_polarity = 0;
+- spec->mute_led_nid = 0x18;
++ spec->mute_led_nid = pin;
+ spec->gen.vmaster_mute.hook = alc269_fixup_mic_mute_hook;
+ spec->gen.vmaster_mute_enum = 1;
+ codec->power_filter = led_power_filter;
+ }
+ }
+
++static void alc269_fixup_hp_mute_led_mic1(struct hda_codec *codec,
++ const struct hda_fixup *fix, int action)
++{
++ alc269_fixup_hp_mute_led_micx(codec, fix, action, 0x18);
++}
++
+ static void alc269_fixup_hp_mute_led_mic2(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->mute_led_polarity = 0;
+- spec->mute_led_nid = 0x19;
+- spec->gen.vmaster_mute.hook = alc269_fixup_mic_mute_hook;
+- spec->gen.vmaster_mute_enum = 1;
+- codec->power_filter = led_power_filter;
+- }
++ alc269_fixup_hp_mute_led_micx(codec, fix, action, 0x19);
+ }
+
+ static void alc269_fixup_hp_mute_led_mic3(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->mute_led_polarity = 0;
+- spec->mute_led_nid = 0x1b;
+- spec->gen.vmaster_mute.hook = alc269_fixup_mic_mute_hook;
+- spec->gen.vmaster_mute_enum = 1;
+- codec->power_filter = led_power_filter;
+- }
++ alc269_fixup_hp_mute_led_micx(codec, fix, action, 0x1b);
+ }
+
+ /* update LED status via GPIO */
+--
+2.18.0
+
diff --git a/patches.drivers/ALSA-hda-realtek-Reorder-ALC269-ASUS-quirk-entries b/patches.drivers/ALSA-hda-realtek-Reorder-ALC269-ASUS-quirk-entries
new file mode 100644
index 0000000000..d061b18a26
--- /dev/null
+++ b/patches.drivers/ALSA-hda-realtek-Reorder-ALC269-ASUS-quirk-entries
@@ -0,0 +1,47 @@
+From 4eab0ea196f569ed2085a0fa3729f60eb8edaad1 Mon Sep 17 00:00:00 2001
+From: Takashi Iwai <tiwai@suse.de>
+Date: Tue, 6 Jun 2017 12:33:17 +0200
+Subject: [PATCH] ALSA: hda/realtek - Reorder ALC269 ASUS quirk entries
+Git-commit: 4eab0ea196f569ed2085a0fa3729f60eb8edaad1
+Patch-mainline: v4.12-rc5
+References: bsc#1099810
+
+A disorder is found in some ALC269 quirk entries for ASUS (1043:xxxx),
+which should have been sorted in PCI SSID order. Rearrange them, so
+that I won't overlook the already existing entry like I did a couple
+of times in the past...
+
+Signed-off-by: Takashi Iwai <tiwai@suse.de>
+
+---
+ sound/pci/hda/patch_realtek.c | 10 +++++-----
+ 1 file changed, 5 insertions(+), 5 deletions(-)
+
+--- a/sound/pci/hda/patch_realtek.c
++++ b/sound/pci/hda/patch_realtek.c
+@@ -6399,7 +6399,11 @@ static const struct snd_pci_quirk alc269
+ SND_PCI_QUIRK(0x1043, 0x103f, "ASUS TX300", ALC282_FIXUP_ASUS_TX300),
+ SND_PCI_QUIRK(0x1043, 0x106d, "Asus K53BE", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
+ SND_PCI_QUIRK(0x1043, 0x10c0, "ASUS X540SA", ALC256_FIXUP_ASUS_MIC),
++ SND_PCI_QUIRK(0x1043, 0x10d0, "ASUS X540LA/X540LJ", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE),
+ SND_PCI_QUIRK(0x1043, 0x115d, "Asus 1015E", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
++ SND_PCI_QUIRK(0x1043, 0x11c0, "ASUS X556UR", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE),
++ SND_PCI_QUIRK(0x1043, 0x1290, "ASUS X441SA", ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE),
++ SND_PCI_QUIRK(0x1043, 0x12a0, "ASUS X441UV", ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE),
+ SND_PCI_QUIRK(0x1043, 0x12f0, "ASUS X541UV", ALC256_FIXUP_ASUS_MIC),
+ SND_PCI_QUIRK(0x1043, 0x12e0, "ASUS X541SA", ALC256_FIXUP_ASUS_MIC),
+ SND_PCI_QUIRK(0x1043, 0x13b0, "ASUS Z550SA", ALC256_FIXUP_ASUS_MIC),
+@@ -6408,12 +6412,8 @@ static const struct snd_pci_quirk alc269
+ SND_PCI_QUIRK(0x1043, 0x16e3, "ASUS UX50", ALC269_FIXUP_STEREO_DMIC),
+ SND_PCI_QUIRK(0x1043, 0x1a13, "Asus G73Jw", ALC269_FIXUP_ASUS_G73JW),
+ SND_PCI_QUIRK(0x1043, 0x1b13, "Asus U41SV", ALC269_FIXUP_INV_DMIC),
+- SND_PCI_QUIRK(0x1043, 0x1c23, "Asus X55U", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
+ SND_PCI_QUIRK(0x1043, 0x1bbd, "ASUS Z550MA", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE),
+- SND_PCI_QUIRK(0x1043, 0x10d0, "ASUS X540LA/X540LJ", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE),
+- SND_PCI_QUIRK(0x1043, 0x11c0, "ASUS X556UR", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE),
+- SND_PCI_QUIRK(0x1043, 0x1290, "ASUS X441SA", ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE),
+- SND_PCI_QUIRK(0x1043, 0x12a0, "ASUS X441UV", ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE),
++ SND_PCI_QUIRK(0x1043, 0x1c23, "Asus X55U", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
+ SND_PCI_QUIRK(0x1043, 0x1ccd, "ASUS X555UB", ALC256_FIXUP_ASUS_MIC),
+ SND_PCI_QUIRK(0x1043, 0x3030, "ASUS ZN270IE", ALC256_FIXUP_ASUS_AIO_GPIO2),
+ SND_PCI_QUIRK(0x1043, 0x831a, "ASUS P901", ALC269_FIXUP_STEREO_DMIC),
diff --git a/patches.drivers/ALSA-hda-realtek-Support-headset-mode-for-ALC215-ALC b/patches.drivers/ALSA-hda-realtek-Support-headset-mode-for-ALC215-ALC
new file mode 100644
index 0000000000..4765104736
--- /dev/null
+++ b/patches.drivers/ALSA-hda-realtek-Support-headset-mode-for-ALC215-ALC
@@ -0,0 +1,96 @@
+From c2b691ee35004ba3d5428cf48672cbbf1a50fbfb Mon Sep 17 00:00:00 2001
+From: Kailang Yang <kailang@realtek.com>
+Date: Wed, 17 Jan 2018 15:22:55 +0800
+Subject: [PATCH] ALSA: hda/realtek - Support headset mode for ALC215/ALC285/ALC289
+Git-commit: c2b691ee35004ba3d5428cf48672cbbf1a50fbfb
+Patch-mainline: v4.16-rc1
+References: bsc#1099810
+
+This patch will enable headset mode for ALC215/ALC285/ALC289 platform.
+
+Signed-off-by: Kailang Yang <kailang@realtek.com>
+Signed-off-by: Takashi Iwai <tiwai@suse.de>
+
+---
+ sound/pci/hda/patch_realtek.c | 18 ++++++++++++++++++
+ 1 file changed, 18 insertions(+)
+
+diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
+index 552646c049fa..2efba4bd9f2b 100644
+--- a/sound/pci/hda/patch_realtek.c
++++ b/sound/pci/hda/patch_realtek.c
+@@ -4086,8 +4086,11 @@ static void alc_headset_mode_unplugged(struct hda_codec *codec)
+ case 0x10ec0668:
+ alc_process_coef_fw(codec, coef0668);
+ break;
++ case 0x10ec0215:
+ case 0x10ec0225:
++ case 0x10ec0285:
+ case 0x10ec0295:
++ case 0x10ec0289:
+ case 0x10ec0299:
+ alc_process_coef_fw(codec, coef0225);
+ break;
+@@ -4209,8 +4212,11 @@ static void alc_headset_mode_mic_in(struct hda_codec *codec, hda_nid_t hp_pin,
+ alc_process_coef_fw(codec, coef0688);
+ snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
+ break;
++ case 0x10ec0215:
+ case 0x10ec0225:
++ case 0x10ec0285:
+ case 0x10ec0295:
++ case 0x10ec0289:
+ case 0x10ec0299:
+ alc_process_coef_fw(codec, alc225_pre_hsmode);
+ alc_update_coef_idx(codec, 0x45, 0x3f<<10, 0x31<<10);
+@@ -4281,8 +4287,11 @@ static void alc_headset_mode_default(struct hda_codec *codec)
+ };
+
+ switch (codec->core.vendor_id) {
++ case 0x10ec0215:
+ case 0x10ec0225:
++ case 0x10ec0285:
+ case 0x10ec0295:
++ case 0x10ec0289:
+ case 0x10ec0299:
+ alc_process_coef_fw(codec, alc225_pre_hsmode);
+ alc_process_coef_fw(codec, coef0225);
+@@ -4424,8 +4433,11 @@ static void alc_headset_mode_ctia(struct hda_codec *codec)
+ case 0x10ec0668:
+ alc_process_coef_fw(codec, coef0688);
+ break;
++ case 0x10ec0215:
+ case 0x10ec0225:
++ case 0x10ec0285:
+ case 0x10ec0295:
++ case 0x10ec0289:
+ case 0x10ec0299:
+ val = alc_read_coef_idx(codec, 0x45);
+ if (val & (1 << 9))
+@@ -4528,8 +4540,11 @@ static void alc_headset_mode_omtp(struct hda_codec *codec)
+ case 0x10ec0668:
+ alc_process_coef_fw(codec, coef0688);
+ break;
++ case 0x10ec0215:
+ case 0x10ec0225:
++ case 0x10ec0285:
+ case 0x10ec0295:
++ case 0x10ec0289:
+ case 0x10ec0299:
+ alc_process_coef_fw(codec, coef0225);
+ break;
+@@ -4658,8 +4673,11 @@ static void alc_determine_headset_type(struct hda_codec *codec)
+ val = alc_read_coef_idx(codec, 0xbe);
+ is_ctia = (val & 0x1c02) == 0x1c02;
+ break;
++ case 0x10ec0215:
+ case 0x10ec0225:
++ case 0x10ec0285:
+ case 0x10ec0295:
++ case 0x10ec0289:
+ case 0x10ec0299:
+ snd_hda_codec_write(codec, 0x21, 0,
+ AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
+--
+2.18.0
+
diff --git a/patches.drivers/ALSA-hda-realtek-Update-ALC255-depop-optimize b/patches.drivers/ALSA-hda-realtek-Update-ALC255-depop-optimize
new file mode 100644
index 0000000000..6bb9e49fde
--- /dev/null
+++ b/patches.drivers/ALSA-hda-realtek-Update-ALC255-depop-optimize
@@ -0,0 +1,35 @@
+From ab3b8e5159b5335c81ba2d09ee5054d4a1b5a7a6 Mon Sep 17 00:00:00 2001
+From: Kailang Yang <kailang@realtek.com>
+Date: Wed, 25 Apr 2018 16:05:27 +0800
+Subject: [PATCH] ALSA: hda/realtek - Update ALC255 depop optimize
+Git-commit: ab3b8e5159b5335c81ba2d09ee5054d4a1b5a7a6
+Patch-mainline: v4.17-rc3
+References: bsc#1099810
+
+Add ALC255 its own depop functions for alc_init and alc_shutup.
+Assign it to ALC256 usage.
+
+Signed-off-by: Kailang Yang <kailang@realtek.com>
+Cc: <stable@vger.kernel.org>
+Signed-off-by: Takashi Iwai <tiwai@suse.de>
+
+---
+ sound/pci/hda/patch_realtek.c | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
+index f3ad5dea2f8d..c13b7fd0f58b 100644
+--- a/sound/pci/hda/patch_realtek.c
++++ b/sound/pci/hda/patch_realtek.c
+@@ -7164,6 +7164,8 @@ static int patch_alc269(struct hda_codec *codec)
+ case 0x10ec0235:
+ case 0x10ec0255:
+ spec->codec_variant = ALC269_TYPE_ALC255;
++ spec->shutup = alc256_shutup;
++ spec->init_hook = alc256_init;
+ break;
+ case 0x10ec0236:
+ case 0x10ec0256:
+--
+2.18.0
+
diff --git a/patches.drivers/ALSA-hda-realtek-adjust-the-location-of-one-mic b/patches.drivers/ALSA-hda-realtek-adjust-the-location-of-one-mic
new file mode 100644
index 0000000000..f32750474d
--- /dev/null
+++ b/patches.drivers/ALSA-hda-realtek-adjust-the-location-of-one-mic
@@ -0,0 +1,33 @@
+From a3dafb2200bf3c13905a088e82ae11f1eb275a83 Mon Sep 17 00:00:00 2001
+From: Hui Wang <hui.wang@canonical.com>
+Date: Thu, 19 Apr 2018 13:29:05 +0800
+Subject: [PATCH] ALSA: hda/realtek - adjust the location of one mic
+Git-commit: a3dafb2200bf3c13905a088e82ae11f1eb275a83
+Patch-mainline: v4.17-rc2
+References: bsc#1099810
+
+There are two front mics on this machine, if we don't adjust the
+location for one of them, they will have the same mixer name,
+pulseaudio can't handle this situation.
+
+After applying this FIXUP, they will have different mixer name,
+then pulseaudio can handle them correctly.
+
+Cc: <stable@vger.kernel.org>
+Signed-off-by: Hui Wang <hui.wang@canonical.com>
+Signed-off-by: Takashi Iwai <tiwai@suse.de>
+
+---
+ sound/pci/hda/patch_realtek.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+--- a/sound/pci/hda/patch_realtek.c
++++ b/sound/pci/hda/patch_realtek.c
+@@ -6497,6 +6497,7 @@ static const struct snd_pci_quirk alc269
+ 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, 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),
diff --git a/patches.drivers/ALSA-hda-realtek-change-the-location-for-one-of-two2 b/patches.drivers/ALSA-hda-realtek-change-the-location-for-one-of-two2
new file mode 100644
index 0000000000..4caedf27e7
--- /dev/null
+++ b/patches.drivers/ALSA-hda-realtek-change-the-location-for-one-of-two2
@@ -0,0 +1,32 @@
+From 65811834ba56e9ed88117cf6c09880416c9951ab Mon Sep 17 00:00:00 2001
+From: Kailang Yang <kailang@realtek.com>
+Date: Wed, 25 Apr 2018 17:07:27 +0800
+Subject: [PATCH] ALSA: hda/realtek - change the location for one of two front mics
+Git-commit: 65811834ba56e9ed88117cf6c09880416c9951ab
+Patch-mainline: v4.17-rc3
+References: bsc#1099810
+
+On this Lenovo ThinkCentre machine. There are two front mics,
+we change the location for one of them.
+
+Relation: f33f79f3d0e5 ("ALSA: hda/realtek - change the location for
+one of two front microphones")
+
+Signed-off-by: Kailang Yang <kailang@realtek.com>
+Cc: <stable@vger.kernel.org>
+Signed-off-by: Takashi Iwai <tiwai@suse.de>
+
+---
+ sound/pci/hda/patch_realtek.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+--- a/sound/pci/hda/patch_realtek.c
++++ b/sound/pci/hda/patch_realtek.c
+@@ -6497,6 +6497,7 @@ static const struct snd_pci_quirk alc269
+ 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, 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),
diff --git a/patches.drivers/ALSA-hda-realtek-update-ALC215-depop-optimize b/patches.drivers/ALSA-hda-realtek-update-ALC215-depop-optimize
new file mode 100644
index 0000000000..b5142d7442
--- /dev/null
+++ b/patches.drivers/ALSA-hda-realtek-update-ALC215-depop-optimize
@@ -0,0 +1,34 @@
+From 1b6832be1b61f63ef367e48050617e870a46b417 Mon Sep 17 00:00:00 2001
+From: Kailang Yang <kailang@realtek.com>
+Date: Wed, 17 Jan 2018 15:32:03 +0800
+Subject: [PATCH] ALSA: hda/realtek - update ALC215 depop optimize
+Git-commit: 1b6832be1b61f63ef367e48050617e870a46b417
+Patch-mainline: v4.16-rc1
+References: bsc#1099810
+
+Add ALC215 its own depop functions for alc_init and alc_shutup.
+Assign it to ALC225 usage.
+
+Signed-off-by: Kailang Yang <kailang@realtek.com>
+Signed-off-by: Takashi Iwai <tiwai@suse.de>
+
+---
+ sound/pci/hda/patch_realtek.c | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
+index 2efba4bd9f2b..0004e282a837 100644
+--- a/sound/pci/hda/patch_realtek.c
++++ b/sound/pci/hda/patch_realtek.c
+@@ -7042,6 +7042,8 @@ static int patch_alc269(struct hda_codec *codec)
+ case 0x10ec0285:
+ case 0x10ec0289:
+ spec->codec_variant = ALC269_TYPE_ALC215;
++ spec->shutup = alc225_shutup;
++ spec->init_hook = alc225_init;
+ spec->gen.mixer_nid = 0;
+ break;
+ case 0x10ec0225:
+--
+2.18.0
+
diff --git a/patches.drivers/ALSA-hda-realtek-update-ALC225-depop-optimize b/patches.drivers/ALSA-hda-realtek-update-ALC225-depop-optimize
new file mode 100644
index 0000000000..279ec7b450
--- /dev/null
+++ b/patches.drivers/ALSA-hda-realtek-update-ALC225-depop-optimize
@@ -0,0 +1,154 @@
+From da911b1f5e98f21b20aa042748dfe73e36322fb1 Mon Sep 17 00:00:00 2001
+From: Kailang Yang <kailang@realtek.com>
+Date: Fri, 5 Jan 2018 16:50:08 +0800
+Subject: [PATCH] ALSA: hda/realtek - update ALC225 depop optimize
+Git-commit: da911b1f5e98f21b20aa042748dfe73e36322fb1
+Patch-mainline: v4.16-rc1
+References: bsc#1099810
+
+Add ALC225 its own depop functions for alc_init and alc_shutup.
+Add depop optimize step for headset mode functions.
+
+Signed-off-by: Kailang Yang <kailang@realtek.com>
+Signed-off-by: Takashi Iwai <tiwai@suse.de>
+
+---
+ sound/pci/hda/patch_realtek.c | 101 ++++++++++++++++++++++++++++++++++
+ 1 file changed, 101 insertions(+)
+
+diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
+index b2037131eed9..440972975bd4 100644
+--- a/sound/pci/hda/patch_realtek.c
++++ b/sound/pci/hda/patch_realtek.c
+@@ -3166,6 +3166,93 @@ static void alc256_shutup(struct hda_codec *codec)
+ snd_hda_shutup_pins(codec);
+ }
+
++static void alc225_init(struct hda_codec *codec)
++{
++ struct alc_spec *spec = codec->spec;
++ hda_nid_t hp_pin = spec->gen.autocfg.hp_pins[0];
++ bool hp1_pin_sense, hp2_pin_sense;
++
++ if (!hp_pin)
++ return;
++
++ msleep(30);
++
++ hp1_pin_sense = snd_hda_jack_detect(codec, hp_pin);
++ hp2_pin_sense = snd_hda_jack_detect(codec, 0x16);
++
++ if (hp1_pin_sense || hp2_pin_sense)
++ msleep(2);
++
++ alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x1); /* Low power */
++
++ if (hp1_pin_sense)
++ snd_hda_codec_write(codec, hp_pin, 0,
++ AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
++ if (hp2_pin_sense)
++ snd_hda_codec_write(codec, 0x16, 0,
++ AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
++
++ if (hp1_pin_sense || hp2_pin_sense)
++ msleep(85);
++
++ if (hp1_pin_sense)
++ snd_hda_codec_write(codec, hp_pin, 0,
++ AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
++ if (hp2_pin_sense)
++ snd_hda_codec_write(codec, 0x16, 0,
++ AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
++
++ if (hp1_pin_sense || hp2_pin_sense)
++ msleep(100);
++
++ alc_update_coef_idx(codec, 0x4a, 3 << 10, 0);
++ alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x4); /* Hight power */
++}
++
++static void alc225_shutup(struct hda_codec *codec)
++{
++ struct alc_spec *spec = codec->spec;
++ hda_nid_t hp_pin = spec->gen.autocfg.hp_pins[0];
++ bool hp1_pin_sense, hp2_pin_sense;
++
++ if (!hp_pin) {
++ alc269_shutup(codec);
++ return;
++ }
++
++ /* 3k pull low control for Headset jack. */
++ alc_update_coef_idx(codec, 0x4a, 0, 3 << 10);
++
++ hp1_pin_sense = snd_hda_jack_detect(codec, hp_pin);
++ hp2_pin_sense = snd_hda_jack_detect(codec, 0x16);
++
++ if (hp1_pin_sense || hp2_pin_sense)
++ msleep(2);
++
++ if (hp1_pin_sense)
++ snd_hda_codec_write(codec, hp_pin, 0,
++ AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
++ if (hp2_pin_sense)
++ snd_hda_codec_write(codec, 0x16, 0,
++ AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
++
++ if (hp1_pin_sense || hp2_pin_sense)
++ msleep(85);
++
++ if (hp1_pin_sense)
++ snd_hda_codec_write(codec, hp_pin, 0,
++ AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
++ if (hp2_pin_sense)
++ snd_hda_codec_write(codec, 0x16, 0,
++ AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
++
++ if (hp1_pin_sense || hp2_pin_sense)
++ msleep(100);
++
++ alc_auto_setup_eapd(codec, false);
++ snd_hda_shutup_pins(codec);
++}
++
+ static void alc_default_init(struct hda_codec *codec)
+ {
+ struct alc_spec *spec = codec->spec;
+@@ -4569,6 +4656,12 @@ static void alc_determine_headset_type(struct hda_codec *codec)
+ case 0x10ec0225:
+ case 0x10ec0295:
+ case 0x10ec0299:
++ snd_hda_codec_write(codec, 0x21, 0,
++ AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
++ msleep(80);
++ snd_hda_codec_write(codec, 0x21, 0,
++ AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
++
+ alc_process_coef_fw(codec, alc225_pre_hsmode);
+ alc_update_coef_idx(codec, 0x67, 0xf000, 0x1000);
+ val = alc_read_coef_idx(codec, 0x45);
+@@ -4588,6 +4681,12 @@ static void alc_determine_headset_type(struct hda_codec *codec)
+ alc_update_coef_idx(codec, 0x4a, 7<<6, 7<<6);
+ alc_update_coef_idx(codec, 0x4a, 3<<4, 3<<4);
+ alc_update_coef_idx(codec, 0x67, 0xf000, 0x3000);
++
++ snd_hda_codec_write(codec, 0x21, 0,
++ AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
++ msleep(80);
++ snd_hda_codec_write(codec, 0x21, 0,
++ AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE);
+ break;
+ case 0x10ec0867:
+ is_ctia = true;
+@@ -6925,6 +7024,8 @@ static int patch_alc269(struct hda_codec *codec)
+ case 0x10ec0295:
+ case 0x10ec0299:
+ spec->codec_variant = ALC269_TYPE_ALC225;
++ spec->shutup = alc225_shutup;
++ spec->init_hook = alc225_init;
+ spec->gen.mixer_nid = 0; /* no loopback on ALC225, ALC295 and ALC299 */
+ break;
+ case 0x10ec0234:
+--
+2.18.0
+
diff --git a/patches.drivers/ALSA-hda-silence-uninitialized-variable-warning-in-a b/patches.drivers/ALSA-hda-silence-uninitialized-variable-warning-in-a
new file mode 100644
index 0000000000..322d352401
--- /dev/null
+++ b/patches.drivers/ALSA-hda-silence-uninitialized-variable-warning-in-a
@@ -0,0 +1,33 @@
+From 0de7d8356241712406973a63572e61fea3233dc2 Mon Sep 17 00:00:00 2001
+From: Dan Carpenter <dan.carpenter@oracle.com>
+Date: Fri, 13 Oct 2017 13:57:10 +0300
+Subject: [PATCH] ALSA: hda - silence uninitialized variable warning in activate_amp_in()
+Git-commit: 0de7d8356241712406973a63572e61fea3233dc2
+Patch-mainline: v4.15-rc1
+References: bsc#1099810
+
+If snd_hda_get_conn_list() fails then "conn" isn't initialized.
+
+Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
+Signed-off-by: Takashi Iwai <tiwai@suse.de>
+
+---
+ sound/pci/hda/hda_generic.c | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/sound/pci/hda/hda_generic.c b/sound/pci/hda/hda_generic.c
+index 28e265a88383..5cc65093d941 100644
+--- a/sound/pci/hda/hda_generic.c
++++ b/sound/pci/hda/hda_generic.c
+@@ -795,6 +795,8 @@ static void activate_amp_in(struct hda_codec *codec, struct nid_path *path,
+ hda_nid_t nid = path->path[i];
+
+ nums = snd_hda_get_conn_list(codec, nid, &conn);
++ if (nums < 0)
++ return;
+ type = get_wcaps_type(get_wcaps(codec, nid));
+ if (type == AC_WID_PIN ||
+ (type == AC_WID_AUD_IN && codec->single_adc_amp)) {
+--
+2.18.0
+
diff --git a/patches.drivers/iwlmvm-tdls-Check-TDLS-channel-switch-support b/patches.drivers/iwlmvm-tdls-Check-TDLS-channel-switch-support
new file mode 100644
index 0000000000..e135c928d1
--- /dev/null
+++ b/patches.drivers/iwlmvm-tdls-Check-TDLS-channel-switch-support
@@ -0,0 +1,50 @@
+From 15c4e33030d172ac0d2a03ebbae4c3687a80ac7d Mon Sep 17 00:00:00 2001
+From: Aviya Erenfeld <aviya.erenfeld@intel.com>
+Date: Mon, 26 Mar 2018 14:35:32 +0300
+Subject: [PATCH] iwlmvm: tdls: Check TDLS channel switch support
+Git-commit: 15c4e33030d172ac0d2a03ebbae4c3687a80ac7d
+Patch-mainline: v4.18-rc1
+References: bsc#1099810
+
+Some versions of the FW don't support channel switch in TDLS.
+Add a condition that checks it.
+
+Fixes: 307e47235a10 ("iwlwifi: mvm: configure TDLS peers to FW")
+Signed-off-by: Aviya Erenfeld <aviya.erenfeld@intel.com>
+Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
+Acked-by: Takashi Iwai <tiwai@suse.de>
+
+---
+ drivers/net/wireless/iwlwifi/mvm/tdls.c | 14 +++++++++-----
+ 1 file changed, 9 insertions(+), 5 deletions(-)
+
+--- a/drivers/net/wireless/iwlwifi/mvm/tdls.c
++++ b/drivers/net/wireless/iwlwifi/mvm/tdls.c
+@@ -17,9 +17,7 @@
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+- * along with this program; if not, write to the Free Software
+- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110,
+- * USA
++ * along with this program.
+ *
+ * The full GNU General Public License is included in this distribution
+ * in the file called COPYING.
+@@ -186,8 +184,14 @@ void iwl_mvm_recalc_tdls_state(struct iw
+ if (tdls_sta_cnt == 1 && sta_added)
+ iwl_mvm_power_update_mac(mvm);
+
+- /* configure the FW with TDLS peer info */
+- iwl_mvm_tdls_config(mvm, vif);
++ /* Configure the FW with TDLS peer info only if TDLS channel switch
++ * capability is set.
++ * TDLS config data is used currently only in TDLS channel switch code.
++ * Supposed to serve also TDLS buffer station which is not implemneted
++ * yet in FW*/
++ if (fw_has_capa(&mvm->fw->ucode_capa,
++ IWL_UCODE_TLV_CAPA_TDLS_CHANNEL_SWITCH))
++ iwl_mvm_tdls_config(mvm, vif);
+
+ /* when the last peer leaves, send a power update last */
+ if (tdls_sta_cnt == 0 && !sta_added)
diff --git a/patches.drivers/iwlwifi-fix-non_shared_ant-for-9000-devices b/patches.drivers/iwlwifi-fix-non_shared_ant-for-9000-devices
new file mode 100644
index 0000000000..2f86592275
--- /dev/null
+++ b/patches.drivers/iwlwifi-fix-non_shared_ant-for-9000-devices
@@ -0,0 +1,31 @@
+From 506247825c5e877741f33a2c657d351e5c7943ba Mon Sep 17 00:00:00 2001
+From: Erel Geron <erelx.geron@intel.com>
+Date: Mon, 28 May 2018 17:09:30 +0300
+Subject: [PATCH] iwlwifi: fix non_shared_ant for 9000 devices
+Git-commit: 506247825c5e877741f33a2c657d351e5c7943ba
+Patch-mainline: v4.18-rc1
+References: bsc#1099810
+
+The non-shared antenna was wrong for 9000 device series. Fix it to
+ANT_B for correct antenna preference by coex in MVM driver.
+
+Fixes: 89374fe60bfb ("iwlwifi: Add new PCI IDs for 9260 and 5165 series")
+Signed-off-by: Erel Geron <erelx.geron@intel.com>
+Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
+Acked-by: Takashi Iwai <tiwai@suse.de>
+
+---
+ drivers/net/wireless/iwlwifi/iwl-9000.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/drivers/net/wireless/iwlwifi/iwl-9000.c
++++ b/drivers/net/wireless/iwlwifi/iwl-9000.c
+@@ -130,7 +130,7 @@ static const struct iwl_tt_params iwl900
+ .base_params = &iwl9000_base_params, \
+ .led_mode = IWL_LED_RF_STATE, \
+ .nvm_hw_section_num = NVM_HW_SECTION_NUM_FAMILY_9000, \
+- .non_shared_ant = ANT_A, \
++ .non_shared_ant = ANT_B, \
+ .dccm_offset = IWL9000_DCCM_OFFSET, \
+ .dccm_len = IWL9000_DCCM_LEN, \
+ .dccm2_offset = IWL9000_DCCM2_OFFSET, \
diff --git a/patches.drivers/mac80211-Fix-condition-validating-WMM-IE b/patches.drivers/mac80211-Fix-condition-validating-WMM-IE
new file mode 100644
index 0000000000..719c49f0f7
--- /dev/null
+++ b/patches.drivers/mac80211-Fix-condition-validating-WMM-IE
@@ -0,0 +1,35 @@
+From 911a26484c33e10de6237228ca1d7293548e9f49 Mon Sep 17 00:00:00 2001
+From: Ilan Peer <ilan.peer@intel.com>
+Date: Tue, 3 Apr 2018 11:35:22 +0300
+Subject: [PATCH] mac80211: Fix condition validating WMM IE
+Git-commit: 911a26484c33e10de6237228ca1d7293548e9f49
+Patch-mainline: v4.17-rc5
+References: bsc#1099810,bsc#1099732
+
+Commit c470bdc1aaf3 ("mac80211: don't WARN on bad WMM parameters from
+buggy APs") handled cases where an AP reports a zeroed WMM
+IE. However, the condition that checks the validity accessed the wrong
+index in the ieee80211_tx_queue_params array, thus wrongly deducing
+that the parameters are invalid. Fix it.
+
+Fixes: c470bdc1aaf3 ("mac80211: don't WARN on bad WMM parameters from buggy APs")
+Signed-off-by: Ilan Peer <ilan.peer@intel.com>
+Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
+Signed-off-by: Johannes Berg <johannes.berg@intel.com>
+Acked-by: Takashi Iwai <tiwai@suse.de>
+
+---
+ net/mac80211/mlme.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/net/mac80211/mlme.c
++++ b/net/mac80211/mlme.c
+@@ -1829,7 +1829,7 @@ static bool ieee80211_sta_wmm_params(str
+ params[ac].acm = acm;
+ params[ac].uapsd = uapsd;
+
+- if (params->cw_min == 0 ||
++ if (params[ac].cw_min == 0 ||
+ params[ac].cw_min > params[ac].cw_max) {
+ sdata_info(sdata,
+ "AP has invalid WMM params (CWmin/max=%d/%d for ACI %d), using defaults\n",
diff --git a/patches.drivers/platform-x86-thinkpad_acpi-Adding-new-hotkey-ID-for- b/patches.drivers/platform-x86-thinkpad_acpi-Adding-new-hotkey-ID-for-
new file mode 100644
index 0000000000..d4a75a8c49
--- /dev/null
+++ b/patches.drivers/platform-x86-thinkpad_acpi-Adding-new-hotkey-ID-for-
@@ -0,0 +1,48 @@
+From a3c42a467a254a17236ab817d5c7c6bc054e4f84 Mon Sep 17 00:00:00 2001
+From: Hui Wang <hui.wang@canonical.com>
+Date: Tue, 8 Nov 2016 16:13:23 +0800
+Subject: [PATCH] platform/x86: thinkpad_acpi: Adding new hotkey ID for Lenovo thinkpad
+Git-commit: a3c42a467a254a17236ab817d5c7c6bc054e4f84
+Patch-mainline: v4.10-rc1
+References: bsc#1099810
+
+Recently we met an issue on lots of Lenovo thinkpad laptops (those
+laptops are not released to market yet), the issue is that the
+thinkpad_acpi.ko can't be automatically loaded as before.
+
+Through debugging, we found the HKEY_HID is LEN0268 instead of
+LEN0068 on those machines, and the MHKV is 0x200 instead of
+0x100. So adding the new ID into the driver.
+
+Signed-off-by: Hui Wang <hui.wang@canonical.com>
+Acked-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
+Signed-off-by: Darren Hart <dvhart@linux.intel.com>
+Acked-by: Takashi Iwai <tiwai@suse.de>
+
+---
+ drivers/platform/x86/thinkpad_acpi.c | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/drivers/platform/x86/thinkpad_acpi.c b/drivers/platform/x86/thinkpad_acpi.c
+index cd956de7c1b2..78cee7671e11 100644
+--- a/drivers/platform/x86/thinkpad_acpi.c
++++ b/drivers/platform/x86/thinkpad_acpi.c
+@@ -128,6 +128,7 @@ enum {
+ /* ACPI HIDs */
+ #define TPACPI_ACPI_IBM_HKEY_HID "IBM0068"
+ #define TPACPI_ACPI_LENOVO_HKEY_HID "LEN0068"
++#define TPACPI_ACPI_LENOVO_HKEY_V2_HID "LEN0268"
+ #define TPACPI_ACPI_EC_HID "PNP0C09"
+
+ /* Input IDs */
+@@ -4196,6 +4197,7 @@ static int hotkey_write(char *buf)
+ static const struct acpi_device_id ibm_htk_device_ids[] = {
+ {TPACPI_ACPI_IBM_HKEY_HID, 0},
+ {TPACPI_ACPI_LENOVO_HKEY_HID, 0},
++ {TPACPI_ACPI_LENOVO_HKEY_V2_HID, 0},
+ {"", 0},
+ };
+
+--
+2.18.0
+
diff --git a/patches.drivers/thinkpad_acpi-Add-support-for-HKEY-version-0x200 b/patches.drivers/thinkpad_acpi-Add-support-for-HKEY-version-0x200
new file mode 100644
index 0000000000..c31394c160
--- /dev/null
+++ b/patches.drivers/thinkpad_acpi-Add-support-for-HKEY-version-0x200
@@ -0,0 +1,173 @@
+From 0118c2d3eac0545d4095877e5a015b5dc763b3c2 Mon Sep 17 00:00:00 2001
+From: Dennis Wassenberg <dennis.wassenberg@secunet.com>
+Date: Wed, 8 Jun 2016 10:54:25 -0400
+Subject: [PATCH] thinkpad_acpi: Add support for HKEY version 0x200
+Git-commit: 0118c2d3eac0545d4095877e5a015b5dc763b3c2
+Patch-mainline: v4.7-rc4
+References: bsc#1099810
+
+Lenovo Thinkpad devices T460, T460s, T460p, T560, X260 use
+HKEY version 0x200 without adaptive keyboard.
+
+HKEY version 0x200 has method MHKA with one parameter value.
+Passing parameter value 1 will get hotkey_all_mask (the same like
+HKEY version 0x100 without parameter). Passing parameter value 2 to
+MHKA method will retrieve hotkey_all_adaptive_mask. If 0 is returned in
+that case there is no adaptive keyboard available.
+
+Signed-off-by: Dennis Wassenberg <dennis.wassenberg@secunet.com>
+Signed-off-by: Lyude <cpaul@redhat.com>
+Tested-by: Lyude <cpaul@redhat.com>
+Tested-by: Marco Trevisan <marco@ubuntu.com>
+Acked-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
+[dvhart: Keep MHKA error string on one line in new and existing pr_err calls]
+Signed-off-by: Darren Hart <dvhart@linux.intel.com>
+Acked-by: Takashi Iwai <tiwai@suse.de>
+
+---
+ drivers/platform/x86/thinkpad_acpi.c | 87 ++++++++++++++++++++--------
+ 1 file changed, 63 insertions(+), 24 deletions(-)
+
+diff --git a/drivers/platform/x86/thinkpad_acpi.c b/drivers/platform/x86/thinkpad_acpi.c
+index c3bfa1fe95bf..b65ce7519411 100644
+--- a/drivers/platform/x86/thinkpad_acpi.c
++++ b/drivers/platform/x86/thinkpad_acpi.c
+@@ -2043,6 +2043,7 @@ static int hotkey_autosleep_ack;
+
+ static u32 hotkey_orig_mask; /* events the BIOS had enabled */
+ static u32 hotkey_all_mask; /* all events supported in fw */
++static u32 hotkey_adaptive_all_mask; /* all adaptive events supported in fw */
+ static u32 hotkey_reserved_mask; /* events better left disabled */
+ static u32 hotkey_driver_mask; /* events needed by the driver */
+ static u32 hotkey_user_mask; /* events visible to userspace */
+@@ -2742,6 +2743,17 @@ static ssize_t hotkey_all_mask_show(struct device *dev,
+
+ static DEVICE_ATTR_RO(hotkey_all_mask);
+
++/* sysfs hotkey all_mask ----------------------------------------------- */
++static ssize_t hotkey_adaptive_all_mask_show(struct device *dev,
++ struct device_attribute *attr,
++ char *buf)
++{
++ return snprintf(buf, PAGE_SIZE, "0x%08x\n",
++ hotkey_adaptive_all_mask | hotkey_source_mask);
++}
++
++static DEVICE_ATTR_RO(hotkey_adaptive_all_mask);
++
+ /* sysfs hotkey recommended_mask --------------------------------------- */
+ static ssize_t hotkey_recommended_mask_show(struct device *dev,
+ struct device_attribute *attr,
+@@ -2985,6 +2997,7 @@ static struct attribute *hotkey_attributes[] __initdata = {
+ &dev_attr_wakeup_hotunplug_complete.attr,
+ &dev_attr_hotkey_mask.attr,
+ &dev_attr_hotkey_all_mask.attr,
++ &dev_attr_hotkey_adaptive_all_mask.attr,
+ &dev_attr_hotkey_recommended_mask.attr,
+ #ifdef CONFIG_THINKPAD_ACPI_HOTKEY_POLL
+ &dev_attr_hotkey_source_mask.attr,
+@@ -3321,20 +3334,6 @@ static int __init hotkey_init(struct ibm_init_struct *iibm)
+ if (!tp_features.hotkey)
+ return 1;
+
+- /*
+- * Check if we have an adaptive keyboard, like on the
+- * Lenovo Carbon X1 2014 (2nd Gen).
+- */
+- if (acpi_evalf(hkey_handle, &hkeyv, "MHKV", "qd")) {
+- if ((hkeyv >> 8) == 2) {
+- tp_features.has_adaptive_kbd = true;
+- res = sysfs_create_group(&tpacpi_pdev->dev.kobj,
+- &adaptive_kbd_attr_group);
+- if (res)
+- goto err_exit;
+- }
+- }
+-
+ quirks = tpacpi_check_quirks(tpacpi_hotkey_qtable,
+ ARRAY_SIZE(tpacpi_hotkey_qtable));
+
+@@ -3357,30 +3356,70 @@ static int __init hotkey_init(struct ibm_init_struct *iibm)
+ A30, R30, R31, T20-22, X20-21, X22-24. Detected by checking
+ for HKEY interface version 0x100 */
+ if (acpi_evalf(hkey_handle, &hkeyv, "MHKV", "qd")) {
+- if ((hkeyv >> 8) != 1) {
+- pr_err("unknown version of the HKEY interface: 0x%x\n",
+- hkeyv);
+- pr_err("please report this to %s\n", TPACPI_MAIL);
+- } else {
++ vdbg_printk(TPACPI_DBG_INIT | TPACPI_DBG_HKEY,
++ "firmware HKEY interface version: 0x%x\n",
++ hkeyv);
++
++ switch (hkeyv >> 8) {
++ case 1:
+ /*
+ * MHKV 0x100 in A31, R40, R40e,
+ * T4x, X31, and later
+ */
+- vdbg_printk(TPACPI_DBG_INIT | TPACPI_DBG_HKEY,
+- "firmware HKEY interface version: 0x%x\n",
+- hkeyv);
+
+ /* Paranoia check AND init hotkey_all_mask */
+ if (!acpi_evalf(hkey_handle, &hotkey_all_mask,
+ "MHKA", "qd")) {
+- pr_err("missing MHKA handler, "
+- "please report this to %s\n",
++ pr_err("missing MHKA handler, please report this to %s\n",
+ TPACPI_MAIL);
+ /* Fallback: pre-init for FN+F3,F4,F12 */
+ hotkey_all_mask = 0x080cU;
+ } else {
+ tp_features.hotkey_mask = 1;
+ }
++ break;
++
++ case 2:
++ /*
++ * MHKV 0x200 in X1, T460s, X260, T560, X1 Tablet (2016)
++ */
++
++ /* Paranoia check AND init hotkey_all_mask */
++ if (!acpi_evalf(hkey_handle, &hotkey_all_mask,
++ "MHKA", "dd", 1)) {
++ pr_err("missing MHKA handler, please report this to %s\n",
++ TPACPI_MAIL);
++ /* Fallback: pre-init for FN+F3,F4,F12 */
++ hotkey_all_mask = 0x080cU;
++ } else {
++ tp_features.hotkey_mask = 1;
++ }
++
++ /*
++ * Check if we have an adaptive keyboard, like on the
++ * Lenovo Carbon X1 2014 (2nd Gen).
++ */
++ if (acpi_evalf(hkey_handle, &hotkey_adaptive_all_mask,
++ "MHKA", "dd", 2)) {
++ if (hotkey_adaptive_all_mask != 0) {
++ tp_features.has_adaptive_kbd = true;
++ res = sysfs_create_group(
++ &tpacpi_pdev->dev.kobj,
++ &adaptive_kbd_attr_group);
++ if (res)
++ goto err_exit;
++ }
++ } else {
++ tp_features.has_adaptive_kbd = false;
++ hotkey_adaptive_all_mask = 0x0U;
++ }
++ break;
++
++ default:
++ pr_err("unknown version of the HKEY interface: 0x%x\n",
++ hkeyv);
++ pr_err("please report this to %s\n", TPACPI_MAIL);
++ break;
+ }
+ }
+
+--
+2.18.0
+
diff --git a/patches.fixes/ceph-fix-dentry-leak-in-splice_dentry.patch b/patches.fixes/ceph-fix-dentry-leak-in-splice_dentry.patch
new file mode 100644
index 0000000000..d90c282a0d
--- /dev/null
+++ b/patches.fixes/ceph-fix-dentry-leak-in-splice_dentry.patch
@@ -0,0 +1,28 @@
+From: "Yan, Zheng" <zyan@redhat.com>
+Date: Tue, 19 Jun 2018 18:20:34 +0800
+Subject: ceph: fix dentry leak in splice_dentry()
+Git-commit: 8b8f53af1ed9df88a4c0fbfdf3db58f62060edf3
+Patch-mainline: v4.18-rc3
+References: bsc#1098236
+
+In any case, d_splice_alias() does not drop reference of original
+dentry.
+
+Signed-off-by: "Yan, Zheng" <zyan@redhat.com>
+Reviewed-by: Jeff Layton <jlayton@redhat.com>
+Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
+Acked-by: Luis Henriques <lhenriques@suse.com>
+---
+ fs/ceph/inode.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+--- a/fs/ceph/inode.c
++++ b/fs/ceph/inode.c
+@@ -1109,6 +1109,7 @@ static struct dentry *splice_dentry(stru
+ if (IS_ERR(realdn)) {
+ pr_err("splice_dentry error %ld %p inode %p ino %llx.%llx\n",
+ PTR_ERR(realdn), dn, in, ceph_vinop(in));
++ dput(dn);
+ dn = realdn; /* note realdn contains the error */
+ goto out;
+ } else if (realdn) {
diff --git a/series.conf b/series.conf
index 8ca382cb8e..edc1763457 100644
--- a/series.conf
+++ b/series.conf
@@ -6150,6 +6150,15 @@
patches.arch/s390-dasd-configurable-IFCC-handling.patch
+ # bsc#1099713 - SLES 12 SP3 - IBM LTC System z maintenance kernel patches (#17)
+ patches.arch/s390-sles12sp3-17-01-01-zfcp-missing-SCSI-trace-result-eh_host_reset.patch
+ patches.arch/s390-sles12sp3-17-01-02-zfcp-missing-SCSI-trace-retry-abort-TMF.patch
+ patches.arch/s390-sles12sp3-17-01-03-zfcp-misleading-REC-trig-trace-erp-setup-failed.patch
+ patches.arch/s390-sles12sp3-17-01-04-zfcp-missing-REC-trig-trace-t_rport_io-early-ret.patch
+ patches.arch/s390-sles12sp3-17-01-05-zfcp-missing-REC-trig-trace-t_rport_io-ERP_FAILED.patch
+ patches.arch/s390-sles12sp3-17-01-06-zfcp-missing-REC-trig-trace-all-objects-ERP_FAILED.patch
+ patches.arch/s390-sles12sp3-17-01-07-zfcp-missing-REC-trig-trace-enqueue-no-ERP-thread.patch
+
########################################################
# arch misc patches
########################################################
@@ -6567,6 +6576,7 @@
# Add acpi_dev_found
patches.arch/ACPI-utils-Add-acpi_dev_present.patch
+ patches.drivers/ALSA-hda-Use-acpi_dev_present.patch
patches.arch/ACPI-utils-Rename-acpi_dev_present.patch
# fate#322061 numa support needed for Hisilicon/Huawei Hip06d05 numa
@@ -11246,6 +11256,7 @@
patches.fixes/ceph-fix-wrong-check-for-the-case-of-updating-link-count.patch
patches.fixes/ceph-prevent-i_version-from-going-back.patch
patches.fixes/ceph-fix-use-after-free-in-ceph_statfs.patch
+ patches.fixes/ceph-fix-dentry-leak-in-splice_dentry.patch
# target driver
patches.drivers/target-make-target-db-location-configurable
@@ -16357,6 +16368,8 @@
patches.drivers/iwlwifi-mvm-fix-the-coex-firmware-API
patches.drivers/iwlwifi-split-the-regulatory-rules-when-the-bandwidt
patches.drivers/iwlwifi-mvm-set-the-RTS_MIMO_PROT-bit-in-flag-mask-w
+ patches.drivers/iwlmvm-tdls-Check-TDLS-channel-switch-support
+ patches.drivers/iwlwifi-fix-non_shared_ant-for-9000-devices
patches.suse/iwlwifi-expose-default-fallback-ucode-api
@@ -16388,6 +16401,7 @@
patches.drivers/ath10k-fix-diag_read-to-collect-data-for-larger-memo
patches.suse/0001-ath10k-convert-warning-about-non-existent-OTP-board-.patch
patches.drivers/mac80211-don-t-WARN-on-bad-WMM-parameters-from-buggy
+ patches.drivers/mac80211-Fix-condition-validating-WMM-IE
########################################################
@@ -17179,6 +17193,39 @@
patches.drivers/ALSA-hda-realtek-Add-headset-mode-support-for-Dell-l
patches.drivers/ALSA-hda-realtek-Fix-speaker-no-sound-after-system-r
patches.drivers/ALSA-hda-conexant-Add-fixup-for-HP-Z2-G4-workstation
+ patches.drivers/ALSA-hda-Fix-a-wrong-FIXUP-for-alc289-on-Dell-machin
+ patches.drivers/ALSA-hda-Fix-forget-to-free-resource-in-error-handli
+ patches.drivers/ALSA-hda-Fix-incorrect-usage-of-IS_REACHABLE
+ patches.drivers/ALSA-hda-fix-some-klockwork-scan-warnings
+ patches.drivers/ALSA-hda-realtek-Enable-mic-mute-hotkey-for-several-
+ patches.drivers/ALSA-hda-patch_sigmatel-Add-AmigaOne-X1000-pinconfig
+ patches.drivers/ALSA-hda-Clean-up-ALC299-init-code
+ patches.drivers/ALSA-hda-realtek-update-ALC225-depop-optimize
+ patches.drivers/ALSA-hda-realtek-Update-ALC255-depop-optimize
+ patches.drivers/ALSA-hda-realtek-Support-headset-mode-for-ALC215-ALC
+ patches.drivers/ALSA-hda-realtek-update-ALC215-depop-optimize
+ patches.drivers/ALSA-hda-realtek-Add-support-headset-mode-for-DELL-W
+ patches.drivers/ALSA-hda-realtek-Enable-Thinkpad-Dock-device-for-ALC
+ patches.drivers/ALSA-hda-realtek-Add-headset-mode-support-for-Dell-2
+ patches.drivers/ALSA-hda-realtek-Fix-Dell-headset-Mic-can-t-record
+ patches.drivers/ALSA-hda-realtek-Clevo-P950ER-ALC1220-Fixup
+ patches.drivers/ALSA-hda-realtek-Fix-pop-noise-on-Lenovo-P50-co
+ patches.drivers/ALSA-hda-realtek-Add-a-quirk-for-FSC-ESPRIMO-U9210
+ patches.drivers/ALSA-hda-realtek-Reorder-ALC269-ASUS-quirk-entries
+ patches.drivers/ALSA-hda-realtek-Limit-mic-boost-on-T480
+ patches.drivers/ALSA-hda-realtek-Make-dock-sound-work-on-ThinkPad-L5
+ patches.drivers/ALSA-hda-realtek-Fixup-mute-led-on-HP-Spectre-x360
+ patches.drivers/ALSA-hda-realtek-Refactor-alc269_fixup_hp_mute_led_m
+ patches.drivers/ALSA-hda-realtek-Fixup-for-HP-x360-laptops-with-B-O-
+ patches.drivers/ALSA-hda-realtek-adjust-the-location-of-one-mic
+ patches.drivers/ALSA-hda-realtek-change-the-location-for-one-of-two2
+ patches.drivers/ALSA-hda-realtek-Fix-the-problem-of-two-front-mics-o
+ patches.drivers/ALSA-hda-realtek-Fix-mic-and-headset-jack-sense-on-A
+ patches.drivers/ALSA-hda-add-a-new-condition-to-check-if-it-is-think
+ patches.drivers/ALSA-hda-add-dock-and-led-support-for-HP-EliteBook-8
+ patches.drivers/ALSA-hda-add-dock-and-led-support-for-HP-ProBook-640
+ patches.drivers/ALSA-hda-Enable-power_save_node-for-CX20722
+ patches.drivers/ALSA-hda-silence-uninitialized-variable-warning-in-a
patches.drivers/ASoC-wm_adsp-Fix-validation-of-firmware-and-coeff-le
@@ -17374,6 +17421,9 @@
patches.drivers/platform-x86-sony-laptop-Fix-error-handling-in-sony_
patches.drivers/platform-x86-acer-wmi-setup-accelerometer-when-ACPI-
+ patches.drivers/thinkpad_acpi-Add-support-for-HKEY-version-0x200
+ patches.drivers/platform-x86-thinkpad_acpi-Adding-new-hotkey-ID-for-
+
patches.drivers/power-bq27xxx-fix-reading-for-bq27000-and-bq27010
patches.drivers/power-bq27xxx_battery-Fix-bq27541-AveragePower-regis
patches.drivers/power-ipaq-micro-battery-freeing-the-wrong-variable