Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp6597610rdb; Fri, 15 Dec 2023 03:17:58 -0800 (PST) X-Google-Smtp-Source: AGHT+IG6fAb2B6bqmY+nlhZQVC/dyio5Yf4Dr+N/z6EoyZPZoVEBMiiH0S5VLarfolkAiKl4Ynz0 X-Received: by 2002:a17:902:d48e:b0:1d3:5d66:19e4 with SMTP id c14-20020a170902d48e00b001d35d6619e4mr5112741plg.20.1702639077895; Fri, 15 Dec 2023 03:17:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702639077; cv=none; d=google.com; s=arc-20160816; b=RCxRR6FeqGHe4cpSja+k66klYmFc9hnH7KpxeCr9LE4Q4WGWB01ctRXHIctaIXxPZ4 eoqjB6lKbMyYlCGT6IzY4ldYdn/Q490Rq+/MVj+LeWtZe+hzZ9jGlF7s1qGh+5EfyztK f5Hjl5TdUYM20yJVqB33cbbcNU4oah/3cQIwsxUw75s+eYarCPhz04Ov+QxkyEzxsGry YysDRaxdmI55KeGaJl125dDegWLAO7/1FMeZHFhmJP4CZfxli78xwAzGW8mk8QVUO7Cf VBuDRy8+ZZ2jVcBAkhcpoFR+7HDpJDS/9sfATan4GWECaaKuD5H8fJpBzx/mlw0t8jxY UqTw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=E+ooKEqmsF7QvtbpeG1r1pA2WmE89GFiP0WEgLh36AY=; fh=ALEjuxmQYbWgig+wIxLy2TTD1IH/EIEdEUBXAEoBMwU=; b=UNd+OfPKp6Wl0MNJDDigsKf1dlq4sSQFeWc0uTAv28DlqLbTyBKS+uitJk0lPB8xRz zEaKm0IXSvZ4s1MCV2izKgEJEVgKVLxgZklj8jHlhztKwpcCtGZEIJan11reI9PF1hec 632ounnXRsz1LmHW528BOjYKc1vlSUpA1qbPwPVoNK4VFlp4OKujn8m0odbA4dPm2EQz UD8c0l+VslfT1HJM2O8Kt6QG8Xsj21tehdE3+nzM83RY/WwqzLb1VICkiNPJ0PmkGzKW r9IlywJb3I8njGUIbfDhSc2mI0C9WEjz7vo0V9vnHS4y+eGHB32OrPRrgwTEsEjPnDZF fz4Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ybQP8bvN; spf=pass (google.com: domain of linux-kernel+bounces-816-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-816-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id n7-20020a1709026a8700b001d356043820si3845996plk.604.2023.12.15.03.17.57 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Dec 2023 03:17:57 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-816-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ybQP8bvN; spf=pass (google.com: domain of linux-kernel+bounces-816-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-816-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 160952860C2 for ; Fri, 15 Dec 2023 11:17:24 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 3F847208D7; Fri, 15 Dec 2023 11:15:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="ybQP8bvN" X-Original-To: linux-kernel@vger.kernel.org Received: from mail-wr1-f45.google.com (mail-wr1-f45.google.com [209.85.221.45]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 52C072C691 for ; Fri, 15 Dec 2023 11:15:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Received: by mail-wr1-f45.google.com with SMTP id ffacd0b85a97d-33638e7f71aso268181f8f.1 for ; Fri, 15 Dec 2023 03:15:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1702638952; x=1703243752; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=E+ooKEqmsF7QvtbpeG1r1pA2WmE89GFiP0WEgLh36AY=; b=ybQP8bvN29AWzEJO0TrF5/Nsva+piSZZrCfBTa6liAUPisaYe0JGDAm7W/qSTRqw3F 4iaCK62Y5tpEKH0ka9goIbC4l8E05h2O9JfhBZb+55RkknJRCehD87gYSN5gOeO/6mo+ zgKUwaGUQqUC/8NloLH9rA227lb7pekSz3LwHzOFd20FWWV6e5hyUhDsuhab1IzgA8uM HpsM/AXb1bz/ptqFTK/Pg8CE2psV88U8hOwY704FGZF1XXFvZji1e4lSphmMbkDfQE/d /8DzRbhpcZ4sOZB7gaonJn106GF1+Uv4KgbkIoyt/bw7LcpA+ALr6gza3Gbetv/XuSbR EtJw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702638952; x=1703243752; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=E+ooKEqmsF7QvtbpeG1r1pA2WmE89GFiP0WEgLh36AY=; b=wnkrir86GFy3EFaJ9mEMFR7zMvqM7e7fh1Y5MFYpNOtv3LDoYuFQ0xSeDkRdktGDj+ ktzeFCkjigwJFG8hQHjSKahOKbGUnZTcdkNviPy7yU/J60kO3RTbj3qGEysGmVmsAF5I 6NrgZYi3c0cwZqlkaUhzz+uYZBkIV1fTq9/gZD6YCLao8HdDVStiGbt14WXGUArhgNk3 1lNpJE6ebF8LobB39BAzHhfUD0G0LJwz7Mry/VP2AbHJuNeBUu0f5Edj8Qbmj6+qg+RB UmR5xpn2Z+Qk+/EhizNtof63eIcG+EjyvQh7YTY7EY8CZ9VB9dcVOnCMtgFsDgxUI7YW hmRA== X-Gm-Message-State: AOJu0YyZtKYjKxse7VMnf6Wqu+dwCtY8uIcOSeN1HtD1e6GUTKTXsprl 6SpvXY+bnlwUWQGEupBNcHQXIFCOSu5eEg4mFMg= X-Received: by 2002:a5d:6ac2:0:b0:333:38eb:8949 with SMTP id u2-20020a5d6ac2000000b0033338eb8949mr5985493wrw.25.1702638952500; Fri, 15 Dec 2023 03:15:52 -0800 (PST) Received: from localhost.localdomain ([5.133.47.210]) by smtp.gmail.com with ESMTPSA id g13-20020a056000118d00b003333d46a9e8sm18511497wrx.56.2023.12.15.03.15.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Dec 2023 03:15:52 -0800 (PST) From: srinivas.kandagatla@linaro.org To: gregkh@linuxfoundation.org Cc: linux-kernel@vger.kernel.org, Miquel Raynal , Srinivas Kandagatla Subject: [PATCH 07/10] ABI: sysfs-nvmem-cells: Expose cells through sysfs Date: Fri, 15 Dec 2023 11:15:33 +0000 Message-Id: <20231215111536.316972-8-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20231215111536.316972-1-srinivas.kandagatla@linaro.org> References: <20231215111536.316972-1-srinivas.kandagatla@linaro.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=2442; i=srinivas.kandagatla@linaro.org; h=from:subject; bh=rDw2aRqd4VB4KQrERUdheIoqHQ7dZxBi1jfzVJE5aW0=; b=owEBbQGS/pANAwAKAXqh/VnHNFU3AcsmYgBlfDVYlpIsMnIDm7GHut/qUakpchD85wEJ03JP8 hLvUbzLP1eJATMEAAEKAB0WIQQi509axvzi9vce3Y16of1ZxzRVNwUCZXw1WAAKCRB6of1ZxzRV N279CACRaGwuqabts3hC8cLlJ9C+ljtD6Usa4/RGBkwhV5+yE4PP0TZfa2+EfOsxDFQ3Io5UK8B /WlfduyfDSb2fwIgNU0udTpy7a1wSvq0o0rmRVrK4ujU77+aOzPwy8coo/S4ykYkiUIISYrIq+z KGtH0MW9ym9uQeTxxxuDcnjcwkJmBoGXXJTDTpA1KwfYcVWAA1FZCh9qG7NXZ9WCuo8DgmI4/b3 FDfudF10K5GA31KPPJLG6BheyKENdeVE5pC1D696OyhVuiSXF1RScSdJAHGSXyt4wsNFUVXjVqE 8moMwpZ6pvQAU5aiB79J3iK5zcSVX4U5rW4LXqXKrgrthc3U X-Developer-Key: i=srinivas.kandagatla@linaro.org; a=openpgp; fpr=ED6472765AB36EC43B3EF97AD77E3FC0562560D6 Content-Transfer-Encoding: 8bit From: Miquel Raynal 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 Signed-off-by: Srinivas Kandagatla --- 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.25.1