| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * MAX1117/MAX1118/MAX1119 8-bit, dual-channel ADCs driver |
|---|
| 3 | 4 | * |
|---|
| 4 | 5 | * 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. |
|---|
| 9 | 6 | * |
|---|
| 10 | 7 | * Datasheet: https://datasheets.maximintegrated.com/en/ds/MAX1117-MAX1119.pdf |
|---|
| 11 | 8 | * |
|---|
| .. | .. |
|---|
| 21 | 18 | */ |
|---|
| 22 | 19 | |
|---|
| 23 | 20 | #include <linux/module.h> |
|---|
| 21 | +#include <linux/mod_devicetable.h> |
|---|
| 24 | 22 | #include <linux/spi/spi.h> |
|---|
| 25 | 23 | #include <linux/iio/iio.h> |
|---|
| 26 | 24 | #include <linux/iio/buffer.h> |
|---|
| .. | .. |
|---|
| 79 | 77 | */ |
|---|
| 80 | 78 | { |
|---|
| 81 | 79 | .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 | + }, |
|---|
| 83 | 84 | .cs_change = 1, |
|---|
| 84 | 85 | }, |
|---|
| 85 | 86 | /* |
|---|
| .. | .. |
|---|
| 89 | 90 | */ |
|---|
| 90 | 91 | { |
|---|
| 91 | 92 | .len = 0, |
|---|
| 92 | | - .delay_usecs = 8, |
|---|
| 93 | + .delay = { |
|---|
| 94 | + .value = 8, |
|---|
| 95 | + .unit = SPI_DELAY_UNIT_USECS |
|---|
| 96 | + }, |
|---|
| 93 | 97 | }, |
|---|
| 94 | 98 | { |
|---|
| 95 | 99 | .rx_buf = &adc->data, |
|---|
| .. | .. |
|---|
| 226 | 230 | spi_set_drvdata(spi, indio_dev); |
|---|
| 227 | 231 | |
|---|
| 228 | 232 | indio_dev->name = spi_get_device_id(spi)->name; |
|---|
| 229 | | - indio_dev->dev.parent = &spi->dev; |
|---|
| 230 | 233 | indio_dev->info = &max1118_info; |
|---|
| 231 | 234 | indio_dev->modes = INDIO_DIRECT_MODE; |
|---|
| 232 | 235 | indio_dev->channels = max1118_channels; |
|---|
| .. | .. |
|---|
| 282 | 285 | }; |
|---|
| 283 | 286 | MODULE_DEVICE_TABLE(spi, max1118_id); |
|---|
| 284 | 287 | |
|---|
| 285 | | -#ifdef CONFIG_OF |
|---|
| 286 | | - |
|---|
| 287 | 288 | static const struct of_device_id max1118_dt_ids[] = { |
|---|
| 288 | 289 | { .compatible = "maxim,max1117" }, |
|---|
| 289 | 290 | { .compatible = "maxim,max1118" }, |
|---|
| .. | .. |
|---|
| 292 | 293 | }; |
|---|
| 293 | 294 | MODULE_DEVICE_TABLE(of, max1118_dt_ids); |
|---|
| 294 | 295 | |
|---|
| 295 | | -#endif |
|---|
| 296 | | - |
|---|
| 297 | 296 | static struct spi_driver max1118_spi_driver = { |
|---|
| 298 | 297 | .driver = { |
|---|
| 299 | 298 | .name = "max1118", |
|---|
| 300 | | - .of_match_table = of_match_ptr(max1118_dt_ids), |
|---|
| 299 | + .of_match_table = max1118_dt_ids, |
|---|
| 301 | 300 | }, |
|---|
| 302 | 301 | .probe = max1118_probe, |
|---|
| 303 | 302 | .remove = max1118_remove, |
|---|