static irqreturn_t touchkey_interrupt(int irq, void *dev_id) { struct touchkey_i2c *tkey_i2c = dev_id; u8 data[3]; int ret; int retry = 10; int keycode_type = 0; int pressed; set_touchkey_debug('a'); retry = 3; while (retry--) { ret = i2c_touchkey_read(tkey_i2c->client, KEYCODE_REG, data, 3); if (!ret) break; else { printk(KERN_DEBUG "[TouchKey] i2c read failed, ret:%d, retry: %d\n", ret, retry); continue; } } if (ret < 0) return IRQ_HANDLED; set_touchkey_debug(data[0]); keycode_type = (data[0] & TK_BIT_KEYCODE); pressed = !(data[0] & TK_BIT_PRESS_EV); if (keycode_type <= 0 || keycode_type >= touchkey_count) { printk(KERN_DEBUG "[Touchkey] keycode_type err\n"); return IRQ_HANDLED; } if (pressed) set_touchkey_debug('P'); if (get_tsp_status() && pressed) printk(KERN_DEBUG "[TouchKey] touchkey pressed but don't send event because touch is pressed.\n"); else { input_report_key(tkey_i2c->input_dev, touchkey_keycode[keycode_type], pressed); input_sync(tkey_i2c->input_dev); /* printk(KERN_DEBUG "[TouchKey] keycode:%d pressed:%d\n", touchkey_keycode[keycode_index], pressed); */ #if defined(CONFIG_TARGET_LOCALE_KOR) if (g_debug_tkey == true) { printk(KERN_DEBUG "[TouchKey] keycode[%d]=%d pressed:%d\n", keycode_type, touchkey_keycode[keycode_type], pressed); } else { printk(KERN_DEBUG "[TouchKey] pressed:%d\n", pressed); } #endif } set_touchkey_debug('A'); return IRQ_HANDLED; }
static irqreturn_t touchkey_interrupt(int irq, void *dev_id) { struct touchkey_i2c *tkey_i2c = dev_id; u8 data[18]; int ret; int retry = 10; int keycode_type = 0; int pressed; printk("[TouchKey] %s", __func__); set_touchkey_debug('a'); retry = 3; while (retry--) { ret = i2c_touchkey_read(tkey_i2c->client, KEYCODE_REG, data, 18); if (!ret) break; else { printk(KERN_DEBUG "[TouchKey] i2c read failed, ret:%d, retry: %d\n", ret, retry); continue; } } if (ret < 0) return IRQ_HANDLED; menu_sensitivity = data[13]; back_sensitivity = data[11]; set_touchkey_debug(data[0]); keycode_type = (data[0] & TK_BIT_KEYCODE); pressed = !(data[0] & TK_BIT_PRESS_EV); if (keycode_type <= 0 || keycode_type >= touchkey_count) { printk(KERN_DEBUG "[Touchkey] keycode_type err\n"); return IRQ_HANDLED; } if (pressed) set_touchkey_debug('P'); if (get_tsp_status() && pressed) printk(KERN_DEBUG "[TouchKey] touchkey pressed" " but don't send event because touch is pressed.\n"); else { input_report_key(touchkey_driver->input_dev, touchkey_keycode[keycode_type], pressed); input_sync(touchkey_driver->input_dev); /* printk(KERN_DEBUG "[TouchKey] keycode:%d pressed:%d\n", touchkey_keycode[keycode_index], pressed); */ } if (keycode_type == 2) printk(KERN_DEBUG "back key sensitivity = %d\n", back_sensitivity); if (keycode_type == 4) printk(KERN_DEBUG "menu key sensitivity = %d\n", menu_sensitivity); set_touchkey_debug('A'); return IRQ_HANDLED; }
static irqreturn_t touchkey_interrupt(int irq, void *dev_id) { struct touchkey_i2c *tkey_i2c = dev_id; u8 data[18]; int ret; int retry = 10; int keycode_type = 0; int pressed; #if 0 if (gpio_get_value(_3_GPIO_TOUCH_INT)) { pr_debug("[TouchKey] Unknown state.\n", __func__); return IRQ_HANDLED; } #endif set_touchkey_debug('a'); #ifdef CONFIG_CPU_FREQ /* set_dvfs_target_level(LEV_800MHZ); */ #endif retry = 3; while (retry--) { #if defined(CONFIG_TARGET_LOCALE_NA) || defined(CONFIG_MACH_Q1_BD)\ || defined(CONFIG_MACH_C1) ret = i2c_touchkey_read(tkey_i2c->client, KEYCODE_REG, data, 18); #else ret = i2c_touchkey_read(tkey_i2c->client, KEYCODE_REG, data, 10); #endif if (!ret) break; else { pr_debug("[TouchKey] i2c read failed, ret:%d, retry: %d\n", ret, retry); continue; } } if (ret < 0) return IRQ_HANDLED; #if defined(CONFIG_TARGET_LOCALE_NA) #if defined(CONFIG_MACH_C1_NA_SPR_EPIC2_REV00) menu_sensitivity = data[11]; home_sensitivity = data[13]; search_sensitivity = data[15]; back_sensitivity = data[17]; #else if (tkey_i2c->module_ver >= 8) { menu_sensitivity = data[17]; home_sensitivity = data[15]; search_sensitivity = data[11]; back_sensitivity = data[13]; } else { menu_sensitivity = data[6]; home_sensitivity = data[7]; search_sensitivity = data[8]; back_sensitivity = data[9]; } #endif #elif defined(CONFIG_MACH_Q1_BD) || defined(CONFIG_MACH_C1) menu_sensitivity = data[13]; back_sensitivity = data[11]; #else menu_sensitivity = data[7]; back_sensitivity = data[9]; #endif /* CONFIG_TARGET_LOCALE_NA */ set_touchkey_debug(data[0]); keycode_type = (data[0] & TK_BIT_KEYCODE); pressed = !(data[0] & TK_BIT_PRESS_EV); if (keycode_type <= 0 || keycode_type >= touchkey_count) { pr_debug("[Touchkey] keycode_type err\n"); return IRQ_HANDLED; } if (pressed) { set_touchkey_debug('P'); } if (get_tsp_status() && pressed) pr_debug("[TouchKey] touchkey pressed" " but don't send event because touch is pressed.\n"); else { input_report_key(touchkey_driver->input_dev, touchkey_keycode[keycode_type], pressed); input_sync(touchkey_driver->input_dev); /* printk(KERN_DEBUG "[TouchKey] keycode:%d pressed:%d\n", touchkey_keycode[keycode_index], pressed); */ } if (keycode_type == 1) printk(KERN_DEBUG "search key sensitivity = %d\n", search_sensitivity); if (keycode_type == 2) pr_debug("back key sensitivity = %d\n", back_sensitivity); #ifdef CONFIG_TARGET_LOCALE_NA if (keycode_type == 3) pr_debug("home key sensitivity = %d\n", home_sensitivity); if (keycode_type == 4) pr_debug("menu key sensitivity = %d\n", menu_sensitivity); #endif set_touchkey_debug('A'); return IRQ_HANDLED; }
static irqreturn_t touchkey_interrupt(int irq, void *dev_id) { struct touchkey_i2c *tkey_i2c = dev_id; static const int ledCmd[] = {TK_CMD_LED_ON, TK_CMD_LED_OFF}; u8 data[3]; int ret; int retry = 10; int keycode_type = 0; int pressed; set_touchkey_debug('a'); retry = 3; while (retry--) { ret = i2c_touchkey_read(tkey_i2c->client, KEYCODE_REG, data, 3); if (!ret) break; else { pr_debug("[TouchKey] i2c read failed, ret:%d, retry: %d\n", ret, retry); continue; } } if (ret < 0) return IRQ_HANDLED; set_touchkey_debug(data[0]); keycode_type = (data[0] & TK_BIT_KEYCODE); pressed = !(data[0] & TK_BIT_PRESS_EV); if (keycode_type <= 0 || keycode_type >= touchkey_count) { pr_debug("[Touchkey] keycode_type err\n"); return IRQ_HANDLED; } if (pressed) { set_touchkey_debug('P'); // enable lights on keydown if (touch_led_disabled == 0) { if (touchkey_led_status == TK_CMD_LED_OFF) { pr_debug("[Touchkey] %s: keydown - LED ON\n", __func__); i2c_touchkey_write(tkey_i2c->client, (u8 *) &ledCmd[0], 1); touchkey_led_status = TK_CMD_LED_ON; } if (timer_pending(&touch_led_timer) == 1) { mod_timer(&touch_led_timer, jiffies + (HZ * touch_led_timeout)); } } } else { // touch led timeout on keyup if (touch_led_disabled == 0) { if (timer_pending(&touch_led_timer) == 0) { pr_debug("[Touchkey] %s: keyup - add_timer\n", __func__); touch_led_timer.expires = jiffies + (HZ * touch_led_timeout); add_timer(&touch_led_timer); } else { mod_timer(&touch_led_timer, jiffies + (HZ * touch_led_timeout)); } } } if (get_tsp_status() && pressed) pr_debug("[TouchKey] touchkey pressed but don't send event because touch is pressed.\n"); else { input_report_key(tkey_i2c->input_dev, touchkey_keycode[keycode_type], pressed); input_sync(tkey_i2c->input_dev); /* pr_debug("[TouchKey] keycode:%d pressed:%d\n", touchkey_keycode[keycode_index], pressed); */ #if defined(CONFIG_TARGET_LOCALE_KOR) if (g_debug_tkey == true) { pr_debug("[TouchKey] keycode[%d]=%d pressed:%d\n", keycode_type, touchkey_keycode[keycode_type], pressed); } else { pr_debug("[TouchKey] pressed:%d\n", pressed); } #endif } set_touchkey_debug('A'); return IRQ_HANDLED; }
static irqreturn_t touchkey_interrupt(int irq, void *dev_id) { struct touchkey_i2c *tkey_i2c = dev_id; u8 data[3]; int ret; int retry = 10; int keycode_type = 0; int pressed; set_touchkey_debug('a'); retry = 3; while (retry--) { ret = i2c_touchkey_read(tkey_i2c->client, KEYCODE_REG, data, 3); if (!ret) { keycode_type = (data[0] & TK_BIT_KEYCODE); if (keycode_type <= 0 || keycode_type >= touchkey_count) { printk(KERN_DEBUG "[Touchkey] keycode_type err" " ret:%d, retry: %d\n", keycode_type, retry); continue; } break; } else { printk(KERN_DEBUG "[TouchKey] i2c read failed, ret:%d, retry: %d\n", ret, retry); continue; } } if (ret < 0) return IRQ_HANDLED; set_touchkey_debug(data[0]); keycode_type = (data[0] & TK_BIT_KEYCODE); pressed = !(data[0] & TK_BIT_PRESS_EV); if (keycode_type <= 0 || keycode_type >= touchkey_count) { int i; printk(KERN_DEBUG "[Touchkey] keycode_type err %d." " Release all keys\n", keycode_type); /* release keys */ for (i = 1; i < touchkey_count; ++i) { input_report_key(tkey_i2c->input_dev, touchkey_keycode[i], 0); } input_sync(tkey_i2c->input_dev); return IRQ_HANDLED; } if (pressed) set_touchkey_debug('P'); if (get_tsp_status() && pressed) printk(KERN_DEBUG "[TouchKey] touch is pressed. Pass touchkey event\n"); else { input_report_key(tkey_i2c->input_dev, touchkey_keycode[keycode_type], pressed); input_sync(tkey_i2c->input_dev); #if !defined(CONFIG_SAMSUNG_PRODUCT_SHIP) printk(KERN_DEBUG "[TouchKey] keycode:%d pressed:%d\n", touchkey_keycode[keycode_type], pressed); #else printk(KERN_DEBUG "[TouchKey] pressed:%d\n", pressed); #endif #if defined(CONFIG_TARGET_LOCALE_KOR) if (g_debug_tkey == true) { printk(KERN_DEBUG "[TouchKey] keycode[%d]=%d pressed:%d\n", keycode_type, touchkey_keycode[keycode_type], pressed); } else { printk(KERN_DEBUG "[TouchKey] pressed:%d\n", pressed); } #endif } set_touchkey_debug('A'); return IRQ_HANDLED; }