All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH hwmon-next 0/2] hwmon: (mlxreg-fan) Extend support for multiply PWM
@ 2021-09-26  5:35 Vadim Pasternak
  2021-09-26  5:35 ` [PATCH hwmon-next 1/2] hwmon: (mlxreg-fan) Modify PWM connectivity validation Vadim Pasternak
  2021-09-26  5:35 ` [PATCH hwmon-next 2/2] hwmon: (mlxreg-fan) Support distinctive names per different cooling devices Vadim Pasternak
  0 siblings, 2 replies; 5+ messages in thread
From: Vadim Pasternak @ 2021-09-26  5:35 UTC (permalink / raw)
  To: linux; +Cc: linux-hwmon, Vadim Pasternak

Patch set contains:
Patch #1: Change for PWM connectivity logic validation
Patch #2:Adding different names for cooling devices.

Vadim Pasternak (2):
  hwmon: (mlxreg-fan) Modify PWM connectivity validation
  hwmon: (mlxreg-fan) Support distinctive names per different cooling
    devices

 drivers/hwmon/mlxreg-fan.c | 22 +++++++++++++++++-----
 1 file changed, 17 insertions(+), 5 deletions(-)

-- 
2.20.1


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH hwmon-next 1/2] hwmon: (mlxreg-fan) Modify PWM connectivity validation
  2021-09-26  5:35 [PATCH hwmon-next 0/2] hwmon: (mlxreg-fan) Extend support for multiply PWM Vadim Pasternak
@ 2021-09-26  5:35 ` Vadim Pasternak
  2021-10-08 14:15   ` Guenter Roeck
  2021-09-26  5:35 ` [PATCH hwmon-next 2/2] hwmon: (mlxreg-fan) Support distinctive names per different cooling devices Vadim Pasternak
  1 sibling, 1 reply; 5+ messages in thread
From: Vadim Pasternak @ 2021-09-26  5:35 UTC (permalink / raw)
  To: linux; +Cc: linux-hwmon, Vadim Pasternak

Validate PWM connectivity only for additional PWM - "pwm1" is connected
on all systems, while "pwm2" - "pwm4" are optional. Validate
connectivity only for optional attributes by reading of related "pwm{n}"
registers - in case "pwm{n}" is not connected, register value is
supposed to be 0xff.

Signed-off-by: Vadim Pasternak <vadimp@nvidia.com>
---
 drivers/hwmon/mlxreg-fan.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/drivers/hwmon/mlxreg-fan.c b/drivers/hwmon/mlxreg-fan.c
index feab9ec6a6ca..8e5cd6991929 100644
--- a/drivers/hwmon/mlxreg-fan.c
+++ b/drivers/hwmon/mlxreg-fan.c
@@ -488,9 +488,14 @@ static int mlxreg_fan_config(struct mlxreg_fan *fan,
 				return -EINVAL;
 			}
 
-			err = mlxreg_pwm_connect_verify(fan, data);
-			if (err)
-				return err;
+			/* Validate if more then one PWM is connected. */
+			if (pwm_num) {
+				err = mlxreg_pwm_connect_verify(fan, data);
+				if (err < 0)
+					return err;
+				else if (!err)
+					continue;
+			}
 
 			fan->pwm[pwm_num].reg = data->reg;
 			fan->pwm[pwm_num].connected = true;
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH hwmon-next 2/2] hwmon: (mlxreg-fan) Support distinctive names per different cooling devices
  2021-09-26  5:35 [PATCH hwmon-next 0/2] hwmon: (mlxreg-fan) Extend support for multiply PWM Vadim Pasternak
  2021-09-26  5:35 ` [PATCH hwmon-next 1/2] hwmon: (mlxreg-fan) Modify PWM connectivity validation Vadim Pasternak
@ 2021-09-26  5:35 ` Vadim Pasternak
  2021-10-08 14:16   ` Guenter Roeck
  1 sibling, 1 reply; 5+ messages in thread
From: Vadim Pasternak @ 2021-09-26  5:35 UTC (permalink / raw)
  To: linux; +Cc: linux-hwmon, Vadim Pasternak

Provide different names for cooling devices registration to allow
binding each cooling devices to relevant thermal zone. Thus, specific
cooling device can be associated with related thermal sensor by setting
thermal cooling device type for example to "mlxreg_fan2" and passing
this type to thermal_zone_bind_cooling_device() through 'cdev->type'.

Signed-off-by: Vadim Pasternak <vadimp@nvidia.com>
---
 drivers/hwmon/mlxreg-fan.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/drivers/hwmon/mlxreg-fan.c b/drivers/hwmon/mlxreg-fan.c
index 8e5cd6991929..4a8becdb0d58 100644
--- a/drivers/hwmon/mlxreg-fan.c
+++ b/drivers/hwmon/mlxreg-fan.c
@@ -263,6 +263,13 @@ mlxreg_fan_is_visible(const void *data, enum hwmon_sensor_types type, u32 attr,
 	return 0;
 }
 
+static char *mlxreg_fan_name[] = {
+	"mlxreg_fan",
+	"mlxreg_fan1",
+	"mlxreg_fan2",
+	"mlxreg_fan3",
+};
+
 static const struct hwmon_channel_info *mlxreg_fan_hwmon_info[] = {
 	HWMON_CHANNEL_INFO(fan,
 			   HWMON_F_INPUT | HWMON_F_FAULT,
@@ -565,8 +572,8 @@ static int mlxreg_fan_cooling_config(struct device *dev, struct mlxreg_fan *fan)
 		if (!pwm->connected)
 			continue;
 		pwm->fan = fan;
-		pwm->cdev = devm_thermal_of_cooling_device_register(dev, NULL, "mlxreg_fan", pwm,
-								    &mlxreg_fan_cooling_ops);
+		pwm->cdev = devm_thermal_of_cooling_device_register(dev, NULL, mlxreg_fan_name[i],
+								    pwm, &mlxreg_fan_cooling_ops);
 		if (IS_ERR(pwm->cdev)) {
 			dev_err(dev, "Failed to register cooling device\n");
 			return PTR_ERR(pwm->cdev);
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH hwmon-next 1/2] hwmon: (mlxreg-fan) Modify PWM connectivity validation
  2021-09-26  5:35 ` [PATCH hwmon-next 1/2] hwmon: (mlxreg-fan) Modify PWM connectivity validation Vadim Pasternak
@ 2021-10-08 14:15   ` Guenter Roeck
  0 siblings, 0 replies; 5+ messages in thread
From: Guenter Roeck @ 2021-10-08 14:15 UTC (permalink / raw)
  To: Vadim Pasternak; +Cc: linux-hwmon

On Sun, Sep 26, 2021 at 08:35:40AM +0300, Vadim Pasternak wrote:
> Validate PWM connectivity only for additional PWM - "pwm1" is connected
> on all systems, while "pwm2" - "pwm4" are optional. Validate
> connectivity only for optional attributes by reading of related "pwm{n}"
> registers - in case "pwm{n}" is not connected, register value is
> supposed to be 0xff.
> 
> Signed-off-by: Vadim Pasternak <vadimp@nvidia.com>

Applied.

Thanks,
Guenter

> ---
>  drivers/hwmon/mlxreg-fan.c | 11 ++++++++---
>  1 file changed, 8 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/hwmon/mlxreg-fan.c b/drivers/hwmon/mlxreg-fan.c
> index feab9ec6a6ca..8e5cd6991929 100644
> --- a/drivers/hwmon/mlxreg-fan.c
> +++ b/drivers/hwmon/mlxreg-fan.c
> @@ -488,9 +488,14 @@ static int mlxreg_fan_config(struct mlxreg_fan *fan,
>  				return -EINVAL;
>  			}
>  
> -			err = mlxreg_pwm_connect_verify(fan, data);
> -			if (err)
> -				return err;
> +			/* Validate if more then one PWM is connected. */
> +			if (pwm_num) {
> +				err = mlxreg_pwm_connect_verify(fan, data);
> +				if (err < 0)
> +					return err;
> +				else if (!err)
> +					continue;
> +			}
>  
>  			fan->pwm[pwm_num].reg = data->reg;
>  			fan->pwm[pwm_num].connected = true;

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH hwmon-next 2/2] hwmon: (mlxreg-fan) Support distinctive names per different cooling devices
  2021-09-26  5:35 ` [PATCH hwmon-next 2/2] hwmon: (mlxreg-fan) Support distinctive names per different cooling devices Vadim Pasternak
@ 2021-10-08 14:16   ` Guenter Roeck
  0 siblings, 0 replies; 5+ messages in thread
From: Guenter Roeck @ 2021-10-08 14:16 UTC (permalink / raw)
  To: Vadim Pasternak; +Cc: linux-hwmon

On Sun, Sep 26, 2021 at 08:35:41AM +0300, Vadim Pasternak wrote:
> Provide different names for cooling devices registration to allow
> binding each cooling devices to relevant thermal zone. Thus, specific
> cooling device can be associated with related thermal sensor by setting
> thermal cooling device type for example to "mlxreg_fan2" and passing
> this type to thermal_zone_bind_cooling_device() through 'cdev->type'.
> 
> Signed-off-by: Vadim Pasternak <vadimp@nvidia.com>

Applied.

Thanks,
Guenter

> ---
>  drivers/hwmon/mlxreg-fan.c | 11 +++++++++--
>  1 file changed, 9 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/hwmon/mlxreg-fan.c b/drivers/hwmon/mlxreg-fan.c
> index 8e5cd6991929..4a8becdb0d58 100644
> --- a/drivers/hwmon/mlxreg-fan.c
> +++ b/drivers/hwmon/mlxreg-fan.c
> @@ -263,6 +263,13 @@ mlxreg_fan_is_visible(const void *data, enum hwmon_sensor_types type, u32 attr,
>  	return 0;
>  }
>  
> +static char *mlxreg_fan_name[] = {
> +	"mlxreg_fan",
> +	"mlxreg_fan1",
> +	"mlxreg_fan2",
> +	"mlxreg_fan3",
> +};
> +
>  static const struct hwmon_channel_info *mlxreg_fan_hwmon_info[] = {
>  	HWMON_CHANNEL_INFO(fan,
>  			   HWMON_F_INPUT | HWMON_F_FAULT,
> @@ -565,8 +572,8 @@ static int mlxreg_fan_cooling_config(struct device *dev, struct mlxreg_fan *fan)
>  		if (!pwm->connected)
>  			continue;
>  		pwm->fan = fan;
> -		pwm->cdev = devm_thermal_of_cooling_device_register(dev, NULL, "mlxreg_fan", pwm,
> -								    &mlxreg_fan_cooling_ops);
> +		pwm->cdev = devm_thermal_of_cooling_device_register(dev, NULL, mlxreg_fan_name[i],
> +								    pwm, &mlxreg_fan_cooling_ops);
>  		if (IS_ERR(pwm->cdev)) {
>  			dev_err(dev, "Failed to register cooling device\n");
>  			return PTR_ERR(pwm->cdev);

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2021-10-08 14:16 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-26  5:35 [PATCH hwmon-next 0/2] hwmon: (mlxreg-fan) Extend support for multiply PWM Vadim Pasternak
2021-09-26  5:35 ` [PATCH hwmon-next 1/2] hwmon: (mlxreg-fan) Modify PWM connectivity validation Vadim Pasternak
2021-10-08 14:15   ` Guenter Roeck
2021-09-26  5:35 ` [PATCH hwmon-next 2/2] hwmon: (mlxreg-fan) Support distinctive names per different cooling devices Vadim Pasternak
2021-10-08 14:16   ` Guenter Roeck

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.