This is a note to let you know that I've just added the patch titled iio: accel: bma400: Ensure VDDIO is enable defore reading the chip ID. to the 6.0-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: iio-accel-bma400-ensure-vddio-is-enable-defore-reading-the-chip-id.patch and it can be found in the queue-6.0 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. >From 57572cacd36e6d4be7722d7770d23f4430219827 Mon Sep 17 00:00:00 2001 From: Jonathan Cameron <Jonathan.Cameron@xxxxxxxxxx> Date: Sun, 2 Oct 2022 15:41:33 +0100 Subject: iio: accel: bma400: Ensure VDDIO is enable defore reading the chip ID. From: Jonathan Cameron <Jonathan.Cameron@xxxxxxxxxx> commit 57572cacd36e6d4be7722d7770d23f4430219827 upstream. The regulator enables were after the check on the chip variant, which was very unlikely to return a correct value when not powered. Presumably all the device anyone is testing on have a regulator that is already powered up when this code runs for reasons beyond the scope of this driver. Move the read call down a few lines. Fixes: 3cf7ded15e40 ("iio: accel: bma400: basic regulator support") Signed-off-by: Jonathan Cameron <Jonathan.Cameron@xxxxxxxxxx> Reviewed-by: Dan Robertson <dan@xxxxxxxxxxxxxxx> Cc: <Stable@xxxxxxxxxxxxxxx> Link: https://lore.kernel.org/r/20221002144133.3771029-1-jic23@xxxxxxxxxx Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- drivers/iio/accel/bma400_core.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) --- a/drivers/iio/accel/bma400_core.c +++ b/drivers/iio/accel/bma400_core.c @@ -737,18 +737,6 @@ static int bma400_init(struct bma400_dat unsigned int val; int ret; - /* Try to read chip_id register. It must return 0x90. */ - ret = regmap_read(data->regmap, BMA400_CHIP_ID_REG, &val); - if (ret) { - dev_err(data->dev, "Failed to read chip id register\n"); - return ret; - } - - if (val != BMA400_ID_REG_VAL) { - dev_err(data->dev, "Chip ID mismatch\n"); - return -ENODEV; - } - data->regulators[BMA400_VDD_REGULATOR].supply = "vdd"; data->regulators[BMA400_VDDIO_REGULATOR].supply = "vddio"; ret = devm_regulator_bulk_get(data->dev, @@ -774,6 +762,18 @@ static int bma400_init(struct bma400_dat if (ret) return ret; + /* Try to read chip_id register. It must return 0x90. */ + ret = regmap_read(data->regmap, BMA400_CHIP_ID_REG, &val); + if (ret) { + dev_err(data->dev, "Failed to read chip id register\n"); + return ret; + } + + if (val != BMA400_ID_REG_VAL) { + dev_err(data->dev, "Chip ID mismatch\n"); + return -ENODEV; + } + ret = bma400_get_power_mode(data); if (ret) { dev_err(data->dev, "Failed to get the initial power-mode\n"); Patches currently in stable-queue which might be from Jonathan.Cameron@xxxxxxxxxx are queue-6.0/iio-pressure-ms5611-changed-hardcoded-spi-speed-to-value-limited.patch queue-6.0/iio-accel-bma400-ensure-vddio-is-enable-defore-reading-the-chip-id.patch queue-6.0/iio-adc-at91_adc-fix-possible-memory-leak-in-at91_adc_allocate_trigger.patch queue-6.0/cxl-mbox-add-a-check-on-input-payload-size.patch queue-6.0/iio-adc-mp2629-fix-wrong-comparison-of-channel.patch queue-6.0/iio-trigger-sysfs-fix-possible-memory-leak-in-iio_sysfs_trig_init.patch queue-6.0/iio-adc-mp2629-fix-potential-array-out-of-bound-access.patch queue-6.0/iio-pressure-ms5611-fixed-value-compensation-bug.patch