* @helper: data and func pointer allowing generic functions
* @us: actual spi_device
* @work_thresh: bh for threshold events
+ * @thresh_timestamp: timestamp for threshold interrupts.
* @inter: used to check if new interrupt has been triggered
* @trig: data ready trigger registered with iio
* @tx: transmit buffer
struct iio_sw_ring_helper_state help;
struct spi_device *us;
struct work_struct work_thresh;
+ s64 thresh_timestamp;
bool inter;
struct iio_trigger *trig;
u8 *tx;
struct lis3l02dq_state *st = lis3l02dq_h_to_s(h);
/* Stash the timestamp somewhere convenient for the bh */
- h->last_timestamp = timestamp;
+ st->thresh_timestamp = timestamp;
schedule_work(&st->work_thresh);
return 0;
if (t & LIS3L02DQ_REG_WAKE_UP_SRC_INTERRUPT_Z_HIGH)
iio_push_event(st->help.indio_dev, 0,
IIO_EVENT_CODE_ACCEL_Z_HIGH,
- st->help.last_timestamp);
+ st->thresh_timestamp);
if (t & LIS3L02DQ_REG_WAKE_UP_SRC_INTERRUPT_Z_LOW)
iio_push_event(st->help.indio_dev, 0,
IIO_EVENT_CODE_ACCEL_Z_LOW,
- st->help.last_timestamp);
+ st->thresh_timestamp);
if (t & LIS3L02DQ_REG_WAKE_UP_SRC_INTERRUPT_Y_HIGH)
iio_push_event(st->help.indio_dev, 0,
IIO_EVENT_CODE_ACCEL_Y_HIGH,
- st->help.last_timestamp);
+ st->thresh_timestamp);
if (t & LIS3L02DQ_REG_WAKE_UP_SRC_INTERRUPT_Y_LOW)
iio_push_event(st->help.indio_dev, 0,
IIO_EVENT_CODE_ACCEL_Y_LOW,
- st->help.last_timestamp);
+ st->thresh_timestamp);
if (t & LIS3L02DQ_REG_WAKE_UP_SRC_INTERRUPT_X_HIGH)
iio_push_event(st->help.indio_dev, 0,
IIO_EVENT_CODE_ACCEL_X_HIGH,
- st->help.last_timestamp);
+ st->thresh_timestamp);
if (t & LIS3L02DQ_REG_WAKE_UP_SRC_INTERRUPT_X_LOW)
iio_push_event(st->help.indio_dev, 0,
IIO_EVENT_CODE_ACCEL_X_LOW,
- st->help.last_timestamp);
+ st->thresh_timestamp);
/* reenable the irq */
enable_irq(st->us->irq);
/* Ack and allow for new interrupts */