mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-06 19:07:52 +00:00
HID: i2c-hid-of: Expose the touchscreen-inverted properties
[ Upstream commit b60d3c803d
]
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
Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
bc13af2535
commit
26d516434d
6 changed files with 17 additions and 5 deletions
|
@ -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.
|
- 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
|
- post-power-on-delay-ms: time required by the device after enabling its regulators
|
||||||
or powering it on, before it is ready for communication.
|
or powering it on, before it is ready for communication.
|
||||||
|
- touchscreen-inverted-x: See touchscreen.txt
|
||||||
|
- touchscreen-inverted-y: See touchscreen.txt
|
||||||
|
|
||||||
Example:
|
Example:
|
||||||
|
|
||||||
|
|
|
@ -111,7 +111,7 @@ static int i2c_hid_acpi_probe(struct i2c_client *client)
|
||||||
}
|
}
|
||||||
|
|
||||||
return i2c_hid_core_probe(client, &ihid_acpi->ops,
|
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[] = {
|
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,
|
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;
|
int ret;
|
||||||
struct i2c_hid *ihid;
|
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;
|
goto err_mem_free;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
hid->quirks |= quirks;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
err_mem_free:
|
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);
|
goodix_i2c_hid_deassert_reset(ihid_goodix, true);
|
||||||
mutex_unlock(&ihid_goodix->regulator_mutex);
|
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 = {
|
static const struct goodix_i2c_hid_timing_data goodix_gt7375p_timing_data = {
|
||||||
|
|
|
@ -21,6 +21,7 @@
|
||||||
|
|
||||||
#include <linux/delay.h>
|
#include <linux/delay.h>
|
||||||
#include <linux/device.h>
|
#include <linux/device.h>
|
||||||
|
#include <linux/hid.h>
|
||||||
#include <linux/i2c.h>
|
#include <linux/i2c.h>
|
||||||
#include <linux/kernel.h>
|
#include <linux/kernel.h>
|
||||||
#include <linux/module.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 device *dev = &client->dev;
|
||||||
struct i2c_hid_of *ihid_of;
|
struct i2c_hid_of *ihid_of;
|
||||||
u16 hid_descriptor_address;
|
u16 hid_descriptor_address;
|
||||||
|
u32 quirks = 0;
|
||||||
int ret;
|
int ret;
|
||||||
u32 val;
|
u32 val;
|
||||||
|
|
||||||
|
@ -105,8 +107,14 @@ static int i2c_hid_of_probe(struct i2c_client *client,
|
||||||
if (ret)
|
if (ret)
|
||||||
return 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,
|
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[] = {
|
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,
|
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);
|
int i2c_hid_core_remove(struct i2c_client *client);
|
||||||
|
|
||||||
void i2c_hid_core_shutdown(struct i2c_client *client);
|
void i2c_hid_core_shutdown(struct i2c_client *client);
|
||||||
|
|
Loading…
Reference in a new issue