xref: /openbmc/linux/drivers/input/misc/ad714x.h (revision c0a150ee)
180503b23SThomas Gleixner /* SPDX-License-Identifier: GPL-2.0-or-later */
231a62963SBryan Wu /*
331a62963SBryan Wu  * AD714X CapTouch Programmable Controller driver (bus interfaces)
431a62963SBryan Wu  *
59eff794bSMichael Hennerich  * Copyright 2009-2011 Analog Devices Inc.
631a62963SBryan Wu  */
731a62963SBryan Wu 
831a62963SBryan Wu #ifndef _AD714X_H_
931a62963SBryan Wu #define _AD714X_H_
1031a62963SBryan Wu 
11*c0a150eeSJonathan Cameron #include <linux/pm.h>
1231a62963SBryan Wu #include <linux/types.h>
1331a62963SBryan Wu 
14c0409febSDmitry Torokhov #define STAGE_NUM              12
15c0409febSDmitry Torokhov 
1631a62963SBryan Wu struct device;
17c0409febSDmitry Torokhov struct ad714x_platform_data;
18c0409febSDmitry Torokhov struct ad714x_driver_data;
1931a62963SBryan Wu struct ad714x_chip;
2031a62963SBryan Wu 
219eff794bSMichael Hennerich typedef int (*ad714x_read_t)(struct ad714x_chip *, unsigned short, unsigned short *, size_t);
22c0409febSDmitry Torokhov typedef int (*ad714x_write_t)(struct ad714x_chip *, unsigned short, unsigned short);
23c0409febSDmitry Torokhov 
24c0409febSDmitry Torokhov struct ad714x_chip {
25c0409febSDmitry Torokhov 	unsigned short l_state;
269eff794bSMichael Hennerich 	unsigned short h_state;
27c0409febSDmitry Torokhov 	unsigned short c_state;
28c0409febSDmitry Torokhov 	unsigned short adc_reg[STAGE_NUM];
29c0409febSDmitry Torokhov 	unsigned short amb_reg[STAGE_NUM];
30c0409febSDmitry Torokhov 	unsigned short sensor_val[STAGE_NUM];
31c0409febSDmitry Torokhov 
32c0409febSDmitry Torokhov 	struct ad714x_platform_data *hw;
33c0409febSDmitry Torokhov 	struct ad714x_driver_data *sw;
34c0409febSDmitry Torokhov 
35c0409febSDmitry Torokhov 	int irq;
36c0409febSDmitry Torokhov 	struct device *dev;
37c0409febSDmitry Torokhov 	ad714x_read_t read;
38c0409febSDmitry Torokhov 	ad714x_write_t write;
39c0409febSDmitry Torokhov 
40c0409febSDmitry Torokhov 	struct mutex mutex;
41c0409febSDmitry Torokhov 
42c0409febSDmitry Torokhov 	unsigned product;
43c0409febSDmitry Torokhov 	unsigned version;
44c0409febSDmitry Torokhov 
45c0409febSDmitry Torokhov 	__be16 xfer_buf[16] ____cacheline_aligned;
46c0409febSDmitry Torokhov 
47c0409febSDmitry Torokhov };
4831a62963SBryan Wu 
49*c0a150eeSJonathan Cameron extern const struct dev_pm_ops ad714x_pm;
5031a62963SBryan Wu struct ad714x_chip *ad714x_probe(struct device *dev, u16 bus_type, int irq,
5131a62963SBryan Wu 				 ad714x_read_t read, ad714x_write_t write);
5231a62963SBryan Wu 
5331a62963SBryan Wu #endif
54