Merge branch 'main' of github.com:PikaOS-Linux/pika-kernel-builder
This commit is contained in:
commit
07301d5e9f
3083
patches/0001-Add-legion-laptop-v0.1.patch
Normal file
3083
patches/0001-Add-legion-laptop-v0.1.patch
Normal file
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,257 @@
|
||||
From 498e88ae626be4f523063c8a7027b4b02eca31d2 Mon Sep 17 00:00:00 2001
|
||||
From: GloriousEggroll <gloriouseggroll@gmail.com>
|
||||
Date: Tue, 17 Jan 2023 12:08:46 -0700
|
||||
Subject: [PATCH] Allow to set custom USB pollrate for specific devices like
|
||||
so: usbcore.interrupt_interval_override=045e:00db:16,1bcf:0005:1
|
||||
|
||||
---
|
||||
.../admin-guide/kernel-parameters.txt | 8 +
|
||||
drivers/usb/core/config.c | 170 +++++++++++++++++-
|
||||
drivers/usb/core/usb.c | 1 +
|
||||
drivers/usb/core/usb.h | 1 +
|
||||
4 files changed, 179 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt
|
||||
index dbd26fde4..c9b8b80af 100644
|
||||
--- a/Documentation/admin-guide/kernel-parameters.txt
|
||||
+++ b/Documentation/admin-guide/kernel-parameters.txt
|
||||
@@ -6552,6 +6552,14 @@
|
||||
delay after resetting its port);
|
||||
Example: quirks=0781:5580:bk,0a5c:5834:gij
|
||||
|
||||
+ usbcore.interrupt_interval_override=
|
||||
+ [USB] A list of USB devices for which a different polling
|
||||
+ interval than the default shall be used on all interrupt-type
|
||||
+ endpoints. The format is VendorID:ProductID:interval, with
|
||||
+ the vendor and product ids specified hexadecimally, and the
|
||||
+ interval decimally in milliseconds.
|
||||
+ Example: interrupt_interval_override=045e:00db:16,1bcf:0005:2
|
||||
+
|
||||
usbhid.mousepoll=
|
||||
[USBHID] The interval which mice are to be polled at.
|
||||
|
||||
diff --git a/drivers/usb/core/config.c b/drivers/usb/core/config.c
|
||||
index 48bc8a481..84bd550ad 100644
|
||||
--- a/drivers/usb/core/config.c
|
||||
+++ b/drivers/usb/core/config.c
|
||||
@@ -19,6 +19,149 @@
|
||||
#define USB_MAXCONFIG 8 /* Arbitrary limit */
|
||||
|
||||
|
||||
+/* A struct associated with the interrupt_interval_override module parameter, representing
|
||||
+ an user's choice to force a specific interrupt interval upon all interrupt endpoints of
|
||||
+ a certain device. */
|
||||
+struct interrupt_interval_override {
|
||||
+ /* The vendor ID of the device of which the interrupt interval shall be overridden */
|
||||
+ u16 vendor;
|
||||
+ /* The product ID of the device of which the interrupt interval shall be overridden */
|
||||
+ u16 product;
|
||||
+ /* The new interval measured in milliseconds that shall be given to all endpoints of type interrupt on said device */
|
||||
+ unsigned int interval;
|
||||
+};
|
||||
+
|
||||
+static DEFINE_MUTEX(interrupt_interval_override_mutex);
|
||||
+static char interrupt_interval_override_param[128];
|
||||
+static struct interrupt_interval_override *interrupt_interval_override_list = NULL;
|
||||
+static size_t interrupt_interval_override_count = 0;
|
||||
+
|
||||
+static int interrupt_interval_override_param_set(const char *value, const struct kernel_param *kp)
|
||||
+{
|
||||
+ const char *p;
|
||||
+ unsigned short vendor, product;
|
||||
+ unsigned int interval;
|
||||
+ struct interrupt_interval_override* list;
|
||||
+ struct interrupt_interval_override param;
|
||||
+ size_t count, max_count, i, len;
|
||||
+ int err, res;
|
||||
+
|
||||
+ mutex_lock(&interrupt_interval_override_mutex);
|
||||
+
|
||||
+ if (!value || !*value) {
|
||||
+ /* Unset the current variable. */
|
||||
+ kfree(interrupt_interval_override_list);
|
||||
+ interrupt_interval_override_list = NULL;
|
||||
+ interrupt_interval_override_count = 0;
|
||||
+ param_set_copystring(value, kp); /* Does not fail: the empty string is short enough to fit. */
|
||||
+ mutex_unlock(&interrupt_interval_override_mutex);
|
||||
+ return 0;
|
||||
+ }
|
||||
+
|
||||
+ /* Compute an upper bound on the amount of entries we need. */
|
||||
+ for (max_count = 1, i = 0; value[i]; i++) {
|
||||
+ if (value[i] == ',')
|
||||
+ max_count++;
|
||||
+ }
|
||||
+
|
||||
+ /* Ensure we can allocate enough memory before overwriting the global variables. */
|
||||
+ list = kcalloc(max_count,
|
||||
+ sizeof(struct interrupt_interval_override),
|
||||
+ GFP_KERNEL);
|
||||
+
|
||||
+ if (!list) {
|
||||
+ mutex_unlock(&interrupt_interval_override_mutex);
|
||||
+ return -ENOMEM;
|
||||
+ }
|
||||
+
|
||||
+ err = param_set_copystring(value, kp);
|
||||
+ if (err) {
|
||||
+ kfree(list);
|
||||
+ mutex_unlock(&interrupt_interval_override_mutex);
|
||||
+ return err;
|
||||
+ }
|
||||
+
|
||||
+ /* Parse the parameter. Example of a valid parameter: 045e:00db:16,1bcf:0005:2 */
|
||||
+ for (count = 0, p = (const char*)value; p && *p;) {
|
||||
+ res = sscanf(p, "%hx:%hx:%d%zn", &vendor, &product, &interval, &len);
|
||||
+
|
||||
+ /* Check whether all variables (vendor, product, interval, len) were assigned.
|
||||
+ %zn does not increase the assignment count, so we need to check for value 3 instead of 4.
|
||||
+ %zn does not consume input either, so setting len shouldn't fail if interval has been properly set. */
|
||||
+ if (res != 3) {
|
||||
+ pr_warn("Error while parsing USB interrupt interval override parameter %s.\n", value);
|
||||
+ break;
|
||||
+ }
|
||||
+
|
||||
+ param.vendor = (u16)vendor;
|
||||
+ param.product = (u16)product;
|
||||
+ param.interval = interval;
|
||||
+ list[count++] = param;
|
||||
+
|
||||
+ p += len;
|
||||
+ if (*p == ',' && *(p+1) != '\0') {
|
||||
+ p++;
|
||||
+ continue;
|
||||
+ } else if(*p == '\0' || (*p == '\n' && *(p+1) == '\0')) {
|
||||
+ break;
|
||||
+ } else {
|
||||
+ pr_warn("Error while parsing USB interrupt interval override parameter %s.\n", value);
|
||||
+ break;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ /* Overwrite the global variables with the local ones. */
|
||||
+ kfree(interrupt_interval_override_list);
|
||||
+ interrupt_interval_override_list = list;
|
||||
+ interrupt_interval_override_count = count;
|
||||
+ mutex_unlock(&interrupt_interval_override_mutex);
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static const struct kernel_param_ops interrupt_interval_override_param_ops = {
|
||||
+ .set = interrupt_interval_override_param_set,
|
||||
+ .get = param_get_string,
|
||||
+};
|
||||
+
|
||||
+static struct kparam_string interrupt_interval_override_param_string = {
|
||||
+ .maxlen = sizeof(interrupt_interval_override_param),
|
||||
+ .string = interrupt_interval_override_param,
|
||||
+};
|
||||
+
|
||||
+device_param_cb(interrupt_interval_override,
|
||||
+ &interrupt_interval_override_param_ops,
|
||||
+ &interrupt_interval_override_param_string,
|
||||
+ 0644);
|
||||
+MODULE_PARM_DESC(interrupt_interval_override,
|
||||
+ "Override the polling interval of all interrupt-type endpoints of a specific USB"
|
||||
+ " device by specifying interrupt_interval_override=vendorID:productID:interval.");
|
||||
+
|
||||
+/* Given an USB device, this checks whether the user has specified they want to override the interrupt
|
||||
+ polling interval on all interrupt-type endpoints of said device.
|
||||
+
|
||||
+ This function returns the user-desired amount of milliseconds between interrupts on said endpoint.
|
||||
+ If this function returns zero, the device-requested interrupt interval should be used. */
|
||||
+static unsigned int usb_check_interrupt_interval_override(struct usb_device* udev)
|
||||
+{
|
||||
+ size_t i;
|
||||
+ unsigned int res;
|
||||
+ u16 vendor = le16_to_cpu(udev->descriptor.idVendor);
|
||||
+ u16 product = le16_to_cpu(udev->descriptor.idProduct);
|
||||
+
|
||||
+ mutex_lock(&interrupt_interval_override_mutex);
|
||||
+ for (i = 0; i < interrupt_interval_override_count; i++) {
|
||||
+ if (interrupt_interval_override_list[i].vendor == vendor
|
||||
+ && interrupt_interval_override_list[i].product == product) {
|
||||
+
|
||||
+ res = interrupt_interval_override_list[i].interval;
|
||||
+ mutex_unlock(&interrupt_interval_override_mutex);
|
||||
+ return res;
|
||||
+ }
|
||||
+ }
|
||||
+ mutex_unlock(&interrupt_interval_override_mutex);
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
static inline const char *plural(int n)
|
||||
{
|
||||
return (n == 1 ? "" : "s");
|
||||
@@ -261,7 +404,7 @@ static int usb_parse_endpoint(struct device *ddev, int cfgno,
|
||||
struct usb_endpoint_descriptor *d;
|
||||
struct usb_host_endpoint *endpoint;
|
||||
int n, i, j, retval;
|
||||
- unsigned int maxp;
|
||||
+ unsigned int maxp, ival;
|
||||
const unsigned short *maxpacket_maxes;
|
||||
|
||||
d = (struct usb_endpoint_descriptor *) buffer;
|
||||
@@ -386,6 +529,23 @@ static int usb_parse_endpoint(struct device *ddev, int cfgno,
|
||||
endpoint->desc.bInterval = n;
|
||||
}
|
||||
|
||||
+ /* Override the interrupt polling interval if a module parameter tells us to do so. */
|
||||
+ if (usb_endpoint_xfer_int(d)) {
|
||||
+ ival = usb_check_interrupt_interval_override(udev);
|
||||
+ if (ival > 0) {
|
||||
+ switch (udev->speed) {
|
||||
+ case USB_SPEED_SUPER_PLUS:
|
||||
+ case USB_SPEED_SUPER:
|
||||
+ case USB_SPEED_HIGH:
|
||||
+ endpoint->desc.bInterval = fls(ival) + 3;
|
||||
+ break;
|
||||
+ default: /* USB_SPEED_FULL or _LOW */
|
||||
+ endpoint->desc.bInterval = ival;
|
||||
+ break;
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
/* Some buggy low-speed devices have Bulk endpoints, which is
|
||||
* explicitly forbidden by the USB spec. In an attempt to make
|
||||
* them usable, we will try treating them as Interrupt endpoints.
|
||||
@@ -1092,3 +1252,11 @@ int usb_get_bos_descriptor(struct usb_device *dev)
|
||||
usb_release_bos_descriptor(dev);
|
||||
return ret;
|
||||
}
|
||||
+
|
||||
+void usb_release_interrupt_interval_override_list(void)
|
||||
+{
|
||||
+ mutex_lock(&interrupt_interval_override_mutex);
|
||||
+ kfree(interrupt_interval_override_list);
|
||||
+ interrupt_interval_override_list = NULL;
|
||||
+ mutex_unlock(&interrupt_interval_override_mutex);
|
||||
+}
|
||||
diff --git a/drivers/usb/core/usb.c b/drivers/usb/core/usb.c
|
||||
index 11b15d7b3..ec52c6322 100644
|
||||
--- a/drivers/usb/core/usb.c
|
||||
+++ b/drivers/usb/core/usb.c
|
||||
@@ -1066,6 +1066,7 @@ static void __exit usb_exit(void)
|
||||
return;
|
||||
|
||||
usb_release_quirk_list();
|
||||
+ usb_release_interrupt_interval_override_list();
|
||||
usb_deregister_device_driver(&usb_generic_driver);
|
||||
usb_major_cleanup();
|
||||
usb_deregister(&usbfs_driver);
|
||||
diff --git a/drivers/usb/core/usb.h b/drivers/usb/core/usb.h
|
||||
index 82538daac..b6faa897c 100644
|
||||
--- a/drivers/usb/core/usb.h
|
||||
+++ b/drivers/usb/core/usb.h
|
||||
@@ -37,6 +37,7 @@ extern void usb_authorize_interface(struct usb_interface *);
|
||||
extern void usb_detect_quirks(struct usb_device *udev);
|
||||
extern void usb_detect_interface_quirks(struct usb_device *udev);
|
||||
extern void usb_release_quirk_list(void);
|
||||
+extern void usb_release_interrupt_interval_override_list(void);
|
||||
extern bool usb_endpoint_is_ignored(struct usb_device *udev,
|
||||
struct usb_host_interface *intf,
|
||||
struct usb_endpoint_descriptor *epd);
|
||||
--
|
||||
2.39.0
|
78
patches/amdgpu-si-cik-default.patch
Normal file
78
patches/amdgpu-si-cik-default.patch
Normal file
@ -0,0 +1,78 @@
|
||||
From e55f6f53ab572901f826fb66d385eaa7d1210bb5 Mon Sep 17 00:00:00 2001
|
||||
From: Jan200101 <sentrycraft123@gmail.com>
|
||||
Date: Tue, 22 Mar 2022 17:52:14 +0100
|
||||
Subject: [PATCH] drm/amdgpu: enable SI and CIK support by default
|
||||
|
||||
Signed-off-by: Jan200101 <sentrycraft123@gmail.com>
|
||||
---
|
||||
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 14 ++------------
|
||||
drivers/gpu/drm/radeon/radeon_drv.c | 10 ++++++++++
|
||||
2 files changed, 12 insertions(+), 12 deletions(-)
|
||||
|
||||
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
|
||||
index 0ead08ba58c2..95a59d203922 100644
|
||||
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
|
||||
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
|
||||
@@ -575,15 +575,10 @@ module_param_named(timeout_period, amdgpu_watchdog_timer.period, uint, 0644);
|
||||
*/
|
||||
#ifdef CONFIG_DRM_AMDGPU_SI
|
||||
|
||||
-#if defined(CONFIG_DRM_RADEON) || defined(CONFIG_DRM_RADEON_MODULE)
|
||||
-int amdgpu_si_support = 0;
|
||||
-MODULE_PARM_DESC(si_support, "SI support (1 = enabled, 0 = disabled (default))");
|
||||
-#else
|
||||
int amdgpu_si_support = 1;
|
||||
MODULE_PARM_DESC(si_support, "SI support (1 = enabled (default), 0 = disabled)");
|
||||
-#endif
|
||||
-
|
||||
module_param_named(si_support, amdgpu_si_support, int, 0444);
|
||||
+
|
||||
#endif
|
||||
|
||||
/**
|
||||
@@ -594,15 +589,10 @@ module_param_named(si_support, amdgpu_si_support, int, 0444);
|
||||
*/
|
||||
#ifdef CONFIG_DRM_AMDGPU_CIK
|
||||
|
||||
-#if defined(CONFIG_DRM_RADEON) || defined(CONFIG_DRM_RADEON_MODULE)
|
||||
-int amdgpu_cik_support = 0;
|
||||
-MODULE_PARM_DESC(cik_support, "CIK support (1 = enabled, 0 = disabled (default))");
|
||||
-#else
|
||||
int amdgpu_cik_support = 1;
|
||||
MODULE_PARM_DESC(cik_support, "CIK support (1 = enabled (default), 0 = disabled)");
|
||||
-#endif
|
||||
-
|
||||
module_param_named(cik_support, amdgpu_cik_support, int, 0444);
|
||||
+
|
||||
#endif
|
||||
|
||||
/**
|
||||
diff --git a/drivers/gpu/drm/radeon/radeon_drv.c b/drivers/gpu/drm/radeon/radeon_drv.c
|
||||
index 956c72b5aa33..5102711ece53 100644
|
||||
--- a/drivers/gpu/drm/radeon/radeon_drv.c
|
||||
+++ b/drivers/gpu/drm/radeon/radeon_drv.c
|
||||
@@ -272,12 +272,22 @@ module_param_named(uvd, radeon_uvd, int, 0444);
|
||||
MODULE_PARM_DESC(vce, "vce enable/disable vce support (1 = enable, 0 = disable)");
|
||||
module_param_named(vce, radeon_vce, int, 0444);
|
||||
|
||||
+#ifdef CONFIG_DRM_AMDGPU_SI
|
||||
+int radeon_si_support = 0;
|
||||
+MODULE_PARM_DESC(si_support, "SI support (1 = enabled, 0 = disabled (default))");
|
||||
+#else
|
||||
int radeon_si_support = 1;
|
||||
MODULE_PARM_DESC(si_support, "SI support (1 = enabled (default), 0 = disabled)");
|
||||
+#endif
|
||||
module_param_named(si_support, radeon_si_support, int, 0444);
|
||||
|
||||
+#ifdef CONFIG_DRM_AMDGPU_CIK
|
||||
+int radeon_cik_support = 0;
|
||||
+MODULE_PARM_DESC(cik_support, "CIK support (1 = enabled, 0 = disabled (default))");
|
||||
+#else
|
||||
int radeon_cik_support = 1;
|
||||
MODULE_PARM_DESC(cik_support, "CIK support (1 = enabled (default), 0 = disabled)");
|
||||
+#endif
|
||||
module_param_named(cik_support, radeon_cik_support, int, 0444);
|
||||
|
||||
static struct pci_device_id pciidlist[] = {
|
||||
--
|
||||
2.35.1
|
@ -0,0 +1,43 @@
|
||||
From ca89780690f7492c2d357e0ed2213a1d027341ae Mon Sep 17 00:00:00 2001
|
||||
From: Sultan Alsawaf <sultan@kerneltoast.com>
|
||||
Date: Sun, 29 May 2022 01:32:19 -0700
|
||||
Subject: [PATCH] mt76: mt7921: Disable powersave features by default
|
||||
|
||||
This brings WiFi latency down considerably and makes latency consistent by
|
||||
disabling runtime PM and typical powersave features by default. The actual
|
||||
power consumption difference is inconsequential on desktops and laptops,
|
||||
while the performance difference is monumental. Latencies of 20+ ms are no
|
||||
longer observed after this change, and the connection is much more stable.
|
||||
|
||||
Signed-off-by: Sultan Alsawaf <sultan@kerneltoast.com>
|
||||
---
|
||||
drivers/net/wireless/mediatek/mt76/mt7921/init.c | 9 ++-------
|
||||
1 file changed, 2 insertions(+), 7 deletions(-)
|
||||
|
||||
diff --git a/drivers/net/wireless/mediatek/mt76/mt7921/init.c b/drivers/net/wireless/mediatek/mt76/mt7921/init.c
|
||||
index 91fc41922d95..cfa0bb51004d 100644
|
||||
--- a/drivers/net/wireless/mediatek/mt76/mt7921/init.c
|
||||
+++ b/drivers/net/wireless/mediatek/mt76/mt7921/init.c
|
||||
@@ -67,7 +67,8 @@
|
||||
|
||||
wiphy->iface_combinations = if_comb;
|
||||
wiphy->flags &= ~(WIPHY_FLAG_IBSS_RSN | WIPHY_FLAG_4ADDR_AP |
|
||||
- WIPHY_FLAG_4ADDR_STATION);
|
||||
+ WIPHY_FLAG_4ADDR_STATION |
|
||||
+ WIPHY_FLAG_PS_ON_BY_DEFAULT);
|
||||
wiphy->interface_modes = BIT(NL80211_IFTYPE_STATION) |
|
||||
BIT(NL80211_IFTYPE_AP);
|
||||
wiphy->n_iface_combinations = ARRAY_SIZE(if_comb);
|
||||
@@ -266,12 +267,6 @@ int mt7921_register_device(struct mt7921_dev *dev)
|
||||
dev->pm.idle_timeout = MT7921_PM_TIMEOUT;
|
||||
dev->pm.stats.last_wake_event = jiffies;
|
||||
dev->pm.stats.last_doze_event = jiffies;
|
||||
- if (!mt76_is_usb(&dev->mt76)) {
|
||||
- dev->pm.enable_user = true;
|
||||
- dev->pm.enable = true;
|
||||
- dev->pm.ds_enable_user = true;
|
||||
- dev->pm.ds_enable = true;
|
||||
- }
|
||||
|
||||
if (!mt76_is_mmio(&dev->mt76))
|
||||
hw->extra_tx_headroom += MT_SDIO_TXD_SIZE + MT_SDIO_HDR_SIZE;
|
15
patches/set-ps4-bt-poll-rate-1000hz.patch
Normal file
15
patches/set-ps4-bt-poll-rate-1000hz.patch
Normal file
@ -0,0 +1,15 @@
|
||||
diff --git a/drivers/hid/hid-sony.c b/drivers/hid/hid-sony.c
|
||||
index 03691cdcf..85c697291 100644
|
||||
--- a/drivers/hid/hid-sony.c
|
||||
+++ b/drivers/hid/hid-sony.c
|
||||
@@ -526,8 +526,8 @@ struct motion_output_report_02 {
|
||||
#define SENSOR_SUFFIX " Motion Sensors"
|
||||
#define DS4_TOUCHPAD_SUFFIX " Touchpad"
|
||||
|
||||
-/* Default to 4ms poll interval, which is same as USB (not adjustable). */
|
||||
-#define DS4_BT_DEFAULT_POLL_INTERVAL_MS 4
|
||||
+/* Default to 1ms poll interval (1000Hz, lower latency). */
|
||||
+#define DS4_BT_DEFAULT_POLL_INTERVAL_MS 1
|
||||
#define DS4_BT_MAX_POLL_INTERVAL_MS 62
|
||||
#define DS4_GYRO_RES_PER_DEG_S 1024
|
||||
#define DS4_ACC_RES_PER_G 8192
|
@ -10,4 +10,15 @@ patch -Np1 < "../patches/0002-cfs-nice.patch"
|
||||
# orig patch from cachy - 0001-bore-cachy.patch
|
||||
patch -Np1 < "../patches/0003-bore.patch"
|
||||
# HDR patch - from cachy (but they deleted it)
|
||||
patch -Np1 < "../patches/0004-hdr.patch"
|
||||
patch -Np1 < "../patches/0004-hdr.patch"
|
||||
# Nobara patches are here: https://github.com/sammilucia/nobara-kernel-fork
|
||||
# Extra Leigon laptop goodies
|
||||
patch -Np1 < "../0001-Add-legion-laptop-v0.1.patch"
|
||||
# Allow setting custom pollrates for usb devices
|
||||
patch -Np1 < "../0001-Allow-to-set-custom-USB-pollrate-for-specific-device.patch"
|
||||
# Allow pre polaris cards to use the amdgpu kernel module
|
||||
patch -Np1 < "../amdgpu-si-cik-default.patch"
|
||||
# Disable mt76 buggy aspm
|
||||
patch -Np1 < "../mt76_-mt7921_-Disable-powersave-features-by-default.patch"
|
||||
# Make PS4 controllers have 1000hz pollrate over bluetooth like the actual console
|
||||
patch -Np1 < "../set-ps4-bt-poll-rate-1000hz.patch"
|
||||
|
Loading…
Reference in New Issue
Block a user