Skip to content

Commit e4aa247

Browse files
EvenxfJiri Kosina
authored andcommitted
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: 22da60f ("HID: Intel-thc-hid: Intel-thc: Introduce interrupt delay control") Fixes: 45e92a0 ("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>
1 parent 56f7db5 commit e4aa247

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

drivers/hid/intel-thc-hid/intel-thc/intel-thc-dev.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1597,6 +1597,7 @@ int thc_i2c_set_rx_max_size(struct thc_device *dev, u32 max_rx_size)
15971597
if (ret)
15981598
return ret;
15991599

1600+
val = val & ~THC_M_PRT_SPI_ICRRD_OPCODE_I2C_MAX_SIZE;
16001601
val |= FIELD_PREP(THC_M_PRT_SPI_ICRRD_OPCODE_I2C_MAX_SIZE, max_rx_size);
16011602

16021603
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)
16671668
return ret;
16681669

16691670
/* THC hardware counts at 10us unit */
1671+
val = val & ~THC_M_PRT_SPI_ICRRD_OPCODE_I2C_INTERVAL;
16701672
val |= FIELD_PREP(THC_M_PRT_SPI_ICRRD_OPCODE_I2C_INTERVAL, DIV_ROUND_UP(delay_us, 10));
16711673

16721674
ret = regmap_write(dev->thc_regmap, THC_M_PRT_SPI_ICRRD_OPCODE_OFFSET, val);

0 commit comments

Comments
 (0)