mprls0025pa.c (2612e3bbc0386368a850140a6c9b990cd496a5ec) | mprls0025pa.c (330e860a08a0e9a1094b8e8b5eca507ada17d462) |
---|---|
1// SPDX-License-Identifier: GPL-2.0-or-later 2/* 3 * MPRLS0025PA - Honeywell MicroPressure pressure sensor series driver 4 * 5 * Copyright (c) Andreas Klinger <ak@it-klinger.de> 6 * 7 * Data sheet: 8 * https://prod-edam.honeywell.com/content/dam/honeywell-edam/sps/siot/en-us/ --- 309 unchanged lines hidden (view full) --- 318 319static int mpr_probe(struct i2c_client *client) 320{ 321 int ret; 322 struct mpr_data *data; 323 struct iio_dev *indio_dev; 324 struct device *dev = &client->dev; 325 s64 scale, offset; | 1// SPDX-License-Identifier: GPL-2.0-or-later 2/* 3 * MPRLS0025PA - Honeywell MicroPressure pressure sensor series driver 4 * 5 * Copyright (c) Andreas Klinger <ak@it-klinger.de> 6 * 7 * Data sheet: 8 * https://prod-edam.honeywell.com/content/dam/honeywell-edam/sps/siot/en-us/ --- 309 unchanged lines hidden (view full) --- 318 319static int mpr_probe(struct i2c_client *client) 320{ 321 int ret; 322 struct mpr_data *data; 323 struct iio_dev *indio_dev; 324 struct device *dev = &client->dev; 325 s64 scale, offset; |
326 u32 func; |
|
326 327 if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_READ_BYTE)) 328 return dev_err_probe(dev, -EOPNOTSUPP, 329 "I2C functionality not supported\n"); 330 331 indio_dev = devm_iio_device_alloc(dev, sizeof(*data)); 332 if (!indio_dev) 333 return dev_err_probe(dev, -ENOMEM, "couldn't get iio_dev\n"); --- 23 unchanged lines hidden (view full) --- 357 return dev_err_probe(dev, ret, 358 "honeywell,pmin-pascal could not be read\n"); 359 ret = device_property_read_u32(dev, "honeywell,pmax-pascal", 360 &data->pmax); 361 if (ret) 362 return dev_err_probe(dev, ret, 363 "honeywell,pmax-pascal could not be read\n"); 364 ret = device_property_read_u32(dev, | 327 328 if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_READ_BYTE)) 329 return dev_err_probe(dev, -EOPNOTSUPP, 330 "I2C functionality not supported\n"); 331 332 indio_dev = devm_iio_device_alloc(dev, sizeof(*data)); 333 if (!indio_dev) 334 return dev_err_probe(dev, -ENOMEM, "couldn't get iio_dev\n"); --- 23 unchanged lines hidden (view full) --- 358 return dev_err_probe(dev, ret, 359 "honeywell,pmin-pascal could not be read\n"); 360 ret = device_property_read_u32(dev, "honeywell,pmax-pascal", 361 &data->pmax); 362 if (ret) 363 return dev_err_probe(dev, ret, 364 "honeywell,pmax-pascal could not be read\n"); 365 ret = device_property_read_u32(dev, |
365 "honeywell,transfer-function", &data->function); | 366 "honeywell,transfer-function", &func); |
366 if (ret) 367 return dev_err_probe(dev, ret, 368 "honeywell,transfer-function could not be read\n"); | 367 if (ret) 368 return dev_err_probe(dev, ret, 369 "honeywell,transfer-function could not be read\n"); |
370 data->function = func - 1; |
|
369 if (data->function > MPR_FUNCTION_C) 370 return dev_err_probe(dev, -EINVAL, 371 "honeywell,transfer-function %d invalid\n", 372 data->function); 373 } else { 374 /* when loaded as i2c device we need to use default values */ 375 dev_notice(dev, "firmware node not found; using defaults\n"); 376 data->pmin = 0; --- 74 unchanged lines hidden --- | 371 if (data->function > MPR_FUNCTION_C) 372 return dev_err_probe(dev, -EINVAL, 373 "honeywell,transfer-function %d invalid\n", 374 data->function); 375 } else { 376 /* when loaded as i2c device we need to use default values */ 377 dev_notice(dev, "firmware node not found; using defaults\n"); 378 data->pmin = 0; --- 74 unchanged lines hidden --- |