for (c = 0; c < indio_dev->num_channels; c++) { if (test_bit(c, scan_mask))
ret = iio_backend_chan_enable(st->back, c); else
ret = iio_backend_chan_disable(st->back, c); if (ret) return ret;
}
st->back = devm_iio_backend_get(dev, NULL); if (IS_ERR(st->back)) return PTR_ERR(st->back);
/* If the device is iio_backend powered the PWM is mandatory */ if (!st->cnvst_pwm) return dev_err_probe(st->dev, -EINVAL, "A PWM is mandatory when using backend.\n");
ret = devm_iio_backend_request_buffer(dev, st->back, indio_dev); if (ret) return ret;
ret = devm_iio_backend_enable(dev, st->back); if (ret) return ret;
for (c = 0; c < indio_dev->num_channels; c++) {
ret = iio_backend_data_format_set(st->back, c, &data); if (ret) return ret;
}
/* * On the parallel interface, the frstdata signal is set to high while * and after reading the sample of the first channel and low for all * other channels. This can be used to check that the incoming data is * correctly aligned. During normal operation the data should never * become unaligned, but some glitch or electrostatic discharge might * cause an extra read or clock cycle. Monitoring the frstdata signal * allows to recover from such failure situations.
*/ int num = count;
u16 *_buf = buf;
staticint ad7606_par8_read_block(struct device *dev, int count, void *buf)
{ struct iio_dev *indio_dev = dev_get_drvdata(dev); struct ad7606_state *st = iio_priv(indio_dev); /* * On the parallel interface, the frstdata signal is set to high while * and after reading the sample of the first channel and low for all * other channels. This can be used to check that the incoming data is * correctly aligned. During normal operation the data should never * become unaligned, but some glitch or electrostatic discharge might * cause an extra read or clock cycle. Monitoring the frstdata signal * allows to recover from such failure situations.
*/ int num = count;
u16 *_buf = buf;
if (st->gpio_frstdata) {
insb((unsignedlong)st->base_address, _buf, 2); if (!gpiod_get_value(st->gpio_frstdata)) {
ad7606_reset(st); return -EIO;
}
_buf++;
num--;
}
insb((unsignedlong)st->base_address, _buf, num * 2);
/* * If a firmware node is available (ACPI or DT), platform_device_id is null * and we must use get_match_data.
*/ if (dev_fwnode(&pdev->dev)) {
chip_info = device_get_match_data(&pdev->dev); if (device_property_present(&pdev->dev, "io-backends")) /* * If a backend is available ,call the core probe with backend * bops, otherwise use the former bops.
*/ return ad7606_probe(&pdev->dev, 0, NULL,
chip_info,
&ad7606_bi_bops);
} else {
id = platform_get_device_id(pdev);
chip_info = (conststruct ad7606_chip_info *)id->driver_data;
}
irq = platform_get_irq(pdev, 0); if (irq < 0) return irq;
addr = devm_platform_get_and_ioremap_resource(pdev, 0, &res); if (IS_ERR(addr)) return PTR_ERR(addr);
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.