| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * Maxim Integrated DS1803 digital potentiometer driver |
|---|
| 3 | 4 | * Copyright (c) 2016 Slawomir Stepien |
|---|
| .. | .. |
|---|
| 6 | 7 | * |
|---|
| 7 | 8 | * DEVID #Wipers #Positions Resistor Opts (kOhm) i2c address |
|---|
| 8 | 9 | * ds1803 2 256 10, 50, 100 0101xxx |
|---|
| 9 | | - * |
|---|
| 10 | | - * This program is free software; you can redistribute it and/or modify it |
|---|
| 11 | | - * under the terms of the GNU General Public License version 2 as published by |
|---|
| 12 | | - * the Free Software Foundation. |
|---|
| 13 | 10 | */ |
|---|
| 14 | 11 | |
|---|
| 15 | 12 | #include <linux/err.h> |
|---|
| .. | .. |
|---|
| 17 | 14 | #include <linux/i2c.h> |
|---|
| 18 | 15 | #include <linux/iio/iio.h> |
|---|
| 19 | 16 | #include <linux/module.h> |
|---|
| 20 | | -#include <linux/of.h> |
|---|
| 17 | +#include <linux/mod_devicetable.h> |
|---|
| 21 | 18 | |
|---|
| 22 | 19 | #define DS1803_MAX_POS 255 |
|---|
| 23 | 20 | #define DS1803_WRITE(chan) (0xa8 | ((chan) + 1)) |
|---|
| .. | .. |
|---|
| 129 | 126 | data->client = client; |
|---|
| 130 | 127 | data->cfg = &ds1803_cfg[id->driver_data]; |
|---|
| 131 | 128 | |
|---|
| 132 | | - indio_dev->dev.parent = dev; |
|---|
| 133 | 129 | indio_dev->info = &ds1803_info; |
|---|
| 134 | 130 | indio_dev->channels = ds1803_channels; |
|---|
| 135 | 131 | indio_dev->num_channels = ARRAY_SIZE(ds1803_channels); |
|---|
| .. | .. |
|---|
| 138 | 134 | return devm_iio_device_register(dev, indio_dev); |
|---|
| 139 | 135 | } |
|---|
| 140 | 136 | |
|---|
| 141 | | -#if defined(CONFIG_OF) |
|---|
| 142 | 137 | static const struct of_device_id ds1803_dt_ids[] = { |
|---|
| 143 | 138 | { .compatible = "maxim,ds1803-010", .data = &ds1803_cfg[DS1803_010] }, |
|---|
| 144 | 139 | { .compatible = "maxim,ds1803-050", .data = &ds1803_cfg[DS1803_050] }, |
|---|
| .. | .. |
|---|
| 146 | 141 | {} |
|---|
| 147 | 142 | }; |
|---|
| 148 | 143 | MODULE_DEVICE_TABLE(of, ds1803_dt_ids); |
|---|
| 149 | | -#endif /* CONFIG_OF */ |
|---|
| 150 | 144 | |
|---|
| 151 | 145 | static const struct i2c_device_id ds1803_id[] = { |
|---|
| 152 | 146 | { "ds1803-010", DS1803_010 }, |
|---|
| .. | .. |
|---|
| 159 | 153 | static struct i2c_driver ds1803_driver = { |
|---|
| 160 | 154 | .driver = { |
|---|
| 161 | 155 | .name = "ds1803", |
|---|
| 162 | | - .of_match_table = of_match_ptr(ds1803_dt_ids), |
|---|
| 156 | + .of_match_table = ds1803_dt_ids, |
|---|
| 163 | 157 | }, |
|---|
| 164 | 158 | .probe = ds1803_probe, |
|---|
| 165 | 159 | .id_table = ds1803_id, |
|---|