iio: acpi_als: Add timestamp channel

Add timestamp channel in list of channel, to allow retrieving timestamps
when events are produced.

Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Link: https://lore.kernel.org/r/20210317074012.2336454-2-gwendal@chromium.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
This commit is contained in:
Gwendal Grignou 2021-03-17 00:40:10 -07:00 committed by Jonathan Cameron
parent 707182b4ff
commit dbd7e992a5
1 changed files with 4 additions and 6 deletions

View File

@ -45,24 +45,22 @@ static const struct iio_chan_spec acpi_als_channels[] = {
.info_mask_separate = BIT(IIO_CHAN_INFO_RAW) |
BIT(IIO_CHAN_INFO_PROCESSED),
},
IIO_CHAN_SOFT_TIMESTAMP(1),
};
/*
* The event buffer contains timestamp and all the data from
* the ACPI0008 block. There are multiple, but so far we only
* support _ALI (illuminance). Once someone adds new channels
* to acpi_als_channels[], the evt_buffer below will grow
* automatically.
* support _ALI (illuminance): One channel, padding and timestamp.
*/
#define ACPI_ALS_EVT_NR_SOURCES ARRAY_SIZE(acpi_als_channels)
#define ACPI_ALS_EVT_BUFFER_SIZE \
(sizeof(s64) + (ACPI_ALS_EVT_NR_SOURCES * sizeof(s32)))
(sizeof(s32) + sizeof(s32) + sizeof(s64))
struct acpi_als {
struct acpi_device *device;
struct mutex lock;
s32 evt_buffer[ACPI_ALS_EVT_BUFFER_SIZE];
s32 evt_buffer[ACPI_ALS_EVT_BUFFER_SIZE / sizeof(s32)] __aligned(8);
};
/*