From patchwork Mon Jun 5 13:34:21 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Miquel Raynal X-Patchwork-Id: 103268 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp2698200vqr; Mon, 5 Jun 2023 06:48:05 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7KxvYTYboJf0n1TUbqg/OO/ZK7G2/Qiva3/sBaDQiPV99/m/tMPowhdI5aCZJKmue+461M X-Received: by 2002:a05:6a20:7493:b0:10c:37ed:3e88 with SMTP id p19-20020a056a20749300b0010c37ed3e88mr7787960pzd.23.1685972885408; Mon, 05 Jun 2023 06:48:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685972885; cv=none; d=google.com; s=arc-20160816; b=jpoIeUf9H99R0R/vwGbSaPQ4QkE5Y1Xa4xBq3z5ttKyJ/e31nF8lQ9Gbo3DTZvrBmS xSORFdqgOVvd/eH8E3BvDXtwkyIhjuFuIjc/PB2DcsVKCCK1gqitqkPgrh41XN3MYN2T hdPTNwXjNbCeOQQ2xVZJHTM9tZCzB8U3Uz1Tu22J3Ev52/pXHqyezJpZO1wPv3hrH4yv 50IXF1b5M+YRcjxsZ68K5dajrvGym/gtreD3y0Inj/CX8gXbbwnKDcLr465VUD6Kc6Gf /VyYSbcriZZ1DQrJbCj0HuClTkGx/iUR62RbejMAZbrS3K1/LVFs6Ejvc/v5kOs16mV8 ktsw== 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=xQTK/9Tc1s5cTjZXN+kqVSQN89MVoOZijWNaHC2AhgL9PJtINFhPAU+ImjQCRuxmIV Qwhu1a2UXitCViPFsJs8sGUnAPNyi0NOzQZNmfmGaoe4ATmgwVwXgkvYIFUgwPqgN1W2 VDOMSG3aOXKBCfAr3KA5ntgHj3CmkH4XRfuDISyyUIhETIQIKlyEZRKEOj+sNOKLj9wn /FlbNwAIHBxXNx+ZICmlulMVuoU+/ChcBuFOq6mDf1Ec7R5Cx93ygWsGKxMcrOIWbCI4 r6Xdxg5P4Y/i2zcDNLFc1lmEORPngfiE3JRfQyTYZb2FyFVfOowfaCAnCaGQxOPvaWll wLBQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=nX8jdpMV; 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 o5-20020a639205000000b0053075988265si5497279pgd.59.2023.06.05.06.47.50; Mon, 05 Jun 2023 06:48:05 -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=nX8jdpMV; 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 S234151AbjFENem (ORCPT + 99 others); Mon, 5 Jun 2023 09:34:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44872 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234098AbjFENe2 (ORCPT ); Mon, 5 Jun 2023 09:34:28 -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 C2ED0D2 for ; Mon, 5 Jun 2023 06:34:27 -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=1685972066; 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=nX8jdpMVZCkY0JwiNgTs2/AkkYvqZZn70B8zIx8fV36lLjX1u/q+PtFaQk17mqeCzZ9Y9q 4k9wefyFwIaRU6M6pN0ARpgZ5HslssfZe5panS+n0HArfzJDVAcYFSA4m/Xiu1r9QdY6sj eKRekgpftSP1oCaJQ2tFBai8FmQCNHHTtFCONXfZ3p2pynsr8bEMwqHmWOW5sipa5EKFFy qccypx4kWWWdfQ1Oe1aZObMw4D80tybwefnIJz1q46x0MZWr+jpcO+u0kU+nizOyge8G+S nY89es1Mlw2WrJ+rl4yYaoPreZw0TqtDpTWMoD3Kqt2yoerdRXk0OsXbcVrnng== 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 D2921FF80E; Mon, 5 Jun 2023 13:34:25 +0000 (UTC) From: Miquel Raynal To: Greg Kroah-Hartman Cc: Luka Perkov , Robert Marko , Thomas Petazzoni , , Srinivas Kandagatla , Rafael J Wysocki , Miquel Raynal Subject: [PATCH v3 3/4] ABI: sysfs-nvmem-cells: Expose cells through sysfs Date: Mon, 5 Jun 2023 15:34:21 +0200 Message-Id: <20230605133422.45840-4-miquel.raynal@bootlin.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230605133422.45840-1-miquel.raynal@bootlin.com> References: <20230605133422.45840-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 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?1767870704112221439?= X-GMAIL-MSGID: =?utf-8?q?1767870704112221439?= 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