summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEven Xu <even.xu@intel.com>2026-02-02 11:01:44 +0800
committerJiri Kosina <jkosina@suse.com>2026-02-02 14:39:30 +0100
commite4aa247d94a04574297a8bc9fabbede0dcba1ab6 (patch)
tree736006aae9ccbc9e03f470dd8852880b4fdbe7c1
parent56f7db581ee73af53cd512e00a6261a025bf1d58 (diff)
HID: Intel-thc-hid: Intel-thc: Fix wrong register fields updating
Clear the target bit fields in register before setting new values. This ensures proper field updates by removing any existing bits that might interfere with the new configuration. Fixes: 22da60f0304b ("HID: Intel-thc-hid: Intel-thc: Introduce interrupt delay control") Fixes: 45e92a093099 ("HID: Intel-thc-hid: Intel-thc: Introduce max input size control") Signed-off-by: Even Xu <even.xu@intel.com> Tested-by: Rui Zhang <rui1.zhang@intel.com> Signed-off-by: Jiri Kosina <jkosina@suse.com>
-rw-r--r--drivers/hid/intel-thc-hid/intel-thc/intel-thc-dev.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/hid/intel-thc-hid/intel-thc/intel-thc-dev.c b/drivers/hid/intel-thc-hid/intel-thc/intel-thc-dev.c
index 7e220a4c5ded..d8e195189e4b 100644
--- a/drivers/hid/intel-thc-hid/intel-thc/intel-thc-dev.c
+++ b/drivers/hid/intel-thc-hid/intel-thc/intel-thc-dev.c
@@ -1597,6 +1597,7 @@ int thc_i2c_set_rx_max_size(struct thc_device *dev, u32 max_rx_size)
if (ret)
return ret;
+ val = val & ~THC_M_PRT_SPI_ICRRD_OPCODE_I2C_MAX_SIZE;
val |= FIELD_PREP(THC_M_PRT_SPI_ICRRD_OPCODE_I2C_MAX_SIZE, max_rx_size);
ret = regmap_write(dev->thc_regmap, THC_M_PRT_SPI_ICRRD_OPCODE_OFFSET, val);
@@ -1667,6 +1668,7 @@ int thc_i2c_set_rx_int_delay(struct thc_device *dev, u32 delay_us)
return ret;
/* THC hardware counts at 10us unit */
+ val = val & ~THC_M_PRT_SPI_ICRRD_OPCODE_I2C_INTERVAL;
val |= FIELD_PREP(THC_M_PRT_SPI_ICRRD_OPCODE_I2C_INTERVAL, DIV_ROUND_UP(delay_us, 10));
ret = regmap_write(dev->thc_regmap, THC_M_PRT_SPI_ICRRD_OPCODE_OFFSET, val);