| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * TI tlc4541 ADC Driver |
|---|
| 3 | 4 | * |
|---|
| 4 | 5 | * Copyright (C) 2017 Phil Reid |
|---|
| 5 | 6 | * |
|---|
| 6 | 7 | * 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 |
|---|
| 13 | 10 | * |
|---|
| 14 | 11 | * The tlc4541 requires 24 clock cycles to start a transfer. |
|---|
| 15 | 12 | * Conversion then takes 2.94us to complete before data is ready |
|---|
| .. | .. |
|---|
| 27 | 24 | #include <linux/iio/triggered_buffer.h> |
|---|
| 28 | 25 | #include <linux/kernel.h> |
|---|
| 29 | 26 | #include <linux/module.h> |
|---|
| 27 | +#include <linux/mod_devicetable.h> |
|---|
| 30 | 28 | #include <linux/regulator/consumer.h> |
|---|
| 31 | 29 | #include <linux/slab.h> |
|---|
| 32 | 30 | #include <linux/spi/spi.h> |
|---|
| .. | .. |
|---|
| 180 | 178 | info = &tlc4541_chip_info[spi_get_device_id(spi)->driver_data]; |
|---|
| 181 | 179 | |
|---|
| 182 | 180 | indio_dev->name = spi_get_device_id(spi)->name; |
|---|
| 183 | | - indio_dev->dev.parent = &spi->dev; |
|---|
| 184 | 181 | indio_dev->modes = INDIO_DIRECT_MODE; |
|---|
| 185 | 182 | indio_dev->channels = info->channels; |
|---|
| 186 | 183 | indio_dev->num_channels = info->num_channels; |
|---|
| .. | .. |
|---|
| 192 | 189 | /* Setup default message */ |
|---|
| 193 | 190 | st->scan_single_xfer[0].rx_buf = &st->rx_buf[0]; |
|---|
| 194 | 191 | 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; |
|---|
| 196 | 194 | st->scan_single_xfer[2].rx_buf = &st->rx_buf[0]; |
|---|
| 197 | 195 | st->scan_single_xfer[2].len = 2; |
|---|
| 198 | 196 | |
|---|
| .. | .. |
|---|
| 238 | 236 | return 0; |
|---|
| 239 | 237 | } |
|---|
| 240 | 238 | |
|---|
| 241 | | -#ifdef CONFIG_OF |
|---|
| 242 | 239 | static const struct of_device_id tlc4541_dt_ids[] = { |
|---|
| 243 | 240 | { .compatible = "ti,tlc3541", }, |
|---|
| 244 | 241 | { .compatible = "ti,tlc4541", }, |
|---|
| 245 | 242 | {} |
|---|
| 246 | 243 | }; |
|---|
| 247 | 244 | MODULE_DEVICE_TABLE(of, tlc4541_dt_ids); |
|---|
| 248 | | -#endif |
|---|
| 249 | 245 | |
|---|
| 250 | 246 | static const struct spi_device_id tlc4541_id[] = { |
|---|
| 251 | 247 | {"tlc3541", TLC3541}, |
|---|
| .. | .. |
|---|
| 257 | 253 | static struct spi_driver tlc4541_driver = { |
|---|
| 258 | 254 | .driver = { |
|---|
| 259 | 255 | .name = "tlc4541", |
|---|
| 260 | | - .of_match_table = of_match_ptr(tlc4541_dt_ids), |
|---|
| 256 | + .of_match_table = tlc4541_dt_ids, |
|---|
| 261 | 257 | }, |
|---|
| 262 | 258 | .probe = tlc4541_probe, |
|---|
| 263 | 259 | .remove = tlc4541_remove, |
|---|