Received: by 2002:a05:7412:419a:b0:f3:1519:9f41 with SMTP id i26csp4713048rdh; Wed, 29 Nov 2023 08:38:19 -0800 (PST) X-Google-Smtp-Source: AGHT+IHnLmfPE0drbPkHYUK+K0kQFn4JtT72qOOuY11tPCSUKeU2yVZTnMPRCUOLL7q4O+imFAEK X-Received: by 2002:a17:903:228a:b0:1cf:b146:8101 with SMTP id b10-20020a170903228a00b001cfb1468101mr18830528plh.16.1701275899043; Wed, 29 Nov 2023 08:38:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701275899; cv=none; d=google.com; s=arc-20160816; b=MaA2V8koQdUkeWIwMHRK6j0SZuEb1EDxyMSu4YhzkG97xwzUaFN6c6zw+KaG1CncVS hL/Jbt1AqnDwcNmShy5KbuXp96oh8n7lN5lpG3fzjH5vs/P5JaRVZSn8VagnEXwp6ebI ZqcdF0oW5XPogAcrrqxccaL6M2MKk1HKo2+AJNzJIEji7PMqbKzXiHPoVf8+QUcArQev 8Uvphd/8kOP+387t/y2Oee4RtrqtnpiH8M/PfOB5KnKCtRT2W10lYjMQgOHS0EkFjMOi PXPpoOgIb9Gmx1yWsF2SxL8jLWVna6EZrCras00eI/aK3KEjoZEr16lnlCG/akooVKgC WoLQ== 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=LHVfHqkxtSfhDK3Auz+HtR9CGNiwZCQHjp1a868hmsY=; b=F+lWu1bG1zyLXScTHg9epEovynBiiE99LT/zpJCCQIEOvl19Jy31PyL4z+e3Gi18lB sQ1tGDCuUt/2AgdTQO5Sy8wEZiUFNuPLWNmJXY608JF0FidmMEb8Vm7rZRupRq4YxnS6 rqt2I4VGUxQofxjyc1TJe++j953kBg4+Y7pKret3YUVp1lx6w+IqLv86k0O5yNMLaW+n CpP4GUg4ubZg4WTHrYhvXg3ILqrmau83syla17lsTHKoQx1VA08qo0IPqqMfRhVHTWOb wIEx1VNGLpdqHsxGg0/PAwIpctxnDC6Ld5BJszVB9MuSgKRnsXFL//zoJosQsTNfyZgg xIKw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=glZ3NGop; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 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 snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id h5-20020a170902748500b001cff8e913b5si3864803pll.605.2023.11.29.08.38.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 Nov 2023 08:38:19 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=glZ3NGop; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 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 snail.vger.email (Postfix) with ESMTP id 4706E802F861; Wed, 29 Nov 2023 08:38:17 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231483AbjK2QiA (ORCPT + 99 others); Wed, 29 Nov 2023 11:38:00 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34142 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230480AbjK2Qhk (ORCPT ); Wed, 29 Nov 2023 11:37:40 -0500 Received: from relay6-d.mail.gandi.net (relay6-d.mail.gandi.net [IPv6:2001:4b98:dc4:8::226]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0237CD68 for ; Wed, 29 Nov 2023 08:37:45 -0800 (PST) Received: by mail.gandi.net (Postfix) with ESMTPSA id 0A45CC000A; Wed, 29 Nov 2023 16:37:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1701275864; 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=glZ3NGop0Vb3y9yDIWz+FYhMiWC3A2/Qs+sB8aCJs4shCfLbbrdzLgFlBZH7U4NCP2hH3M uiZ7W0l6QlITXpQFguGB5TyBLybUtGZbbUqAkCoT5J7rWMYJJl+a0gUENQh4FCa0r/9vUh FMUxpF7jYg3nbT3QDvPlKRiZZxV+sbAqZYhdqy++kyaDRsQW1K9/bQ6MLpQxiFrVz7k7ZV eNeI2ngePFYnurOdtxBmZZoVnMIYiLC+lmYD9SskT8jed12thZJHAgh+MIEQpu4FXroxUt aosXNCM4qOIuMlQWoDnacpGUaIYNzPd6X6GgTLTLUlMrJpoJr/ieB6dqryEiEw== From: Miquel Raynal To: Srinivas Kandagatla , Greg Kroah-Hartman , Cc: Thomas Petazzoni , Robert Marko , Luca Ceresoli , Michael Walle , =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= , Marco Felsch , Randy Dunlap , Chen-Yu Tsai , Daniel Golle , Miquel Raynal Subject: [PATCH v14 7/8] ABI: sysfs-nvmem-cells: Expose cells through sysfs Date: Wed, 29 Nov 2023 17:37:36 +0100 Message-Id: <20231129163737.698317-8-miquel.raynal@bootlin.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231129163737.698317-1-miquel.raynal@bootlin.com> References: <20231129163737.698317-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,T_SCC_BODY_TEXT_LINE 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-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Wed, 29 Nov 2023 08:38:17 -0800 (PST) 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