Received: by 2002:a05:6358:7058:b0:131:369:b2a3 with SMTP id 24csp5316272rwp; Mon, 17 Jul 2023 01:40:22 -0700 (PDT) X-Google-Smtp-Source: APBJJlFCLS1mTFaIdTKxMdXqPNq5eJDSfJUydcG8RsNeA/4zhtAquZ5LcvjhS9o8SCfZPhE2wSNc X-Received: by 2002:a17:902:ea02:b0:1b5:2fdf:5bd8 with SMTP id s2-20020a170902ea0200b001b52fdf5bd8mr14143580plg.8.1689583221866; Mon, 17 Jul 2023 01:40:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689583221; cv=none; d=google.com; s=arc-20160816; b=u9Nqd4Y7ZEqAqB8fVxiS3G4kO5MZnfIk+uZPYTvGUQKVn0/MvgxPGgkPUPm345u4jg MV149kzvQx9LpO4ibamVsh0nPzpHLd9Ju7CG7tq/yfUkv/z7LZfG2yHT8rJ5jPuHx23O kylpvzu51/YT4JGgLseXDrB4oj0scFt4nbCtWH409dXoIRQV5Ldo1KUwbXukirZHWVlT FLXK8DmCFV0cCM8Oeu8wxMxCP34EvLm27/FuL1bed2ndyLLb4v4yO+57NjNfff/VOAtN fSS+MXBPf6WbeW3Mz1M4RSSaYTCrj11me/6fZ4lPwtgvsucG3ZVrfRdyzEcTIfHyNbUY Lldw== 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=nH6/LjRkYId88yq613RlWdOphmfE4iRu7Ck+Oxwm0yc=; fh=JpygR/0v0UTOXdyljMXVkuezv/HjT4xrIjOwJ6y50X0=; b=QQIjxQTdMtyg4y5NkA/XJ4NWqR1pWMOKkGcLAxpHLVplAY/ewsXL4fXV4o/mPbWieU 1WiMvG9moomJSCzvhtB8GyGlXsN1zhD08z5LCCXobA9HH9bxTtMrpxyG7hcZobeE4tm3 tBy5VD7fDMcET+gMrQmd/LmKA1N9W0JQaVxwl3Z0jXj7ngTOBdnCa4MarY+AIo0PBynU ky5NoWeJMOFPDSz24VDvfuBMRIzZ/sEPtBTPreDxwYPsTe+Lg53uHDI3QUImd8nzmRm5 8hMbu5dgdniC3Ay+a2vr5nrVC0zcWvwkYu3aXpYZCuC7XFLmMPcCPMQHPNHE0hb4siCE QlVg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=WDkqvzg8; 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 a9-20020a170902ecc900b001bb21d502f0si3772025plh.76.2023.07.17.01.40.09; Mon, 17 Jul 2023 01:40: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=WDkqvzg8; 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 S231201AbjGQHwV (ORCPT + 99 others); Mon, 17 Jul 2023 03:52:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53504 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231186AbjGQHwD (ORCPT ); Mon, 17 Jul 2023 03:52:03 -0400 Received: from relay3-d.mail.gandi.net (relay3-d.mail.gandi.net [IPv6:2001:4b98:dc4:8::223]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 77576118 for ; Mon, 17 Jul 2023 00:51:53 -0700 (PDT) Received: by mail.gandi.net (Postfix) with ESMTPSA id 7811C60007; Mon, 17 Jul 2023 07:51:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1689580311; 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=nH6/LjRkYId88yq613RlWdOphmfE4iRu7Ck+Oxwm0yc=; b=WDkqvzg8QAfJqTq4uPlJhLx4c7ON8Cote9uwAPhSzr8+CJy20QpkqHe28R/g8CfLl3pJuJ +QGUPfERJPkT6c9ZYfzQj8zwSFVhCzvCJxUGXrlLy5RzDHHSISRHCuxhSIgulWpbjB81KL 70XZc+DOzkMOjBw1uHYInwhVjcF/Y208/M96Yr1ZlfI2ltPEgV/x9VXYIGt46UuEYbNxhX XX45Bpn1e0TSLhRWK1pigr9VKlatROaI4ATRrdl7TgOp1ncXtdPWBXGcYR71sIBYoyS1+D 6Mv/8wk8U9BtgntdJqlGZRdlnhEAu0DUbpJnQd7+ZMreKIhEIsm+ediXMETSfQ== From: Miquel Raynal To: Srinivas Kandagatla , Greg Kroah-Hartman , Cc: Thomas Petazzoni , Robert Marko , Luka Perkov , Michael Walle , Randy Dunlap , Miquel Raynal Subject: [PATCH v6 1/3] ABI: sysfs-nvmem-cells: Expose cells through sysfs Date: Mon, 17 Jul 2023 09:51:45 +0200 Message-Id: <20230717075147.43326-2-miquel.raynal@bootlin.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230717075147.43326-1-miquel.raynal@bootlin.com> References: <20230717075147.43326-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 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 | 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..b2d15a8d36e5 --- /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. + + Example:: + + 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