mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-11 12:28:41 +08:00
HID: i2c-hid-of: Expose the touchscreen-inverted properties
Allow the touchscreen-inverted-x/y device tree properties to control the HID_QUIRK_X_INVERT/HID_QUIRK_Y_INVERT quirks for the hid-input device. Signed-off-by: Alistair Francis <alistair@alistair23.me> Acked-by: Rob Herring <robh@kernel.org> [bentiss: silence checkpatch warnings] Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com> Link: https://lore.kernel.org/r/20211208124045.61815-3-alistair@alistair23.me
This commit is contained in:
parent
fd8d135b2c
commit
b60d3c803d
@ -32,6 +32,8 @@ device-specific compatible properties, which should be used in addition to the
|
||||
- vdd-supply: phandle of the regulator that provides the supply voltage.
|
||||
- post-power-on-delay-ms: time required by the device after enabling its regulators
|
||||
or powering it on, before it is ready for communication.
|
||||
- touchscreen-inverted-x: See touchscreen.txt
|
||||
- touchscreen-inverted-y: See touchscreen.txt
|
||||
|
||||
Example:
|
||||
|
||||
|
@ -111,7 +111,7 @@ static int i2c_hid_acpi_probe(struct i2c_client *client)
|
||||
}
|
||||
|
||||
return i2c_hid_core_probe(client, &ihid_acpi->ops,
|
||||
hid_descriptor_address);
|
||||
hid_descriptor_address, 0);
|
||||
}
|
||||
|
||||
static const struct acpi_device_id i2c_hid_acpi_match[] = {
|
||||
|
@ -912,7 +912,7 @@ static void i2c_hid_core_shutdown_tail(struct i2c_hid *ihid)
|
||||
}
|
||||
|
||||
int i2c_hid_core_probe(struct i2c_client *client, struct i2chid_ops *ops,
|
||||
u16 hid_descriptor_address)
|
||||
u16 hid_descriptor_address, u32 quirks)
|
||||
{
|
||||
int ret;
|
||||
struct i2c_hid *ihid;
|
||||
@ -1009,6 +1009,8 @@ int i2c_hid_core_probe(struct i2c_client *client, struct i2chid_ops *ops,
|
||||
goto err_mem_free;
|
||||
}
|
||||
|
||||
hid->quirks |= quirks;
|
||||
|
||||
return 0;
|
||||
|
||||
err_mem_free:
|
||||
|
@ -150,7 +150,7 @@ static int i2c_hid_of_goodix_probe(struct i2c_client *client,
|
||||
goodix_i2c_hid_deassert_reset(ihid_goodix, true);
|
||||
mutex_unlock(&ihid_goodix->regulator_mutex);
|
||||
|
||||
return i2c_hid_core_probe(client, &ihid_goodix->ops, 0x0001);
|
||||
return i2c_hid_core_probe(client, &ihid_goodix->ops, 0x0001, 0);
|
||||
}
|
||||
|
||||
static const struct goodix_i2c_hid_timing_data goodix_gt7375p_timing_data = {
|
||||
|
@ -21,6 +21,7 @@
|
||||
|
||||
#include <linux/delay.h>
|
||||
#include <linux/device.h>
|
||||
#include <linux/hid.h>
|
||||
#include <linux/i2c.h>
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/module.h>
|
||||
@ -71,6 +72,7 @@ static int i2c_hid_of_probe(struct i2c_client *client,
|
||||
struct device *dev = &client->dev;
|
||||
struct i2c_hid_of *ihid_of;
|
||||
u16 hid_descriptor_address;
|
||||
u32 quirks = 0;
|
||||
int ret;
|
||||
u32 val;
|
||||
|
||||
@ -105,8 +107,14 @@ static int i2c_hid_of_probe(struct i2c_client *client,
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
if (device_property_read_bool(dev, "touchscreen-inverted-x"))
|
||||
quirks |= HID_QUIRK_X_INVERT;
|
||||
|
||||
if (device_property_read_bool(dev, "touchscreen-inverted-y"))
|
||||
quirks |= HID_QUIRK_Y_INVERT;
|
||||
|
||||
return i2c_hid_core_probe(client, &ihid_of->ops,
|
||||
hid_descriptor_address);
|
||||
hid_descriptor_address, quirks);
|
||||
}
|
||||
|
||||
static const struct of_device_id i2c_hid_of_match[] = {
|
||||
|
@ -32,7 +32,7 @@ struct i2chid_ops {
|
||||
};
|
||||
|
||||
int i2c_hid_core_probe(struct i2c_client *client, struct i2chid_ops *ops,
|
||||
u16 hid_descriptor_address);
|
||||
u16 hid_descriptor_address, u32 quirks);
|
||||
int i2c_hid_core_remove(struct i2c_client *client);
|
||||
|
||||
void i2c_hid_core_shutdown(struct i2c_client *client);
|
||||
|
Loading…
Reference in New Issue
Block a user