From nobody Sun Feb 8 16:50:40 2026 Received: from mail-wm1-f49.google.com (mail-wm1-f49.google.com [209.85.128.49]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0C1E13915C8 for ; Thu, 22 Jan 2026 16:23:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.49 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769099033; cv=none; b=ZuuiS/6yMYolX4xHBJjfwEQvWXnDT402aQxYLfTD0qvy8huMbgepX4rOH71GgwaCAORou4bK0yyEcEJQuIaLWgAiVLSj6f9yhbCqRCeFVukF4uF8CeBTL5iHEM9wSQlkZc7VgFHRK+rUaaktS2QKMzYA74PslMcZ2Nf6WumbJmY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769099033; c=relaxed/simple; bh=aBIjT8HJMfYZDveJouRj4sa520yQuhHwAmIb09eSjwY=; h=From:To:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=mAOZ0lwNr3rqgCqJ3eRnA6SSyVDysd87cnTlell+pDSfnJj59IJl1wfcQEQbmN0r2zDTD+4j0MGsG7gqPVvMak6Y6gfZqU5yi3+HUhdizovz8KbEnQ6+zpqFe7sLqIPbh/cFP02zbHEgcHzL+wHo9LjRBP9c3Usly5z0kJ6LHLw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=baylibre.com; spf=pass smtp.mailfrom=baylibre.com; dkim=pass (2048-bit key) header.d=baylibre-com.20230601.gappssmtp.com header.i=@baylibre-com.20230601.gappssmtp.com header.b=L9NACxKx; arc=none smtp.client-ip=209.85.128.49 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=baylibre.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=baylibre.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=baylibre-com.20230601.gappssmtp.com header.i=@baylibre-com.20230601.gappssmtp.com header.b="L9NACxKx" Received: by mail-wm1-f49.google.com with SMTP id 5b1f17b1804b1-47ee3da7447so9164565e9.0 for ; Thu, 22 Jan 2026 08:23:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20230601.gappssmtp.com; s=20230601; t=1769099019; x=1769703819; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=RHmHZviAuhOhpKSUpCtTa1iFHF2rU7EWwgoioRxdGwg=; b=L9NACxKxJohW2pvYswoGX1tigiv5hopL5ESdVmwlCae1wLUQL51zDWRJGuhmbyNZ0y ts1kaQ8y7IBgvQFW9lst1l7dFyzYQuHoK7zsXnl3kD+GzvfPruw31KGXaTCyec6UUq2R jwmWrH/Go3NadphI/Rpc7i12r8jiW0eu0ctJNfhrChB0mEOsLlnN3Ik5H7sVl/GM+7G5 zpjjyBRpzRjpL8/BkrfB9wIDQdOJ/GdpfuM1DKrmK1xHhn9i39gb0QHIWb1rLX3hCB66 rw/uMiy8W7pMZhMDe8X1AKpy/Wii+6lGfr0SLsS1YedRm5L63O47aji9OW53Rku9DPTn xtCw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1769099019; x=1769703819; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=RHmHZviAuhOhpKSUpCtTa1iFHF2rU7EWwgoioRxdGwg=; b=FTn/+NvPOH8BijJS1XMqbmoHhEpyHHoWn3eYg/XAky6TQBPx6ClaBrF4ePN3O7Ekju Z8T+mblZwiQK6tUL5Z5lhkng8ShfDgCuGj9mgLmUvXqA1brEJ56XuUS0H2j5d+R1Oqt3 dWHPsZj+CYfi/1crBakd2tZOaxRiICzcqOtvwYYmt6mFBZFRUzKO3j7NL6BSLlSNN9uq wq4MDYjsuScmC/O00of9FOVz3CTrHixzEohRIYvV1Nm9nRLYBJMxCAJPJ71SDoXpI6ft r4JpPBLZT48Gpr0JTrgGP54xbba3c4aGEkPSlasE4M8QQbqGLXPUmcnTJE550u4FJmks cQ8Q== X-Forwarded-Encrypted: i=1; AJvYcCW6P+kmVvINOtSmQ+XCDC4+B77FmtC8HoLi6xLgN7b3d5FXvq+PKF6HuONbJ7kZOxoyrAko+qX0pTucg1Y=@vger.kernel.org X-Gm-Message-State: AOJu0YyUwbGvusuKNATyU8j15Khe89fhZGfWZRZsJrrReDRCK0bfCKde akTa3w8A8RD6n1vC6LPstenWoBkkamumQDAHmKe8GXBJM4h3rZVNTzbQIIIvZCKAr90= X-Gm-Gg: AZuq6aIVcT2X2dQ+yGl4TeSwwGuoVFNiJ97FVp2BLZvdsRePxh7DYyBWECuUAWI4pVS vcNRi0YPq+G4TNuaCcjTF4YqRz5TrkB7I7o7VLTemrDxoPE+/+sjcpfDTk9nVYGQ7baDq9QqNcu Ty5y+FM5RmCgNLFd8KoPnH1dou++Hp6t2PW190pgKlB2nKXmfQkNGbRqsZskMIXvttWzPZ3mu5b +p9NF6hfONDsiTqXoW2KlXC38c8PH7H4u2SlhDzeLwEDZWoURqjv8fECJ+Yip7cxXVi7hNs2ZdY qvBQAHCWYh8K++4wDWu/3mPDKRjHDtYNuhfU6cI0By+/n0XVYLtILPrpZ5XvCL1HaDAyNfZKapn t2cs2DGuH5CRvD7UhQ8AjygO2sTqUfcY/8RrQJV3+2pJ8sobJg73/zmPOSA== X-Received: by 2002:a05:600c:8285:b0:477:9ce2:a0d8 with SMTP id 5b1f17b1804b1-4804c8f29f1mr4045955e9.0.1769099017865; Thu, 22 Jan 2026 08:23:37 -0800 (PST) Received: from localhost ([151.57.192.129]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4804706f14fsm78889845e9.13.2026.01.22.08.23.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Jan 2026 08:23:37 -0800 (PST) From: Francesco Lavra To: Lorenzo Bianconi , Jonathan Cameron , David Lechner , =?UTF-8?q?Nuno=20S=C3=A1?= , Andy Shevchenko , linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v5 1/4] iio: imu: st_lsm6dsx: Set FIFO ODR for accelerometer and gyroscope only Date: Thu, 22 Jan 2026 17:23:32 +0100 Message-Id: <20260122162335.2020006-2-flavra@baylibre.com> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20260122162335.2020006-1-flavra@baylibre.com> References: <20260122162335.2020006-1-flavra@baylibre.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1747; i=flavra@baylibre.com; h=from:subject; bh=aBIjT8HJMfYZDveJouRj4sa520yQuhHwAmIb09eSjwY=; b=owEB7QES/pANAwAKAe3xO3POlDZfAcsmYgBpck7oKHlBS2+YWZdjOWGvX/xqPbpahixKnyHdW ADRDgnr6CSJAbMEAAEKAB0WIQSGV4VPlTvcox7DFObt8TtzzpQ2XwUCaXJO6AAKCRDt8TtzzpQ2 XyJfDACg8mGeBAgcwaglN2TERZ6vbyZu9tlJLV7qdJo0WDYHYQhkwu9JvY7xW2rg/lUITTNTGBe PjBUCQp3CDwVk8PB5cC1pR5C0NSdgEpIE0yVbgLtQ4eBNEJKeAcwWp2MoJHTV1BDQSA4c0cjqcO 5Dbvr7bgbE2gVlZWcBFVeYZra9bH8CcrpkgRc7rjYTf7uKmiESIv6jb9AZSNEzShN9ZR+z0htXq DKbOI042A05tUe0yWsLyq1SyxqhjE3xMCCpx/aMQGiM4/4qZaH41MV9DrNsv54ZdT5odLW5JDMY 7PJbt2S0lcGmF2thgMNZrZpDrT9HNh0igeuGL5xikHb2uG2Ue8xYuhOpDaO3gw5fO0apiWQe2uZ /pgH4jtVFPou0KN36Lq4iOYkDj1JBRPcbErWB+PxIaVOvJiDAO0qD1CMydvlQoFuTD89NQ4LJgk ROVJJBHtOHv/xnGSLMeY4YoX0x/ja5hzuPGrxusJKXS1+JmgtimhgJHkfRjTKH5vhJwu0= X-Developer-Key: i=flavra@baylibre.com; a=openpgp; fpr=8657854F953BDCA31EC314E6EDF13B73CE94365F Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" 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 gyroscope; 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 sup= port") Signed-off-by: Francesco Lavra --- drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_buffer.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_buffer.c b/drivers/iio/i= mu/st_lsm6dsx/st_lsm6dsx_buffer.c index 55d877745575..1ee2fc5f5f1f 100644 --- a/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_buffer.c +++ b/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_buffer.c @@ -225,6 +225,10 @@ static int st_lsm6dsx_set_fifo_odr(struct st_lsm6dsx_s= ensor *sensor, const struct st_lsm6dsx_reg *batch_reg; u8 data; =20 + /* Only internal sensors have a FIFO ODR configuration register. */ + if (sensor->id >=3D ARRAY_SIZE(hw->settings->batch)) + return 0; + batch_reg =3D &hw->settings->batch[sensor->id]; if (batch_reg->addr) { int val; --=20 2.39.5