^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) /* SPDX-License-Identifier: GPL-2.0-or-later */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) * AD714X CapTouch Programmable Controller driver (bus interfaces)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) * Copyright 2009-2011 Analog Devices Inc.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8) #ifndef _AD714X_H_
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9) #define _AD714X_H_
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) #include <linux/types.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) #define STAGE_NUM 12
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) struct device;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) struct ad714x_platform_data;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) struct ad714x_driver_data;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) struct ad714x_chip;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) typedef int (*ad714x_read_t)(struct ad714x_chip *, unsigned short, unsigned short *, size_t);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) typedef int (*ad714x_write_t)(struct ad714x_chip *, unsigned short, unsigned short);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) struct ad714x_chip {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) unsigned short l_state;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) unsigned short h_state;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) unsigned short c_state;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) unsigned short adc_reg[STAGE_NUM];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) unsigned short amb_reg[STAGE_NUM];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) unsigned short sensor_val[STAGE_NUM];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) struct ad714x_platform_data *hw;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) struct ad714x_driver_data *sw;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) int irq;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) struct device *dev;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) ad714x_read_t read;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) ad714x_write_t write;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) struct mutex mutex;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) unsigned product;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) unsigned version;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) __be16 xfer_buf[16] ____cacheline_aligned;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) int ad714x_disable(struct ad714x_chip *ad714x);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) int ad714x_enable(struct ad714x_chip *ad714x);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) struct ad714x_chip *ad714x_probe(struct device *dev, u16 bus_type, int irq,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) ad714x_read_t read, ad714x_write_t write);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) #endif