diff mbox

[RFC,1/2] hwmon: Add support for power min, lcrit, min_alarm and lcrit_alarm

Message ID 1530218475-4369-2-git-send-email-andrew@lunn.ch (mailing list archive)
State Changes Requested
Headers show

Commit Message

Andrew Lunn June 28, 2018, 8:41 p.m. UTC
Some sensors support reporting minimal and lower critical power, as
well as alarms when these thresholds are reached. Add support for
these attributes to the hwmon core.

Signed-off-by: Andrew Lunn <andrew@lunn.ch>
---
 drivers/hwmon/hwmon.c | 4 ++++
 include/linux/hwmon.h | 8 ++++++++
 2 files changed, 12 insertions(+)

Comments

Guenter Roeck June 28, 2018, 10:42 p.m. UTC | #1
On Thu, Jun 28, 2018 at 10:41:14PM +0200, Andrew Lunn wrote:
> Some sensors support reporting minimal and lower critical power, as
> well as alarms when these thresholds are reached. Add support for
> these attributes to the hwmon core.
> 
> Signed-off-by: Andrew Lunn <andrew@lunn.ch>

I am inclined to accept this patch immediately. I'll do that
in the next couple of days unless someone gives me a good reason
not to.

Guenter

> ---
>  drivers/hwmon/hwmon.c | 4 ++++
>  include/linux/hwmon.h | 8 ++++++++
>  2 files changed, 12 insertions(+)
> 
> diff --git a/drivers/hwmon/hwmon.c b/drivers/hwmon/hwmon.c
> index e88c01961948..33d51281272b 100644
> --- a/drivers/hwmon/hwmon.c
> +++ b/drivers/hwmon/hwmon.c
> @@ -394,12 +394,16 @@ static const char * const hwmon_power_attr_templates[] = {
>  	[hwmon_power_cap_hyst] = "power%d_cap_hyst",
>  	[hwmon_power_cap_max] = "power%d_cap_max",
>  	[hwmon_power_cap_min] = "power%d_cap_min",
> +	[hwmon_power_min] = "power%d_min",
>  	[hwmon_power_max] = "power%d_max",
> +	[hwmon_power_lcrit] = "power%d_lcrit",
>  	[hwmon_power_crit] = "power%d_crit",
>  	[hwmon_power_label] = "power%d_label",
>  	[hwmon_power_alarm] = "power%d_alarm",
>  	[hwmon_power_cap_alarm] = "power%d_cap_alarm",
> +	[hwmon_power_min_alarm] = "power%d_min_alarm",
>  	[hwmon_power_max_alarm] = "power%d_max_alarm",
> +	[hwmon_power_lcrit_alarm] = "power%d_lcrit_alarm",
>  	[hwmon_power_crit_alarm] = "power%d_crit_alarm",
>  };
>  
> diff --git a/include/linux/hwmon.h b/include/linux/hwmon.h
> index 1b74ad11a5a4..b217101ca76e 100644
> --- a/include/linux/hwmon.h
> +++ b/include/linux/hwmon.h
> @@ -188,12 +188,16 @@ enum hwmon_power_attributes {
>  	hwmon_power_cap_hyst,
>  	hwmon_power_cap_max,
>  	hwmon_power_cap_min,
> +	hwmon_power_min,
>  	hwmon_power_max,
>  	hwmon_power_crit,
> +	hwmon_power_lcrit,
>  	hwmon_power_label,
>  	hwmon_power_alarm,
>  	hwmon_power_cap_alarm,
> +	hwmon_power_min_alarm,
>  	hwmon_power_max_alarm,
> +	hwmon_power_lcrit_alarm,
>  	hwmon_power_crit_alarm,
>  };
>  
> @@ -214,12 +218,16 @@ enum hwmon_power_attributes {
>  #define HWMON_P_CAP_HYST		BIT(hwmon_power_cap_hyst)
>  #define HWMON_P_CAP_MAX			BIT(hwmon_power_cap_max)
>  #define HWMON_P_CAP_MIN			BIT(hwmon_power_cap_min)
> +#define HWMON_P_MIN			BIT(hwmon_power_min)
>  #define HWMON_P_MAX			BIT(hwmon_power_max)
> +#define HWMON_P_LCRIT			BIT(hwmon_power_lcrit)
>  #define HWMON_P_CRIT			BIT(hwmon_power_crit)
>  #define HWMON_P_LABEL			BIT(hwmon_power_label)
>  #define HWMON_P_ALARM			BIT(hwmon_power_alarm)
>  #define HWMON_P_CAP_ALARM		BIT(hwmon_power_cap_alarm)
> +#define HWMON_P_MIN_ALARM		BIT(hwmon_power_max_alarm)
>  #define HWMON_P_MAX_ALARM		BIT(hwmon_power_max_alarm)
> +#define HWMON_P_LCRIT_ALARM		BIT(hwmon_power_lcrit_alarm)
>  #define HWMON_P_CRIT_ALARM		BIT(hwmon_power_crit_alarm)
>  
>  enum hwmon_energy_attributes {
> -- 
> 2.18.0.rc2
> 
--
To unsubscribe from this list: send the line "unsubscribe linux-hwmon" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Andrew Lunn June 29, 2018, 7:21 a.m. UTC | #2
On Thu, Jun 28, 2018 at 03:42:36PM -0700, Guenter Roeck wrote:
> On Thu, Jun 28, 2018 at 10:41:14PM +0200, Andrew Lunn wrote:
> > Some sensors support reporting minimal and lower critical power, as
> > well as alarms when these thresholds are reached. Add support for
> > these attributes to the hwmon core.
> > 
> > Signed-off-by: Andrew Lunn <andrew@lunn.ch>
> 
> I am inclined to accept this patch immediately. I'll do that
> in the next couple of days unless someone gives me a good reason
> not to.

Hi Guenter

We need to watch out for merge dependencies. If you take it, you
probably should also take the second patch into your tree as
well. Otherwise, you need a stable branch DaveM can pull into net-next
if he takes the second patch.

I also have a patch to lm-sensors sensors, so it prints these
values. I will create a github pull request.

	Andrew
--
To unsubscribe from this list: send the line "unsubscribe linux-hwmon" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Guenter Roeck June 29, 2018, 5:12 p.m. UTC | #3
On Fri, Jun 29, 2018 at 09:21:56AM +0200, Andrew Lunn wrote:
> On Thu, Jun 28, 2018 at 03:42:36PM -0700, Guenter Roeck wrote:
> > On Thu, Jun 28, 2018 at 10:41:14PM +0200, Andrew Lunn wrote:
> > > Some sensors support reporting minimal and lower critical power, as
> > > well as alarms when these thresholds are reached. Add support for
> > > these attributes to the hwmon core.
> > > 
> > > Signed-off-by: Andrew Lunn <andrew@lunn.ch>
> > 
> > I am inclined to accept this patch immediately. I'll do that
> > in the next couple of days unless someone gives me a good reason
> > not to.
> 
> Hi Guenter
> 
> We need to watch out for merge dependencies. If you take it, you
> probably should also take the second patch into your tree as
> well. Otherwise, you need a stable branch DaveM can pull into net-next
> if he takes the second patch.
> 
Good point. I don't have anything queued for hwmon.c, so it should be ok
for the patch to go through networking. I'll Ack it when the time comes.

> I also have a patch to lm-sensors sensors, so it prints these
> values. I will create a github pull request.
> 
Excellent.

Thanks,
Guenter
--
To unsubscribe from this list: send the line "unsubscribe linux-hwmon" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/hwmon/hwmon.c b/drivers/hwmon/hwmon.c
index e88c01961948..33d51281272b 100644
--- a/drivers/hwmon/hwmon.c
+++ b/drivers/hwmon/hwmon.c
@@ -394,12 +394,16 @@  static const char * const hwmon_power_attr_templates[] = {
 	[hwmon_power_cap_hyst] = "power%d_cap_hyst",
 	[hwmon_power_cap_max] = "power%d_cap_max",
 	[hwmon_power_cap_min] = "power%d_cap_min",
+	[hwmon_power_min] = "power%d_min",
 	[hwmon_power_max] = "power%d_max",
+	[hwmon_power_lcrit] = "power%d_lcrit",
 	[hwmon_power_crit] = "power%d_crit",
 	[hwmon_power_label] = "power%d_label",
 	[hwmon_power_alarm] = "power%d_alarm",
 	[hwmon_power_cap_alarm] = "power%d_cap_alarm",
+	[hwmon_power_min_alarm] = "power%d_min_alarm",
 	[hwmon_power_max_alarm] = "power%d_max_alarm",
+	[hwmon_power_lcrit_alarm] = "power%d_lcrit_alarm",
 	[hwmon_power_crit_alarm] = "power%d_crit_alarm",
 };
 
diff --git a/include/linux/hwmon.h b/include/linux/hwmon.h
index 1b74ad11a5a4..b217101ca76e 100644
--- a/include/linux/hwmon.h
+++ b/include/linux/hwmon.h
@@ -188,12 +188,16 @@  enum hwmon_power_attributes {
 	hwmon_power_cap_hyst,
 	hwmon_power_cap_max,
 	hwmon_power_cap_min,
+	hwmon_power_min,
 	hwmon_power_max,
 	hwmon_power_crit,
+	hwmon_power_lcrit,
 	hwmon_power_label,
 	hwmon_power_alarm,
 	hwmon_power_cap_alarm,
+	hwmon_power_min_alarm,
 	hwmon_power_max_alarm,
+	hwmon_power_lcrit_alarm,
 	hwmon_power_crit_alarm,
 };
 
@@ -214,12 +218,16 @@  enum hwmon_power_attributes {
 #define HWMON_P_CAP_HYST		BIT(hwmon_power_cap_hyst)
 #define HWMON_P_CAP_MAX			BIT(hwmon_power_cap_max)
 #define HWMON_P_CAP_MIN			BIT(hwmon_power_cap_min)
+#define HWMON_P_MIN			BIT(hwmon_power_min)
 #define HWMON_P_MAX			BIT(hwmon_power_max)
+#define HWMON_P_LCRIT			BIT(hwmon_power_lcrit)
 #define HWMON_P_CRIT			BIT(hwmon_power_crit)
 #define HWMON_P_LABEL			BIT(hwmon_power_label)
 #define HWMON_P_ALARM			BIT(hwmon_power_alarm)
 #define HWMON_P_CAP_ALARM		BIT(hwmon_power_cap_alarm)
+#define HWMON_P_MIN_ALARM		BIT(hwmon_power_max_alarm)
 #define HWMON_P_MAX_ALARM		BIT(hwmon_power_max_alarm)
+#define HWMON_P_LCRIT_ALARM		BIT(hwmon_power_lcrit_alarm)
 #define HWMON_P_CRIT_ALARM		BIT(hwmon_power_crit_alarm)
 
 enum hwmon_energy_attributes {