Received: by 2002:a05:7412:8d09:b0:fa:4c10:6cad with SMTP id bj9csp58255rdb; Mon, 15 Jan 2024 12:03:02 -0800 (PST) X-Google-Smtp-Source: AGHT+IE+M1zHoIq6SWjch9NJlvZJ1Pipx94BsN2slDsEFaxHSyNuncmCz1m7SKVk0oVOnBUi1XTr X-Received: by 2002:a17:903:606:b0:1d4:59ab:36af with SMTP id kg6-20020a170903060600b001d459ab36afmr6171890plb.30.1705348982119; Mon, 15 Jan 2024 12:03:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1705348982; cv=none; d=google.com; s=arc-20160816; b=tbHL5UgjB0xpBQhJTOY+DCKE7bjrq2+nGIgaut3SJaOCuo1JqUL+pO6kGZ7NaJdtUg RLDNvBTZOA3Om/5yNgQHC9C0FyB661qYbCb4VTXleM2HjalcSEnIuO41lKfdg8r6TrRl a+MglfA28erNAlbz1fvkS72gzsVOwZc4xZFjEgUENQoauRiergYXOF6nuw2GUD1vHJ4Z OLYtqTg4QTqns35ZJyPc0UpAwrX+bWXXbykzbDvylT69xdnmS4qH72aQtGARD2mI1tKO UT+AM40t5tLw+CLCvu3eBF1f7sw+anbbp+rbO27AeFTjYBiJ3lQaSkcQdCWNxVcgAy/D HvMw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :subject:date:from:dkim-signature; bh=iR96KjiNOLwJsrZW9YjWEMZZO1SB3q3Gyovy8VvF6lw=; fh=BhgptoEUHHIBEHgXVGG0kPFbmqQnYZSFfCxI4r2nG+I=; b=aAK0uMEF21S1d7PJ5m6HCqmR8A6MuzLBns2wNpiOzoBzLIarN9g7u3kritzFrIw5hQ gUanZdpaUQkkZxI3Qa6GSrrvWS8IhUB0Ub42MCInQXiXrw/W/jYNiVBw7cySFO5a5tGC PadoD2VWixO2VNVeU589P+j+auk4/EbdU7nKBvbF9Bz+lhdgAQ8SzgpU+kGmsFBjRLfi tTDFgU0SI6cgjfp5NvdCAebBv89pYt1FSp0BYpf7gBDqKUppCyXwFOa9aDZQP4II5ZXO M762+IcgM0ewBgQBA8NTG6TkPCT7bxoklc8sy+Z5kMCBkDqpo6p5D1nakBrjiGwr7ND7 L5GQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=l6k25LwR; spf=pass (google.com: domain of linux-kernel+bounces-26453-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-26453-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id p24-20020a170902b09800b001d5af6a0736si6550486plr.451.2024.01.15.12.03.01 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 15 Jan 2024 12:03:02 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-26453-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=l6k25LwR; spf=pass (google.com: domain of linux-kernel+bounces-26453-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-26453-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com 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 55B3F2837D6 for ; Mon, 15 Jan 2024 20:03:01 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B6F6F199DA; Mon, 15 Jan 2024 20:02:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="l6k25LwR" Received: from mail-wm1-f42.google.com (mail-wm1-f42.google.com [209.85.128.42]) (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 6C63019473; Mon, 15 Jan 2024 20:02:29 +0000 (UTC) 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 Received: by mail-wm1-f42.google.com with SMTP id 5b1f17b1804b1-40e60e137aaso44219665e9.0; Mon, 15 Jan 2024 12:02:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1705348948; x=1705953748; 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=iR96KjiNOLwJsrZW9YjWEMZZO1SB3q3Gyovy8VvF6lw=; b=l6k25LwRsDbc/vTBHa64vziXoka4xMWMWp9af+Ki511/xRyMLjGzRfoqHisj3plqyi AZVxpPSDTzuwh4fQBFfByoPS3k0HA0o1PFV91MO4/tnkNZml75j+exbU20PP+KiOzBUO iT/yF4Xdmc2Ds3PFM7o7uAf6LombgsVQYs1C02B0xFWJXhBjv1LHaEbo63v1w8PrHbkG tBUPJQwmLfxkjQgmUVQNyHoHVn9e+VhTcheog+mvt7hkJF5+0UNmWuye0thLIOoT5J5a epJCgKQLt0R74hciB506JwCdQrHJmfmZJaZNFNKMmwy9YH2QAV6vcqmh3RefJULQ8MiY 6R5w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1705348948; x=1705953748; 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=iR96KjiNOLwJsrZW9YjWEMZZO1SB3q3Gyovy8VvF6lw=; b=qoXNERLWhCm+XKrs8FSrv/wdXmieL69s1u1C/JJMQFrpF8m4pbLfYOVO3vokKSenPO p1gW0SNulODWo+fCC7msM1UKZX/dUCvNtSH9ZjiqnXoU4kiaRJuYE4ThOaF9X/4JbZe7 xuBiwI+M/pQeneF5puzfOVcCILhFvXGT1GQmBNFa/mA+Q8+7rafLtO0nL1VlJgWAcDpy 9pfIiuhEAixg9UtK3HXWheS0mjjfU90EchD779GVMtOT1TsQL8czZ83y8L42OATcei+d HdTQvOaEnJwDerll/FlriPUCRgYw/3bpXLiOWeDDEB4Xm25fftM9Z+pLZ+A2QP25/a2h emUQ== X-Gm-Message-State: AOJu0YygzgW7rHbqZXC/HEJ8rSBmvFymayJcneBRyDtXs+twTBtrVJQ+ 3WndvQidpMWuo/08fCDf/ek= X-Received: by 2002:a05:600c:2112:b0:40e:7f2c:9dbd with SMTP id u18-20020a05600c211200b0040e7f2c9dbdmr681930wml.13.1705348947693; Mon, 15 Jan 2024 12:02:27 -0800 (PST) Received: from [127.0.1.1] (2a02-8389-41cf-e200-bf32-c470-1874-c1ad.cable.dynamic.v6.surfer.at. [2a02:8389:41cf:e200:bf32:c470:1874:c1ad]) by smtp.gmail.com with ESMTPSA id m26-20020a7bca5a000000b0040e54381a85sm16377924wml.26.2024.01.15.12.02.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 15 Jan 2024 12:02:27 -0800 (PST) From: Javier Carrasco Date: Mon, 15 Jan 2024 21:02:22 +0100 Subject: [PATCH v5 2/5] hwmon: (core) Add support for humidity min/max alarm Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20240115-topic-chipcap2-v5-2-0cc7a15aeece@gmail.com> References: <20240115-topic-chipcap2-v5-0-0cc7a15aeece@gmail.com> In-Reply-To: <20240115-topic-chipcap2-v5-0-0cc7a15aeece@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-4e032 X-Developer-Signature: v=1; a=ed25519-sha256; t=1705348943; l=2225; i=javier.carrasco.cruz@gmail.com; s=20230509; h=from:subject:message-id; bh=re14X9c0E+VBxIxbVskjRDUjU7zOxmCOyQzwnK834Ds=; b=dd4rGLkjd9y828kruYsv6h+aliJTL24L+Inb5681K1+rd0C9CwKjEcELJmYKjdC+FqbmPrSZ9 vnIHAL2Mp//C+zhZvr07AomwvL67uM1HRUVizAy/oU2gAmnKh24ZmJK 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..7f92984c37d9 100644 --- a/drivers/hwmon/hwmon.c +++ b/drivers/hwmon/hwmon.c @@ -579,8 +579,10 @@ static const char * const hwmon_humidity_attr_templates[] = { [hwmon_humidity_input] = "humidity%d_input", [hwmon_humidity_label] = "humidity%d_label", [hwmon_humidity_min] = "humidity%d_min", + [hwmon_humidity_min_alarm] = "humidity%d_min_alarm", [hwmon_humidity_min_hyst] = "humidity%d_min_hyst", [hwmon_humidity_max] = "humidity%d_max", + [hwmon_humidity_max_alarm] = "humidity%d_max_alarm", [hwmon_humidity_max_hyst] = "humidity%d_max_hyst", [hwmon_humidity_alarm] = "humidity%d_alarm", [hwmon_humidity_fault] = "humidity%d_fault", diff --git a/include/linux/hwmon.h b/include/linux/hwmon.h index 8cd6a6b33593..154de35e34ac 100644 --- a/include/linux/hwmon.h +++ b/include/linux/hwmon.h @@ -286,8 +286,10 @@ enum hwmon_humidity_attributes { hwmon_humidity_input, hwmon_humidity_label, hwmon_humidity_min, + hwmon_humidity_min_alarm, hwmon_humidity_min_hyst, hwmon_humidity_max, + hwmon_humidity_max_alarm, hwmon_humidity_max_hyst, hwmon_humidity_alarm, hwmon_humidity_fault, @@ -299,8 +301,10 @@ enum hwmon_humidity_attributes { #define HWMON_H_INPUT BIT(hwmon_humidity_input) #define HWMON_H_LABEL BIT(hwmon_humidity_label) #define HWMON_H_MIN BIT(hwmon_humidity_min) +#define HWMON_H_MIN_ALARM BIT(hwmon_humidity_min_alarm) #define HWMON_H_MIN_HYST BIT(hwmon_humidity_min_hyst) #define HWMON_H_MAX BIT(hwmon_humidity_max) +#define HWMON_H_MAX_ALARM BIT(hwmon_humidity_max_alarm) #define HWMON_H_MAX_HYST BIT(hwmon_humidity_max_hyst) #define HWMON_H_ALARM BIT(hwmon_humidity_alarm) #define HWMON_H_FAULT BIT(hwmon_humidity_fault) -- 2.39.2