hdc100x.c (c13aca79ff3c4af5fd31a5b2743a90eba6e36a26) | hdc100x.c (23f1ce3c08aad743cd828ca5a36946f043ecf0f1) |
---|---|
1// SPDX-License-Identifier: GPL-2.0+ 2/* 3 * hdc100x.c - Support for the TI HDC100x temperature + humidity sensors 4 * 5 * Copyright (C) 2015, 2018 6 * Author: Matt Ranostay <matt.ranostay@konsulko.com> 7 * 8 * Datasheets: --- 371 unchanged lines hidden (view full) --- 380 indio_dev->num_channels = ARRAY_SIZE(hdc100x_channels); 381 indio_dev->available_scan_masks = hdc100x_scan_masks; 382 383 /* be sure we are in a known state */ 384 hdc100x_set_it_time(data, 0, hdc100x_int_time[0][0]); 385 hdc100x_set_it_time(data, 1, hdc100x_int_time[1][0]); 386 hdc100x_update_config(data, HDC100X_REG_CONFIG_ACQ_MODE, 0); 387 | 1// SPDX-License-Identifier: GPL-2.0+ 2/* 3 * hdc100x.c - Support for the TI HDC100x temperature + humidity sensors 4 * 5 * Copyright (C) 2015, 2018 6 * Author: Matt Ranostay <matt.ranostay@konsulko.com> 7 * 8 * Datasheets: --- 371 unchanged lines hidden (view full) --- 380 indio_dev->num_channels = ARRAY_SIZE(hdc100x_channels); 381 indio_dev->available_scan_masks = hdc100x_scan_masks; 382 383 /* be sure we are in a known state */ 384 hdc100x_set_it_time(data, 0, hdc100x_int_time[0][0]); 385 hdc100x_set_it_time(data, 1, hdc100x_int_time[1][0]); 386 hdc100x_update_config(data, HDC100X_REG_CONFIG_ACQ_MODE, 0); 387 |
388 ret = iio_triggered_buffer_setup(indio_dev, NULL, | 388 ret = devm_iio_triggered_buffer_setup(&client->dev, 389 indio_dev, NULL, |
389 hdc100x_trigger_handler, 390 &hdc_buffer_setup_ops); 391 if (ret < 0) { 392 dev_err(&client->dev, "iio triggered buffer setup failed\n"); 393 return ret; 394 } | 390 hdc100x_trigger_handler, 391 &hdc_buffer_setup_ops); 392 if (ret < 0) { 393 dev_err(&client->dev, "iio triggered buffer setup failed\n"); 394 return ret; 395 } |
395 ret = iio_device_register(indio_dev); 396 if (ret < 0) 397 iio_triggered_buffer_cleanup(indio_dev); | |
398 | 396 |
399 return ret; | 397 return devm_iio_device_register(&client->dev, indio_dev); |
400} 401 | 398} 399 |
402static int hdc100x_remove(struct i2c_client *client) 403{ 404 struct iio_dev *indio_dev = i2c_get_clientdata(client); 405 406 iio_device_unregister(indio_dev); 407 iio_triggered_buffer_cleanup(indio_dev); 408 409 return 0; 410} 411 | |
412static const struct i2c_device_id hdc100x_id[] = { 413 { "hdc100x", 0 }, 414 { "hdc1000", 0 }, 415 { "hdc1008", 0 }, 416 { "hdc1010", 0 }, 417 { "hdc1050", 0 }, 418 { "hdc1080", 0 }, 419 { } --- 11 unchanged lines hidden (view full) --- 431MODULE_DEVICE_TABLE(of, hdc100x_dt_ids); 432 433static struct i2c_driver hdc100x_driver = { 434 .driver = { 435 .name = "hdc100x", 436 .of_match_table = of_match_ptr(hdc100x_dt_ids), 437 }, 438 .probe = hdc100x_probe, | 400static const struct i2c_device_id hdc100x_id[] = { 401 { "hdc100x", 0 }, 402 { "hdc1000", 0 }, 403 { "hdc1008", 0 }, 404 { "hdc1010", 0 }, 405 { "hdc1050", 0 }, 406 { "hdc1080", 0 }, 407 { } --- 11 unchanged lines hidden (view full) --- 419MODULE_DEVICE_TABLE(of, hdc100x_dt_ids); 420 421static struct i2c_driver hdc100x_driver = { 422 .driver = { 423 .name = "hdc100x", 424 .of_match_table = of_match_ptr(hdc100x_dt_ids), 425 }, 426 .probe = hdc100x_probe, |
439 .remove = hdc100x_remove, | |
440 .id_table = hdc100x_id, 441}; 442module_i2c_driver(hdc100x_driver); 443 444MODULE_AUTHOR("Matt Ranostay <matt.ranostay@konsulko.com>"); 445MODULE_DESCRIPTION("TI HDC100x humidity and temperature sensor driver"); 446MODULE_LICENSE("GPL"); | 427 .id_table = hdc100x_id, 428}; 429module_i2c_driver(hdc100x_driver); 430 431MODULE_AUTHOR("Matt Ranostay <matt.ranostay@konsulko.com>"); 432MODULE_DESCRIPTION("TI HDC100x humidity and temperature sensor driver"); 433MODULE_LICENSE("GPL"); |