Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp2259861rwd; Tue, 13 Jun 2023 23:41:12 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7pKG/KiI8u9kFbBe478HRH/bo19jHKi5MKaDzAgfwqTAExcVJfFHCwwhYBRsD0n+Ylja6X X-Received: by 2002:a05:6512:ea7:b0:4f3:a99f:1e91 with SMTP id bi39-20020a0565120ea700b004f3a99f1e91mr7126320lfb.52.1686724872645; Tue, 13 Jun 2023 23:41:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686724872; cv=none; d=google.com; s=arc-20160816; b=n3WxjwsG4Vjoc6X3sRHDZJ32MsRbgEDAdt51bvYB7qNFESPrrrQ9K3S4P7nWc0B3Qk Ioi4Y2yWn4CCa33JP/WbWQ6dpZfEiYGda1u5NRRGovtjTKeummH/P0ZDKlxArECmhhys H3Dg1YawWDtP7tcpPT4fygWnIYs2B9jIDvWTUJ6Oh5f1ZM3uOVasC6ROjOksm08Xe0XS FsurlD91MAjfWfR9LkmaeY/FrCQLq16MaWIRmWlHd+Cr1tyYtQlWrlYsEScNyGusu6TP JHrbJ8d0Ov685jTKQ81tuv5tmi6PJdyOS7r4vMYHLI5mXn4FGSMuaCmsq5oq5K853pfQ ggqw== 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i16-20020aa7c9d0000000b00514ab83b8e2si8668530edt.34.2023.06.13.23.40.48; Tue, 13 Jun 2023 23:41: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 S243169AbjFNGbS (ORCPT + 99 others); Wed, 14 Jun 2023 02:31:18 -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 Content-Transfer-Encoding: 8bit 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 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 -- 2.34.1