| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * max30102.c - Support for MAX30102 heart rate and pulse oximeter sensor |
|---|
| 3 | 4 | * |
|---|
| 4 | | - * Copyright (C) 2017 Matt Ranostay <matt@ranostay.consulting> |
|---|
| 5 | + * Copyright (C) 2017 Matt Ranostay <matt.ranostay@konsulko.com> |
|---|
| 5 | 6 | * |
|---|
| 6 | 7 | * Support for MAX30105 optical particle sensor |
|---|
| 7 | 8 | * Copyright (C) 2017 Peter Meerwald-Stadler <pmeerw@pmeerw.net> |
|---|
| 8 | | - * |
|---|
| 9 | | - * This program is free software; you can redistribute it and/or modify |
|---|
| 10 | | - * it under the terms of the GNU General Public License as published by |
|---|
| 11 | | - * the Free Software Foundation; either version 2 of the License, or |
|---|
| 12 | | - * (at your option) any later version. |
|---|
| 13 | | - * |
|---|
| 14 | | - * This program is distributed in the hope that it will be useful, |
|---|
| 15 | | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|---|
| 16 | | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|---|
| 17 | | - * GNU General Public License for more details. |
|---|
| 18 | 9 | * |
|---|
| 19 | 10 | * 7-bit I2C chip address: 0x57 |
|---|
| 20 | 11 | * TODO: proximity power saving feature |
|---|
| .. | .. |
|---|
| 28 | 19 | #include <linux/irq.h> |
|---|
| 29 | 20 | #include <linux/i2c.h> |
|---|
| 30 | 21 | #include <linux/mutex.h> |
|---|
| 31 | | -#include <linux/of.h> |
|---|
| 22 | +#include <linux/mod_devicetable.h> |
|---|
| 32 | 23 | #include <linux/regmap.h> |
|---|
| 33 | 24 | #include <linux/iio/iio.h> |
|---|
| 34 | 25 | #include <linux/iio/buffer.h> |
|---|
| .. | .. |
|---|
| 282 | 273 | switch (measurements) { |
|---|
| 283 | 274 | case 3: |
|---|
| 284 | 275 | MAX30102_COPY_DATA(2); |
|---|
| 285 | | - case 2: /* fall-through */ |
|---|
| 276 | + fallthrough; |
|---|
| 277 | + case 2: |
|---|
| 286 | 278 | MAX30102_COPY_DATA(1); |
|---|
| 287 | | - case 1: /* fall-through */ |
|---|
| 279 | + fallthrough; |
|---|
| 280 | + case 1: |
|---|
| 288 | 281 | MAX30102_COPY_DATA(0); |
|---|
| 289 | 282 | break; |
|---|
| 290 | 283 | default: |
|---|
| .. | .. |
|---|
| 330 | 323 | static int max30102_led_init(struct max30102_data *data) |
|---|
| 331 | 324 | { |
|---|
| 332 | 325 | struct device *dev = &data->client->dev; |
|---|
| 333 | | - struct device_node *np = dev->of_node; |
|---|
| 334 | 326 | unsigned int val; |
|---|
| 335 | 327 | int reg, ret; |
|---|
| 336 | 328 | |
|---|
| 337 | | - ret = of_property_read_u32(np, "maxim,red-led-current-microamp", &val); |
|---|
| 329 | + ret = device_property_read_u32(dev, "maxim,red-led-current-microamp", &val); |
|---|
| 338 | 330 | if (ret) { |
|---|
| 339 | 331 | dev_info(dev, "no red-led-current-microamp set\n"); |
|---|
| 340 | 332 | |
|---|
| .. | .. |
|---|
| 353 | 345 | return ret; |
|---|
| 354 | 346 | |
|---|
| 355 | 347 | if (data->chip_id == max30105) { |
|---|
| 356 | | - ret = of_property_read_u32(np, |
|---|
| 348 | + ret = device_property_read_u32(dev, |
|---|
| 357 | 349 | "maxim,green-led-current-microamp", &val); |
|---|
| 358 | 350 | if (ret) { |
|---|
| 359 | 351 | dev_info(dev, "no green-led-current-microamp set\n"); |
|---|
| .. | .. |
|---|
| 375 | 367 | return ret; |
|---|
| 376 | 368 | } |
|---|
| 377 | 369 | |
|---|
| 378 | | - ret = of_property_read_u32(np, "maxim,ir-led-current-microamp", &val); |
|---|
| 370 | + ret = device_property_read_u32(dev, "maxim,ir-led-current-microamp", &val); |
|---|
| 379 | 371 | if (ret) { |
|---|
| 380 | 372 | dev_info(dev, "no ir-led-current-microamp set\n"); |
|---|
| 381 | 373 | |
|---|
| .. | .. |
|---|
| 533 | 525 | indio_dev->info = &max30102_info; |
|---|
| 534 | 526 | indio_dev->modes = (INDIO_BUFFER_SOFTWARE | INDIO_DIRECT_MODE); |
|---|
| 535 | 527 | indio_dev->setup_ops = &max30102_buffer_setup_ops; |
|---|
| 536 | | - indio_dev->dev.parent = &client->dev; |
|---|
| 537 | 528 | |
|---|
| 538 | 529 | data = iio_priv(indio_dev); |
|---|
| 539 | 530 | data->indio_dev = indio_dev; |
|---|
| .. | .. |
|---|
| 632 | 623 | static struct i2c_driver max30102_driver = { |
|---|
| 633 | 624 | .driver = { |
|---|
| 634 | 625 | .name = MAX30102_DRV_NAME, |
|---|
| 635 | | - .of_match_table = of_match_ptr(max30102_dt_ids), |
|---|
| 626 | + .of_match_table = max30102_dt_ids, |
|---|
| 636 | 627 | }, |
|---|
| 637 | 628 | .probe = max30102_probe, |
|---|
| 638 | 629 | .remove = max30102_remove, |
|---|
| .. | .. |
|---|
| 640 | 631 | }; |
|---|
| 641 | 632 | module_i2c_driver(max30102_driver); |
|---|
| 642 | 633 | |
|---|
| 643 | | -MODULE_AUTHOR("Matt Ranostay <matt@ranostay.consulting>"); |
|---|
| 634 | +MODULE_AUTHOR("Matt Ranostay <matt.ranostay@konsulko.com>"); |
|---|
| 644 | 635 | MODULE_DESCRIPTION("MAX30102 heart rate/pulse oximeter and MAX30105 particle sensor driver"); |
|---|
| 645 | 636 | MODULE_LICENSE("GPL"); |
|---|