From patchwork Wed Jan 31 11:15:11 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Gloor X-Patchwork-Id: 19724 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:2087:b0:106:209c:c626 with SMTP id gs7csp1816002dyb; Wed, 31 Jan 2024 03:19:33 -0800 (PST) X-Google-Smtp-Source: AGHT+IHVJY49LONuWJmr4x+lp1Ht73TZHokoXcaZL7aHtJKWwEWMTQ/lCZMj1tyBn8d8A/1lv1ED X-Received: by 2002:a05:622a:1ba2:b0:42a:b2b1:a800 with SMTP id bp34-20020a05622a1ba200b0042ab2b1a800mr1679766qtb.26.1706699973760; Wed, 31 Jan 2024 03:19:33 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706699973; cv=pass; d=google.com; s=arc-20160816; b=Q6WNN24qlyzSdTvSJLIr+Z2tzHoxxSPYAhaOET74PUsZQ1PQpVmdb7A+/tBMwGQmt+ nG7NQGt8661eQpudQRG4ngm9xdPL7M7pYcpFHCmBx/XaIvDLszAOv4VFXGOJyPC8delR KhhYb6l+Gb/8v7xZ1J7VskBXC3beLk5bqjSTCRoFJbLAUL3zAofrbIDUsIY5Vv9NI7LV 5094uYB6olB/OoTB5xOnaDMt9X4Di8UzkmnsB1JRXAUYfD6FQp3ivE/qsdZtkOZxU1uf oop6SNLAW7ug8nxEXHM+WU5Y2LEgVz6vVGhkZlUsHbzMKESp2dFyQSeEM0I91/G8D//E H4Eg== ARC-Message-Signature: i=2; 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:message-id:date:subject:cc:to :from; bh=mIwh8QVSXo9uq2cFLUFe2Iw2IqLkgX4ikES9+eIxn5c=; fh=VZ0/2mYoXBmjDMr29aQXLndFa8Doe8h2FyRvyHA3cOc=; b=CEBfhJYJbPWDeHZk28tVM9DwzRLsUtR5d2HZz7GfVaX0nbuEAm3TJbGAh2mQOewdug n7DNsDqk7T8f32RMEVWyqEGJhg6YGSK1pOnOd/fEeFV00P2Q8XbC5Koa5Uvwc3L/ZYCS OfYD6tWVT7NSZRr6GUIHW/Wc1kCIk+EH2h0FnRtwPvWK3PP6qpjpGOIh0K8h+E78vi7M 8uEAnWq2r+8PlV+HbslCMfRzE+VRrOA9CkeYVxZnJTeLVV5fweqn07xb39iK0SdtjBH6 AuWy5lLbj+1sTe37oHPmCsjnfpuiivkEnad+zjLM+t6OqJyqMpf3PEV3x9wfM9zX3pxf Q+UQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=stefan-gloor.ch); spf=pass (google.com: domain of linux-kernel+bounces-46335-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-46335-ouuuleilei=gmail.com@vger.kernel.org" X-Forwarded-Encrypted: i=1; AJvYcCVR9WoFn6Jf3ZHsZheKTyX0wtQ+oupNUuHORdH0n1bRuNqk15qnVznFpmnTsTxWg13Tejlon+iyRrKti7mAJvQ4+9PyoA== Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id f3-20020ac87f03000000b0042a3c052248si11777375qtk.314.2024.01.31.03.19.33 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 31 Jan 2024 03:19:33 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-46335-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=stefan-gloor.ch); spf=pass (google.com: domain of linux-kernel+bounces-46335-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-46335-ouuuleilei=gmail.com@vger.kernel.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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 29C8A1C26385 for ; Wed, 31 Jan 2024 11:18:49 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 44C9F79DC3; Wed, 31 Jan 2024 11:17:22 +0000 (UTC) Received: from mxout013.mail.hostpoint.ch (mxout013.mail.hostpoint.ch [217.26.49.173]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A433A7993A; Wed, 31 Jan 2024 11:17:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.26.49.173 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706699840; cv=none; b=Fd+52vC21TG4k+C+zianvOSudU7P96yGfrysFXqD1xxkKHMePWxBjdUulvgbqJ0itWvo/I+OPcxdH0BsSMqagqJzNNDyA8zx6t23URyW/YBV3DuGKA+sIpHR4drFGYdqOCJv+X8VARjOVoHHQ7Te7uqqCVg5arGms6e4PNNFwjI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706699840; c=relaxed/simple; bh=pJCY8vlQdovHIAKMl/XorVaaAX4PdAyOBYKtKbP5f0Y=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=QcrRfuTbce7MLt21puFZSYSe1FbnAsy8qmUI2DMxBY02ZbsJazrpabmKGPWFaI+9ZMqywyyWzdqfkE1Fy7o+S8JsotSHl2YUzub81tTWy2ftJTFNsmQB6DtkfLZ7U3ZBgwCkHCp1g9mb3L+DlR+/FyQu5OIHIHBnP+rXkRM4uwo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=stefan-gloor.ch; spf=pass smtp.mailfrom=stefan-gloor.ch; arc=none smtp.client-ip=217.26.49.173 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=stefan-gloor.ch Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=stefan-gloor.ch Received: from [10.0.2.44] (helo=asmtp014.mail.hostpoint.ch) by mxout013.mail.hostpoint.ch with esmtps (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.97.1 (FreeBSD)) (envelope-from ) id 1rV8ZB-00000000DVs-0gxz; Wed, 31 Jan 2024 12:15:41 +0100 Received: from 157.20.79.83.dynamic.wline.res.cust.swisscom.ch ([83.79.20.157] helo=thinkpad.localdomain) by asmtp014.mail.hostpoint.ch with esmtpa (Exim 4.97.1 (FreeBSD)) (envelope-from ) id 1rV8ZA-000000009un-3yfk; Wed, 31 Jan 2024 12:15:41 +0100 X-Authenticated-Sender-Id: code@stefan-gloor.ch From: Stefan Gloor To: jdelvare@suse.com, linux@roeck-us.net, corbet@lwn.net, linux-hwmon@vger.kernel.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Stefan Gloor Subject: [PATCH v4 0/1] hwmon: (sht3x) read out sensor serial number Date: Wed, 31 Jan 2024 12:15:11 +0100 Message-ID: <20240131111512.25321-1-code@stefan-gloor.ch> X-Mailer: git-send-email 2.41.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Vs-State: 0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1789604612408345254 X-GMAIL-MSGID: 1789604631586584948 The temperature/humidity sensors of the STS3x/SHT3x family are calibrated and factory-programmed with a unique serial number. For some sensors, this serial number can be used to obtain a calibration certificate via an API provided by the manufacturer (Sensirion). Expose the serial number via debugfs. A "sht3x" debugfs directory is created when loading the driver. Within this parent directory, another directory is created for each sensor instantiation which contains the serial number. The sensor-specific directories are managed by devres, such that they are cleaned up upon deinstantation or if hwmon registration fails. The top-level directory is removed when the driver is unloaded. Changelog ========= v3 -> v4: - Remove debugfs entry with devm_add_action_or_reset() v2 -> v3: - Remove #ifdef for debugfs - Add debugfs cleanup - Do not expose serial number if read fails v1 -> v2: - Change from sysfs to debugfs - Add documentation improvements Stefan Gloor (1): hwmon: (sht3x) read out sensor serial number Documentation/hwmon/sht3x.rst | 11 ++++++ drivers/hwmon/sht3x.c | 66 ++++++++++++++++++++++++++++++++++- 2 files changed, 76 insertions(+), 1 deletion(-)