Re: [PATCH v3 15/19] hwmon: (mr75203) add support for series 6 temperature equation

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

 



On Tue, Aug 30, 2022 at 07:22:08PM +0000, Eliav Farber wrote:
> The current equation used in code is aligned to series 5:
> T = G + H * (n / cal5 - 0.5) + J * F
> Where:
> G = 60, H = 200, cal5 = 4094, J = -0.1, F = frequency clock in MHz
> 
> Series 6 has a slightly different equation:
> T = G + H * (n / cal5 - 0.5)
> and a different set of coefficients:
> G = 57.4, H = 249.4, cal5 = 4096
> 
> This change supports equation and coefficients for both series.
> (for series 6, J is set to 0).
> 
> The series is determined according to “ts-series” property in device
> tree.
> If absent, series 5 is assumed to be the default.

...

> -#define PVT_H_CONST		200000
> -#define PVT_G_CONST		60000
> -#define PVT_J_CONST		-100
> -#define PVT_CAL5_CONST		4094

You just introduced them patch before. Please, avoid ping-pong style in
the same series.

...

> +	ret = of_property_read_u32(np, "moortec,ts-series", &series);

of_ ?!

Be consistent. Either you use OF everywhere, or device property APIs.

...

> +	if (ret)
> +		series = TEMPERATURE_SENSOR_SERIES_5;
> +
> +	if (series == TEMPERATURE_SENSOR_SERIES_5) {
> +		ts_coeff->h = PVT_SERIES5_H_CONST;
> +		ts_coeff->g = PVT_SERIES5_G_CONST;
> +		ts_coeff->j = PVT_SERIES5_J_CONST;
> +		ts_coeff->cal5 = PVT_SERIES5_CAL5_CONST;
> +	} else if (series == TEMPERATURE_SENSOR_SERIES_6) {
> +		ts_coeff->h = PVT_SERIES6_H_CONST;
> +		ts_coeff->g = PVT_SERIES6_G_CONST;
> +		ts_coeff->j = PVT_SERIES6_J_CONST;
> +		ts_coeff->cal5 = PVT_SERIES6_CAL5_CONST;
> +	} else {
> +		dev_err(dev, "invalid temperature sensor series (%u)\n",
> +			series);
> +		return -EINVAL;
> +	}

switch-case?

-- 
With Best Regards,
Andy Shevchenko





[Index of Archives]     [LM Sensors]     [Linux Sound]     [ALSA Users]     [ALSA Devel]     [Linux Audio Users]     [Linux Media]     [Kernel]     [Gimp]     [Yosemite News]     [Linux Media]

  Powered by Linux