android_kernel_xiaomi_sm8450/drivers/iio/accel
Hans de Goede e2648b3d17 iio: accel: mxc4005: Interrupt handling fixes
commit 57a1592784d622ecee0b71940c65429173996b33 upstream.

There are 2 issues with interrupt handling in the mxc4005 driver:

1. mxc4005_set_trigger_state() writes MXC4005_REG_INT_MASK1_BIT_DRDYE
(0x01) to INT_MASK1 to enable the interrupt, but to disable the interrupt
it writes ~MXC4005_REG_INT_MASK1_BIT_DRDYE which is 0xfe, so it enables
all other interrupt sources in the INT_SRC1 register. On the MXC4005 this
is not an issue because only bit 0 of the register is used. On the MXC6655
OTOH this is a problem since bit7 is used as TC (Temperature Compensation)
disable bit and writing 1 to this disables Temperature Compensation which
should only be done when running self-tests on the chip.

Write 0 instead of ~MXC4005_REG_INT_MASK1_BIT_DRDYE to disable
the interrupts to fix this.

2. The datasheets for the MXC4005 / MXC6655 do not state what the reset
value for the INT_MASK0 and INT_MASK1 registers is and since these are
write only we also cannot learn this from the hw. Presumably the reset
value for both is all 0, which means all interrupts disabled.

Explicitly set both registers to 0 from mxc4005_chip_init() to ensure
both masks are actually set to 0.

Fixes: 79846e33aa ("iio: accel: mxc4005: add support for mxc6655")
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Link: https://lore.kernel.org/r/20240326113700.56725-2-hdegoede@redhat.com
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-05-17 11:48:09 +02:00
..
adis16201.c iio:imu:adis: Move exports into IIO_ADISLIB namespace 2023-01-14 10:15:58 +01:00
adis16209.c iio:imu:adis: Move exports into IIO_ADISLIB namespace 2023-01-14 10:15:58 +01:00
adxl345_core.c
adxl345_i2c.c
adxl345_spi.c
adxl345.h
adxl372_i2c.c
adxl372_spi.c
adxl372.c
adxl372.h
bma180.c
bma220_spi.c
bma400_core.c iio: accel: bma400: Reordering of header files 2022-08-21 15:15:54 +02:00
bma400_i2c.c
bma400_spi.c
bma400.h iio: accel: bma400: Fix the scale min and max macro values 2022-08-21 15:15:54 +02:00
bmc150-accel-core.c
bmc150-accel-i2c.c
bmc150-accel-spi.c
bmc150-accel.h
cros_ec_accel_legacy.c
da280.c
da311.c
dmard06.c
dmard09.c
dmard10.c
hid-sensor-accel-3d.c iio: hid: fix the retval in accel_3d_capture_sample 2023-02-15 17:22:17 +01:00
Kconfig iio: accel: bma400: Fix a compilation problem 2024-02-23 08:42:27 +01:00
kxcjk-1013.c
kxsd9-i2c.c
kxsd9-spi.c
kxsd9.c
kxsd9.h
Makefile
mc3230.c
mma7455_core.c
mma7455_i2c.c
mma7455_spi.c
mma7455.h
mma7660.c
mma8452.c iio: accel: mma8452: ignore the return value of reset operation 2022-06-29 08:59:52 +02:00
mma9551_core.c iio: accel: mma9551_core: Prevent uninitialized variable in mma9551_read_config_word() 2023-03-11 16:40:17 +01:00
mma9551_core.h
mma9551.c
mma9553.c
mxc4005.c iio: accel: mxc4005: Interrupt handling fixes 2024-05-17 11:48:09 +02:00
mxc6255.c
sca3000.c
ssp_accel_sensor.c
st_accel_buffer.c
st_accel_core.c
st_accel_i2c.c
st_accel_spi.c
st_accel.h
stk8ba50.c
stk8312.c