13 #include <linux/module.h>
14 #include <linux/kernel.h>
21 #include <linux/slab.h>
23 #define PCAP_ADC_MAXQ 8
68 spi_message_add_tail(&
t, &
m);
71 t.tx_buf = (
u8 *) &pcap->
buf;
72 t.rx_buf = (
u8 *) &pcap->
buf;
89 ret = ezx_pcap_putget(pcap, &value);
104 ret = ezx_pcap_putget(pcap, value);
118 ret = ezx_pcap_putget(pcap, &tmp);
126 ret = ezx_pcap_putget(pcap, &tmp);
147 static void pcap_mask_irq(
struct irq_data *
d)
149 struct pcap_chip *pcap = irq_data_get_irq_chip_data(d);
155 static void pcap_unmask_irq(
struct irq_data *
d)
157 struct pcap_chip *pcap = irq_data_get_irq_chip_data(d);
163 static struct irq_chip pcap_irq_chip = {
165 .irq_disable = pcap_mask_irq,
166 .irq_mask = pcap_mask_irq,
167 .irq_unmask = pcap_unmask_irq,
198 service = isr & ~msr;
199 for (irq = pcap->
irq_base; service; service >>= 1, irq++) {
208 static void pcap_irq_handler(
unsigned int irq,
struct irq_desc *
desc)
210 struct pcap_chip *pcap = irq_get_handler_data(irq);
231 static void pcap_disable_adc(
struct pcap_chip *pcap)
240 static void pcap_adc_trigger(
struct pcap_chip *pcap)
249 pcap_disable_adc(pcap);
266 static irqreturn_t pcap_adc_irq(
int irq,
void *_pcap)
276 if (
WARN(!req,
"adc irq without pending request\n")) {
300 pcap_adc_trigger(pcap);
333 pcap_adc_trigger(pcap);
339 static void pcap_adc_sync_cb(
void *
param,
u16 res[])
343 req->
res[0] = res[0];
344 req->
res[1] = res[1];
360 res[0] = sync_data.
res[0];
361 res[1] = sync_data.
res[1];
384 pdev->
dev.parent = &pcap->
spi->dev;
414 irq_set_chip_and_handler(i,
NULL,
NULL);
460 dev_err(&spi->
dev,
"can't create pcap thread\n");
487 irq_set_chained_handler(spi->
irq, pcap_irq_handler);
494 ret =
request_irq(adc_irq, pcap_adc_irq, 0,
"ADC", pcap);
500 ret = pcap_add_subdev(pcap, &pdata->
subdevs[i]);
517 irq_set_chip_and_handler(i,
NULL,
NULL);
527 .probe = ezx_pcap_probe,
535 static int __init ezx_pcap_init(
void)
540 static void __exit ezx_pcap_exit(
void)
542 spi_unregister_driver(&ezxpcap_driver);