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=1796386139; b=3BL+5oLGhaGX/qLJCiEZjrsTUOs1yEHQ69b/7oPcGAuTJQ0I2qEusyc9kIIE6tpVjzAs qFz0rlEBUMgN+recFd0e1myBNI+ZJu/sMjm5xDE6Mu5Id7u/7EHGzPegCyJB+ht6vrdjy gQEFYODUM0EVIPWjWyGGFUYEg6tAfEAHS43lpvTtVL3HKWxXAT8YVRx9A0h+FfO7SLMTC 2jkNg69eJ49FXGm0JKQXbFAoWpgitrmco00UMl0gtKudgdgISEM0jvIiB3x+Og1Ext0OV fICpoFdOo4QTSrvyX4e6dO1HJ0wSc1d4oKvlArZrNvvI8q1djTxkkxLNFv+fQfeHLqg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796386139; 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=UMZTkVuBRW1nRLXKV/fwOCDgGRxfTV2fvt8yEM0hnP4=; b=eiYZBUqRxshdm+P3JKhTe7q/poQ3wbPwjPFeTUABOtv9E5Tf3Zz/AMhE9Y9HsyOSKhvP g4degJmGi0sBxBZOy0oentbOpRxz7S7TwxA9yE0xAqQSVaYQQNwZb8TftFrk0nuDSnGUv mRzZTRObzf/wSz8ZTyTcL+Btmfa+EYVqkaD/hpoGs9EmIJd4AqR0gVUvpUsiiTePKi7QN AIHmNVj3iNSJushyBYbZRkJIHlKU3G0g8ayMRknVbilJHUtnHQGtGxdIBQuBYDF4nu2/l +gNAGMIEg8mb5c32oEs/iTWv41vpCls8HPthPw6UERxc5vbF0gX/oiwYaQ+adTymoZA== 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=GzBXVu+X; 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 19D5E606A322; Fri, 4 Dec 2026 12:08:59 +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=GzBXVu+X Received: by smtp.kernel.org (Postfix) with ESMTPSA id 266F91F00931; Fri, 4 Dec 2026 12:08:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796386138; bh=UMZTkVuBRW1nRLXKV/fwOCDgGRxfTV2fvt8yEM0hnP4=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=GzBXVu+XJvbmlXpb+RHlmFtFQ2rOOJoCndiou4/V7GESd3ejp/P9iRjCOhKmriOsj QR2pvrQBXF42sZqdN1rL5jale8H2iOE29GPHdtKlcsGmzSzZ7ZrLWk+YlAOSLubZYS 3V33nvWhvv9SOAlNcDGtt66uT1pMAWwFYUmgA6bw= 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 6.6 0842/1167] iio: inv_sensors: do not compute period estimation when updating odr Date: Fri, 4 Dec 2026 19:04:29 +0900 Message-ID: <20261204100724.052526275@linuxfoundation.org> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261204100702.047403948@linuxfoundation.org> References: <20261204100702.047403948@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 6.6-stable review patch. If anyone has any objections, please let me know. ------------------ From: Jean-Baptiste Maneyrol [ Upstream commit 0d695709ed380f1bc9303a91f57525d33766a07e ] When odr is updated, the delta between the interrupts will change and it will lead to a bad period estimation. Avoid this by preventing the period estimation in this case. Fixes: 82bd09ce4fd3 ("iio: inv_sensors: improve period measurement by using a longer delay") Cc: stable@vger.kernel.org Signed-off-by: Jean-Baptiste Maneyrol Signed-off-by: Jonathan Cameron Signed-off-by: Sasha Levin --- drivers/iio/common/inv_sensors/inv_sensors_timestamp.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/drivers/iio/common/inv_sensors/inv_sensors_timestamp.c b/drivers/iio/common/inv_sensors/inv_sensors_timestamp.c index d46646510bbb6..1f44402b5b958 100644 --- a/drivers/iio/common/inv_sensors/inv_sensors_timestamp.c +++ b/drivers/iio/common/inv_sensors/inv_sensors_timestamp.c @@ -147,6 +147,12 @@ void inv_sensors_timestamp_interrupt(struct inv_sensors_timestamp *ts, /* update delta timestamps and estimated period */ it = &ts->delta; ts->delta_counter += sample_nb; + /* reset in case of odr change */ + if (ts->new_mult) { + it->lo = 0; + it->up = 0; + ts->delta_counter = 0; + } delta = timestamp - it->up; delta_threshold = INV_SENSORS_TIMESTAMP_MIN(INV_SENSORS_MIN_IT_DELTA, ts->chip.jitter); if (delta >= delta_threshold) { @@ -166,7 +172,7 @@ void inv_sensors_timestamp_interrupt(struct inv_sensors_timestamp *ts, it->lo = it->up; it->up = timestamp; delta = it->up - it->lo; - if (it->lo != 0) { + if (it->lo != 0 && !ts->new_mult) { /* compute period and check validity */ period = div_s64(delta, sample_nb); valid = inv_validate_period(ts, period); -- 2.53.0