forked from ~ljy/RK356X_SDK_RELEASE

hc
2023-12-11 072de836f53be56a70cecf70b43ae43b7ce17376
kernel/drivers/iio/adc/ti-tlc4541.c
....@@ -1,15 +1,12 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /*
23 * TI tlc4541 ADC Driver
34 *
45 * Copyright (C) 2017 Phil Reid
56 *
67 * Datasheets can be found here:
7
- * http://www.ti.com/lit/gpn/tlc3541
8
- * http://www.ti.com/lit/gpn/tlc4541
9
- *
10
- * This program is free software; you can redistribute it and/or modify
11
- * it under the terms of the GNU General Public License version 2 as
12
- * published by the Free Software Foundation.
8
+ * https://www.ti.com/lit/gpn/tlc3541
9
+ * https://www.ti.com/lit/gpn/tlc4541
1310 *
1411 * The tlc4541 requires 24 clock cycles to start a transfer.
1512 * Conversion then takes 2.94us to complete before data is ready
....@@ -27,6 +24,7 @@
2724 #include <linux/iio/triggered_buffer.h>
2825 #include <linux/kernel.h>
2926 #include <linux/module.h>
27
+#include <linux/mod_devicetable.h>
3028 #include <linux/regulator/consumer.h>
3129 #include <linux/slab.h>
3230 #include <linux/spi/spi.h>
....@@ -180,7 +178,6 @@
180178 info = &tlc4541_chip_info[spi_get_device_id(spi)->driver_data];
181179
182180 indio_dev->name = spi_get_device_id(spi)->name;
183
- indio_dev->dev.parent = &spi->dev;
184181 indio_dev->modes = INDIO_DIRECT_MODE;
185182 indio_dev->channels = info->channels;
186183 indio_dev->num_channels = info->num_channels;
....@@ -192,7 +189,8 @@
192189 /* Setup default message */
193190 st->scan_single_xfer[0].rx_buf = &st->rx_buf[0];
194191 st->scan_single_xfer[0].len = 3;
195
- st->scan_single_xfer[1].delay_usecs = 3;
192
+ st->scan_single_xfer[1].delay.value = 3;
193
+ st->scan_single_xfer[1].delay.unit = SPI_DELAY_UNIT_NSECS;
196194 st->scan_single_xfer[2].rx_buf = &st->rx_buf[0];
197195 st->scan_single_xfer[2].len = 2;
198196
....@@ -238,14 +236,12 @@
238236 return 0;
239237 }
240238
241
-#ifdef CONFIG_OF
242239 static const struct of_device_id tlc4541_dt_ids[] = {
243240 { .compatible = "ti,tlc3541", },
244241 { .compatible = "ti,tlc4541", },
245242 {}
246243 };
247244 MODULE_DEVICE_TABLE(of, tlc4541_dt_ids);
248
-#endif
249245
250246 static const struct spi_device_id tlc4541_id[] = {
251247 {"tlc3541", TLC3541},
....@@ -257,7 +253,7 @@
257253 static struct spi_driver tlc4541_driver = {
258254 .driver = {
259255 .name = "tlc4541",
260
- .of_match_table = of_match_ptr(tlc4541_dt_ids),
256
+ .of_match_table = tlc4541_dt_ids,
261257 },
262258 .probe = tlc4541_probe,
263259 .remove = tlc4541_remove,