static void pen_insert_work(struct work_struct *work) { struct wacom_i2c *wac_i2c = container_of(work, struct wacom_i2c, pen_insert_dwork.work); #ifdef WACOM_DEBOUNCEINT_BY_ESD pen_insert_state = !gpio_get_value(wac_i2c->gpio_pen_insert); #if defined(CONFIG_MACH_T0) if (wac_i2c->invert_pen_insert) pen_insert_state = !pen_insert_state; #endif if (wac_i2c->pen_insert == pen_insert_state) { printk(KERN_DEBUG "epen:%s INT: (%d) was skipped\n", __func__, wac_i2c->pen_insert); #ifdef BATTERY_SAVING_MODE if (wac_i2c->pen_insert) { if (wac_i2c->battery_saving_mode) wacom_power_off(wac_i2c); } else { if (wake_lock_active(&wac_i2c->wakelock)) return; printk(KERN_DEBUG "epen:%s call WACOM Reset\n", __func__); wac_i2c->wac_pdata->suspend_platform_hw(); msleep(200); wacom_power_on(wac_i2c); } #endif return; } wac_i2c->pen_insert = pen_insert_state; #else wac_i2c->pen_insert = !gpio_get_value(wac_i2c->gpio_pen_insert); #if defined(CONFIG_MACH_T0) if (wac_i2c->invert_pen_insert) wac_i2c->pen_insert = !wac_i2c->pen_insert; #endif #endif printk(KERN_DEBUG "epen:%s : %d\n", __func__, wac_i2c->pen_insert); input_report_switch(wac_i2c->input_dev, SW_PEN_INSERT, !wac_i2c->pen_insert); input_sync(wac_i2c->input_dev); #ifdef BATTERY_SAVING_MODE if (wac_i2c->pen_insert) { if (wac_i2c->battery_saving_mode) wacom_power_off(wac_i2c); } else wacom_power_on(wac_i2c); #endif }
static void wacom_i2c_early_suspend(struct early_suspend *h) { struct wacom_i2c *wac_i2c = container_of(h, struct wacom_i2c, early_suspend); printk(KERN_DEBUG "epen:%s.\n", __func__); wacom_power_off(wac_i2c); }
static ssize_t epen_saving_mode_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) { struct wacom_i2c *wac_i2c = dev_get_drvdata(dev); int val; if (sscanf(buf, "%u", &val) == 1) wac_i2c->battery_saving_mode = !!val; printk(KERN_DEBUG"epen:%s, val %d\n", __func__, wac_i2c->battery_saving_mode); if (!wac_i2c->pwr_flag) { printk(KERN_DEBUG"epen:pass pwr control\n"); return count; } if (wac_i2c->battery_saving_mode) { if (wac_i2c->pen_insert) wacom_power_off(wac_i2c); } else { if(wac_i2c->enabled) wacom_power_on(wac_i2c); } return count; }
static void stop_wacom(struct wacom_i2c *wac_i2c) { printk(KERN_DEBUG "epen:%s.\n", __func__); #ifdef WACOM_STATE_CHECK cancel_delayed_work_sync(&wac_i2c->wac_statecheck_work); #endif wacom_power_off(wac_i2c); }
static void wacom_i2c_input_close(struct input_dev *dev) { struct wacom_i2c *wac_i2c = input_get_drvdata(dev); dev_info(&wac_i2c->client->dev, "%s\n", __func__); wacom_power_off(wac_i2c); wac_i2c->enabled = false; }
static void wacom_i2c_early_suspend(struct early_suspend *h) { struct wacom_i2c *wac_i2c = container_of(h, struct wacom_i2c, early_suspend); printk(KERN_DEBUG "epen:%s.\n", __func__); #ifdef WACOM_STATE_CHECK cancel_delayed_work_sync(&wac_i2c->wac_statecheck_work); #endif wacom_power_off(wac_i2c); }
static int wacom_i2c_suspend(struct device *dev) { struct wacom_i2c *wac_i2c = dev_get_drvdata(dev); wac_i2c->pwr_flag = false; if (wac_i2c->input_dev->users) wacom_power_off(wac_i2c); return 0; }
static int wacom_i2c_suspend(struct device *dev) { struct wacom_i2c *wac_i2c = dev_get_drvdata(dev); printk(KERN_DEBUG"%s\n", __func__); if (wac_i2c->input_dev->users) wacom_power_off(wac_i2c); return 0; }
static ssize_t epen_saving_mode_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) { struct wacom_i2c *wac_i2c = dev_get_drvdata(dev); int val; if (sscanf(buf, "%u", &val) == 1) wac_i2c->battery_saving_mode = !!val; if (wac_i2c->battery_saving_mode) { if (wac_i2c->pen_insert) wacom_power_off(wac_i2c); } else wacom_power_on(wac_i2c); return count; }
static void pen_insert_work(struct work_struct *work) { struct wacom_i2c *wac_i2c = container_of(work, struct wacom_i2c, pen_insert_dwork.work); wac_i2c->pen_insert = !gpio_get_value(wac_i2c->gpio_pen_insert); printk(KERN_DEBUG "epen:%s : %d\n", __func__, wac_i2c->pen_insert); input_report_switch(wac_i2c->input_dev, SW_PEN_INSERT, !wac_i2c->pen_insert); input_sync(wac_i2c->input_dev); #ifdef BATTERY_SAVING_MODE if (wac_i2c->pen_insert) { if (wac_i2c->battery_saving_mode) wacom_power_off(wac_i2c); } else wacom_power_on(wac_i2c); #endif }
static void wacom_i2c_input_close(struct input_dev *dev) { struct wacom_i2c *wac_i2c = input_get_drvdata(dev); wacom_power_off(wac_i2c); }