blob: 2ca5059ef89ef16dce37b6c87448635d831433be [file] [log] [blame]
Michael Hennerichb5a49482010-11-22 11:15:23 +01001/*
2 * AD5446 SPI DAC driver
3 *
4 * Copyright 2010 Analog Devices Inc.
5 *
6 * Licensed under the GPL-2 or later.
7 */
8
9#include <linux/interrupt.h>
10#include <linux/workqueue.h>
11#include <linux/device.h>
12#include <linux/kernel.h>
13#include <linux/slab.h>
14#include <linux/sysfs.h>
15#include <linux/list.h>
16#include <linux/spi/spi.h>
17#include <linux/regulator/consumer.h>
18#include <linux/err.h>
Paul Gortmaker99c97852011-07-03 15:49:50 -040019#include <linux/module.h>
Michael Hennerichb5a49482010-11-22 11:15:23 +010020
Jonathan Cameron06458e22012-04-25 15:54:58 +010021#include <linux/iio/iio.h>
22#include <linux/iio/sysfs.h>
Michael Hennerichb5a49482010-11-22 11:15:23 +010023
24#include "ad5446.h"
25
Lars-Peter Clausencae329e2012-04-25 09:44:59 +020026static int ad5446_write(struct ad5446_state *st, unsigned val)
Michael Hennerichd8462632010-11-23 11:14:16 +010027{
Lars-Peter Clausenaf836d92012-04-25 09:44:54 +020028 __be16 data = cpu_to_be16(val);
29 return spi_write(st->spi, &data, sizeof(data));
Michael Hennerichd8462632010-11-23 11:14:16 +010030}
31
Lars-Peter Clausencae329e2012-04-25 09:44:59 +020032static int ad5660_write(struct ad5446_state *st, unsigned val)
Michael Hennerichd8462632010-11-23 11:14:16 +010033{
Lars-Peter Clausenaf836d92012-04-25 09:44:54 +020034 uint8_t data[3];
35
Lars-Peter Clausenaf836d92012-04-25 09:44:54 +020036 data[0] = (val >> 16) & 0xFF;
37 data[1] = (val >> 8) & 0xFF;
38 data[2] = val & 0xFF;
39
40 return spi_write(st->spi, data, sizeof(data));
Michael Hennerichbbed4dc2011-03-10 13:26:47 +010041}
42
Lars-Peter Clausen83f0f572012-04-25 09:44:58 +020043static const char * const ad5446_powerdown_modes[] = {
Lars-Peter Clausen09d48aa2012-06-04 11:36:13 +020044 "1kohm_to_gnd", "100kohm_to_gnd", "three_state"
Lars-Peter Clausen83f0f572012-04-25 09:44:58 +020045};
Michael Hennerichbbed4dc2011-03-10 13:26:47 +010046
Lars-Peter Clausen09d48aa2012-06-04 11:36:13 +020047static int ad5446_set_powerdown_mode(struct iio_dev *indio_dev,
48 const struct iio_chan_spec *chan, unsigned int mode)
Michael Hennerichbbed4dc2011-03-10 13:26:47 +010049{
Lars-Peter Clausen83f0f572012-04-25 09:44:58 +020050 struct ad5446_state *st = iio_priv(indio_dev);
51
Lars-Peter Clausen09d48aa2012-06-04 11:36:13 +020052 st->pwr_down_mode = mode + 1;
53
54 return 0;
Lars-Peter Clausen83f0f572012-04-25 09:44:58 +020055}
56
Lars-Peter Clausen09d48aa2012-06-04 11:36:13 +020057static int ad5446_get_powerdown_mode(struct iio_dev *indio_dev,
58 const struct iio_chan_spec *chan)
59{
60 struct ad5446_state *st = iio_priv(indio_dev);
61
62 return st->pwr_down_mode - 1;
63}
64
65static const struct iio_enum ad5446_powerdown_mode_enum = {
66 .items = ad5446_powerdown_modes,
67 .num_items = ARRAY_SIZE(ad5446_powerdown_modes),
68 .get = ad5446_get_powerdown_mode,
69 .set = ad5446_set_powerdown_mode,
70};
71
Lars-Peter Clausen83f0f572012-04-25 09:44:58 +020072static ssize_t ad5446_read_dac_powerdown(struct iio_dev *indio_dev,
Michael Hennerichfc6d1132012-04-27 10:58:36 +020073 uintptr_t private,
Lars-Peter Clausen83f0f572012-04-25 09:44:58 +020074 const struct iio_chan_spec *chan,
75 char *buf)
76{
Jonathan Cameron638e59f2011-10-06 17:14:38 +010077 struct ad5446_state *st = iio_priv(indio_dev);
Michael Hennerichbbed4dc2011-03-10 13:26:47 +010078
79 return sprintf(buf, "%d\n", st->pwr_down);
80}
81
Lars-Peter Clausen83f0f572012-04-25 09:44:58 +020082static ssize_t ad5446_write_dac_powerdown(struct iio_dev *indio_dev,
Michael Hennerichfc6d1132012-04-27 10:58:36 +020083 uintptr_t private,
Lars-Peter Clausen83f0f572012-04-25 09:44:58 +020084 const struct iio_chan_spec *chan,
Michael Hennerichbbed4dc2011-03-10 13:26:47 +010085 const char *buf, size_t len)
86{
Jonathan Cameron638e59f2011-10-06 17:14:38 +010087 struct ad5446_state *st = iio_priv(indio_dev);
Lars-Peter Clausencae329e2012-04-25 09:44:59 +020088 unsigned int shift;
89 unsigned int val;
Lars-Peter Clausen83f0f572012-04-25 09:44:58 +020090 bool powerdown;
Michael Hennerichbbed4dc2011-03-10 13:26:47 +010091 int ret;
92
Lars-Peter Clausen83f0f572012-04-25 09:44:58 +020093 ret = strtobool(buf, &powerdown);
Michael Hennerichbbed4dc2011-03-10 13:26:47 +010094 if (ret)
95 return ret;
96
Jonathan Cameron638e59f2011-10-06 17:14:38 +010097 mutex_lock(&indio_dev->mlock);
Lars-Peter Clausen83f0f572012-04-25 09:44:58 +020098 st->pwr_down = powerdown;
Michael Hennerichbbed4dc2011-03-10 13:26:47 +010099
Lars-Peter Clausencae329e2012-04-25 09:44:59 +0200100 if (st->pwr_down) {
101 shift = chan->scan_type.realbits + chan->scan_type.shift;
102 val = st->pwr_down_mode << shift;
103 } else {
104 val = st->cached_val;
105 }
Michael Hennerichbbed4dc2011-03-10 13:26:47 +0100106
Lars-Peter Clausencae329e2012-04-25 09:44:59 +0200107 ret = st->chip_info->write(st, val);
Jonathan Cameron638e59f2011-10-06 17:14:38 +0100108 mutex_unlock(&indio_dev->mlock);
Michael Hennerichbbed4dc2011-03-10 13:26:47 +0100109
110 return ret ? ret : len;
111}
112
Lars-Peter Clausen83f0f572012-04-25 09:44:58 +0200113static const struct iio_chan_spec_ext_info ad5064_ext_info_powerdown[] = {
114 {
115 .name = "powerdown",
116 .read = ad5446_read_dac_powerdown,
117 .write = ad5446_write_dac_powerdown,
Lars-Peter Clausen83f0f572012-04-25 09:44:58 +0200118 },
Lars-Peter Clausen09d48aa2012-06-04 11:36:13 +0200119 IIO_ENUM("powerdown_mode", false, &ad5446_powerdown_mode_enum),
120 IIO_ENUM_AVAILABLE("powerdown_mode", &ad5446_powerdown_mode_enum),
Lars-Peter Clausen83f0f572012-04-25 09:44:58 +0200121 { },
Michael Hennerichb5a49482010-11-22 11:15:23 +0100122};
123
Lars-Peter Clausen83f0f572012-04-25 09:44:58 +0200124#define _AD5446_CHANNEL(bits, storage, shift, ext) { \
Lars-Peter Clausen33ad6b22011-11-15 16:31:22 +0100125 .type = IIO_VOLTAGE, \
126 .indexed = 1, \
127 .output = 1, \
128 .channel = 0, \
Jonathan Cameron09f4eb42012-04-15 17:41:19 +0100129 .info_mask = IIO_CHAN_INFO_RAW_SEPARATE_BIT | \
130 IIO_CHAN_INFO_SCALE_SHARED_BIT, \
Lars-Peter Clausen83f0f572012-04-25 09:44:58 +0200131 .scan_type = IIO_ST('u', (bits), (storage), (shift)), \
132 .ext_info = (ext), \
Lars-Peter Clausen33ad6b22011-11-15 16:31:22 +0100133}
134
Lars-Peter Clausen83f0f572012-04-25 09:44:58 +0200135#define AD5446_CHANNEL(bits, storage, shift) \
136 _AD5446_CHANNEL(bits, storage, shift, NULL)
137
138#define AD5446_CHANNEL_POWERDOWN(bits, storage, shift) \
139 _AD5446_CHANNEL(bits, storage, shift, ad5064_ext_info_powerdown)
140
Michael Hennerichb5a49482010-11-22 11:15:23 +0100141static const struct ad5446_chip_info ad5446_chip_info_tbl[] = {
142 [ID_AD5444] = {
Lars-Peter Clausen33ad6b22011-11-15 16:31:22 +0100143 .channel = AD5446_CHANNEL(12, 16, 2),
Lars-Peter Clausencae329e2012-04-25 09:44:59 +0200144 .write = ad5446_write,
Michael Hennerichb5a49482010-11-22 11:15:23 +0100145 },
146 [ID_AD5446] = {
Lars-Peter Clausen33ad6b22011-11-15 16:31:22 +0100147 .channel = AD5446_CHANNEL(14, 16, 0),
Lars-Peter Clausencae329e2012-04-25 09:44:59 +0200148 .write = ad5446_write,
Michael Hennerichb5a49482010-11-22 11:15:23 +0100149 },
Lars-Peter Clausen779c0c42012-06-26 10:45:43 +0200150 [ID_AD5450] = {
151 .channel = AD5446_CHANNEL(8, 16, 6),
152 .write = ad5446_write,
153 },
154 [ID_AD5451] = {
155 .channel = AD5446_CHANNEL(10, 16, 4),
156 .write = ad5446_write,
157 },
Michael Hennerich67d1c1f2011-04-15 13:51:07 +0200158 [ID_AD5541A] = {
Lars-Peter Clausen33ad6b22011-11-15 16:31:22 +0100159 .channel = AD5446_CHANNEL(16, 16, 0),
Lars-Peter Clausencae329e2012-04-25 09:44:59 +0200160 .write = ad5446_write,
Michael Hennerich67d1c1f2011-04-15 13:51:07 +0200161 },
Michael Hennerichb5a49482010-11-22 11:15:23 +0100162 [ID_AD5512A] = {
Lars-Peter Clausen33ad6b22011-11-15 16:31:22 +0100163 .channel = AD5446_CHANNEL(12, 16, 4),
Lars-Peter Clausencae329e2012-04-25 09:44:59 +0200164 .write = ad5446_write,
Michael Hennerichd8462632010-11-23 11:14:16 +0100165 },
Michael Hennerich07722682011-02-23 10:45:47 +0100166 [ID_AD5553] = {
Lars-Peter Clausen33ad6b22011-11-15 16:31:22 +0100167 .channel = AD5446_CHANNEL(14, 16, 0),
Lars-Peter Clausencae329e2012-04-25 09:44:59 +0200168 .write = ad5446_write,
Michael Hennerich07722682011-02-23 10:45:47 +0100169 },
Michael Hennerich2b615352011-03-10 13:26:48 +0100170 [ID_AD5601] = {
Lars-Peter Clausen83f0f572012-04-25 09:44:58 +0200171 .channel = AD5446_CHANNEL_POWERDOWN(8, 16, 6),
Lars-Peter Clausencae329e2012-04-25 09:44:59 +0200172 .write = ad5446_write,
Michael Hennerich2b615352011-03-10 13:26:48 +0100173 },
174 [ID_AD5611] = {
Lars-Peter Clausen83f0f572012-04-25 09:44:58 +0200175 .channel = AD5446_CHANNEL_POWERDOWN(10, 16, 4),
Lars-Peter Clausencae329e2012-04-25 09:44:59 +0200176 .write = ad5446_write,
Michael Hennerich2b615352011-03-10 13:26:48 +0100177 },
178 [ID_AD5621] = {
Lars-Peter Clausen83f0f572012-04-25 09:44:58 +0200179 .channel = AD5446_CHANNEL_POWERDOWN(12, 16, 2),
Lars-Peter Clausencae329e2012-04-25 09:44:59 +0200180 .write = ad5446_write,
Michael Hennerich2b615352011-03-10 13:26:48 +0100181 },
Michael Hennerichd8462632010-11-23 11:14:16 +0100182 [ID_AD5620_2500] = {
Lars-Peter Clausen83f0f572012-04-25 09:44:58 +0200183 .channel = AD5446_CHANNEL_POWERDOWN(12, 16, 2),
Michael Hennerichd8462632010-11-23 11:14:16 +0100184 .int_vref_mv = 2500,
Lars-Peter Clausencae329e2012-04-25 09:44:59 +0200185 .write = ad5446_write,
Michael Hennerichd8462632010-11-23 11:14:16 +0100186 },
187 [ID_AD5620_1250] = {
Lars-Peter Clausen83f0f572012-04-25 09:44:58 +0200188 .channel = AD5446_CHANNEL_POWERDOWN(12, 16, 2),
Michael Hennerichd8462632010-11-23 11:14:16 +0100189 .int_vref_mv = 1250,
Lars-Peter Clausencae329e2012-04-25 09:44:59 +0200190 .write = ad5446_write,
Michael Hennerichd8462632010-11-23 11:14:16 +0100191 },
192 [ID_AD5640_2500] = {
Lars-Peter Clausen83f0f572012-04-25 09:44:58 +0200193 .channel = AD5446_CHANNEL_POWERDOWN(14, 16, 0),
Michael Hennerichd8462632010-11-23 11:14:16 +0100194 .int_vref_mv = 2500,
Lars-Peter Clausencae329e2012-04-25 09:44:59 +0200195 .write = ad5446_write,
Michael Hennerichd8462632010-11-23 11:14:16 +0100196 },
197 [ID_AD5640_1250] = {
Lars-Peter Clausen83f0f572012-04-25 09:44:58 +0200198 .channel = AD5446_CHANNEL_POWERDOWN(14, 16, 0),
Michael Hennerichd8462632010-11-23 11:14:16 +0100199 .int_vref_mv = 1250,
Lars-Peter Clausencae329e2012-04-25 09:44:59 +0200200 .write = ad5446_write,
Michael Hennerichd8462632010-11-23 11:14:16 +0100201 },
202 [ID_AD5660_2500] = {
Lars-Peter Clausen83f0f572012-04-25 09:44:58 +0200203 .channel = AD5446_CHANNEL_POWERDOWN(16, 16, 0),
Michael Hennerichd8462632010-11-23 11:14:16 +0100204 .int_vref_mv = 2500,
Lars-Peter Clausencae329e2012-04-25 09:44:59 +0200205 .write = ad5660_write,
Michael Hennerichd8462632010-11-23 11:14:16 +0100206 },
207 [ID_AD5660_1250] = {
Lars-Peter Clausen83f0f572012-04-25 09:44:58 +0200208 .channel = AD5446_CHANNEL_POWERDOWN(16, 16, 0),
Michael Hennerichd8462632010-11-23 11:14:16 +0100209 .int_vref_mv = 1250,
Lars-Peter Clausencae329e2012-04-25 09:44:59 +0200210 .write = ad5660_write,
Michael Hennerichb5a49482010-11-22 11:15:23 +0100211 },
Lars-Peter Clausen18e5ab32012-04-25 09:45:01 +0200212 [ID_AD5662] = {
213 .channel = AD5446_CHANNEL_POWERDOWN(16, 16, 0),
214 .write = ad5660_write,
215 },
Michael Hennerichb5a49482010-11-22 11:15:23 +0100216};
217
Lars-Peter Clausen33ad6b22011-11-15 16:31:22 +0100218static int ad5446_read_raw(struct iio_dev *indio_dev,
219 struct iio_chan_spec const *chan,
220 int *val,
221 int *val2,
222 long m)
223{
224 struct ad5446_state *st = iio_priv(indio_dev);
225 unsigned long scale_uv;
226
227 switch (m) {
Lars-Peter Clausen5e06bdf2012-04-25 09:45:00 +0200228 case IIO_CHAN_INFO_RAW:
229 *val = st->cached_val;
230 return IIO_VAL_INT;
Lars-Peter Clausen33ad6b22011-11-15 16:31:22 +0100231 case IIO_CHAN_INFO_SCALE:
232 scale_uv = (st->vref_mv * 1000) >> chan->scan_type.realbits;
233 *val = scale_uv / 1000;
234 *val2 = (scale_uv % 1000) * 1000;
235 return IIO_VAL_INT_PLUS_MICRO;
236
237 }
238 return -EINVAL;
239}
240
241static int ad5446_write_raw(struct iio_dev *indio_dev,
242 struct iio_chan_spec const *chan,
243 int val,
244 int val2,
245 long mask)
246{
247 struct ad5446_state *st = iio_priv(indio_dev);
Lars-Peter Clausen07ffd0d2012-04-25 09:44:52 +0200248 int ret = 0;
Lars-Peter Clausen33ad6b22011-11-15 16:31:22 +0100249
250 switch (mask) {
Jonathan Cameron09f4eb42012-04-15 17:41:19 +0100251 case IIO_CHAN_INFO_RAW:
Lars-Peter Clausen33ad6b22011-11-15 16:31:22 +0100252 if (val >= (1 << chan->scan_type.realbits) || val < 0)
253 return -EINVAL;
254
255 val <<= chan->scan_type.shift;
256 mutex_lock(&indio_dev->mlock);
257 st->cached_val = val;
Lars-Peter Clausenaf836d92012-04-25 09:44:54 +0200258 if (!st->pwr_down)
Lars-Peter Clausencae329e2012-04-25 09:44:59 +0200259 ret = st->chip_info->write(st, val);
Lars-Peter Clausen33ad6b22011-11-15 16:31:22 +0100260 mutex_unlock(&indio_dev->mlock);
261 break;
262 default:
263 ret = -EINVAL;
264 }
265
266 return ret;
267}
268
Jonathan Cameron6fe81352011-05-18 14:42:37 +0100269static const struct iio_info ad5446_info = {
Lars-Peter Clausen33ad6b22011-11-15 16:31:22 +0100270 .read_raw = ad5446_read_raw,
271 .write_raw = ad5446_write_raw,
Jonathan Cameron73892662012-01-29 11:07:02 +0000272 .driver_module = THIS_MODULE,
273};
274
Michael Hennerichb5a49482010-11-22 11:15:23 +0100275static int __devinit ad5446_probe(struct spi_device *spi)
276{
277 struct ad5446_state *st;
Jonathan Cameron86729fc2011-06-27 13:07:33 +0100278 struct iio_dev *indio_dev;
279 struct regulator *reg;
Michael Hennerichb5a49482010-11-22 11:15:23 +0100280 int ret, voltage_uv = 0;
281
Jonathan Cameron86729fc2011-06-27 13:07:33 +0100282 reg = regulator_get(&spi->dev, "vcc");
283 if (!IS_ERR(reg)) {
284 ret = regulator_enable(reg);
Michael Hennerichb5a49482010-11-22 11:15:23 +0100285 if (ret)
286 goto error_put_reg;
287
Jonathan Cameron86729fc2011-06-27 13:07:33 +0100288 voltage_uv = regulator_get_voltage(reg);
Michael Hennerichb5a49482010-11-22 11:15:23 +0100289 }
290
Lars-Peter Clausen7cbb7532012-04-26 13:35:01 +0200291 indio_dev = iio_device_alloc(sizeof(*st));
Jonathan Cameron86729fc2011-06-27 13:07:33 +0100292 if (indio_dev == NULL) {
Michael Hennerichb5a49482010-11-22 11:15:23 +0100293 ret = -ENOMEM;
294 goto error_disable_reg;
295 }
Jonathan Cameron86729fc2011-06-27 13:07:33 +0100296 st = iio_priv(indio_dev);
297 st->chip_info =
298 &ad5446_chip_info_tbl[spi_get_device_id(spi)->driver_data];
299
300 spi_set_drvdata(spi, indio_dev);
301 st->reg = reg;
302 st->spi = spi;
Michael Hennerichb5a49482010-11-22 11:15:23 +0100303
Justin P. Mattock4abf6f82012-02-29 22:00:38 -0800304 /* Establish that the iio_dev is a child of the spi device */
Jonathan Cameron86729fc2011-06-27 13:07:33 +0100305 indio_dev->dev.parent = &spi->dev;
306 indio_dev->name = spi_get_device_id(spi)->name;
Lars-Peter Clausen83f0f572012-04-25 09:44:58 +0200307 indio_dev->info = &ad5446_info;
Jonathan Cameron86729fc2011-06-27 13:07:33 +0100308 indio_dev->modes = INDIO_DIRECT_MODE;
Lars-Peter Clausen33ad6b22011-11-15 16:31:22 +0100309 indio_dev->channels = &st->chip_info->channel;
310 indio_dev->num_channels = 1;
Michael Hennerichb5a49482010-11-22 11:15:23 +0100311
Lars-Peter Clausen09d48aa2012-06-04 11:36:13 +0200312 st->pwr_down_mode = MODE_PWRDWN_1k;
313
Lars-Peter Clausen4e5d3f92012-04-25 09:44:56 +0200314 if (st->chip_info->int_vref_mv)
Michael Hennerichbbed4dc2011-03-10 13:26:47 +0100315 st->vref_mv = st->chip_info->int_vref_mv;
Lars-Peter Clausen4e5d3f92012-04-25 09:44:56 +0200316 else if (voltage_uv)
317 st->vref_mv = voltage_uv / 1000;
318 else
319 dev_warn(&spi->dev, "reference voltage unspecified\n");
Michael Hennerichb5a49482010-11-22 11:15:23 +0100320
Jonathan Cameron86729fc2011-06-27 13:07:33 +0100321 ret = iio_device_register(indio_dev);
Michael Hennerichb5a49482010-11-22 11:15:23 +0100322 if (ret)
323 goto error_free_device;
324
325 return 0;
326
327error_free_device:
Lars-Peter Clausen7cbb7532012-04-26 13:35:01 +0200328 iio_device_free(indio_dev);
Michael Hennerichb5a49482010-11-22 11:15:23 +0100329error_disable_reg:
Jonathan Cameron86729fc2011-06-27 13:07:33 +0100330 if (!IS_ERR(reg))
331 regulator_disable(reg);
Michael Hennerichb5a49482010-11-22 11:15:23 +0100332error_put_reg:
Jonathan Cameron86729fc2011-06-27 13:07:33 +0100333 if (!IS_ERR(reg))
334 regulator_put(reg);
335
Michael Hennerichb5a49482010-11-22 11:15:23 +0100336 return ret;
337}
338
339static int ad5446_remove(struct spi_device *spi)
340{
Jonathan Cameron86729fc2011-06-27 13:07:33 +0100341 struct iio_dev *indio_dev = spi_get_drvdata(spi);
342 struct ad5446_state *st = iio_priv(indio_dev);
Michael Hennerichb5a49482010-11-22 11:15:23 +0100343
344 iio_device_unregister(indio_dev);
Jonathan Camerond2fffd62011-10-14 14:46:58 +0100345 if (!IS_ERR(st->reg)) {
346 regulator_disable(st->reg);
347 regulator_put(st->reg);
Michael Hennerichb5a49482010-11-22 11:15:23 +0100348 }
Lars-Peter Clausen7cbb7532012-04-26 13:35:01 +0200349 iio_device_free(indio_dev);
Jonathan Camerond2fffd62011-10-14 14:46:58 +0100350
Michael Hennerichb5a49482010-11-22 11:15:23 +0100351 return 0;
352}
353
354static const struct spi_device_id ad5446_id[] = {
355 {"ad5444", ID_AD5444},
356 {"ad5446", ID_AD5446},
Lars-Peter Clausen779c0c42012-06-26 10:45:43 +0200357 {"ad5450", ID_AD5450},
358 {"ad5451", ID_AD5451},
359 {"ad5452", ID_AD5444}, /* ad5452 is compatible to the ad5444 */
360 {"ad5453", ID_AD5446}, /* ad5453 is compatible to the ad5446 */
Michael Hennerichb5a49482010-11-22 11:15:23 +0100361 {"ad5512a", ID_AD5512A},
Michael Hennerich67d1c1f2011-04-15 13:51:07 +0200362 {"ad5541a", ID_AD5541A},
Lars-Peter Clausen11a7df42012-04-25 09:44:57 +0200363 {"ad5542a", ID_AD5541A}, /* ad5541a and ad5542a are compatible */
364 {"ad5543", ID_AD5541A}, /* ad5541a and ad5543 are compatible */
Michael Hennerichbd51c0b2011-03-10 13:26:46 +0100365 {"ad5553", ID_AD5553},
Michael Hennerich2b615352011-03-10 13:26:48 +0100366 {"ad5601", ID_AD5601},
367 {"ad5611", ID_AD5611},
368 {"ad5621", ID_AD5621},
Michael Hennerichd8462632010-11-23 11:14:16 +0100369 {"ad5620-2500", ID_AD5620_2500}, /* AD5620/40/60: */
370 {"ad5620-1250", ID_AD5620_1250}, /* part numbers may look differently */
371 {"ad5640-2500", ID_AD5640_2500},
372 {"ad5640-1250", ID_AD5640_1250},
373 {"ad5660-2500", ID_AD5660_2500},
374 {"ad5660-1250", ID_AD5660_1250},
Lars-Peter Clausen18e5ab32012-04-25 09:45:01 +0200375 {"ad5662", ID_AD5662},
Michael Hennerichb5a49482010-11-22 11:15:23 +0100376 {}
377};
Lars-Peter Clausen55e43902011-11-16 08:53:31 +0100378MODULE_DEVICE_TABLE(spi, ad5446_id);
Michael Hennerichb5a49482010-11-22 11:15:23 +0100379
380static struct spi_driver ad5446_driver = {
381 .driver = {
382 .name = "ad5446",
Michael Hennerichb5a49482010-11-22 11:15:23 +0100383 .owner = THIS_MODULE,
384 },
385 .probe = ad5446_probe,
386 .remove = __devexit_p(ad5446_remove),
387 .id_table = ad5446_id,
388};
Lars-Peter Clausenae6ae6f2011-11-16 10:13:39 +0100389module_spi_driver(ad5446_driver);
Michael Hennerichb5a49482010-11-22 11:15:23 +0100390
391MODULE_AUTHOR("Michael Hennerich <hennerich@blackfin.uclinux.org>");
392MODULE_DESCRIPTION("Analog Devices AD5444/AD5446 DAC");
393MODULE_LICENSE("GPL v2");