From patchwork Wed Nov 8 12:29:57 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Javier Carrasco X-Patchwork-Id: 742386 Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net [23.128.96.19]) (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 60196179A2; Wed, 8 Nov 2023 12:30:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="Lr1mXzwr" Received: from mail-ed1-x531.google.com (mail-ed1-x531.google.com [IPv6:2a00:1450:4864:20::531]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B7A9A1BF1; Wed, 8 Nov 2023 04:30:03 -0800 (PST) Received: by mail-ed1-x531.google.com with SMTP id 4fb4d7f45d1cf-53e70b0a218so11608849a12.2; Wed, 08 Nov 2023 04:30:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1699446602; x=1700051402; 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=Lr1mXzwrttvYlTnAHmZHkbg5XjahfqOj06VcnXwCK67Tcgi/lwNbm3KCjkGAHyjRxr V2bOHf1TcOjeQVNZ8OmiecWbc9LESho7HJVVd08CMu1dbg7f4Q9u4yMZ53F7sdPVV/XA eAyhAdEqTSJUddQlo+voUJ3AYcHj8PAL9WjbyRVy18722grg0RAJFKDk4ywxoNQoRRz3 QzxWTNVFNKIsPgsrIsUOMcwrrh3A8Z8esfdXii4Ae0zb5Lseco8+o8sj40KbD3TaulgZ tazJTxQosykmwePwfMMhb1lDBSQ/uO8s66JjQvGQtwMRe6O1lvMlqkoZMS5FffO9Hy+c +ZQQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1699446602; x=1700051402; 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=LYQB/hNNlsL+4Plu3n6rjRJxVxyEglS12IKW04k8hGkJxsuhh/njX3irlnkIPZ/lOG 1zdFOt2EM7AbVPMzASbqAq3k6K6M+g77DLjLkcsZr6lfHU9aMGUQ8FX2VrZ4LIPZES5P im0x8FOagEmfFFV5Y6l7AMatgMM9jzHe85eML88BvF3O+OWcoiChaaVdHMIWbvB+7mLg 7ZLR4A1uhrR4AY4kc9fFbonyjp2VTpS+eTDqrCAO8TkmxhhiudZJcGtrhsGWNN/9hP30 pnZj53jFIDDmqEouP+R8znerh21FC2wTq/9s6b/vUxlHhXACHYl40gD8j1rp0JWAUZLt 9EvA== X-Gm-Message-State: AOJu0YwYtYuT/C97DUplHqK1Xiord7iFBDRzyq0w47/xkx6tY+DqaDtF gL0L7mTiJz86gHHqIeux9dY= X-Google-Smtp-Source: AGHT+IEb5uaMdGI23U/402CS1xMTSfToMSu79Qut4cMazO6e9qWd3C9Cnrt8f0NEcl449KJ3OPtiGA== X-Received: by 2002:a17:907:268c:b0:9e1:a5eb:8cb4 with SMTP id bn12-20020a170907268c00b009e1a5eb8cb4mr1361890ejc.58.1699446602184; Wed, 08 Nov 2023 04:30:02 -0800 (PST) Received: from [127.0.1.1] (2a02-8389-41cf-e200-8f74-d45a-3701-05b6.cable.dynamic.v6.surfer.at. [2a02:8389:41cf:e200:8f74:d45a:3701:5b6]) by smtp.gmail.com with ESMTPSA id n22-20020a170906841600b009b27d4153c0sm971065ejx.178.2023.11.08.04.30.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 Nov 2023 04:30:01 -0800 (PST) From: Javier Carrasco Date: Wed, 08 Nov 2023 13:29:57 +0100 Subject: [PATCH 2/4] 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: <20231020-topic-chipcap2-v1-2-087e21d4b1ed@gmail.com> References: <20231020-topic-chipcap2-v1-0-087e21d4b1ed@gmail.com> In-Reply-To: <20231020-topic-chipcap2-v1-0-087e21d4b1ed@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.12.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1699446596; l=2225; i=javier.carrasco.cruz@gmail.com; s=20230509; h=from:subject:message-id; bh=re14X9c0E+VBxIxbVskjRDUjU7zOxmCOyQzwnK834Ds=; b=ndEoDmRPmkYDB4bzzLjVU7GpEu5DIYUOvFhO75jwlsx4yolgMUrURmTX050kx3358Cfsf+AcY auStvpX8SNmAxGJP1RUFwWKuk1SYIhuhbPok33tMeYWLtYpgdHTdDq5 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)