Message ID | 20240213081720.17549-1-ramona.gradinariu@analog.com |
---|---|
Headers |
Return-Path: <linux-kernel+bounces-63089-ouuuleilei=gmail.com@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:bc8a:b0:106:860b:bbdd with SMTP id dn10csp394008dyb; Tue, 13 Feb 2024 00:20:03 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCX3648g7neOd/dbXumC6k34oI3jM0BJbqgj9X04XsAv8v0pb/Y3ODIeYo2iBN1CO9jv+Iza6kVkGMk/QvayIvW0IFlOyA== X-Google-Smtp-Source: AGHT+IFMkIs/ulsWVYWHjyWd9yh6+bMZ3KiSIJjszjJ0ZlK/QokuFI4JxrHMTjxISsMAzbwdt60W X-Received: by 2002:a17:907:100a:b0:a3c:36be:2496 with SMTP id ox10-20020a170907100a00b00a3c36be2496mr6566861ejb.3.1707812403587; Tue, 13 Feb 2024 00:20:03 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707812403; cv=pass; d=google.com; s=arc-20160816; b=Bd4jIMNF69xoqbqUJ3AZFEDiuLVxfQjNxp/b6eRwwJQ/HQlumeS+0FoyCXlJqfx1Pj gkVT8yrb7uAYCP9574T81SGoRh76A+mHS+8xsmHQqe2tl52PNoOBZ16jGnGB9t/A9RSY Gh1oxhhPO21QQDp6LmagECUKNPiTJce88wRcj544Jo3SSgqzrZh+VXiColsxNxIm8poi C4S/VGqBeoJI9rzeVOibaDBK2BoMBNLh9BI8Vc6Oxye1AOl07V0DxCOXUgilfscdKn1p DxcnA47A5192zR1M+uB7/0+sojAIHM3KqUacJhWvMNSPAGg60DBXwed6JCI19p/+8dqW rMqA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from:dkim-signature; bh=JYMLQr3GB6iVexzsK5eqR6fBUWPghlCTHVFQohd/4+0=; fh=xzG/zyFwik4eHLebDX3EB/DznrmlNitj4cKRDp7K+G4=; b=c5/O3isLT97xr7BArWcg9PcCzLrTTtWQJGJJBD2E/N6gydBUfZJreDZ/ResZqM6KfV +pd7ZuwIioausVjiXquktDl0yLwwOO7Qty/N/g5IsHc++QdqzIrnfz+rjxCYw0E+7BwO Au0QmiU+uZauodp7ovHIH/hfZed1jORiVwU1WbAWCvcAgS2DrKQgmVBCHndqiclesVF2 FSoNRyz8fZES0+nPDcC37KVBLP5j6pIGFaru2iIuaxhOKPrKL2B7aTbup2mQb3rL00be lRgzBGC+zbte2bvBcZxMyTPHEh8BFZV3pltxfbP+PoSuu4Bpky1vurg3m+NQiPJSavgb jLig==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@analog.com header.s=DKIM header.b=wUORoW8z; arc=pass (i=1 spf=pass spfdomain=analog.com dkim=pass dkdomain=analog.com dmarc=pass fromdomain=analog.com); spf=pass (google.com: domain of linux-kernel+bounces-63089-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-63089-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=analog.com X-Forwarded-Encrypted: i=2; AJvYcCXcG9D3V52weIvi6qFfuqq6GeK8bOk4OSawkHQ0ik69Z956ZrJYm9ZGrDy74PTLRbjVReHDPOxtigOFoGt7u0mds494Hw== Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id qw27-20020a170906fcbb00b00a3cf2f6dd1asi621965ejb.359.2024.02.13.00.20.03 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 13 Feb 2024 00:20:03 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-63089-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@analog.com header.s=DKIM header.b=wUORoW8z; arc=pass (i=1 spf=pass spfdomain=analog.com dkim=pass dkdomain=analog.com dmarc=pass fromdomain=analog.com); spf=pass (google.com: domain of linux-kernel+bounces-63089-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-63089-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=analog.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 3186F1F2267F for <ouuuleilei@gmail.com>; Tue, 13 Feb 2024 08:20:03 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id F349224A0D; Tue, 13 Feb 2024 08:17:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=analog.com header.i=@analog.com header.b="wUORoW8z" Received: from mx0b-00128a01.pphosted.com (mx0a-00128a01.pphosted.com [148.163.135.77]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 96E8218026; Tue, 13 Feb 2024 08:17:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=148.163.135.77 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707812277; cv=none; b=NnFjIb/q9zYl//GF73DuyspW6gExuFqIQGTb8epMOYoo0pywhRFtc/Spl0VTn0OXbPurF5DF19yOn0sIUzvVh4Gcd6o+sVdXUrJsI+zXN5AgGgO8Jhc7/cJmD145aI9VsVnmE3g0Wemz6lDImAnvUs0CL/TNU20gUb8OGtMTMo0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707812277; c=relaxed/simple; bh=JylogIJZukuCaWwS/VLftp3ASkKsQ1fIB4T0l/ZJ7Ys=; h=From:To:CC:Subject:Date:Message-ID:MIME-Version:Content-Type; b=A7QVgtPlCh1M0peCQLnj6ciiGQQvpUpxBeyuiUNiIAgZ0NBjsQbRiuECkCZP9yTVTLydsMS4Yu9UorUytsSertzo/5SPPiapmXp4z7PDyN37SPhMsmjtCDGwKQZKclTWkvsMdd1Nxn+2/INIJ6+JDjB8xPmGK4tYKXr9hiGz3c0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=analog.com; spf=pass smtp.mailfrom=analog.com; dkim=pass (2048-bit key) header.d=analog.com header.i=@analog.com header.b=wUORoW8z; arc=none smtp.client-ip=148.163.135.77 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=analog.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=analog.com Received: from pps.filterd (m0375855.ppops.net [127.0.0.1]) by mx0b-00128a01.pphosted.com (8.17.1.24/8.17.1.24) with ESMTP id 41D60Jhq005419; Tue, 13 Feb 2024 03:17:39 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=analog.com; h= from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding:content-type; s=DKIM; bh=JYMLQr3GB6iV exzsK5eqR6fBUWPghlCTHVFQohd/4+0=; b=wUORoW8zt7BPLaT2aCpUszXSowpB SRLYkdnNqrD+uv3gqemOqm5NzzV8owa57QBYjW13Tf0ybNrfNmtDHOQF0Ob7Y63S yWaVucbb8bi9DaTGQzSwxcwgqxDbeFCfC1JyonHff90GWFyrvDTVPdvExEGvxDVq A1Wv6cJ26DYGxApP/L5XhXlwHVfp4MvGw7jNBgY7cqY7RLE7iHs0LYmGQWFt56uK 134wPfOdVEHJ/g1j005jo9ir+RIcfqtrFXQGAfOvnCVktRGI6TAeb0ayTZceFpc0 8WoFVE4iyR3Gsu2cGAnSdoDbsk+Nt1kdn44zqlC6hMTgMXMVH0RfqAK8zw== Received: from nwd2mta4.analog.com ([137.71.173.58]) by mx0b-00128a01.pphosted.com (PPS) with ESMTPS id 3w82sbrdn3-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 13 Feb 2024 03:17:37 -0500 (EST) Received: from ASHBMBX8.ad.analog.com (ASHBMBX8.ad.analog.com [10.64.17.5]) by nwd2mta4.analog.com (8.14.7/8.14.7) with ESMTP id 41D8Habb020755 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Tue, 13 Feb 2024 03:17:36 -0500 Received: from ASHBCASHYB5.ad.analog.com (10.64.17.133) by ASHBMBX8.ad.analog.com (10.64.17.5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.14; Tue, 13 Feb 2024 03:17:35 -0500 Received: from ASHBMBX9.ad.analog.com (10.64.17.10) by ASHBCASHYB5.ad.analog.com (10.64.17.133) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.14; Tue, 13 Feb 2024 03:17:35 -0500 Received: from zeus.spd.analog.com (10.66.68.11) by ashbmbx9.ad.analog.com (10.64.17.10) with Microsoft SMTP Server id 15.2.986.14 via Frontend Transport; Tue, 13 Feb 2024 03:17:35 -0500 Received: from rbolboac.ad.analog.com ([10.48.65.135]) by zeus.spd.analog.com (8.15.1/8.15.1) with ESMTP id 41D8HPZB025896; Tue, 13 Feb 2024 03:17:27 -0500 From: Ramona Gradinariu <ramona.gradinariu@analog.com> To: <corbet@lwn.net>, <linux-doc@vger.kernel.org>, <linux-kernel@vger.kernel.org>, <jic23@kernel.org>, <nuno.sa@analog.com>, <linux-iio@vger.kernel.org> CC: Ramona Gradinariu <ramona.gradinariu@analog.com> Subject: [PATCH v4 0/3] adis16475 driver documentation Date: Tue, 13 Feb 2024 10:17:17 +0200 Message-ID: <20240213081720.17549-1-ramona.gradinariu@analog.com> X-Mailer: git-send-email 2.34.1 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: <linux-kernel.vger.kernel.org> List-Subscribe: <mailto:linux-kernel+subscribe@vger.kernel.org> List-Unsubscribe: <mailto:linux-kernel+unsubscribe@vger.kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ADIRuleOP-NewSCL: Rule Triggered X-Proofpoint-GUID: bj5Bk7TH-Dgi-ycQmftRV8NVh2F4tIfG X-Proofpoint-ORIG-GUID: bj5Bk7TH-Dgi-ycQmftRV8NVh2F4tIfG X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-02-13_04,2024-02-12_03,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxscore=0 lowpriorityscore=0 spamscore=0 clxscore=1015 bulkscore=0 priorityscore=1501 suspectscore=0 phishscore=0 mlxlogscore=612 impostorscore=0 malwarescore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2401310000 definitions=main-2402130064 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790771098942892807 X-GMAIL-MSGID: 1790771098942892807 |
Series |
adis16475 driver documentation
|
|
Message
Ramona Gradinariu
Feb. 13, 2024, 8:17 a.m. UTC
Add documentation for: - iio device buffers describing buffer attributes and how data is structured in buffers using scan elements. - adis16475 driver which describes the driver device files and shows how the user may use the ABI for various scenarios (configuration, measurement, etc.). This kind of documentation describes how the user can interract with the drivers device files, showing the driver's particularities and we think all IIO drivers need such a documentation and will benefit from it. Having this documentation in the Linux Kernel will make it more accessible to the user, seeing how it is in the same location as the code. Analog Devices is prepared to add similar documentation for all new drivers (for ADI components), and in time to also add documentation for existing drivers, following the adis16475 documentation template. Ramona Gradinariu (3): docs: iio: Refactor index.rst docs: iio: add documentation for device buffers docs: iio: add documentation for adis16475 driver Documentation/iio/adis16475.rst | 406 +++++++++++++++++++++++++++++++ Documentation/iio/iio_devbuf.rst | 125 ++++++++++ Documentation/iio/index.rst | 9 +- 3 files changed, 539 insertions(+), 1 deletion(-) create mode 100644 Documentation/iio/adis16475.rst create mode 100644 Documentation/iio/iio_devbuf.rst -- 2.34.1
Comments
A few follow up comments on your David's review Anything I deleted didn't need a comment as all made sense to me! > > > +to 0, for devices with a single buffer. > > Is /sys/bus/iio/devices/deviceX/buffer (without the Y) for backwards > compatibility? Yes. For these docs I'd not mention it. New software should be aware of multiple buffers being possible and not use it. Same is true of the scan_elements directory. If we really want to mention it, say buffer/ and scan_elements are for backwards compatibility and should not be used in new userspace software. They aren't going anywhere, but better people start from a multibuffer world! > > > + > > +Read / Write attribute which states the total number of data samples (capacity) > > +that can be stored by the buffer. > > + > > +Enable > > +------ > > + > > +Read / Write attribute which starts / stops the buffer capture. This file should > > +be written last, after length and selection of scan elements. > > Could be useful here to mention that writing a non-zero value here to > enable the buffer may result in an error, such as EINVAL, e.g. if an > invalid configuration was selected, like choosing a combination of > scan elements that don't match one of the valid scan masks. Be careful to not refer to matching. Could be a subset. I'd refer to "an unsupported combination of channels" or something like that. > > +directory. The scan elements attributes are presented below. > > + > > +**_en** > > + > > +Read/ Write attribute used for enabling a channel. If and only if its value > > +is non zero, then a triggered capture will contain data samples for this > > +channel. > > + > > +**_index** > > + > > +Read-only positive integer attribute specifying the position of the channel in > > Isn't 0 a valid scan index? So non-negative? Or unsigned? Yes - unsigned would be my preference. > > > +the buffer. Note these are not dependent on what is enabled and may not be > > +contiguous. Thus for user-space to establish the full layout these must be used > > +in conjunction with all _en attributes to establish which channels are present, > > +and the relevant _type attributes to establish the data storage format. > > + > > It would also be nice to get an example on the binary layout for > something that has multiple channels enabled. In particular with the > data alignment, e.g. when you have a 16-bit word followed by a 64-bit > word. > Agreed - the padding is sometimes not what people expect. > > > +**_type** > > + > > +Read-only attribute containing the description of the scan element data storage > > +within the buffer and hence the form in which it is read from user space. Format > > +is [be|le]:[s|u]bits/storagebits[Xrepeat][>>shift], where: > > + > > +- **be** or **le** specifies big or little endian. > > +- **s** or **u**, specifies if signed (2's complement) or unsigned. > > +- **bits**, is the number of valid data bits. > > +- **storagebits**, is the number of bits (after padding) that it occupies in the > > + buffer. > > +- **repeat**, specifies the number of bits/storagebits repetitions. When the > > + repeat element is 0 or 1, then the repeat value is omitted. > > +- **shift**, if specified, is the shift that needs to be applied prior to > > + masking out unused bits. > > + > > +For example, a driver for a 3-axis accelerometer with 12 bit resolution where > > +data is stored in two 8-bits registers as follows: > > + > > +.. code-block:: bash > > Doesn't look like this should use "bash" styling. > > > + > > + 7 6 5 4 3 2 1 0 > > + +---+---+---+---+---+---+---+---+ > > + |D3 |D2 |D1 |D0 | X | X | X | X | (LOW byte, address 0x06) > > + +---+---+---+---+---+---+---+---+ > > + > > + 7 6 5 4 3 2 1 0 > > + +---+---+---+---+---+---+---+---+ > > + |D11|D10|D9 |D8 |D7 |D6 |D5 |D4 | (HIGH byte, address 0x07) > > + +---+---+---+---+---+---+---+---+ > > + > > +will have the following scan element type for each axis: > > + > > +.. code-block:: bash > > + > > + $ cat /sys/bus/iio/devices/iio:device0/buffer0/in_accel_y_type > > + le:s12/16>>4 > > + > > +A user space application will interpret data samples read from the buffer as two > > +byte little endian signed data, that needs a 4 bits right shift before masking > > +out the 12 valid bits of data. > > Is it always assumed that scan data is `raw` and needs to be > multiplied by `scale` for that channel to convert it to SI (or IIO > standard) units? Definitely by far the most common case but there are a few exceptions where there isn't a _raw attribute but only an _input one where the assumption is processed data. Tricky to mention that here without adding complexity. Maybe just add some weasel words to hint there are corners not covered by this doc. > > > + > > +Please see Documentation/ABI/testing/sysfs-bus-iio for a complete description of > > +the attributes. > > Is it also worth mentioning > ``Documentation/ABI/testing/sysfs-bus-iio-dma-buffer`` here? I'd not do that until we have a section for these docs on dma buffers which are different in a bunch of ways. Would just be a potential source of confusion. Jonathan