Esempio n. 1
0
static void certify_cover_work(struct work_struct *work)
{
	bool first;
	struct certify_hall_drvdata *ddata =
		container_of(work, struct certify_hall_drvdata,
				certify_cover_dwork.work);

	first = !gpio_get_value(ddata->gpio_certify_cover);

	printk("[keys] %s certify_status : %d (%s)\n", __func__, first, first?"attach":"detach");

	certify_cover = first;
#ifdef CONFIG_CERTIFY_HALL_NFC_WA
	if(certify_cover)
		felica_ant_tuning(1);
	else
		felica_ant_tuning(0);
#endif
	input_report_switch(ddata->input,
			SW_CERTIFYHALL, certify_cover);
	input_sync(ddata->input);

/* WorkAround for Hall IRQ Noise problem in connect to GSM band */
#ifdef CONFIG_SENSORS_HALL_IRQ_CTRL
	if(certify_cover)
		hall_irq_set(enable, true);
	else
		hall_irq_set(disable, true);
#endif
}
static ssize_t hall_irq_ctrl_store(struct device *dev,
		struct device_attribute *attr, const char *buf,
		size_t count)
{
	pr_info("%s: %s\n", __func__, buf);

	if (!g_drvdata->wa_enable)
		return count;

	if (!strncasecmp(buf, "ON", 2)) {
		g_drvdata->gsm_area = true;
		if (!g_drvdata->cover_state)
			hall_irq_set(disable, false);
	} else if (!strncasecmp(buf, "OFF", 3)) {
		hall_irq_set(enable, false);
		g_drvdata->gsm_area = false;
	} else {
		pr_info("%s: Wrong command, current state %s\n",
				__func__, g_drvdata->gsm_area?"ON":"OFF");
	}

	return count;
}
static int hall_resume(struct device *dev)
{
	struct hall_drvdata *ddata = dev_get_drvdata(dev);
	struct input_dev *input = ddata->input;

	printk("%s start\n", __func__);
	input_sync(input);
#ifdef CONFIG_SENSORS_HALL_IRQ_CTRL
	/* gsm_area can be controlled only in hall_irq_set */
	if (g_drvdata->cover_state && g_drvdata->gsm_area)
		hall_irq_set(enable, false);
#endif
	return 0;
}