]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
5.4-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 17 Feb 2020 11:57:05 +0000 (12:57 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 17 Feb 2020 11:57:05 +0000 (12:57 +0100)
added patches:
acpi-ec-fix-flushing-of-pending-work.patch
acpi-pm-s2idle-avoid-possible-race-related-to-the-ec-gpe.patch
acpi-pm-s2idle-prevent-spurious-scis-from-waking-up-the-system.patch
acpica-introduce-acpi_any_gpe_status_set.patch
alsa-hda-realtek-add-more-codec-supported-headset-button.patch
alsa-hda-realtek-fix-silent-output-on-msi-gl73.patch
alsa-usb-audio-apply-sample-rate-quirk-for-audioengine-d1.patch
alsa-usb-audio-fix-uac2-3-effect-unit-parsing.patch
input-synaptics-enable-smbus-on-thinkpad-l470.patch
input-synaptics-remove-the-len0049-dmi-id-from-topbuttonpad-list.patch
input-synaptics-switch-t470s-to-rmi4-by-default.patch

queue-5.4/acpi-ec-fix-flushing-of-pending-work.patch [new file with mode: 0644]
queue-5.4/acpi-pm-s2idle-avoid-possible-race-related-to-the-ec-gpe.patch [new file with mode: 0644]
queue-5.4/acpi-pm-s2idle-prevent-spurious-scis-from-waking-up-the-system.patch [new file with mode: 0644]
queue-5.4/acpica-introduce-acpi_any_gpe_status_set.patch [new file with mode: 0644]
queue-5.4/alsa-hda-realtek-add-more-codec-supported-headset-button.patch [new file with mode: 0644]
queue-5.4/alsa-hda-realtek-fix-silent-output-on-msi-gl73.patch [new file with mode: 0644]
queue-5.4/alsa-usb-audio-apply-sample-rate-quirk-for-audioengine-d1.patch [new file with mode: 0644]
queue-5.4/alsa-usb-audio-fix-uac2-3-effect-unit-parsing.patch [new file with mode: 0644]
queue-5.4/input-synaptics-enable-smbus-on-thinkpad-l470.patch [new file with mode: 0644]
queue-5.4/input-synaptics-remove-the-len0049-dmi-id-from-topbuttonpad-list.patch [new file with mode: 0644]
queue-5.4/input-synaptics-switch-t470s-to-rmi4-by-default.patch [new file with mode: 0644]

diff --git a/queue-5.4/acpi-ec-fix-flushing-of-pending-work.patch b/queue-5.4/acpi-ec-fix-flushing-of-pending-work.patch
new file mode 100644 (file)
index 0000000..2883b9a
--- /dev/null
@@ -0,0 +1,152 @@
+From f0ac20c3f6137910c8a927953e8a92f5b3716166 Mon Sep 17 00:00:00 2001
+From: "Rafael J. Wysocki" <rafael.j.wysocki@intel.com>
+Date: Tue, 11 Feb 2020 10:07:43 +0100
+Subject: ACPI: EC: Fix flushing of pending work
+
+From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
+
+commit f0ac20c3f6137910c8a927953e8a92f5b3716166 upstream.
+
+Commit 016b87ca5c8c ("ACPI: EC: Rework flushing of pending work")
+introduced a subtle bug into the flushing of pending EC work while
+suspended to idle, which may cause the EC driver to fail to
+re-enable the EC GPE after handling a non-wakeup event (like a
+battery status change event, for example).
+
+The problem is that the work item flushed by flush_scheduled_work()
+in __acpi_ec_flush_work() may disable the EC GPE and schedule another
+work item expected to re-enable it, but that new work item is not
+flushed, so __acpi_ec_flush_work() returns with the EC GPE disabled
+and the CPU running it goes into an idle state subsequently.  If all
+of the other CPUs are in idle states at that point, the EC GPE won't
+be re-enabled until at least one CPU is woken up by another interrupt
+source, so system wakeup events that would normally come from the EC
+then don't work.
+
+This is reproducible on a Dell XPS13 9360 in my office which
+sometimes stops reacting to power button and lid events (triggered
+by the EC on that machine) after switching from AC power to battery
+power or vice versa while suspended to idle (each of those switches
+causes the EC GPE to trigger for several times in a row, but they
+are not system wakeup events).
+
+To avoid this problem, it is necessary to drain the workqueue
+entirely in __acpi_ec_flush_work(), but that cannot be done with
+respect to system_wq, because work items may be added to it from
+other places while __acpi_ec_flush_work() is running.  For this
+reason, make the EC driver use a dedicated workqueue for EC events
+processing (let that workqueue be ordered so that EC events are
+processed sequentially) and use drain_workqueue() on it in
+__acpi_ec_flush_work().
+
+Fixes: 016b87ca5c8c ("ACPI: EC: Rework flushing of pending work")
+Cc: 5.4+ <stable@vger.kernel.org> # 5.4+
+Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/acpi/ec.c |   44 ++++++++++++++++++++++++++------------------
+ 1 file changed, 26 insertions(+), 18 deletions(-)
+
+--- a/drivers/acpi/ec.c
++++ b/drivers/acpi/ec.c
+@@ -179,6 +179,7 @@ EXPORT_SYMBOL(first_ec);
+ static struct acpi_ec *boot_ec;
+ static bool boot_ec_is_ecdt = false;
++static struct workqueue_struct *ec_wq;
+ static struct workqueue_struct *ec_query_wq;
+ static int EC_FLAGS_QUERY_HANDSHAKE; /* Needs QR_EC issued when SCI_EVT set */
+@@ -461,7 +462,7 @@ static void acpi_ec_submit_query(struct
+               ec_dbg_evt("Command(%s) submitted/blocked",
+                          acpi_ec_cmd_string(ACPI_EC_COMMAND_QUERY));
+               ec->nr_pending_queries++;
+-              schedule_work(&ec->work);
++              queue_work(ec_wq, &ec->work);
+       }
+ }
+@@ -527,7 +528,7 @@ static void acpi_ec_enable_event(struct
+ #ifdef CONFIG_PM_SLEEP
+ static void __acpi_ec_flush_work(void)
+ {
+-      flush_scheduled_work(); /* flush ec->work */
++      drain_workqueue(ec_wq); /* flush ec->work */
+       flush_workqueue(ec_query_wq); /* flush queries */
+ }
+@@ -548,8 +549,8 @@ static void acpi_ec_disable_event(struct
+ void acpi_ec_flush_work(void)
+ {
+-      /* Without ec_query_wq there is nothing to flush. */
+-      if (!ec_query_wq)
++      /* Without ec_wq there is nothing to flush. */
++      if (!ec_wq)
+               return;
+       __acpi_ec_flush_work();
+@@ -2032,25 +2033,33 @@ static struct acpi_driver acpi_ec_driver
+       .drv.pm = &acpi_ec_pm,
+ };
+-static inline int acpi_ec_query_init(void)
++static void acpi_ec_destroy_workqueues(void)
+ {
+-      if (!ec_query_wq) {
+-              ec_query_wq = alloc_workqueue("kec_query", 0,
+-                                            ec_max_queries);
+-              if (!ec_query_wq)
+-                      return -ENODEV;
++      if (ec_wq) {
++              destroy_workqueue(ec_wq);
++              ec_wq = NULL;
+       }
+-      return 0;
+-}
+-
+-static inline void acpi_ec_query_exit(void)
+-{
+       if (ec_query_wq) {
+               destroy_workqueue(ec_query_wq);
+               ec_query_wq = NULL;
+       }
+ }
++static int acpi_ec_init_workqueues(void)
++{
++      if (!ec_wq)
++              ec_wq = alloc_ordered_workqueue("kec", 0);
++
++      if (!ec_query_wq)
++              ec_query_wq = alloc_workqueue("kec_query", 0, ec_max_queries);
++
++      if (!ec_wq || !ec_query_wq) {
++              acpi_ec_destroy_workqueues();
++              return -ENODEV;
++      }
++      return 0;
++}
++
+ static const struct dmi_system_id acpi_ec_no_wakeup[] = {
+       {
+               .ident = "Thinkpad X1 Carbon 6th",
+@@ -2081,8 +2090,7 @@ int __init acpi_ec_init(void)
+       int result;
+       int ecdt_fail, dsdt_fail;
+-      /* register workqueue for _Qxx evaluations */
+-      result = acpi_ec_query_init();
++      result = acpi_ec_init_workqueues();
+       if (result)
+               return result;
+@@ -2113,6 +2121,6 @@ static void __exit acpi_ec_exit(void)
+ {
+       acpi_bus_unregister_driver(&acpi_ec_driver);
+-      acpi_ec_query_exit();
++      acpi_ec_destroy_workqueues();
+ }
+ #endif        /* 0 */
diff --git a/queue-5.4/acpi-pm-s2idle-avoid-possible-race-related-to-the-ec-gpe.patch b/queue-5.4/acpi-pm-s2idle-avoid-possible-race-related-to-the-ec-gpe.patch
new file mode 100644 (file)
index 0000000..097e3b3
--- /dev/null
@@ -0,0 +1,132 @@
+From e3728b50cd9be7d4b1469447cdf1feb93e3b7adb Mon Sep 17 00:00:00 2001
+From: "Rafael J. Wysocki" <rafael.j.wysocki@intel.com>
+Date: Tue, 11 Feb 2020 10:11:02 +0100
+Subject: ACPI: PM: s2idle: Avoid possible race related to the EC GPE
+
+From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
+
+commit e3728b50cd9be7d4b1469447cdf1feb93e3b7adb upstream.
+
+It is theoretically possible for the ACPI EC GPE to be set after the
+s2idle_ops->wake() called from s2idle_loop() has returned and before
+the subsequent pm_wakeup_pending() check is carried out.  If that
+happens, the resulting wakeup event will cause the system to resume
+even though it may be a spurious one.
+
+To avoid that race, first make the ->wake() callback in struct
+platform_s2idle_ops return a bool value indicating whether or not
+to let the system resume and rearrange s2idle_loop() to use that
+value instad of the direct pm_wakeup_pending() call if ->wake() is
+present.
+
+Next, rework acpi_s2idle_wake() to process EC events and check
+pm_wakeup_pending() before re-arming the SCI for system wakeup
+to prevent it from triggering prematurely and add comments to
+that function to explain the rationale for the new code flow.
+
+Fixes: 56b991849009 ("PM: sleep: Simplify suspend-to-idle control flow")
+Cc: 5.4+ <stable@vger.kernel.org> # 5.4+
+Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/acpi/sleep.c    |   46 ++++++++++++++++++++++++++++++++--------------
+ include/linux/suspend.h |    2 +-
+ kernel/power/suspend.c  |    9 +++++----
+ 3 files changed, 38 insertions(+), 19 deletions(-)
+
+--- a/drivers/acpi/sleep.c
++++ b/drivers/acpi/sleep.c
+@@ -977,21 +977,28 @@ static int acpi_s2idle_prepare_late(void
+       return 0;
+ }
+-static void acpi_s2idle_wake(void)
++static bool acpi_s2idle_wake(void)
+ {
+-      /*
+-       * If IRQD_WAKEUP_ARMED is set for the SCI at this point, the SCI has
+-       * not triggered while suspended, so bail out.
+-       */
+-      if (!acpi_sci_irq_valid() ||
+-          irqd_is_wakeup_armed(irq_get_irq_data(acpi_sci_irq)))
+-              return;
+-
+-      /*
+-       * If there are EC events to process, the wakeup may be a spurious one
+-       * coming from the EC.
+-       */
+-      if (acpi_ec_dispatch_gpe()) {
++      if (!acpi_sci_irq_valid())
++              return pm_wakeup_pending();
++
++      while (pm_wakeup_pending()) {
++              /*
++               * If IRQD_WAKEUP_ARMED is set for the SCI at this point, the
++               * SCI has not triggered while suspended, so bail out (the
++               * wakeup is pending anyway and the SCI is not the source of
++               * it).
++               */
++              if (irqd_is_wakeup_armed(irq_get_irq_data(acpi_sci_irq)))
++                      return true;
++
++              /*
++               * If there are no EC events to process, the wakeup is regarded
++               * as a genuine one.
++               */
++              if (!acpi_ec_dispatch_gpe())
++                      return true;
++
+               /*
+                * Cancel the wakeup and process all pending events in case
+                * there are any wakeup ones in there.
+@@ -1009,8 +1016,19 @@ static void acpi_s2idle_wake(void)
+               acpi_ec_flush_work();
+               acpi_os_wait_events_complete(); /* synchronize Notify handling */
++              /*
++               * The SCI is in the "suspended" state now and it cannot produce
++               * new wakeup events till the rearming below, so if any of them
++               * are pending here, they must be resulting from the processing
++               * of EC events above or coming from somewhere else.
++               */
++              if (pm_wakeup_pending())
++                      return true;
++
+               rearm_wake_irq(acpi_sci_irq);
+       }
++
++      return false;
+ }
+ static void acpi_s2idle_restore_early(void)
+--- a/include/linux/suspend.h
++++ b/include/linux/suspend.h
+@@ -191,7 +191,7 @@ struct platform_s2idle_ops {
+       int (*begin)(void);
+       int (*prepare)(void);
+       int (*prepare_late)(void);
+-      void (*wake)(void);
++      bool (*wake)(void);
+       void (*restore_early)(void);
+       void (*restore)(void);
+       void (*end)(void);
+--- a/kernel/power/suspend.c
++++ b/kernel/power/suspend.c
+@@ -131,11 +131,12 @@ static void s2idle_loop(void)
+        * to avoid them upfront.
+        */
+       for (;;) {
+-              if (s2idle_ops && s2idle_ops->wake)
+-                      s2idle_ops->wake();
+-
+-              if (pm_wakeup_pending())
++              if (s2idle_ops && s2idle_ops->wake) {
++                      if (s2idle_ops->wake())
++                              break;
++              } else if (pm_wakeup_pending()) {
+                       break;
++              }
+               pm_wakeup_clear(false);
diff --git a/queue-5.4/acpi-pm-s2idle-prevent-spurious-scis-from-waking-up-the-system.patch b/queue-5.4/acpi-pm-s2idle-prevent-spurious-scis-from-waking-up-the-system.patch
new file mode 100644 (file)
index 0000000..15b9351
--- /dev/null
@@ -0,0 +1,47 @@
+From fdde0ff8590b4c1c41b3227f5ac4265fccccb96b Mon Sep 17 00:00:00 2001
+From: "Rafael J. Wysocki" <rafael.j.wysocki@intel.com>
+Date: Tue, 11 Feb 2020 17:53:52 +0100
+Subject: ACPI: PM: s2idle: Prevent spurious SCIs from waking up the system
+
+From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
+
+commit fdde0ff8590b4c1c41b3227f5ac4265fccccb96b upstream.
+
+If the platform triggers a spurious SCI even though the status bit
+is not set for any GPE when the system is suspended to idle, it will
+be treated as a genuine wakeup, so avoid that by checking if any GPEs
+are active at all before returning 'true' from acpi_s2idle_wake().
+
+Link: https://bugzilla.kernel.org/show_bug.cgi?id=206413
+Fixes: 56b991849009 ("PM: sleep: Simplify suspend-to-idle control flow")
+Reported-by: Tsuchiya Yuto <kitakar@gmail.com>
+Cc: 5.4+ <stable@vger.kernel.org> # 5.4+
+Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/acpi/sleep.c |   12 +++++++++---
+ 1 file changed, 9 insertions(+), 3 deletions(-)
+
+--- a/drivers/acpi/sleep.c
++++ b/drivers/acpi/sleep.c
+@@ -993,10 +993,16 @@ static bool acpi_s2idle_wake(void)
+                       return true;
+               /*
+-               * If there are no EC events to process, the wakeup is regarded
+-               * as a genuine one.
++               * If there are no EC events to process and at least one of the
++               * other enabled GPEs is active, the wakeup is regarded as a
++               * genuine one.
++               *
++               * Note that the checks below must be carried out in this order
++               * to avoid returning prematurely due to a change of the EC GPE
++               * status bit from unset to set between the checks with the
++               * status bits of all the other GPEs unset.
+                */
+-              if (!acpi_ec_dispatch_gpe())
++              if (acpi_any_gpe_status_set() && !acpi_ec_dispatch_gpe())
+                       return true;
+               /*
diff --git a/queue-5.4/acpica-introduce-acpi_any_gpe_status_set.patch b/queue-5.4/acpica-introduce-acpi_any_gpe_status_set.patch
new file mode 100644 (file)
index 0000000..d1d4a76
--- /dev/null
@@ -0,0 +1,173 @@
+From ea128834dd76f9a72a35d011c651fa96658f06a7 Mon Sep 17 00:00:00 2001
+From: "Rafael J. Wysocki" <rafael.j.wysocki@intel.com>
+Date: Tue, 11 Feb 2020 17:52:32 +0100
+Subject: ACPICA: Introduce acpi_any_gpe_status_set()
+
+From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
+
+commit ea128834dd76f9a72a35d011c651fa96658f06a7 upstream.
+
+Introduce a new helper function, acpi_any_gpe_status_set(), for
+checking the status bits of all enabled GPEs in one go.
+
+It is needed to distinguish spurious SCIs from genuine ones when
+deciding whether or not to wake up the system from suspend-to-idle.
+
+Cc: 5.4+ <stable@vger.kernel.org> # 5.4+
+Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/acpi/acpica/achware.h |    2 +
+ drivers/acpi/acpica/evxfgpe.c |   32 ++++++++++++++++++
+ drivers/acpi/acpica/hwgpe.c   |   71 ++++++++++++++++++++++++++++++++++++++++++
+ include/acpi/acpixf.h         |    1 
+ 4 files changed, 106 insertions(+)
+
+--- a/drivers/acpi/acpica/achware.h
++++ b/drivers/acpi/acpica/achware.h
+@@ -101,6 +101,8 @@ acpi_status acpi_hw_enable_all_runtime_g
+ acpi_status acpi_hw_enable_all_wakeup_gpes(void);
++u8 acpi_hw_check_all_gpes(void);
++
+ acpi_status
+ acpi_hw_enable_runtime_gpe_block(struct acpi_gpe_xrupt_info *gpe_xrupt_info,
+                                struct acpi_gpe_block_info *gpe_block,
+--- a/drivers/acpi/acpica/evxfgpe.c
++++ b/drivers/acpi/acpica/evxfgpe.c
+@@ -795,6 +795,38 @@ acpi_status acpi_enable_all_wakeup_gpes(
+ ACPI_EXPORT_SYMBOL(acpi_enable_all_wakeup_gpes)
++/******************************************************************************
++ *
++ * FUNCTION:    acpi_any_gpe_status_set
++ *
++ * PARAMETERS:  None
++ *
++ * RETURN:      Whether or not the status bit is set for any GPE
++ *
++ * DESCRIPTION: Check the status bits of all enabled GPEs and return TRUE if any
++ *              of them is set or FALSE otherwise.
++ *
++ ******************************************************************************/
++u32 acpi_any_gpe_status_set(void)
++{
++      acpi_status status;
++      u8 ret;
++
++      ACPI_FUNCTION_TRACE(acpi_any_gpe_status_set);
++
++      status = acpi_ut_acquire_mutex(ACPI_MTX_EVENTS);
++      if (ACPI_FAILURE(status)) {
++              return (FALSE);
++      }
++
++      ret = acpi_hw_check_all_gpes();
++      (void)acpi_ut_release_mutex(ACPI_MTX_EVENTS);
++
++      return (ret);
++}
++
++ACPI_EXPORT_SYMBOL(acpi_any_gpe_status_set)
++
+ /*******************************************************************************
+  *
+  * FUNCTION:    acpi_install_gpe_block
+--- a/drivers/acpi/acpica/hwgpe.c
++++ b/drivers/acpi/acpica/hwgpe.c
+@@ -446,6 +446,53 @@ acpi_hw_enable_wakeup_gpe_block(struct a
+ /******************************************************************************
+  *
++ * FUNCTION:    acpi_hw_get_gpe_block_status
++ *
++ * PARAMETERS:  gpe_xrupt_info      - GPE Interrupt info
++ *              gpe_block           - Gpe Block info
++ *
++ * RETURN:      Success
++ *
++ * DESCRIPTION: Produce a combined GPE status bits mask for the given block.
++ *
++ ******************************************************************************/
++
++static acpi_status
++acpi_hw_get_gpe_block_status(struct acpi_gpe_xrupt_info *gpe_xrupt_info,
++                           struct acpi_gpe_block_info *gpe_block,
++                           void *ret_ptr)
++{
++      struct acpi_gpe_register_info *gpe_register_info;
++      u64 in_enable, in_status;
++      acpi_status status;
++      u8 *ret = ret_ptr;
++      u32 i;
++
++      /* Examine each GPE Register within the block */
++
++      for (i = 0; i < gpe_block->register_count; i++) {
++              gpe_register_info = &gpe_block->register_info[i];
++
++              status = acpi_hw_read(&in_enable,
++                                    &gpe_register_info->enable_address);
++              if (ACPI_FAILURE(status)) {
++                      continue;
++              }
++
++              status = acpi_hw_read(&in_status,
++                                    &gpe_register_info->status_address);
++              if (ACPI_FAILURE(status)) {
++                      continue;
++              }
++
++              *ret |= in_enable & in_status;
++      }
++
++      return (AE_OK);
++}
++
++/******************************************************************************
++ *
+  * FUNCTION:    acpi_hw_disable_all_gpes
+  *
+  * PARAMETERS:  None
+@@ -510,4 +557,28 @@ acpi_status acpi_hw_enable_all_wakeup_gp
+       return_ACPI_STATUS(status);
+ }
++/******************************************************************************
++ *
++ * FUNCTION:    acpi_hw_check_all_gpes
++ *
++ * PARAMETERS:  None
++ *
++ * RETURN:      Combined status of all GPEs
++ *
++ * DESCRIPTION: Check all enabled GPEs in all GPE blocks and return TRUE if the
++ *              status bit is set for at least one of them of FALSE otherwise.
++ *
++ ******************************************************************************/
++
++u8 acpi_hw_check_all_gpes(void)
++{
++      u8 ret = 0;
++
++      ACPI_FUNCTION_TRACE(acpi_hw_check_all_gpes);
++
++      (void)acpi_ev_walk_gpe_list(acpi_hw_get_gpe_block_status, &ret);
++
++      return (ret != 0);
++}
++
+ #endif                                /* !ACPI_REDUCED_HARDWARE */
+--- a/include/acpi/acpixf.h
++++ b/include/acpi/acpixf.h
+@@ -748,6 +748,7 @@ ACPI_HW_DEPENDENT_RETURN_UINT32(u32 acpi
+ ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status acpi_disable_all_gpes(void))
+ ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status acpi_enable_all_runtime_gpes(void))
+ ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status acpi_enable_all_wakeup_gpes(void))
++ACPI_HW_DEPENDENT_RETURN_UINT32(u32 acpi_any_gpe_status_set(void))
+ ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status
+                               acpi_get_gpe_device(u32 gpe_index,
diff --git a/queue-5.4/alsa-hda-realtek-add-more-codec-supported-headset-button.patch b/queue-5.4/alsa-hda-realtek-add-more-codec-supported-headset-button.patch
new file mode 100644 (file)
index 0000000..691bc87
--- /dev/null
@@ -0,0 +1,35 @@
+From 2b3b6497c38d123934de68ea82a247b557d95290 Mon Sep 17 00:00:00 2001
+From: Kailang Yang <kailang@realtek.com>
+Date: Mon, 10 Feb 2020 16:15:14 +0800
+Subject: ALSA: hda/realtek - Add more codec supported Headset Button
+
+From: Kailang Yang <kailang@realtek.com>
+
+commit 2b3b6497c38d123934de68ea82a247b557d95290 upstream.
+
+Add supported Headset Button for ALC215/ALC285/ALC289.
+
+Signed-off-by: Kailang Yang <kailang@realtek.com>
+Cc: <stable@vger.kernel.org>
+Link: https://lore.kernel.org/r/948f70b4488f4cc2b629a39ce4e4be33@realtek.com
+Signed-off-by: Takashi Iwai <tiwai@suse.de>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ sound/pci/hda/patch_realtek.c |    3 +++
+ 1 file changed, 3 insertions(+)
+
+--- a/sound/pci/hda/patch_realtek.c
++++ b/sound/pci/hda/patch_realtek.c
+@@ -5701,8 +5701,11 @@ static void alc_fixup_headset_jack(struc
+               break;
+       case HDA_FIXUP_ACT_INIT:
+               switch (codec->core.vendor_id) {
++              case 0x10ec0215:
+               case 0x10ec0225:
++              case 0x10ec0285:
+               case 0x10ec0295:
++              case 0x10ec0289:
+               case 0x10ec0299:
+                       alc_write_coef_idx(codec, 0x48, 0xd011);
+                       alc_update_coef_idx(codec, 0x49, 0x007f, 0x0045);
diff --git a/queue-5.4/alsa-hda-realtek-fix-silent-output-on-msi-gl73.patch b/queue-5.4/alsa-hda-realtek-fix-silent-output-on-msi-gl73.patch
new file mode 100644 (file)
index 0000000..171ded3
--- /dev/null
@@ -0,0 +1,33 @@
+From 7dafba3762d6c0083ded00a48f8c1a158bc86717 Mon Sep 17 00:00:00 2001
+From: Takashi Iwai <tiwai@suse.de>
+Date: Wed, 12 Feb 2020 09:10:47 +0100
+Subject: ALSA: hda/realtek - Fix silent output on MSI-GL73
+
+From: Takashi Iwai <tiwai@suse.de>
+
+commit 7dafba3762d6c0083ded00a48f8c1a158bc86717 upstream.
+
+MSI-GL73 laptop with ALC1220 codec requires a similar workaround for
+Clevo laptops to enforce the DAC/mixer connection path.  Set up a
+quirk entry for that.
+
+BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=204159
+Cc: <stable@vger.kernel.org>
+Link: https://lore.kernel.org/r/20200212081047.27727-1-tiwai@suse.de
+Signed-off-by: Takashi Iwai <tiwai@suse.de>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ 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
+@@ -2447,6 +2447,7 @@ static const struct snd_pci_quirk alc882
+       SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC882_FIXUP_EAPD),
+       SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte EP45-DS3/Z87X-UD3H", ALC889_FIXUP_FRONT_HP_NO_PRESENCE),
+       SND_PCI_QUIRK(0x1458, 0xa0b8, "Gigabyte AZ370-Gaming", ALC1220_FIXUP_GB_DUAL_CODECS),
++      SND_PCI_QUIRK(0x1462, 0x1276, "MSI-GL73", ALC1220_FIXUP_CLEVO_P950),
+       SND_PCI_QUIRK(0x1462, 0x7350, "MSI-7350", ALC889_FIXUP_CD),
+       SND_PCI_QUIRK(0x1462, 0xda57, "MSI Z270-Gaming", ALC1220_FIXUP_GB_DUAL_CODECS),
+       SND_PCI_QUIRK_VENDOR(0x1462, "MSI", ALC882_FIXUP_GPIO3),
diff --git a/queue-5.4/alsa-usb-audio-apply-sample-rate-quirk-for-audioengine-d1.patch b/queue-5.4/alsa-usb-audio-apply-sample-rate-quirk-for-audioengine-d1.patch
new file mode 100644 (file)
index 0000000..3401027
--- /dev/null
@@ -0,0 +1,47 @@
+From 93f9d1a4ac5930654c17412e3911b46ece73755a Mon Sep 17 00:00:00 2001
+From: Arvind Sankar <nivedita@alum.mit.edu>
+Date: Tue, 11 Feb 2020 11:22:35 -0500
+Subject: ALSA: usb-audio: Apply sample rate quirk for Audioengine D1
+
+From: Arvind Sankar <nivedita@alum.mit.edu>
+
+commit 93f9d1a4ac5930654c17412e3911b46ece73755a upstream.
+
+The Audioengine D1 (0x2912:0x30c8) does support reading the sample rate,
+but it returns the rate in byte-reversed order.
+
+When setting sampling rate, the driver produces these warning messages:
+[168840.944226] usb 3-2.2: current rate 4500480 is different from the runtime rate 44100
+[168854.930414] usb 3-2.2: current rate 8436480 is different from the runtime rate 48000
+[168905.185825] usb 3-2.1.2: current rate 30465 is different from the runtime rate 96000
+
+As can be seen from the hexadecimal conversion, the current rate read
+back is byte-reversed from the rate that was set.
+
+44100 == 0x00ac44, 4500480 == 0x44ac00
+48000 == 0x00bb80, 8436480 == 0x80bb00
+96000 == 0x017700,   30465 == 0x007701
+
+Rather than implementing a new quirk to reverse the order, just skip
+checking the rate to avoid spamming the log.
+
+Signed-off-by: Arvind Sankar <nivedita@alum.mit.edu>
+Cc: <stable@vger.kernel.org>
+Link: https://lore.kernel.org/r/20200211162235.1639889-1-nivedita@alum.mit.edu
+Signed-off-by: Takashi Iwai <tiwai@suse.de>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ sound/usb/quirks.c |    1 +
+ 1 file changed, 1 insertion(+)
+
+--- a/sound/usb/quirks.c
++++ b/sound/usb/quirks.c
+@@ -1402,6 +1402,7 @@ bool snd_usb_get_sample_rate_quirk(struc
+       case USB_ID(0x1395, 0x740a): /* Sennheiser DECT */
+       case USB_ID(0x1901, 0x0191): /* GE B850V3 CP2114 audio interface */
+       case USB_ID(0x21B4, 0x0081): /* AudioQuest DragonFly */
++      case USB_ID(0x2912, 0x30c8): /* Audioengine D1 */
+               return true;
+       }
diff --git a/queue-5.4/alsa-usb-audio-fix-uac2-3-effect-unit-parsing.patch b/queue-5.4/alsa-usb-audio-fix-uac2-3-effect-unit-parsing.patch
new file mode 100644 (file)
index 0000000..bb5f5ce
--- /dev/null
@@ -0,0 +1,84 @@
+From d75a170fd848f037a1e28893ad10be7a4c51f8a6 Mon Sep 17 00:00:00 2001
+From: Takashi Iwai <tiwai@suse.de>
+Date: Tue, 11 Feb 2020 17:05:21 +0100
+Subject: ALSA: usb-audio: Fix UAC2/3 effect unit parsing
+
+From: Takashi Iwai <tiwai@suse.de>
+
+commit d75a170fd848f037a1e28893ad10be7a4c51f8a6 upstream.
+
+We've got a regression report about M-Audio Fast Track C400 device,
+and the git bisection resulted in the commit e0ccdef92653 ("ALSA:
+usb-audio: Clean up check_input_term()").  This commit was about the
+rewrite of the input terminal parser, and it's not too obvious from
+the change what really broke.  The answer is: it's the interpretation
+of UAC2/3 effect units.
+
+In the original code, UAC2 effect unit is as if through UAC1
+processing unit because both UAC1 PU and UAC2/3 EU share the same
+number (0x07).  The old code went through a complex switch-case
+fallthrough, finally bailing out in the middle:
+
+  if (protocol == UAC_VERSION_2 &&
+      hdr[2] == UAC2_EFFECT_UNIT) {
+         /* UAC2/UAC1 unit IDs overlap here in an
+          * uncompatible way. Ignore this unit for now.
+          */
+         return 0;
+   }
+
+... and this special handling was missing in the new code; the new
+code treats UAC2/3 effect unit as if it were equivalent with the
+processing unit.
+
+Actually, the old code was too confusing.  The effect unit has an
+incompatible unit description with the processing unit, so we
+shouldn't have dealt with EU in the same way.
+
+This patch addresses the regression by changing the effect unit
+handling to the own parser function.  The own parser function makes
+the clear distinct with PU, so it improves the readability, too.
+
+The EU parser just sets the type and the id like the old kernels.
+Once when the proper effect unit support is added, we can revisit this
+parser function, but for now, let's keep this simple setup as is.
+
+Fixes: e0ccdef92653 ("ALSA: usb-audio: Clean up check_input_term()")
+Cc: <stable@vger.kernel.org>
+BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=206147
+Link: https://lore.kernel.org/r/20200211160521.31990-1-tiwai@suse.de
+Signed-off-by: Takashi Iwai <tiwai@suse.de>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ sound/usb/mixer.c |   12 ++++++++++--
+ 1 file changed, 10 insertions(+), 2 deletions(-)
+
+--- a/sound/usb/mixer.c
++++ b/sound/usb/mixer.c
+@@ -897,6 +897,15 @@ static int parse_term_proc_unit(struct m
+       return 0;
+ }
++static int parse_term_effect_unit(struct mixer_build *state,
++                                struct usb_audio_term *term,
++                                void *p1, int id)
++{
++      term->type = UAC3_EFFECT_UNIT << 16; /* virtual type */
++      term->id = id;
++      return 0;
++}
++
+ static int parse_term_uac2_clock_source(struct mixer_build *state,
+                                       struct usb_audio_term *term,
+                                       void *p1, int id)
+@@ -981,8 +990,7 @@ static int __check_input_term(struct mix
+                                                   UAC3_PROCESSING_UNIT);
+               case PTYPE(UAC_VERSION_2, UAC2_EFFECT_UNIT):
+               case PTYPE(UAC_VERSION_3, UAC3_EFFECT_UNIT):
+-                      return parse_term_proc_unit(state, term, p1, id,
+-                                                  UAC3_EFFECT_UNIT);
++                      return parse_term_effect_unit(state, term, p1, id);
+               case PTYPE(UAC_VERSION_1, UAC1_EXTENSION_UNIT):
+               case PTYPE(UAC_VERSION_2, UAC2_EXTENSION_UNIT_V2):
+               case PTYPE(UAC_VERSION_3, UAC3_EXTENSION_UNIT):
diff --git a/queue-5.4/input-synaptics-enable-smbus-on-thinkpad-l470.patch b/queue-5.4/input-synaptics-enable-smbus-on-thinkpad-l470.patch
new file mode 100644 (file)
index 0000000..6403f5f
--- /dev/null
@@ -0,0 +1,32 @@
+From b8a3d819f872e0a3a0a6db0dbbcd48071042fb98 Mon Sep 17 00:00:00 2001
+From: Gaurav Agrawal <agrawalgaurav@gnome.org>
+Date: Thu, 13 Feb 2020 17:06:10 -0800
+Subject: Input: synaptics - enable SMBus on ThinkPad L470
+
+From: Gaurav Agrawal <agrawalgaurav@gnome.org>
+
+commit b8a3d819f872e0a3a0a6db0dbbcd48071042fb98 upstream.
+
+Add touchpad LEN2044 to the list, as it is capable of working with
+psmouse.synaptics_intertouch=1
+
+Signed-off-by: Gaurav Agrawal <agrawalgaurav@gnome.org>
+Cc: stable@vger.kernel.org
+Link: https://lore.kernel.org/r/CADdtggVzVJq5gGNmFhKSz2MBwjTpdN5YVOdr4D3Hkkv=KZRc9g@mail.gmail.com
+Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/input/mouse/synaptics.c |    1 +
+ 1 file changed, 1 insertion(+)
+
+--- a/drivers/input/mouse/synaptics.c
++++ b/drivers/input/mouse/synaptics.c
+@@ -180,6 +180,7 @@ static const char * const smbus_pnp_ids[
+       "LEN0097", /* X280 -> ALPS trackpoint */
+       "LEN009b", /* T580 */
+       "LEN200f", /* T450s */
++      "LEN2044", /* L470  */
+       "LEN2054", /* E480 */
+       "LEN2055", /* E580 */
+       "SYN3052", /* HP EliteBook 840 G4 */
diff --git a/queue-5.4/input-synaptics-remove-the-len0049-dmi-id-from-topbuttonpad-list.patch b/queue-5.4/input-synaptics-remove-the-len0049-dmi-id-from-topbuttonpad-list.patch
new file mode 100644 (file)
index 0000000..97d90c2
--- /dev/null
@@ -0,0 +1,44 @@
+From 5179a9dfa9440c1781816e2c9a183d1d2512dc61 Mon Sep 17 00:00:00 2001
+From: Benjamin Tissoires <benjamin.tissoires@redhat.com>
+Date: Thu, 13 Feb 2020 17:07:47 -0800
+Subject: Input: synaptics - remove the LEN0049 dmi id from topbuttonpad list
+
+From: Benjamin Tissoires <benjamin.tissoires@redhat.com>
+
+commit 5179a9dfa9440c1781816e2c9a183d1d2512dc61 upstream.
+
+The Yoga 11e is using LEN0049, but it doesn't have a trackstick.
+
+Thus, there is no need to create a software top buttons row.
+
+However, it seems that the device works under SMBus, so keep it as part
+of the smbus_pnp_ids.
+
+Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
+Cc: stable@vger.kernel.org
+Link: https://lore.kernel.org/r/20200115013023.9710-1-benjamin.tissoires@redhat.com
+Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/input/mouse/synaptics.c |    2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/drivers/input/mouse/synaptics.c
++++ b/drivers/input/mouse/synaptics.c
+@@ -146,7 +146,6 @@ static const char * const topbuttonpad_p
+       "LEN0042", /* Yoga */
+       "LEN0045",
+       "LEN0047",
+-      "LEN0049",
+       "LEN2000", /* S540 */
+       "LEN2001", /* Edge E431 */
+       "LEN2002", /* Edge E531 */
+@@ -166,6 +165,7 @@ static const char * const smbus_pnp_ids[
+       /* all of the topbuttonpad_pnp_ids are valid, we just add some extras */
+       "LEN0048", /* X1 Carbon 3 */
+       "LEN0046", /* X250 */
++      "LEN0049", /* Yoga 11e */
+       "LEN004a", /* W541 */
+       "LEN005b", /* P50 */
+       "LEN005e", /* T560 */
diff --git a/queue-5.4/input-synaptics-switch-t470s-to-rmi4-by-default.patch b/queue-5.4/input-synaptics-switch-t470s-to-rmi4-by-default.patch
new file mode 100644 (file)
index 0000000..848a292
--- /dev/null
@@ -0,0 +1,32 @@
+From bf502391353b928e63096127e5fd8482080203f5 Mon Sep 17 00:00:00 2001
+From: Lyude Paul <lyude@redhat.com>
+Date: Thu, 13 Feb 2020 16:59:15 -0800
+Subject: Input: synaptics - switch T470s to RMI4 by default
+
+From: Lyude Paul <lyude@redhat.com>
+
+commit bf502391353b928e63096127e5fd8482080203f5 upstream.
+
+This supports RMI4 and everything seems to work, including the touchpad
+buttons. So, let's enable this by default.
+
+Signed-off-by: Lyude Paul <lyude@redhat.com>
+Cc: stable@vger.kernel.org
+Link: https://lore.kernel.org/r/20200204194322.112638-1-lyude@redhat.com
+Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/input/mouse/synaptics.c |    1 +
+ 1 file changed, 1 insertion(+)
+
+--- a/drivers/input/mouse/synaptics.c
++++ b/drivers/input/mouse/synaptics.c
+@@ -169,6 +169,7 @@ static const char * const smbus_pnp_ids[
+       "LEN004a", /* W541 */
+       "LEN005b", /* P50 */
+       "LEN005e", /* T560 */
++      "LEN006c", /* T470s */
+       "LEN0071", /* T480 */
+       "LEN0072", /* X1 Carbon Gen 5 (2017) - Elan/ALPS trackpoint */
+       "LEN0073", /* X1 Carbon G5 (Elantech) */