Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

iio: temperature: mlx90632 Relax the compatibility check

Register EE_VERSION contains mixture of calibration information and DSP
version. So far, because calibrations were definite, the driver
compatibility depended on whole contents, but in the newer production
process the calibration part changes. Because of that, value in EE_VERSION
will be changed and to avoid that calibration value is same as DSP version
the MSB in calibration part was fixed to 1.
That means existing calibrations (medical and consumer) will now have
hex values (bits 8 to 15) of 83 and 84 respectively. Driver compatibility
should be based only on DSP version part of the EE_VERSION (bits 0 to 7)
register.

Signed-off-by: Crt Mori <cmo@melexis.com>
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>

authored by

Crt Mori and committed by
Jonathan Cameron
389fc70b bce0d57d

+7 -2
+7 -2
drivers/iio/temperature/mlx90632.c
··· 81 81 /* Magic constants */ 82 82 #define MLX90632_ID_MEDICAL 0x0105 /* EEPROM DSPv5 Medical device id */ 83 83 #define MLX90632_ID_CONSUMER 0x0205 /* EEPROM DSPv5 Consumer device id */ 84 + #define MLX90632_DSP_VERSION 5 /* DSP version */ 85 + #define MLX90632_DSP_MASK GENMASK(7, 0) /* DSP version in EE_VERSION */ 84 86 #define MLX90632_RESET_CMD 0x0006 /* Reset sensor (address or global) */ 85 87 #define MLX90632_REF_12 12LL /**< ResCtrlRef value of Ch 1 or Ch 2 */ 86 88 #define MLX90632_REF_3 12LL /**< ResCtrlRef value of Channel 3 */ ··· 669 667 } else if (read == MLX90632_ID_CONSUMER) { 670 668 dev_dbg(&client->dev, 671 669 "Detected Consumer EEPROM calibration %x\n", read); 670 + } else if ((read & MLX90632_DSP_MASK) == MLX90632_DSP_VERSION) { 671 + dev_dbg(&client->dev, 672 + "Detected Unknown EEPROM calibration %x\n", read); 672 673 } else { 673 674 dev_err(&client->dev, 674 - "EEPROM version mismatch %x (expected %x or %x)\n", 675 - read, MLX90632_ID_CONSUMER, MLX90632_ID_MEDICAL); 675 + "Wrong DSP version %x (expected %x)\n", 676 + read, MLX90632_DSP_VERSION); 676 677 return -EPROTONOSUPPORT; 677 678 } 678 679