From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1794063945; b=17YUj0uZ1szrOL/uxmd9m6xkcJO/pNnF0xSAJHuBKoGK8McRR+oWy+Ia44dI3wq8yIGP Pk+DaPb/LOhKlPQoBKY2OIU5Ek63GFUt50McQauVtgwKDHWRjM80IgDI8xySAJ8EDj3CR OdR9I9auvZXc3apObwboKLpib96Lgz5yd6LLYXeeAeWV0WiOaaKhXqPcLofuM38smfjD4 yuLWm1rL4SdC83BkACcFTNwQWVJsAkbDmWgPNJ4vPh0hw6y0kGJ9Z0yx0xPeH/QdWB6+Y shjhROjSuFhujSfVsMZRJk1+HmoZYa0inWrNxvkKauk+lTJwRdZA0u60O6i5+Q5CQVg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1794063945; h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:User-Agent:X-stable:X-Patchwork-Hint: MIME-Version:Content-Transfer-Encoding; bh=3is1g/jjUV69MWE37SOHdnKZdTakNRrWLGaig/KPyks=; b=Hpmh5xoKJOlHHhQRXmcUISmaZg9UxpQD0XBUpY2BpYP/EoWSEa+P9YcERjOVPBFQAM67 Z1GRahLVrEiCvPtirehcBTrTjUzvr+pq4n1Hlykh2C8cWUd7ohRYYqFZMSNl01NEtic7A dfMDoIQA/g/TQ8DEQs3FZAbhU7QCcCdO89vCytVzgeamiZMFyeKE4HGGgTLgFD9tSJKsl hDiBRmqfxmsUuCqQxugJifAfw9rUlbtCYDxM4EMmL4qF20XFgGc56aoXkz9RRsV+3i8fZ 5SWY1B2A2rRBgz9Z7f+z4dE/LnplQJZiOCv9gQcJR0l2fUVHe8TKv4HNaISLMBOktnw== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=CBTf4t3b; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 40B42606D829; Sat, 7 Nov 2026 15:05:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=CBTf4t3b Received: by smtp.kernel.org (Postfix) with ESMTPSA id E2B3A1F0089F; Sat, 7 Nov 2026 15:05:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1794063945; bh=3is1g/jjUV69MWE37SOHdnKZdTakNRrWLGaig/KPyks=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=CBTf4t3bNZgBtrwiYpVEk0MqPc0RztWPWobQaUzTDsGWQ2X0DRy7wb6huvoqc9J0Y cTUz2sgYOggbYj0sVkZfaunY5UFyVTBYQ7geeMtW/biM2igK9jHLJ8A0PAKwTwJv7z qQvvrT+5cOeC9p0jo5iEjBcrxcittid1ZvQaF4wQ= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Jean-Baptiste Maneyrol , Jonathan Cameron , Sasha Levin Subject: [PATCH 7.3 0137/1257] iio: imu: inv_icm42600: fix odr change not caught in certain cases Date: Sat, 7 Nov 2026 08:40:33 -0500 Message-ID: <20261107134943.093677944@linuxfoundation.org> X-Mailer: git-send-email 2.56.0 In-Reply-To: <20261107134939.434104957@linuxfoundation.org> References: <20261107134939.434104957@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore X-Mailing-List: stable@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 7.3-stable review patch. If anyone has any objections, please let me know. ------------------ From: Jean-Baptiste Maneyrol [ Upstream commit f670d4d3477386d62017936f0121909f93ac17f8 ] When using both accel and gyro with different frequencies, the ODR change flag in the FIFO header can be sometime in a packet with invalid data. Since we are ignoring these packets, we miss the ODR change and any further change are blocked until sensor is turned off. Fix this by moving the packet data validity check after the ODR change flag check. Fixes: ec74ae9fd37c ("iio: imu: inv_icm42600: add accurate timestamping") Cc: stable@vger.kernel.org Signed-off-by: Jean-Baptiste Maneyrol Signed-off-by: Jonathan Cameron Signed-off-by: Sasha Levin --- drivers/iio/imu/inv_icm42600/inv_icm42600_accel.c | 8 ++++---- drivers/iio/imu/inv_icm42600/inv_icm42600_gyro.c | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/iio/imu/inv_icm42600/inv_icm42600_accel.c b/drivers/iio/imu/inv_icm42600/inv_icm42600_accel.c index 4b0e3cd8a5067..b2ad1bd202b4f 100644 --- a/drivers/iio/imu/inv_icm42600/inv_icm42600_accel.c +++ b/drivers/iio/imu/inv_icm42600/inv_icm42600_accel.c @@ -1227,15 +1227,15 @@ int inv_icm42600_accel_parse_fifo(struct iio_dev *indio_dev) if (size <= 0) return size; - /* skip packet if no accel data or data is invalid */ - if (accel == NULL || !inv_icm42600_fifo_is_data_valid(accel)) - continue; - /* update odr */ if (odr & INV_ICM42600_SENSOR_ACCEL) inv_sensors_timestamp_apply_odr(ts, st->fifo.period, st->fifo.nb.total, no); + /* skip packet if no accel data or data is invalid */ + if (accel == NULL || !inv_icm42600_fifo_is_data_valid(accel)) + continue; + memcpy(&buffer.accel, accel, sizeof(buffer.accel)); /* convert 8 bits FIFO temperature in high resolution format */ buffer.temp = temp ? (*temp * 64) : 0; diff --git a/drivers/iio/imu/inv_icm42600/inv_icm42600_gyro.c b/drivers/iio/imu/inv_icm42600/inv_icm42600_gyro.c index 253bf571439d9..41e46276e6f22 100644 --- a/drivers/iio/imu/inv_icm42600/inv_icm42600_gyro.c +++ b/drivers/iio/imu/inv_icm42600/inv_icm42600_gyro.c @@ -808,15 +808,15 @@ int inv_icm42600_gyro_parse_fifo(struct iio_dev *indio_dev) if (size <= 0) return size; - /* skip packet if no gyro data or data is invalid */ - if (gyro == NULL || !inv_icm42600_fifo_is_data_valid(gyro)) - continue; - /* update odr */ if (odr & INV_ICM42600_SENSOR_GYRO) inv_sensors_timestamp_apply_odr(ts, st->fifo.period, st->fifo.nb.total, no); + /* skip packet if no gyro data or data is invalid */ + if (gyro == NULL || !inv_icm42600_fifo_is_data_valid(gyro)) + continue; + memcpy(&buffer.gyro, gyro, sizeof(buffer.gyro)); /* convert 8 bits FIFO temperature in high resolution format */ buffer.temp = temp ? (*temp * 64) : 0; -- 2.53.0