From ad654b4a28dfc9ed63c9bafa598b37574a60111f Mon Sep 17 00:00:00 2001 From: ferrreo Date: Mon, 10 Apr 2023 20:36:24 +0100 Subject: [PATCH] Update patches and config for 6.3 --- config | 91 +++++++++++- main.sh | 2 - patches/0005-amd-usbc-fix.patch | 19 --- patches/0006-Nintendo-controller-one.patch | 165 ++++++++++++++++----- patches/0006-Nintendo-controller-two.patch | 160 +++++++------------- patches/set-ps4-bt-poll-rate-1000hz.patch | 15 -- scripts/config.sh | 2 +- scripts/patch.sh | 14 +- 8 files changed, 277 insertions(+), 191 deletions(-) delete mode 100644 patches/0005-amd-usbc-fix.patch delete mode 100644 patches/set-ps4-bt-poll-rate-1000hz.patch diff --git a/config b/config index 32d8691..8a79d3d 100644 --- a/config +++ b/config @@ -272,6 +272,7 @@ CONFIG_RD_LZO=y CONFIG_RD_LZ4=y CONFIG_RD_ZSTD=y CONFIG_BOOT_CONFIG=y +CONFIG_BOOT_CONFIG_FORCE=n # CONFIG_BOOT_CONFIG_EMBED is not set CONFIG_INITRAMFS_PRESERVE_MTIME=y # CONFIG_CC_OPTIMIZE_FOR_PERFORMANCE is not set @@ -1136,6 +1137,7 @@ CONFIG_ZSWAP_ZPOOL_DEFAULT="z3fold" CONFIG_ZBUD=y CONFIG_Z3FOLD=y CONFIG_ZSMALLOC=y +CONFIG_ZSMALLOC_CHAIN_SIZE=8 # CONFIG_ZSMALLOC_STAT is not set # @@ -2082,6 +2084,7 @@ CONFIG_BT_VIRTIO=m CONFIG_AF_RXRPC=m CONFIG_AF_RXRPC_IPV6=y +CONFIG_AF_RXRPC_INJECT_RX_DELAY=n # CONFIG_AF_RXRPC_INJECT_LOSS is not set CONFIG_AF_RXRPC_DEBUG=y CONFIG_RXKAD=y @@ -2975,7 +2978,22 @@ CONFIG_PATA_TOSHIBA=m CONFIG_PATA_TRIFLEX=m CONFIG_PATA_VIA=m CONFIG_PATA_WINBOND=m - +CONFIG_PATA_PARPORT=m +CONFIG_PATA_PARPORT_ATEN=m +CONFIG_PATA_PARPORT_BPCK=m +CONFIG_PATA_PARPORT_COMM=m +CONFIG_PATA_PARPORT_DSTR=m +CONFIG_PATA_PARPORT_FIT2=m +CONFIG_PATA_PARPORT_FIT3=m +CONFIG_PATA_PARPORT_EPAT=m +CONFIG_PATA_PARPORT_EPATC8=y +CONFIG_PATA_PARPORT_EPIA=m +CONFIG_PATA_PARPORT_FRIQ=m +CONFIG_PATA_PARPORT_FRPW=m +CONFIG_PATA_PARPORT_KBIC=m +CONFIG_PATA_PARPORT_KTTI=m +CONFIG_PATA_PARPORT_ON20=m +CONFIG_PATA_PARPORT_ON26=m # # PIO-only SFF controllers # @@ -3162,6 +3180,7 @@ CONFIG_NET_DSA_MV88E6060=m CONFIG_NET_DSA_MICROCHIP_KSZ_COMMON=m CONFIG_NET_DSA_MICROCHIP_KSZ9477_I2C=m CONFIG_NET_DSA_MICROCHIP_KSZ_SPI=m +CONFIG_NET_DSA_MICROCHIP_KSZ_PTP=y CONFIG_NET_DSA_MICROCHIP_KSZ8863_SMI=m CONFIG_NET_DSA_MV88E6XXX=m CONFIG_NET_DSA_MV88E6XXX_PTP=y @@ -3174,6 +3193,7 @@ CONFIG_NET_DSA_SJA1105_TAS=y CONFIG_NET_DSA_SJA1105_VL=y CONFIG_NET_DSA_XRS700X=m CONFIG_NET_DSA_XRS700X_I2C=m +CONFIG_NET_DSA_MSCC_OCELOT_EXT=m CONFIG_NET_DSA_XRS700X_MDIO=m CONFIG_NET_DSA_REALTEK=m # CONFIG_NET_DSA_REALTEK_MDIO is not set @@ -3516,6 +3536,7 @@ CONFIG_DWC_XLGMAC_PCI=m CONFIG_NET_VENDOR_TEHUTI=y CONFIG_TEHUTI=m CONFIG_NET_VENDOR_TI=y +CONFIG_NCN26000_PHY=m # CONFIG_TI_CPSW_PHY_SEL is not set CONFIG_TLAN=m CONFIG_NET_VENDOR_VERTEXCOM=y @@ -3825,6 +3846,9 @@ CONFIG_ATH11K_DEBUG=y CONFIG_ATH11K_DEBUGFS=y # CONFIG_ATH11K_TRACING is not set CONFIG_ATH11K_SPECTRAL=y +CONFIG_ATH12K=m +CONFIG_ATH12K_DEBUG=y +CONFIG_ATH12K_TRACING=n CONFIG_WLAN_VENDOR_ATMEL=y CONFIG_ATMEL=m CONFIG_PCI_ATMEL=m @@ -4521,6 +4545,8 @@ CONFIG_LDISC_AUTOLOAD=y # # Serial drivers # +CONFIG_SERIAL_8250_PCI1XXXX=m +CONFIG_SERIAL_8250_DFL=m CONFIG_SERIAL_EARLYCON=y CONFIG_SERIAL_8250=y # CONFIG_SERIAL_8250_DEPRECATED_OPTIONS is not set @@ -5144,6 +5170,8 @@ CONFIG_BATTERY_GAUGE_LTC2941=m CONFIG_BATTERY_GOLDFISH=m CONFIG_BATTERY_RT5033=m CONFIG_CHARGER_RT9455=m +CONFIG_CHARGER_RT9467=m +CONFIG_CHARGER_RT9471=m CONFIG_CHARGER_CROS_USBPD=m CONFIG_CHARGER_CROS_PCHG=m CONFIG_CHARGER_BD99954=m @@ -5202,6 +5230,7 @@ CONFIG_SENSORS_F71805F=m CONFIG_SENSORS_F71882FG=m CONFIG_SENSORS_F75375S=m CONFIG_SENSORS_MC13783_ADC=m +CONFIG_SENSORS_MC34VR500=m CONFIG_SENSORS_FSCHMD=m CONFIG_SENSORS_FTSTEUTATES=m CONFIG_SENSORS_GL518SM=m @@ -5318,6 +5347,8 @@ CONFIG_SENSORS_MAX8688=m CONFIG_SENSORS_MP2888=m CONFIG_SENSORS_MP2975=m CONFIG_SENSORS_MP5023=m +CONFIG_SENSORS_MPQ7932=m +CONFIG_SENSORS_MPQ7932_REGULATOR=y CONFIG_SENSORS_PIM4328=m CONFIG_SENSORS_PLI1209BC=m CONFIG_SENSORS_PLI1209BC_REGULATOR=y @@ -5325,6 +5356,8 @@ CONFIG_SENSORS_PM6764TR=m CONFIG_SENSORS_PXE1610=m CONFIG_SENSORS_Q54SJ108A2=m CONFIG_SENSORS_STPDDC60=m +CONFIG_SENSORS_TDA38640=m +CONFIG_SENSORS_TDA38640_REGULATOR=y CONFIG_SENSORS_TPS40422=m CONFIG_SENSORS_TPS53679=m CONFIG_SENSORS_TPS546D24=m @@ -5691,6 +5724,8 @@ CONFIG_MFD_ATC260X=m CONFIG_MFD_ATC260X_I2C=m CONFIG_RAVE_SP_CORE=m CONFIG_MFD_INTEL_M10_BMC=m +CONFIG_MFD_INTEL_M10_BMC_SPI=m +CONFIG_MFD_INTEL_M10_BMC_PMCI=m # end of Multifunction device drivers CONFIG_REGULATOR=y @@ -5742,6 +5777,7 @@ CONFIG_REGULATOR_MAX8998=m CONFIG_REGULATOR_MAX20086=m CONFIG_REGULATOR_MAX77693=m CONFIG_REGULATOR_MAX77826=m +CONFIG_REGULATOR_MAX20411=m CONFIG_REGULATOR_MC13XXX_CORE=m CONFIG_REGULATOR_MC13783=m CONFIG_REGULATOR_MC13892=m @@ -5872,6 +5908,9 @@ CONFIG_MEDIA_TEST_SUPPORT=y CONFIG_VIDEO_DEV=m CONFIG_MEDIA_CONTROLLER=y CONFIG_DVB_CORE=m +CONFIG_DVB_AV7110=m +CONFIG_DVB_AV7110_OSD=y +CONFIG_DVB_BUDGET_PATCH=m # # Video4Linux options @@ -6078,6 +6117,9 @@ CONFIG_VIDEO_SOLO6X10=m CONFIG_VIDEO_TW5864=m CONFIG_VIDEO_TW68=m CONFIG_VIDEO_TW686X=m +CONFIG_VIDEO_HEXIUM_GEMINI=m +CONFIG_VIDEO_HEXIUM_ORION=m +CONFIG_VIDEO_MXB=m # CONFIG_VIDEO_ZORAN is not set # @@ -6116,6 +6158,10 @@ CONFIG_VIDEO_SAA7164=m # # Media digital TV PCI Adapters # +CONFIG_DVB_BUDGET_CORE=m +CONFIG_DVB_BUDGET=m +CONFIG_DVB_BUDGET_CI=m +CONFIG_DVB_BUDGET_AV=m CONFIG_DVB_B2C2_FLEXCOP_PCI=m # CONFIG_DVB_B2C2_FLEXCOP_PCI_DEBUG is not set CONFIG_DVB_DDBRIDGE=m @@ -6329,6 +6375,7 @@ CONFIG_VIDEO_IMX274=m CONFIG_VIDEO_IMX290=m CONFIG_VIDEO_IMX319=m CONFIG_VIDEO_IMX355=m +CONFIG_VIDEO_IMX296=m CONFIG_VIDEO_MAX9271_LIB=m CONFIG_VIDEO_MT9M001=m CONFIG_VIDEO_MT9M032=m @@ -6366,6 +6413,7 @@ CONFIG_VIDEO_OV772X=m CONFIG_VIDEO_OV7740=m CONFIG_VIDEO_OV8856=m CONFIG_VIDEO_OV8865=m +CONFIG_VIDEO_OV8858=m CONFIG_VIDEO_OV9640=m CONFIG_VIDEO_OV9650=m CONFIG_VIDEO_OV9734=m @@ -6760,6 +6808,8 @@ CONFIG_DRM_PANEL=y # CONFIG_DRM_PANEL_RASPBERRYPI_TOUCHSCREEN=m CONFIG_DRM_PANEL_WIDECHIPS_WS2401=m +CONFIG_DRM_PANEL_AUO_A030JTN01=m +CONFIG_DRM_PANEL_ORISETECH_OTA5601A=m # end of Display Panels CONFIG_DRM_BRIDGE=y @@ -6916,6 +6966,7 @@ CONFIG_BACKLIGHT_LV5207LP=m CONFIG_BACKLIGHT_BD6107=m CONFIG_BACKLIGHT_ARCXCNN=m CONFIG_BACKLIGHT_RAVE_SP=m +CONFIG_BACKLIGHT_KTZ8866=m # end of Backlight & LCD device support CONFIG_VIDEOMODE_HELPERS=y @@ -6939,6 +6990,8 @@ CONFIG_FRAMEBUFFER_CONSOLE_DEFERRED_TAKEOVER=y # end of Graphics support CONFIG_DRM_ACCEL=y +CONFIG_DRM_ACCEL_HABANALABS=m +CONFIG_DRM_ACCEL_IVPU=m CONFIG_SOUND=m CONFIG_SOUND_OSS_CORE=y # CONFIG_SOUND_OSS_CORE_PRECLAIM is not set @@ -7186,6 +7239,12 @@ CONFIG_SND_SOC_AMD_SOF_MACH=m CONFIG_SND_SOC_AMD_RPL_ACP6x=m CONFIG_SND_SOC_AMD_PS=m CONFIG_SND_SOC_AMD_PS_MACH=m +CONFIG_SND_SOC_AW88395=m +CONFIG_SND_SOC_CS42L42_SDW=m +CONFIG_SND_SOC_IDT821034=m +CONFIG_SND_SOC_PEB2466=m +CONFIG_SND_SOC_RT712_SDCA_SDW=m +CONFIG_SND_SOC_SMA1303=m CONFIG_SND_ATMEL_SOC=m # CONFIG_SND_BCM63XX_I2S_WHISTLER is not set CONFIG_SND_DESIGNWARE_I2S=m @@ -7648,6 +7707,8 @@ CONFIG_AC97_BUS=m # HID support # CONFIG_HID=y +CONFIG_HID_SUPPORT=y +CONFIG_HID_BPF=y CONFIG_HID_BATTERY_STRENGTH=y CONFIG_HIDRAW=y CONFIG_UHID=m @@ -7757,6 +7818,7 @@ CONFIG_HID_SONY=m CONFIG_SONY_FF=y CONFIG_HID_SPEEDLINK=m CONFIG_HID_STEAM=m +CONFIG_STEAM_FF=y CONFIG_HID_STEELSERIES=m CONFIG_HID_SUNPLUS=m CONFIG_HID_RMI=m @@ -7783,6 +7845,7 @@ CONFIG_HID_SENSOR_HUB=m CONFIG_HID_SENSOR_CUSTOM_SENSOR=m CONFIG_HID_ALPS=m CONFIG_HID_MCP2221=m +CONFIG_HID_EVISION=m # end of Special HID drivers # @@ -7796,6 +7859,7 @@ CONFIG_USB_HIDDEV=y # # I2C HID support # +CONFIG_I2C_HID=m CONFIG_I2C_HID_ACPI=m # end of I2C HID support @@ -8226,6 +8290,7 @@ CONFIG_TYPEC_WUSB3801=m # USB Type-C Multiplexer/DeMultiplexer Switch support # CONFIG_TYPEC_MUX_FSA4480=m +CONFIG_TYPEC_MUX_GPIO_SBU=m CONFIG_TYPEC_MUX_PI3USB30532=m CONFIG_TYPEC_MUX_INTEL_PMC=m # end of USB Type-C Multiplexer/DeMultiplexer Switch support @@ -8739,8 +8804,10 @@ CONFIG_VDPA_USER=m CONFIG_IFCVF=m CONFIG_MLX5_VDPA=y CONFIG_MLX5_VDPA_NET=m +CONFIG_MLX5_VDPA_STEERING_DEBUG=n CONFIG_VP_VDPA=m CONFIG_ALIBABA_ENI_VDPA=m +CONFIG_SNET_VDPA=m CONFIG_VHOST_IOTLB=m CONFIG_VHOST_RING=m CONFIG_VHOST=m @@ -8913,6 +8980,7 @@ CONFIG_CROS_EC_DEBUGFS=m CONFIG_CROS_EC_SENSORHUB=m CONFIG_CROS_EC_SYSFS=m CONFIG_CROS_EC_TYPEC=m +CONFIG_CROS_EC_UART=m CONFIG_CROS_HPS_I2C=m CONFIG_CROS_USBPD_LOGGER=m CONFIG_CROS_USBPD_NOTIFY=m @@ -9046,6 +9114,8 @@ CONFIG_INTEL_PUNIT_IPC=m CONFIG_INTEL_RST=m CONFIG_INTEL_SDSI=m CONFIG_INTEL_SMARTCONNECT=m +CONFIG_INTEL_TPMI=m +CONFIG_INTEL_IOMMU_PERF_EVENTS=y CONFIG_INTEL_TURBO_MAX_3=y CONFIG_INTEL_VSEC=m CONFIG_MSI_LAPTOP=m @@ -9097,6 +9167,7 @@ CONFIG_CLK_TWL6040=m CONFIG_COMMON_CLK_PALMAS=m CONFIG_COMMON_CLK_PWM=m CONFIG_XILINX_VCU=m +CONFIG_XILINX_XDMA=m CONFIG_HWSPINLOCK=y # @@ -9139,7 +9210,7 @@ CONFIG_IOMMUFD=m CONFIG_IRQ_REMAP=y CONFIG_HYPERV_IOMMU=y CONFIG_VIRTIO_IOMMU=m - +CONFIG_WPCM450_SOC=m # # Remoteproc drivers # @@ -9408,11 +9479,13 @@ CONFIG_TI_ADS1015=m CONFIG_TI_ADS7950=m CONFIG_TI_ADS8344=m CONFIG_TI_ADS8688=m +CONFIG_TI_ADS7924=m CONFIG_TI_ADS124S08=m CONFIG_TI_ADS131E08=m CONFIG_TI_AM335X_ADC=m CONFIG_TI_TLC4541=m CONFIG_TI_TSC2046=m +CONFIG_TI_LMP92064=m CONFIG_TWL4030_MADC=m CONFIG_TWL6030_GPADC=m CONFIG_VF610_ADC=m @@ -9539,6 +9612,7 @@ CONFIG_MAX517=m CONFIG_MAX5821=m CONFIG_MCP4725=m CONFIG_MCP4922=m +CONFIG_MAX5522=m CONFIG_TI_DAC082S085=m CONFIG_TI_DAC5571=m CONFIG_TI_DAC7311=m @@ -9927,6 +10001,7 @@ CONFIG_SERIAL_IPOCTAL=m CONFIG_RESET_CONTROLLER=y CONFIG_RESET_TI_SYSCON=m CONFIG_RESET_TI_TPS380X=m +CONFIG_TI_TMAG5273=m # # PHY Subsystem @@ -9994,6 +10069,7 @@ CONFIG_DEV_DAX_PMEM=m CONFIG_DEV_DAX_HMEM=m CONFIG_DEV_DAX_HMEM_DEVICES=y CONFIG_DEV_DAX_KMEM=m +CONFIG_DEV_DAX_CXL=m CONFIG_NVMEM=y CONFIG_NVMEM_SYSFS=y CONFIG_NVMEM_RAVE_SP_EEPROM=m @@ -10351,6 +10427,8 @@ CONFIG_EROFS_FS_SECURITY=y CONFIG_EROFS_FS_ZIP=y CONFIG_EROFS_FS_ZIP_LZMA=y CONFIG_EROFS_FS_ONDEMAND=y +CONFIG_EROFS_FS_PCPU_KTHREAD=y +CONFIG_EROFS_FS_PCPU_KTHREAD_HIPRI=y CONFIG_VBOXSF_FS=m CONFIG_NETWORK_FILESYSTEMS=y CONFIG_NFS_FS=m @@ -10394,6 +10472,10 @@ CONFIG_SUNRPC_GSS=m CONFIG_SUNRPC_BACKCHANNEL=y CONFIG_SUNRPC_SWAP=y CONFIG_RPCSEC_GSS_KRB5=m +CONFIG_RPCSEC_GSS_KRB5_ENCTYPES_DES=n +CONFIG_RPCSEC_GSS_KRB5_ENCTYPES_AES_SHA1=y +CONFIG_RPCSEC_GSS_KRB5_ENCTYPES_CAMELLIA=y +CONFIG_RPCSEC_GSS_KRB5_ENCTYPES_AES_SHA2=y CONFIG_SUNRPC_DISABLE_INSECURE_ENCTYPES=y CONFIG_SUNRPC_DEBUG=y CONFIG_SUNRPC_XPRT_RDMA=m @@ -10797,6 +10879,8 @@ CONFIG_CRYPTO_TWOFISH_X86_64=m CONFIG_CRYPTO_TWOFISH_X86_64_3WAY=m CONFIG_CRYPTO_TWOFISH_AVX_X86_64=m CONFIG_CRYPTO_ARIA_AESNI_AVX_X86_64=m +CONFIG_CRYPTO_ARIA_AESNI_AVX2_X86_64=m +CONFIG_CRYPTO_ARIA_GFNI_AVX512_X86_64=m CONFIG_CRYPTO_CHACHA20_X86_64=m CONFIG_CRYPTO_AEGIS128_AESNI_SSE2=m CONFIG_CRYPTO_NHPOLY1305_SSE2=m @@ -11218,6 +11302,8 @@ CONFIG_SCHEDSTATS=y # Lock Debugging (spinlocks, mutexes, etc...) # CONFIG_LOCK_DEBUGGING_SUPPORT=y +CONFIG_NMI_CHECK_CPU=n +CONFIG_RCU_CPU_STALL_CPUTIME=n # CONFIG_PROVE_LOCKING is not set # CONFIG_LOCK_STAT is not set # CONFIG_DEBUG_RT_MUTEXES is not set @@ -11391,6 +11477,7 @@ CONFIG_ARCH_HAS_KCOV=y CONFIG_CC_HAS_SANCOV_TRACE_PC=y # CONFIG_KCOV is not set CONFIG_RUNTIME_TESTING_MENU=y +CONFIG_TEST_DHRY=m # CONFIG_LKDTM is not set # CONFIG_TEST_MIN_HEAP is not set # CONFIG_TEST_DIV64 is not set diff --git a/main.sh b/main.sh index 4cb6d06..baba420 100755 --- a/main.sh +++ b/main.sh @@ -5,5 +5,3 @@ . ../scripts/config.sh . ../scripts/build.sh . ../scripts/output.sh - - diff --git a/patches/0005-amd-usbc-fix.patch b/patches/0005-amd-usbc-fix.patch deleted file mode 100644 index f0c3c81..0000000 --- a/patches/0005-amd-usbc-fix.patch +++ /dev/null @@ -1,19 +0,0 @@ -diff --git a/drivers/gpu/drm/amd/amdgpu/nbio_v4_3.c b/drivers/gpu/drm/amd/amdgpu/nbio_v4_3.c -index 15eb3658d70e6..09fdcd20cb919 100644 ---- a/drivers/gpu/drm/amd/amdgpu/nbio_v4_3.c -+++ b/drivers/gpu/drm/amd/amdgpu/nbio_v4_3.c -@@ -337,7 +337,13 @@ const struct nbio_hdp_flush_reg nbio_v4_3_hdp_flush_reg = { - - static void nbio_v4_3_init_registers(struct amdgpu_device *adev) - { -- return; -+ if (adev->ip_versions[NBIO_HWIP][0] == IP_VERSION(4, 3, 0)) { -+ uint32_t data; -+ -+ data = RREG32_SOC15(NBIO, 0, regRCC_DEV0_EPF2_STRAP2); -+ data &= ~RCC_DEV0_EPF2_STRAP2__STRAP_NO_SOFT_RESET_DEV0_F2_MASK; -+ WREG32_SOC15(NBIO, 0, regRCC_DEV0_EPF2_STRAP2, data); -+ } - } - - static u32 nbio_v4_3_get_rom_offset(struct amdgpu_device *adev) \ No newline at end of file diff --git a/patches/0006-Nintendo-controller-one.patch b/patches/0006-Nintendo-controller-one.patch index a27203e..cd15ea7 100644 --- a/patches/0006-Nintendo-controller-one.patch +++ b/patches/0006-Nintendo-controller-one.patch @@ -1,46 +1,139 @@ +From d750d1480362781e208b3cc64640c0be127afcc9 Mon Sep 17 00:00:00 2001 +From: "Daniel J. Ogorchock" +Date: Fri, 3 Feb 2023 16:51:18 -0500 +Subject: HID: nintendo: fix rumble rate limiter + +It's been discovered that BT controller disconnect events correlate to +erratic input report timestamp deltas. + +In experimentation, it's been found that ensuring that multiple +timestamp deltas are consistent prior to transmitting a rumble packet +drastically reduces the occurence rate of BT disconnects. + +Alter the joycon_enforce_subcmd_rate() function to use this new +approach. + +Signed-off-by: Daniel J. Ogorchock +Reviewed-by: Silvan Jegen +--- + drivers/hid/hid-nintendo.c | 75 ++++++++++++++++++++++++++++++++++++++++++---- + 1 file changed, 69 insertions(+), 6 deletions(-) + diff --git a/drivers/hid/hid-nintendo.c b/drivers/hid/hid-nintendo.c -index 5bfc0c4504608..2b781cc9082b4 100644 +index 2b781cc9082b4..250f5d2f888ab 100644 --- a/drivers/hid/hid-nintendo.c +++ b/drivers/hid/hid-nintendo.c -@@ -1527,6 +1527,7 @@ static int joycon_set_rumble(struct joycon_ctlr *ctlr, u16 amp_r, u16 amp_l, - u16 freq_l_low; - u16 freq_l_high; - unsigned long flags; -+ int next_rq_head; +@@ -433,7 +433,9 @@ struct joycon_ctlr { + u8 usb_ack_match; + u8 subcmd_ack_match; + bool received_input_report; ++ unsigned int last_input_report_msecs; + unsigned int last_subcmd_sent_msecs; ++ unsigned int consecutive_valid_report_deltas; - spin_lock_irqsave(&ctlr->lock, flags); - freq_r_low = ctlr->rumble_rl_freq; -@@ -1547,8 +1548,21 @@ static int joycon_set_rumble(struct joycon_ctlr *ctlr, u16 amp_r, u16 amp_l, - joycon_encode_rumble(data, freq_l_low, freq_l_high, amp); + /* factory calibration data */ + struct joycon_stick_cal left_stick_cal_x; +@@ -543,19 +545,54 @@ static void joycon_wait_for_input_report(struct joycon_ctlr *ctlr) + * Sending subcommands and/or rumble data at too high a rate can cause bluetooth + * controller disconnections. + */ ++#define JC_INPUT_REPORT_MIN_DELTA 8 ++#define JC_INPUT_REPORT_MAX_DELTA 17 ++#define JC_SUBCMD_TX_OFFSET_MS 4 ++#define JC_SUBCMD_VALID_DELTA_REQ 3 ++#define JC_SUBCMD_RATE_MAX_ATTEMPTS 500 ++#define JC_SUBCMD_RATE_LIMITER_USB_MS 20 ++#define JC_SUBCMD_RATE_LIMITER_BT_MS 60 ++#define JC_SUBCMD_RATE_LIMITER_MS(ctlr) ((ctlr)->hdev->bus == BUS_USB ? JC_SUBCMD_RATE_LIMITER_USB_MS : JC_SUBCMD_RATE_LIMITER_BT_MS) + static void joycon_enforce_subcmd_rate(struct joycon_ctlr *ctlr) + { +- static const unsigned int max_subcmd_rate_ms = 25; +- unsigned int current_ms = jiffies_to_msecs(jiffies); +- unsigned int delta_ms = current_ms - ctlr->last_subcmd_sent_msecs; ++ unsigned int current_ms; ++ unsigned long subcmd_delta; ++ int consecutive_valid_deltas = 0; ++ int attempts = 0; ++ unsigned long flags; ++ ++ if (unlikely(ctlr->ctlr_state != JOYCON_CTLR_STATE_READ)) ++ return; - spin_lock_irqsave(&ctlr->lock, flags); -- if (++ctlr->rumble_queue_head >= JC_RUMBLE_QUEUE_SIZE) -- ctlr->rumble_queue_head = 0; +- while (delta_ms < max_subcmd_rate_ms && +- ctlr->ctlr_state == JOYCON_CTLR_STATE_READ) { ++ do { + joycon_wait_for_input_report(ctlr); + current_ms = jiffies_to_msecs(jiffies); +- delta_ms = current_ms - ctlr->last_subcmd_sent_msecs; ++ subcmd_delta = current_ms - ctlr->last_subcmd_sent_msecs; + -+ next_rq_head = ctlr->rumble_queue_head + 1; -+ if (next_rq_head >= JC_RUMBLE_QUEUE_SIZE) -+ next_rq_head = 0; ++ spin_lock_irqsave(&ctlr->lock, flags); ++ consecutive_valid_deltas = ctlr->consecutive_valid_report_deltas; ++ spin_unlock_irqrestore(&ctlr->lock, flags); + -+ /* Did we overrun the circular buffer? -+ * If so, be sure we keep the latest intended rumble state. ++ attempts++; ++ } while ((consecutive_valid_deltas < JC_SUBCMD_VALID_DELTA_REQ || ++ subcmd_delta < JC_SUBCMD_RATE_LIMITER_MS(ctlr)) && ++ ctlr->ctlr_state == JOYCON_CTLR_STATE_READ && ++ attempts < JC_SUBCMD_RATE_MAX_ATTEMPTS); ++ ++ if (attempts >= JC_SUBCMD_RATE_MAX_ATTEMPTS) { ++ hid_warn(ctlr->hdev, "%s: exceeded max attempts", __func__); ++ return; + } ++ + ctlr->last_subcmd_sent_msecs = current_ms; ++ ++ /* ++ * Wait a short time after receiving an input report before ++ * transmitting. This should reduce odds of a TX coinciding with an RX. ++ * Minimizing concurrent BT traffic with the controller seems to lower ++ * the rate of disconnections. + */ -+ if (next_rq_head == ctlr->rumble_queue_tail) { -+ hid_dbg(ctlr->hdev, "rumble queue is full"); -+ /* overwrite the prior value at the end of the circular buf */ -+ next_rq_head = ctlr->rumble_queue_head; ++ msleep(JC_SUBCMD_TX_OFFSET_MS); + } + + static int joycon_hid_send_sync(struct joycon_ctlr *ctlr, u8 *data, size_t len, +@@ -1223,6 +1260,7 @@ static void joycon_parse_report(struct joycon_ctlr *ctlr, + u8 tmp; + u32 btns; + unsigned long msecs = jiffies_to_msecs(jiffies); ++ unsigned long report_delta_ms = msecs - ctlr->last_input_report_msecs; + + spin_lock_irqsave(&ctlr->lock, flags); + if (IS_ENABLED(CONFIG_NINTENDO_FF) && rep->vibrator_report && +@@ -1364,6 +1402,31 @@ static void joycon_parse_report(struct joycon_ctlr *ctlr, + + input_sync(dev); + ++ spin_lock_irqsave(&ctlr->lock, flags); ++ ctlr->last_input_report_msecs = msecs; ++ /* ++ * Was this input report a reasonable time delta compared to the prior ++ * report? We use this information to decide when a safe time is to send ++ * rumble packets or subcommand packets. ++ */ ++ if (report_delta_ms >= JC_INPUT_REPORT_MIN_DELTA && ++ report_delta_ms <= JC_INPUT_REPORT_MAX_DELTA) { ++ if (ctlr->consecutive_valid_report_deltas < JC_SUBCMD_VALID_DELTA_REQ) ++ ctlr->consecutive_valid_report_deltas++; ++ } else { ++ ctlr->consecutive_valid_report_deltas = 0; + } ++ /* ++ * Our consecutive valid report tracking is only relevant for ++ * bluetooth-connected controllers. For USB devices, we're beholden to ++ * USB's underlying polling rate anyway. Always set to the consecutive ++ * delta requirement. ++ */ ++ if (ctlr->hdev->bus == BUS_USB) ++ ctlr->consecutive_valid_report_deltas = JC_SUBCMD_VALID_DELTA_REQ; + -+ ctlr->rumble_queue_head = next_rq_head; - memcpy(ctlr->rumble_data[ctlr->rumble_queue_head], data, - JC_RUMBLE_DATA_SIZE); - -@@ -2128,7 +2142,7 @@ static int nintendo_hid_probe(struct hid_device *hdev, - - ctlr->hdev = hdev; - ctlr->ctlr_state = JOYCON_CTLR_STATE_INIT; -- ctlr->rumble_queue_head = JC_RUMBLE_QUEUE_SIZE - 1; -+ ctlr->rumble_queue_head = 0; - ctlr->rumble_queue_tail = 0; - hid_set_drvdata(hdev, ctlr); - mutex_init(&ctlr->output_mutex); -generated by cgit (git 2.34.1) at 2023-04-10 17:10:33 +0000 \ No newline at end of file ++ spin_unlock_irqrestore(&ctlr->lock, flags); ++ + /* + * Immediately after receiving a report is the most reliable time to + * send a subcommand to the controller. Wake any subcommand senders +-- +cgit diff --git a/patches/0006-Nintendo-controller-two.patch b/patches/0006-Nintendo-controller-two.patch index a61397f..1d02a33 100644 --- a/patches/0006-Nintendo-controller-two.patch +++ b/patches/0006-Nintendo-controller-two.patch @@ -1,116 +1,64 @@ +From bcba9f32c13a29edf7e996371eebe7eb5ff9f854 Mon Sep 17 00:00:00 2001 +From: "Daniel J. Ogorchock" +Date: Fri, 3 Feb 2023 16:51:17 -0500 +Subject: HID: nintendo: prevent rumble queue overruns + +Make sure that we never throw out the most recent rumble setting, +opting to overwrite the prior queue head instead. This prevents +instances where we could get rumble stuck on if there were an overrun at +the wrong time. + +Signed-off-by: Daniel J. Ogorchock +Reviewed-by: Silvan Jegen +--- + drivers/hid/hid-nintendo.c | 20 +++++++++++++++++--- + 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/drivers/hid/hid-nintendo.c b/drivers/hid/hid-nintendo.c -index 2b781cc9082b4..250f5d2f888ab 100644 +index 5bfc0c4504608..2b781cc9082b4 100644 --- a/drivers/hid/hid-nintendo.c +++ b/drivers/hid/hid-nintendo.c -@@ -433,7 +433,9 @@ struct joycon_ctlr { - u8 usb_ack_match; - u8 subcmd_ack_match; - bool received_input_report; -+ unsigned int last_input_report_msecs; - unsigned int last_subcmd_sent_msecs; -+ unsigned int consecutive_valid_report_deltas; - - /* factory calibration data */ - struct joycon_stick_cal left_stick_cal_x; -@@ -543,19 +545,54 @@ static void joycon_wait_for_input_report(struct joycon_ctlr *ctlr) - * Sending subcommands and/or rumble data at too high a rate can cause bluetooth - * controller disconnections. - */ -+#define JC_INPUT_REPORT_MIN_DELTA 8 -+#define JC_INPUT_REPORT_MAX_DELTA 17 -+#define JC_SUBCMD_TX_OFFSET_MS 4 -+#define JC_SUBCMD_VALID_DELTA_REQ 3 -+#define JC_SUBCMD_RATE_MAX_ATTEMPTS 500 -+#define JC_SUBCMD_RATE_LIMITER_USB_MS 20 -+#define JC_SUBCMD_RATE_LIMITER_BT_MS 60 -+#define JC_SUBCMD_RATE_LIMITER_MS(ctlr) ((ctlr)->hdev->bus == BUS_USB ? JC_SUBCMD_RATE_LIMITER_USB_MS : JC_SUBCMD_RATE_LIMITER_BT_MS) - static void joycon_enforce_subcmd_rate(struct joycon_ctlr *ctlr) - { -- static const unsigned int max_subcmd_rate_ms = 25; -- unsigned int current_ms = jiffies_to_msecs(jiffies); -- unsigned int delta_ms = current_ms - ctlr->last_subcmd_sent_msecs; -+ unsigned int current_ms; -+ unsigned long subcmd_delta; -+ int consecutive_valid_deltas = 0; -+ int attempts = 0; -+ unsigned long flags; -+ -+ if (unlikely(ctlr->ctlr_state != JOYCON_CTLR_STATE_READ)) -+ return; - -- while (delta_ms < max_subcmd_rate_ms && -- ctlr->ctlr_state == JOYCON_CTLR_STATE_READ) { -+ do { - joycon_wait_for_input_report(ctlr); - current_ms = jiffies_to_msecs(jiffies); -- delta_ms = current_ms - ctlr->last_subcmd_sent_msecs; -+ subcmd_delta = current_ms - ctlr->last_subcmd_sent_msecs; -+ -+ spin_lock_irqsave(&ctlr->lock, flags); -+ consecutive_valid_deltas = ctlr->consecutive_valid_report_deltas; -+ spin_unlock_irqrestore(&ctlr->lock, flags); -+ -+ attempts++; -+ } while ((consecutive_valid_deltas < JC_SUBCMD_VALID_DELTA_REQ || -+ subcmd_delta < JC_SUBCMD_RATE_LIMITER_MS(ctlr)) && -+ ctlr->ctlr_state == JOYCON_CTLR_STATE_READ && -+ attempts < JC_SUBCMD_RATE_MAX_ATTEMPTS); -+ -+ if (attempts >= JC_SUBCMD_RATE_MAX_ATTEMPTS) { -+ hid_warn(ctlr->hdev, "%s: exceeded max attempts", __func__); -+ return; - } -+ - ctlr->last_subcmd_sent_msecs = current_ms; -+ -+ /* -+ * Wait a short time after receiving an input report before -+ * transmitting. This should reduce odds of a TX coinciding with an RX. -+ * Minimizing concurrent BT traffic with the controller seems to lower -+ * the rate of disconnections. -+ */ -+ msleep(JC_SUBCMD_TX_OFFSET_MS); - } - - static int joycon_hid_send_sync(struct joycon_ctlr *ctlr, u8 *data, size_t len, -@@ -1223,6 +1260,7 @@ static void joycon_parse_report(struct joycon_ctlr *ctlr, - u8 tmp; - u32 btns; - unsigned long msecs = jiffies_to_msecs(jiffies); -+ unsigned long report_delta_ms = msecs - ctlr->last_input_report_msecs; +@@ -1527,6 +1527,7 @@ static int joycon_set_rumble(struct joycon_ctlr *ctlr, u16 amp_r, u16 amp_l, + u16 freq_l_low; + u16 freq_l_high; + unsigned long flags; ++ int next_rq_head; spin_lock_irqsave(&ctlr->lock, flags); - if (IS_ENABLED(CONFIG_NINTENDO_FF) && rep->vibrator_report && -@@ -1364,6 +1402,31 @@ static void joycon_parse_report(struct joycon_ctlr *ctlr, + freq_r_low = ctlr->rumble_rl_freq; +@@ -1547,8 +1548,21 @@ static int joycon_set_rumble(struct joycon_ctlr *ctlr, u16 amp_r, u16 amp_l, + joycon_encode_rumble(data, freq_l_low, freq_l_high, amp); - input_sync(dev); - -+ spin_lock_irqsave(&ctlr->lock, flags); -+ ctlr->last_input_report_msecs = msecs; -+ /* -+ * Was this input report a reasonable time delta compared to the prior -+ * report? We use this information to decide when a safe time is to send -+ * rumble packets or subcommand packets. + spin_lock_irqsave(&ctlr->lock, flags); +- if (++ctlr->rumble_queue_head >= JC_RUMBLE_QUEUE_SIZE) +- ctlr->rumble_queue_head = 0; ++ ++ next_rq_head = ctlr->rumble_queue_head + 1; ++ if (next_rq_head >= JC_RUMBLE_QUEUE_SIZE) ++ next_rq_head = 0; ++ ++ /* Did we overrun the circular buffer? ++ * If so, be sure we keep the latest intended rumble state. + */ -+ if (report_delta_ms >= JC_INPUT_REPORT_MIN_DELTA && -+ report_delta_ms <= JC_INPUT_REPORT_MAX_DELTA) { -+ if (ctlr->consecutive_valid_report_deltas < JC_SUBCMD_VALID_DELTA_REQ) -+ ctlr->consecutive_valid_report_deltas++; -+ } else { -+ ctlr->consecutive_valid_report_deltas = 0; ++ if (next_rq_head == ctlr->rumble_queue_tail) { ++ hid_dbg(ctlr->hdev, "rumble queue is full"); ++ /* overwrite the prior value at the end of the circular buf */ ++ next_rq_head = ctlr->rumble_queue_head; + } -+ /* -+ * Our consecutive valid report tracking is only relevant for -+ * bluetooth-connected controllers. For USB devices, we're beholden to -+ * USB's underlying polling rate anyway. Always set to the consecutive -+ * delta requirement. -+ */ -+ if (ctlr->hdev->bus == BUS_USB) -+ ctlr->consecutive_valid_report_deltas = JC_SUBCMD_VALID_DELTA_REQ; + -+ spin_unlock_irqrestore(&ctlr->lock, flags); -+ - /* - * Immediately after receiving a report is the most reliable time to - * send a subcommand to the controller. Wake any subcommand senders \ No newline at end of file ++ ctlr->rumble_queue_head = next_rq_head; + memcpy(ctlr->rumble_data[ctlr->rumble_queue_head], data, + JC_RUMBLE_DATA_SIZE); + +@@ -2128,7 +2142,7 @@ static int nintendo_hid_probe(struct hid_device *hdev, + + ctlr->hdev = hdev; + ctlr->ctlr_state = JOYCON_CTLR_STATE_INIT; +- ctlr->rumble_queue_head = JC_RUMBLE_QUEUE_SIZE - 1; ++ ctlr->rumble_queue_head = 0; + ctlr->rumble_queue_tail = 0; + hid_set_drvdata(hdev, ctlr); + mutex_init(&ctlr->output_mutex); +-- +cgit diff --git a/patches/set-ps4-bt-poll-rate-1000hz.patch b/patches/set-ps4-bt-poll-rate-1000hz.patch deleted file mode 100644 index c8b9565..0000000 --- a/patches/set-ps4-bt-poll-rate-1000hz.patch +++ /dev/null @@ -1,15 +0,0 @@ -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 diff --git a/scripts/config.sh b/scripts/config.sh index 99ff444..ee6b2a2 100755 --- a/scripts/config.sh +++ b/scripts/config.sh @@ -6,7 +6,7 @@ cp ../config .config scripts/config -k -e CONFIG_GENERIC_CPU scripts/config -e CACHY -scripts/config -e SCHED_BORE +scripts/config -e SCHED_CFS scripts/config -e HZ_300 --set-val HZ 1000 scripts/config -d HZ_PERIODIC -d NO_HZ_FULL -e NO_HZ_IDLE -e NO_HZ -e NO_HZ_COMMON diff --git a/scripts/patch.sh b/scripts/patch.sh index 04f493e..14039b8 100755 --- a/scripts/patch.sh +++ b/scripts/patch.sh @@ -7,12 +7,10 @@ echo "Pika Kernel - Applying patches" patch -Np1 < "../patches/0001-cachy-all.patch" # orig patch from cachy patch -Np1 < "../patches/0002-eevdf.patch" -# orig patch from cachy - 0001-bore-eevdf.patch -patch -Np1 < "../patches/0003-bore.patch" -# HDR patch - from cachy (but they deleted it) -patch -Np1 < "../patches/0004-hdr.patch" -# AMD GPU USB C fix patch -patch -Np1 < "../patches/0005-amd-usbc-fix.patch" +# orig patch from cachy - 0001-bore-eevdf.patch - looks to not exist for 6.3 so switch to eevdf/cfs +#patch -Np1 < "../patches/0003-bore.patch" +# HDR patch - Currently broken against 6.3 +#patch -Np1 < "../patches/0004-hdr.patch" # Nintendo controller rumble patch patch -Np1 < "../patches/0006-Nintendo-controller-one.patch" # Nintendo controller BT patch @@ -24,7 +22,3 @@ patch -Np1 < "../patches/0001-Add-legion-laptop-v0.1.patch" patch -Np1 < "../patches/0001-Allow-to-set-custom-USB-pollrate-for-specific-device.patch" # Allow pre polaris cards to use the amdgpu kernel module patch -Np1 < "../patches/amdgpu-si-cik-default.patch" -# Disable mt76 buggy aspm -#patch -Np1 < "../patches/mt76_-mt7921_-Disable-powersave-features-by-default.patch" -# Make PS4 controllers have 1000hz pollrate over bluetooth like the actual console -patch -Np1 < "../patches/set-ps4-bt-poll-rate-1000hz.patch"