forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-05-13 9d77db3c730780c8ef5ccd4b66403ff5675cfe4e
kernel/drivers/iio/adc/max1118.c
....@@ -1,11 +1,8 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /*
23 * MAX1117/MAX1118/MAX1119 8-bit, dual-channel ADCs driver
34 *
45 * Copyright (c) 2017 Akinobu Mita <akinobu.mita@gmail.com>
5
- *
6
- * This file is subject to the terms and conditions of version 2 of
7
- * the GNU General Public License. See the file COPYING in the main
8
- * directory of this archive for more details.
96 *
107 * Datasheet: https://datasheets.maximintegrated.com/en/ds/MAX1117-MAX1119.pdf
118 *
....@@ -21,6 +18,7 @@
2118 */
2219
2320 #include <linux/module.h>
21
+#include <linux/mod_devicetable.h>
2422 #include <linux/spi/spi.h>
2523 #include <linux/iio/iio.h>
2624 #include <linux/iio/buffer.h>
....@@ -79,7 +77,10 @@
7977 */
8078 {
8179 .len = 0,
82
- .delay_usecs = 1, /* > CNVST Low Time 100 ns */
80
+ .delay = { /* > CNVST Low Time 100 ns */
81
+ .value = 1,
82
+ .unit = SPI_DELAY_UNIT_USECS
83
+ },
8384 .cs_change = 1,
8485 },
8586 /*
....@@ -89,7 +90,10 @@
8990 */
9091 {
9192 .len = 0,
92
- .delay_usecs = 8,
93
+ .delay = {
94
+ .value = 8,
95
+ .unit = SPI_DELAY_UNIT_USECS
96
+ },
9397 },
9498 {
9599 .rx_buf = &adc->data,
....@@ -226,7 +230,6 @@
226230 spi_set_drvdata(spi, indio_dev);
227231
228232 indio_dev->name = spi_get_device_id(spi)->name;
229
- indio_dev->dev.parent = &spi->dev;
230233 indio_dev->info = &max1118_info;
231234 indio_dev->modes = INDIO_DIRECT_MODE;
232235 indio_dev->channels = max1118_channels;
....@@ -282,8 +285,6 @@
282285 };
283286 MODULE_DEVICE_TABLE(spi, max1118_id);
284287
285
-#ifdef CONFIG_OF
286
-
287288 static const struct of_device_id max1118_dt_ids[] = {
288289 { .compatible = "maxim,max1117" },
289290 { .compatible = "maxim,max1118" },
....@@ -292,12 +293,10 @@
292293 };
293294 MODULE_DEVICE_TABLE(of, max1118_dt_ids);
294295
295
-#endif
296
-
297296 static struct spi_driver max1118_spi_driver = {
298297 .driver = {
299298 .name = "max1118",
300
- .of_match_table = of_match_ptr(max1118_dt_ids),
299
+ .of_match_table = max1118_dt_ids,
301300 },
302301 .probe = max1118_probe,
303302 .remove = max1118_remove,