From patchwork Tue Jan 30 21:06:45 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Javier Carrasco X-Patchwork-Id: 768221 Received: from mail-ej1-f52.google.com (mail-ej1-f52.google.com [209.85.218.52]) (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 98EBA762DD; Tue, 30 Jan 2024 21:06:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.52 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706648816; cv=none; b=Bh3uZIiI0rkCCgoVRrDzMzB+q+V09rbuhDgyskfbd/E0ilSkbp5fGLyT8+QhPvvBxNjeK4lKessL7CX6Mln/hi+8O2xUPRMXKK0rd2QI/Ce8EVPVdYAibjHd1usYJghiJEFibk08Gy1+mrTvQKQhrXbZNUXIdkcJxonHs/aqgeA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706648816; c=relaxed/simple; bh=uLF/Qmue1+Wzk3XhIihfzQTCEXmbPTvk9jP+cW/SKMg=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=MxMUlQZiefJw0TQP2iWcgTzQnNg4yzUmATM53Hq3pzf4kuZmYlY0QbIagh4PYRak2YrEdaXpgmjAMLNoGTlFH7Zq6zY7CrYD/sLOyMDtiv2/7SgC2b9+c1e8CGMNVJPcXKTr5fpnOIrAWneaoBlvPXRUzswkV9G3MJyVz9kd1HQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=MYeLN6qN; arc=none smtp.client-ip=209.85.218.52 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="MYeLN6qN" Received: by mail-ej1-f52.google.com with SMTP id a640c23a62f3a-a34c5ca2537so499045566b.0; Tue, 30 Jan 2024 13:06:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1706648813; x=1707253613; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=IQtvJUU+OqNUf9TfCmUtoX2TLTtaGeLRFukm+fQ1w2U=; b=MYeLN6qNjVVNybaJRV9FGYXqcsbFl/yr0Xz3BVO6n4UbecLHUpYtUn9/c4JDpjBVkk EjDTfZh9E0a2pvI/IBK3Fg9pX2aeUuieHVqHZa86RbC6Xs1QQqLr5cCaZl9S5LRB0dO9 z0MntVlI3oBxp6eVUdCqOC2MhdwYHeNupbZir/Yo/oWNxbLMrMkb2DJhHKK0DW9Ojqq0 OvXBOk0CQO2ztSiGO3Hn28bjWjbr2JrPaWuJI8NDwfbIUlSlfdqOUrjfd+d0zvCPj7Vt rThhsWL3x48uyNProxlNl1CwjFqPmMB2BVrWY63GPpUA8N4eOMtvhRV6X/P3aPwdbEh/ K5MQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706648813; x=1707253613; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=IQtvJUU+OqNUf9TfCmUtoX2TLTtaGeLRFukm+fQ1w2U=; b=F3dwt5kIxl3SZdugev3FoOUgyWb5QJJ/Zjpam5S7Y37tRXgbrk59+I5UMKn67BksGt IdFOmU2IP2J2wcrb4y88UloJRrzSZ8fsbMfB6ZfF5P8bNoheg2NfQYe0FP8TbSLB/K+X 08FO1Exh1Ycscga5uYEMh5xT5+yqTDyFKTUckrEeJY0oJSxrJgBDPuTZcOqejCfICyVW alzxrYgNuaxJRAiTjIyjZKIhS1c5OgzouynfCV4zSLwTIe67k8oFUUtRfkXRO5TaGlWw JzSBsy/pPczmJySWYXyIIH4yOIrfgtzGKOfm9B6050P1M6l0UU5EY1mYchstTZPLYy8Q ZFvQ== X-Gm-Message-State: AOJu0YxLST6uR1jEhOuZbwmi4RT2vIO45vBgAkoXI0SSry4RrIhz9lXa o4N8+J3QYmtpRmJrU8rPUrMGiNpfEUHclQ8ilWQyuQZzmEIm3zql X-Google-Smtp-Source: AGHT+IE7jIrmgeOq4vCSI0+9AQSg9oLjTu6kevG43kjrQUqhj1DyGkMA7jqRnBAGjEF9+kaQM9OzeA== X-Received: by 2002:a17:906:1703:b0:a28:2165:7c74 with SMTP id c3-20020a170906170300b00a2821657c74mr6714400eje.13.1706648812450; Tue, 30 Jan 2024 13:06:52 -0800 (PST) Received: from [127.0.1.1] (2a02-8389-41cf-e200-7400-ff68-7ab4-4169.cable.dynamic.v6.surfer.at. [2a02:8389:41cf:e200:7400:ff68:7ab4:4169]) by smtp.gmail.com with ESMTPSA id vv9-20020a170907a68900b00a354a5d2c39sm4177658ejc.31.2024.01.30.13.06.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 Jan 2024 13:06:52 -0800 (PST) From: Javier Carrasco Date: Tue, 30 Jan 2024 22:06:45 +0100 Subject: [PATCH v6 2/5] hwmon: (core) Add support for humidity min/max alarm Precedence: bulk X-Mailing-List: devicetree@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240130-topic-chipcap2-v6-2-260bea05cf9b@gmail.com> References: <20240130-topic-chipcap2-v6-0-260bea05cf9b@gmail.com> In-Reply-To: <20240130-topic-chipcap2-v6-0-260bea05cf9b@gmail.com> To: Rob Herring , Krzysztof Kozlowski , Conor Dooley , Jean Delvare , Guenter Roeck , Jonathan Corbet , Liam Girdwood , Mark Brown Cc: Rob Herring , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-hwmon@vger.kernel.org, linux-doc@vger.kernel.org, Javier Carrasco X-Mailer: b4 0.13-dev-0434a X-Developer-Signature: v=1; a=ed25519-sha256; t=1706648808; l=1810; i=javier.carrasco.cruz@gmail.com; s=20230509; h=from:subject:message-id; bh=uLF/Qmue1+Wzk3XhIihfzQTCEXmbPTvk9jP+cW/SKMg=; b=Rw6EQWW4CWmGJ3m9Vp1Pt2qAtCMUx4XzR/QlV8oumy6at0oar4qK3QBRzng+inKt/Z1oYG3ID VYxEk5A8TEQDCtZQdVQnSHcvwqidbJiqEa6tbENi5lPscRlVarkpvwv X-Developer-Key: i=javier.carrasco.cruz@gmail.com; a=ed25519; pk=tIGJV7M+tCizagNijF0eGMBGcOsPD+0cWGfKjl4h6K8= Add min_alarm and max_alarm attributes for humidityX to support devices that can generate these alarms. Such attributes already exist for other magnitudes such as tempX. Tested with a ChipCap 2 temperature-humidity sensor. Signed-off-by: Javier Carrasco --- drivers/hwmon/hwmon.c | 2 ++ include/linux/hwmon.h | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/drivers/hwmon/hwmon.c b/drivers/hwmon/hwmon.c index c7dd3f5b2bd5..b51d13f08d27 100644 --- a/drivers/hwmon/hwmon.c +++ b/drivers/hwmon/hwmon.c @@ -586,6 +586,8 @@ static const char * const hwmon_humidity_attr_templates[] = { [hwmon_humidity_fault] = "humidity%d_fault", [hwmon_humidity_rated_min] = "humidity%d_rated_min", [hwmon_humidity_rated_max] = "humidity%d_rated_max", + [hwmon_humidity_min_alarm] = "humidity%d_min_alarm", + [hwmon_humidity_max_alarm] = "humidity%d_max_alarm", }; static const char * const hwmon_fan_attr_templates[] = { diff --git a/include/linux/hwmon.h b/include/linux/hwmon.h index 8cd6a6b33593..f553f8cd6946 100644 --- a/include/linux/hwmon.h +++ b/include/linux/hwmon.h @@ -293,6 +293,8 @@ enum hwmon_humidity_attributes { hwmon_humidity_fault, hwmon_humidity_rated_min, hwmon_humidity_rated_max, + hwmon_humidity_min_alarm, + hwmon_humidity_max_alarm, }; #define HWMON_H_ENABLE BIT(hwmon_humidity_enable) @@ -306,6 +308,8 @@ enum hwmon_humidity_attributes { #define HWMON_H_FAULT BIT(hwmon_humidity_fault) #define HWMON_H_RATED_MIN BIT(hwmon_humidity_rated_min) #define HWMON_H_RATED_MAX BIT(hwmon_humidity_rated_max) +#define HWMON_H_MIN_ALARM BIT(hwmon_humidity_min_alarm) +#define HWMON_H_MAX_ALARM BIT(hwmon_humidity_max_alarm) enum hwmon_fan_attributes { hwmon_fan_enable, From patchwork Tue Jan 30 21:06:47 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Javier Carrasco X-Patchwork-Id: 768220 Received: from mail-ej1-f54.google.com (mail-ej1-f54.google.com [209.85.218.54]) (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 6A690762F4; Tue, 30 Jan 2024 21:06:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.54 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706648819; cv=none; b=fnWUKV7Yoep6FeLlHf2nmOekEIrx67RZzAujBn5m5SatbNqSrNgADj+9+8LoHflrvuIQ45D+cCTTwSnpDhxl3OtA2RMejYfnipLKruf2D8AsY5KupFHHtPRy4lqb0i4QwvIkZjJNbNWqHC5cb9G60fXUQcH6pvQBwNe8B12H0ak= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706648819; c=relaxed/simple; bh=fNJt6Q/D/Alnf1fohB1Z7SdgiB8iUvgMdRCGPeqchec=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=pLycXFvjOAgRJXl4YSz2I9aqcmr535hWdcV33kkKNZDwXXfD3F977qjobSlSX+hRPg8ZdQTNKgtjZSfx+qIi6bzwjL47C5uTRXrofELSoE1DM7iH0GBMBy0OlDRz3eog54IsbexZUWHQoid/yjsbeOf7C1eFr+wdmhfCWq8LY9U= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=TqfX1oFA; arc=none smtp.client-ip=209.85.218.54 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="TqfX1oFA" Received: by mail-ej1-f54.google.com with SMTP id a640c23a62f3a-a35e9161b8cso309430666b.3; Tue, 30 Jan 2024 13:06:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1706648815; x=1707253615; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=CLDQhSu6kRqZGxiyHOr+RblF6k83oiX6rLk/meipQMA=; b=TqfX1oFA6owraA4egYBHaJsxAyo7ngxiou7GiBswvpkxHcn4sgAxQpLPoUiMRFHpkp Hicm+hTkzWLMNMkjNZCxrOYoz5adgJXJhGXfO2Mb5J2vCMq17O0ZqRJIiiktuXT4C42n tpo8/hxZCU3lhkxIz1XEbIeov8M0iO6q4G0FWaXTj0iJWVOPQfNKYXDh74VdxFXrlJy3 k0tR6fnGKxnA95PL8d6BUfXFZeSjAdytaywA2hkjP0+SDTcPk1cerGIW48UUIYtnVfbC nQsMz8JGqN1SAIy5ig7Jozxa8FLMhloLrtNSBhslXijcOsj67seMB1IPOJEtRfYu4qnG aJvg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706648815; x=1707253615; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=CLDQhSu6kRqZGxiyHOr+RblF6k83oiX6rLk/meipQMA=; b=YAqD+DPufPFuYlOcT0c1X7Gt/0q7mj3nyl0gNgUr5kHA2D0iytlStrTJ59/MRq0cCK J3fXtkMLEK5e2MwjfgzLBP8qV8YB5PMjNFXmW8UN/KuKDvQE/EM+yeY/6/2MJLHUuMEU 5Ci0FpFebuIrdbo3EXAVY/Au0VP8JnVUWN2j3Iua8y1JnaWi87GMkGv/DnsPs+6UIh7x vfJzAbECFSMifqvYNm7tGr0A5XKNgfKI+5JeYrZizFiHnKREq3ioiFwZnpgSak832rx/ gyUckIy2/4NCs284kI6vgBtjFFmahriyUx7ydPk5EF9le+TYfBE4bNGgbdrJqlRCeyvs gPQQ== X-Gm-Message-State: AOJu0Yzju1DY8BVv+kQ88++E1ygqkM6mQghj6r8egW8MaLT74R33wCTA waYCC+hFXdQTcMdoYTFBNfxgVTnwG5yEvZBz+Jahy4mDces+ffRC X-Google-Smtp-Source: AGHT+IGk6r9KlNzje7atnk4nKVE+RhaI2llH4SByjhzfH3V9RToNtOYhP4sic9HHF0riJEA1uADvBw== X-Received: by 2002:a17:906:26d6:b0:a36:239:77a with SMTP id u22-20020a17090626d600b00a360239077amr2770503ejc.23.1706648815369; Tue, 30 Jan 2024 13:06:55 -0800 (PST) Received: from [127.0.1.1] (2a02-8389-41cf-e200-7400-ff68-7ab4-4169.cable.dynamic.v6.surfer.at. [2a02:8389:41cf:e200:7400:ff68:7ab4:4169]) by smtp.gmail.com with ESMTPSA id vv9-20020a170907a68900b00a354a5d2c39sm4177658ejc.31.2024.01.30.13.06.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 Jan 2024 13:06:55 -0800 (PST) From: Javier Carrasco Date: Tue, 30 Jan 2024 22:06:47 +0100 Subject: [PATCH v6 4/5] dt-bindings: hwmon: Add Amphenol ChipCap 2 Precedence: bulk X-Mailing-List: devicetree@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240130-topic-chipcap2-v6-4-260bea05cf9b@gmail.com> References: <20240130-topic-chipcap2-v6-0-260bea05cf9b@gmail.com> In-Reply-To: <20240130-topic-chipcap2-v6-0-260bea05cf9b@gmail.com> To: Rob Herring , Krzysztof Kozlowski , Conor Dooley , Jean Delvare , Guenter Roeck , Jonathan Corbet , Liam Girdwood , Mark Brown Cc: Rob Herring , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-hwmon@vger.kernel.org, linux-doc@vger.kernel.org, Javier Carrasco , Conor Dooley X-Mailer: b4 0.13-dev-0434a X-Developer-Signature: v=1; a=ed25519-sha256; t=1706648808; l=2700; i=javier.carrasco.cruz@gmail.com; s=20230509; h=from:subject:message-id; bh=fNJt6Q/D/Alnf1fohB1Z7SdgiB8iUvgMdRCGPeqchec=; b=MAPNCwHqUhbiKclSBeuhCBTF8oR3TzEGbpJ7+X1TyFsGcwyuTBxjXe4VbItX8JQ0V0h6G9rQy xD+aGaGSlUsDi1NnuBkFF7V8fByqizgn52ePwweamWNiH29+NEvukzA X-Developer-Key: i=javier.carrasco.cruz@gmail.com; a=ed25519; pk=tIGJV7M+tCizagNijF0eGMBGcOsPD+0cWGfKjl4h6K8= Add device tree bindings and an example for the ChipCap 2 humidity and temperature sensor. Reviewed-by: Conor Dooley Signed-off-by: Javier Carrasco --- .../bindings/hwmon/amphenol,chipcap2.yaml | 77 ++++++++++++++++++++++ 1 file changed, 77 insertions(+) diff --git a/Documentation/devicetree/bindings/hwmon/amphenol,chipcap2.yaml b/Documentation/devicetree/bindings/hwmon/amphenol,chipcap2.yaml new file mode 100644 index 000000000000..17351fdbefce --- /dev/null +++ b/Documentation/devicetree/bindings/hwmon/amphenol,chipcap2.yaml @@ -0,0 +1,77 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/hwmon/amphenol,chipcap2.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: ChipCap 2 humidity and temperature iio sensor + +maintainers: + - Javier Carrasco + +description: | + Relative humidity and temperature sensor on I2C bus. + + Datasheets: + https://www.amphenol-sensors.com/en/telaire/humidity/527-humidity-sensors/3095-chipcap-2 + +properties: + compatible: + oneOf: + - const: amphenol,cc2d23 + - items: + - enum: + - amphenol,cc2d23s + - amphenol,cc2d25 + - amphenol,cc2d25s + - amphenol,cc2d33 + - amphenol,cc2d33s + - amphenol,cc2d35 + - amphenol,cc2d35s + - const: amphenol,cc2d23 + + reg: + maxItems: 1 + + interrupts: + items: + - description: measurement ready indicator + - description: low humidity alarm + - description: high humidity alarm + + interrupt-names: + items: + - const: ready + - const: low + - const: high + + vdd-supply: + description: + Dedicated, controllable supply-regulator to reset the device and + enter in command mode. + +required: + - compatible + - reg + - vdd-supply + +additionalProperties: false + +examples: + - | + #include + i2c { + #address-cells = <1>; + #size-cells = <0>; + + humidity@28 { + compatible = "amphenol,cc2d23s", "amphenol,cc2d23"; + reg = <0x28>; + interrupt-parent = <&gpio>; + interrupts = <4 IRQ_TYPE_EDGE_RISING>, + <5 IRQ_TYPE_EDGE_RISING>, + <6 IRQ_TYPE_EDGE_RISING>; + interrupt-names = "ready", "low", "high"; + vdd-supply = <®_vdd>; + }; + };