From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-oa1-f46.google.com (mail-oa1-f46.google.com [209.85.160.46]) (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 EB93F2749C9 for ; Tue, 1 Jul 2025 13:53:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.160.46 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1751378008; cv=none; b=ezgdsWGvQhfpgSit5bKIsfg+RSwhIT25ptCTj09MYBESvWa/tTIC2vYdgPDQvv5itNAKI/jRL/AkH2XlLjd2KBIbzxtAPMFtjwZweVjxnL7Gcz1HkIrmXe+2axHAFL/dLzaWeWYrd1W1F4eLxuaNuPUh/v/wIiwzoaAjXVL1j/Q= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1751378008; 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=HiEKoiHKZeQYQPeif6RnbAQMlOIGjX9YSAxnosbPLFvmM97zqHfYKINcyUSrM6fEJnZ2tGPqZ+bE60yu8R/hLOp9SHTCGeWa0R8REkX452Xew8yx0QJi9s9rm0udadTj+nFuKnjdzuk2AO7/zXzJ9ksDW/dL8f3x184STbNvM8g= 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.46 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-f46.google.com with SMTP id 586e51a60fabf-2ebb72384dbso1505112fac.1 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=QJ8wbnNvQk7bF5vG7JXvI0ra6zU35ObxvAvz84qj9boHe3WSPCeMILg22UdScWCpX6 Tu8n/zYVTPmy1cC60hlDalH/g2qsUNKDynlRuR+w0KU5nPJ1tkLgZFQNUwegdxfSlpIh /TJwvv4bhUx6qx4E5ppcg+lwVQUkHBnVgoNT4pEI14NjpjnBcBnQJfxH8ob4rJ9JsC3T aAU73452PTZfZl88RymhLK0kQ5Vb7EzndxaAg3HlMJ982t7s7LwYouGMBZ7FmCMWEOwI wUoaIc9iMqVLZu75GKKYzlnsPeeYlk4i7SBnEtVhCDl9wZBnq5cj+GK2ruuEEPDtwXF/ vrlA== X-Forwarded-Encrypted: i=1; AJvYcCWRuUbqR60vJ2KsXOdmHSDAmeUI7zX2rLnJnoR1RoS0a2fKhE/P9FbwXkAItXwTgYY7ZpwRKGvZaXo=@vger.kernel.org X-Gm-Message-State: AOJu0YxH7qsIvCXn7EFlfhtueqivlouXaF1FASUtJl1i6K4ijfTMZMsf oXOigvmYpTKIS4yZjKCURj06R9c5CoCXgSAfznwqSsJ2jU84tZVrndQgI4+ghnpOrNo= X-Gm-Gg: ASbGnct/fyXGI78ygEb95KZMGI6ubyJ+wMuPnDH1i+mOy1TOp66KunFTXnqlntBzb+5 rC6woEbMWyg7TsinzkU2dAyhPwfenvdPLdDcOrZsSPe1unCZqshsM0Y0C5AWtJX0CedBcSYy1aE SXHGkMLV6HCprlzGaKZzJcftSXHijeezPMvYkxaHL2KkntsOJnmnjpJPkd3EfcHPg9qlGsFgpoq HzpIj83aw9ejyt6c2/P1WSQtzqqjcsNVPn1kb0lYfq1cpMAN128anpHG49Sxoo232hijfkCcxCZ 2w2DoRyC/INoOKYQ8ppq7MJTslFbYv/36vN6aLr9l12m8sutDr+gZ/0yaNUzFEmwY7tjf/7mV+1 M8kVMYoj2P+9eZ85eqFgFXJ7stUmZjde5f01p7SQ= 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-doc@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.