From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CB6AB34B68F; Sun, 11 Jan 2026 16:23:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768148639; cv=none; b=g8lNOeHvJdfU8RZpFcgj0u70K2DzTmp2Cz4z6W7t90pacAOh8OM+Oh80/IsU7MRpUu5YFva9MuVpyj6vD4G3q/ULXfnxI+q2kQ8awWDpskmSvxIguH72OvkwSuSroVrI7VZ83ud7FybvwzexL9gfgVf/7eXDloYDZCPbYifLkMk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768148639; c=relaxed/simple; bh=XZv96mLsbVJM75QFrgCaAzgGVUWDJuc4fhkVKne/mi4=; h=Date:From:To:Cc:Subject:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=RubEa+GiMg7BGjahMr1h/uznviNQbXo81vqTgmH7XzIcb3K1dGEijNp3cv3/4e38ajesFDc1PgJVGmBsINMlZcnxpDZIrMJXeLE3Hq18O4BF3Bd+Ck+ktHatI2oHO01ZHjPbkWd1ynxf5WjlJIl+Rk3Rbii+4pHO3P/EuHD6nfk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=nPFT4TaP; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="nPFT4TaP" Received: by smtp.kernel.org (Postfix) with ESMTPSA id A1D39C4CEF7; Sun, 11 Jan 2026 16:23:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1768148639; bh=XZv96mLsbVJM75QFrgCaAzgGVUWDJuc4fhkVKne/mi4=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=nPFT4TaPQQ8uxG+K3tG6teAme+x+TcXq9XfJKaqI0yAROMxHI1wd573heSlE+R3kR 69OwnX6Qwf3gV0kXj7lPDaQ76pbHKxU2+zZMJj27iQ6UUWrf+TxD1KQCxrKqCqZ5so EvB3y+G44MVLXrXnw+RklBT5MGfV92p7P3uE09GPM4zv+bIIstc/dU5WRmSogewJAx K5Lk4o6Uod7KAI01KtuEcxHbTfyyvan36IRlOAriUtwGubAhvJmmgNjveZE37QuNHH /Vwck6KExLsx2qNmcugVXVZFN+cxwIjDixm7AZqDQqAHb+NcgoAmXsFoLn7DoyDSMz EdNIwwLaqwUsQ== Date: Sun, 11 Jan 2026 16:23:51 +0000 From: Jonathan Cameron To: Francesco Lavra Cc: Lorenzo Bianconi , David Lechner , Nuno =?UTF-8?B?U8Oh?= , Andy Shevchenko , linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 2/3] iio: imu: st_lsm6dsx: set FIFO ODR for accelerometer and magnetometer only Message-ID: <20260111162351.1407115a@jic23-huawei> In-Reply-To: <20260109181528.154127-3-flavra@baylibre.com> References: <20260109181528.154127-1-flavra@baylibre.com> <20260109181528.154127-3-flavra@baylibre.com> X-Mailer: Claws Mail 4.3.1 (GTK 3.24.51; x86_64-pc-linux-gnu) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit On Fri, 9 Jan 2026 19:15:27 +0100 Francesco Lavra wrote: > The st_lsm6dsx_set_fifo_odr() function, which is called when enabling and > disabling the hardware FIFO, checks the contents of the hw->settings->batch > array at index sensor->id, and then sets the current ODR value in sensor > registers that depend on whether the register address is set in the above > array element. This logic is valid for internal sensors only, i.e. the > accelerometer and magnetometer; however, since commit c91c1c844ebd ("iio: > imu: st_lsm6dsx: add i2c embedded controller support"), this function is > called also when configuring the hardware FIFO for external sensors (i.e. > sensors accessed through the sensor hub functionality), which can result in > unrelated device registers being written. > > Add a check to the beginning of st_lsm6dsx_set_fifo_odr() so that it does > not touch any registers unless it is called for internal sensors. > > Fixes: c91c1c844ebd ("iio: imu: st_lsm6dsx: add i2c embedded controller support") > Signed-off-by: Francesco Lavra This seems fine to me. Ideally it would have been first patch in the series as this is one we want to backport. I'll leave it on list little while though to see if Lorenzo or anyone else has time to take a look. Thanks, Jonathan > --- > drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_buffer.c | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_buffer.c b/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_buffer.c > index 5ac45e6230b5..9db48e835d4f 100644 > --- a/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_buffer.c > +++ b/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_buffer.c > @@ -225,6 +225,9 @@ static int st_lsm6dsx_set_fifo_odr(struct st_lsm6dsx_sensor *sensor, > const struct st_lsm6dsx_reg *batch_reg; > u8 data; > > + /* Only accel and gyro have batch registers. */ > + if (sensor->id >= ARRAY_SIZE(hw->settings->batch)) > + return 0; > batch_reg = &hw->settings->batch[sensor->id]; > if (batch_reg->addr) { > int val;