forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-05-10 37f49e37ab4cb5d0bc4c60eb5c6d4dd57db767bb
kernel/drivers/iio/health/max30102.c
....@@ -1,20 +1,11 @@
1
+// SPDX-License-Identifier: GPL-2.0-or-later
12 /*
23 * max30102.c - Support for MAX30102 heart rate and pulse oximeter sensor
34 *
4
- * Copyright (C) 2017 Matt Ranostay <matt@ranostay.consulting>
5
+ * Copyright (C) 2017 Matt Ranostay <matt.ranostay@konsulko.com>
56 *
67 * Support for MAX30105 optical particle sensor
78 * 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.
189 *
1910 * 7-bit I2C chip address: 0x57
2011 * TODO: proximity power saving feature
....@@ -28,7 +19,7 @@
2819 #include <linux/irq.h>
2920 #include <linux/i2c.h>
3021 #include <linux/mutex.h>
31
-#include <linux/of.h>
22
+#include <linux/mod_devicetable.h>
3223 #include <linux/regmap.h>
3324 #include <linux/iio/iio.h>
3425 #include <linux/iio/buffer.h>
....@@ -282,9 +273,11 @@
282273 switch (measurements) {
283274 case 3:
284275 MAX30102_COPY_DATA(2);
285
- case 2: /* fall-through */
276
+ fallthrough;
277
+ case 2:
286278 MAX30102_COPY_DATA(1);
287
- case 1: /* fall-through */
279
+ fallthrough;
280
+ case 1:
288281 MAX30102_COPY_DATA(0);
289282 break;
290283 default:
....@@ -330,11 +323,10 @@
330323 static int max30102_led_init(struct max30102_data *data)
331324 {
332325 struct device *dev = &data->client->dev;
333
- struct device_node *np = dev->of_node;
334326 unsigned int val;
335327 int reg, ret;
336328
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);
338330 if (ret) {
339331 dev_info(dev, "no red-led-current-microamp set\n");
340332
....@@ -353,7 +345,7 @@
353345 return ret;
354346
355347 if (data->chip_id == max30105) {
356
- ret = of_property_read_u32(np,
348
+ ret = device_property_read_u32(dev,
357349 "maxim,green-led-current-microamp", &val);
358350 if (ret) {
359351 dev_info(dev, "no green-led-current-microamp set\n");
....@@ -375,7 +367,7 @@
375367 return ret;
376368 }
377369
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);
379371 if (ret) {
380372 dev_info(dev, "no ir-led-current-microamp set\n");
381373
....@@ -533,7 +525,6 @@
533525 indio_dev->info = &max30102_info;
534526 indio_dev->modes = (INDIO_BUFFER_SOFTWARE | INDIO_DIRECT_MODE);
535527 indio_dev->setup_ops = &max30102_buffer_setup_ops;
536
- indio_dev->dev.parent = &client->dev;
537528
538529 data = iio_priv(indio_dev);
539530 data->indio_dev = indio_dev;
....@@ -632,7 +623,7 @@
632623 static struct i2c_driver max30102_driver = {
633624 .driver = {
634625 .name = MAX30102_DRV_NAME,
635
- .of_match_table = of_match_ptr(max30102_dt_ids),
626
+ .of_match_table = max30102_dt_ids,
636627 },
637628 .probe = max30102_probe,
638629 .remove = max30102_remove,
....@@ -640,6 +631,6 @@
640631 };
641632 module_i2c_driver(max30102_driver);
642633
643
-MODULE_AUTHOR("Matt Ranostay <matt@ranostay.consulting>");
634
+MODULE_AUTHOR("Matt Ranostay <matt.ranostay@konsulko.com>");
644635 MODULE_DESCRIPTION("MAX30102 heart rate/pulse oximeter and MAX30105 particle sensor driver");
645636 MODULE_LICENSE("GPL");