diff mbox series

[v6,2/5] hwmon: (core) Add support for humidity min/max alarm

Message ID 20240130-topic-chipcap2-v6-2-260bea05cf9b@gmail.com (mailing list archive)
State Accepted
Headers show
Series hwmon: Add support for Amphenol ChipCap 2 | expand

Commit Message

Javier Carrasco Jan. 30, 2024, 9:06 p.m. UTC
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 <javier.carrasco.cruz@gmail.com>
---
 drivers/hwmon/hwmon.c | 2 ++
 include/linux/hwmon.h | 4 ++++
 2 files changed, 6 insertions(+)

Comments

Guenter Roeck Feb. 2, 2024, 6:55 p.m. UTC | #1
On Tue, Jan 30, 2024 at 10:06:45PM +0100, Javier Carrasco wrote:
> 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 <javier.carrasco.cruz@gmail.com>

Applied.

Thanks,
Guenter

> ---
>  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,
diff mbox series

Patch

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,