aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/staging
diff options
context:
space:
mode:
authorLars-Peter Clausen <lars@metafoo.de>2016-03-07 09:22:31 -0500
committerJonathan Cameron <jic23@kernel.org>2016-03-09 16:06:02 -0500
commit88ae3aedb8ec20a6b6ea8f7bd1990c0eb7c6f5d5 (patch)
treeff59c074d42dfc8e2e2362f695019d3d5851a847 /drivers/staging
parente84a41d5db891eab6f1f4a2625bb97f3c6415eee (diff)
staging:iio:adis16204: Remove adis16204 driver
The ADIS16204 part has been obsoleted, which makes it hard to get the hardware to even test the driver. Considering this there is no expectation that the driver will be cleaned up and be able to move out of staging, so remove the driver. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Diffstat (limited to 'drivers/staging')
-rw-r--r--drivers/staging/iio/accel/Kconfig12
-rw-r--r--drivers/staging/iio/accel/Makefile3
-rw-r--r--drivers/staging/iio/accel/adis16204.h68
-rw-r--r--drivers/staging/iio/accel/adis16204_core.c253
4 files changed, 0 insertions, 336 deletions
diff --git a/drivers/staging/iio/accel/Kconfig b/drivers/staging/iio/accel/Kconfig
index fa67da9408b6..5bc98031a34d 100644
--- a/drivers/staging/iio/accel/Kconfig
+++ b/drivers/staging/iio/accel/Kconfig
@@ -27,18 +27,6 @@ config ADIS16203
27 To compile this driver as a module, say M here: the module will be 27 To compile this driver as a module, say M here: the module will be
28 called adis16203. 28 called adis16203.
29 29
30config ADIS16204
31 tristate "Analog Devices ADIS16204 Programmable High-g Digital Impact Sensor and Recorder"
32 depends on SPI
33 select IIO_ADIS_LIB
34 select IIO_ADIS_LIB_BUFFER if IIO_BUFFER
35 help
36 Say Y here to build support for Analog Devices adis16204 Programmable
37 High-g Digital Impact Sensor and Recorder.
38
39 To compile this driver as a module, say M here: the module will be
40 called adis16204.
41
42config ADIS16209 30config ADIS16209
43 tristate "Analog Devices ADIS16209 Dual-Axis Digital Inclinometer and Accelerometer" 31 tristate "Analog Devices ADIS16209 Dual-Axis Digital Inclinometer and Accelerometer"
44 depends on SPI 32 depends on SPI
diff --git a/drivers/staging/iio/accel/Makefile b/drivers/staging/iio/accel/Makefile
index 1ed137f1a506..8ad9732e3dbb 100644
--- a/drivers/staging/iio/accel/Makefile
+++ b/drivers/staging/iio/accel/Makefile
@@ -8,9 +8,6 @@ obj-$(CONFIG_ADIS16201) += adis16201.o
8adis16203-y := adis16203_core.o 8adis16203-y := adis16203_core.o
9obj-$(CONFIG_ADIS16203) += adis16203.o 9obj-$(CONFIG_ADIS16203) += adis16203.o
10 10
11adis16204-y := adis16204_core.o
12obj-$(CONFIG_ADIS16204) += adis16204.o
13
14adis16209-y := adis16209_core.o 11adis16209-y := adis16209_core.o
15obj-$(CONFIG_ADIS16209) += adis16209.o 12obj-$(CONFIG_ADIS16209) += adis16209.o
16 13
diff --git a/drivers/staging/iio/accel/adis16204.h b/drivers/staging/iio/accel/adis16204.h
deleted file mode 100644
index 0b23f0b5c52f..000000000000
--- a/drivers/staging/iio/accel/adis16204.h
+++ /dev/null
@@ -1,68 +0,0 @@
1#ifndef SPI_ADIS16204_H_
2#define SPI_ADIS16204_H_
3
4#define ADIS16204_STARTUP_DELAY 220 /* ms */
5
6#define ADIS16204_FLASH_CNT 0x00 /* Flash memory write count */
7#define ADIS16204_SUPPLY_OUT 0x02 /* Output, power supply */
8#define ADIS16204_XACCL_OUT 0x04 /* Output, x-axis accelerometer */
9#define ADIS16204_YACCL_OUT 0x06 /* Output, y-axis accelerometer */
10#define ADIS16204_AUX_ADC 0x08 /* Output, auxiliary ADC input */
11#define ADIS16204_TEMP_OUT 0x0A /* Output, temperature */
12#define ADIS16204_X_PEAK_OUT 0x0C /* Twos complement */
13#define ADIS16204_Y_PEAK_OUT 0x0E /* Twos complement */
14#define ADIS16204_XACCL_NULL 0x10 /* Calibration, x-axis acceleration offset null */
15#define ADIS16204_YACCL_NULL 0x12 /* Calibration, y-axis acceleration offset null */
16#define ADIS16204_XACCL_SCALE 0x14 /* X-axis scale factor calibration register */
17#define ADIS16204_YACCL_SCALE 0x16 /* Y-axis scale factor calibration register */
18#define ADIS16204_XY_RSS_OUT 0x18 /* XY combined acceleration (RSS) */
19#define ADIS16204_XY_PEAK_OUT 0x1A /* Peak, XY combined output (RSS) */
20#define ADIS16204_CAP_BUF_1 0x1C /* Capture buffer output register 1 */
21#define ADIS16204_CAP_BUF_2 0x1E /* Capture buffer output register 2 */
22#define ADIS16204_ALM_MAG1 0x20 /* Alarm 1 amplitude threshold */
23#define ADIS16204_ALM_MAG2 0x22 /* Alarm 2 amplitude threshold */
24#define ADIS16204_ALM_CTRL 0x28 /* Alarm control */
25#define ADIS16204_CAPT_PNTR 0x2A /* Capture register address pointer */
26#define ADIS16204_AUX_DAC 0x30 /* Auxiliary DAC data */
27#define ADIS16204_GPIO_CTRL 0x32 /* General-purpose digital input/output control */
28#define ADIS16204_MSC_CTRL 0x34 /* Miscellaneous control */
29#define ADIS16204_SMPL_PRD 0x36 /* Internal sample period (rate) control */
30#define ADIS16204_AVG_CNT 0x38 /* Operation, filter configuration */
31#define ADIS16204_SLP_CNT 0x3A /* Operation, sleep mode control */
32#define ADIS16204_DIAG_STAT 0x3C /* Diagnostics, system status register */
33#define ADIS16204_GLOB_CMD 0x3E /* Operation, system command register */
34
35/* MSC_CTRL */
36#define ADIS16204_MSC_CTRL_PWRUP_SELF_TEST BIT(10) /* Self-test at power-on: 1 = disabled, 0 = enabled */
37#define ADIS16204_MSC_CTRL_SELF_TEST_EN BIT(8) /* Self-test enable */
38#define ADIS16204_MSC_CTRL_DATA_RDY_EN BIT(2) /* Data-ready enable: 1 = enabled, 0 = disabled */
39#define ADIS16204_MSC_CTRL_ACTIVE_HIGH BIT(1) /* Data-ready polarity: 1 = active high, 0 = active low */
40#define ADIS16204_MSC_CTRL_DATA_RDY_DIO2 BIT(0) /* Data-ready line selection: 1 = DIO2, 0 = DIO1 */
41
42/* DIAG_STAT */
43#define ADIS16204_DIAG_STAT_ALARM2 BIT(9) /* Alarm 2 status: 1 = alarm active, 0 = alarm inactive */
44#define ADIS16204_DIAG_STAT_ALARM1 BIT(8) /* Alarm 1 status: 1 = alarm active, 0 = alarm inactive */
45#define ADIS16204_DIAG_STAT_SELFTEST_FAIL_BIT 5 /* Self-test diagnostic error flag: 1 = error condition,
46 0 = normal operation */
47#define ADIS16204_DIAG_STAT_SPI_FAIL_BIT 3 /* SPI communications failure */
48#define ADIS16204_DIAG_STAT_FLASH_UPT_BIT 2 /* Flash update failure */
49#define ADIS16204_DIAG_STAT_POWER_HIGH_BIT 1 /* Power supply above 3.625 V */
50#define ADIS16204_DIAG_STAT_POWER_LOW_BIT 0 /* Power supply below 2.975 V */
51
52/* GLOB_CMD */
53#define ADIS16204_GLOB_CMD_SW_RESET BIT(7)
54#define ADIS16204_GLOB_CMD_CLEAR_STAT BIT(4)
55#define ADIS16204_GLOB_CMD_FACTORY_CAL BIT(1)
56
57#define ADIS16204_ERROR_ACTIVE BIT(14)
58
59enum adis16204_scan {
60 ADIS16204_SCAN_ACC_X,
61 ADIS16204_SCAN_ACC_Y,
62 ADIS16204_SCAN_ACC_XY,
63 ADIS16204_SCAN_SUPPLY,
64 ADIS16204_SCAN_AUX_ADC,
65 ADIS16204_SCAN_TEMP,
66};
67
68#endif /* SPI_ADIS16204_H_ */
diff --git a/drivers/staging/iio/accel/adis16204_core.c b/drivers/staging/iio/accel/adis16204_core.c
deleted file mode 100644
index 20a9df64f1ed..000000000000
--- a/drivers/staging/iio/accel/adis16204_core.c
+++ /dev/null
@@ -1,253 +0,0 @@
1/*
2 * ADIS16204 Programmable High-g Digital Impact Sensor and Recorder
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/irq.h>
11#include <linux/delay.h>
12#include <linux/mutex.h>
13#include <linux/device.h>
14#include <linux/kernel.h>
15#include <linux/spi/spi.h>
16#include <linux/slab.h>
17#include <linux/sysfs.h>
18#include <linux/list.h>
19#include <linux/module.h>
20
21#include <linux/iio/iio.h>
22#include <linux/iio/sysfs.h>
23#include <linux/iio/buffer.h>
24#include <linux/iio/imu/adis.h>
25
26#include "adis16204.h"
27
28/* Unique to this driver currently */
29
30static const u8 adis16204_addresses[][2] = {
31 [ADIS16204_SCAN_ACC_X] = { ADIS16204_XACCL_NULL, ADIS16204_X_PEAK_OUT },
32 [ADIS16204_SCAN_ACC_Y] = { ADIS16204_YACCL_NULL, ADIS16204_Y_PEAK_OUT },
33 [ADIS16204_SCAN_ACC_XY] = { 0, ADIS16204_XY_PEAK_OUT },
34};
35
36static int adis16204_read_raw(struct iio_dev *indio_dev,
37 struct iio_chan_spec const *chan,
38 int *val, int *val2,
39 long mask)
40{
41 struct adis *st = iio_priv(indio_dev);
42 int ret;
43 int bits;
44 u8 addr;
45 s16 val16;
46 int addrind;
47
48 switch (mask) {
49 case IIO_CHAN_INFO_RAW:
50 return adis_single_conversion(indio_dev, chan,
51 ADIS16204_ERROR_ACTIVE, val);
52 case IIO_CHAN_INFO_SCALE:
53 switch (chan->type) {
54 case IIO_VOLTAGE:
55 if (chan->channel == 0) {
56 *val = 1;
57 *val2 = 220000; /* 1.22 mV */
58 } else {
59 *val = 0;
60 *val2 = 610000; /* 0.61 mV */
61 }
62 return IIO_VAL_INT_PLUS_MICRO;
63 case IIO_TEMP:
64 *val = -470; /* 0.47 C */
65 *val2 = 0;
66 return IIO_VAL_INT_PLUS_MICRO;
67 case IIO_ACCEL:
68 *val = 0;
69 switch (chan->channel2) {
70 case IIO_MOD_X:
71 case IIO_MOD_ROOT_SUM_SQUARED_X_Y:
72 *val2 = IIO_G_TO_M_S_2(17125); /* 17.125 mg */
73 break;
74 case IIO_MOD_Y:
75 case IIO_MOD_Z:
76 *val2 = IIO_G_TO_M_S_2(8407); /* 8.407 mg */
77 break;
78 }
79 return IIO_VAL_INT_PLUS_MICRO;
80 default:
81 return -EINVAL;
82 }
83 break;
84 case IIO_CHAN_INFO_OFFSET:
85 *val = 25000 / -470 - 1278; /* 25 C = 1278 */
86 return IIO_VAL_INT;
87 case IIO_CHAN_INFO_CALIBBIAS:
88 case IIO_CHAN_INFO_PEAK:
89 if (mask == IIO_CHAN_INFO_CALIBBIAS) {
90 bits = 12;
91 addrind = 0;
92 } else { /* PEAK_SEPARATE */
93 bits = 14;
94 addrind = 1;
95 }
96 mutex_lock(&indio_dev->mlock);
97 addr = adis16204_addresses[chan->scan_index][addrind];
98 ret = adis_read_reg_16(st, addr, &val16);
99 if (ret) {
100 mutex_unlock(&indio_dev->mlock);
101 return ret;
102 }
103 val16 &= (1 << bits) - 1;
104 val16 = (s16)(val16 << (16 - bits)) >> (16 - bits);
105 *val = val16;
106 mutex_unlock(&indio_dev->mlock);
107 return IIO_VAL_INT;
108 }
109 return -EINVAL;
110}
111
112static int adis16204_write_raw(struct iio_dev *indio_dev,
113 struct iio_chan_spec const *chan,
114 int val,
115 int val2,
116 long mask)
117{
118 struct adis *st = iio_priv(indio_dev);
119 int bits;
120 s16 val16;
121 u8 addr;
122
123 switch (mask) {
124 case IIO_CHAN_INFO_CALIBBIAS:
125 switch (chan->type) {
126 case IIO_ACCEL:
127 bits = 12;
128 break;
129 default:
130 return -EINVAL;
131 }
132 val16 = val & ((1 << bits) - 1);
133 addr = adis16204_addresses[chan->scan_index][1];
134 return adis_write_reg_16(st, addr, val16);
135 }
136 return -EINVAL;
137}
138
139static const struct iio_chan_spec adis16204_channels[] = {
140 ADIS_SUPPLY_CHAN(ADIS16204_SUPPLY_OUT, ADIS16204_SCAN_SUPPLY, 0, 12),
141 ADIS_AUX_ADC_CHAN(ADIS16204_AUX_ADC, ADIS16204_SCAN_AUX_ADC, 0, 12),
142 ADIS_TEMP_CHAN(ADIS16204_TEMP_OUT, ADIS16204_SCAN_TEMP, 0, 12),
143 ADIS_ACCEL_CHAN(X, ADIS16204_XACCL_OUT, ADIS16204_SCAN_ACC_X,
144 BIT(IIO_CHAN_INFO_CALIBBIAS) | BIT(IIO_CHAN_INFO_PEAK),
145 0, 14),
146 ADIS_ACCEL_CHAN(Y, ADIS16204_YACCL_OUT, ADIS16204_SCAN_ACC_Y,
147 BIT(IIO_CHAN_INFO_CALIBBIAS) | BIT(IIO_CHAN_INFO_PEAK),
148 0, 14),
149 ADIS_ACCEL_CHAN(ROOT_SUM_SQUARED_X_Y, ADIS16204_XY_RSS_OUT,
150 ADIS16204_SCAN_ACC_XY, BIT(IIO_CHAN_INFO_PEAK), 0, 14),
151 IIO_CHAN_SOFT_TIMESTAMP(5),
152};
153
154static const struct iio_info adis16204_info = {
155 .read_raw = &adis16204_read_raw,
156 .write_raw = &adis16204_write_raw,
157 .update_scan_mode = adis_update_scan_mode,
158 .driver_module = THIS_MODULE,
159};
160
161static const char * const adis16204_status_error_msgs[] = {
162 [ADIS16204_DIAG_STAT_SELFTEST_FAIL_BIT] = "Self test failure",
163 [ADIS16204_DIAG_STAT_SPI_FAIL_BIT] = "SPI failure",
164 [ADIS16204_DIAG_STAT_FLASH_UPT_BIT] = "Flash update failed",
165 [ADIS16204_DIAG_STAT_POWER_HIGH_BIT] = "Power supply above 3.625V",
166 [ADIS16204_DIAG_STAT_POWER_LOW_BIT] = "Power supply below 2.975V",
167};
168
169static const struct adis_data adis16204_data = {
170 .read_delay = 20,
171 .msc_ctrl_reg = ADIS16204_MSC_CTRL,
172 .glob_cmd_reg = ADIS16204_GLOB_CMD,
173 .diag_stat_reg = ADIS16204_DIAG_STAT,
174
175 .self_test_mask = ADIS16204_MSC_CTRL_SELF_TEST_EN,
176 .startup_delay = ADIS16204_STARTUP_DELAY,
177
178 .status_error_msgs = adis16204_status_error_msgs,
179 .status_error_mask = BIT(ADIS16204_DIAG_STAT_SELFTEST_FAIL_BIT) |
180 BIT(ADIS16204_DIAG_STAT_SPI_FAIL_BIT) |
181 BIT(ADIS16204_DIAG_STAT_FLASH_UPT_BIT) |
182 BIT(ADIS16204_DIAG_STAT_POWER_HIGH_BIT) |
183 BIT(ADIS16204_DIAG_STAT_POWER_LOW_BIT),
184};
185
186static int adis16204_probe(struct spi_device *spi)
187{
188 int ret;
189 struct adis *st;
190 struct iio_dev *indio_dev;
191
192 /* setup the industrialio driver allocated elements */
193 indio_dev = devm_iio_device_alloc(&spi->dev, sizeof(*st));
194 if (!indio_dev)
195 return -ENOMEM;
196 st = iio_priv(indio_dev);
197 /* this is only used for removal purposes */
198 spi_set_drvdata(spi, indio_dev);
199
200 indio_dev->name = spi->dev.driver->name;
201 indio_dev->dev.parent = &spi->dev;
202 indio_dev->info = &adis16204_info;
203 indio_dev->channels = adis16204_channels;
204 indio_dev->num_channels = ARRAY_SIZE(adis16204_channels);
205 indio_dev->modes = INDIO_DIRECT_MODE;
206
207 ret = adis_init(st, indio_dev, spi, &adis16204_data);
208 if (ret)
209 return ret;
210
211 ret = adis_setup_buffer_and_trigger(st, indio_dev, NULL);
212 if (ret)
213 return ret;
214
215 /* Get the device into a sane initial state */
216 ret = adis_initial_startup(st);
217 if (ret)
218 goto error_cleanup_buffer_trigger;
219 ret = iio_device_register(indio_dev);
220 if (ret)
221 goto error_cleanup_buffer_trigger;
222
223 return 0;
224
225error_cleanup_buffer_trigger:
226 adis_cleanup_buffer_and_trigger(st, indio_dev);
227 return ret;
228}
229
230static int adis16204_remove(struct spi_device *spi)
231{
232 struct iio_dev *indio_dev = spi_get_drvdata(spi);
233 struct adis *st = iio_priv(indio_dev);
234
235 iio_device_unregister(indio_dev);
236 adis_cleanup_buffer_and_trigger(st, indio_dev);
237
238 return 0;
239}
240
241static struct spi_driver adis16204_driver = {
242 .driver = {
243 .name = "adis16204",
244 },
245 .probe = adis16204_probe,
246 .remove = adis16204_remove,
247};
248module_spi_driver(adis16204_driver);
249
250MODULE_AUTHOR("Barry Song <21cnbao@gmail.com>");
251MODULE_DESCRIPTION("ADIS16204 High-g Digital Impact Sensor and Recorder");
252MODULE_LICENSE("GPL v2");
253MODULE_ALIAS("spi:adis16204");