Release 4.7 drivers/staging/iio/adc/ad7606_spi.c
/*
* AD7606 SPI ADC driver
*
* Copyright 2011 Analog Devices Inc.
*
* Licensed under the GPL-2.
*/
#include <linux/module.h>
#include <linux/spi/spi.h>
#include <linux/types.h>
#include <linux/err.h>
#include <linux/iio/iio.h>
#include "ad7606.h"
#define MAX_SPI_FREQ_HZ 23500000
/* VDRIVE above 4.75 V */
static int ad7606_spi_read_block(struct device *dev,
int count, void *buf)
{
struct spi_device *spi = to_spi_device(dev);
int i, ret;
unsigned short *data = buf;
__be16 *bdata = buf;
ret = spi_read(spi, buf, count * 2);
if (ret < 0) {
dev_err(&spi->dev, "SPI read error\n");
return ret;
}
for (i = 0; i < count; i++)
data[i] = be16_to_cpu(bdata[i]);
return 0;
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
michael hennerich | michael hennerich | 102 | 93.58% | 1 | 33.33% |
ksenija stanojevic | ksenija stanojevic | 5 | 4.59% | 1 | 33.33% |
arnd bergmann | arnd bergmann | 2 | 1.83% | 1 | 33.33% |
| Total | 109 | 100.00% | 3 | 100.00% |
static const struct ad7606_bus_ops ad7606_spi_bops = {
.read_block = ad7606_spi_read_block,
};
static int ad7606_spi_probe(struct spi_device *spi)
{
struct iio_dev *indio_dev;
indio_dev = ad7606_probe(&spi->dev, spi->irq, NULL,
spi_get_device_id(spi)->driver_data,
&ad7606_spi_bops);
if (IS_ERR(indio_dev))
return PTR_ERR(indio_dev);
spi_set_drvdata(spi, indio_dev);
return 0;
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
michael hennerich | michael hennerich | 65 | 100.00% | 2 | 100.00% |
| Total | 65 | 100.00% | 2 | 100.00% |
static int ad7606_spi_remove(struct spi_device *spi)
{
struct iio_dev *indio_dev = dev_get_drvdata(&spi->dev);
return ad7606_remove(indio_dev, spi->irq);
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
michael hennerich | michael hennerich | 30 | 88.24% | 2 | 66.67% |
jonathan cameron | jonathan cameron | 4 | 11.76% | 1 | 33.33% |
| Total | 34 | 100.00% | 3 | 100.00% |
static const struct spi_device_id ad7606_id[] = {
{"ad7606-8", ID_AD7606_8},
{"ad7606-6", ID_AD7606_6},
{"ad7606-4", ID_AD7606_4},
{}
};
MODULE_DEVICE_TABLE(spi, ad7606_id);
static struct spi_driver ad7606_driver = {
.driver = {
.name = "ad7606",
.pm = AD7606_PM_OPS,
},
.probe = ad7606_spi_probe,
.remove = ad7606_spi_remove,
.id_table = ad7606_id,
};
module_spi_driver(ad7606_driver);
MODULE_AUTHOR("Michael Hennerich <hennerich@blackfin.uclinux.org>");
MODULE_DESCRIPTION("Analog Devices AD7606 ADC");
MODULE_LICENSE("GPL v2");
Overall Contributors
| Person | Tokens | Prop | Commits | CommitProp |
michael hennerich | michael hennerich | 317 | 93.79% | 2 | 22.22% |
lars-peter clausen | lars-peter clausen | 9 | 2.66% | 3 | 33.33% |
ksenija stanojevic | ksenija stanojevic | 5 | 1.48% | 1 | 11.11% |
jonathan cameron | jonathan cameron | 5 | 1.48% | 2 | 22.22% |
arnd bergmann | arnd bergmann | 2 | 0.59% | 1 | 11.11% |
| Total | 338 | 100.00% | 9 | 100.00% |
Information contained on this website is for historical information purposes only and does not indicate or represent copyright ownership.