mirror of https://gitee.com/openkylin/linux.git
iio: imu: st_lsm6dsx: enable clear on read for latched interrupts
Enable clear on read feature for latched interrupts. This bit allows immediately clearing the latched interrupts of an event detection upon the read of the corresponding status register. It must be set to 1 together with LIR. This feature is available just on LSM6DS0/LSM6DSR/ASM330LHH Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Tested-by: Sean Nyekjaer <sean@geanix.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
This commit is contained in:
parent
9db02d32b8
commit
22ea565110
|
@ -216,6 +216,7 @@ struct st_lsm6dsx_ext_dev_settings {
|
||||||
* @decimator: List of decimator register info (addr + mask).
|
* @decimator: List of decimator register info (addr + mask).
|
||||||
* @batch: List of FIFO batching register info (addr + mask).
|
* @batch: List of FIFO batching register info (addr + mask).
|
||||||
* @lir: Latched interrupt register info (addr + mask).
|
* @lir: Latched interrupt register info (addr + mask).
|
||||||
|
* @clear_on_read: Clear on read register info (addr + mask).
|
||||||
* @fifo_ops: Sensor hw FIFO parameters.
|
* @fifo_ops: Sensor hw FIFO parameters.
|
||||||
* @ts_settings: Hw timer related settings.
|
* @ts_settings: Hw timer related settings.
|
||||||
* @shub_settings: i2c controller related settings.
|
* @shub_settings: i2c controller related settings.
|
||||||
|
@ -239,6 +240,7 @@ struct st_lsm6dsx_settings {
|
||||||
struct st_lsm6dsx_reg decimator[ST_LSM6DSX_MAX_ID];
|
struct st_lsm6dsx_reg decimator[ST_LSM6DSX_MAX_ID];
|
||||||
struct st_lsm6dsx_reg batch[ST_LSM6DSX_MAX_ID];
|
struct st_lsm6dsx_reg batch[ST_LSM6DSX_MAX_ID];
|
||||||
struct st_lsm6dsx_reg lir;
|
struct st_lsm6dsx_reg lir;
|
||||||
|
struct st_lsm6dsx_reg clear_on_read;
|
||||||
struct st_lsm6dsx_fifo_ops fifo_ops;
|
struct st_lsm6dsx_fifo_ops fifo_ops;
|
||||||
struct st_lsm6dsx_hw_ts_settings ts_settings;
|
struct st_lsm6dsx_hw_ts_settings ts_settings;
|
||||||
struct st_lsm6dsx_shub_settings shub_settings;
|
struct st_lsm6dsx_shub_settings shub_settings;
|
||||||
|
|
|
@ -601,6 +601,10 @@ static const struct st_lsm6dsx_settings st_lsm6dsx_sensor_settings[] = {
|
||||||
.addr = 0x56,
|
.addr = 0x56,
|
||||||
.mask = BIT(0),
|
.mask = BIT(0),
|
||||||
},
|
},
|
||||||
|
.clear_on_read = {
|
||||||
|
.addr = 0x56,
|
||||||
|
.mask = BIT(6),
|
||||||
|
},
|
||||||
.fifo_ops = {
|
.fifo_ops = {
|
||||||
.update_fifo = st_lsm6dsx_update_fifo,
|
.update_fifo = st_lsm6dsx_update_fifo,
|
||||||
.read_fifo = st_lsm6dsx_read_tagged_fifo,
|
.read_fifo = st_lsm6dsx_read_tagged_fifo,
|
||||||
|
@ -735,6 +739,10 @@ static const struct st_lsm6dsx_settings st_lsm6dsx_sensor_settings[] = {
|
||||||
.addr = 0x56,
|
.addr = 0x56,
|
||||||
.mask = BIT(0),
|
.mask = BIT(0),
|
||||||
},
|
},
|
||||||
|
.clear_on_read = {
|
||||||
|
.addr = 0x56,
|
||||||
|
.mask = BIT(6),
|
||||||
|
},
|
||||||
.fifo_ops = {
|
.fifo_ops = {
|
||||||
.update_fifo = st_lsm6dsx_update_fifo,
|
.update_fifo = st_lsm6dsx_update_fifo,
|
||||||
.read_fifo = st_lsm6dsx_read_tagged_fifo,
|
.read_fifo = st_lsm6dsx_read_tagged_fifo,
|
||||||
|
@ -846,6 +854,10 @@ static const struct st_lsm6dsx_settings st_lsm6dsx_sensor_settings[] = {
|
||||||
.addr = 0x56,
|
.addr = 0x56,
|
||||||
.mask = BIT(0),
|
.mask = BIT(0),
|
||||||
},
|
},
|
||||||
|
.clear_on_read = {
|
||||||
|
.addr = 0x56,
|
||||||
|
.mask = BIT(6),
|
||||||
|
},
|
||||||
.fifo_ops = {
|
.fifo_ops = {
|
||||||
.update_fifo = st_lsm6dsx_update_fifo,
|
.update_fifo = st_lsm6dsx_update_fifo,
|
||||||
.read_fifo = st_lsm6dsx_read_tagged_fifo,
|
.read_fifo = st_lsm6dsx_read_tagged_fifo,
|
||||||
|
@ -1449,6 +1461,18 @@ static int st_lsm6dsx_init_device(struct st_lsm6dsx_hw *hw)
|
||||||
hw->settings->lir.mask, data);
|
hw->settings->lir.mask, data);
|
||||||
if (err < 0)
|
if (err < 0)
|
||||||
return err;
|
return err;
|
||||||
|
|
||||||
|
/* enable clear on read for latched interrupts */
|
||||||
|
if (hw->settings->clear_on_read.addr) {
|
||||||
|
data = ST_LSM6DSX_SHIFT_VAL(1,
|
||||||
|
hw->settings->clear_on_read.mask);
|
||||||
|
err = regmap_update_bits(hw->regmap,
|
||||||
|
hw->settings->clear_on_read.addr,
|
||||||
|
hw->settings->clear_on_read.mask,
|
||||||
|
data);
|
||||||
|
if (err < 0)
|
||||||
|
return err;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
err = st_lsm6dsx_init_shub(hw);
|
err = st_lsm6dsx_init_shub(hw);
|
||||||
|
|
Loading…
Reference in New Issue