patch "iio: accel: bma400: Ensure VDDIO is enable defore reading the chip" added to char-misc-linus
Subsystems (3)
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
to my char-misc git tree which can be found at
git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc.git
in the char-misc-linus branch.
The patch will show up in the next release of the linux-next tree (usually sometime within the next 24 hours during the week.)
The patch will hopefully also be merged in Linus's tree for the next -rc kernel release.
If you have any questions about this process, please let me know.
From 57572cacd36e6d4be7722d7770d23f4430219827 Mon Sep 17 00:00:00 2001
From: Jonathan Cameron <[email protected]>
Date: Sun, 2 Oct 2022 15:41:33 +0100
Subject: iio: accel: bma400: Ensure VDDIO is enable defore reading the chip
ID.
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.
--- drivers/iio/accel/bma400_core.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-)
drivers/iio/accel/bma400_core.c +12 -12
@@ -869,18 +869,6 @@ static int bma400_init(struct bma400_data *data)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,
@@ -906,6 +894,18 @@ static int bma400_init(struct bma400_data *data)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" );
Signature · 1 line
2.38.1