Skip to contentSkip to conversation

HID: Intel-thc-hid: Intel-thc: Fix wrong register fields updating

PATCH Applied Even Xu 2 participants 3 messages Feb 2 – Feb 3

Subsystems (2)
lore
Share & tools
lore

Even Xu

author maintainer
#0 lore raw

PATCH 1/1 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")
---
 drivers/hid/intel-thc-hid/intel-thc/intel-thc-dev.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/hid/intel-thc-hid/intel-thc/intel-thc-dev.c +2 -0
index 7e220a4c5ded..d8e195189e4b 100644
@@ -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);
Signature · 1 line
2.40.1
maintainer Applied
#1 lore raw
Quoted 8 lines · Even Xu

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")

Applied, thanks.

Signature · 2 lines
Jiri Kosina
SUSE Labs
author maintainer
#2 lore raw

Thanks Jiri!

Best Regards,
Even Xu

Quoted 28 lines

-----Original Message-----
From: Jiri Kosina <[email protected]>
Sent: Monday, February 2, 2026 9:40 PM
To: Xu, Even <[email protected]>
Cc: [email protected]; [email protected]; linux- [email protected]; [email protected]; Zhang, Rui1 <[email protected]>
Subject: Re: [PATCH] HID: Intel-thc-hid: Intel-thc: Fix wrong register fields updating

Quoted 10 lines · Even Xu

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")

Applied, thanks.

--
Jiri Kosina
SUSE Labs