mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-15 16:24:13 +08:00
iio: pressure: Fixes SPI support for BMP3xx devices
commit5ca29ea4e4
upstream. 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:a9dd9ba323
("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> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
d4c39840bc
commit
fcb97f514c
@ -1233,6 +1233,7 @@ const struct bmp280_chip_info bmp380_chip_info = {
|
|||||||
.chip_id = bmp380_chip_ids,
|
.chip_id = bmp380_chip_ids,
|
||||||
.num_chip_id = ARRAY_SIZE(bmp380_chip_ids),
|
.num_chip_id = ARRAY_SIZE(bmp380_chip_ids),
|
||||||
.regmap_config = &bmp380_regmap_config,
|
.regmap_config = &bmp380_regmap_config,
|
||||||
|
.spi_read_extra_byte = true,
|
||||||
.start_up_time = 2000,
|
.start_up_time = 2000,
|
||||||
.channels = bmp380_channels,
|
.channels = bmp380_channels,
|
||||||
.num_channels = 2,
|
.num_channels = 2,
|
||||||
|
@ -96,15 +96,10 @@ static int bmp280_spi_probe(struct spi_device *spi)
|
|||||||
|
|
||||||
chip_info = spi_get_device_match_data(spi);
|
chip_info = spi_get_device_match_data(spi);
|
||||||
|
|
||||||
switch (chip_info->chip_id[0]) {
|
if (chip_info->spi_read_extra_byte)
|
||||||
case BMP380_CHIP_ID:
|
|
||||||
case BMP390_CHIP_ID:
|
|
||||||
bmp_regmap_bus = &bmp380_regmap_bus;
|
bmp_regmap_bus = &bmp380_regmap_bus;
|
||||||
break;
|
else
|
||||||
default:
|
|
||||||
bmp_regmap_bus = &bmp280_regmap_bus;
|
bmp_regmap_bus = &bmp280_regmap_bus;
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
regmap = devm_regmap_init(&spi->dev,
|
regmap = devm_regmap_init(&spi->dev,
|
||||||
bmp_regmap_bus,
|
bmp_regmap_bus,
|
||||||
|
@ -423,6 +423,7 @@ struct bmp280_chip_info {
|
|||||||
int num_chip_id;
|
int num_chip_id;
|
||||||
|
|
||||||
const struct regmap_config *regmap_config;
|
const struct regmap_config *regmap_config;
|
||||||
|
bool spi_read_extra_byte;
|
||||||
|
|
||||||
const struct iio_chan_spec *channels;
|
const struct iio_chan_spec *channels;
|
||||||
int num_channels;
|
int num_channels;
|
||||||
|
Loading…
Reference in New Issue
Block a user