Received: by 2002:a05:7412:d8a:b0:e2:908c:2ebd with SMTP id b10csp735995rdg; Wed, 11 Oct 2023 04:16:43 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEmAwU6m6qKVN1AJcxWISkgGr/Zg46+ycpy5iaO0OovvANgDoL5OO1y+bQ9r/6yo7t075lN X-Received: by 2002:a05:6a20:4428:b0:159:e04f:e184 with SMTP id ce40-20020a056a20442800b00159e04fe184mr27829322pzb.7.1697023002903; Wed, 11 Oct 2023 04:16:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697023002; cv=none; d=google.com; s=arc-20160816; b=YlPcY3s/LEIISDmX6uzgYuudul6aYOWHzFPAyUo5Y6SDlnzA9eGJi/MTJczTN74HLA LP4h7gpQDGYOSmxbqPEYQT3MNetA6jxklN/c2MCOn+A7FVZ9eL/ljpl4Dn5dq1W7Myls DJg6bCjNtR0Vir4kX+TYYwjc6Gi8ZjIUxfzPyFJVNZXoggamF8eSNNavpbFwfCqODj/y cfEP4U6yBILxplseILmy6gZ7XQ0ZD4GRcctk9O0PhsyWG/eK+cyjYYBEnsIO1+l/xKxy aHOW5pqjb2n19LcoLveicYgkEHWZzLoP+Pa8Y3KhAglFH62MUvwfOSdsVLirdZJaLcpq lv/A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=dfOp8t/SWXoAMbVxsmdWr6p/Yay0CylcPPBrARczmbM=; fh=XQzgxiPMj/Cqsom9sWl23DkvcXkGD6r/vx0NuuBn5R0=; b=C3N40zIRo91kn79Ru9iB+XMBbccuN2oN6lgs6/FuWTIUCH7omtzxMwMfZx+6fSDqzy 5pTJvb1oR60y2g9qz15yTIsI0DSw6b9+sh+DlIM1tkhf0oLiZSWgk3bep/wDAq95S5uv +Xs5zcSz7LfCiWKWrnWBduvcD556yy86i86IPzo8pnGCFOEOEGYjnQcTnWztpGFpoewy MXW5tm0g9dGnD/nAGld3NsRenbMDCpjNgeYqZaPik8jl1PjTE3XzyAg4Cz/LLitLJzu1 oiNxiW8YlhNFf1GUeMHm367+AjufqkKXkzg6n4Mi8OirQmsHt7lmcWiAMhY+LXN/MLUC I1/Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=eAMEWS0U; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Return-Path: Received: from fry.vger.email (fry.vger.email. [23.128.96.38]) by mx.google.com with ESMTPS id r20-20020a6560d4000000b0059ccb99a2f0si3093487pgv.205.2023.10.11.04.16.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Oct 2023 04:16:42 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) client-ip=23.128.96.38; Authentication-Results: mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=eAMEWS0U; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by fry.vger.email (Postfix) with ESMTP id D4D7880A9DF7; Wed, 11 Oct 2023 04:16:39 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346014AbjJKLQF (ORCPT + 99 others); Wed, 11 Oct 2023 07:16:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55408 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346103AbjJKLPr (ORCPT ); Wed, 11 Oct 2023 07:15:47 -0400 Received: from relay5-d.mail.gandi.net (relay5-d.mail.gandi.net [217.70.183.197]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 665C08F; Wed, 11 Oct 2023 04:15:42 -0700 (PDT) Received: by mail.gandi.net (Postfix) with ESMTPSA id 8F29D1C000B; Wed, 11 Oct 2023 11:15:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1697022941; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=dfOp8t/SWXoAMbVxsmdWr6p/Yay0CylcPPBrARczmbM=; b=eAMEWS0UvEF+PWeZcW0Aftj0Q7o6JvZDzUvY0H0Lche1LfRCfSm6wnPPazx8zuQEvTGNEA zhiFGAkPi9i35Sj4YnqJWsbtglUzWfInLIHRuOTitmw8o/X51WqGu7T+Ai6+2zsTzJVZs7 aeFXvHbVqpnaUeivEs49VJ04dSqoMj8OTF+nq6CQopK+bhlGsWDif+kk+sqxjAJU7jHx2Q Z/6BVuExVsS3LqGZAXKzhgDTf6uceQNdjK1HzgT9pUTZN7tVGr2LtXhI/m2ARO10COYZ7r tEYFUNYfSezzViihEw5nwz11LcY6AtVbhXyWpErLJKWrZZaLJS9E5MCwI8Zdaw== From: Miquel Raynal To: Srinivas Kandagatla , Greg Kroah-Hartman Cc: Michael Walle , =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= , Rob Herring , Frank Rowand , devicetree@vger.kernel.org, , Robert Marko , Thomas Petazzoni , Luka Perkov , Randy Dunlap , Chen-Yu Tsai , Daniel Golle , Miquel Raynal Subject: [PATCH v13 5/6] ABI: sysfs-nvmem-cells: Expose cells through sysfs Date: Wed, 11 Oct 2023 13:15:28 +0200 Message-Id: <20231011111529.86440-6-miquel.raynal@bootlin.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231011111529.86440-1-miquel.raynal@bootlin.com> References: <20231011111529.86440-1-miquel.raynal@bootlin.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-GND-Sasl: miquel.raynal@bootlin.com X-Spam-Status: No, score=2.7 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, RCVD_IN_SBL_CSS,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on fry.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (fry.vger.email [0.0.0.0]); Wed, 11 Oct 2023 04:16:40 -0700 (PDT) X-Spam-Level: ** The binary content of nvmem devices is available to the user so in the easiest cases, finding the content of a cell is rather easy as it is just a matter of looking at a known and fixed offset. However, nvmem layouts have been recently introduced to cope with more advanced situations, where the offset and size of the cells is not known in advance or is dynamic. When using layouts, more advanced parsers are used by the kernel in order to give direct access to the content of each cell regardless of their position/size in the underlying device, but these information were not accessible to the user. By exposing the nvmem cells to the user through a dedicated cell/ folder containing one file per cell, we provide a straightforward access to useful user information without the need for re-writing a userland parser. Content of nvmem cells is usually: product names, manufacturing date, MAC addresses, etc, Signed-off-by: Miquel Raynal Reviewed-by: Greg Kroah-Hartman --- Documentation/ABI/testing/sysfs-nvmem-cells | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 Documentation/ABI/testing/sysfs-nvmem-cells diff --git a/Documentation/ABI/testing/sysfs-nvmem-cells b/Documentation/ABI/testing/sysfs-nvmem-cells new file mode 100644 index 000000000000..7af70adf3690 --- /dev/null +++ b/Documentation/ABI/testing/sysfs-nvmem-cells @@ -0,0 +1,21 @@ +What: /sys/bus/nvmem/devices/.../cells/ +Date: May 2023 +KernelVersion: 6.5 +Contact: Miquel Raynal +Description: + The "cells" folder contains one file per cell exposed by the + NVMEM device. The name of the file is: @, with + being the cell name and its location in the NVMEM + device, in hexadecimal (without the '0x' prefix, to mimic device + tree node names). The length of the file is the size of the cell + (when known). The content of the file is the binary content of + the cell (may sometimes be ASCII, likely without trailing + character). + Note: This file is only present if CONFIG_NVMEM_SYSFS + is enabled. + + Example:: + + hexdump -C /sys/bus/nvmem/devices/1-00563/cells/product-name@d + 00000000 54 4e 34 38 4d 2d 50 2d 44 4e |TN48M-P-DN| + 0000000a -- 2.34.1