static void blink_callback(struct work_struct *blink_work) { if (--blink_count == 0) { pr_info("%s: notification timed out\n", __FUNCTION__); bln_enable_backlights(); del_timer(&blink_timer); return; } if (bln_blink_state) bln_enable_backlights(); else bln_disable_backlights(); bln_blink_state = !bln_blink_state; }
static void enable_led_notification(void) { if (!bln_enabled) return; if (in_kernel_blink) { wake_lock(&bln_wake_lock); /* Start timer */ blink_timer.expires = jiffies + msecs_to_jiffies(bln_blink_interval); blink_count = bln_blink_max_count; /* * Check for pending timer and use mod_timer * if it exists instead of attempting to * add another, which results in a panic */ if (timer_pending(&blink_timer)) mod_timer(&blink_timer, blink_timer.expires); else add_timer(&blink_timer); } bln_enable_backlights(); pr_info("%s: notification led enabled\n", __FUNCTION__); bln_ongoing = true; }
static ssize_t buttons_led_status_write(struct device *dev, struct device_attribute *attr, const char *buf, size_t size) { unsigned int data; if (sscanf(buf, "%u\n", &data) != 1) { pr_info("%s: input error\n", __FUNCTION__); return size; } if (data == 1) { if(!bln_suspended){ buttons_led_enabled = true; bln_power_on(); bln_enable_backlights(gen_all_leds_mask()); } } else if (data == 0) { if(!bln_suspended){ buttons_led_enabled = false; bln_disable_backlights(gen_all_leds_mask()); } } else { pr_info("%s: wrong input %u\n", __FUNCTION__, data); } return size; }
static ssize_t blink_control_write(struct device *dev, struct device_attribute *attr, const char *buf, size_t size) { unsigned int data; if (!bln_ongoing) return size; if (sscanf(buf, "%u\n", &data) != 1) { pr_info("%s: input error\n", __FUNCTION__); return size; } /* reversed logic: * 1 = leds off * 0 = leds on */ if (data == 1) { bln_blink_state = 1; bln_disable_backlights(get_led_mask()); } else if (data == 0) { bln_blink_state = 0; bln_enable_backlights(get_led_mask()); } else { pr_info("%s: wrong input %u\n", __FUNCTION__, data); } return size; }
static void enable_led_notification(void) { if (!bln_enabled) return; if (in_kernel_blink) { /* Start timer */ blink_timer.expires = jiffies + msecs_to_jiffies(BLINK_INTERVAL); blink_count = MAX_BLINK_COUNT; add_timer(&blink_timer); } bln_enable_backlights(); pr_info("%s: notification led enabled\n", __FUNCTION__); bln_ongoing = true; }
static void enable_led_notification(void) { if (!bln_enabled) return; /* * dont allow led notifications while the screen is on, * avoid to interfere with the normal buttons led */ if (!bln_suspended) return; bln_ongoing = true; bln_power_on(); bln_enable_backlights(get_led_mask()); pr_info("%s: notification led enabled\n", __FUNCTION__); }
static void enable_led_notification(void) { if (!bln_enabled) return; if (in_kernel_blink) { wake_lock(&bln_wake_lock); /* Start timer */ blink_timer.expires = jiffies + msecs_to_jiffies(blink_interval); blink_count = max_blink_count; add_timer(&blink_timer); } bln_enable_backlights(); pr_info("%s: notification led enabled\n", __FUNCTION__); bln_ongoing = true; }
static void enable_led_notification(void) { if (!bln_enabled) return; if (in_kernel_blink) { wake_lock(&bln_wake_lock); /* Start timer */ blink_timer.expires = jiffies + msecs_to_jiffies(BLINK_INTERVAL); blink_count = MAX_BLINK_COUNT; add_timer(&blink_timer); } int con=0;//Max time ~ 20*100 ms while(!bln_enable_backlights() && con<20){ msleep(100);con++; } pr_info("%s: notification led enabled\n", __FUNCTION__); bln_ongoing = true; }
static ssize_t blink_control_write(struct device *dev, struct device_attribute *attr, const char *buf, size_t size) { unsigned int data; if (!bln_ongoing) return size; if (sscanf(buf, "%u\n", &data) == 1) { if (data == 1) { bln_blink_state = 1; bln_disable_backlights(); } else if (data == 0) { bln_blink_state = 0; bln_enable_backlights(); } else { pr_info("%s: wrong input %u\n", __FUNCTION__, data); } } else { pr_info("%s: input error\n", __FUNCTION__); } return size; }