@@ -526,6 +526,29 @@ static void lenovo_led_brightness_set_tpx1cover(struct led_classdev *led_cdev,
}
}
+static int lenovo_event_tpx1cover(struct hid_device *hdev,
+ struct hid_field *field, struct hid_usage *usage, __s32 value)
+{
+ int ret = 0;
+
+ if (usage->hid == HID_CP_CONSUMERCONTROL) {
+ if (usage->usage_index == 8 && value == 1) {
+ struct lenovo_drvdata_tpx1cover *drv_data = hid_get_drvdata(hdev);
+
+ if (drv_data && drv_data->led_present) {
+ drv_data->fnlock_state = lenovo_led_brightness_get_tpx1cover(
+ &drv_data->led_fnlock) == LED_OFF ? 1 : 0;
+ lenovo_led_brightness_set_tpx1cover(
+ &drv_data->led_fnlock,
+ drv_data->fnlock_state ? LED_FULL : LED_OFF);
+ }
+ }
+
+ }
+
+ return ret;
+}
+
static int lenovo_event(struct hid_device *hdev, struct hid_field *field,
struct hid_usage *usage, __s32 value)
{
@@ -533,6 +556,8 @@ static int lenovo_event(struct hid_device *hdev, struct hid_field *field,
case USB_DEVICE_ID_LENOVO_CUSBKBD:
case USB_DEVICE_ID_LENOVO_CBTKBD:
return lenovo_event_cptkbd(hdev, field, usage, value);
+ case USB_DEVICE_ID_LENOVO_X1_COVER:
+ return lenovo_event_tpx1cover(hdev, field, usage, value);
default:
return 0;
}