blob: 3c85455aa66d23329d3605fb367d400d320e4976 [file] [log] [blame]
Bryan Wu31a62962010-03-21 23:23:24 -07001/*
2 * AD714X CapTouch Programmable Controller driver (bus interfaces)
3 *
Michael Hennerich9eff794b72011-08-22 09:45:42 -07004 * Copyright 2009-2011 Analog Devices Inc.
Bryan Wu31a62962010-03-21 23:23:24 -07005 *
6 * Licensed under the GPL-2 or later.
7 */
8
9#ifndef _AD714X_H_
10#define _AD714X_H_
11
12#include <linux/types.h>
13
Dmitry Torokhovc0409fe2011-08-22 09:45:39 -070014#define STAGE_NUM 12
15
Bryan Wu31a62962010-03-21 23:23:24 -070016struct device;
Dmitry Torokhovc0409fe2011-08-22 09:45:39 -070017struct ad714x_platform_data;
18struct ad714x_driver_data;
Bryan Wu31a62962010-03-21 23:23:24 -070019struct ad714x_chip;
20
Michael Hennerich9eff794b72011-08-22 09:45:42 -070021typedef int (*ad714x_read_t)(struct ad714x_chip *, unsigned short, unsigned short *, size_t);
Dmitry Torokhovc0409fe2011-08-22 09:45:39 -070022typedef int (*ad714x_write_t)(struct ad714x_chip *, unsigned short, unsigned short);
23
24struct ad714x_chip {
Dmitry Torokhovc0409fe2011-08-22 09:45:39 -070025 unsigned short l_state;
Michael Hennerich9eff794b72011-08-22 09:45:42 -070026 unsigned short h_state;
Dmitry Torokhovc0409fe2011-08-22 09:45:39 -070027 unsigned short c_state;
28 unsigned short adc_reg[STAGE_NUM];
29 unsigned short amb_reg[STAGE_NUM];
30 unsigned short sensor_val[STAGE_NUM];
31
32 struct ad714x_platform_data *hw;
33 struct ad714x_driver_data *sw;
34
35 int irq;
36 struct device *dev;
37 ad714x_read_t read;
38 ad714x_write_t write;
39
40 struct mutex mutex;
41
42 unsigned product;
43 unsigned version;
44
45 __be16 xfer_buf[16] ____cacheline_aligned;
46
47};
Bryan Wu31a62962010-03-21 23:23:24 -070048
49int ad714x_disable(struct ad714x_chip *ad714x);
50int ad714x_enable(struct ad714x_chip *ad714x);
51struct ad714x_chip *ad714x_probe(struct device *dev, u16 bus_type, int irq,
52 ad714x_read_t read, ad714x_write_t write);
53void ad714x_remove(struct ad714x_chip *ad714x);
54
55#endif