Exemplo n.º 1
0
static void sec_flip_work_func(struct work_struct *work)
{
    struct sec_flip* flip = container_of( work, struct sec_flip, flip_id_det);

    //enable_irq(flip->irq);

    set_flip_status(flip);
    printk("%s: %s, before:%d \n", __func__, (flip_status) ? "OPEN 1" : "CLOSE 0", flip_status_before);

    sec_report_flip_key(flip);

    if (flip_status != flip_status_before) {
#ifdef CONFIG_S5P_DSIM_SWITCHABLE_DUAL_LCD
        s3cfb_switch_dual_lcd(!flip_status);
#endif
        samsung_switching_tsp(flip_status);
        samsung_switching_tkey(flip_status);
    }
}
Exemplo n.º 2
0
static void sec_flip_work_func(struct work_struct *work)
{
	struct sec_flip* flip = container_of( work, struct sec_flip, flip_id_det); 

	//enable_irq(flip->irq);

	set_flip_status(flip);

	sec_report_flip_key(flip);
	printk("[FLIP]%s: %s, before:%d \n", __func__, (flip_status) ? "OPEN 1" : "CLOSE 0", flip_status_before);

	if (flip_status != flip_status_before) {
#if 0 //def CONFIG_S5P_DSIM_SWITCHABLE_DUAL_LCD  
		s3cfb_switch_dual_lcd(!flip_status);
#endif
		printk("[FLIP]:go to switch func, flip_status=%d\n",flip_status);
		samsung_switching_tsp(flip_status);
		//samsung_switching_tkey(flip_status);
	}
	//samsung_enable_tspInput(); /* do not accept tsp irq before folder open/close complete */
	flip_status_before = flip_status;
}
Exemplo n.º 3
0
static void flip_cover_work(struct work_struct *work)
{
	struct gpio_keys_drvdata *ddata =
		container_of(work, struct gpio_keys_drvdata,
				flip_cover_dwork.work);
#if !defined (CONFIG_SEC_MILLET_PROJECT) || !defined (CONFIG_SEC_T8_PROJECT)
	int comp_val[2]={0};
#else
	int comp_val[3]={0};
#endif

	comp_val[0] = gpio_get_value(ddata->gpio_flip_cover);
#if !defined (CONFIG_SEC_MILLET_PROJECT) || !defined (CONFIG_SEC_T8_PROJECT)
	mdelay(30);
#else
	mdelay(10);
#endif
	comp_val[1] = gpio_get_value(ddata->gpio_flip_cover);
#if defined (CONFIG_SEC_MILLET_PROJECT) || defined (CONFIG_SEC_T8_PROJECT)
	mdelay(10);
	comp_val[2] = gpio_get_value(ddata->gpio_flip_cover);
#endif

#if !defined (CONFIG_SEC_MILLET_PROJECT) || !defined (CONFIG_SEC_T8_PROJECT)
	if (comp_val[0] == comp_val[1]) {
#else
	if ((comp_val[0] == comp_val[1]) && (comp_val[0] == comp_val[2])) {
#endif
		if (ddata->flip_code == SW_LID)
			ddata->flip_cover = !gpio_get_value(ddata->gpio_flip_cover);
		else
			ddata->flip_cover = gpio_get_value(ddata->gpio_flip_cover);

		printk(KERN_DEBUG "[keys] %s : %d code 0x%x\n",
			__func__, ddata->flip_cover, ddata->flip_code);

		input_report_switch(ddata->input,
			ddata->flip_code, ddata->flip_cover);
		input_sync(ddata->input);

		if (ddata->flip_cover != flip_status_before) {
#if defined(CONFIG_DUAL_LCD)
			samsung_switching_lcd(ddata->flip_cover);
			samsung_switching_tsp(ddata->flip_cover);
			samsung_switching_tkey(ddata->flip_cover);
			samsung_switching_ssp(ddata->flip_cover);
#endif
		}

		flip_status_before = ddata->flip_cover;
	} else {
		printk(KERN_DEBUG "%s : Value is not same!\n", __func__);
	}
}
#else // CONFIG_SEC_FACTORY
static void flip_cover_work(struct work_struct *work)
{
	struct gpio_keys_drvdata *ddata =
		container_of(work, struct gpio_keys_drvdata,
				flip_cover_dwork.work);

	if (ddata->flip_code == SW_LID)
		ddata->flip_cover = !gpio_get_value(ddata->gpio_flip_cover);
	else
		ddata->flip_cover = gpio_get_value(ddata->gpio_flip_cover);

	printk(KERN_DEBUG "[keys] %s : %d code 0x%x\n",
		__func__, ddata->flip_cover, ddata->flip_code);

	input_report_switch(ddata->input,
			ddata->flip_code, ddata->flip_cover);
	input_sync(ddata->input);

	if (ddata->flip_cover != flip_status_before) {
#if defined(CONFIG_DUAL_LCD)
		samsung_switching_lcd(ddata->flip_cover);
		samsung_switching_tsp(ddata->flip_cover);
		samsung_switching_tkey(ddata->flip_cover);
		samsung_switching_ssp(ddata->flip_cover);
#endif
	}

	flip_status_before = ddata->flip_cover;
}
#endif // CONFIG_SEC_FACTORY

#if defined (CONFIG_SEC_MILLET_PROJECT) || defined (CONFIG_SEC_T8_PROJECT)
static irqreturn_t flip_cover_detect(int irq, void *dev_id)
{
	struct gpio_keys_drvdata *ddata = dev_id;
#define HALL_COMPARISONS 6
	int comp_val[HALL_COMPARISONS]={0};
	int i;

	comp_val[0] = gpio_get_value(ddata->gpio_flip_cover);

	if(comp_val[0]) {
		wake_lock_timeout(&ddata->flip_wake_lock, HZ * 5 / 100); /* 50ms */
	} else {
		wake_unlock(&ddata->flip_wake_lock);
	}

	pr_info("[keys] %s flip_status : %d (%s)\n",
		__func__, comp_val[0], comp_val[0]?"on":"off");

	for(i=1;i<HALL_COMPARISONS;i++){
		mdelay(6);
		comp_val[i] = gpio_get_value(ddata->gpio_flip_cover);
		if(comp_val[i]!=comp_val[0]){
			pr_err("%s : Value is not same!\n", __func__);
			goto out;
		}
	}

	ddata->flip_cover = comp_val[0];
	pr_info("[keys] hall ic reported value: %d (%s)\n",
		ddata->flip_cover, ddata->flip_cover?"on":"off");

	input_report_switch(ddata->input,
		SW_FLIP, ddata->flip_cover);
	input_sync(ddata->input);
out:
	return IRQ_HANDLED;
}
#else
static irqreturn_t flip_cover_detect(int irq, void *dev_id)
{
	bool flip_status;
	struct gpio_keys_drvdata *ddata = dev_id;
#ifdef CONFIG_SENSORS_HALL_IRQ_CTRL
	bool debounce_status;
#endif
#ifdef CONFIG_SENSORS_HALL_DEBOUNCE
	int DTIME_IRQ, DTIME_WAKE;

	/* Set Debounce time for HALL IC IRQ(wake_lock / IRQ recheck)
	 * ON : 140ms / 70ms
	 * OFF : 50ms / 10ms
	 */
	DTIME_IRQ = ddata->debounce_set ? (HZ*7/100) : (HZ*1/100);
	DTIME_WAKE = ddata->debounce_set ? (HZ*14/100) : (HZ*5/100);
#endif

	if (ddata->flip_code == SW_LID)
		flip_status = !gpio_get_value(ddata->gpio_flip_cover);
	else
		flip_status = gpio_get_value(ddata->gpio_flip_cover);

	cancel_delayed_work_sync(&ddata->flip_cover_dwork);
#ifdef CONFIG_SENSORS_HALL_DEBOUNCE
	printk(KERN_DEBUG "[keys] %s flip_satatus : %d, IRQt : %d, WAKEt : %d\n",
		__func__, flip_status, DTIME_IRQ, DTIME_WAKE);

	if(flip_status) {
		wake_lock_timeout(&ddata->flip_wake_lock, HZ * DTIME_WAKE);
		schedule_delayed_work(&ddata->flip_cover_dwork, DTIME_IRQ);
	} else {
		wake_unlock(&ddata->flip_wake_lock);
		wake_lock_timeout(&ddata->flip_wake_lock, HZ * DTIME_WAKE);
		schedule_delayed_work(&ddata->flip_cover_dwork, DTIME_IRQ);
	}
#else /* CONFIG_SENSORS_HALL_DEBOUNCE */
	printk(KERN_DEBUG "[keys] %s flip_satatus : %d\n",
		__func__, flip_status);

	if(flip_status) {
		wake_lock_timeout(&ddata->flip_wake_lock, HZ * 5 / 100); /* 50ms */
		schedule_delayed_work(&ddata->flip_cover_dwork, HZ * 1 / 100); /* 10ms */
	} else {
#ifdef CONFIG_SENSORS_HALL_IRQ_CTRL
	if (ddata->gsm_area) {
		mdelay(7);
		debounce_status = gpio_get_value(ddata->gpio_flip_cover);
		if (debounce_status != flip_status) {
			printk(KERN_DEBUG "[keys] %s filp ignore IRQ\n",
				__func__);
			return IRQ_HANDLED;
		}
	}
#endif /* CONFIG_SENSORS_HALL_IRQ_CTRL */
		wake_unlock(&ddata->flip_wake_lock);
		schedule_delayed_work(&ddata->flip_cover_dwork, 0);
	}
#endif /* CONFIG_SENSORS_HALL_DEBOUNCE */
	return IRQ_HANDLED;
}