Received: by 2002:a05:7412:37c9:b0:e2:908c:2ebd with SMTP id jz9csp2985221rdb; Fri, 22 Sep 2023 14:19:40 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEpQufhC5U19AJ8N8MYcOJBG4yalH4CW+h6zOG/o5FrOyb8GpOfB2URrivx2CmIKC/jy5aR X-Received: by 2002:a05:6a21:9996:b0:14c:ca25:3b53 with SMTP id ve22-20020a056a21999600b0014cca253b53mr827156pzb.27.1695417580179; Fri, 22 Sep 2023 14:19:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695417580; cv=none; d=google.com; s=arc-20160816; b=o52aa5gWh8J4NbxKenQU/FCuqFXzIGrBC00KTSUrMgqB0XaE6FcBddj9s41K/uex2O l4mc199kZZpzllrisoRDTmZQh8yCEsM9dt7BkN0w0yAtAQs2c1j5rgdb1Avx4e0sSNcM /bNsF5Xir8kMjnh2ew3CWbBkiR9e1OXcMF3cYbyHBI8A0tGpdAZq+KRRDl953jHm16T/ bybuRVOMbUTClUFxKO/DFD32u99ytu+3vvuHJD8EIB41CZ6rFjnCYVlGcx5lL17rSxJ4 EYZPkBDTtDv/mf+36aDCaSiZ+Z7RA9SVPQ05LI5KsMsfDyXa4/Bh+WCPC+zon54p2j9S ZsPA== 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=uNRYBw15K+4lj0RowSR5ppkZ/jQAGNdwwLd8P1k8N6c=; b=LJMqBVFDKqYF8vlqCBjtdDXnMppDkP+DhjKCM4QRNzMaH5HGl0sd4GoIKFuYH6Xw7b YmNpjRQ/rHNf2JPcdr1FJvJ7jdj3nRWXg64bt3ss7C0YP7liJ5I3wLaSk3Ixar8hMsRB L8VptoPmz1420iQwzPyYRQJfofIrC5ZAok1UuSwxzGyyUqlfBiYUkPPvpgpwhQZG6CP8 kEbfBTNvDVL5kA4WAHoO/kfAWDA3zzd3sdmgA7SLaIIotKtQQAoXVgYnbDDliSy8EC6G kJL7NB9xbXCjO0TgEokNyJX0XIJoqj1vSXj0vTF/ngfc4wj+ZkvIGH+s5nTlXwzw6Oa9 A2zg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=cUjfLTWd; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 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 pete.vger.email (pete.vger.email. [23.128.96.36]) by mx.google.com with ESMTPS id i67-20020a636d46000000b005708fb8f0bbsi4651508pgc.571.2023.09.22.14.19.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Sep 2023 14:19:40 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) client-ip=23.128.96.36; Authentication-Results: mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=cUjfLTWd; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 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 pete.vger.email (Postfix) with ESMTP id 2386483CCA62; Fri, 22 Sep 2023 10:49:26 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at pete.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233182AbjIVRtU (ORCPT + 99 others); Fri, 22 Sep 2023 13:49:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43820 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232987AbjIVRtM (ORCPT ); Fri, 22 Sep 2023 13:49:12 -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 090C299 for ; Fri, 22 Sep 2023 10:49:05 -0700 (PDT) Received: by mail.gandi.net (Postfix) with ESMTPSA id DD990E0003; Fri, 22 Sep 2023 17:49:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1695404944; 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=cUjfLTWdIYMKuMb63IFz5LtWQxIs46prbk3G4JAlSMOp+uDL3HTdPZyUwhl9BXgEFYElEd x5g+N9LHLyH0C0gIQZ5szWDBqgnI9a+9VQCZl/SfDh88YFnU0d5WMKmLxS/xPQvD9v5wuR leInR8cKhka+/Pvlyj2RDLFb0ILjDw55WVyhdeMKZCHQQNTiyBbqwiePOiKuFvBpO3e0Od 2Pp1QprnAQpG8kZetLNN0BzhmB2EZTNVbilAkMSywOvwW0ossH38uPhWSAfMpnLKO7rlHT VNpZGpa50DBJHOb4WTwt6nZ1M/twGUBuYRsVZWX7HkdSbkfO9wkV5TEK+O+8Cg== From: Miquel Raynal To: Srinivas Kandagatla , Greg Kroah-Hartman Cc: Michael Walle , Thomas Petazzoni , Robert Marko , Luka Perkov , , Randy Dunlap , Chen-Yu Tsai , Daniel Golle , =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= , Miquel Raynal Subject: [PATCH v10 2/3] ABI: sysfs-nvmem-cells: Expose cells through sysfs Date: Fri, 22 Sep 2023 19:48:53 +0200 Message-Id: <20230922174854.611975-3-miquel.raynal@bootlin.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230922174854.611975-1-miquel.raynal@bootlin.com> References: <20230922174854.611975-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=-0.8 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on pete.vger.email 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 (pete.vger.email [0.0.0.0]); Fri, 22 Sep 2023 10:49:26 -0700 (PDT) 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