From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wm1-f47.google.com (mail-wm1-f47.google.com [209.85.128.47]) (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 B1E0B44B670 for ; Thu, 8 Jan 2026 13:45:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.47 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767879929; cv=none; b=LiOy5FA6VqKsO5rc74YZ9kts3J9dK3NGpv3Y9JUf3NtvzJVt1K7fJ5rfifQp62snS//c5Y+5GiQ2/s5/Xzr91C0CVCGTiEFLvj7Xg8yiD9MC8Bw84hNWgJpowwcProcE4nW9IhaESxOLSX6jnaKb0IvRkMA9Dd17wLVcQhG+h34= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767879929; c=relaxed/simple; bh=CA+OcVYwlAR0KUjhM+FdFOnuU8HCz2zYR3BYb70ICG8=; h=Message-ID:Subject:From:To:Date:In-Reply-To:References: Content-Type:MIME-Version; b=iThzCsuEyh42wDTbtnRf5djDw0KZzMAGL4OiI80xOHY2qAj0VN6z7B6GyljdkGwInAmEizmAyYVqxAUQFnBEJPr1Ecb4BZUbAxQiyG7UYBHCQA0BYmOC7UBcj44GKGE9FSdun5VkxjhnnaJL37srhxh3HbUhfvI9sv0nXTLnl3o= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=nrZnx2ec; arc=none smtp.client-ip=209.85.128.47 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="nrZnx2ec" Received: by mail-wm1-f47.google.com with SMTP id 5b1f17b1804b1-4775ae5684fso15236345e9.1 for ; Thu, 08 Jan 2026 05:45:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1767879917; x=1768484717; darn=vger.kernel.org; h=mime-version:user-agent:content-transfer-encoding:references :in-reply-to:date:to:from:subject:message-id:from:to:cc:subject:date :message-id:reply-to; bh=CA+OcVYwlAR0KUjhM+FdFOnuU8HCz2zYR3BYb70ICG8=; b=nrZnx2ecKbeDjKimNBBEFbVp3Teuh885OU7YYKljuFaL+FPf5ra04EGHTffGCyxyJo cLnz5EuLHVUQIIEe4zUj9rMIkTJozzzNIfb50rtAFoE2tLqgl+jjaA+3H2tU6rH42DOf aeI6GNh56+TB2NceBI68w4AJgqjmYuyPj0OC3betLmpIXbk1aZHClEvSWY4htmrRXEID 0DUsXvrhmLRvEP7H0mQautb05Xgqt15A3p6BqS/ZqfPPuuM1Qz8dbMhUeEw3LFdvkBIr 3yCWi0XvDEe2h42Fg6KjKqqw6vOAwon6m5iuAijSFtxlxxXp1UOh8dlSVSrVfW5YSlMD ZSvA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1767879917; x=1768484717; h=mime-version:user-agent:content-transfer-encoding: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=CA+OcVYwlAR0KUjhM+FdFOnuU8HCz2zYR3BYb70ICG8=; b=eX35I6uftpUPsafijG1WROu0kFFlKwNOKANbu0E0m560bvIcPA37bzrBBfRvXXfpVb w7azXJ8klCiV0YkCtAGUefnsM+Xpyx028Y0DriFVyZGLooNQS1AxRLphcv5iiiz5eE1D +GruknOCtuWyDs3Q/ddW0aoCUgGanT9q+BAgrrrWEW44JwwH2weN8DNnvKobB09uMDtr 3viZorMjoMaRb/TdsV5c5Pl22BPpoVh6nR6G56T+lfkZJcTleQh4+HJlyEcPtRiHGMfF vCPYP2s4enqGqeKB7JspFHbzobgEfgbALVBpkTVm/SgFjAr1OS7cjjCH6fbhVjRIP/sF 9bKQ== X-Forwarded-Encrypted: i=1; AJvYcCWLeSM5s/wjjlPzKAGSs90KjAcuzyBSycuOvSCtGCKKXFRjec4U5GNlvGtNpswu97s0Kq7LdBe5hdb8AL0=@vger.kernel.org X-Gm-Message-State: AOJu0YzchDHGZSUfYjcL625JC0V3v+r/NRe4BpUXIJctbZKGwBoQC9Dw e63B6ilvO3rmTjdT3a4+4rEOLwELORG5m8DLjhQWD/vgdAELtnAJ7Fq/ X-Gm-Gg: AY/fxX4DJZvDXRlf5sxhHr9rk1dcEzgYI6WmcyVEwCg2AcMNfMDq4xKGo1jLEOfS4v+ rOUV3qPcW7PhPayL644uzCwB5Z4ohCs+1G8FZMR+AKLef9J12wq2MrvA3qeivxEb46UGcY0uLhG ooPl9t7yR0lf62graWZkYHtdOtnNQ1ltfCklQE7im7QjaKFtbmJzZCIZizaFzIxuxGYhMy2zNiF UTxCTgFJGXTrgQNn1xCMQ5uPwr3cPBkSwFNCNhxd2h+aO9kt625WguUloa+VA9ghD/2TYmOAivc pOMPK1J7/YzeSfW1TCzat7K6rCHniwFIcOeJtXcUc+rFek9hWGHG3LZuOn03iz+c+PdbSZpf5wD foXgR5p8nRNsqMLJDqu+HA1x3kyrQ2szux3ZVoPYt/z2OEDj0d7rRdw45ig/Jia+/V7t9lPDINP YEyi8koVECP1wcJVK8bar6SD+NPPCKBw== X-Google-Smtp-Source: AGHT+IGqC+YpFC8AtrYSr5K2U+LOC6qSa9F/xVWtbGW+5nd3fTLz34UJcjifFLY4mVHx9luSsoW3bw== X-Received: by 2002:a05:600c:470c:b0:475:da13:2568 with SMTP id 5b1f17b1804b1-47d84b39626mr67416585e9.25.1767879917115; Thu, 08 Jan 2026 05:45:17 -0800 (PST) Received: from [192.168.1.187] ([161.230.67.253]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-47d8662c09bsm41168155e9.2.2026.01.08.05.45.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Jan 2026 05:45:16 -0800 (PST) Message-ID: <5cd68e397bb45f606f59038290e4f3ac09d241da.camel@gmail.com> Subject: Re: [PATCH 2/2] iio: accel: adxl380: Add support for 1 kHz sampling frequency From: Nuno =?ISO-8859-1?Q?S=E1?= To: Francesco Lavra , 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: Thu, 08 Jan 2026 13:45:59 +0000 In-Reply-To: <9a5db937dc7072d95d6757cdf2eb8d6fde4abbd0.camel@baylibre.com> References: <20260107123518.4017292-1-flavra@baylibre.com> <20260107123518.4017292-3-flavra@baylibre.com> <52e5cea72b99fc23c922cf74d7dce3403f43c9cd.camel@gmail.com> <9a5db937dc7072d95d6757cdf2eb8d6fde4abbd0.camel@baylibre.com> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.58.2 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 On Wed, 2026-01-07 at 16:39 +0100, Francesco Lavra wrote: > 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-pow= er > > > 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 usin= g > > > 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 mode= s. > > > 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 mode= s. > > > =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-= >odr =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= )? >=20 > Correct. >=20 > > With the above we'll > > update the reported odr right? >=20 > Right. >=20 > > Some things/doubts that come to mind: > >=20 > > 1. If I'm right not sure if this shouldn't be treated as a fix. >=20 > 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. > =C2=A0 > > 2. Should we cache the current odr so that we restore it when > > appropriate? >=20 > Do you mean caching it when activity detection is enabled and restoring i= t > when detection is disabled? It could be done. >=20 Just and idea. I think it makes sense since enabling activity detection wil= l change things under the hood and some users might not realize it. But it is not super imp= ortant I guess. > > 3. Other thing that comes to mind is if it makes sense to allow > > controlling odr if > > Activity/Inactivity detection is enabled? >=20 > 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 t= he > sampling frequency value when not allowed? -EBUSY? I think it makes sense given the constrains on activity events. EBUSY would= be my choice as well. Out of curiosity, do you know how the chip behaves if we change the odr wit= h activity enabled? Is it just ignored? - Nuno S=C3=A1