From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-ej1-f48.google.com (mail-ej1-f48.google.com [209.85.218.48]) (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 5EB4F3A7830 for ; Wed, 7 Jan 2026 15:40:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.48 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767800406; cv=none; b=Uq0rOSGzPgYLZiqohdA+BKj8lQ5jPDqKbNW1Xas2cTcwccLTnSPcBPu8jqNekv4utKlaAmuoKoXXarFhdPX3qHTUyp7QYJFF0wwq4NgCIrU4tGbZ0BY3ZyUoTEQFS4gzOKbjQCBWYHY2d7qhuZrz5JOk6/HgFKPOKkszfoLQnKg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767800406; c=relaxed/simple; bh=PwLA3Zx5Zn2HiWNWCkNzXiWy47mDo7eka3UjyZ+0sto=; h=Message-ID:Subject:From:To:Date:In-Reply-To:References: Content-Type:MIME-Version; b=M3PxnzDqMB5bVcU5+fn8gaG/LXFwadnwkH4fRdggPnkqM/C9y/2fNqFfDCJbzh26WHGDNR5JIm3+O6lKXqjocYlTTQronThiSza0QV7GN+2YK+epiGfnakyjURGA0S7pvt31Fjvhh9SC2YmyEwl6Ss5bAc83BFwe+hMS3AcjWrY= 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=MVGIvWUZ; arc=none smtp.client-ip=209.85.218.48 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="MVGIvWUZ" Received: by mail-ej1-f48.google.com with SMTP id a640c23a62f3a-b73a9592fb8so175962066b.1 for ; Wed, 07 Jan 2026 07:40:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20230601.gappssmtp.com; s=20230601; t=1767800402; x=1768405202; darn=vger.kernel.org; h=mime-version:user-agent:organization:references:in-reply-to:date:to :from:subject:message-id:from:to:cc:subject:date:message-id:reply-to; bh=PwLA3Zx5Zn2HiWNWCkNzXiWy47mDo7eka3UjyZ+0sto=; b=MVGIvWUZWHmwKKydT3X0OkI3mAp/sfyb+jBIiRMTG/SmNWUEgks5y0WewWjoL1o2nJ qZBa48dEXBRoRs8ikKlWdnGFM/Ahq6Qu4jyAi/OX7JsXzTDi+1eDOiYP6nBXO5pNPZ3x JrDmTrYwMGB3gRQosrrhVVyCDLXk7Nl+eOUs1kVjxQ6kmApRIuwJ8QioHkY6cZvVcFqD 43rr3SAD6lcPrp18KqQdEtpWfFnKCcWAgpdjOGvD/BeIQp54wxIJIFWNFHMxUPFRv/wd 3VIoYhtBIsMvygcUIXYw7aOVizzC9Bi5zFHYwiMMyBcZpPf+PeKiz/ipUV3J4DbUdBBR zqyA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1767800402; x=1768405202; h=mime-version:user-agent:organization:references:in-reply-to:date:to :from:subject:message-id:x-gm-gg:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=PwLA3Zx5Zn2HiWNWCkNzXiWy47mDo7eka3UjyZ+0sto=; b=Cz95PcbIvUpwlKqE6CeyJkuyYH5kqxm2bBrLllLBVBkp36F7Khh/Xh+zUZtCOItIrY 6PjPJ7bhobMWvGBD70CFYXlAXvNjIow7Sd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g22wtE0HI/0++7uGN6w== X-Received: by 2002:a17:907:a08:b0:b07:87f1:fc42 with SMTP id a640c23a62f3a-b8444f488f0mr347306866b.16.1767800401548; Wed, 07 Jan 2026 07:40:01 -0800 (PST) Received: from [10.203.83.20] (mob-176-245-178-111.net.vodafone.it. [176.245.178.111]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-b842a5126d6sm537439666b.50.2026.01.07.07.39.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 07 Jan 2026 07:40:00 -0800 (PST) Message-ID: <9a5db937dc7072d95d6757cdf2eb8d6fde4abbd0.camel@baylibre.com> Subject: Re: [PATCH 2/2] iio: accel: adxl380: Add support for 1 kHz sampling frequency From: Francesco Lavra To: Nuno =?ISO-8859-1?Q?S=E1?= , Ramona Gradinariu , Antoniu Miclaus , Lars-Peter Clausen , Michael Hennerich , Jonathan Cameron , David Lechner , Nuno =?ISO-8859-1?Q?S=E1?= , Andy Shevchenko , linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org Date: Wed, 07 Jan 2026 16:39:54 +0100 In-Reply-To: <52e5cea72b99fc23c922cf74d7dce3403f43c9cd.camel@gmail.com> References: <20260107123518.4017292-1-flavra@baylibre.com> <20260107123518.4017292-3-flavra@baylibre.com> <52e5cea72b99fc23c922cf74d7dce3403f43c9cd.camel@gmail.com> Organization: BayLibre Content-Type: multipart/signed; micalg="pgp-sha512"; protocol="application/pgp-signature"; boundary="=-8+xrSS0UILKS/MgU7OkV" User-Agent: Evolution 3.46.4-2 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 --=-8+xrSS0UILKS/MgU7OkV Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Wed, 2026-01-07 at 13:56 +0000, Nuno S=C3=A1 wrote: > Hi Francesco, >=20 > On Wed, 2026-01-07 at 13:35 +0100, Francesco Lavra wrote: > > In sensor variants (such as ADXL380 and ADXL382) that support low-power > > mode, the SAR signal path allows sampling acceleration data at lower > > rates; > > more specifically, when the sensor operates in VLP mode, the sampling > > frequency is 1 kHz. > > To add support for the 1kHz sampling frequency value, modify the > > operating > > mode selection logic to take into account the sampling frequency, and > > configure the decimation filters only when applicable (i.e. when using > > a > > sampling frequency that relies on the DSM signal path). > >=20 > > Signed-off-by: Francesco Lavra > > --- > > =C2=A0drivers/iio/accel/adxl380.c | 49 +++++++++++++++++++++++---------= ----- > > =C2=A0drivers/iio/accel/adxl380.h | 10 +++++++- > > =C2=A02 files changed, 40 insertions(+), 19 deletions(-) > >=20 > > diff --git a/drivers/iio/accel/adxl380.c b/drivers/iio/accel/adxl380.c > > index bbf1f88ca781..a6919dfce2e9 100644 > > --- a/drivers/iio/accel/adxl380.c > > +++ b/drivers/iio/accel/adxl380.c > > @@ -245,12 +245,14 @@ static int adxl380_set_measure_en(struct > > adxl380_state *st, bool en) > > =C2=A0 > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0/* > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0 * Activity/Inactivity detection available only = in > > VLP/ULP > > -=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0 * mode and for devices that support low power modes. > > Otherwise > > -=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0 * go straight to measure mode (same bits as > > ADXL380_OP_MODE_HP). > > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0 * mode and for devices that support low power modes. > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0 */ > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0if (st->chip_info->has_low_power && > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (FIELD_GET(ADXL380_ACT_EN_MSK= , act_inact_ctl) || > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 FIELD_GET(ADXL380_INACT= _EN_MSK, act_inact_ctl))) > > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0st->od= r =3D ADXL380_ODR_VLP; > > + >=20 > So before this change we would go to low power mode but still report > whatever sampling frequency > userspace had configured (which I guess would not correspond to reality)? Correct. > With the above we'll > update the reported odr right? Right. > Some things/doubts that come to mind: >=20 > 1. If I'm right not sure if this shouldn't be treated as a fix. Yes, this technically fixes an existing issue, but I didn't advertise it as a fix because solving the issue requires adding support for the 1kHz frequency, which seems to go beyond the strict definition of a fix and sounds more like a new feature. =20 > 2. Should we cache the current odr so that we restore it when > appropriate? Do you mean caching it when activity detection is enabled and restoring it when detection is disabled? It could be done. > 3. Other thing that comes to mind is if it makes sense to allow > controlling odr if > Activity/Inactivity detection is enabled? Disallowing odr control when activity detection is enabled could be an option, but what error code should be returned if the user tries to set the sampling frequency value when not allowed? -EBUSY? >=20 > Thx! > - Nuno S=C3=A1 >=20 --=-8+xrSS0UILKS/MgU7OkV Content-Type: application/pgp-signature; name="signature.asc" Content-Description: This is a digitally signed message part -----BEGIN PGP SIGNATURE----- iQGzBAABCgAdFiEEhleFT5U73KMewxTm7fE7c86UNl8FAmlefkoACgkQ7fE7c86U Nl+YygwAn1ZW3kg/CNvPcdo4qKSi9o/5I/FuTM2rQvY4f2BHGt8W7Y994KenUwW8 gepz01h4sBhCcbyYqUJmzIE57PIhGT6tg2lQPmEinq5qHJW/yvjENLAKBk0+gG5o rPZKg0C/SDw2EIJed1M9OaWU4kHRzicMCq6HM+9ZWgIWPkEkyk33QDbOEAOZLTOX i5YT+bpFKhv6hucKdCFyMGf5j4xChIedNJfOKhqqRO2VahHsmETAWer18Vctaiy/ g5NaRRxOlZCZZsenKrptH1cMpJvsgPXKfexw3Q8tM5YUPFkf7xE+8b4LBsFv5Avo 3YvmY4M5FSPSm+7FObADZSgnwG1BKcGC1U4h3rXPHEPmtT41GvEbUpqwKx5KhXU9 3uUvxhCTVWQ53GO6/vGItrnoht7EEx8XAUB72SsthZse4tWFoxDrOGIQUiydbjar fGAlx9y49QjXsnJq5/jahyO9IadENkbeOH86T0GiLZTkTVOSW+8HliOcCAi2c8TR 1/SCyTVh =lgfG -----END PGP SIGNATURE----- --=-8+xrSS0UILKS/MgU7OkV--