Based on testing branch of iio.git IMPORTANT NOTE: There are already upstreamed fixes for this driver [1], [2] and there is an upcoming one [3]. They will probably conflict with the the last three commits PATCH [3-5/5]. The solution should be quite trivial with minor changes in these 3 patches. When it is deemed necessary I can resubmit the patches or help with resolving the issue: Changes in v7: PATCH [1/5]: - PATCH [5/9] of previous version - Moved comments to correct locations and dropped unnecessary casting. PATCH [2/5]: - Used bmp580_nvmem_{read/write}_impl() functions for the read/write operations and bmp580_nvmem_{read/write}() for applying the power managent functions in order to keep correct order of mutex unlocking and power management with the guard(mutex). PATCH [4/5]: - Used ARRAY_SIZE(bmpxxx_channels) for the .num_channels variable in the bmp280_chip_info struct in order to make code better and more maintainable PATCH [5/5]: - Adjusted changes for the addition of ARRAY_SIZE(bmpxxx_channels) in the previous commit. [1]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=546a4f4b5f4d930ea57f5510e109acf08eca5e87 [2]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=5ca29ea4e4073b3caba750efe155b1bd4c597ca9 [3]: https://lore.kernel.org/linux-iio/043f2be49df3c11152aaf32fc5467ed43fd59faa.camel@xxxxxxxxx/ Previous versions: v6: https://lore.kernel.org/linux-iio/20240508165207.145554-1-vassilisamir@xxxxxxxxx/ v5: https://lore.kernel.org/linux-iio/20240429190046.24252-1-vassilisamir@xxxxxxxxx/ v4: https://lore.kernel.org/linux-iio/20240407172920.264282-1-vassilisamir@xxxxxxxxx/ v3: https://lore.kernel.org/linux-iio/20240319002925.2121016-1-vassilisamir@xxxxxxxxx/ v2: https://lore.kernel.org/linux-iio/20240313174007.1934983-1-vassilisamir@xxxxxxxxx/ v1: https://lore.kernel.org/linux-iio/20240303165300.468011-1-vassilisamir@xxxxxxxxx/ Vasileios Amoiridis (5): iio: pressure: bmp280: Refactorize reading functions iio: pressure: bmp280: Introduce new cleanup routines iio: pressure: bmp280: Generalize read_{temp,press,humid}() functions iio: pressure: bmp280: Add SCALE, RAW values in channels and refactorize them iio: pressure: bmp280: Add triggered buffer support drivers/iio/pressure/Kconfig | 2 + drivers/iio/pressure/bmp280-core.c | 1057 ++++++++++++++++++++-------- drivers/iio/pressure/bmp280-spi.c | 8 +- drivers/iio/pressure/bmp280.h | 34 +- 4 files changed, 810 insertions(+), 291 deletions(-) base-commit: 34d3aa6a60c8e0d053e8df5ff4a2b211951f06a6 -- 2.25.1