+static int rkvr_fb_event_notify(struct notifier_block *self,
+ unsigned long action, void *data)
+{
+ int i;
+ unsigned char buf[3] = {HID_REPORT_ID_RKVR, RKVR_ID_IDLE, 0};
+ struct hid_device *hid;
+ struct fb_event *event = data;
+ int blank_mode = *((int *)event->data);
+
+ if (action != FB_EARLY_EVENT_BLANK && action != FB_EVENT_BLANK)
+ return NOTIFY_OK;
+
+ mutex_lock(&minors_lock);
+ for (i = 0; i < RKVR_HIDRAW_MAX_DEVICES; i++) {
+ if (!rkvr_hidraw_table[i] || !rkvr_hidraw_table[i]->exist)
+ continue;
+ if (!rkvr_hid_capability[i].suspend_notify) {
+ continue;
+ }
+ hid = rkvr_hidraw_table[i]->hid;
+ if (action == FB_EARLY_EVENT_BLANK) {
+ switch (blank_mode) {
+ case FB_BLANK_UNBLANK:
+ break;
+ default:
+ rkvr_send_report(&hid->dev, buf, 3);
+ break;
+ }
+ } else if (action == FB_EVENT_BLANK) {
+ switch (blank_mode) {
+ case FB_BLANK_UNBLANK:
+ buf[2] = 1;
+ rkvr_send_report(&hid->dev, buf, 3);
+ break;
+ default:
+ break;
+ }
+ }
+ }
+ mutex_unlock(&minors_lock);
+ return NOTIFY_OK;
+}
+
+static struct notifier_block rkvr_fb_notifier = {
+ .notifier_call = rkvr_fb_event_notify,
+};
+