forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-05-13 9d77db3c730780c8ef5ccd4b66403ff5675cfe4e
kernel/drivers/iio/adc/axp20x_adc.c
....@@ -1,21 +1,18 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /* ADC driver for AXP20X and AXP22X PMICs
23 *
34 * Copyright (c) 2016 Free Electrons NextThing Co.
45 * Quentin Schulz <quentin.schulz@free-electrons.com>
5
- *
6
- * This program is free software; you can redistribute it and/or modify it under
7
- * the terms of the GNU General Public License version 2 as published by the
8
- * Free Software Foundation.
96 */
107
118 #include <linux/completion.h>
129 #include <linux/interrupt.h>
1310 #include <linux/io.h>
1411 #include <linux/module.h>
15
-#include <linux/of.h>
16
-#include <linux/of_device.h>
12
+#include <linux/mod_devicetable.h>
1713 #include <linux/platform_device.h>
1814 #include <linux/pm_runtime.h>
15
+#include <linux/property.h>
1916 #include <linux/regmap.h>
2017 #include <linux/thermal.h>
2118
....@@ -70,7 +67,7 @@
7067
7168 struct axp20x_adc_iio {
7269 struct regmap *regmap;
73
- struct axp_data *data;
70
+ const struct axp_data *data;
7471 };
7572
7673 enum axp20x_adc_channel_v {
....@@ -659,19 +656,17 @@
659656 platform_set_drvdata(pdev, indio_dev);
660657
661658 info->regmap = axp20x_dev->regmap;
662
- indio_dev->dev.parent = &pdev->dev;
663
- indio_dev->dev.of_node = pdev->dev.of_node;
664659 indio_dev->modes = INDIO_DIRECT_MODE;
665660
666
- if (!pdev->dev.of_node) {
661
+ if (!dev_fwnode(&pdev->dev)) {
667662 const struct platform_device_id *id;
668663
669664 id = platform_get_device_id(pdev);
670
- info->data = (struct axp_data *)id->driver_data;
665
+ info->data = (const struct axp_data *)id->driver_data;
671666 } else {
672667 struct device *dev = &pdev->dev;
673668
674
- info->data = (struct axp_data *)of_device_get_match_data(dev);
669
+ info->data = device_get_match_data(dev);
675670 }
676671
677672 indio_dev->name = platform_get_device_id(pdev)->name;
....@@ -735,7 +730,7 @@
735730 static struct platform_driver axp20x_adc_driver = {
736731 .driver = {
737732 .name = "axp20x-adc",
738
- .of_match_table = of_match_ptr(axp20x_adc_of_match),
733
+ .of_match_table = axp20x_adc_of_match,
739734 },
740735 .id_table = axp20x_adc_id_match,
741736 .probe = axp20x_probe,