lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <135535d2-f400-4ca8-8362-526b47ae8362@cherry.de>
Date: Wed, 3 Jul 2024 17:28:35 +0200
From: Quentin Schulz <quentin.schulz@...rry.de>
To: Guenter Roeck <linux@...ck-us.net>, linux-hwmon@...r.kernel.org
Cc: linux-kernel@...r.kernel.org, Farouk Bouabid <farouk.bouabid@...rry.de>
Subject: Re: [PATCH v2 11/11] hwmon: (amc6821) Add support for pwm1_mode
 attribute

Hi Guenter,

On 7/1/24 11:23 PM, Guenter Roeck wrote:
> AMC6821 supports configuring if a fan is DC or PWM controlled.
> Add support for the pwm1_mode attribute to make it runtime configurable.
> 
> Signed-off-by: Guenter Roeck <linux@...ck-us.net>
> ---
> v2: New patch
> 
>   Documentation/hwmon/amc6821.rst |  1 +
>   drivers/hwmon/amc6821.c         | 16 +++++++++++++++-
>   2 files changed, 16 insertions(+), 1 deletion(-)
> 
> diff --git a/Documentation/hwmon/amc6821.rst b/Documentation/hwmon/amc6821.rst
> index 96e604c5ea8e..dbd544cd1160 100644
> --- a/Documentation/hwmon/amc6821.rst
> +++ b/Documentation/hwmon/amc6821.rst
> @@ -58,6 +58,7 @@ pwm1_enable		rw	regulator mode, 1=open loop, 2=fan controlled
>   				remote-sensor temperature,
>   				4=fan controlled by target rpm set with
>   				fan1_target attribute.
> +pwm1_mode		rw	Fan duty control mode (0=DC, 1=PWM)
>   pwm1_auto_channels_temp ro	1 if pwm_enable==2, 3 if pwm_enable==3
>   pwm1_auto_point1_pwm	ro	Hardwired to 0, shared for both
>   				temperature channels.
> diff --git a/drivers/hwmon/amc6821.c b/drivers/hwmon/amc6821.c
> index 5a3c089ae06f..98a45fe529e0 100644
> --- a/drivers/hwmon/amc6821.c
> +++ b/drivers/hwmon/amc6821.c
> @@ -317,6 +317,12 @@ static int amc6821_pwm_read(struct device *dev, u32 attr, long *val)
>   			break;
>   		}
>   		return 0;
> +	case hwmon_pwm_mode:
> +		err = regmap_read(regmap, AMC6821_REG_CONF2, &regval);
> +		if (err)
> +			return err;
> +		*val = !!(regval & AMC6821_CONF2_TACH_MODE);
> +		return 0;
>   	case hwmon_pwm_auto_channels_temp:
>   		err = regmap_read(regmap, AMC6821_REG_CONF1, &regval);
>   		if (err)
> @@ -372,6 +378,13 @@ static int amc6821_pwm_write(struct device *dev, u32 attr, long val)
>   		return regmap_update_bits(regmap, AMC6821_REG_CONF1,
>   					  AMC6821_CONF1_FDRC0 | AMC6821_CONF1_FDRC1,
>   					  mode);
> +	case hwmon_pwm_mode:
> +		if (val < 0 || val > 1)
> +			return -EINVAL;
> +		return regmap_update_bits(regmap, AMC6821_REG_CONF1,

Wrong register here, should be AMC6821_REG_CONF2.

Otherwise, looks good to me.

Cheers,
Quentin

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ