HID: Intel-thc-hid: Intel-thc: Introduce max input size control
authorEven Xu <even.xu@intel.com>
Wed, 14 May 2025 06:19:40 +0000 (14:19 +0800)
committerJiri Kosina <jkosina@suse.com>
Tue, 10 Jun 2025 19:15:58 +0000 (21:15 +0200)
commit45e92a093099eaf71ff2915a5f6ab5c04c8385e6
treeac136e9f333d3c30d07555294cc106706a5892cb
parent13dd60947f439bc2e7a37ed14fbec6b6ff591572
HID: Intel-thc-hid: Intel-thc: Introduce max input size control

This patch adds support for a new feature, named "Max Input Size
Control", allowing driver to set a maximum input size for RxDMA. This
enhancement aims to prevent RxDMA buffer overruns caused by data
corruption on the I2C bus, thereby improving overall system stability.

APIs added:
- thc_i2c_set_rx_max_size(): Set the maximum input size for I2C RxDMA.
- thc_i2c_rx_max_size_enable(): Enable or disable the max input size
  control.

As this max input size control feature is only applicable to RxDMA
and must remain disabled during SWDMA operations, it also involves
a change in SWDMA code to record the max input size control feature
state before SWDMA and restore the state after SWDMA.

Signed-off-by: Even Xu <even.xu@intel.com>
Tested-by: Chong Han <chong.han@intel.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Jiri Kosina <jkosina@suse.com>
Documentation/hid/intel-thc-hid.rst
drivers/hid/intel-thc-hid/intel-thc/intel-thc-dev.c
drivers/hid/intel-thc-hid/intel-thc/intel-thc-dev.h
drivers/hid/intel-thc-hid/intel-thc/intel-thc-dma.c
drivers/hid/intel-thc-hid/intel-thc/intel-thc-dma.h
drivers/hid/intel-thc-hid/intel-thc/intel-thc-hw.h