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=1796383238; b=Qi6l2A44XE7GrO1WcWFlC7uJd+jUyHxlqu9fMpKGKrUaiXVBWQLRBLpt7Fuo3DwLgLma rAhBWa8SsktBUSn4OKMK69uG0upOuM+TjjuWP7u+ApHPOGdVFfMY4sk52gticA+OA099/ cIFjZzGaEP3O7x7Kw7nLaZAXDdQWuxGqjsVTSn8IZwJhNQ5FapZLob8pqztl1VzBiD1FO irujMqDZnLhOb6tJvFJKWgjgVOlWRrtofXYWnMrO1BgLH7iynYyYoRhK/QlCPhCRoTYIw xHdr2fEHEJejwS6fqgeCUFENnD2kCHXGGVNFETepT8K+5veZMMS0u3xXcqFRhL8zEnw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796383238; 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=WzeQLtASqyHfVoBufT1NpDHB9VeSElIPZhdj4gQVUrw=; b=jKlLGH933eYGiC/09UfzfcnJRe1FW7VMwJ6rARI3RzUBCmgB6rn4+IZu3IGaFPDgSHJk gF2sFF72PxF6fKiCbg1EjnnjFtI35qGVCu3FRlfv8FOyUhTZs1Pm7c0JuZaZoDKibGk3J /0xBTlrugqPBcTvWucEtqrwjoBUSQoLkoWA7yiw8ZUwR6fymIfmUiOabwUx71IcyCGiqZ kcmQZWXkI7GsHlQSE1XVLTXEWyaRg73VlKDMHteuMT9hOevpTJU6GfsKY/Wx9pczyF1EW 6NPrxrroc8B5ke+Evhw1EHg9bi1UQOamiUhBpAtbBX1IP2bLkmxH9WkjcBvZR8K/Tpw== 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=zRremGFV; 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 63E4D606A32C; Fri, 4 Dec 2026 11:20:38 +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=zRremGFV Received: by smtp.kernel.org (Postfix) with ESMTPSA id D124D1F000C2; Fri, 4 Dec 2026 11:20:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796383238; bh=WzeQLtASqyHfVoBufT1NpDHB9VeSElIPZhdj4gQVUrw=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=zRremGFV8ZCzMIQJD12yN9WJscp7oxTOqkp6gSeafm9qJoqsKZd43jxu2a00H5PYU awC5AbomQOXxAvGclL5BWVUqSIFScIviCdM6ytwxstVsGpEcWKfPhi252t86achgIy YxhDa9x7gD1F72u4ajzBYf6oMTtn7Zn3H42O1//U= 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.12 142/555] iio: inv_sensors: do not compute period estimation when updating odr Date: Fri, 4 Dec 2026 19:03:05 +0900 Message-ID: <20261204100613.155601978@linuxfoundation.org> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261204100603.988357525@linuxfoundation.org> References: <20261204100603.988357525@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.12-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