//[*]--------------------------------------------------------------------------------------------------[*] //[*]--------------------------------------------------------------------------------------------------[*] // disablel (1 -> disable irq, cancel work, 0 -> enable irq), show irq state //[*]--------------------------------------------------------------------------------------------------[*] static ssize_t show_idle (struct device *dev, struct device_attribute *attr, char *buf) { struct touch *ts = dev_get_drvdata(dev); unsigned char idle = 0; if(!err_mask(ts->fw_status) && !(ts->fw_status & STATUS_BOOT_MODE)) { touch_disable(ts); touch_wake_control(ts); if(touch_i2c_read(ts->client, REG_TS_IDLE_RD, 1, &idle) == 1) { touch_enable(ts); return sprintf(buf, "%d\n", idle); } touch_enable(ts); } return sprintf(buf, "%d\n", -1); }
/*[BEGIN]20110118 Jack: Delay timer function*/ static enum hrtimer_restart delay_timer_func(struct hrtimer *data) { int ret; if(lgd_ts->irq){ touch_enable(lgd_ts); } ret=hrtimer_try_to_cancel(&delay_timer); return HRTIMER_NORESTART; }
//[*]--------------------------------------------------------------------------------------------------[*] static int touch_input_open(struct input_dev *input) { struct touch *ts = input_get_drvdata(input); touch_enable(ts); // printk("%s\n", __func__); return 0; }
//[*]--------------------------------------------------------------------------------------------------[*] // firmware version display //[*]--------------------------------------------------------------------------------------------------[*] static ssize_t show_fw_version (struct device *dev, struct device_attribute *attr, char *buf) { struct touch *ts = dev_get_drvdata(dev); if(!err_mask(ts->fw_status) && !(ts->fw_status & STATUS_BOOT_MODE)) { touch_disable(ts); touch_wake_control(ts); touch_i2c_read(ts->client, REG_TS_FIRMWARE_ID, 1, &ts->fw_version); touch_enable(ts); } return sprintf(buf, "%d\n", ts->fw_version); }
//[*]--------------------------------------------------------------------------------------------------[*] static ssize_t store_disable (struct device *dev, struct device_attribute *attr, const char *buf, size_t count) { struct touch *ts = dev_get_drvdata(dev); unsigned long val; int err; if ((err = strict_strtoul(buf, 10, &val))) return err; if (val) touch_disable(ts); // interrupt disable else touch_enable(ts); // interrupt enable return count; }
//[*]--------------------------------------------------------------------------------------------------[*] static ssize_t store_idle (struct device *dev, struct device_attribute *attr, const char *buf, size_t count) { struct touch *ts = dev_get_drvdata(dev); unsigned long val = 0; unsigned char idle = 0; int err; if ((err = strict_strtoul(buf, 10, &val))) return err; if (val > 255 && val < 0) idle = 0; else { idle = (unsigned char)val; if(!err_mask(ts->fw_status) && !(ts->fw_status & STATUS_BOOT_MODE)) { touch_disable(ts); touch_wake_control(ts); touch_i2c_write(ts->client, REG_TS_IDLE_WR, 1, &idle); touch_enable(ts); } } return count; }