162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-only */
262306a36Sopenharmony_ci/*
362306a36Sopenharmony_ci * Copyright (c) 2011-2016 Synaptics Incorporated
462306a36Sopenharmony_ci * Copyright (c) 2011 Unixphere
562306a36Sopenharmony_ci */
662306a36Sopenharmony_ci
762306a36Sopenharmony_ci#ifndef _RMI_H
862306a36Sopenharmony_ci#define _RMI_H
962306a36Sopenharmony_ci#include <linux/kernel.h>
1062306a36Sopenharmony_ci#include <linux/device.h>
1162306a36Sopenharmony_ci#include <linux/interrupt.h>
1262306a36Sopenharmony_ci#include <linux/input.h>
1362306a36Sopenharmony_ci#include <linux/kfifo.h>
1462306a36Sopenharmony_ci#include <linux/list.h>
1562306a36Sopenharmony_ci#include <linux/module.h>
1662306a36Sopenharmony_ci#include <linux/types.h>
1762306a36Sopenharmony_ci
1862306a36Sopenharmony_ci#define NAME_BUFFER_SIZE 256
1962306a36Sopenharmony_ci
2062306a36Sopenharmony_ci/**
2162306a36Sopenharmony_ci * struct rmi_2d_axis_alignment - target axis alignment
2262306a36Sopenharmony_ci * @swap_axes: set to TRUE if desired to swap x- and y-axis
2362306a36Sopenharmony_ci * @flip_x: set to TRUE if desired to flip direction on x-axis
2462306a36Sopenharmony_ci * @flip_y: set to TRUE if desired to flip direction on y-axis
2562306a36Sopenharmony_ci * @clip_x_low - reported X coordinates below this setting will be clipped to
2662306a36Sopenharmony_ci *               the specified value
2762306a36Sopenharmony_ci * @clip_x_high - reported X coordinates above this setting will be clipped to
2862306a36Sopenharmony_ci *               the specified value
2962306a36Sopenharmony_ci * @clip_y_low - reported Y coordinates below this setting will be clipped to
3062306a36Sopenharmony_ci *               the specified value
3162306a36Sopenharmony_ci * @clip_y_high - reported Y coordinates above this setting will be clipped to
3262306a36Sopenharmony_ci *               the specified value
3362306a36Sopenharmony_ci * @offset_x - this value will be added to all reported X coordinates
3462306a36Sopenharmony_ci * @offset_y - this value will be added to all reported Y coordinates
3562306a36Sopenharmony_ci * @rel_report_enabled - if set to true, the relative reporting will be
3662306a36Sopenharmony_ci *               automatically enabled for this sensor.
3762306a36Sopenharmony_ci */
3862306a36Sopenharmony_cistruct rmi_2d_axis_alignment {
3962306a36Sopenharmony_ci	bool swap_axes;
4062306a36Sopenharmony_ci	bool flip_x;
4162306a36Sopenharmony_ci	bool flip_y;
4262306a36Sopenharmony_ci	u16 clip_x_low;
4362306a36Sopenharmony_ci	u16 clip_y_low;
4462306a36Sopenharmony_ci	u16 clip_x_high;
4562306a36Sopenharmony_ci	u16 clip_y_high;
4662306a36Sopenharmony_ci	u16 offset_x;
4762306a36Sopenharmony_ci	u16 offset_y;
4862306a36Sopenharmony_ci	u8 delta_x_threshold;
4962306a36Sopenharmony_ci	u8 delta_y_threshold;
5062306a36Sopenharmony_ci};
5162306a36Sopenharmony_ci
5262306a36Sopenharmony_ci/** This is used to override any hints an F11 2D sensor might have provided
5362306a36Sopenharmony_ci * as to what type of sensor it is.
5462306a36Sopenharmony_ci *
5562306a36Sopenharmony_ci * @rmi_f11_sensor_default - do not override, determine from F11_2D_QUERY14 if
5662306a36Sopenharmony_ci * available.
5762306a36Sopenharmony_ci * @rmi_f11_sensor_touchscreen - treat the sensor as a touchscreen (direct
5862306a36Sopenharmony_ci * pointing).
5962306a36Sopenharmony_ci * @rmi_f11_sensor_touchpad - thread the sensor as a touchpad (indirect
6062306a36Sopenharmony_ci * pointing).
6162306a36Sopenharmony_ci */
6262306a36Sopenharmony_cienum rmi_sensor_type {
6362306a36Sopenharmony_ci	rmi_sensor_default = 0,
6462306a36Sopenharmony_ci	rmi_sensor_touchscreen,
6562306a36Sopenharmony_ci	rmi_sensor_touchpad
6662306a36Sopenharmony_ci};
6762306a36Sopenharmony_ci
6862306a36Sopenharmony_ci#define RMI_F11_DISABLE_ABS_REPORT      BIT(0)
6962306a36Sopenharmony_ci
7062306a36Sopenharmony_ci/**
7162306a36Sopenharmony_ci * struct rmi_2d_sensor_data - overrides defaults for a 2D sensor.
7262306a36Sopenharmony_ci * @axis_align - provides axis alignment overrides (see above).
7362306a36Sopenharmony_ci * @sensor_type - Forces the driver to treat the sensor as an indirect
7462306a36Sopenharmony_ci * pointing device (touchpad) rather than a direct pointing device
7562306a36Sopenharmony_ci * (touchscreen).  This is useful when F11_2D_QUERY14 register is not
7662306a36Sopenharmony_ci * available.
7762306a36Sopenharmony_ci * @disable_report_mask - Force data to not be reported even if it is supported
7862306a36Sopenharmony_ci * by the firware.
7962306a36Sopenharmony_ci * @topbuttonpad - Used with the "5 buttons touchpads" found on the Lenovo 40
8062306a36Sopenharmony_ci * series
8162306a36Sopenharmony_ci * @kernel_tracking - most moderns RMI f11 firmwares implement Multifinger
8262306a36Sopenharmony_ci * Type B protocol. However, there are some corner cases where the user
8362306a36Sopenharmony_ci * triggers some jumps by tapping with two fingers on the touchpad.
8462306a36Sopenharmony_ci * Use this setting and dmax to filter out these jumps.
8562306a36Sopenharmony_ci * Also, when using an old sensor using MF Type A behavior, set to true to
8662306a36Sopenharmony_ci * report an actual MT protocol B.
8762306a36Sopenharmony_ci * @dmax - the maximum distance (in sensor units) the kernel tracking allows two
8862306a36Sopenharmony_ci * distincts fingers to be considered the same.
8962306a36Sopenharmony_ci */
9062306a36Sopenharmony_cistruct rmi_2d_sensor_platform_data {
9162306a36Sopenharmony_ci	struct rmi_2d_axis_alignment axis_align;
9262306a36Sopenharmony_ci	enum rmi_sensor_type sensor_type;
9362306a36Sopenharmony_ci	int x_mm;
9462306a36Sopenharmony_ci	int y_mm;
9562306a36Sopenharmony_ci	int disable_report_mask;
9662306a36Sopenharmony_ci	u16 rezero_wait;
9762306a36Sopenharmony_ci	bool topbuttonpad;
9862306a36Sopenharmony_ci	bool kernel_tracking;
9962306a36Sopenharmony_ci	int dmax;
10062306a36Sopenharmony_ci	int dribble;
10162306a36Sopenharmony_ci	int palm_detect;
10262306a36Sopenharmony_ci};
10362306a36Sopenharmony_ci
10462306a36Sopenharmony_ci/**
10562306a36Sopenharmony_ci * struct rmi_gpio_data - overrides defaults for a single F30/F3A GPIOs/LED
10662306a36Sopenharmony_ci * chip.
10762306a36Sopenharmony_ci * @buttonpad - the touchpad is a buttonpad, so enable only the first actual
10862306a36Sopenharmony_ci * button that is found.
10962306a36Sopenharmony_ci * @trackstick_buttons - Set when the function 30 or 3a is handling the physical
11062306a36Sopenharmony_ci * buttons of the trackstick (as a PS/2 passthrough device).
11162306a36Sopenharmony_ci * @disable - the touchpad incorrectly reports F30/F3A and it should be ignored.
11262306a36Sopenharmony_ci * This is a special case which is due to misconfigured firmware.
11362306a36Sopenharmony_ci */
11462306a36Sopenharmony_cistruct rmi_gpio_data {
11562306a36Sopenharmony_ci	bool buttonpad;
11662306a36Sopenharmony_ci	bool trackstick_buttons;
11762306a36Sopenharmony_ci	bool disable;
11862306a36Sopenharmony_ci};
11962306a36Sopenharmony_ci
12062306a36Sopenharmony_ci
12162306a36Sopenharmony_ci/*
12262306a36Sopenharmony_ci * Set the state of a register
12362306a36Sopenharmony_ci *	DEFAULT - use the default value set by the firmware config
12462306a36Sopenharmony_ci *	OFF - explicitly disable the register
12562306a36Sopenharmony_ci *	ON - explicitly enable the register
12662306a36Sopenharmony_ci */
12762306a36Sopenharmony_cienum rmi_reg_state {
12862306a36Sopenharmony_ci	RMI_REG_STATE_DEFAULT = 0,
12962306a36Sopenharmony_ci	RMI_REG_STATE_OFF = 1,
13062306a36Sopenharmony_ci	RMI_REG_STATE_ON = 2
13162306a36Sopenharmony_ci};
13262306a36Sopenharmony_ci
13362306a36Sopenharmony_ci/**
13462306a36Sopenharmony_ci * struct rmi_f01_power_management -When non-zero, these values will be written
13562306a36Sopenharmony_ci * to the touch sensor to override the default firmware settigns.  For a
13662306a36Sopenharmony_ci * detailed explanation of what each field does, see the corresponding
13762306a36Sopenharmony_ci * documention in the RMI4 specification.
13862306a36Sopenharmony_ci *
13962306a36Sopenharmony_ci * @nosleep - specifies whether the device is permitted to sleep or doze (that
14062306a36Sopenharmony_ci * is, enter a temporary low power state) when no fingers are touching the
14162306a36Sopenharmony_ci * sensor.
14262306a36Sopenharmony_ci * @wakeup_threshold - controls the capacitance threshold at which the touch
14362306a36Sopenharmony_ci * sensor will decide to wake up from that low power state.
14462306a36Sopenharmony_ci * @doze_holdoff - controls how long the touch sensor waits after the last
14562306a36Sopenharmony_ci * finger lifts before entering the doze state, in units of 100ms.
14662306a36Sopenharmony_ci * @doze_interval - controls the interval between checks for finger presence
14762306a36Sopenharmony_ci * when the touch sensor is in doze mode, in units of 10ms.
14862306a36Sopenharmony_ci */
14962306a36Sopenharmony_cistruct rmi_f01_power_management {
15062306a36Sopenharmony_ci	enum rmi_reg_state nosleep;
15162306a36Sopenharmony_ci	u8 wakeup_threshold;
15262306a36Sopenharmony_ci	u8 doze_holdoff;
15362306a36Sopenharmony_ci	u8 doze_interval;
15462306a36Sopenharmony_ci};
15562306a36Sopenharmony_ci
15662306a36Sopenharmony_ci/**
15762306a36Sopenharmony_ci * struct rmi_device_platform_data_spi - provides parameters used in SPI
15862306a36Sopenharmony_ci * communications.  All Synaptics SPI products support a standard SPI
15962306a36Sopenharmony_ci * interface; some also support what is called SPI V2 mode, depending on
16062306a36Sopenharmony_ci * firmware and/or ASIC limitations.  In V2 mode, the touch sensor can
16162306a36Sopenharmony_ci * support shorter delays during certain operations, and these are specified
16262306a36Sopenharmony_ci * separately from the standard mode delays.
16362306a36Sopenharmony_ci *
16462306a36Sopenharmony_ci * @block_delay - for standard SPI transactions consisting of both a read and
16562306a36Sopenharmony_ci * write operation, the delay (in microseconds) between the read and write
16662306a36Sopenharmony_ci * operations.
16762306a36Sopenharmony_ci * @split_read_block_delay_us - for V2 SPI transactions consisting of both a
16862306a36Sopenharmony_ci * read and write operation, the delay (in microseconds) between the read and
16962306a36Sopenharmony_ci * write operations.
17062306a36Sopenharmony_ci * @read_delay_us - the delay between each byte of a read operation in normal
17162306a36Sopenharmony_ci * SPI mode.
17262306a36Sopenharmony_ci * @write_delay_us - the delay between each byte of a write operation in normal
17362306a36Sopenharmony_ci * SPI mode.
17462306a36Sopenharmony_ci * @split_read_byte_delay_us - the delay between each byte of a read operation
17562306a36Sopenharmony_ci * in V2 mode.
17662306a36Sopenharmony_ci * @pre_delay_us - the delay before the start of a SPI transaction.  This is
17762306a36Sopenharmony_ci * typically useful in conjunction with custom chip select assertions (see
17862306a36Sopenharmony_ci * below).
17962306a36Sopenharmony_ci * @post_delay_us - the delay after the completion of an SPI transaction.  This
18062306a36Sopenharmony_ci * is typically useful in conjunction with custom chip select assertions (see
18162306a36Sopenharmony_ci * below).
18262306a36Sopenharmony_ci * @cs_assert - For systems where the SPI subsystem does not control the CS/SSB
18362306a36Sopenharmony_ci * line, or where such control is broken, you can provide a custom routine to
18462306a36Sopenharmony_ci * handle a GPIO as CS/SSB.  This routine will be called at the beginning and
18562306a36Sopenharmony_ci * end of each SPI transaction.  The RMI SPI implementation will wait
18662306a36Sopenharmony_ci * pre_delay_us after this routine returns before starting the SPI transfer;
18762306a36Sopenharmony_ci * and post_delay_us after completion of the SPI transfer(s) before calling it
18862306a36Sopenharmony_ci * with assert==FALSE.
18962306a36Sopenharmony_ci */
19062306a36Sopenharmony_cistruct rmi_device_platform_data_spi {
19162306a36Sopenharmony_ci	u32 block_delay_us;
19262306a36Sopenharmony_ci	u32 split_read_block_delay_us;
19362306a36Sopenharmony_ci	u32 read_delay_us;
19462306a36Sopenharmony_ci	u32 write_delay_us;
19562306a36Sopenharmony_ci	u32 split_read_byte_delay_us;
19662306a36Sopenharmony_ci	u32 pre_delay_us;
19762306a36Sopenharmony_ci	u32 post_delay_us;
19862306a36Sopenharmony_ci	u8 bits_per_word;
19962306a36Sopenharmony_ci	u16 mode;
20062306a36Sopenharmony_ci
20162306a36Sopenharmony_ci	void *cs_assert_data;
20262306a36Sopenharmony_ci	int (*cs_assert)(const void *cs_assert_data, const bool assert);
20362306a36Sopenharmony_ci};
20462306a36Sopenharmony_ci
20562306a36Sopenharmony_ci/**
20662306a36Sopenharmony_ci * struct rmi_device_platform_data - system specific configuration info.
20762306a36Sopenharmony_ci *
20862306a36Sopenharmony_ci * @reset_delay_ms - after issuing a reset command to the touch sensor, the
20962306a36Sopenharmony_ci * driver waits a few milliseconds to give the firmware a chance to
21062306a36Sopenharmony_ci * re-initialize.  You can override the default wait period here.
21162306a36Sopenharmony_ci * @irq: irq associated with the attn gpio line, or negative
21262306a36Sopenharmony_ci */
21362306a36Sopenharmony_cistruct rmi_device_platform_data {
21462306a36Sopenharmony_ci	int reset_delay_ms;
21562306a36Sopenharmony_ci	int irq;
21662306a36Sopenharmony_ci
21762306a36Sopenharmony_ci	struct rmi_device_platform_data_spi spi_data;
21862306a36Sopenharmony_ci
21962306a36Sopenharmony_ci	/* function handler pdata */
22062306a36Sopenharmony_ci	struct rmi_2d_sensor_platform_data sensor_pdata;
22162306a36Sopenharmony_ci	struct rmi_f01_power_management power_management;
22262306a36Sopenharmony_ci	struct rmi_gpio_data gpio_data;
22362306a36Sopenharmony_ci};
22462306a36Sopenharmony_ci
22562306a36Sopenharmony_ci/**
22662306a36Sopenharmony_ci * struct rmi_function_descriptor - RMI function base addresses
22762306a36Sopenharmony_ci *
22862306a36Sopenharmony_ci * @query_base_addr: The RMI Query base address
22962306a36Sopenharmony_ci * @command_base_addr: The RMI Command base address
23062306a36Sopenharmony_ci * @control_base_addr: The RMI Control base address
23162306a36Sopenharmony_ci * @data_base_addr: The RMI Data base address
23262306a36Sopenharmony_ci * @interrupt_source_count: The number of irqs this RMI function needs
23362306a36Sopenharmony_ci * @function_number: The RMI function number
23462306a36Sopenharmony_ci *
23562306a36Sopenharmony_ci * This struct is used when iterating the Page Description Table. The addresses
23662306a36Sopenharmony_ci * are 16-bit values to include the current page address.
23762306a36Sopenharmony_ci *
23862306a36Sopenharmony_ci */
23962306a36Sopenharmony_cistruct rmi_function_descriptor {
24062306a36Sopenharmony_ci	u16 query_base_addr;
24162306a36Sopenharmony_ci	u16 command_base_addr;
24262306a36Sopenharmony_ci	u16 control_base_addr;
24362306a36Sopenharmony_ci	u16 data_base_addr;
24462306a36Sopenharmony_ci	u8 interrupt_source_count;
24562306a36Sopenharmony_ci	u8 function_number;
24662306a36Sopenharmony_ci	u8 function_version;
24762306a36Sopenharmony_ci};
24862306a36Sopenharmony_ci
24962306a36Sopenharmony_cistruct rmi_device;
25062306a36Sopenharmony_ci
25162306a36Sopenharmony_ci/**
25262306a36Sopenharmony_ci * struct rmi_transport_dev - represent an RMI transport device
25362306a36Sopenharmony_ci *
25462306a36Sopenharmony_ci * @dev: Pointer to the communication device, e.g. i2c or spi
25562306a36Sopenharmony_ci * @rmi_dev: Pointer to the RMI device
25662306a36Sopenharmony_ci * @proto_name: name of the transport protocol (SPI, i2c, etc)
25762306a36Sopenharmony_ci * @ops: pointer to transport operations implementation
25862306a36Sopenharmony_ci *
25962306a36Sopenharmony_ci * The RMI transport device implements the glue between different communication
26062306a36Sopenharmony_ci * buses such as I2C and SPI.
26162306a36Sopenharmony_ci *
26262306a36Sopenharmony_ci */
26362306a36Sopenharmony_cistruct rmi_transport_dev {
26462306a36Sopenharmony_ci	struct device *dev;
26562306a36Sopenharmony_ci	struct rmi_device *rmi_dev;
26662306a36Sopenharmony_ci
26762306a36Sopenharmony_ci	const char *proto_name;
26862306a36Sopenharmony_ci	const struct rmi_transport_ops *ops;
26962306a36Sopenharmony_ci
27062306a36Sopenharmony_ci	struct rmi_device_platform_data pdata;
27162306a36Sopenharmony_ci
27262306a36Sopenharmony_ci	struct input_dev *input;
27362306a36Sopenharmony_ci};
27462306a36Sopenharmony_ci
27562306a36Sopenharmony_ci/**
27662306a36Sopenharmony_ci * struct rmi_transport_ops - defines transport protocol operations.
27762306a36Sopenharmony_ci *
27862306a36Sopenharmony_ci * @write_block: Writing a block of data to the specified address
27962306a36Sopenharmony_ci * @read_block: Read a block of data from the specified address.
28062306a36Sopenharmony_ci */
28162306a36Sopenharmony_cistruct rmi_transport_ops {
28262306a36Sopenharmony_ci	int (*write_block)(struct rmi_transport_dev *xport, u16 addr,
28362306a36Sopenharmony_ci			   const void *buf, size_t len);
28462306a36Sopenharmony_ci	int (*read_block)(struct rmi_transport_dev *xport, u16 addr,
28562306a36Sopenharmony_ci			  void *buf, size_t len);
28662306a36Sopenharmony_ci	int (*reset)(struct rmi_transport_dev *xport, u16 reset_addr);
28762306a36Sopenharmony_ci};
28862306a36Sopenharmony_ci
28962306a36Sopenharmony_ci/**
29062306a36Sopenharmony_ci * struct rmi_driver - driver for an RMI4 sensor on the RMI bus.
29162306a36Sopenharmony_ci *
29262306a36Sopenharmony_ci * @driver: Device driver model driver
29362306a36Sopenharmony_ci * @reset_handler: Called when a reset is detected.
29462306a36Sopenharmony_ci * @clear_irq_bits: Clear the specified bits in the current interrupt mask.
29562306a36Sopenharmony_ci * @set_irq_bist: Set the specified bits in the current interrupt mask.
29662306a36Sopenharmony_ci * @store_productid: Callback for cache product id from function 01
29762306a36Sopenharmony_ci * @data: Private data pointer
29862306a36Sopenharmony_ci *
29962306a36Sopenharmony_ci */
30062306a36Sopenharmony_cistruct rmi_driver {
30162306a36Sopenharmony_ci	struct device_driver driver;
30262306a36Sopenharmony_ci
30362306a36Sopenharmony_ci	int (*reset_handler)(struct rmi_device *rmi_dev);
30462306a36Sopenharmony_ci	int (*clear_irq_bits)(struct rmi_device *rmi_dev, unsigned long *mask);
30562306a36Sopenharmony_ci	int (*set_irq_bits)(struct rmi_device *rmi_dev, unsigned long *mask);
30662306a36Sopenharmony_ci	int (*store_productid)(struct rmi_device *rmi_dev);
30762306a36Sopenharmony_ci	int (*set_input_params)(struct rmi_device *rmi_dev,
30862306a36Sopenharmony_ci			struct input_dev *input);
30962306a36Sopenharmony_ci	void *data;
31062306a36Sopenharmony_ci};
31162306a36Sopenharmony_ci
31262306a36Sopenharmony_ci/**
31362306a36Sopenharmony_ci * struct rmi_device - represents an RMI4 sensor device on the RMI bus.
31462306a36Sopenharmony_ci *
31562306a36Sopenharmony_ci * @dev: The device created for the RMI bus
31662306a36Sopenharmony_ci * @number: Unique number for the device on the bus.
31762306a36Sopenharmony_ci * @driver: Pointer to associated driver
31862306a36Sopenharmony_ci * @xport: Pointer to the transport interface
31962306a36Sopenharmony_ci *
32062306a36Sopenharmony_ci */
32162306a36Sopenharmony_cistruct rmi_device {
32262306a36Sopenharmony_ci	struct device dev;
32362306a36Sopenharmony_ci	int number;
32462306a36Sopenharmony_ci
32562306a36Sopenharmony_ci	struct rmi_driver *driver;
32662306a36Sopenharmony_ci	struct rmi_transport_dev *xport;
32762306a36Sopenharmony_ci
32862306a36Sopenharmony_ci};
32962306a36Sopenharmony_ci
33062306a36Sopenharmony_cistruct rmi4_attn_data {
33162306a36Sopenharmony_ci	unsigned long irq_status;
33262306a36Sopenharmony_ci	size_t size;
33362306a36Sopenharmony_ci	void *data;
33462306a36Sopenharmony_ci};
33562306a36Sopenharmony_ci
33662306a36Sopenharmony_cistruct rmi_driver_data {
33762306a36Sopenharmony_ci	struct list_head function_list;
33862306a36Sopenharmony_ci
33962306a36Sopenharmony_ci	struct rmi_device *rmi_dev;
34062306a36Sopenharmony_ci
34162306a36Sopenharmony_ci	struct rmi_function *f01_container;
34262306a36Sopenharmony_ci	struct rmi_function *f34_container;
34362306a36Sopenharmony_ci	bool bootloader_mode;
34462306a36Sopenharmony_ci
34562306a36Sopenharmony_ci	int num_of_irq_regs;
34662306a36Sopenharmony_ci	int irq_count;
34762306a36Sopenharmony_ci	void *irq_memory;
34862306a36Sopenharmony_ci	unsigned long *irq_status;
34962306a36Sopenharmony_ci	unsigned long *fn_irq_bits;
35062306a36Sopenharmony_ci	unsigned long *current_irq_mask;
35162306a36Sopenharmony_ci	unsigned long *new_irq_mask;
35262306a36Sopenharmony_ci	struct mutex irq_mutex;
35362306a36Sopenharmony_ci	struct input_dev *input;
35462306a36Sopenharmony_ci
35562306a36Sopenharmony_ci	struct irq_domain *irqdomain;
35662306a36Sopenharmony_ci
35762306a36Sopenharmony_ci	u8 pdt_props;
35862306a36Sopenharmony_ci
35962306a36Sopenharmony_ci	u8 num_rx_electrodes;
36062306a36Sopenharmony_ci	u8 num_tx_electrodes;
36162306a36Sopenharmony_ci
36262306a36Sopenharmony_ci	bool enabled;
36362306a36Sopenharmony_ci	struct mutex enabled_mutex;
36462306a36Sopenharmony_ci
36562306a36Sopenharmony_ci	struct rmi4_attn_data attn_data;
36662306a36Sopenharmony_ci	DECLARE_KFIFO(attn_fifo, struct rmi4_attn_data, 16);
36762306a36Sopenharmony_ci};
36862306a36Sopenharmony_ci
36962306a36Sopenharmony_ciint rmi_register_transport_device(struct rmi_transport_dev *xport);
37062306a36Sopenharmony_civoid rmi_unregister_transport_device(struct rmi_transport_dev *xport);
37162306a36Sopenharmony_ci
37262306a36Sopenharmony_civoid rmi_set_attn_data(struct rmi_device *rmi_dev, unsigned long irq_status,
37362306a36Sopenharmony_ci		       void *data, size_t size);
37462306a36Sopenharmony_ci
37562306a36Sopenharmony_ciint rmi_driver_suspend(struct rmi_device *rmi_dev, bool enable_wake);
37662306a36Sopenharmony_ciint rmi_driver_resume(struct rmi_device *rmi_dev, bool clear_wake);
37762306a36Sopenharmony_ci#endif
378