aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hid
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/hid')
-rw-r--r--drivers/hid/hid-core.c2
-rw-r--r--drivers/hid/hid-picolcd_cir.c2
-rw-r--r--drivers/hid/hid-sensor-hub.c8
-rw-r--r--drivers/hid/hidraw.c1
-rw-r--r--drivers/hid/i2c-hid/i2c-hid.c99
5 files changed, 92 insertions, 20 deletions
diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c
index eb2ee11b6412..fe3a59e2a5ba 100644
--- a/drivers/hid/hid-core.c
+++ b/drivers/hid/hid-core.c
@@ -729,7 +729,7 @@ static int hid_scan_report(struct hid_device *hid)
729 item.type == HID_ITEM_TYPE_MAIN && 729 item.type == HID_ITEM_TYPE_MAIN &&
730 item.tag == HID_MAIN_ITEM_TAG_BEGIN_COLLECTION && 730 item.tag == HID_MAIN_ITEM_TAG_BEGIN_COLLECTION &&
731 (item_udata(&item) & 0xff) == HID_COLLECTION_PHYSICAL && 731 (item_udata(&item) & 0xff) == HID_COLLECTION_PHYSICAL &&
732 hid->bus == BUS_USB) 732 (hid->bus == BUS_USB || hid->bus == BUS_I2C))
733 hid->group = HID_GROUP_SENSOR_HUB; 733 hid->group = HID_GROUP_SENSOR_HUB;
734 } 734 }
735 735
diff --git a/drivers/hid/hid-picolcd_cir.c b/drivers/hid/hid-picolcd_cir.c
index 13ca9191b630..a79e95bb9fb6 100644
--- a/drivers/hid/hid-picolcd_cir.c
+++ b/drivers/hid/hid-picolcd_cir.c
@@ -116,7 +116,7 @@ int picolcd_init_cir(struct picolcd_data *data, struct hid_report *report)
116 116
117 rdev->priv = data; 117 rdev->priv = data;
118 rdev->driver_type = RC_DRIVER_IR_RAW; 118 rdev->driver_type = RC_DRIVER_IR_RAW;
119 rdev->allowed_protos = RC_TYPE_ALL; 119 rdev->allowed_protos = RC_BIT_ALL;
120 rdev->open = picolcd_cir_open; 120 rdev->open = picolcd_cir_open;
121 rdev->close = picolcd_cir_close; 121 rdev->close = picolcd_cir_close;
122 rdev->input_name = data->hdev->name; 122 rdev->input_name = data->hdev->name;
diff --git a/drivers/hid/hid-sensor-hub.c b/drivers/hid/hid-sensor-hub.c
index 0bc58bd8d4f5..7d96db367477 100644
--- a/drivers/hid/hid-sensor-hub.c
+++ b/drivers/hid/hid-sensor-hub.c
@@ -605,16 +605,12 @@ static void sensor_hub_remove(struct hid_device *hdev)
605} 605}
606 606
607static const struct hid_device_id sensor_hub_devices[] = { 607static const struct hid_device_id sensor_hub_devices[] = {
608 { HID_DEVICE(BUS_USB, HID_GROUP_SENSOR_HUB, HID_ANY_ID, HID_ANY_ID) }, 608 { HID_DEVICE(HID_BUS_ANY, HID_GROUP_SENSOR_HUB, HID_ANY_ID,
609 HID_ANY_ID) },
609 { } 610 { }
610}; 611};
611MODULE_DEVICE_TABLE(hid, sensor_hub_devices); 612MODULE_DEVICE_TABLE(hid, sensor_hub_devices);
612 613
613static const struct hid_usage_id sensor_hub_grabbed_usages[] = {
614 { HID_ANY_ID, HID_ANY_ID, HID_ANY_ID },
615 { HID_ANY_ID - 1, HID_ANY_ID - 1, HID_ANY_ID - 1 }
616};
617
618static struct hid_driver sensor_hub_driver = { 614static struct hid_driver sensor_hub_driver = {
619 .name = "hid-sensor-hub", 615 .name = "hid-sensor-hub",
620 .id_table = sensor_hub_devices, 616 .id_table = sensor_hub_devices,
diff --git a/drivers/hid/hidraw.c b/drivers/hid/hidraw.c
index 413a73187d33..f3bbbce8353b 100644
--- a/drivers/hid/hidraw.c
+++ b/drivers/hid/hidraw.c
@@ -581,6 +581,7 @@ int __init hidraw_init(void)
581 if (result < 0) 581 if (result < 0)
582 goto error_class; 582 goto error_class;
583 583
584 printk(KERN_INFO "hidraw: raw HID events driver (C) Jiri Kosina\n");
584out: 585out:
585 return result; 586 return result;
586 587
diff --git a/drivers/hid/i2c-hid/i2c-hid.c b/drivers/hid/i2c-hid/i2c-hid.c
index 5774ebf4298c..ec7930217a6d 100644
--- a/drivers/hid/i2c-hid/i2c-hid.c
+++ b/drivers/hid/i2c-hid/i2c-hid.c
@@ -34,6 +34,7 @@
34#include <linux/kernel.h> 34#include <linux/kernel.h>
35#include <linux/hid.h> 35#include <linux/hid.h>
36#include <linux/mutex.h> 36#include <linux/mutex.h>
37#include <linux/acpi.h>
37 38
38#include <linux/i2c/i2c-hid.h> 39#include <linux/i2c/i2c-hid.h>
39 40
@@ -139,6 +140,8 @@ struct i2c_hid {
139 unsigned long flags; /* device flags */ 140 unsigned long flags; /* device flags */
140 141
141 wait_queue_head_t wait; /* For waiting the interrupt */ 142 wait_queue_head_t wait; /* For waiting the interrupt */
143
144 struct i2c_hid_platform_data pdata;
142}; 145};
143 146
144static int __i2c_hid_command(struct i2c_client *client, 147static int __i2c_hid_command(struct i2c_client *client,
@@ -742,7 +745,7 @@ static struct hid_ll_driver i2c_hid_ll_driver = {
742 .hidinput_input_event = i2c_hid_hidinput_input_event, 745 .hidinput_input_event = i2c_hid_hidinput_input_event,
743}; 746};
744 747
745static int __devinit i2c_hid_init_irq(struct i2c_client *client) 748static int i2c_hid_init_irq(struct i2c_client *client)
746{ 749{
747 struct i2c_hid *ihid = i2c_get_clientdata(client); 750 struct i2c_hid *ihid = i2c_get_clientdata(client);
748 int ret; 751 int ret;
@@ -764,7 +767,7 @@ static int __devinit i2c_hid_init_irq(struct i2c_client *client)
764 return 0; 767 return 0;
765} 768}
766 769
767static int __devinit i2c_hid_fetch_hid_descriptor(struct i2c_hid *ihid) 770static int i2c_hid_fetch_hid_descriptor(struct i2c_hid *ihid)
768{ 771{
769 struct i2c_client *client = ihid->client; 772 struct i2c_client *client = ihid->client;
770 struct i2c_hid_desc *hdesc = &ihid->hdesc; 773 struct i2c_hid_desc *hdesc = &ihid->hdesc;
@@ -821,8 +824,72 @@ static int __devinit i2c_hid_fetch_hid_descriptor(struct i2c_hid *ihid)
821 return 0; 824 return 0;
822} 825}
823 826
824static int __devinit i2c_hid_probe(struct i2c_client *client, 827#ifdef CONFIG_ACPI
825 const struct i2c_device_id *dev_id) 828static int i2c_hid_acpi_pdata(struct i2c_client *client,
829 struct i2c_hid_platform_data *pdata)
830{
831 static u8 i2c_hid_guid[] = {
832 0xF7, 0xF6, 0xDF, 0x3C, 0x67, 0x42, 0x55, 0x45,
833 0xAD, 0x05, 0xB3, 0x0A, 0x3D, 0x89, 0x38, 0xDE,
834 };
835 struct acpi_buffer buf = { ACPI_ALLOCATE_BUFFER, NULL };
836 union acpi_object params[4], *obj;
837 struct acpi_object_list input;
838 struct acpi_device *adev;
839 acpi_handle handle;
840
841 handle = ACPI_HANDLE(&client->dev);
842 if (!handle || acpi_bus_get_device(handle, &adev))
843 return -ENODEV;
844
845 input.count = ARRAY_SIZE(params);
846 input.pointer = params;
847
848 params[0].type = ACPI_TYPE_BUFFER;
849 params[0].buffer.length = sizeof(i2c_hid_guid);
850 params[0].buffer.pointer = i2c_hid_guid;
851 params[1].type = ACPI_TYPE_INTEGER;
852 params[1].integer.value = 1;
853 params[2].type = ACPI_TYPE_INTEGER;
854 params[2].integer.value = 1; /* HID function */
855 params[3].type = ACPI_TYPE_INTEGER;
856 params[3].integer.value = 0;
857
858 if (ACPI_FAILURE(acpi_evaluate_object(handle, "_DSM", &input, &buf))) {
859 dev_err(&client->dev, "device _DSM execution failed\n");
860 return -ENODEV;
861 }
862
863 obj = (union acpi_object *)buf.pointer;
864 if (obj->type != ACPI_TYPE_INTEGER) {
865 dev_err(&client->dev, "device _DSM returned invalid type: %d\n",
866 obj->type);
867 kfree(buf.pointer);
868 return -EINVAL;
869 }
870
871 pdata->hid_descriptor_address = obj->integer.value;
872
873 kfree(buf.pointer);
874 return 0;
875}
876
877static const struct acpi_device_id i2c_hid_acpi_match[] = {
878 {"ACPI0C50", 0 },
879 {"PNP0C50", 0 },
880 { },
881};
882MODULE_DEVICE_TABLE(acpi, i2c_hid_acpi_match);
883#else
884static inline int i2c_hid_acpi_pdata(struct i2c_client *client,
885 struct i2c_hid_platform_data *pdata)
886{
887 return -ENODEV;
888}
889#endif
890
891static int i2c_hid_probe(struct i2c_client *client,
892 const struct i2c_device_id *dev_id)
826{ 893{
827 int ret; 894 int ret;
828 struct i2c_hid *ihid; 895 struct i2c_hid *ihid;
@@ -832,11 +899,6 @@ static int __devinit i2c_hid_probe(struct i2c_client *client,
832 899
833 dbg_hid("HID probe called for i2c 0x%02x\n", client->addr); 900 dbg_hid("HID probe called for i2c 0x%02x\n", client->addr);
834 901
835 if (!platform_data) {
836 dev_err(&client->dev, "HID register address not provided\n");
837 return -EINVAL;
838 }
839
840 if (!client->irq) { 902 if (!client->irq) {
841 dev_err(&client->dev, 903 dev_err(&client->dev,
842 "HID over i2c has not been provided an Int IRQ\n"); 904 "HID over i2c has not been provided an Int IRQ\n");
@@ -847,11 +909,22 @@ static int __devinit i2c_hid_probe(struct i2c_client *client,
847 if (!ihid) 909 if (!ihid)
848 return -ENOMEM; 910 return -ENOMEM;
849 911
912 if (!platform_data) {
913 ret = i2c_hid_acpi_pdata(client, &ihid->pdata);
914 if (ret) {
915 dev_err(&client->dev,
916 "HID register address not provided\n");
917 goto err;
918 }
919 } else {
920 ihid->pdata = *platform_data;
921 }
922
850 i2c_set_clientdata(client, ihid); 923 i2c_set_clientdata(client, ihid);
851 924
852 ihid->client = client; 925 ihid->client = client;
853 926
854 hidRegister = platform_data->hid_descriptor_address; 927 hidRegister = ihid->pdata.hid_descriptor_address;
855 ihid->wHIDDescRegister = cpu_to_le16(hidRegister); 928 ihid->wHIDDescRegister = cpu_to_le16(hidRegister);
856 929
857 init_waitqueue_head(&ihid->wait); 930 init_waitqueue_head(&ihid->wait);
@@ -884,6 +957,7 @@ static int __devinit i2c_hid_probe(struct i2c_client *client,
884 hid->hid_get_raw_report = i2c_hid_get_raw_report; 957 hid->hid_get_raw_report = i2c_hid_get_raw_report;
885 hid->hid_output_raw_report = i2c_hid_output_raw_report; 958 hid->hid_output_raw_report = i2c_hid_output_raw_report;
886 hid->dev.parent = &client->dev; 959 hid->dev.parent = &client->dev;
960 ACPI_HANDLE_SET(&hid->dev, ACPI_HANDLE(&client->dev));
887 hid->bus = BUS_I2C; 961 hid->bus = BUS_I2C;
888 hid->version = le16_to_cpu(ihid->hdesc.bcdVersion); 962 hid->version = le16_to_cpu(ihid->hdesc.bcdVersion);
889 hid->vendor = le16_to_cpu(ihid->hdesc.wVendorID); 963 hid->vendor = le16_to_cpu(ihid->hdesc.wVendorID);
@@ -913,7 +987,7 @@ err:
913 return ret; 987 return ret;
914} 988}
915 989
916static int __devexit i2c_hid_remove(struct i2c_client *client) 990static int i2c_hid_remove(struct i2c_client *client)
917{ 991{
918 struct i2c_hid *ihid = i2c_get_clientdata(client); 992 struct i2c_hid *ihid = i2c_get_clientdata(client);
919 struct hid_device *hid; 993 struct hid_device *hid;
@@ -975,10 +1049,11 @@ static struct i2c_driver i2c_hid_driver = {
975 .name = "i2c_hid", 1049 .name = "i2c_hid",
976 .owner = THIS_MODULE, 1050 .owner = THIS_MODULE,
977 .pm = &i2c_hid_pm, 1051 .pm = &i2c_hid_pm,
1052 .acpi_match_table = ACPI_PTR(i2c_hid_acpi_match),
978 }, 1053 },
979 1054
980 .probe = i2c_hid_probe, 1055 .probe = i2c_hid_probe,
981 .remove = __devexit_p(i2c_hid_remove), 1056 .remove = i2c_hid_remove,
982 1057
983 .id_table = i2c_hid_id_table, 1058 .id_table = i2c_hid_id_table,
984}; 1059};