mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-12-03 00:54:09 +08:00
b33752c300
This patch rejiggers the i2c-hid code so that the OF (Open Firmware aka Device Tree) and ACPI support is separated out a bit. The OF and ACPI drivers are now separate modules that wrap the core module. Essentially, what we're doing here: * Make "power up" and "power down" a function that can be (optionally) implemented by a given user of the i2c-hid core. * The OF and ACPI modules are drivers on their own, so they implement probe / remove / suspend / resume / shutdown. The core code provides implementations that OF and ACPI can call into. We'll organize this so that we now have 3 modules: the old i2c-hid module becomes the "core" module and two new modules will depend on it, handling probing the specific device. As part of this work, we'll remove the i2c-hid "platform data" concept since it's not needed. Signed-off-by: Douglas Anderson <dianders@chromium.org> Reviewed-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
43 lines
1.2 KiB
C
43 lines
1.2 KiB
C
/* SPDX-License-Identifier: GPL-2.0+ */
|
|
|
|
#ifndef I2C_HID_H
|
|
#define I2C_HID_H
|
|
|
|
#include <linux/i2c.h>
|
|
|
|
#ifdef CONFIG_DMI
|
|
struct i2c_hid_desc *i2c_hid_get_dmi_i2c_hid_desc_override(uint8_t *i2c_name);
|
|
char *i2c_hid_get_dmi_hid_report_desc_override(uint8_t *i2c_name,
|
|
unsigned int *size);
|
|
#else
|
|
static inline struct i2c_hid_desc
|
|
*i2c_hid_get_dmi_i2c_hid_desc_override(uint8_t *i2c_name)
|
|
{ return NULL; }
|
|
static inline char *i2c_hid_get_dmi_hid_report_desc_override(uint8_t *i2c_name,
|
|
unsigned int *size)
|
|
{ return NULL; }
|
|
#endif
|
|
|
|
/**
|
|
* struct i2chid_ops - Ops provided to the core.
|
|
*
|
|
* @power_up: do sequencing to power up the device.
|
|
* @power_down: do sequencing to power down the device.
|
|
* @shutdown_tail: called at the end of shutdown.
|
|
*/
|
|
struct i2chid_ops {
|
|
int (*power_up)(struct i2chid_ops *ops);
|
|
void (*power_down)(struct i2chid_ops *ops);
|
|
void (*shutdown_tail)(struct i2chid_ops *ops);
|
|
};
|
|
|
|
int i2c_hid_core_probe(struct i2c_client *client, struct i2chid_ops *ops,
|
|
u16 hid_descriptor_address);
|
|
int i2c_hid_core_remove(struct i2c_client *client);
|
|
|
|
void i2c_hid_core_shutdown(struct i2c_client *client);
|
|
|
|
extern const struct dev_pm_ops i2c_hid_core_pm;
|
|
|
|
#endif
|