Received: by 2002:a05:6359:6284:b0:131:369:b2a3 with SMTP id se4csp2746859rwb; Mon, 7 Aug 2023 02:50:22 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHbIwCdTZjEUO5s+Wsr3wjeMFOvLX7xkS8c8IFN7FOx+U/1CQ0jYYKqetm2ya6Akfu4hUvo X-Received: by 2002:a05:620a:4085:b0:76c:e6cc:1a4a with SMTP id f5-20020a05620a408500b0076ce6cc1a4amr13688551qko.4.1691401821664; Mon, 07 Aug 2023 02:50:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691401821; cv=none; d=google.com; s=arc-20160816; b=rc89Ct7TXdNizGBtWleFK89lAHQqkCogjfl4S8m2aJsKOxTCdfof0QYTQnONQTXKJy lE0dFjralsh7p5hIHiYvVFeECQZQ8uK1ancF8H1mTvltH6ROPy/IGbYTDK1G8SRpZAy8 2gQzBI/jyA0cNqI4BzPpib1Ft1ENthOVe5CgTwY9j9Gc9Ob+wrWZ/c8ZdsSGirM709YR /K8rIdNU2KnjFMKj0mvxmMU6EbYy4nKbHcFLjL7RQUzRXGZS4FLV4x3GLjbfwqMQss4l EELoCDlpkuw4gZ2DvS8VTHJgZZ5q1WuQkJNPcrSecdKqW05A4O5hHqDq9e4Epf+jSwpP 1j9Q== 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=OHS2tDwbcHt81zFnYeyYq8ynDfpjq+e2h9R20vebRfM=; b=b033axWpkf5mwn/Mo7lVr+a0d+WjG56F/66RCrg3PpGwhPxly5c3jT7X8H8dl9Ur+F 89vZSTfRVHMYaj+4lDV4ZO02uU1UzyhL3X3EYg0jo4NhJayhEMsPYkEM0PDBCmCOfaT0 KFBaYFtRGeph4B5GLvghzcWEDIFSdPlU8r4PVbXvkeXW8uVpGbJNcYlPgL3bcGg7ELk0 NK+ARBzeufnUL+pL5XPR8/Eq1P8n4scdcz50zkT3ZmWupJhWG+I2AEpmNhXbt2Ej4hOB LiYugpIQzV85Lyvqq5nTD2EXX9HNBlmY19U09jr55Z5vc9SfKpbnA2xdOlWyhgtMYYaq zZjw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=kjUDxNyS; 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 bv193-20020a632eca000000b0055b766191f4si3298051pgb.218.2023.08.07.02.50.08; Mon, 07 Aug 2023 02:50:21 -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=kjUDxNyS; 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 S231302AbjHGIYp (ORCPT + 99 others); Mon, 7 Aug 2023 04:24:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56120 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231191AbjHGIYc (ORCPT ); Mon, 7 Aug 2023 04:24:32 -0400 Received: from relay4-d.mail.gandi.net (relay4-d.mail.gandi.net [IPv6:2001:4b98:dc4:8::224]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3A9FD1721 for ; Mon, 7 Aug 2023 01:24:31 -0700 (PDT) Received: by mail.gandi.net (Postfix) with ESMTPSA id C3D50E000C; Mon, 7 Aug 2023 08:24:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1691396669; 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=kjUDxNyS0uxFR0kzo+cDIBNqOC7LUzEn02ykcHbnNSze025tvzy0QDcE4EGC619pvA9rLd Qw4G81M2oHmkRSfdPHeOGK0hnZT5oDWD/NMjHhpxR8VgKbfcHmMXfcdk3nVS6W/9ht0Ol3 7jwQaFF0HQrvZMZQqcmmDav2NYYW4jzbRLsmhWzh80IO7p8r2NkS5Ik6GPdyB6A771sO5e pxo8VfM8Gcq+mx6FCvGxTcIivij6NHOFwdfdUQJs7WxuvrjATWkio34auJm/CGnS4SBr6H n+J1V4Fjxh3+ZOkcOyWWK3a17Ea1x7a08QFR2sE+9oXaEXLQcpzyuGAug5q5JQ== From: Miquel Raynal To: Srinivas Kandagatla Cc: Greg Kroah-Hartman , Thomas Petazzoni , Robert Marko , Luka Perkov , Michael Walle , , Randy Dunlap , Chen-Yu Tsai , Daniel Golle , =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= , Miquel Raynal Subject: [PATCH v8 7/8] ABI: sysfs-nvmem-cells: Expose cells through sysfs Date: Mon, 7 Aug 2023 10:24:18 +0200 Message-Id: <20230807082419.38780-8-miquel.raynal@bootlin.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230807082419.38780-1-miquel.raynal@bootlin.com> References: <20230807082419.38780-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.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_PASS,SPF_PASS 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 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