xref: /linux/drivers/hid/i2c-hid/i2c-hid.h (revision 9a87ffc99ec8eb8d35eed7c4f816d75f5cc9662e)
19ee3e066SJulian Sax /* SPDX-License-Identifier: GPL-2.0+ */
29ee3e066SJulian Sax 
39ee3e066SJulian Sax #ifndef I2C_HID_H
49ee3e066SJulian Sax #define I2C_HID_H
59ee3e066SJulian Sax 
6b33752c3SDouglas Anderson #include <linux/i2c.h>
79ee3e066SJulian Sax 
89ee3e066SJulian Sax #ifdef CONFIG_DMI
99ee3e066SJulian Sax struct i2c_hid_desc *i2c_hid_get_dmi_i2c_hid_desc_override(uint8_t *i2c_name);
109ee3e066SJulian Sax char *i2c_hid_get_dmi_hid_report_desc_override(uint8_t *i2c_name,
119ee3e066SJulian Sax 					       unsigned int *size);
12*a2f416bfSAllen Ballway u32 i2c_hid_get_dmi_quirks(const u16 vendor, const u16 product);
139ee3e066SJulian Sax #else
149ee3e066SJulian Sax static inline struct i2c_hid_desc
i2c_hid_get_dmi_i2c_hid_desc_override(uint8_t * i2c_name)159ee3e066SJulian Sax 		   *i2c_hid_get_dmi_i2c_hid_desc_override(uint8_t *i2c_name)
169ee3e066SJulian Sax { return NULL; }
i2c_hid_get_dmi_hid_report_desc_override(uint8_t * i2c_name,unsigned int * size)179ee3e066SJulian Sax static inline char *i2c_hid_get_dmi_hid_report_desc_override(uint8_t *i2c_name,
189ee3e066SJulian Sax 							     unsigned int *size)
199ee3e066SJulian Sax { return NULL; }
i2c_hid_get_dmi_quirks(const u16 vendor,const u16 product)20*a2f416bfSAllen Ballway static inline u32 i2c_hid_get_dmi_quirks(const u16 vendor, const u16 product)
21*a2f416bfSAllen Ballway { return 0; }
229ee3e066SJulian Sax #endif
239ee3e066SJulian Sax 
24b33752c3SDouglas Anderson /**
25b33752c3SDouglas Anderson  * struct i2chid_ops - Ops provided to the core.
26b33752c3SDouglas Anderson  *
27b33752c3SDouglas Anderson  * @power_up: do sequencing to power up the device.
28b33752c3SDouglas Anderson  * @power_down: do sequencing to power down the device.
29b33752c3SDouglas Anderson  * @shutdown_tail: called at the end of shutdown.
30b33752c3SDouglas Anderson  */
31b33752c3SDouglas Anderson struct i2chid_ops {
32b33752c3SDouglas Anderson 	int (*power_up)(struct i2chid_ops *ops);
33b33752c3SDouglas Anderson 	void (*power_down)(struct i2chid_ops *ops);
34b33752c3SDouglas Anderson 	void (*shutdown_tail)(struct i2chid_ops *ops);
35b33752c3SDouglas Anderson };
36b33752c3SDouglas Anderson 
37b33752c3SDouglas Anderson int i2c_hid_core_probe(struct i2c_client *client, struct i2chid_ops *ops,
38b60d3c80SAlistair Francis 		       u16 hid_descriptor_address, u32 quirks);
39ed5c2f5fSUwe Kleine-König void i2c_hid_core_remove(struct i2c_client *client);
40b33752c3SDouglas Anderson 
41b33752c3SDouglas Anderson void i2c_hid_core_shutdown(struct i2c_client *client);
42b33752c3SDouglas Anderson 
43b33752c3SDouglas Anderson extern const struct dev_pm_ops i2c_hid_core_pm;
44b33752c3SDouglas Anderson 
459ee3e066SJulian Sax #endif
46