aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/arm/mach-at91/at91sam9260_devices.c2
-rw-r--r--arch/arm/mach-at91/at91sam9g45_devices.c2
-rw-r--r--drivers/iio/adc/at91_adc.c33
-rw-r--r--drivers/iio/industrialio-buffer.c6
-rw-r--r--drivers/iio/light/cm32181.c1
-rw-r--r--drivers/iio/light/cm36651.c22
-rw-r--r--drivers/staging/comedi/drivers/usbdux.c9
-rw-r--r--drivers/staging/iio/adc/mxs-lradc.c2
-rw-r--r--drivers/staging/iio/resolver/ad2s1200.c1
9 files changed, 59 insertions, 19 deletions
diff --git a/arch/arm/mach-at91/at91sam9260_devices.c b/arch/arm/mach-at91/at91sam9260_devices.c
index 8b1b0a870025..a0282928e9c1 100644
--- a/arch/arm/mach-at91/at91sam9260_devices.c
+++ b/arch/arm/mach-at91/at91sam9260_devices.c
@@ -1296,7 +1296,7 @@ static struct resource adc_resources[] = {
1296}; 1296};
1297 1297
1298static struct platform_device at91_adc_device = { 1298static struct platform_device at91_adc_device = {
1299 .name = "at91_adc", 1299 .name = "at91sam9260-adc",
1300 .id = -1, 1300 .id = -1,
1301 .dev = { 1301 .dev = {
1302 .platform_data = &adc_data, 1302 .platform_data = &adc_data,
diff --git a/arch/arm/mach-at91/at91sam9g45_devices.c b/arch/arm/mach-at91/at91sam9g45_devices.c
index 77b04c2edd78..dab362c06487 100644
--- a/arch/arm/mach-at91/at91sam9g45_devices.c
+++ b/arch/arm/mach-at91/at91sam9g45_devices.c
@@ -1204,7 +1204,7 @@ static struct resource adc_resources[] = {
1204}; 1204};
1205 1205
1206static struct platform_device at91_adc_device = { 1206static struct platform_device at91_adc_device = {
1207 .name = "at91_adc", 1207 .name = "at91sam9g45-adc",
1208 .id = -1, 1208 .id = -1,
1209 .dev = { 1209 .dev = {
1210 .platform_data = &adc_data, 1210 .platform_data = &adc_data,
diff --git a/drivers/iio/adc/at91_adc.c b/drivers/iio/adc/at91_adc.c
index 5b1aa027c034..89777ed9abd8 100644
--- a/drivers/iio/adc/at91_adc.c
+++ b/drivers/iio/adc/at91_adc.c
@@ -765,14 +765,17 @@ static int at91_adc_probe_pdata(struct at91_adc_state *st,
765 if (!pdata) 765 if (!pdata)
766 return -EINVAL; 766 return -EINVAL;
767 767
768 st->caps = (struct at91_adc_caps *)
769 platform_get_device_id(pdev)->driver_data;
770
768 st->use_external = pdata->use_external_triggers; 771 st->use_external = pdata->use_external_triggers;
769 st->vref_mv = pdata->vref; 772 st->vref_mv = pdata->vref;
770 st->channels_mask = pdata->channels_used; 773 st->channels_mask = pdata->channels_used;
771 st->num_channels = pdata->num_channels; 774 st->num_channels = st->caps->num_channels;
772 st->startup_time = pdata->startup_time; 775 st->startup_time = pdata->startup_time;
773 st->trigger_number = pdata->trigger_number; 776 st->trigger_number = pdata->trigger_number;
774 st->trigger_list = pdata->trigger_list; 777 st->trigger_list = pdata->trigger_list;
775 st->registers = pdata->registers; 778 st->registers = &st->caps->registers;
776 779
777 return 0; 780 return 0;
778} 781}
@@ -1004,8 +1007,11 @@ static int at91_adc_probe(struct platform_device *pdev)
1004 * the best converted final value between two channels selection 1007 * the best converted final value between two channels selection
1005 * The formula thus is : Sample and Hold Time = (shtim + 1) / ADCClock 1008 * The formula thus is : Sample and Hold Time = (shtim + 1) / ADCClock
1006 */ 1009 */
1007 shtim = round_up((st->sample_hold_time * adc_clk_khz / 1010 if (st->sample_hold_time > 0)
1008 1000) - 1, 1); 1011 shtim = round_up((st->sample_hold_time * adc_clk_khz / 1000)
1012 - 1, 1);
1013 else
1014 shtim = 0;
1009 1015
1010 reg = AT91_ADC_PRESCAL_(prsc) & st->registers->mr_prescal_mask; 1016 reg = AT91_ADC_PRESCAL_(prsc) & st->registers->mr_prescal_mask;
1011 reg |= AT91_ADC_STARTUP_(ticks) & st->registers->mr_startup_mask; 1017 reg |= AT91_ADC_STARTUP_(ticks) & st->registers->mr_startup_mask;
@@ -1101,7 +1107,6 @@ static int at91_adc_remove(struct platform_device *pdev)
1101 return 0; 1107 return 0;
1102} 1108}
1103 1109
1104#ifdef CONFIG_OF
1105static struct at91_adc_caps at91sam9260_caps = { 1110static struct at91_adc_caps at91sam9260_caps = {
1106 .calc_startup_ticks = calc_startup_ticks_9260, 1111 .calc_startup_ticks = calc_startup_ticks_9260,
1107 .num_channels = 4, 1112 .num_channels = 4,
@@ -1154,11 +1159,27 @@ static const struct of_device_id at91_adc_dt_ids[] = {
1154 {}, 1159 {},
1155}; 1160};
1156MODULE_DEVICE_TABLE(of, at91_adc_dt_ids); 1161MODULE_DEVICE_TABLE(of, at91_adc_dt_ids);
1157#endif 1162
1163static const struct platform_device_id at91_adc_ids[] = {
1164 {
1165 .name = "at91sam9260-adc",
1166 .driver_data = (unsigned long)&at91sam9260_caps,
1167 }, {
1168 .name = "at91sam9g45-adc",
1169 .driver_data = (unsigned long)&at91sam9g45_caps,
1170 }, {
1171 .name = "at91sam9x5-adc",
1172 .driver_data = (unsigned long)&at91sam9x5_caps,
1173 }, {
1174 /* terminator */
1175 }
1176};
1177MODULE_DEVICE_TABLE(platform, at91_adc_ids);
1158 1178
1159static struct platform_driver at91_adc_driver = { 1179static struct platform_driver at91_adc_driver = {
1160 .probe = at91_adc_probe, 1180 .probe = at91_adc_probe,
1161 .remove = at91_adc_remove, 1181 .remove = at91_adc_remove,
1182 .id_table = at91_adc_ids,
1162 .driver = { 1183 .driver = {
1163 .name = DRIVER_NAME, 1184 .name = DRIVER_NAME,
1164 .of_match_table = of_match_ptr(at91_adc_dt_ids), 1185 .of_match_table = of_match_ptr(at91_adc_dt_ids),
diff --git a/drivers/iio/industrialio-buffer.c b/drivers/iio/industrialio-buffer.c
index e108f2a9d827..e472cff6eeae 100644
--- a/drivers/iio/industrialio-buffer.c
+++ b/drivers/iio/industrialio-buffer.c
@@ -165,7 +165,8 @@ static ssize_t iio_scan_el_show(struct device *dev,
165 int ret; 165 int ret;
166 struct iio_dev *indio_dev = dev_to_iio_dev(dev); 166 struct iio_dev *indio_dev = dev_to_iio_dev(dev);
167 167
168 ret = test_bit(to_iio_dev_attr(attr)->address, 168 /* Ensure ret is 0 or 1. */
169 ret = !!test_bit(to_iio_dev_attr(attr)->address,
169 indio_dev->buffer->scan_mask); 170 indio_dev->buffer->scan_mask);
170 171
171 return sprintf(buf, "%d\n", ret); 172 return sprintf(buf, "%d\n", ret);
@@ -862,7 +863,8 @@ int iio_scan_mask_query(struct iio_dev *indio_dev,
862 if (!buffer->scan_mask) 863 if (!buffer->scan_mask)
863 return 0; 864 return 0;
864 865
865 return test_bit(bit, buffer->scan_mask); 866 /* Ensure return value is 0 or 1. */
867 return !!test_bit(bit, buffer->scan_mask);
866}; 868};
867EXPORT_SYMBOL_GPL(iio_scan_mask_query); 869EXPORT_SYMBOL_GPL(iio_scan_mask_query);
868 870
diff --git a/drivers/iio/light/cm32181.c b/drivers/iio/light/cm32181.c
index 47a6dbac2d0c..d976e6ce60db 100644
--- a/drivers/iio/light/cm32181.c
+++ b/drivers/iio/light/cm32181.c
@@ -221,6 +221,7 @@ static int cm32181_read_raw(struct iio_dev *indio_dev,
221 *val = cm32181->calibscale; 221 *val = cm32181->calibscale;
222 return IIO_VAL_INT; 222 return IIO_VAL_INT;
223 case IIO_CHAN_INFO_INT_TIME: 223 case IIO_CHAN_INFO_INT_TIME:
224 *val = 0;
224 ret = cm32181_read_als_it(cm32181, val2); 225 ret = cm32181_read_als_it(cm32181, val2);
225 return ret; 226 return ret;
226 } 227 }
diff --git a/drivers/iio/light/cm36651.c b/drivers/iio/light/cm36651.c
index a45e07492db3..39fc67e82138 100644
--- a/drivers/iio/light/cm36651.c
+++ b/drivers/iio/light/cm36651.c
@@ -652,7 +652,19 @@ static int cm36651_probe(struct i2c_client *client,
652 cm36651->client = client; 652 cm36651->client = client;
653 cm36651->ps_client = i2c_new_dummy(client->adapter, 653 cm36651->ps_client = i2c_new_dummy(client->adapter,
654 CM36651_I2C_ADDR_PS); 654 CM36651_I2C_ADDR_PS);
655 if (!cm36651->ps_client) {
656 dev_err(&client->dev, "%s: new i2c device failed\n", __func__);
657 ret = -ENODEV;
658 goto error_disable_reg;
659 }
660
655 cm36651->ara_client = i2c_new_dummy(client->adapter, CM36651_ARA); 661 cm36651->ara_client = i2c_new_dummy(client->adapter, CM36651_ARA);
662 if (!cm36651->ara_client) {
663 dev_err(&client->dev, "%s: new i2c device failed\n", __func__);
664 ret = -ENODEV;
665 goto error_i2c_unregister_ps;
666 }
667
656 mutex_init(&cm36651->lock); 668 mutex_init(&cm36651->lock);
657 indio_dev->dev.parent = &client->dev; 669 indio_dev->dev.parent = &client->dev;
658 indio_dev->channels = cm36651_channels; 670 indio_dev->channels = cm36651_channels;
@@ -664,7 +676,7 @@ static int cm36651_probe(struct i2c_client *client,
664 ret = cm36651_setup_reg(cm36651); 676 ret = cm36651_setup_reg(cm36651);
665 if (ret) { 677 if (ret) {
666 dev_err(&client->dev, "%s: register setup failed\n", __func__); 678 dev_err(&client->dev, "%s: register setup failed\n", __func__);
667 goto error_disable_reg; 679 goto error_i2c_unregister_ara;
668 } 680 }
669 681
670 ret = request_threaded_irq(client->irq, NULL, cm36651_irq_handler, 682 ret = request_threaded_irq(client->irq, NULL, cm36651_irq_handler,
@@ -672,7 +684,7 @@ static int cm36651_probe(struct i2c_client *client,
672 "cm36651", indio_dev); 684 "cm36651", indio_dev);
673 if (ret) { 685 if (ret) {
674 dev_err(&client->dev, "%s: request irq failed\n", __func__); 686 dev_err(&client->dev, "%s: request irq failed\n", __func__);
675 goto error_disable_reg; 687 goto error_i2c_unregister_ara;
676 } 688 }
677 689
678 ret = iio_device_register(indio_dev); 690 ret = iio_device_register(indio_dev);
@@ -685,6 +697,10 @@ static int cm36651_probe(struct i2c_client *client,
685 697
686error_free_irq: 698error_free_irq:
687 free_irq(client->irq, indio_dev); 699 free_irq(client->irq, indio_dev);
700error_i2c_unregister_ara:
701 i2c_unregister_device(cm36651->ara_client);
702error_i2c_unregister_ps:
703 i2c_unregister_device(cm36651->ps_client);
688error_disable_reg: 704error_disable_reg:
689 regulator_disable(cm36651->vled_reg); 705 regulator_disable(cm36651->vled_reg);
690 return ret; 706 return ret;
@@ -698,6 +714,8 @@ static int cm36651_remove(struct i2c_client *client)
698 iio_device_unregister(indio_dev); 714 iio_device_unregister(indio_dev);
699 regulator_disable(cm36651->vled_reg); 715 regulator_disable(cm36651->vled_reg);
700 free_irq(client->irq, indio_dev); 716 free_irq(client->irq, indio_dev);
717 i2c_unregister_device(cm36651->ps_client);
718 i2c_unregister_device(cm36651->ara_client);
701 719
702 return 0; 720 return 0;
703} 721}
diff --git a/drivers/staging/comedi/drivers/usbdux.c b/drivers/staging/comedi/drivers/usbdux.c
index 71db683098d6..b59af0303581 100644
--- a/drivers/staging/comedi/drivers/usbdux.c
+++ b/drivers/staging/comedi/drivers/usbdux.c
@@ -493,7 +493,7 @@ static void usbduxsub_ao_isoc_irq(struct urb *urb)
493 /* pointer to the DA */ 493 /* pointer to the DA */
494 *datap++ = val & 0xff; 494 *datap++ = val & 0xff;
495 *datap++ = (val >> 8) & 0xff; 495 *datap++ = (val >> 8) & 0xff;
496 *datap++ = chan; 496 *datap++ = chan << 6;
497 devpriv->ao_readback[chan] = val; 497 devpriv->ao_readback[chan] = val;
498 498
499 s->async->events |= COMEDI_CB_BLOCK; 499 s->async->events |= COMEDI_CB_BLOCK;
@@ -1040,11 +1040,8 @@ static int usbdux_ao_cmd(struct comedi_device *dev, struct comedi_subdevice *s)
1040 /* set current channel of the running acquisition to zero */ 1040 /* set current channel of the running acquisition to zero */
1041 s->async->cur_chan = 0; 1041 s->async->cur_chan = 0;
1042 1042
1043 for (i = 0; i < cmd->chanlist_len; ++i) { 1043 for (i = 0; i < cmd->chanlist_len; ++i)
1044 unsigned int chan = CR_CHAN(cmd->chanlist[i]); 1044 devpriv->ao_chanlist[i] = CR_CHAN(cmd->chanlist[i]);
1045
1046 devpriv->ao_chanlist[i] = chan << 6;
1047 }
1048 1045
1049 /* we count in steps of 1ms (125us) */ 1046 /* we count in steps of 1ms (125us) */
1050 /* 125us mode not used yet */ 1047 /* 125us mode not used yet */
diff --git a/drivers/staging/iio/adc/mxs-lradc.c b/drivers/staging/iio/adc/mxs-lradc.c
index 11fb95201545..dae8d1a9038e 100644
--- a/drivers/staging/iio/adc/mxs-lradc.c
+++ b/drivers/staging/iio/adc/mxs-lradc.c
@@ -1526,7 +1526,7 @@ static int mxs_lradc_probe(struct platform_device *pdev)
1526 struct resource *iores; 1526 struct resource *iores;
1527 int ret = 0, touch_ret; 1527 int ret = 0, touch_ret;
1528 int i, s; 1528 int i, s;
1529 unsigned int scale_uv; 1529 uint64_t scale_uv;
1530 1530
1531 /* Allocate the IIO device. */ 1531 /* Allocate the IIO device. */
1532 iio = devm_iio_device_alloc(dev, sizeof(*lradc)); 1532 iio = devm_iio_device_alloc(dev, sizeof(*lradc));
diff --git a/drivers/staging/iio/resolver/ad2s1200.c b/drivers/staging/iio/resolver/ad2s1200.c
index 36eedd8a0ea9..e2b482045158 100644
--- a/drivers/staging/iio/resolver/ad2s1200.c
+++ b/drivers/staging/iio/resolver/ad2s1200.c
@@ -70,6 +70,7 @@ static int ad2s1200_read_raw(struct iio_dev *indio_dev,
70 vel = (((s16)(st->rx[0])) << 4) | ((st->rx[1] & 0xF0) >> 4); 70 vel = (((s16)(st->rx[0])) << 4) | ((st->rx[1] & 0xF0) >> 4);
71 vel = (vel << 4) >> 4; 71 vel = (vel << 4) >> 4;
72 *val = vel; 72 *val = vel;
73 break;
73 default: 74 default:
74 mutex_unlock(&st->lock); 75 mutex_unlock(&st->lock);
75 return -EINVAL; 76 return -EINVAL;