.. | .. |
---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
---|
1 | 2 | /* ADC driver for AXP20X and AXP22X PMICs |
---|
2 | 3 | * |
---|
3 | 4 | * Copyright (c) 2016 Free Electrons NextThing Co. |
---|
4 | 5 | * 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. |
---|
9 | 6 | */ |
---|
10 | 7 | |
---|
11 | 8 | #include <linux/completion.h> |
---|
12 | 9 | #include <linux/interrupt.h> |
---|
13 | 10 | #include <linux/io.h> |
---|
14 | 11 | #include <linux/module.h> |
---|
15 | | -#include <linux/of.h> |
---|
16 | | -#include <linux/of_device.h> |
---|
| 12 | +#include <linux/mod_devicetable.h> |
---|
17 | 13 | #include <linux/platform_device.h> |
---|
18 | 14 | #include <linux/pm_runtime.h> |
---|
| 15 | +#include <linux/property.h> |
---|
19 | 16 | #include <linux/regmap.h> |
---|
20 | 17 | #include <linux/thermal.h> |
---|
21 | 18 | |
---|
.. | .. |
---|
70 | 67 | |
---|
71 | 68 | struct axp20x_adc_iio { |
---|
72 | 69 | struct regmap *regmap; |
---|
73 | | - struct axp_data *data; |
---|
| 70 | + const struct axp_data *data; |
---|
74 | 71 | }; |
---|
75 | 72 | |
---|
76 | 73 | enum axp20x_adc_channel_v { |
---|
.. | .. |
---|
659 | 656 | platform_set_drvdata(pdev, indio_dev); |
---|
660 | 657 | |
---|
661 | 658 | info->regmap = axp20x_dev->regmap; |
---|
662 | | - indio_dev->dev.parent = &pdev->dev; |
---|
663 | | - indio_dev->dev.of_node = pdev->dev.of_node; |
---|
664 | 659 | indio_dev->modes = INDIO_DIRECT_MODE; |
---|
665 | 660 | |
---|
666 | | - if (!pdev->dev.of_node) { |
---|
| 661 | + if (!dev_fwnode(&pdev->dev)) { |
---|
667 | 662 | const struct platform_device_id *id; |
---|
668 | 663 | |
---|
669 | 664 | 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; |
---|
671 | 666 | } else { |
---|
672 | 667 | struct device *dev = &pdev->dev; |
---|
673 | 668 | |
---|
674 | | - info->data = (struct axp_data *)of_device_get_match_data(dev); |
---|
| 669 | + info->data = device_get_match_data(dev); |
---|
675 | 670 | } |
---|
676 | 671 | |
---|
677 | 672 | indio_dev->name = platform_get_device_id(pdev)->name; |
---|
.. | .. |
---|
735 | 730 | static struct platform_driver axp20x_adc_driver = { |
---|
736 | 731 | .driver = { |
---|
737 | 732 | .name = "axp20x-adc", |
---|
738 | | - .of_match_table = of_match_ptr(axp20x_adc_of_match), |
---|
| 733 | + .of_match_table = axp20x_adc_of_match, |
---|
739 | 734 | }, |
---|
740 | 735 | .id_table = axp20x_adc_id_match, |
---|
741 | 736 | .probe = axp20x_probe, |
---|