Commit 5229f102 authored by Crt Mori's avatar Crt Mori Committed by Greg Kroah-Hartman

iio: temperature: mlx90632 Relax the compatibility check

commit 389fc70b upstream.

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: default avatarCrt Mori <cmo@melexis.com>
Cc: <Stable@vger.kernel.org>
Signed-off-by: default avatarJonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 0a9be6a8
...@@ -81,6 +81,8 @@ ...@@ -81,6 +81,8 @@
/* Magic constants */ /* Magic constants */
#define MLX90632_ID_MEDICAL 0x0105 /* EEPROM DSPv5 Medical device id */ #define MLX90632_ID_MEDICAL 0x0105 /* EEPROM DSPv5 Medical device id */
#define MLX90632_ID_CONSUMER 0x0205 /* EEPROM DSPv5 Consumer device id */ #define MLX90632_ID_CONSUMER 0x0205 /* EEPROM DSPv5 Consumer device id */
#define MLX90632_DSP_VERSION 5 /* DSP version */
#define MLX90632_DSP_MASK GENMASK(7, 0) /* DSP version in EE_VERSION */
#define MLX90632_RESET_CMD 0x0006 /* Reset sensor (address or global) */ #define MLX90632_RESET_CMD 0x0006 /* Reset sensor (address or global) */
#define MLX90632_REF_12 12LL /**< ResCtrlRef value of Ch 1 or Ch 2 */ #define MLX90632_REF_12 12LL /**< ResCtrlRef value of Ch 1 or Ch 2 */
#define MLX90632_REF_3 12LL /**< ResCtrlRef value of Channel 3 */ #define MLX90632_REF_3 12LL /**< ResCtrlRef value of Channel 3 */
...@@ -667,10 +669,13 @@ static int mlx90632_probe(struct i2c_client *client, ...@@ -667,10 +669,13 @@ static int mlx90632_probe(struct i2c_client *client,
} else if (read == MLX90632_ID_CONSUMER) { } else if (read == MLX90632_ID_CONSUMER) {
dev_dbg(&client->dev, dev_dbg(&client->dev,
"Detected Consumer EEPROM calibration %x\n", read); "Detected Consumer EEPROM calibration %x\n", read);
} else if ((read & MLX90632_DSP_MASK) == MLX90632_DSP_VERSION) {
dev_dbg(&client->dev,
"Detected Unknown EEPROM calibration %x\n", read);
} else { } else {
dev_err(&client->dev, dev_err(&client->dev,
"EEPROM version mismatch %x (expected %x or %x)\n", "Wrong DSP version %x (expected %x)\n",
read, MLX90632_ID_CONSUMER, MLX90632_ID_MEDICAL); read, MLX90632_DSP_VERSION);
return -EPROTONOSUPPORT; return -EPROTONOSUPPORT;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment