diff options
author | Vasileios Amoiridis <vassilisamir@gmail.com> | 2024-03-16 14:07:43 +0300 |
---|---|---|
committer | Jonathan Cameron <Jonathan.Cameron@huawei.com> | 2024-03-24 14:03:08 +0300 |
commit | 5ca29ea4e4073b3caba750efe155b1bd4c597ca9 (patch) | |
tree | f7ec7f85ec5cd2a4dcf7e2bf9c09377efb5c5ce7 /drivers/iio/pressure/bmp280-spi.c | |
parent | 546a4f4b5f4d930ea57f5510e109acf08eca5e87 (diff) | |
download | linux-5ca29ea4e4073b3caba750efe155b1bd4c597ca9.tar.xz |
iio: pressure: Fixes SPI support for BMP3xx devices
Bosch does not use unique BMPxxx_CHIP_ID for the different versions
of the device which leads to misidentification of devices if their
ID is used. Use a new value in the chip_info structure instead of
the BMPxxx_CHIP_ID, in order to choose the correct regmap_bus to
be used.
Fixes: a9dd9ba32311 ("iio: pressure: Fixes BMP38x and BMP390 SPI support")
Signed-off-by: Vasileios Amoiridis <vassilisamir@gmail.com>
Link: https://lore.kernel.org/r/20240316110743.1998400-3-vassilisamir@gmail.com
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Diffstat (limited to 'drivers/iio/pressure/bmp280-spi.c')
-rw-r--r-- | drivers/iio/pressure/bmp280-spi.c | 9 |
1 files changed, 2 insertions, 7 deletions
diff --git a/drivers/iio/pressure/bmp280-spi.c b/drivers/iio/pressure/bmp280-spi.c index 038d36aad3eb..4e19ea0b4d39 100644 --- a/drivers/iio/pressure/bmp280-spi.c +++ b/drivers/iio/pressure/bmp280-spi.c @@ -96,15 +96,10 @@ static int bmp280_spi_probe(struct spi_device *spi) chip_info = spi_get_device_match_data(spi); - switch (chip_info->chip_id[0]) { - case BMP380_CHIP_ID: - case BMP390_CHIP_ID: + if (chip_info->spi_read_extra_byte) bmp_regmap_bus = &bmp380_regmap_bus; - break; - default: + else bmp_regmap_bus = &bmp280_regmap_bus; - break; - } regmap = devm_regmap_init(&spi->dev, bmp_regmap_bus, |