From nobody Sun Feb 8 21:33:56 2026 Received: from mail-ed1-f52.google.com (mail-ed1-f52.google.com [209.85.208.52]) (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 4FE5F366557 for ; Fri, 9 Jan 2026 18:15:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.52 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767982538; cv=none; b=JDwyMe8O+8ZjpjKVCjYwwDhi126gkredsAwXV/NZBb86p2ptbHBtQTZEwji3Paw4tB259NLVzToYYEL370TR3/ROnrmaVkQarwv8fBbsmH5IomUGwnrSdF6dzZZuJLOdo8EUbBMn3nzCrC44mvxNVRP9HinDTvwBQFuswx0Ip24= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767982538; c=relaxed/simple; bh=HyDQvFt38CbL24666SIbmPISPjsBCOGkvrEjkNdUEYM=; h=From:To:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=AoKovHzy1hNAjvWC7V6HWSVOGycU/R0fl7FMOEq7NCLaEwJo62SoBBP+9ipkR9zNC8CX9/ys2rgs3N/00k75VqFd4jcrF8Y8eZUGLsZBy7O9O4wInoLH/OoxoOlGsX9ZK/iFEGVrVreNRK30JISM02VQPRY1KncKz+mrn+IxNZk= 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=NnKNyeqr; arc=none smtp.client-ip=209.85.208.52 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="NnKNyeqr" Received: by mail-ed1-f52.google.com with SMTP id 4fb4d7f45d1cf-64c893f3a94so5263811a12.0 for ; Fri, 09 Jan 2026 10:15:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20230601.gappssmtp.com; s=20230601; t=1767982536; x=1768587336; 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=jNKSanGi/682T6/bpK1636gCehsHDuuGDNYO8lX6fUQ=; b=NnKNyeqroKLkE2zQ779Kfmyc9snzuvfWVB/2zayT0v/80DEzE4jLXHXzZ6t2jw9bvI i6x3XEBuUTeDeTxfg7h+OuKxecPre4vUaDpFuPfjtKEmouCiT5Rvpp86FTbGlF2QrL+/ AQzI0RBvt3DojRpzK6kTISxS0zZGj2SM9SOnGKhfzA3C0AGFeniSYaE6rZxC3C6E1xaL E6KDXCztqIRfDIRYr8M4rEZcN53Na2sixbBxNv73TUKhymTUhuBMmeDA2dp+66m3bWxk 19rPaMNq5zi1unlBZYtuUzehprCJkLzWxTpO88jK0qlKGjDK6REACWyFffpGmsnhXdAO DJCw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1767982536; x=1768587336; 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=jNKSanGi/682T6/bpK1636gCehsHDuuGDNYO8lX6fUQ=; b=aVQeQKDy5Sy85ZfEtA3udlakqcpzr7l9BAtT8vz9+IaNxxwOyVy8IPvTRVuFkrcpBA DBXVT6Xk30uK2lZWrQkgrSHqr5s7mRlrHUJcy19GEfW6rC8+nwKDw4z3RQeiZW8agDFI tNUFsZwXbH+IVg1mTgrMRjOMemRI/DE8vpTr1pIB1RN5GB1Mc6I/zOLhnIwUQT7U9um9 J8sXH0izIWhmQKqwco6sIJDdgvLc1MXN4Yvc8yXeBEq+nXfBPpfqZ6av7ele4PD4uawI bn+pDy0Oz46fQly5ZUmNhHucH2x32/qN1ILwPi+7JhRoWvkTVy+MKoTdtxYOhka909yu OckA== X-Forwarded-Encrypted: i=1; AJvYcCWzxRMEl4/LOMkAOM+nZ345uIRBqjsJVfUP3D9Ejev4fTFIBsJN6KaV3wO/9hxIJ+RTNQu119zYbYNxfy4=@vger.kernel.org X-Gm-Message-State: AOJu0YxhvhB5iUmT8VynMmAFE+wdJajZoe6fdzRUuFamUWJh7D60mfO+ 5hosAWu8OgXegzpbylO9FmR6IjupW4I+BdDQifa1QGRyoZvQ7VbCI8dWZCE7lPnZSFw= X-Gm-Gg: AY/fxX4on4lOC/smZCu3kF8xeW+oSS+0LCB4QPMSbTWRdZU5T4ZuAz7HBdQKfJ6i1Tl lxTdbJwgYQ2hwSXKlfLmqfOlbkcnTK/CVj3n0P6WyDKrGHu7pTC0ZpnLOm3qWo2OoqUxzIvf1y1 /RGW0RZmG2aXLRdAFKJDfbWi7LyqV50HAzKGEg8s1O00HkbtjK5upUnrjO0jz5sVpZAisK2dp8q GP2aMMcDXuXMVnzhrdiXuj+jmQqzQrpkLOj4pNE1uAoi/CYUMeHklhorpdbmpwDucUcWfelI1Aw 2MUR7wpZRffhIvFTvsEdWpff7VG7iG/hHImCKD8Oveydudflbq7KGmlJ1o09hQsEl4jwmnnU8MP RoXKxinomob2aIPcviM2X0QhC1MvyUn6fCByll3CjcuiTxuq56GT6+6K/OQ== X-Google-Smtp-Source: AGHT+IEdAr73dmVnN674sxfFpbGODRqcsy8dZfQgBLgbGjQzIlujJ+Urus5GqDJjCqurPfWcvbCuOQ== X-Received: by 2002:a17:907:971d:b0:b80:3ff7:e43d with SMTP id a640c23a62f3a-b8444faa4femr1109183766b.26.1767982535706; Fri, 09 Jan 2026 10:15:35 -0800 (PST) Received: from localhost ([151.47.174.220]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-b842a4cfe6bsm1174309566b.34.2026.01.09.10.15.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 09 Jan 2026 10:15:35 -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 2/3] iio: imu: st_lsm6dsx: set FIFO ODR for accelerometer and magnetometer only Date: Fri, 9 Jan 2026 19:15:27 +0100 Message-Id: <20260109181528.154127-3-flavra@baylibre.com> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20260109181528.154127-1-flavra@baylibre.com> References: <20260109181528.154127-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=1725; i=flavra@baylibre.com; h=from:subject; bh=HyDQvFt38CbL24666SIbmPISPjsBCOGkvrEjkNdUEYM=; b=owEB7QES/pANAwAKAe3xO3POlDZfAcsmYgBpYUWGk8yDBpa5cnHA5yE2LmLq9JwJ7/3Z7nuTl Ak+T8zMK/2JAbMEAAEKAB0WIQSGV4VPlTvcox7DFObt8TtzzpQ2XwUCaWFFhgAKCRDt8TtzzpQ2 XymmC/9F2DC5VZETvTqxNEzTvp8IPesMArEGV9mIXgu3f8Yg6KfzKa/xNifgCmH7NghoMeMIPpq F/DZnPYO7foWKEuCJ5d3pP9FNZ0+a8pe4wgpmGsHugtkI6wqtAjS2AaJp/0kfDokLodSu7EFwvP xqbcbkCC5esPEygIoUO0cWCeJPjw/4r/rN8QWOPY/YPZjLA8PMZkVjg3FWGk5p9Mi8+ujIeGiCR zKv7Xhtk8yX+yOWJklFqjo0BgUgrzsbIsO1JemYhkaFWVGx2vvbiljBQ5azsJGzRqs8Z3kDbsRw 0qVbafSIHisScaszRNO0hg0LkbEeULnPR9bAUCbPMWbOTS9ejGdVtObQW9bzbunbLJsYsio5/5o miI27lYfAlHHTF+kl9Z8Qqyu7BX2U5D+0sVOnlFaNCU7N8AyXi8RBVS5K0cYPMbvPmx2V9OlkM7 LVN2Lj67FSXetieHNATuqnw4zCAIMa//68w1ufgVAXVCPSNp/z51Sv3jpyAPqf3CXkpQM= 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 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 sup= port") Signed-off-by: Francesco Lavra --- 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/i= mu/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_se= nsor *sensor, const struct st_lsm6dsx_reg *batch_reg; u8 data; =20 + /* Only accel and gyro have batch registers. */ + 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