summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThorsten Leemhuis <fedora@leemhuis.info>2020-06-18 07:30:46 +0200
committerThorsten Leemhuis <fedora@leemhuis.info>2020-06-18 07:30:46 +0200
commit4f9aef74d72cad34127c11c93531f94f8dc665d4 (patch)
tree31cafa0bd4dcd01dba172275e676405296d64e20
parent6c387426998e86b168f88b49be1bf6b80f23255d (diff)
parent00a0a7417430f3d386a5f55d8489573bc6534f22 (diff)
downloadkernel-4f9aef74d72cad34127c11c93531f94f8dc665d4.tar.gz
kernel-4f9aef74d72cad34127c11c93531f94f8dc665d4.tar.xz
kernel-4f9aef74d72cad34127c11c93531f94f8dc665d4.zip
-rw-r--r--0001-platform-x86-sony-laptop-SNC-calls-should-handle-BUF.patch114
-rw-r--r--0001-platform-x86-thinkpad_acpi-Add-support-for-dual-fan-.patch136
-rw-r--r--kernel.spec16
-rw-r--r--sources2
4 files changed, 150 insertions, 118 deletions
diff --git a/0001-platform-x86-sony-laptop-SNC-calls-should-handle-BUF.patch b/0001-platform-x86-sony-laptop-SNC-calls-should-handle-BUF.patch
deleted file mode 100644
index dcae360a7..000000000
--- a/0001-platform-x86-sony-laptop-SNC-calls-should-handle-BUF.patch
+++ /dev/null
@@ -1,114 +0,0 @@
-From 47828d22539f76c8c9dcf2a55f18ea3a8039d8ef Mon Sep 17 00:00:00 2001
-From: Mattia Dongili <malattia@linux.it>
-Date: Fri, 8 May 2020 09:14:04 +0900
-Subject: [PATCH] platform/x86: sony-laptop: SNC calls should handle BUFFER
- types
-
-After commit 6d232b29cfce ("ACPICA: Dispatcher: always generate buffer
-objects for ASL create_field() operator") ACPICA creates buffers even
-when new fields are small enough to fit into an integer.
-Many SNC calls counted on the old behaviour.
-Since sony-laptop already handles the INTEGER/BUFFER case in
-sony_nc_buffer_call, switch sony_nc_int_call to use its more generic
-function instead.
-
-Fixes: 6d232b29cfce ("ACPICA: Dispatcher: always generate buffer objects for ASL create_field() operator")
-Reported-by: Dominik Mierzejewski <dominik@greysector.net>
-Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=207491
-Reported-by: William Bader <williambader@hotmail.com>
-Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1830150
-Signed-off-by: Mattia Dongili <malattia@linux.it>
-Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
----
- drivers/platform/x86/sony-laptop.c | 53 +++++++++++++-----------------
- 1 file changed, 23 insertions(+), 30 deletions(-)
-
-diff --git a/drivers/platform/x86/sony-laptop.c b/drivers/platform/x86/sony-laptop.c
-index 51309f7ceede..6932cd11e660 100644
---- a/drivers/platform/x86/sony-laptop.c
-+++ b/drivers/platform/x86/sony-laptop.c
-@@ -757,33 +757,6 @@ static union acpi_object *__call_snc_method(acpi_handle handle, char *method,
- return result;
- }
-
--static int sony_nc_int_call(acpi_handle handle, char *name, int *value,
-- int *result)
--{
-- union acpi_object *object = NULL;
-- if (value) {
-- u64 v = *value;
-- object = __call_snc_method(handle, name, &v);
-- } else
-- object = __call_snc_method(handle, name, NULL);
--
-- if (!object)
-- return -EINVAL;
--
-- if (object->type != ACPI_TYPE_INTEGER) {
-- pr_warn("Invalid acpi_object: expected 0x%x got 0x%x\n",
-- ACPI_TYPE_INTEGER, object->type);
-- kfree(object);
-- return -EINVAL;
-- }
--
-- if (result)
-- *result = object->integer.value;
--
-- kfree(object);
-- return 0;
--}
--
- #define MIN(a, b) (a > b ? b : a)
- static int sony_nc_buffer_call(acpi_handle handle, char *name, u64 *value,
- void *buffer, size_t buflen)
-@@ -795,17 +768,20 @@ static int sony_nc_buffer_call(acpi_handle handle, char *name, u64 *value,
- if (!object)
- return -EINVAL;
-
-- if (object->type == ACPI_TYPE_BUFFER) {
-+ if (!buffer) {
-+ /* do nothing */
-+ } else if (object->type == ACPI_TYPE_BUFFER) {
- len = MIN(buflen, object->buffer.length);
-+ memset(buffer, 0, buflen);
- memcpy(buffer, object->buffer.pointer, len);
-
- } else if (object->type == ACPI_TYPE_INTEGER) {
- len = MIN(buflen, sizeof(object->integer.value));
-+ memset(buffer, 0, buflen);
- memcpy(buffer, &object->integer.value, len);
-
- } else {
-- pr_warn("Invalid acpi_object: expected 0x%x got 0x%x\n",
-- ACPI_TYPE_BUFFER, object->type);
-+ pr_warn("Unexpected acpi_object: 0x%x\n", object->type);
- ret = -EINVAL;
- }
-
-@@ -813,6 +789,23 @@ static int sony_nc_buffer_call(acpi_handle handle, char *name, u64 *value,
- return ret;
- }
-
-+static int sony_nc_int_call(acpi_handle handle, char *name, int *value, int
-+ *result)
-+{
-+ int ret;
-+
-+ if (value) {
-+ u64 v = *value;
-+
-+ ret = sony_nc_buffer_call(handle, name, &v, result,
-+ sizeof(*result));
-+ } else {
-+ ret = sony_nc_buffer_call(handle, name, NULL, result,
-+ sizeof(*result));
-+ }
-+ return ret;
-+}
-+
- struct sony_nc_handles {
- u16 cap[0x10];
- struct device_attribute devattr;
---
-2.26.2
-
diff --git a/0001-platform-x86-thinkpad_acpi-Add-support-for-dual-fan-.patch b/0001-platform-x86-thinkpad_acpi-Add-support-for-dual-fan-.patch
new file mode 100644
index 000000000..4ba03934d
--- /dev/null
+++ b/0001-platform-x86-thinkpad_acpi-Add-support-for-dual-fan-.patch
@@ -0,0 +1,136 @@
+From 14232c6e788cb1f7b96dbd08b077f90923324b24 Mon Sep 17 00:00:00 2001
+From: Lars Hofhansl <larsh@apache.org>
+Date: Thu, 23 Apr 2020 14:57:09 -0700
+Subject: [PATCH] platform/x86: thinkpad_acpi: Add support for dual fan control
+
+This adds dual fan control for the following models:
+P50, P51, P52, P70, P71, P72, P1 gen1, P2 gen2, X1E gen1 and X1E gen2.
+
+Both fans are controlled together as if they were a single fan.
+
+Tested on an X1 Extreme Gen1, an X1 Extreme Gen2, and a P50.
+
+The patch is defensive, it adds only specific supported machines, and falls
+back to the old behavior if both fans cannot be controlled.
+
+Background:
+I tested the BIOS default behavior on my X1E gen2 and both fans are always
+changed together. So rather than adding controls for each fan, this controls
+both fans together as the BIOS would do.
+
+This was inspired by a discussion on dual fan support for the thinkfan tool
+(see link below). All BIOS IDs are taken from there. The X1E gen2 ID is
+verified on my machine.
+
+Thanks to GitHub users voidworker and civic9 for the earlier patches and
+BIOS IDs, and to users peter-stoll and sassman for testing the patch on
+their machines.
+
+BugLink: https://github.com/vmatare/thinkfan/issues/58
+Signed-off-by: Lars Hofhansl <larsh@apache.org>
+[andy: massaged commit message to capitalize ID and convert to BugLink]
+Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
+---
+ drivers/platform/x86/thinkpad_acpi.c | 43 ++++++++++++++++++++++++----
+ 1 file changed, 37 insertions(+), 6 deletions(-)
+
+diff --git a/drivers/platform/x86/thinkpad_acpi.c b/drivers/platform/x86/thinkpad_acpi.c
+index 8eaadbaf8ffa..83b4a83da967 100644
+--- a/drivers/platform/x86/thinkpad_acpi.c
++++ b/drivers/platform/x86/thinkpad_acpi.c
+@@ -318,6 +318,7 @@ static struct {
+ u32 uwb:1;
+ u32 fan_ctrl_status_undef:1;
+ u32 second_fan:1;
++ u32 second_fan_ctl:1;
+ u32 beep_needs_two_args:1;
+ u32 mixer_no_level_control:1;
+ u32 battery_force_primary:1;
+@@ -8324,11 +8325,19 @@ static int fan_set_level(int level)
+
+ switch (fan_control_access_mode) {
+ case TPACPI_FAN_WR_ACPI_SFAN:
+- if (level >= 0 && level <= 7) {
+- if (!acpi_evalf(sfan_handle, NULL, NULL, "vd", level))
+- return -EIO;
+- } else
++ if ((level < 0) || (level > 7))
+ return -EINVAL;
++
++ if (tp_features.second_fan_ctl) {
++ if (!fan_select_fan2() ||
++ !acpi_evalf(sfan_handle, NULL, NULL, "vd", level)) {
++ pr_warn("Couldn't set 2nd fan level, disabling support\n");
++ tp_features.second_fan_ctl = 0;
++ }
++ fan_select_fan1();
++ }
++ if (!acpi_evalf(sfan_handle, NULL, NULL, "vd", level))
++ return -EIO;
+ break;
+
+ case TPACPI_FAN_WR_ACPI_FANS:
+@@ -8345,6 +8354,15 @@ static int fan_set_level(int level)
+ else if (level & TP_EC_FAN_AUTO)
+ level |= 4; /* safety min speed 4 */
+
++ if (tp_features.second_fan_ctl) {
++ if (!fan_select_fan2() ||
++ !acpi_ec_write(fan_status_offset, level)) {
++ pr_warn("Couldn't set 2nd fan level, disabling support\n");
++ tp_features.second_fan_ctl = 0;
++ }
++ fan_select_fan1();
++
++ }
+ if (!acpi_ec_write(fan_status_offset, level))
+ return -EIO;
+ else
+@@ -8763,6 +8781,7 @@ static const struct attribute_group fan_attr_group = {
+
+ #define TPACPI_FAN_Q1 0x0001 /* Unitialized HFSP */
+ #define TPACPI_FAN_2FAN 0x0002 /* EC 0x31 bit 0 selects fan2 */
++#define TPACPI_FAN_2CTL 0x0004 /* selects fan2 control */
+
+ static const struct tpacpi_quirk fan_quirk_table[] __initconst = {
+ TPACPI_QEC_IBM('1', 'Y', TPACPI_FAN_Q1),
+@@ -8771,6 +8790,13 @@ static const struct tpacpi_quirk fan_quirk_table[] __initconst = {
+ TPACPI_QEC_IBM('7', '0', TPACPI_FAN_Q1),
+ TPACPI_QEC_LNV('7', 'M', TPACPI_FAN_2FAN),
+ TPACPI_Q_LNV('N', '1', TPACPI_FAN_2FAN),
++ TPACPI_Q_LNV3('N', '1', 'D', TPACPI_FAN_2CTL), /* P70 */
++ TPACPI_Q_LNV3('N', '1', 'E', TPACPI_FAN_2CTL), /* P50 */
++ TPACPI_Q_LNV3('N', '1', 'T', TPACPI_FAN_2CTL), /* P71 */
++ TPACPI_Q_LNV3('N', '1', 'U', TPACPI_FAN_2CTL), /* P51 */
++ TPACPI_Q_LNV3('N', '2', 'C', TPACPI_FAN_2CTL), /* P52 / P72 */
++ TPACPI_Q_LNV3('N', '2', 'E', TPACPI_FAN_2CTL), /* P1 / X1 Extreme (1st gen) */
++ TPACPI_Q_LNV3('N', '2', 'O', TPACPI_FAN_2CTL), /* P1 / X1 Extreme (2nd gen) */
+ };
+
+ static int __init fan_init(struct ibm_init_struct *iibm)
+@@ -8788,6 +8814,7 @@ static int __init fan_init(struct ibm_init_struct *iibm)
+ fan_watchdog_maxinterval = 0;
+ tp_features.fan_ctrl_status_undef = 0;
+ tp_features.second_fan = 0;
++ tp_features.second_fan_ctl = 0;
+ fan_control_desired_level = 7;
+
+ if (tpacpi_is_ibm()) {
+@@ -8812,8 +8839,12 @@ static int __init fan_init(struct ibm_init_struct *iibm)
+ fan_quirk1_setup();
+ if (quirks & TPACPI_FAN_2FAN) {
+ tp_features.second_fan = 1;
+- dbg_printk(TPACPI_DBG_INIT | TPACPI_DBG_FAN,
+- "secondary fan support enabled\n");
++ pr_info("secondary fan support enabled\n");
++ }
++ if (quirks & TPACPI_FAN_2CTL) {
++ tp_features.second_fan = 1;
++ tp_features.second_fan_ctl = 1;
++ pr_info("secondary fan control enabled\n");
+ }
+ } else {
+ pr_err("ThinkPad ACPI EC access misbehaving, fan status and control unavailable\n");
+--
+2.26.2
+
diff --git a/kernel.spec b/kernel.spec
index c99491b73..4aeaa7d7a 100644
--- a/kernel.spec
+++ b/kernel.spec
@@ -94,7 +94,7 @@ Summary: The Linux kernel
%define stable_rc 0
# Do we have a -stable update to apply?
-%define stable_update 18
+%define stable_update 19
# Set rpm version accordingly
%if 0%{?stable_update}
%define stablerev %{stable_update}
@@ -932,8 +932,8 @@ Patch518: vfio-pci-block-user-access-to-disabled-device-MMIO.patch
# rhbz 1789545
Patch519: vboxguest-fixes.patch
-# rhbz 1830150
-Patch520: 0001-platform-x86-sony-laptop-SNC-calls-should-handle-BUF.patch
+# Thinkpad dual fan control
+Patch521: 0001-platform-x86-thinkpad_acpi-Add-support-for-dual-fan-.patch
# END OF PATCH DEFINITIONS
@@ -2968,6 +2968,16 @@ fi
#
#
%changelog
+* Wed Jun 17 2020 Justin M. Forbes <jforbes@fedoraproject.org> - 5.6.19-200
+- Linux v5.6.19
+
+* Mon Jun 15 2020 Stefan Assmann <sassmann@redhat.com>
+- Add dual fan control for P50, P51, P52, P70, P71, P72, P1 gen1, P2 gen2,
+ X1E gen1 and X1E gen2.
+
+* Wed Jun 10 2020 Justin M. Forbes <jforbes@fedoraproject.org> - 5.6.18-200
+- Linux v5.6.18
+
* Mon Jun 08 2020 Justin M. Forbes <jforbes@fedoraproject.org> - 5.6.17-200
- Linux v5.6.17
diff --git a/sources b/sources
index 06183057e..067ac998e 100644
--- a/sources
+++ b/sources
@@ -1,2 +1,2 @@
SHA512 (linux-5.6.tar.xz) = 80846fe2b4e4a7ff471d2dde28a8216ae807a3209f959e93d39ea4fc9a189ea28ec3db9d303b3fe15a28c2cb90e7446876678e93e23353c2d6f262e364a06bc9
-SHA512 (patch-5.6.18.xz) = c7191fdaf6bd231a38a41b4a876f7855b1038a8b2be52882aba8ac42704b5e4101ff151b29991233a7db6c8d191e2a547a78a00c027d79f63d4e99054aefb9ba
+SHA512 (patch-5.6.19.xz) = f967f9ffc12249db757bd38fd890ac69d327f23bcb767ffa0c178aa7e541bb4a10715664d703315ac3b96ed35909046350f97752c2a4691526ad55a9f03f2c24