From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-oa1-f50.google.com (mail-oa1-f50.google.com [209.85.160.50]) (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 10CE92749E2 for ; Tue, 1 Jul 2025 13:53:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.160.50 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1751378009; cv=none; b=a+SKogxuE/1sop1LndGU18q6Zn7IRmo5jDzNZGbObkkpJQrF2CDMIJ5IQdTtxjdOb0fAm4KJMJi05GPdQyr5IHKdnO+kEh2gaZtkk3oY3xq9HXnZii5D2SPnoOllR/xe2fEfeINdD5Dpd04JYhhCRTHnrvd3LlprKbcRriXbT5s= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1751378009; c=relaxed/simple; bh=V81NFUMfJ+mUE+a8e02h/KVMMTf6ar5ykGTXcYIsHTU=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=g2VK2FGRALIS7go8ZVvt8O/2OKDj8Qj8bvdwh/4lQBBGNhskEUL+KjLlv/a96HpjtU8jyVu0FKWzfx3J+evl/SkJ+mtMHdajG3f3uZaKv6JC++Cs0Mb1YzhUnSGfuN0WnBDK7Rd3mGNv9b+2ZVx6i4VzM72yGnB5eMngRoiSw24= 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=PBr2kME3; arc=none smtp.client-ip=209.85.160.50 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="PBr2kME3" Received: by mail-oa1-f50.google.com with SMTP id 586e51a60fabf-2f39532bd11so547560fac.0 for ; Tue, 01 Jul 2025 06:53:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20230601.gappssmtp.com; s=20230601; t=1751378005; x=1751982805; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=sxytrCpc62k1MJCjbRCCIhFdchEXxF2W+J08NfrIMAI=; b=PBr2kME3NMJsg8+kdTd29vHKOtATAxn8AVUBTpQxC6AxQxdXoOmycJqMtfn1TvwpGz uekCSipvNeLmKodLwRP0x/2UFVAUPLAf6mt/QsvAxLJER1Wv1O1C0tOoRapWzczum3VF kXNthUMK9fT/rrIHOHF9F8PVIcHTjWKCYYJNqfY0vRWFIP9a0KjKWdoj6o5jLzJX4QhE CoVWX50DH9lrOSZVo95yvwEw2HBRROK7Da3AOM+gd/4szWgyVPmKLUUYb6bt5jT7W1rV SKOD+8HXdlWwocaHn77Y8LHugJ+mDnLrTZ5StnsrZN3za/puUl6AzYNhh8PXJCin0Jv7 v7Eg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1751378005; x=1751982805; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=sxytrCpc62k1MJCjbRCCIhFdchEXxF2W+J08NfrIMAI=; b=dxoAILr9Fm0vhgANoc8z38gOPZmhdIhGZnjCb3NttsoxtSxbvvRWSkXDcmod2BXiuF I9NYbYJWnoo9vMcxIx0PHTqyG96Vzhrp9NlJnwERmYBXZ50xGfInxwAeJmf5mJjael2F NlwCox2IOmJknVUSFV5XcgRVemYpDeTQ3Nv/PwXaSmCuyYYHobBCfIXh2IPhXk4/Gqea l4YQUo2XS3pZOl4yr+ubW/pIvEHA3PPhgX1jY1NR7nZvuJMAWYYqge/U7z5iW9B0P9bn oLY0EfYssyWy6nlqCyWnYw2am/i2g8rSN0o7Kx5k84MRCitKY9ss1AcHJzjyDuIxlj7+ bUng== X-Forwarded-Encrypted: i=1; AJvYcCXZl6NebABXP8IBwVGYlcab42eMzjMunyfRIrWmiCX73ILc7bv0PAT/aF6fddYvl0yydEdh36jalqvWKck=@vger.kernel.org X-Gm-Message-State: AOJu0YyCvgr6DablYL6nLRdsi1F1/dUTYJcNnt8hW+KEatGa1cvWfnaJ SAPzKhOdrzQnc8LvzyYXPt4HL79F6iDrRzhPrOuWC93PpZnkjQ1jIptD5H/q4lPb9d8= X-Gm-Gg: ASbGncu116VjYrsblM7RgkEJBfEuMK0OeJRlDpUv0/w0qji638NClSh7e4utAB+GM+O /rhUWuJPR45N5Xeke8bcBu1af+hDuaT/VvKv7pX3LH0CJwQLCRgVJWaMotzYvBjaI45oQ3hdHxj MvCGEz+DnNzhvpTcds8ZRI4cBcZpTmuUoxgwVhWDT8irBacGAWImWIVFuIOmI/O+CyahGvQ+Sjq A/tuZZWEMZLRKZ+YdhNYp47mPeud3vC8ExrfqSY0HtCfQx3+zcQWN0ZgpkvxAcu5LhJK6CvPnyn znhC84lUPzbwiBNyZNYukQvOH1CjzBdzH7MPHDYfMnk3RMufu0vYaUxkiBUz1Gt2CdG1kCM2zx8 YVoWVztfCcRrJ3+ilVNB4ykXza2J0STvyLv+nqQU= X-Google-Smtp-Source: AGHT+IEeLp6iDhItR5Y2D19m+ylI47glnT/8a7E8Ytbkuo8eMEH+v17nazXRudRC6L4a35mzZvpHEQ== X-Received: by 2002:a05:6870:455:b0:2d6:2a40:fbe7 with SMTP id 586e51a60fabf-2efed4305a2mr12022011fac.6.1751378004996; Tue, 01 Jul 2025 06:53:24 -0700 (PDT) Received: from ?IPV6:2600:8803:e7e4:1d00:86fc:b3bf:2a91:5479? ([2600:8803:e7e4:1d00:86fc:b3bf:2a91:5479]) by smtp.gmail.com with ESMTPSA id 46e09a7af769-73afb00c48asm2120701a34.27.2025.07.01.06.53.24 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 01 Jul 2025 06:53:24 -0700 (PDT) Message-ID: Date: Tue, 1 Jul 2025 08:53:23 -0500 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v6 3/8] iio: accel: adxl313: add buffered FIFO watermark with interrupt handling To: Lothar Rubusch , Jonathan Cameron Cc: nuno.sa@analog.com, andy@kernel.org, corbet@lwn.net, lucas.p.stankus@gmail.com, lars@metafoo.de, Michael.Hennerich@analog.com, bagasdotme@gmail.com, linux-iio@vger.kernel.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org References: <20250622122937.156930-1-l.rubusch@gmail.com> <20250622122937.156930-4-l.rubusch@gmail.com> <20250628181643.0ce0ed51@jic23-huawei> Content-Language: en-US From: David Lechner In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit On 7/1/25 2:23 AM, Lothar Rubusch wrote: > On Sat, Jun 28, 2025 at 7:16 PM Jonathan Cameron wrote: >> >> On Sun, 22 Jun 2025 12:29:32 +0000 >> Lothar Rubusch wrote: >> >>> Cover the following tasks: >>> - Add scan_mask and scan_index to the IIO channel configuration. The >>> scan_index sets up buffer usage. According to the datasheet, the ADXL313 >>> uses a 13-bit wide data field in full-resolution mode. Set the >>> signedness, number of storage bits, and endianness accordingly. >>> >>> - Parse the devicetree for an optional interrupt line and configure the >>> interrupt mapping based on its presence. If no interrupt line is >>> specified, keep the FIFO in bypass mode as currently implemented. >>> >>> - Set up the interrupt handler. Add register access to detect and >>> evaluate interrupts. Implement functions to clear status registers and >>> reset the FIFO. >>> >>> - Implement FIFO watermark configuration and handling. Allow the >>> watermark level to be set, evaluate the corresponding interrupt, read >>> the FIFO contents, and push the data to the IIO channel. >>> >>> Signed-off-by: Lothar Rubusch >> Hi Lothar, >> > > Hi Jonathan, there's still one thing about this patch [PATCH v6 3/8], > I wanted to address: > > struct mutex lock; /* lock to protect transf_buf */ > + u8 watermark; > __le16 transf_buf __aligned(IIO_DMA_MINALIGN); > + __le16 fifo_buf[ADXL313_NUM_AXIS * ADXL313_FIFO_SIZE + 1]; > }; > > Is this correct usage of the IIO_DMA_MINALIGN? My intention here is to > have transf_buf and fifo_buf[...] aligned with the IIO_DMA_MINALIGN. > > Sorry, I should have asked this earlier. I saw the sensor operating, > but I'm unsure if perhaps DMA usage is setup correctly. Perhaps you > could drop me a line of feedback here? > > Best, > L Assuming that transf_bus and fifo_buf aren't used at the same time, which seems unlikely, this looks correct. As an example of what could be problematic would be if the driver wrote to transf_buf while fifo_buf was being used for a SPI DMA read. Then, when the DMA operation was done, it could write over transf_buf with the old value from when the DMA operation started because it was in the same memory cache line as fifo_buf.