This patch series aims to add triggered buffer support in the BMP280 driver. The patches have been separated in a way that a single functionality is added with each commit. The 1st commit is independent but the others not. Commit no.3 needs commit no.2 and commit no.4 needs both commit no.3 and commit no.2. More details below: PATCH 1/4: Sort the headers of the bmp280-core.c file before adding new ones. PATCH 2/4: The scale value for every channel is needed in order to be able to calculate the final value in userspace. Every measurement from every device requires a different scaling in order to apply to the IIO measurement unit standards. PATCH 3/4: This commit adds a channel for a soft timestamp. The indexing of temperature and pressure channels is changed and temperature comes first. This is because the temperature measurement is always needed for a measurement so it is better to have it as first for the available_scan_masks. The values have already the CPU endiannes and are already compensated. As mentioned before, only the scale value to convert them to IIO measurement unit standards is missing. PATCH 4/4: This commit is adding the actual triggered buffer. An extra buffer is added to hold the values of the measurements. This buffer is not inside the union but rather an external buffer. The reasons for that are presented below: i) The sensor is built in a way that first you read the raw values out of the sensor, then you have to compensate those values in software and then you have to convert them in IIO measurement units. This means that the values of the data->buf (which is in the DMA safe union) cannot be used directly to push data to userspace because even though we can have the SCALE value to convert to IIO measurement units, we still need to compensate first. Only the latest version of the BMP58x sensor returns directly compensated values. ii) In order to have a pressure or a humidity measurement, a temperature measurement needs to happen first so the t_fine variable is filled/updated. The read_press() and read_humid() functions contain the read_temp() measurement inside their bodies. This means that if we use an extra buffer inside the DMA safe union in order to push data to userspace, the first 3 bytes of that buffer will always be overwritten by a read_press() or read_humid() operation. In order to overcome the above 2 problems the following things need to be done: a) Remove the read_temp() function from the inside bodies of read_press/humid() and call it before you call them. b) Modify all the read_temp/press/humid() functions and instead of returning the IIO measurement unit (with *val, *val2, and return IIO value) just return the compensated value so it can be used with the SCALE value in userspace for buffer reads and for oneshot captures just do the extra calculations for *val, *val2 and return IIO value in the bmp280_read_raw() body. If the solution that I have already sent in the commits is acceptable it's OK. If it is necessary to have this iio_buffer structure that I used, inside the union which is also DMA safe then I can immediately implement the a) and b) solutions and resend the patches for discussion. Vasileios Amoiridis (4): iio: pressure: BMP280 core driver headers sorting iio: pressure: Add scale value for channels iio: pressure: Add timestamp and scan_masks for BMP280 driver iio: pressure: Add triggered buffer support for BMP280 driver drivers/iio/pressure/Kconfig | 2 + drivers/iio/pressure/bmp280-core.c | 352 ++++++++++++++++++++++++----- drivers/iio/pressure/bmp280.h | 8 + 3 files changed, 311 insertions(+), 51 deletions(-) -- 2.25.1