Re: [PATCH v2 4/5] hwmon: pmbus: mpq8785: Implement VOUT feedback resistor divider ratio configuration

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 09/05/2025 08:51, Pawel Dembicki wrote:
> Implement support for setting the VOUT_SCALE_LOOP PMBus register
> based on an optional device tree property
> "mps,vout-fb-divider-ratio-permille".
> 
> This allows the driver to provide the correct VOUT value depending
> on the feedback voltage divider configuration for chips where the
> bootloader does not configure the VOUT_SCALE_LOOP register.
> 
> Signed-off-by: Pawel Dembicki <paweldembicki@xxxxxxxxx>
> 
> ---
> v2:
>   - rename property to mps,vout-fb-divider-ratio-permille
>   - add register value range checking
> ---
>  drivers/hwmon/pmbus/mpq8785.c | 21 +++++++++++++++++++++
>  1 file changed, 21 insertions(+)
> 
> diff --git a/drivers/hwmon/pmbus/mpq8785.c b/drivers/hwmon/pmbus/mpq8785.c
> index 34245d0d2125..1d0e7ac9daf4 100644
> --- a/drivers/hwmon/pmbus/mpq8785.c
> +++ b/drivers/hwmon/pmbus/mpq8785.c
> @@ -12,6 +12,13 @@
>  
>  enum chips { mpq8785, mpm82504, mpm3695, mpm3695_25 };
>  
> +static u16 voltage_scale_loop_max_val[] = {
> +	GENMASK(10, 0), /* mpq8785 */

Drop comments and index the table with enums instead. It makes clear and
obvious code. Code should be readable and self-documenting instead of
adding comments as an substitute of non-obvious code.

> +	GENMASK(9, 0), /* mpm82504 */
> +	GENMASK(9, 0), /* mpm3695 */
> +	GENMASK(11, 0), /* mpm3695_25 */
> +};
> +
Best regards,
Krzysztof




[Index of Archives]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux FS]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]     [Linux Resources]

  Powered by Linux