Re: [PATCH v3 5/5] iio: pressure: ms5637: Add per-variant compensation

Jonathan Cameron <[email protected]>
Newsgroups org.kernel.vger.linux-iio,org.kernel.vger.linux-kernel
Message-ID <20260821020122.1c2cc7dc@jic23-huawei>
On Thu, 20 Aug 2026 10:12:20 -0400
Louis Adamian <[email protected]> wrote:

> Previously, all sensors used the compensation for the MS5637-02BA. Add
> correct temperature compensation for MS5637-30BA, MS5803-01BA,
> MS5803-02BA, MS5803-05BA, MS5803-14BA, MS5803-30BA, MS5805, MS5837-02BA
> and MS5837-30BA.
> 
> The deprecated meas,ms5803, meas,ms5637 and meas,ms5837 compatibles
> resolve to the -02BA variants. This changes the values that meas,ms5803
> and meas,ms5837 report.
> 
> meas,ms5805 now uses its own constants, correcting its readings. MS8607
> gets its own constants struct. The values match the MS5637-02BA ones it
> previously shared, so its readings are unchanged.
> 
> Signed-off-by: Louis Adamian <[email protected]>

For this one Sashiko raises a valid concern.  The ABI is changing for
those deprecated choices.  To avoid that will require a slightly 
annoying dance with extra copies of the data to keep the old name.

One other question below.

> ---
>  drivers/iio/pressure/ms5637.c | 376 ++++++++++++++++++++++++++++++++--
>  1 file changed, 360 insertions(+), 16 deletions(-)
> 
> diff --git a/drivers/iio/pressure/ms5637.c b/drivers/iio/pressure/ms5637.c
> index 359f3a8e79b2..81b87b79e011 100644
> --- a/drivers/iio/pressure/ms5637.c
> +++ b/drivers/iio/pressure/ms5637.c


> +/*
> + * MS5805-02BA01 compensation constants
> + * Datasheet: https://www.te.com/commerce/DocumentDelivery/DDEController?Action=srchrtrv&DocNm=MS5805-02BA01&DocType=Data%20Sheet&DocLang=English&DocFormat=pdf&PartCntxt=MS580502BA01-50
> + * Pages: 8-9
> + * Sections: Pressure and Temperature Calculation, Second Order Temperature Compensation
> + */
> +static const struct ms_tp_comp_consts ms5805_consts = {
> +	.press_scale = 1000,
> +	.high_t2_multiplier = 0,
> +	.high_t2_shift = 0,
> +	.high_off2_multiplier = 0,
> +	.high_off2_shift = 0,
> +	.low_t2_multiplier = 11,
> +	.low_t2_shift = 35,
> +	.low_off2_multiplier = 31,
> +	.low_off2_shift = 3,
> +	.low_sens2_multiplier = 63,
> +	.low_sens2_shift = 5,
> +	.vlow_off2_multiplier = 0,
> +	.vlow_sens2_multiplier = 0,
> +	.has_vhigh_temp = false,
> +	.off_t1_shift = 17,
> +	.off_shift = 6,
> +	.sens_t1_shift = 16,
> +	.sens_shift = 7,
> +	.press_sens_shift = 21,
> +	.press_shift = 15,
>  };
>  
>  static const struct ms_tp_data ms5805_data = {
>  	.name = "ms5805",
>  	.hw = &ms5637_hw_data,
> -	.comp_consts = &ms5637_02_consts,
> +	.comp_consts = &ms5805_consts,

Is this change actually a fix?

> +};
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.