Commit 47df986b684ec1de77e243bc5be17725afca18c4
Exists in
ti-lsk-linux-4.1.y
and in
10 other branches
Merge tag 'staging-4.0-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging
Pull staging driver fixes from Greg KH: "Here are some IIO and staging driver fixes for 4.0-rc3. Details are in the shortlog, nothing major, mostly IIO fixes for reported issues. All have been in linux-next successfully" * tag 'staging-4.0-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging: (23 commits) staging: comedi: adv_pci1710: fix AI INSN_READ for non-zero channel staging: comedi: vmk80xx: remove "firmware version" kernel messages staging: comedi: comedi_isadma: fix "stalled" detect in comedi_isadma_disable_on_sample() iio: ak8975: fix AK09911 dependencies iio: common: ssp_sensors: Protect PM-only functions to kill warning IIO: si7020: Allocate correct amount of memory in devm_iio_device_alloc Revert "iio:humidity:si7020: fix pointer to i2c client" iio: light: gp2ap020a00f: Select REGMAP_I2C iio: light: jsa1212: Select REGMAP_I2C iio: ad5686: fix optional reference voltage declaration iio:adc:mcp3422 Fix incorrect scales table iio: mxs-lradc: fix iio channel map regression iio: imu: adis16400: Fix sign extension staging: iio: ad2s1200: Fix sign extension iio: mxs-lradc: only update the buffer when its conversions have finished iio: mxs-lradc: make ADC reads not unschedule touchscreen conversions iio: mxs-lradc: make ADC reads not disable touchscreen interrupts iio: mxs-lradc: separate touchscreen and buffer virtual channels iio: imu: inv_mpu6050: Prevent dereferencing NULL iio: iadc: wait_for_completion_timeout time in jiffies ...
Showing 15 changed files Side-by-side Diff
- drivers/iio/adc/mcp3422.c
- drivers/iio/adc/qcom-spmi-iadc.c
- drivers/iio/common/ssp_sensors/ssp_dev.c
- drivers/iio/dac/ad5686.c
- drivers/iio/humidity/dht11.c
- drivers/iio/humidity/si7020.c
- drivers/iio/imu/adis16400_core.c
- drivers/iio/imu/inv_mpu6050/inv_mpu_core.c
- drivers/iio/light/Kconfig
- drivers/iio/magnetometer/Kconfig
- drivers/staging/comedi/drivers/adv_pci1710.c
- drivers/staging/comedi/drivers/comedi_isadma.c
- drivers/staging/comedi/drivers/vmk80xx.c
- drivers/staging/iio/adc/mxs-lradc.c
- drivers/staging/iio/resolver/ad2s1200.c
drivers/iio/adc/mcp3422.c
... | ... | @@ -58,20 +58,11 @@ |
58 | 58 | .info_mask_shared_by_type = BIT(IIO_CHAN_INFO_SAMP_FREQ), \ |
59 | 59 | } |
60 | 60 | |
61 | -/* LSB is in nV to eliminate floating point */ | |
62 | -static const u32 rates_to_lsb[] = {1000000, 250000, 62500, 15625}; | |
63 | - | |
64 | -/* | |
65 | - * scales calculated as: | |
66 | - * rates_to_lsb[sample_rate] / (1 << pga); | |
67 | - * pga is 1 for 0, 2 | |
68 | - */ | |
69 | - | |
70 | 61 | static const int mcp3422_scales[4][4] = { |
71 | - { 1000000, 250000, 62500, 15625 }, | |
72 | - { 500000 , 125000, 31250, 7812 }, | |
73 | - { 250000 , 62500 , 15625, 3906 }, | |
74 | - { 125000 , 31250 , 7812 , 1953 } }; | |
62 | + { 1000000, 500000, 250000, 125000 }, | |
63 | + { 250000 , 125000, 62500 , 31250 }, | |
64 | + { 62500 , 31250 , 15625 , 7812 }, | |
65 | + { 15625 , 7812 , 3906 , 1953 } }; | |
75 | 66 | |
76 | 67 | /* Constant msleep times for data acquisitions */ |
77 | 68 | static const int mcp3422_read_times[4] = { |
drivers/iio/adc/qcom-spmi-iadc.c
... | ... | @@ -296,7 +296,8 @@ |
296 | 296 | if (iadc->poll_eoc) { |
297 | 297 | ret = iadc_poll_wait_eoc(iadc, wait); |
298 | 298 | } else { |
299 | - ret = wait_for_completion_timeout(&iadc->complete, wait); | |
299 | + ret = wait_for_completion_timeout(&iadc->complete, | |
300 | + usecs_to_jiffies(wait)); | |
300 | 301 | if (!ret) |
301 | 302 | ret = -ETIMEDOUT; |
302 | 303 | else |
drivers/iio/common/ssp_sensors/ssp_dev.c
... | ... | @@ -640,6 +640,7 @@ |
640 | 640 | return 0; |
641 | 641 | } |
642 | 642 | |
643 | +#ifdef CONFIG_PM_SLEEP | |
643 | 644 | static int ssp_suspend(struct device *dev) |
644 | 645 | { |
645 | 646 | int ret; |
... | ... | @@ -688,6 +689,7 @@ |
688 | 689 | |
689 | 690 | return 0; |
690 | 691 | } |
692 | +#endif /* CONFIG_PM_SLEEP */ | |
691 | 693 | |
692 | 694 | static const struct dev_pm_ops ssp_pm_ops = { |
693 | 695 | SET_SYSTEM_SLEEP_PM_OPS(ssp_suspend, ssp_resume) |
drivers/iio/dac/ad5686.c
... | ... | @@ -322,7 +322,7 @@ |
322 | 322 | st = iio_priv(indio_dev); |
323 | 323 | spi_set_drvdata(spi, indio_dev); |
324 | 324 | |
325 | - st->reg = devm_regulator_get(&spi->dev, "vcc"); | |
325 | + st->reg = devm_regulator_get_optional(&spi->dev, "vcc"); | |
326 | 326 | if (!IS_ERR(st->reg)) { |
327 | 327 | ret = regulator_enable(st->reg); |
328 | 328 | if (ret) |
drivers/iio/humidity/dht11.c
... | ... | @@ -29,6 +29,7 @@ |
29 | 29 | #include <linux/wait.h> |
30 | 30 | #include <linux/bitops.h> |
31 | 31 | #include <linux/completion.h> |
32 | +#include <linux/mutex.h> | |
32 | 33 | #include <linux/delay.h> |
33 | 34 | #include <linux/gpio.h> |
34 | 35 | #include <linux/of_gpio.h> |
35 | 36 | |
... | ... | @@ -39,8 +40,12 @@ |
39 | 40 | |
40 | 41 | #define DHT11_DATA_VALID_TIME 2000000000 /* 2s in ns */ |
41 | 42 | |
42 | -#define DHT11_EDGES_PREAMBLE 4 | |
43 | +#define DHT11_EDGES_PREAMBLE 2 | |
43 | 44 | #define DHT11_BITS_PER_READ 40 |
45 | +/* | |
46 | + * Note that when reading the sensor actually 84 edges are detected, but | |
47 | + * since the last edge is not significant, we only store 83: | |
48 | + */ | |
44 | 49 | #define DHT11_EDGES_PER_READ (2*DHT11_BITS_PER_READ + DHT11_EDGES_PREAMBLE + 1) |
45 | 50 | |
46 | 51 | /* Data transmission timing (nano seconds) */ |
... | ... | @@ -57,6 +62,7 @@ |
57 | 62 | int irq; |
58 | 63 | |
59 | 64 | struct completion completion; |
65 | + struct mutex lock; | |
60 | 66 | |
61 | 67 | s64 timestamp; |
62 | 68 | int temperature; |
... | ... | @@ -88,7 +94,7 @@ |
88 | 94 | unsigned char temp_int, temp_dec, hum_int, hum_dec, checksum; |
89 | 95 | |
90 | 96 | /* Calculate timestamp resolution */ |
91 | - for (i = 0; i < dht11->num_edges; ++i) { | |
97 | + for (i = 1; i < dht11->num_edges; ++i) { | |
92 | 98 | t = dht11->edges[i].ts - dht11->edges[i-1].ts; |
93 | 99 | if (t > 0 && t < timeres) |
94 | 100 | timeres = t; |
... | ... | @@ -138,6 +144,27 @@ |
138 | 144 | return 0; |
139 | 145 | } |
140 | 146 | |
147 | +/* | |
148 | + * IRQ handler called on GPIO edges | |
149 | + */ | |
150 | +static irqreturn_t dht11_handle_irq(int irq, void *data) | |
151 | +{ | |
152 | + struct iio_dev *iio = data; | |
153 | + struct dht11 *dht11 = iio_priv(iio); | |
154 | + | |
155 | + /* TODO: Consider making the handler safe for IRQ sharing */ | |
156 | + if (dht11->num_edges < DHT11_EDGES_PER_READ && dht11->num_edges >= 0) { | |
157 | + dht11->edges[dht11->num_edges].ts = iio_get_time_ns(); | |
158 | + dht11->edges[dht11->num_edges++].value = | |
159 | + gpio_get_value(dht11->gpio); | |
160 | + | |
161 | + if (dht11->num_edges >= DHT11_EDGES_PER_READ) | |
162 | + complete(&dht11->completion); | |
163 | + } | |
164 | + | |
165 | + return IRQ_HANDLED; | |
166 | +} | |
167 | + | |
141 | 168 | static int dht11_read_raw(struct iio_dev *iio_dev, |
142 | 169 | const struct iio_chan_spec *chan, |
143 | 170 | int *val, int *val2, long m) |
... | ... | @@ -145,6 +172,7 @@ |
145 | 172 | struct dht11 *dht11 = iio_priv(iio_dev); |
146 | 173 | int ret; |
147 | 174 | |
175 | + mutex_lock(&dht11->lock); | |
148 | 176 | if (dht11->timestamp + DHT11_DATA_VALID_TIME < iio_get_time_ns()) { |
149 | 177 | reinit_completion(&dht11->completion); |
150 | 178 | |
151 | 179 | |
... | ... | @@ -157,8 +185,17 @@ |
157 | 185 | if (ret) |
158 | 186 | goto err; |
159 | 187 | |
188 | + ret = request_irq(dht11->irq, dht11_handle_irq, | |
189 | + IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING, | |
190 | + iio_dev->name, iio_dev); | |
191 | + if (ret) | |
192 | + goto err; | |
193 | + | |
160 | 194 | ret = wait_for_completion_killable_timeout(&dht11->completion, |
161 | 195 | HZ); |
196 | + | |
197 | + free_irq(dht11->irq, iio_dev); | |
198 | + | |
162 | 199 | if (ret == 0 && dht11->num_edges < DHT11_EDGES_PER_READ - 1) { |
163 | 200 | dev_err(&iio_dev->dev, |
164 | 201 | "Only %d signal edges detected\n", |
... | ... | @@ -185,6 +222,7 @@ |
185 | 222 | ret = -EINVAL; |
186 | 223 | err: |
187 | 224 | dht11->num_edges = -1; |
225 | + mutex_unlock(&dht11->lock); | |
188 | 226 | return ret; |
189 | 227 | } |
190 | 228 | |
... | ... | @@ -193,27 +231,6 @@ |
193 | 231 | .read_raw = dht11_read_raw, |
194 | 232 | }; |
195 | 233 | |
196 | -/* | |
197 | - * IRQ handler called on GPIO edges | |
198 | -*/ | |
199 | -static irqreturn_t dht11_handle_irq(int irq, void *data) | |
200 | -{ | |
201 | - struct iio_dev *iio = data; | |
202 | - struct dht11 *dht11 = iio_priv(iio); | |
203 | - | |
204 | - /* TODO: Consider making the handler safe for IRQ sharing */ | |
205 | - if (dht11->num_edges < DHT11_EDGES_PER_READ && dht11->num_edges >= 0) { | |
206 | - dht11->edges[dht11->num_edges].ts = iio_get_time_ns(); | |
207 | - dht11->edges[dht11->num_edges++].value = | |
208 | - gpio_get_value(dht11->gpio); | |
209 | - | |
210 | - if (dht11->num_edges >= DHT11_EDGES_PER_READ) | |
211 | - complete(&dht11->completion); | |
212 | - } | |
213 | - | |
214 | - return IRQ_HANDLED; | |
215 | -} | |
216 | - | |
217 | 234 | static const struct iio_chan_spec dht11_chan_spec[] = { |
218 | 235 | { .type = IIO_TEMP, |
219 | 236 | .info_mask_separate = BIT(IIO_CHAN_INFO_PROCESSED), }, |
... | ... | @@ -256,11 +273,6 @@ |
256 | 273 | dev_err(dev, "GPIO %d has no interrupt\n", dht11->gpio); |
257 | 274 | return -EINVAL; |
258 | 275 | } |
259 | - ret = devm_request_irq(dev, dht11->irq, dht11_handle_irq, | |
260 | - IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING, | |
261 | - pdev->name, iio); | |
262 | - if (ret) | |
263 | - return ret; | |
264 | 276 | |
265 | 277 | dht11->timestamp = iio_get_time_ns() - DHT11_DATA_VALID_TIME - 1; |
266 | 278 | dht11->num_edges = -1; |
... | ... | @@ -268,6 +280,7 @@ |
268 | 280 | platform_set_drvdata(pdev, iio); |
269 | 281 | |
270 | 282 | init_completion(&dht11->completion); |
283 | + mutex_init(&dht11->lock); | |
271 | 284 | iio->name = pdev->name; |
272 | 285 | iio->dev.parent = &pdev->dev; |
273 | 286 | iio->info = &dht11_iio_info; |
drivers/iio/humidity/si7020.c
... | ... | @@ -45,12 +45,12 @@ |
45 | 45 | struct iio_chan_spec const *chan, int *val, |
46 | 46 | int *val2, long mask) |
47 | 47 | { |
48 | - struct i2c_client *client = iio_priv(indio_dev); | |
48 | + struct i2c_client **client = iio_priv(indio_dev); | |
49 | 49 | int ret; |
50 | 50 | |
51 | 51 | switch (mask) { |
52 | 52 | case IIO_CHAN_INFO_RAW: |
53 | - ret = i2c_smbus_read_word_data(client, | |
53 | + ret = i2c_smbus_read_word_data(*client, | |
54 | 54 | chan->type == IIO_TEMP ? |
55 | 55 | SI7020CMD_TEMP_HOLD : |
56 | 56 | SI7020CMD_RH_HOLD); |
... | ... | @@ -126,7 +126,7 @@ |
126 | 126 | /* Wait the maximum power-up time after software reset. */ |
127 | 127 | msleep(15); |
128 | 128 | |
129 | - indio_dev = devm_iio_device_alloc(&client->dev, sizeof(*client)); | |
129 | + indio_dev = devm_iio_device_alloc(&client->dev, sizeof(*data)); | |
130 | 130 | if (!indio_dev) |
131 | 131 | return -ENOMEM; |
132 | 132 |
drivers/iio/imu/adis16400_core.c
... | ... | @@ -26,6 +26,7 @@ |
26 | 26 | #include <linux/list.h> |
27 | 27 | #include <linux/module.h> |
28 | 28 | #include <linux/debugfs.h> |
29 | +#include <linux/bitops.h> | |
29 | 30 | |
30 | 31 | #include <linux/iio/iio.h> |
31 | 32 | #include <linux/iio/sysfs.h> |
... | ... | @@ -414,7 +415,7 @@ |
414 | 415 | mutex_unlock(&indio_dev->mlock); |
415 | 416 | if (ret) |
416 | 417 | return ret; |
417 | - val16 = ((val16 & 0xFFF) << 4) >> 4; | |
418 | + val16 = sign_extend32(val16, 11); | |
418 | 419 | *val = val16; |
419 | 420 | return IIO_VAL_INT; |
420 | 421 | case IIO_CHAN_INFO_OFFSET: |
drivers/iio/imu/inv_mpu6050/inv_mpu_core.c
... | ... | @@ -780,7 +780,11 @@ |
780 | 780 | |
781 | 781 | i2c_set_clientdata(client, indio_dev); |
782 | 782 | indio_dev->dev.parent = &client->dev; |
783 | - indio_dev->name = id->name; | |
783 | + /* id will be NULL when enumerated via ACPI */ | |
784 | + if (id) | |
785 | + indio_dev->name = (char *)id->name; | |
786 | + else | |
787 | + indio_dev->name = (char *)dev_name(&client->dev); | |
784 | 788 | indio_dev->channels = inv_mpu_channels; |
785 | 789 | indio_dev->num_channels = ARRAY_SIZE(inv_mpu_channels); |
786 | 790 |
drivers/iio/light/Kconfig
... | ... | @@ -73,6 +73,7 @@ |
73 | 73 | config GP2AP020A00F |
74 | 74 | tristate "Sharp GP2AP020A00F Proximity/ALS sensor" |
75 | 75 | depends on I2C |
76 | + select REGMAP_I2C | |
76 | 77 | select IIO_BUFFER |
77 | 78 | select IIO_TRIGGERED_BUFFER |
78 | 79 | select IRQ_WORK |
... | ... | @@ -126,6 +127,7 @@ |
126 | 127 | config JSA1212 |
127 | 128 | tristate "JSA1212 ALS and proximity sensor driver" |
128 | 129 | depends on I2C |
130 | + select REGMAP_I2C | |
129 | 131 | help |
130 | 132 | Say Y here if you want to build a IIO driver for JSA1212 |
131 | 133 | proximity & ALS sensor device. |
drivers/iio/magnetometer/Kconfig
drivers/staging/comedi/drivers/adv_pci1710.c
... | ... | @@ -426,7 +426,6 @@ |
426 | 426 | unsigned int *data) |
427 | 427 | { |
428 | 428 | struct pci1710_private *devpriv = dev->private; |
429 | - unsigned int chan = CR_CHAN(insn->chanspec); | |
430 | 429 | int ret = 0; |
431 | 430 | int i; |
432 | 431 | |
... | ... | @@ -447,7 +446,7 @@ |
447 | 446 | if (ret) |
448 | 447 | break; |
449 | 448 | |
450 | - ret = pci171x_ai_read_sample(dev, s, chan, &val); | |
449 | + ret = pci171x_ai_read_sample(dev, s, 0, &val); | |
451 | 450 | if (ret) |
452 | 451 | break; |
453 | 452 |
drivers/staging/comedi/drivers/comedi_isadma.c
drivers/staging/comedi/drivers/vmk80xx.c
... | ... | @@ -103,11 +103,6 @@ |
103 | 103 | VMK8061_MODEL |
104 | 104 | }; |
105 | 105 | |
106 | -struct firmware_version { | |
107 | - unsigned char ic3_vers[32]; /* USB-Controller */ | |
108 | - unsigned char ic6_vers[32]; /* CPU */ | |
109 | -}; | |
110 | - | |
111 | 106 | static const struct comedi_lrange vmk8061_range = { |
112 | 107 | 2, { |
113 | 108 | UNI_RANGE(5), |
114 | 109 | |
... | ... | @@ -156,68 +151,12 @@ |
156 | 151 | struct vmk80xx_private { |
157 | 152 | struct usb_endpoint_descriptor *ep_rx; |
158 | 153 | struct usb_endpoint_descriptor *ep_tx; |
159 | - struct firmware_version fw; | |
160 | 154 | struct semaphore limit_sem; |
161 | 155 | unsigned char *usb_rx_buf; |
162 | 156 | unsigned char *usb_tx_buf; |
163 | 157 | enum vmk80xx_model model; |
164 | 158 | }; |
165 | 159 | |
166 | -static int vmk80xx_check_data_link(struct comedi_device *dev) | |
167 | -{ | |
168 | - struct vmk80xx_private *devpriv = dev->private; | |
169 | - struct usb_device *usb = comedi_to_usb_dev(dev); | |
170 | - unsigned int tx_pipe; | |
171 | - unsigned int rx_pipe; | |
172 | - unsigned char tx[1]; | |
173 | - unsigned char rx[2]; | |
174 | - | |
175 | - tx_pipe = usb_sndbulkpipe(usb, 0x01); | |
176 | - rx_pipe = usb_rcvbulkpipe(usb, 0x81); | |
177 | - | |
178 | - tx[0] = VMK8061_CMD_RD_PWR_STAT; | |
179 | - | |
180 | - /* | |
181 | - * Check that IC6 (PIC16F871) is powered and | |
182 | - * running and the data link between IC3 and | |
183 | - * IC6 is working properly | |
184 | - */ | |
185 | - usb_bulk_msg(usb, tx_pipe, tx, 1, NULL, devpriv->ep_tx->bInterval); | |
186 | - usb_bulk_msg(usb, rx_pipe, rx, 2, NULL, HZ * 10); | |
187 | - | |
188 | - return (int)rx[1]; | |
189 | -} | |
190 | - | |
191 | -static void vmk80xx_read_eeprom(struct comedi_device *dev, int flag) | |
192 | -{ | |
193 | - struct vmk80xx_private *devpriv = dev->private; | |
194 | - struct usb_device *usb = comedi_to_usb_dev(dev); | |
195 | - unsigned int tx_pipe; | |
196 | - unsigned int rx_pipe; | |
197 | - unsigned char tx[1]; | |
198 | - unsigned char rx[64]; | |
199 | - int cnt; | |
200 | - | |
201 | - tx_pipe = usb_sndbulkpipe(usb, 0x01); | |
202 | - rx_pipe = usb_rcvbulkpipe(usb, 0x81); | |
203 | - | |
204 | - tx[0] = VMK8061_CMD_RD_VERSION; | |
205 | - | |
206 | - /* | |
207 | - * Read the firmware version info of IC3 and | |
208 | - * IC6 from the internal EEPROM of the IC | |
209 | - */ | |
210 | - usb_bulk_msg(usb, tx_pipe, tx, 1, NULL, devpriv->ep_tx->bInterval); | |
211 | - usb_bulk_msg(usb, rx_pipe, rx, 64, &cnt, HZ * 10); | |
212 | - | |
213 | - rx[cnt] = '\0'; | |
214 | - | |
215 | - if (flag & IC3_VERSION) | |
216 | - strncpy(devpriv->fw.ic3_vers, rx + 1, 24); | |
217 | - else /* IC6_VERSION */ | |
218 | - strncpy(devpriv->fw.ic6_vers, rx + 25, 24); | |
219 | -} | |
220 | - | |
221 | 160 | static void vmk80xx_do_bulk_msg(struct comedi_device *dev) |
222 | 161 | { |
223 | 162 | struct vmk80xx_private *devpriv = dev->private; |
... | ... | @@ -877,16 +816,6 @@ |
877 | 816 | sema_init(&devpriv->limit_sem, 8); |
878 | 817 | |
879 | 818 | usb_set_intfdata(intf, devpriv); |
880 | - | |
881 | - if (devpriv->model == VMK8061_MODEL) { | |
882 | - vmk80xx_read_eeprom(dev, IC3_VERSION); | |
883 | - dev_info(&intf->dev, "%s\n", devpriv->fw.ic3_vers); | |
884 | - | |
885 | - if (vmk80xx_check_data_link(dev)) { | |
886 | - vmk80xx_read_eeprom(dev, IC6_VERSION); | |
887 | - dev_info(&intf->dev, "%s\n", devpriv->fw.ic6_vers); | |
888 | - } | |
889 | - } | |
890 | 819 | |
891 | 820 | if (devpriv->model == VMK8055_MODEL) |
892 | 821 | vmk80xx_reset_device(dev); |
drivers/staging/iio/adc/mxs-lradc.c
... | ... | @@ -214,11 +214,17 @@ |
214 | 214 | unsigned long is_divided; |
215 | 215 | |
216 | 216 | /* |
217 | - * Touchscreen LRADC channels receives a private slot in the CTRL4 | |
218 | - * register, the slot #7. Therefore only 7 slots instead of 8 in the | |
219 | - * CTRL4 register can be mapped to LRADC channels when using the | |
220 | - * touchscreen. | |
221 | - * | |
217 | + * When the touchscreen is enabled, we give it two private virtual | |
218 | + * channels: #6 and #7. This means that only 6 virtual channels (instead | |
219 | + * of 8) will be available for buffered capture. | |
220 | + */ | |
221 | +#define TOUCHSCREEN_VCHANNEL1 7 | |
222 | +#define TOUCHSCREEN_VCHANNEL2 6 | |
223 | +#define BUFFER_VCHANS_LIMITED 0x3f | |
224 | +#define BUFFER_VCHANS_ALL 0xff | |
225 | + u8 buffer_vchans; | |
226 | + | |
227 | + /* | |
222 | 228 | * Furthermore, certain LRADC channels are shared between touchscreen |
223 | 229 | * and/or touch-buttons and generic LRADC block. Therefore when using |
224 | 230 | * either of these, these channels are not available for the regular |
... | ... | @@ -342,6 +348,9 @@ |
342 | 348 | #define LRADC_CTRL4 0x140 |
343 | 349 | #define LRADC_CTRL4_LRADCSELECT_MASK(n) (0xf << ((n) * 4)) |
344 | 350 | #define LRADC_CTRL4_LRADCSELECT_OFFSET(n) ((n) * 4) |
351 | +#define LRADC_CTRL4_LRADCSELECT(n, x) \ | |
352 | + (((x) << LRADC_CTRL4_LRADCSELECT_OFFSET(n)) & \ | |
353 | + LRADC_CTRL4_LRADCSELECT_MASK(n)) | |
345 | 354 | |
346 | 355 | #define LRADC_RESOLUTION 12 |
347 | 356 | #define LRADC_SINGLE_SAMPLE_MASK ((1 << LRADC_RESOLUTION) - 1) |
... | ... | @@ -416,6 +425,14 @@ |
416 | 425 | LRADC_STATUS_TOUCH_DETECT_RAW); |
417 | 426 | } |
418 | 427 | |
428 | +static void mxs_lradc_map_channel(struct mxs_lradc *lradc, unsigned vch, | |
429 | + unsigned ch) | |
430 | +{ | |
431 | + mxs_lradc_reg_clear(lradc, LRADC_CTRL4_LRADCSELECT_MASK(vch), | |
432 | + LRADC_CTRL4); | |
433 | + mxs_lradc_reg_set(lradc, LRADC_CTRL4_LRADCSELECT(vch, ch), LRADC_CTRL4); | |
434 | +} | |
435 | + | |
419 | 436 | static void mxs_lradc_setup_ts_channel(struct mxs_lradc *lradc, unsigned ch) |
420 | 437 | { |
421 | 438 | /* |
422 | 439 | |
... | ... | @@ -450,12 +467,8 @@ |
450 | 467 | LRADC_DELAY_DELAY(lradc->over_sample_delay - 1), |
451 | 468 | LRADC_DELAY(3)); |
452 | 469 | |
453 | - mxs_lradc_reg_clear(lradc, LRADC_CTRL1_LRADC_IRQ(2) | | |
454 | - LRADC_CTRL1_LRADC_IRQ(3) | LRADC_CTRL1_LRADC_IRQ(4) | | |
455 | - LRADC_CTRL1_LRADC_IRQ(5), LRADC_CTRL1); | |
470 | + mxs_lradc_reg_clear(lradc, LRADC_CTRL1_LRADC_IRQ(ch), LRADC_CTRL1); | |
456 | 471 | |
457 | - /* wake us again, when the complete conversion is done */ | |
458 | - mxs_lradc_reg_set(lradc, LRADC_CTRL1_LRADC_IRQ_EN(ch), LRADC_CTRL1); | |
459 | 472 | /* |
460 | 473 | * after changing the touchscreen plates setting |
461 | 474 | * the signals need some initial time to settle. Start the |
462 | 475 | |
... | ... | @@ -509,12 +522,8 @@ |
509 | 522 | LRADC_DELAY_DELAY(lradc->over_sample_delay - 1), |
510 | 523 | LRADC_DELAY(3)); |
511 | 524 | |
512 | - mxs_lradc_reg_clear(lradc, LRADC_CTRL1_LRADC_IRQ(2) | | |
513 | - LRADC_CTRL1_LRADC_IRQ(3) | LRADC_CTRL1_LRADC_IRQ(4) | | |
514 | - LRADC_CTRL1_LRADC_IRQ(5), LRADC_CTRL1); | |
525 | + mxs_lradc_reg_clear(lradc, LRADC_CTRL1_LRADC_IRQ(ch2), LRADC_CTRL1); | |
515 | 526 | |
516 | - /* wake us again, when the conversions are done */ | |
517 | - mxs_lradc_reg_set(lradc, LRADC_CTRL1_LRADC_IRQ_EN(ch2), LRADC_CTRL1); | |
518 | 527 | /* |
519 | 528 | * after changing the touchscreen plates setting |
520 | 529 | * the signals need some initial time to settle. Start the |
... | ... | @@ -580,36 +589,6 @@ |
580 | 589 | #define TS_CH_XM 4 |
581 | 590 | #define TS_CH_YM 5 |
582 | 591 | |
583 | -static int mxs_lradc_read_ts_channel(struct mxs_lradc *lradc) | |
584 | -{ | |
585 | - u32 reg; | |
586 | - int val; | |
587 | - | |
588 | - reg = readl(lradc->base + LRADC_CTRL1); | |
589 | - | |
590 | - /* only channels 3 to 5 are of interest here */ | |
591 | - if (reg & LRADC_CTRL1_LRADC_IRQ(TS_CH_YP)) { | |
592 | - mxs_lradc_reg_clear(lradc, LRADC_CTRL1_LRADC_IRQ_EN(TS_CH_YP) | | |
593 | - LRADC_CTRL1_LRADC_IRQ(TS_CH_YP), LRADC_CTRL1); | |
594 | - val = mxs_lradc_read_raw_channel(lradc, TS_CH_YP); | |
595 | - } else if (reg & LRADC_CTRL1_LRADC_IRQ(TS_CH_XM)) { | |
596 | - mxs_lradc_reg_clear(lradc, LRADC_CTRL1_LRADC_IRQ_EN(TS_CH_XM) | | |
597 | - LRADC_CTRL1_LRADC_IRQ(TS_CH_XM), LRADC_CTRL1); | |
598 | - val = mxs_lradc_read_raw_channel(lradc, TS_CH_XM); | |
599 | - } else if (reg & LRADC_CTRL1_LRADC_IRQ(TS_CH_YM)) { | |
600 | - mxs_lradc_reg_clear(lradc, LRADC_CTRL1_LRADC_IRQ_EN(TS_CH_YM) | | |
601 | - LRADC_CTRL1_LRADC_IRQ(TS_CH_YM), LRADC_CTRL1); | |
602 | - val = mxs_lradc_read_raw_channel(lradc, TS_CH_YM); | |
603 | - } else { | |
604 | - return -EIO; | |
605 | - } | |
606 | - | |
607 | - mxs_lradc_reg_wrt(lradc, 0, LRADC_DELAY(2)); | |
608 | - mxs_lradc_reg_wrt(lradc, 0, LRADC_DELAY(3)); | |
609 | - | |
610 | - return val; | |
611 | -} | |
612 | - | |
613 | 592 | /* |
614 | 593 | * YP(open)--+-------------+ |
615 | 594 | * | |--+ |
... | ... | @@ -653,7 +632,8 @@ |
653 | 632 | mxs_lradc_reg_set(lradc, mxs_lradc_drive_x_plate(lradc), LRADC_CTRL0); |
654 | 633 | |
655 | 634 | lradc->cur_plate = LRADC_SAMPLE_X; |
656 | - mxs_lradc_setup_ts_channel(lradc, TS_CH_YP); | |
635 | + mxs_lradc_map_channel(lradc, TOUCHSCREEN_VCHANNEL1, TS_CH_YP); | |
636 | + mxs_lradc_setup_ts_channel(lradc, TOUCHSCREEN_VCHANNEL1); | |
657 | 637 | } |
658 | 638 | |
659 | 639 | /* |
... | ... | @@ -674,7 +654,8 @@ |
674 | 654 | mxs_lradc_reg_set(lradc, mxs_lradc_drive_y_plate(lradc), LRADC_CTRL0); |
675 | 655 | |
676 | 656 | lradc->cur_plate = LRADC_SAMPLE_Y; |
677 | - mxs_lradc_setup_ts_channel(lradc, TS_CH_XM); | |
657 | + mxs_lradc_map_channel(lradc, TOUCHSCREEN_VCHANNEL1, TS_CH_XM); | |
658 | + mxs_lradc_setup_ts_channel(lradc, TOUCHSCREEN_VCHANNEL1); | |
678 | 659 | } |
679 | 660 | |
680 | 661 | /* |
... | ... | @@ -695,7 +676,10 @@ |
695 | 676 | mxs_lradc_reg_set(lradc, mxs_lradc_drive_pressure(lradc), LRADC_CTRL0); |
696 | 677 | |
697 | 678 | lradc->cur_plate = LRADC_SAMPLE_PRESSURE; |
698 | - mxs_lradc_setup_ts_pressure(lradc, TS_CH_XP, TS_CH_YM); | |
679 | + mxs_lradc_map_channel(lradc, TOUCHSCREEN_VCHANNEL1, TS_CH_YM); | |
680 | + mxs_lradc_map_channel(lradc, TOUCHSCREEN_VCHANNEL2, TS_CH_XP); | |
681 | + mxs_lradc_setup_ts_pressure(lradc, TOUCHSCREEN_VCHANNEL2, | |
682 | + TOUCHSCREEN_VCHANNEL1); | |
699 | 683 | } |
700 | 684 | |
701 | 685 | static void mxs_lradc_enable_touch_detection(struct mxs_lradc *lradc) |
... | ... | @@ -708,6 +692,19 @@ |
708 | 692 | mxs_lradc_reg_set(lradc, LRADC_CTRL1_TOUCH_DETECT_IRQ_EN, LRADC_CTRL1); |
709 | 693 | } |
710 | 694 | |
695 | +static void mxs_lradc_start_touch_event(struct mxs_lradc *lradc) | |
696 | +{ | |
697 | + mxs_lradc_reg_clear(lradc, LRADC_CTRL1_TOUCH_DETECT_IRQ_EN, | |
698 | + LRADC_CTRL1); | |
699 | + mxs_lradc_reg_set(lradc, | |
700 | + LRADC_CTRL1_LRADC_IRQ_EN(TOUCHSCREEN_VCHANNEL1), LRADC_CTRL1); | |
701 | + /* | |
702 | + * start with the Y-pos, because it uses nearly the same plate | |
703 | + * settings like the touch detection | |
704 | + */ | |
705 | + mxs_lradc_prepare_y_pos(lradc); | |
706 | +} | |
707 | + | |
711 | 708 | static void mxs_lradc_report_ts_event(struct mxs_lradc *lradc) |
712 | 709 | { |
713 | 710 | input_report_abs(lradc->ts_input, ABS_X, lradc->ts_x_pos); |
... | ... | @@ -725,10 +722,12 @@ |
725 | 722 | * start a dummy conversion to burn time to settle the signals |
726 | 723 | * note: we are not interested in the conversion's value |
727 | 724 | */ |
728 | - mxs_lradc_reg_wrt(lradc, 0, LRADC_CH(5)); | |
729 | - mxs_lradc_reg_clear(lradc, LRADC_CTRL1_LRADC_IRQ(5), LRADC_CTRL1); | |
730 | - mxs_lradc_reg_set(lradc, LRADC_CTRL1_LRADC_IRQ_EN(5), LRADC_CTRL1); | |
731 | - mxs_lradc_reg_wrt(lradc, LRADC_DELAY_TRIGGER(1 << 5) | | |
725 | + mxs_lradc_reg_wrt(lradc, 0, LRADC_CH(TOUCHSCREEN_VCHANNEL1)); | |
726 | + mxs_lradc_reg_clear(lradc, | |
727 | + LRADC_CTRL1_LRADC_IRQ(TOUCHSCREEN_VCHANNEL1) | | |
728 | + LRADC_CTRL1_LRADC_IRQ(TOUCHSCREEN_VCHANNEL2), LRADC_CTRL1); | |
729 | + mxs_lradc_reg_wrt(lradc, | |
730 | + LRADC_DELAY_TRIGGER(1 << TOUCHSCREEN_VCHANNEL1) | | |
732 | 731 | LRADC_DELAY_KICK | LRADC_DELAY_DELAY(10), /* waste 5 ms */ |
733 | 732 | LRADC_DELAY(2)); |
734 | 733 | } |
735 | 734 | |
736 | 735 | |
737 | 736 | |
738 | 737 | |
739 | 738 | |
740 | 739 | |
... | ... | @@ -760,59 +759,45 @@ |
760 | 759 | |
761 | 760 | /* if it is released, wait for the next touch via IRQ */ |
762 | 761 | lradc->cur_plate = LRADC_TOUCH; |
763 | - mxs_lradc_reg_clear(lradc, LRADC_CTRL1_TOUCH_DETECT_IRQ, LRADC_CTRL1); | |
762 | + mxs_lradc_reg_wrt(lradc, 0, LRADC_DELAY(2)); | |
763 | + mxs_lradc_reg_wrt(lradc, 0, LRADC_DELAY(3)); | |
764 | + mxs_lradc_reg_clear(lradc, LRADC_CTRL1_TOUCH_DETECT_IRQ | | |
765 | + LRADC_CTRL1_LRADC_IRQ_EN(TOUCHSCREEN_VCHANNEL1) | | |
766 | + LRADC_CTRL1_LRADC_IRQ(TOUCHSCREEN_VCHANNEL1), LRADC_CTRL1); | |
764 | 767 | mxs_lradc_reg_set(lradc, LRADC_CTRL1_TOUCH_DETECT_IRQ_EN, LRADC_CTRL1); |
765 | 768 | } |
766 | 769 | |
767 | 770 | /* touchscreen's state machine */ |
768 | 771 | static void mxs_lradc_handle_touch(struct mxs_lradc *lradc) |
769 | 772 | { |
770 | - int val; | |
771 | - | |
772 | 773 | switch (lradc->cur_plate) { |
773 | 774 | case LRADC_TOUCH: |
774 | - /* | |
775 | - * start with the Y-pos, because it uses nearly the same plate | |
776 | - * settings like the touch detection | |
777 | - */ | |
778 | - if (mxs_lradc_check_touch_event(lradc)) { | |
779 | - mxs_lradc_reg_clear(lradc, | |
780 | - LRADC_CTRL1_TOUCH_DETECT_IRQ_EN, | |
781 | - LRADC_CTRL1); | |
782 | - mxs_lradc_prepare_y_pos(lradc); | |
783 | - } | |
775 | + if (mxs_lradc_check_touch_event(lradc)) | |
776 | + mxs_lradc_start_touch_event(lradc); | |
784 | 777 | mxs_lradc_reg_clear(lradc, LRADC_CTRL1_TOUCH_DETECT_IRQ, |
785 | 778 | LRADC_CTRL1); |
786 | 779 | return; |
787 | 780 | |
788 | 781 | case LRADC_SAMPLE_Y: |
789 | - val = mxs_lradc_read_ts_channel(lradc); | |
790 | - if (val < 0) { | |
791 | - mxs_lradc_enable_touch_detection(lradc); /* re-start */ | |
792 | - return; | |
793 | - } | |
794 | - lradc->ts_y_pos = val; | |
782 | + lradc->ts_y_pos = mxs_lradc_read_raw_channel(lradc, | |
783 | + TOUCHSCREEN_VCHANNEL1); | |
795 | 784 | mxs_lradc_prepare_x_pos(lradc); |
796 | 785 | return; |
797 | 786 | |
798 | 787 | case LRADC_SAMPLE_X: |
799 | - val = mxs_lradc_read_ts_channel(lradc); | |
800 | - if (val < 0) { | |
801 | - mxs_lradc_enable_touch_detection(lradc); /* re-start */ | |
802 | - return; | |
803 | - } | |
804 | - lradc->ts_x_pos = val; | |
788 | + lradc->ts_x_pos = mxs_lradc_read_raw_channel(lradc, | |
789 | + TOUCHSCREEN_VCHANNEL1); | |
805 | 790 | mxs_lradc_prepare_pressure(lradc); |
806 | 791 | return; |
807 | 792 | |
808 | 793 | case LRADC_SAMPLE_PRESSURE: |
809 | - lradc->ts_pressure = | |
810 | - mxs_lradc_read_ts_pressure(lradc, TS_CH_XP, TS_CH_YM); | |
794 | + lradc->ts_pressure = mxs_lradc_read_ts_pressure(lradc, | |
795 | + TOUCHSCREEN_VCHANNEL2, | |
796 | + TOUCHSCREEN_VCHANNEL1); | |
811 | 797 | mxs_lradc_complete_touch_event(lradc); |
812 | 798 | return; |
813 | 799 | |
814 | 800 | case LRADC_SAMPLE_VALID: |
815 | - val = mxs_lradc_read_ts_channel(lradc); /* ignore the value */ | |
816 | 801 | mxs_lradc_finish_touch_event(lradc, 1); |
817 | 802 | break; |
818 | 803 | } |
819 | 804 | |
... | ... | @@ -844,9 +829,9 @@ |
844 | 829 | * used if doing raw sampling. |
845 | 830 | */ |
846 | 831 | if (lradc->soc == IMX28_LRADC) |
847 | - mxs_lradc_reg_clear(lradc, LRADC_CTRL1_MX28_LRADC_IRQ_EN_MASK, | |
832 | + mxs_lradc_reg_clear(lradc, LRADC_CTRL1_LRADC_IRQ_EN(0), | |
848 | 833 | LRADC_CTRL1); |
849 | - mxs_lradc_reg_clear(lradc, 0xff, LRADC_CTRL0); | |
834 | + mxs_lradc_reg_clear(lradc, 0x1, LRADC_CTRL0); | |
850 | 835 | |
851 | 836 | /* Enable / disable the divider per requirement */ |
852 | 837 | if (test_bit(chan, &lradc->is_divided)) |
... | ... | @@ -1090,9 +1075,8 @@ |
1090 | 1075 | { |
1091 | 1076 | /* stop all interrupts from firing */ |
1092 | 1077 | mxs_lradc_reg_clear(lradc, LRADC_CTRL1_TOUCH_DETECT_IRQ_EN | |
1093 | - LRADC_CTRL1_LRADC_IRQ_EN(2) | LRADC_CTRL1_LRADC_IRQ_EN(3) | | |
1094 | - LRADC_CTRL1_LRADC_IRQ_EN(4) | LRADC_CTRL1_LRADC_IRQ_EN(5), | |
1095 | - LRADC_CTRL1); | |
1078 | + LRADC_CTRL1_LRADC_IRQ_EN(TOUCHSCREEN_VCHANNEL1) | | |
1079 | + LRADC_CTRL1_LRADC_IRQ_EN(TOUCHSCREEN_VCHANNEL2), LRADC_CTRL1); | |
1096 | 1080 | |
1097 | 1081 | /* Power-down touchscreen touch-detect circuitry. */ |
1098 | 1082 | mxs_lradc_reg_clear(lradc, mxs_lradc_plate_mask(lradc), LRADC_CTRL0); |
1099 | 1083 | |
1100 | 1084 | |
1101 | 1085 | |
1102 | 1086 | |
1103 | 1087 | |
... | ... | @@ -1158,26 +1142,31 @@ |
1158 | 1142 | struct iio_dev *iio = data; |
1159 | 1143 | struct mxs_lradc *lradc = iio_priv(iio); |
1160 | 1144 | unsigned long reg = readl(lradc->base + LRADC_CTRL1); |
1145 | + uint32_t clr_irq = mxs_lradc_irq_mask(lradc); | |
1161 | 1146 | const uint32_t ts_irq_mask = |
1162 | 1147 | LRADC_CTRL1_TOUCH_DETECT_IRQ | |
1163 | - LRADC_CTRL1_LRADC_IRQ(2) | | |
1164 | - LRADC_CTRL1_LRADC_IRQ(3) | | |
1165 | - LRADC_CTRL1_LRADC_IRQ(4) | | |
1166 | - LRADC_CTRL1_LRADC_IRQ(5); | |
1148 | + LRADC_CTRL1_LRADC_IRQ(TOUCHSCREEN_VCHANNEL1) | | |
1149 | + LRADC_CTRL1_LRADC_IRQ(TOUCHSCREEN_VCHANNEL2); | |
1167 | 1150 | |
1168 | 1151 | if (!(reg & mxs_lradc_irq_mask(lradc))) |
1169 | 1152 | return IRQ_NONE; |
1170 | 1153 | |
1171 | - if (lradc->use_touchscreen && (reg & ts_irq_mask)) | |
1154 | + if (lradc->use_touchscreen && (reg & ts_irq_mask)) { | |
1172 | 1155 | mxs_lradc_handle_touch(lradc); |
1173 | 1156 | |
1174 | - if (iio_buffer_enabled(iio)) | |
1175 | - iio_trigger_poll(iio->trig); | |
1176 | - else if (reg & LRADC_CTRL1_LRADC_IRQ(0)) | |
1157 | + /* Make sure we don't clear the next conversion's interrupt. */ | |
1158 | + clr_irq &= ~(LRADC_CTRL1_LRADC_IRQ(TOUCHSCREEN_VCHANNEL1) | | |
1159 | + LRADC_CTRL1_LRADC_IRQ(TOUCHSCREEN_VCHANNEL2)); | |
1160 | + } | |
1161 | + | |
1162 | + if (iio_buffer_enabled(iio)) { | |
1163 | + if (reg & lradc->buffer_vchans) | |
1164 | + iio_trigger_poll(iio->trig); | |
1165 | + } else if (reg & LRADC_CTRL1_LRADC_IRQ(0)) { | |
1177 | 1166 | complete(&lradc->completion); |
1167 | + } | |
1178 | 1168 | |
1179 | - mxs_lradc_reg_clear(lradc, reg & mxs_lradc_irq_mask(lradc), | |
1180 | - LRADC_CTRL1); | |
1169 | + mxs_lradc_reg_clear(lradc, reg & clr_irq, LRADC_CTRL1); | |
1181 | 1170 | |
1182 | 1171 | return IRQ_HANDLED; |
1183 | 1172 | } |
... | ... | @@ -1289,9 +1278,10 @@ |
1289 | 1278 | } |
1290 | 1279 | |
1291 | 1280 | if (lradc->soc == IMX28_LRADC) |
1292 | - mxs_lradc_reg_clear(lradc, LRADC_CTRL1_MX28_LRADC_IRQ_EN_MASK, | |
1293 | - LRADC_CTRL1); | |
1294 | - mxs_lradc_reg_clear(lradc, 0xff, LRADC_CTRL0); | |
1281 | + mxs_lradc_reg_clear(lradc, | |
1282 | + lradc->buffer_vchans << LRADC_CTRL1_LRADC_IRQ_EN_OFFSET, | |
1283 | + LRADC_CTRL1); | |
1284 | + mxs_lradc_reg_clear(lradc, lradc->buffer_vchans, LRADC_CTRL0); | |
1295 | 1285 | |
1296 | 1286 | for_each_set_bit(chan, iio->active_scan_mask, LRADC_MAX_TOTAL_CHANS) { |
1297 | 1287 | ctrl4_set |= chan << LRADC_CTRL4_LRADCSELECT_OFFSET(ofs); |
1298 | 1288 | |
... | ... | @@ -1324,10 +1314,11 @@ |
1324 | 1314 | mxs_lradc_reg_clear(lradc, LRADC_DELAY_TRIGGER_LRADCS_MASK | |
1325 | 1315 | LRADC_DELAY_KICK, LRADC_DELAY(0)); |
1326 | 1316 | |
1327 | - mxs_lradc_reg_clear(lradc, 0xff, LRADC_CTRL0); | |
1317 | + mxs_lradc_reg_clear(lradc, lradc->buffer_vchans, LRADC_CTRL0); | |
1328 | 1318 | if (lradc->soc == IMX28_LRADC) |
1329 | - mxs_lradc_reg_clear(lradc, LRADC_CTRL1_MX28_LRADC_IRQ_EN_MASK, | |
1330 | - LRADC_CTRL1); | |
1319 | + mxs_lradc_reg_clear(lradc, | |
1320 | + lradc->buffer_vchans << LRADC_CTRL1_LRADC_IRQ_EN_OFFSET, | |
1321 | + LRADC_CTRL1); | |
1331 | 1322 | |
1332 | 1323 | kfree(lradc->buffer); |
1333 | 1324 | mutex_unlock(&lradc->lock); |
... | ... | @@ -1353,7 +1344,7 @@ |
1353 | 1344 | if (lradc->use_touchbutton) |
1354 | 1345 | rsvd_chans++; |
1355 | 1346 | if (lradc->use_touchscreen) |
1356 | - rsvd_chans++; | |
1347 | + rsvd_chans += 2; | |
1357 | 1348 | |
1358 | 1349 | /* Test for attempts to map channels with special mode of operation. */ |
1359 | 1350 | if (bitmap_intersects(mask, &rsvd_mask, LRADC_MAX_TOTAL_CHANS)) |
... | ... | @@ -1413,6 +1404,13 @@ |
1413 | 1404 | .channel = 8, |
1414 | 1405 | .scan_type = {.sign = 'u', .realbits = 18, .storagebits = 32,}, |
1415 | 1406 | }, |
1407 | + /* Hidden channel to keep indexes */ | |
1408 | + { | |
1409 | + .type = IIO_TEMP, | |
1410 | + .indexed = 1, | |
1411 | + .scan_index = -1, | |
1412 | + .channel = 9, | |
1413 | + }, | |
1416 | 1414 | MXS_ADC_CHAN(10, IIO_VOLTAGE), /* VDDIO */ |
1417 | 1415 | MXS_ADC_CHAN(11, IIO_VOLTAGE), /* VTH */ |
1418 | 1416 | MXS_ADC_CHAN(12, IIO_VOLTAGE), /* VDDA */ |
... | ... | @@ -1582,6 +1580,11 @@ |
1582 | 1580 | } |
1583 | 1581 | |
1584 | 1582 | touch_ret = mxs_lradc_probe_touchscreen(lradc, node); |
1583 | + | |
1584 | + if (touch_ret == 0) | |
1585 | + lradc->buffer_vchans = BUFFER_VCHANS_LIMITED; | |
1586 | + else | |
1587 | + lradc->buffer_vchans = BUFFER_VCHANS_ALL; | |
1585 | 1588 | |
1586 | 1589 | /* Grab all IRQ sources */ |
1587 | 1590 | for (i = 0; i < of_cfg->irq_count; i++) { |
drivers/staging/iio/resolver/ad2s1200.c
... | ... | @@ -18,6 +18,7 @@ |
18 | 18 | #include <linux/delay.h> |
19 | 19 | #include <linux/gpio.h> |
20 | 20 | #include <linux/module.h> |
21 | +#include <linux/bitops.h> | |
21 | 22 | |
22 | 23 | #include <linux/iio/iio.h> |
23 | 24 | #include <linux/iio/sysfs.h> |
... | ... | @@ -68,7 +69,7 @@ |
68 | 69 | break; |
69 | 70 | case IIO_ANGL_VEL: |
70 | 71 | vel = (((s16)(st->rx[0])) << 4) | ((st->rx[1] & 0xF0) >> 4); |
71 | - vel = (vel << 4) >> 4; | |
72 | + vel = sign_extend32(vel, 11); | |
72 | 73 | *val = vel; |
73 | 74 | break; |
74 | 75 | default: |