xref: /OK3568_Linux_fs/kernel/include/linux/platform_data/i2c-hid.h (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun /*
2*4882a593Smuzhiyun  * HID over I2C protocol implementation
3*4882a593Smuzhiyun  *
4*4882a593Smuzhiyun  * Copyright (c) 2012 Benjamin Tissoires <benjamin.tissoires@gmail.com>
5*4882a593Smuzhiyun  * Copyright (c) 2012 Ecole Nationale de l'Aviation Civile, France
6*4882a593Smuzhiyun  *
7*4882a593Smuzhiyun  * This file is subject to the terms and conditions of the GNU General Public
8*4882a593Smuzhiyun  * License.  See the file COPYING in the main directory of this archive for
9*4882a593Smuzhiyun  * more details.
10*4882a593Smuzhiyun  */
11*4882a593Smuzhiyun 
12*4882a593Smuzhiyun #ifndef __LINUX_I2C_HID_H
13*4882a593Smuzhiyun #define __LINUX_I2C_HID_H
14*4882a593Smuzhiyun 
15*4882a593Smuzhiyun #include <linux/regulator/consumer.h>
16*4882a593Smuzhiyun #include <linux/types.h>
17*4882a593Smuzhiyun 
18*4882a593Smuzhiyun /**
19*4882a593Smuzhiyun  * struct i2chid_platform_data - used by hid over i2c implementation.
20*4882a593Smuzhiyun  * @hid_descriptor_address: i2c register where the HID descriptor is stored.
21*4882a593Smuzhiyun  * @supplies: regulators for powering on the device.
22*4882a593Smuzhiyun  * @post_power_delay_ms: delay after powering on before device is usable.
23*4882a593Smuzhiyun  *
24*4882a593Smuzhiyun  * Note that it is the responsibility of the platform driver (or the acpi 5.0
25*4882a593Smuzhiyun  * driver, or the flattened device tree) to setup the irq related to the gpio in
26*4882a593Smuzhiyun  * the struct i2c_board_info.
27*4882a593Smuzhiyun  * The platform driver should also setup the gpio according to the device:
28*4882a593Smuzhiyun  *
29*4882a593Smuzhiyun  * A typical example is the following:
30*4882a593Smuzhiyun  *	irq = gpio_to_irq(intr_gpio);
31*4882a593Smuzhiyun  *	hkdk4412_i2c_devs5[0].irq = irq; // store the irq in i2c_board_info
32*4882a593Smuzhiyun  *	gpio_request(intr_gpio, "elan-irq");
33*4882a593Smuzhiyun  *	s3c_gpio_setpull(intr_gpio, S3C_GPIO_PULL_UP);
34*4882a593Smuzhiyun  */
35*4882a593Smuzhiyun struct i2c_hid_platform_data {
36*4882a593Smuzhiyun 	u16 hid_descriptor_address;
37*4882a593Smuzhiyun 	struct regulator_bulk_data supplies[2];
38*4882a593Smuzhiyun 	int post_power_delay_ms;
39*4882a593Smuzhiyun };
40*4882a593Smuzhiyun 
41*4882a593Smuzhiyun #endif /* __LINUX_I2C_HID_H */
42