blob: af847b5f0d0e53f94d9e79d70a43d94a623cb234 [file] [log] [blame]
Thomas Gleixner80503b22019-05-24 12:04:09 +02001/* SPDX-License-Identifier: GPL-2.0-or-later */
Bryan Wu31a62962010-03-21 23:23:24 -07002/*
3 * AD714X CapTouch Programmable Controller driver (bus interfaces)
4 *
Michael Hennerich9eff794b72011-08-22 09:45:42 -07005 * Copyright 2009-2011 Analog Devices Inc.
Bryan Wu31a62962010-03-21 23:23:24 -07006 */
7
8#ifndef _AD714X_H_
9#define _AD714X_H_
10
11#include <linux/types.h>
12
Dmitry Torokhovc0409fe2011-08-22 09:45:39 -070013#define STAGE_NUM 12
14
Bryan Wu31a62962010-03-21 23:23:24 -070015struct device;
Dmitry Torokhovc0409fe2011-08-22 09:45:39 -070016struct ad714x_platform_data;
17struct ad714x_driver_data;
Bryan Wu31a62962010-03-21 23:23:24 -070018struct ad714x_chip;
19
Michael Hennerich9eff794b72011-08-22 09:45:42 -070020typedef int (*ad714x_read_t)(struct ad714x_chip *, unsigned short, unsigned short *, size_t);
Dmitry Torokhovc0409fe2011-08-22 09:45:39 -070021typedef int (*ad714x_write_t)(struct ad714x_chip *, unsigned short, unsigned short);
22
23struct ad714x_chip {
Dmitry Torokhovc0409fe2011-08-22 09:45:39 -070024 unsigned short l_state;
Michael Hennerich9eff794b72011-08-22 09:45:42 -070025 unsigned short h_state;
Dmitry Torokhovc0409fe2011-08-22 09:45:39 -070026 unsigned short c_state;
27 unsigned short adc_reg[STAGE_NUM];
28 unsigned short amb_reg[STAGE_NUM];
29 unsigned short sensor_val[STAGE_NUM];
30
31 struct ad714x_platform_data *hw;
32 struct ad714x_driver_data *sw;
33
34 int irq;
35 struct device *dev;
36 ad714x_read_t read;
37 ad714x_write_t write;
38
39 struct mutex mutex;
40
41 unsigned product;
42 unsigned version;
43
44 __be16 xfer_buf[16] ____cacheline_aligned;
45
46};
Bryan Wu31a62962010-03-21 23:23:24 -070047
48int ad714x_disable(struct ad714x_chip *ad714x);
49int ad714x_enable(struct ad714x_chip *ad714x);
50struct ad714x_chip *ad714x_probe(struct device *dev, u16 bus_type, int irq,
51 ad714x_read_t read, ad714x_write_t write);
Bryan Wu31a62962010-03-21 23:23:24 -070052
53#endif