static void power_key_check_reset_work_func(struct work_struct *dummy)
{
    struct gpio_event_input_info *aa = gis;
    int pocket_mode = 0;
    KEY_LOGI("[PWR] %s\n", __func__);
    if ((aa->clear_hw_reset)) {
        /* Check P/L sensor status */
        pocket_mode = power_key_check_in_pocket();
        if (pocket_mode) {
            printk(KERN_INFO "[KEY] power_key_check_in_pocket = %d\n", pocket_mode);
            aa->clear_hw_reset();
        }
    }
    else {
        KEY_LOGI("[PWR] No reset  clear function\n");
    }
    handle_power_key_reset(KEY_POWER, 1);
}
Beispiel #2
0
static void Mistouch_powerkey_func(struct work_struct *work)
{
	Mistouch_powerkey_requested = power_key_check_in_pocket();
	pr_info("[KEY] %s in (%x)\n", __func__, Mistouch_powerkey_requested);
	if ( Mistouch_powerkey_requested ) {
		if ( mistouch_gpio_active != NULL )
			mistouch_gpio_active();
		else
			pr_err("[KEY] mistouch_gpio_active() is NULL\n");
	}
	else {
		if ( mistouch_gpio_normal != NULL )
			mistouch_gpio_normal();
		else
			pr_err("[KEY] mistouch_gpio_normal() is NULL\n");
	}
	if ( Powerkey_pressed ) {
		wake_lock_timeout(&key_reset_clr_wake_lock, PWRKEYCHKRST_WAKELOCK_TIMEOUT);
		queue_delayed_work(delay_wq, &delay_work, msecs_to_jiffies(3500));
	}
}
Beispiel #3
0
static void power_key_check_reset_work_func(struct work_struct *dummy)
{
	struct gpio_event_input_info *aa = gis;
	int pocket_mode = 0;
	KEY_LOGI("[PWR] %s\n", __func__);
	if ((aa->clear_hw_reset)) {
		if (aa->info.rrm1_mode) {
			printk(KERN_INFO "[KEY] Power key check in Lab Test RRM1 mode.\n");
			aa->clear_hw_reset();
		}
		else {
			
			pocket_mode = power_key_check_in_pocket();
			if (pocket_mode) {
				printk(KERN_INFO "[KEY] power_key_check_in_pocket = %d\n", pocket_mode);
				aa->clear_hw_reset();
			}
		}
	}
	else {
		KEY_LOGI("[PWR] No reset  clear function\n");
	}
	handle_power_key_reset(KEY_POWER, 1);
}
static void power_key_check_reset_work_func(struct work_struct *dummy)
{
	struct gpio_event_input_info *aa = gis;
#ifdef CONFIG_POWER_VOLUP_RESET
	uint8_t val = 0, i = 0;
#else
	int pocket_mode = 0;
#endif
	KEY_LOGI("[PWR] %s\n", __func__);

#ifdef CONFIG_OF
	if ((aa->dt_clear_hw_reset)) {
		if (aa->info.rrm1_mode) {
			KEY_LOGI(" Power key check in Lab Test RRM1 mode.\n");
			aa->dt_clear_hw_reset(aa->clr_gpio);
#else
	if ((aa->clear_hw_reset)) {
		if (aa->info.rrm1_mode) {
			printk(KERN_INFO "[KEY] Power key check in Lab Test RRM1 mode.\n");
			aa->clear_hw_reset();
#endif
#ifndef CONFIG_POWER_VOLUP_RESET
		} else if (board_mfg_mode() == MFG_MODE_NORMAL) {
			
			pocket_mode = power_key_check_in_pocket();
			if (pocket_mode) {
				printk(KERN_INFO "[KEY] power_key_check_in_pocket = %d\n", pocket_mode);
#ifdef CONFIG_OF
				aa->dt_clear_hw_reset(aa->clr_gpio);
#else
				aa->clear_hw_reset();
#endif
			}
		} else
			printk(KERN_INFO "[KEY] Not in normal OS mode, mode=%d\n", board_mfg_mode());
#else	
		} else {
			printk(KERN_INFO "[KEY] OS Mode=%d\n", board_mfg_mode());
			for (i = 0; i < aa->keymap_size; i++) {
				if (aa->keymap[i].code == KEY_VOLUMEUP) {
					val = gpio_get_value(aa->keymap[i].gpio);
					break;
				}
			}
			if (!val) { 	
				KEY_LOGI("HW RESET continue");
			} else {	
#ifdef CONFIG_OF
				aa->dt_clear_hw_reset(aa->clr_gpio);
#else
				aa->clear_hw_reset();
#endif
			}
		}
#endif	
	} else {
		KEY_LOGI("[PWR] No reset  clear function\n");
	}
	handle_power_key_reset(KEY_POWER, 1);
}
static DECLARE_DELAYED_WORK(power_key_check_reset_work, power_key_check_reset_work_func);

static void power_key_clr_check_work_func(struct work_struct *dummy)
{
#ifdef CONFIG_POWER_VOLUP_RESET
	uint8_t i = 0, val = 0, pwr_idx = 0;
	struct gpio_event_input_info *aa = gis;

	for (i = 0; i < aa->keymap_size; i++) {
		if (aa->keymap[i].code == KEY_VOLUMEUP) {
			val = gpio_get_value(aa->keymap[i].gpio);
			if (val) {
				KEY_LOGI("volUP clear");
#ifdef CONFIG_OF
				aa->dt_clear_hw_reset(aa->clr_gpio);
#else
				aa->clear_hw_reset();
#endif
			}
			break;
		}
		if (aa->keymap[i].code == KEY_POWER)
			pwr_idx = i;
	}

	val = gpio_get_value(aa->keymap[pwr_idx].gpio);

	if (val) {
#endif 
		if (cancel_delayed_work_sync(&power_key_check_reset_work))
			KEY_LOGI("[PWR] cancel power key check reset work successfully\n");
		else
			KEY_LOGI("[PWR] cancel power key check reset work unsuccessfully\n");
#ifdef CONFIG_KPDPWR_S2_DVDD_RESET
		clear_kpdpwr_s2_rst_flag = 0;
		KEY_LOGD("%s: Disable kpdpwr s2 reset clear up [%d]\n", __func__, clear_kpdpwr_s2_rst_flag);
		if (hrtimer_is_queued(&clr_kpd_reset_timer))
			hrtimer_cancel(&clr_kpd_reset_timer);
		if (hrtimer_is_queued(&enable_kpd_s2_timer))
			hrtimer_cancel(&enable_kpd_s2_timer);
#endif 
#ifdef CONFIG_POWER_VOLUP_RESET
	}
#endif
	wake_unlock(&key_reset_clr_wake_lock);
}
static void power_key_restart_work_func(struct work_struct *dummy)
{
#ifndef CONFIG_POWER_VOLUP_RESET
	int pocket_mode = (board_mfg_mode() == MFG_MODE_NORMAL) ? power_key_check_in_pocket() : 0;
	KEY_LOGI( "%s: power_key_check_in_pocket = %d\n", __func__, pocket_mode);

	if (!pocket_mode && pre_power_key_led_status == 1 && !is_rrm1_mode()) {
#else
	uint8_t gpio_val = 0, i, idx_pwr = 9, idx_vup = 9;
	struct gpio_event_input_info *local = gis;
	for (i = 0; i < local->keymap_size; i++) {
		if (local->keymap[i].code == KEY_POWER) {
			idx_pwr = i;
			continue;
		}
		if (local->keymap[i].code == KEY_VOLUMEUP)
			idx_vup = i;
	}
	gpio_val = !(gpio_get_value(local->keymap[idx_pwr].gpio) |
		     gpio_get_value(local->keymap[idx_vup].gpio));

	if (gpio_val && pre_power_key_led_status == 1 && !is_rrm1_mode()) {
		KEY_LOGI("%s, (PWR+VOL_UP) reset", __func__);
#endif
		
		set_hw_reason(0);
#if defined(CONFIG_PM8921_BMS) && (CONFIG_HTC_BATT_8960)
		pm8921_store_hw_reset_reason(1);
#endif
		clear_hw_reset();
		set_restart_to_ramdump("Powerkey Hard Reset - SW");
		msm_restart(0, NULL);
	}
}

static DECLARE_DELAYED_WORK(power_key_restart_work, power_key_restart_work_func);
#endif

static void power_key_led_on_work_func(struct work_struct *dummy)
{
	KEY_LOGI("[PWR] %s in (%x)\n", __func__, power_key_led_requested);
	if (power_key_led_requested == 1) {
		pre_power_key_led_status = 1;
#ifdef CONFIG_POWER_KEY_CLR_RESET
		schedule_delayed_work(&power_key_restart_work, PWRKEYKP_DELAY);
#endif
		KEY_LOGI("[PWR] change power key led on\n");
#ifdef CONFIG_QPNP_PWM
#ifdef CONFIG_VK_LED
		qpnp_led_set_for_key(1);
#endif
#else
		pm8xxx_led_current_set_for_key(1);
#endif
#ifdef CONFIG_POWER_KEY_CLR_RESET
		if(!is_rrm1_mode())
#endif
			set_hw_reason(HW_RESET_REASON);
		KEY_LOGI("[PWR] Show Blocked State -- long press power key\n");
		show_state_filter(TASK_UNINTERRUPTIBLE);
	}
}