1
0
Fork 0

iio: vcnl4000: warn on incorrectly specified device id

We can detect incorrectly specified device id for some chips, so warn
user in that case.

Signed-off-by: Tomas Novotny <tomas@novotny.cz>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
hifive-unleashed-5.1
Tomas Novotny 2018-07-25 17:18:20 +02:00 committed by Jonathan Cameron
parent 50c50b975d
commit 58bf9ace8c
1 changed files with 13 additions and 1 deletions

View File

@ -84,8 +84,20 @@ static int vcnl4000_init(struct vcnl4000_data *data)
return ret;
prod_id = ret >> 4;
if (prod_id != VCNL4010_PROD_ID && prod_id != VCNL4000_PROD_ID)
switch (prod_id) {
case VCNL4000_PROD_ID:
if (data->id != VCNL4000)
dev_warn(&data->client->dev,
"wrong device id, use vcnl4000");
break;
case VCNL4010_PROD_ID:
if (data->id != VCNL4010)
dev_warn(&data->client->dev,
"wrong device id, use vcnl4010/4020");
break;
default:
return -ENODEV;
}
data->rev = ret & 0xf;
data->al_scale = 250000;