From patchwork Wed Jun 14 06:30:17 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Miquel Raynal X-Patchwork-Id: 107733 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp1043308vqr; Tue, 13 Jun 2023 23:52:12 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6fHumG/m/hdg2s1ZHzcADXK8+wC+TjK4d/eGlp0tB/guIzxSoBoUEQdcnNYtm/ECv0XNDK X-Received: by 2002:a17:903:41c8:b0:1b3:d759:d2dd with SMTP id u8-20020a17090341c800b001b3d759d2ddmr6165037ple.9.1686725532603; Tue, 13 Jun 2023 23:52:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686725532; cv=none; d=google.com; s=arc-20160816; b=QfVO4kacQz9yMbiH75o+qyNl1Ulwg3nGkuQjIlFZFGe+qOTqJ5ohh381Jou4lO87lV L7gQYSzbNTXkPimUNOg6/oPoKhg5tj+AsWGtfxWHWJEwvGOIDKhebkDixjzJrNwK/+HK h9uuguQXtsLgotIyUz+pd08Xr11FlAGj+h4w0w1NPDN1K0ZUuQD4n15R2uLB19Qa1JlF n5gTaQd161yRfN27IYZDB4gulrwm8csjkjxTIytbPyMH4WlK4JuA/OttXS2pyC690LFG 5rPVTgcKGFE7vSXe3zRf//FX/cLp5+5lttTrHcnWeLyMZCrfxg6yfCk05EBBLljbzFYz 62qA== 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=QUIYbUJt+Cl/OQINsVO/8Ug45EH5iacT/hNl2EpfQ/k=; b=WAo9uV/AzPnT6bEQb6edQcwBErPZ4wHlJFlV9Nm6e4uhEsei6xR5RsqyTlvDoMivlk HRBUDpfd+uTyIgjMDrSfe86vh2HJ+dWegg8FQn0FYsLMnXoXRPzNwQQbYExMBxZJ9e3X BYU5/DWFi4J04Q6wPeY7Z4HDw/qoYrbiUU0sZ8G85KuC8ZyoOg9qnF4lATUtyQRtargW ULcYRpLNcHIsJmA5uJ/qaG1RbncjpSuqBcQh4lpNLsW1q0IIPpBsRwRfiGXYJ8Q8p0M5 qwdINJ9oYRIWhalkMAh99CeGOCtiksBkEEGPcE60s0+/TEKyBuaW1NNh0mAIUDAGzx7C dbzQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=mfakaeBi; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ju11-20020a170903428b00b001b07145bc30si1655212plb.312.2023.06.13.23.52.00; Tue, 13 Jun 2023 23:52:12 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=mfakaeBi; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243216AbjFNGbT (ORCPT + 99 others); Wed, 14 Jun 2023 02:31:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44076 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243168AbjFNGap (ORCPT ); Wed, 14 Jun 2023 02:30:45 -0400 Received: from relay9-d.mail.gandi.net (relay9-d.mail.gandi.net [IPv6:2001:4b98:dc4:8::229]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C9C562688 for ; Tue, 13 Jun 2023 23:30:23 -0700 (PDT) X-GND-Sasl: miquel.raynal@bootlin.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1686724222; 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=QUIYbUJt+Cl/OQINsVO/8Ug45EH5iacT/hNl2EpfQ/k=; b=mfakaeBitl8sXX9VzebECkRFdSsiGf2T8dggJsBcOT6ZnOkapFalhekJ1ozj3EJWsO1Z9o 5IxHEtOe3Mup/bKnMqr6BwGxTvllPwvOHQKl5VuXs+dopoYVA+Pb0kK4VB8bteOUEP4cGT ljDrRyjZogg3pH5BB9sVkwwXbQdafyo3aQeOUyAcIDjFDZSBlKdJ383DGLkh4ADBz4XHNh X1l79aSfjmQboxhyLYeALg894WeFSp+mMqX+QMMwb3UHbOUFtPLKXiNwAvENoLpmxRwMAN +ZqLYLrsWf2JhYvTryKMEUFWM6ocy4Jr+pg5RKEzhGLgWDoL54jfAfTblaW3pA== X-GND-Sasl: miquel.raynal@bootlin.com X-GND-Sasl: miquel.raynal@bootlin.com X-GND-Sasl: miquel.raynal@bootlin.com X-GND-Sasl: miquel.raynal@bootlin.com X-GND-Sasl: miquel.raynal@bootlin.com X-GND-Sasl: miquel.raynal@bootlin.com X-GND-Sasl: miquel.raynal@bootlin.com Received: by mail.gandi.net (Postfix) with ESMTPSA id 95518FF812; Wed, 14 Jun 2023 06:30:21 +0000 (UTC) From: Miquel Raynal To: Srinivas Kandagatla Cc: Greg Kroah-Hartman , "Rafael J . Wysocki" , , Thomas Petazzoni , Luka Perkov , Robert Marko , Miquel Raynal Subject: [PATCH v4 3/4] ABI: sysfs-nvmem-cells: Expose cells through sysfs Date: Wed, 14 Jun 2023 08:30:17 +0200 Message-Id: <20230614063018.2419043-4-miquel.raynal@bootlin.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230614063018.2419043-1-miquel.raynal@bootlin.com> References: <20230614063018.2419043-1-miquel.raynal@bootlin.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1768659912059642819?= X-GMAIL-MSGID: =?utf-8?q?1768659912059642819?= 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 --- Documentation/ABI/testing/sysfs-nvmem-cells | 19 +++++++++++++++++++ 1 file changed, 19 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..641a7d7dad76 --- /dev/null +++ b/Documentation/ABI/testing/sysfs-nvmem-cells @@ -0,0 +1,19 @@ +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 the cell name. + 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 + + ex:: + + hexdump -C /sys/bus/nvmem/devices/1-00563/cells/product-name + 00000000 54 4e 34 38 4d 2d 50 2d 44 4e |TN48M-P-DN| + 0000000a