From nobody Mon Feb 9 07:22:15 2026 Received: from mail-ed1-f46.google.com (mail-ed1-f46.google.com [209.85.208.46]) (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 658AB357728 for ; Mon, 19 Jan 2026 10:04:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.46 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768817095; cv=none; b=in+fSjlxXSEh3MohPxGJJGF77YDTI5tLXkAinGYxoiNOo+6MdXOvWfM/mB2V7H/+iLeJibbIYy5lc2L2UB92BHsnmarN2BYGYiQpjUl0g4nGBbF+FELe6WxGIHxVa1sFP04ZcnUwFjMG6KTXLAMOT+2Xnzkc9PS1RSp8MOz66oc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768817095; c=relaxed/simple; bh=aBIjT8HJMfYZDveJouRj4sa520yQuhHwAmIb09eSjwY=; h=From:To:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=HavzCps1KjwkL7sohNunCDGf/t+mnifMO3oTqCrV0biovCHVrIDSNxL7iIp9RMXDaHxgfYZkp7xTWopPUFAD8pP54c9yg/B/MXDJ/OT5C/q6YI2AR/sBqkJmDoS0B0JVW1JD8joaJ6j2UxVyr+fibnyAWd/Rqj4TJHeIW6xsffA= 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=SICmyfT3; arc=none smtp.client-ip=209.85.208.46 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="SICmyfT3" Received: by mail-ed1-f46.google.com with SMTP id 4fb4d7f45d1cf-64d0d41404cso7252234a12.0 for ; Mon, 19 Jan 2026 02:04:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20230601.gappssmtp.com; s=20230601; t=1768817092; x=1769421892; 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=SICmyfT3WauIeYm1hdDlDKFBVwruQTeOZTc4sKAiSViWpuzUvb53aUK/kcz/bEOaWo Ut/19UCLOJvScMS0EnqviVdD2T7O4v+dQnAtV1avg6uq7eo3fkUuCd5Gh8PMfHjHCD/1 dviBX9HJYAO1vBVoHMA1eXflAPJM7aBs/0F9OPYCsUrPDv8sLBEvik9DY6TpMJAyMx9s h33Jt5OCCptdk4hPE8IAIaJb3yao1stUUc3DB6uTewmw/8hcgSxCH3GBV+9+7+KtWBMo CQiLgQjrvAYDOS4LoH5PnYhwY6c+T+5RMSsMbOapY3h7OkOt0evQURosuxDpkUWuosZM ap1Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1768817092; x=1769421892; 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=xMw0L2dyCHBle5+l6X0vQwHv7OZRseJ1ep0r6tVv234KFRLRmXC+WH1YBAmEs8bb9L nZoDo1YCNU2CS6TveHsFZwNnJPIKYLGQ0XVB7lPxDMPciISn5Y6D12lUq2r6ob361oBu tyozpgHGaYj+Edl8wpZahdm6dzmO9LiZ2gDs/6l9KojqwwAptzHjiDBU2n1Bx+C8mHFJ cRNzLMXOzW6zzS7HcKSWC8fvOI8cNaGb58Ykey3rhKOISe6MY2DktdQm0iyttgU0akrb Cu9oCDVIZrMBdI6cSGFoFM/DzRfAPstbrNM8aLi1GMvYR9o1qNoZ340e7k8ScP68y9V4 jRWQ== X-Forwarded-Encrypted: i=1; AJvYcCU4pwOCW+n9YktDbdzE0QHvk0rXYUgstphF2wjvUw7uX5qLnd/8mcvNo0ix/1w23zLXEvVa316pvkqQq6o=@vger.kernel.org X-Gm-Message-State: AOJu0YxJj2SdSIHC17oaw8E2Rv0YUiO7K6E8eebwXX3+SGt9oH1F80xM PO9pBJBVvFyxs+wsuaNRZFIAM098PPqoOAHqolnCLS7xS6773gpMstQ37hUwnk7PXhs= X-Gm-Gg: AY/fxX4XfGJsms/BDPrMHdH0t1uH2Sf28KOYCctiGvlxRWo+DyHPXuITUcLE0FPMSSu dclO+AMBfeeW/NJirEHex2TVRfHaD4UPjp4kMyaqjgeNiNgBR3jXwVHfm7IP/ZrLppgqGgdTuFd LRvnqdx0DTcDLauQB5SRsgpB1StOeJ83XPPKum0QZpHufWaFrbnWTHO2rdkwy51yNFKrC0WyFEh RXiILKEUo6E1JHt4DoVFoz7LupjLpV3aH1Uf44j6QncsFapVHF5uLFu+gd2XYg/69ZgP/OSR4NA 5PTK67qVYJUbNf6gLApqlAy1yA19GehLXntShWNN9S6pKN73ORXaEP9E1KnqruPJgCsA1hM1psf i9yFWsZaPGB1Qk+nwMi/qxTIDU+YyzrsX/J1IzlH2Veu3jImpZsFcrwI= X-Received: by 2002:a17:907:6d27:b0:b73:7b97:5bfb with SMTP id a640c23a62f3a-b8792f79634mr963249466b.33.1768817091611; Mon, 19 Jan 2026 02:04:51 -0800 (PST) Received: from localhost ([151.37.196.5]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-65452cda145sm9797493a12.9.2026.01.19.02.04.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Jan 2026 02:04:51 -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 v3 1/3] iio: imu: st_lsm6dsx: set FIFO ODR for accelerometer and gyroscope only Date: Mon, 19 Jan 2026 11:04:47 +0100 Message-Id: <20260119100449.1559624-2-flavra@baylibre.com> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20260119100449.1559624-1-flavra@baylibre.com> References: <20260119100449.1559624-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/pANAwAKAe3xO3POlDZfAcsmYgBpbgGowZOLCXnAHBgihNqEZpm9U7tlz7gxjSjf/ ONRRLt/DCKJAbMEAAEKAB0WIQSGV4VPlTvcox7DFObt8TtzzpQ2XwUCaW4BqAAKCRDt8TtzzpQ2 X4b3C/9T+3fo5duBrXG1i+844DEj+97f2r0YKyGOfC5Q9X4PFTJjMtq2tiFwKBZw6YyzuWtv9Rw kQkcCUphhHrbcMBtU2qf7dBNtvxTMnaQtkpVOG1jlknJy5+0gUVYsUOSElGhGqxp/e3PIuGDBOA xJNTKF2TH11yi5LxOtWGyKL5wFi5Qy4Qt85Yd+7f+gdy7K0p+yIxJH+y6a/56Oq3Eg6SypW9s/O BVyHqckVeDlAvI3q/qC6jVnH8tGvzQtxTkQS3kMcQRl5U++kQaPYnb8qOlW9A0GlyrCUtpoRF21 /rXaM/KVADCyY8mxNYzDXxUlJwFse84GHApTBAiGZzLkYA4HJcMewrVzerYsPsv9YWCS9B65STN Kvrku56MQY+Lt2RF1LGdckAaP8EnG+TzNfVA3KQQorJqAihhBhtmaV8Q2ng9lMBeMFZT0bvwy7C 7USbHep8CyMjfI2q4+6JVriI6+3SeV0lWv5+UY/nFeCufj+pJ84th+Zfa7VDpx2r6OWE8= 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