drm/client: Fix drm client endless Kconfig loop
[drm/drm-misc.git] / drivers / iio / accel / sca3300.c
blobca0ce83e42b2cec52219b91f3c5d513c9f80d55e
1 // SPDX-License-Identifier: GPL-2.0-only
2 /*
3 * Murata SCA3300 3-axis industrial accelerometer
5 * Copyright (c) 2021 Vaisala Oyj. All rights reserved.
6 */
8 #include <linux/bitops.h>
9 #include <linux/crc8.h>
10 #include <linux/delay.h>
11 #include <linux/kernel.h>
12 #include <linux/module.h>
13 #include <linux/spi/spi.h>
15 #include <linux/unaligned.h>
17 #include <linux/iio/buffer.h>
18 #include <linux/iio/iio.h>
19 #include <linux/iio/sysfs.h>
20 #include <linux/iio/trigger_consumer.h>
21 #include <linux/iio/triggered_buffer.h>
23 #define SCA3300_ALIAS "sca3300"
25 #define SCA3300_CRC8_POLYNOMIAL 0x1d
27 /* Device mode register */
28 #define SCA3300_REG_MODE 0xd
29 #define SCA3300_MODE_SW_RESET 0x20
31 /* Last register in map */
32 #define SCA3300_REG_SELBANK 0x1f
34 /* Device status and mask */
35 #define SCA3300_REG_STATUS 0x6
36 #define SCA3300_STATUS_MASK GENMASK(8, 0)
38 /* Device ID */
39 #define SCA3300_REG_WHOAMI 0x10
40 #define SCA3300_WHOAMI_ID 0x51
41 #define SCL3300_WHOAMI_ID 0xC1
43 /* Device return status and mask */
44 #define SCA3300_VALUE_RS_ERROR 0x3
45 #define SCA3300_MASK_RS_STATUS GENMASK(1, 0)
47 #define SCL3300_REG_ANG_CTRL 0x0C
48 #define SCL3300_ANG_ENABLE 0x1F
50 enum sca3300_scan_indexes {
51 SCA3300_ACC_X = 0,
52 SCA3300_ACC_Y,
53 SCA3300_ACC_Z,
54 SCA3300_TEMP,
55 SCA3300_INCLI_X,
56 SCA3300_INCLI_Y,
57 SCA3300_INCLI_Z,
58 SCA3300_SCAN_MAX
62 * Buffer size max case:
63 * Three accel channels, two bytes per channel.
64 * Temperature channel, two bytes.
65 * Three incli channels, two bytes per channel.
66 * Timestamp channel, eight bytes.
68 #define SCA3300_MAX_BUFFER_SIZE (ALIGN(sizeof(s16) * SCA3300_SCAN_MAX, sizeof(s64)) + sizeof(s64))
70 #define SCA3300_ACCEL_CHANNEL(index, reg, axis) { \
71 .type = IIO_ACCEL, \
72 .address = reg, \
73 .modified = 1, \
74 .channel2 = IIO_MOD_##axis, \
75 .info_mask_separate = BIT(IIO_CHAN_INFO_RAW), \
76 .info_mask_shared_by_type = \
77 BIT(IIO_CHAN_INFO_SCALE) | \
78 BIT(IIO_CHAN_INFO_LOW_PASS_FILTER_3DB_FREQUENCY), \
79 .info_mask_shared_by_type_available = \
80 BIT(IIO_CHAN_INFO_SCALE) | \
81 BIT(IIO_CHAN_INFO_LOW_PASS_FILTER_3DB_FREQUENCY), \
82 .scan_index = index, \
83 .scan_type = { \
84 .sign = 's', \
85 .realbits = 16, \
86 .storagebits = 16, \
87 .endianness = IIO_CPU, \
88 }, \
91 #define SCA3300_INCLI_CHANNEL(index, reg, axis) { \
92 .type = IIO_INCLI, \
93 .address = reg, \
94 .modified = 1, \
95 .channel2 = IIO_MOD_##axis, \
96 .info_mask_shared_by_type = BIT(IIO_CHAN_INFO_SCALE), \
97 .info_mask_separate = BIT(IIO_CHAN_INFO_RAW), \
98 .info_mask_shared_by_type_available = BIT(IIO_CHAN_INFO_SCALE), \
99 .scan_index = index, \
100 .scan_type = { \
101 .sign = 's', \
102 .realbits = 16, \
103 .storagebits = 16, \
104 .endianness = IIO_CPU, \
105 }, \
108 #define SCA3300_TEMP_CHANNEL(index, reg) { \
109 .type = IIO_TEMP, \
110 .address = reg, \
111 .scan_index = index, \
112 .info_mask_separate = BIT(IIO_CHAN_INFO_RAW), \
113 .scan_type = { \
114 .sign = 's', \
115 .realbits = 16, \
116 .storagebits = 16, \
117 .endianness = IIO_CPU, \
118 }, \
121 static const struct iio_chan_spec sca3300_channels[] = {
122 SCA3300_ACCEL_CHANNEL(SCA3300_ACC_X, 0x1, X),
123 SCA3300_ACCEL_CHANNEL(SCA3300_ACC_Y, 0x2, Y),
124 SCA3300_ACCEL_CHANNEL(SCA3300_ACC_Z, 0x3, Z),
125 SCA3300_TEMP_CHANNEL(SCA3300_TEMP, 0x05),
126 IIO_CHAN_SOFT_TIMESTAMP(4),
129 static const int sca3300_lp_freq[] = {70, 10};
130 static const int sca3300_lp_freq_map[] = {0, 0, 0, 1};
132 static const int scl3300_lp_freq[] = {40, 70, 10};
133 static const int scl3300_lp_freq_map[] = {0, 1, 2};
135 static const int sca3300_accel_scale[][2] = {{0, 370}, {0, 741}, {0, 185}};
136 static const int sca3300_accel_scale_map[] = {0, 1, 2, 2};
138 static const int scl3300_accel_scale[][2] = {{0, 167}, {0, 333}, {0, 83}};
139 static const int scl3300_accel_scale_map[] = {0, 1, 2};
141 static const int scl3300_incli_scale[][2] = {{0, 5495}};
142 static const int scl3300_incli_scale_map[] = {0, 0, 0};
144 static const int sca3300_avail_modes_map[] = {0, 1, 2, 3};
145 static const int scl3300_avail_modes_map[] = {0, 1, 3};
147 static const struct iio_chan_spec scl3300_channels[] = {
148 SCA3300_ACCEL_CHANNEL(SCA3300_ACC_X, 0x1, X),
149 SCA3300_ACCEL_CHANNEL(SCA3300_ACC_Y, 0x2, Y),
150 SCA3300_ACCEL_CHANNEL(SCA3300_ACC_Z, 0x3, Z),
151 SCA3300_TEMP_CHANNEL(SCA3300_TEMP, 0x05),
152 SCA3300_INCLI_CHANNEL(SCA3300_INCLI_X, 0x09, X),
153 SCA3300_INCLI_CHANNEL(SCA3300_INCLI_Y, 0x0A, Y),
154 SCA3300_INCLI_CHANNEL(SCA3300_INCLI_Z, 0x0B, Z),
155 IIO_CHAN_SOFT_TIMESTAMP(7),
158 static const unsigned long sca3300_scan_masks[] = {
159 BIT(SCA3300_ACC_X) | BIT(SCA3300_ACC_Y) | BIT(SCA3300_ACC_Z) |
160 BIT(SCA3300_TEMP),
164 static const unsigned long scl3300_scan_masks[] = {
165 BIT(SCA3300_ACC_X) | BIT(SCA3300_ACC_Y) | BIT(SCA3300_ACC_Z) |
166 BIT(SCA3300_TEMP) |
167 BIT(SCA3300_INCLI_X) | BIT(SCA3300_INCLI_Y) | BIT(SCA3300_INCLI_Z),
171 struct sca3300_chip_info {
172 const char *name;
173 const unsigned long *scan_masks;
174 const struct iio_chan_spec *channels;
175 u8 num_channels;
176 u8 num_accel_scales;
177 const int (*accel_scale)[2];
178 const int *accel_scale_map;
179 const int (*incli_scale)[2];
180 const int *incli_scale_map;
181 u8 num_incli_scales;
182 u8 num_freqs;
183 const int *freq_table;
184 const int *freq_map;
185 const int *avail_modes_table;
186 u8 num_avail_modes;
187 u8 chip_id;
188 bool angle_supported;
192 * struct sca3300_data - device data
193 * @spi: SPI device structure
194 * @lock: Data buffer lock
195 * @chip: Sensor chip specific information
196 * @buffer: Triggered buffer:
197 * -SCA3300: 4 channel 16-bit data + 64-bit timestamp
198 * -SCL3300: 7 channel 16-bit data + 64-bit timestamp
199 * @txbuf: Transmit buffer
200 * @rxbuf: Receive buffer
202 struct sca3300_data {
203 struct spi_device *spi;
204 struct mutex lock;
205 const struct sca3300_chip_info *chip;
206 u8 buffer[SCA3300_MAX_BUFFER_SIZE] __aligned(sizeof(s64));
207 u8 txbuf[4] __aligned(IIO_DMA_MINALIGN);
208 u8 rxbuf[4];
211 static const struct sca3300_chip_info sca3300_chip_tbl[] = {
213 .name = "sca3300",
214 .scan_masks = sca3300_scan_masks,
215 .channels = sca3300_channels,
216 .num_channels = ARRAY_SIZE(sca3300_channels),
217 .num_accel_scales = ARRAY_SIZE(sca3300_accel_scale)*2,
218 .accel_scale = sca3300_accel_scale,
219 .accel_scale_map = sca3300_accel_scale_map,
220 .num_freqs = ARRAY_SIZE(sca3300_lp_freq),
221 .freq_table = sca3300_lp_freq,
222 .freq_map = sca3300_lp_freq_map,
223 .avail_modes_table = sca3300_avail_modes_map,
224 .num_avail_modes = 4,
225 .chip_id = SCA3300_WHOAMI_ID,
226 .angle_supported = false,
229 .name = "scl3300",
230 .scan_masks = scl3300_scan_masks,
231 .channels = scl3300_channels,
232 .num_channels = ARRAY_SIZE(scl3300_channels),
233 .num_accel_scales = ARRAY_SIZE(scl3300_accel_scale)*2,
234 .accel_scale = scl3300_accel_scale,
235 .accel_scale_map = scl3300_accel_scale_map,
236 .incli_scale = scl3300_incli_scale,
237 .incli_scale_map = scl3300_incli_scale_map,
238 .num_incli_scales = ARRAY_SIZE(scl3300_incli_scale)*2,
239 .num_freqs = ARRAY_SIZE(scl3300_lp_freq),
240 .freq_table = scl3300_lp_freq,
241 .freq_map = scl3300_lp_freq_map,
242 .avail_modes_table = scl3300_avail_modes_map,
243 .num_avail_modes = 3,
244 .chip_id = SCL3300_WHOAMI_ID,
245 .angle_supported = true,
249 DECLARE_CRC8_TABLE(sca3300_crc_table);
251 static int sca3300_transfer(struct sca3300_data *sca_data, int *val)
253 /* Consecutive requests min. 10 us delay (Datasheet section 5.1.2) */
254 struct spi_delay delay = { .value = 10, .unit = SPI_DELAY_UNIT_USECS };
255 int32_t ret;
256 int rs;
257 u8 crc;
258 struct spi_transfer xfers[2] = {
260 .tx_buf = sca_data->txbuf,
261 .len = ARRAY_SIZE(sca_data->txbuf),
262 .delay = delay,
263 .cs_change = 1,
266 .rx_buf = sca_data->rxbuf,
267 .len = ARRAY_SIZE(sca_data->rxbuf),
268 .delay = delay,
272 /* inverted crc value as described in device data sheet */
273 crc = ~crc8(sca3300_crc_table, &sca_data->txbuf[0], 3, CRC8_INIT_VALUE);
274 sca_data->txbuf[3] = crc;
276 ret = spi_sync_transfer(sca_data->spi, xfers, ARRAY_SIZE(xfers));
277 if (ret) {
278 dev_err(&sca_data->spi->dev,
279 "transfer error, error: %d\n", ret);
280 return -EIO;
283 crc = ~crc8(sca3300_crc_table, &sca_data->rxbuf[0], 3, CRC8_INIT_VALUE);
284 if (sca_data->rxbuf[3] != crc) {
285 dev_err(&sca_data->spi->dev, "CRC checksum mismatch");
286 return -EIO;
289 /* get return status */
290 rs = sca_data->rxbuf[0] & SCA3300_MASK_RS_STATUS;
291 if (rs == SCA3300_VALUE_RS_ERROR)
292 ret = -EINVAL;
294 *val = sign_extend32(get_unaligned_be16(&sca_data->rxbuf[1]), 15);
296 return ret;
299 static int sca3300_error_handler(struct sca3300_data *sca_data)
301 int ret;
302 int val;
304 mutex_lock(&sca_data->lock);
305 sca_data->txbuf[0] = SCA3300_REG_STATUS << 2;
306 ret = sca3300_transfer(sca_data, &val);
307 mutex_unlock(&sca_data->lock);
309 * Return status error is cleared after reading status register once,
310 * expect EINVAL here.
312 if (ret != -EINVAL) {
313 dev_err(&sca_data->spi->dev,
314 "error reading device status: %d\n", ret);
315 return ret;
318 dev_err(&sca_data->spi->dev, "device status: 0x%lx\n",
319 val & SCA3300_STATUS_MASK);
321 return 0;
324 static int sca3300_read_reg(struct sca3300_data *sca_data, u8 reg, int *val)
326 int ret;
328 mutex_lock(&sca_data->lock);
329 sca_data->txbuf[0] = reg << 2;
330 ret = sca3300_transfer(sca_data, val);
331 mutex_unlock(&sca_data->lock);
332 if (ret != -EINVAL)
333 return ret;
335 return sca3300_error_handler(sca_data);
338 static int sca3300_write_reg(struct sca3300_data *sca_data, u8 reg, int val)
340 int reg_val = 0;
341 int ret;
343 mutex_lock(&sca_data->lock);
344 /* BIT(7) for write operation */
345 sca_data->txbuf[0] = BIT(7) | (reg << 2);
346 put_unaligned_be16(val, &sca_data->txbuf[1]);
347 ret = sca3300_transfer(sca_data, &reg_val);
348 mutex_unlock(&sca_data->lock);
349 if (ret != -EINVAL)
350 return ret;
352 return sca3300_error_handler(sca_data);
355 static int sca3300_set_op_mode(struct sca3300_data *sca_data, int index)
357 if ((index < 0) || (index >= sca_data->chip->num_avail_modes))
358 return -EINVAL;
360 return sca3300_write_reg(sca_data, SCA3300_REG_MODE,
361 sca_data->chip->avail_modes_table[index]);
364 static int sca3300_get_op_mode(struct sca3300_data *sca_data, int *index)
366 int reg_val;
367 int ret;
368 int i;
370 ret = sca3300_read_reg(sca_data, SCA3300_REG_MODE, &reg_val);
371 if (ret)
372 return ret;
374 for (i = 0; i < sca_data->chip->num_avail_modes; i++) {
375 if (sca_data->chip->avail_modes_table[i] == reg_val)
376 break;
378 if (i == sca_data->chip->num_avail_modes)
379 return -EINVAL;
381 *index = i;
382 return 0;
385 static int sca3300_set_frequency(struct sca3300_data *data, int val)
387 const struct sca3300_chip_info *chip = data->chip;
388 unsigned int index;
389 int *opmode_scale;
390 int *new_scale;
391 unsigned int i;
393 if (sca3300_get_op_mode(data, &index))
394 return -EINVAL;
397 * Find a mode in which the requested sampling frequency is available
398 * and the scaling currently set is retained.
400 opmode_scale = (int *)chip->accel_scale[chip->accel_scale_map[index]];
401 for (i = 0; i < chip->num_avail_modes; i++) {
402 new_scale = (int *)chip->accel_scale[chip->accel_scale_map[i]];
403 if ((val == chip->freq_table[chip->freq_map[i]]) &&
404 (opmode_scale[1] == new_scale[1]) &&
405 (opmode_scale[0] == new_scale[0]))
406 break;
408 if (i == chip->num_avail_modes)
409 return -EINVAL;
411 return sca3300_set_op_mode(data, i);
414 static int sca3300_write_raw(struct iio_dev *indio_dev,
415 struct iio_chan_spec const *chan,
416 int val, int val2, long mask)
418 struct sca3300_data *data = iio_priv(indio_dev);
419 int index;
420 int i;
422 switch (mask) {
423 case IIO_CHAN_INFO_SCALE:
424 if (chan->type != IIO_ACCEL)
425 return -EINVAL;
427 * Letting scale take priority over sampling frequency.
428 * That makes sense given we can only ever end up increasing
429 * the sampling frequency which is unlikely to be a problem.
431 for (i = 0; i < data->chip->num_avail_modes; i++) {
432 index = data->chip->accel_scale_map[i];
433 if ((val == data->chip->accel_scale[index][0]) &&
434 (val2 == data->chip->accel_scale[index][1]))
435 return sca3300_set_op_mode(data, i);
437 return -EINVAL;
438 case IIO_CHAN_INFO_LOW_PASS_FILTER_3DB_FREQUENCY:
439 return sca3300_set_frequency(data, val);
440 default:
441 return -EINVAL;
445 static int sca3300_read_raw(struct iio_dev *indio_dev,
446 struct iio_chan_spec const *chan,
447 int *val, int *val2, long mask)
449 struct sca3300_data *data = iio_priv(indio_dev);
450 int index;
451 int ret;
453 switch (mask) {
454 case IIO_CHAN_INFO_RAW:
455 ret = sca3300_read_reg(data, chan->address, val);
456 if (ret)
457 return ret;
458 return IIO_VAL_INT;
459 case IIO_CHAN_INFO_SCALE:
460 ret = sca3300_get_op_mode(data, &index);
461 if (ret)
462 return ret;
463 switch (chan->type) {
464 case IIO_INCLI:
465 index = data->chip->incli_scale_map[index];
466 *val = data->chip->incli_scale[index][0];
467 *val2 = data->chip->incli_scale[index][1];
468 return IIO_VAL_INT_PLUS_MICRO;
469 case IIO_ACCEL:
470 index = data->chip->accel_scale_map[index];
471 *val = data->chip->accel_scale[index][0];
472 *val2 = data->chip->accel_scale[index][1];
473 return IIO_VAL_INT_PLUS_MICRO;
474 default:
475 return -EINVAL;
477 case IIO_CHAN_INFO_LOW_PASS_FILTER_3DB_FREQUENCY:
478 ret = sca3300_get_op_mode(data, &index);
479 if (ret)
480 return ret;
481 index = data->chip->freq_map[index];
482 *val = data->chip->freq_table[index];
483 return IIO_VAL_INT;
484 default:
485 return -EINVAL;
489 static irqreturn_t sca3300_trigger_handler(int irq, void *p)
491 struct iio_poll_func *pf = p;
492 struct iio_dev *indio_dev = pf->indio_dev;
493 struct sca3300_data *data = iio_priv(indio_dev);
494 int bit, ret, val, i = 0;
495 s16 *channels = (s16 *)data->buffer;
497 iio_for_each_active_channel(indio_dev, bit) {
498 ret = sca3300_read_reg(data, indio_dev->channels[bit].address, &val);
499 if (ret) {
500 dev_err_ratelimited(&data->spi->dev,
501 "failed to read register, error: %d\n", ret);
502 /* handled, but bailing out due to errors */
503 goto out;
505 channels[i++] = val;
508 iio_push_to_buffers_with_timestamp(indio_dev, data->buffer,
509 iio_get_time_ns(indio_dev));
510 out:
511 iio_trigger_notify_done(indio_dev->trig);
513 return IRQ_HANDLED;
517 * sca3300_init - Device init sequence. See datasheet rev 2 section
518 * 4.2 Start-Up Sequence for details.
520 static int sca3300_init(struct sca3300_data *sca_data,
521 struct iio_dev *indio_dev)
523 int value = 0;
524 int ret;
525 int i;
527 ret = sca3300_write_reg(sca_data, SCA3300_REG_MODE,
528 SCA3300_MODE_SW_RESET);
529 if (ret)
530 return ret;
533 * Wait 1ms after SW-reset command.
534 * Wait for the settling of signal paths,
535 * 15ms for SCA3300 and 25ms for SCL3300,
537 usleep_range(26e3, 50e3);
539 ret = sca3300_read_reg(sca_data, SCA3300_REG_WHOAMI, &value);
540 if (ret)
541 return ret;
543 for (i = 0; i < ARRAY_SIZE(sca3300_chip_tbl); i++) {
544 if (sca3300_chip_tbl[i].chip_id == value)
545 break;
547 if (i == ARRAY_SIZE(sca3300_chip_tbl)) {
548 dev_err(&sca_data->spi->dev, "unknown chip id %x\n", value);
549 return -ENODEV;
552 sca_data->chip = &sca3300_chip_tbl[i];
554 if (sca_data->chip->angle_supported) {
555 ret = sca3300_write_reg(sca_data, SCL3300_REG_ANG_CTRL,
556 SCL3300_ANG_ENABLE);
557 if (ret)
558 return ret;
561 return 0;
564 static int sca3300_debugfs_reg_access(struct iio_dev *indio_dev,
565 unsigned int reg, unsigned int writeval,
566 unsigned int *readval)
568 struct sca3300_data *data = iio_priv(indio_dev);
569 int value;
570 int ret;
572 if (reg > SCA3300_REG_SELBANK)
573 return -EINVAL;
575 if (!readval)
576 return sca3300_write_reg(data, reg, writeval);
578 ret = sca3300_read_reg(data, reg, &value);
579 if (ret)
580 return ret;
582 *readval = value;
584 return 0;
587 static int sca3300_read_avail(struct iio_dev *indio_dev,
588 struct iio_chan_spec const *chan,
589 const int **vals, int *type, int *length,
590 long mask)
592 struct sca3300_data *data = iio_priv(indio_dev);
593 switch (mask) {
594 case IIO_CHAN_INFO_SCALE:
595 switch (chan->type) {
596 case IIO_INCLI:
597 *vals = (const int *)data->chip->incli_scale;
598 *length = data->chip->num_incli_scales;
599 *type = IIO_VAL_INT_PLUS_MICRO;
600 return IIO_AVAIL_LIST;
601 case IIO_ACCEL:
602 *vals = (const int *)data->chip->accel_scale;
603 *length = data->chip->num_accel_scales;
604 *type = IIO_VAL_INT_PLUS_MICRO;
605 return IIO_AVAIL_LIST;
606 default:
607 return -EINVAL;
609 case IIO_CHAN_INFO_LOW_PASS_FILTER_3DB_FREQUENCY:
610 *vals = (const int *)data->chip->freq_table;
611 *length = data->chip->num_freqs;
612 *type = IIO_VAL_INT;
613 return IIO_AVAIL_LIST;
614 default:
615 return -EINVAL;
619 static const struct iio_info sca3300_info = {
620 .read_raw = sca3300_read_raw,
621 .write_raw = sca3300_write_raw,
622 .debugfs_reg_access = &sca3300_debugfs_reg_access,
623 .read_avail = sca3300_read_avail,
626 static int sca3300_probe(struct spi_device *spi)
628 struct sca3300_data *sca_data;
629 struct iio_dev *indio_dev;
630 int ret;
632 indio_dev = devm_iio_device_alloc(&spi->dev, sizeof(*sca_data));
633 if (!indio_dev)
634 return -ENOMEM;
636 sca_data = iio_priv(indio_dev);
637 mutex_init(&sca_data->lock);
638 sca_data->spi = spi;
640 crc8_populate_msb(sca3300_crc_table, SCA3300_CRC8_POLYNOMIAL);
642 indio_dev->info = &sca3300_info;
644 ret = sca3300_init(sca_data, indio_dev);
645 if (ret) {
646 dev_err(&spi->dev, "failed to init device, error: %d\n", ret);
647 return ret;
650 indio_dev->name = sca_data->chip->name;
651 indio_dev->modes = INDIO_DIRECT_MODE;
652 indio_dev->channels = sca_data->chip->channels;
653 indio_dev->num_channels = sca_data->chip->num_channels;
654 indio_dev->available_scan_masks = sca_data->chip->scan_masks;
656 ret = devm_iio_triggered_buffer_setup(&spi->dev, indio_dev,
657 iio_pollfunc_store_time,
658 sca3300_trigger_handler, NULL);
659 if (ret) {
660 dev_err(&spi->dev,
661 "iio triggered buffer setup failed, error: %d\n", ret);
662 return ret;
665 ret = devm_iio_device_register(&spi->dev, indio_dev);
666 if (ret) {
667 dev_err(&spi->dev, "iio device register failed, error: %d\n",
668 ret);
671 return ret;
674 static const struct of_device_id sca3300_dt_ids[] = {
675 { .compatible = "murata,sca3300"},
676 { .compatible = "murata,scl3300"},
679 MODULE_DEVICE_TABLE(of, sca3300_dt_ids);
681 static const struct spi_device_id sca3300_ids[] = {
682 { "sca3300" },
683 { "scl3300" },
686 MODULE_DEVICE_TABLE(spi, sca3300_ids);
688 static struct spi_driver sca3300_driver = {
689 .driver = {
690 .name = SCA3300_ALIAS,
691 .of_match_table = sca3300_dt_ids,
693 .probe = sca3300_probe,
694 .id_table = sca3300_ids,
696 module_spi_driver(sca3300_driver);
698 MODULE_AUTHOR("Tomas Melin <tomas.melin@vaisala.com>");
699 MODULE_DESCRIPTION("Murata SCA3300 SPI Accelerometer");
700 MODULE_LICENSE("GPL v2");