Пример #1
0
ssize_t rws_write(struct file *file, const char __user *data, size_t len, loff_t *ppos)
{
	char rws_val;

	MFC_DRV_DBG_LOG("START");

	if (data == NULL) {
		MFC_DRV_ERR_LOG("rws_write param err");
		return -EIO;
	}

	if ( len < 1 ) {
		MFC_DRV_ERR_LOG("length check len = %d", len);
		return -EIO;
	}
	
	if (copy_from_user(&rws_val, data, 1)) {
		MFC_DRV_ERR_LOG("copy_from_user");
		return -EFAULT;
	}

	g_rws_data = rws_val;

	MFC_DRV_DBG_LOG("END rws_val = %d, g_rws_data = %d", rws_val, g_rws_data);

	return 1;
}
Пример #2
0
static int succ_actOpenNfc(int flags)
{
	MFC_DRV_DBG_LOG("ENTER");

	if (flags & SHSNFC_UCC_FLAG_RWS_CHECK) {
		if (mfc_rws_sts == D_RWS_RW_DISABLE) {
			MFC_DRV_DBG_LOG("rws disable");
			succ_handle_event(SUCC_EVENT_END_NFC, flags);
			return SUCC_RETVAL_BUSY;
		}
	}

	set_hsel_value(D_HSEL_DEV_HIGH);
	if (set_pon_value(D_PON_DEV_HIGH) != 0) {
		MFC_DRV_ERR_LOG("set pon failed");
		succ_handle_event(SUCC_EVENT_END_NFC, flags);
		return SUCC_RETVAL_BUSY;
	}

	if (flags & SHSNFC_UCC_FLAG_PON_WAIT) {
		usleep(D_SUCC_PON_WAIT_USEC);
	} else if (flags & SHSNFC_UCC_FLAG_PON_WAIT_NO_RFS) {
		if (get_rfs_value() == D_RFS_DEV_HIGH) {
			usleep(D_SUCC_PON_WAIT_USEC);
		}
	} else {
		/* nothing to do */
	}

	return SUCC_RETVAL_OK;
}
Пример #3
0
int succ_handle_event(int event, int flags)
{
	int result = SUCC_RETVAL_ABNORMAL;
	const succ_fsm_item *item;
	static DEFINE_MUTEX(lock);

	MFC_DRV_DBG_LOG("START event = %d", event);

	mutex_lock(&lock);

	MFC_DRV_DBG_LOG("state = %d", g_current_state);

	item = succ_getFsmItem(g_current_state, event);

	if (item && (item->execFunc != 0)) {
		if (item->nextStatus >= 0) {
			g_current_state = item->nextStatus;
		}

		mutex_unlock(&lock);

		result = item->execFunc(flags);
	} else {
		mutex_unlock(&lock);
	}

	MFC_DRV_DBG_LOG("END state = %d, result = %d", g_current_state, result);
	return result;
}
Пример #4
0
static int pon_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg)
{
	MFC_DRV_DBG_LOG("START");

	MFC_DRV_DBG_LOG("END");
	return 0;
}
Пример #5
0
void notify_nfc_avalable_change(int type, int status)
{
	int available;

	MFC_DRV_DBG_LOG("START device_status = %d, type = %d", g_available_d.device_status, type);

	switch (type) {
	case NFC_AVAILABLE_RFS:
	case NFC_AVAILABLE_CEN:
	case NFC_AVAILABLE_FELICA:
	case NFC_AVAILABLE_RWS:
		break;
	default:
		return;
	}

	if (status) {
		g_available_d.device_status |= type;
	} else {
		g_available_d.device_status &= ~type;
	}

	available = is_nfc_available();
	if (available) {
		if ((snfc_available()) && (snfc_available_wake_up())) {
			g_available_d.irq_handler_done = 1;
			wake_up_interruptible(&g_available_d.read_wait);
		}
	}

	MFC_DRV_DBG_LOG("END device_status = %d", g_available_d.device_status);
}
Пример #6
0
/*
 * function_pon
 */
ssize_t pon_write(struct file *file, const char __user *data,
		       size_t len, loff_t *ppos)
{
	char on;
	int seton;
	
	MFC_DRV_DBG_LOG("START");
	
	if ( len < 1 ) {
		MFC_DRV_ERR_LOG("length check len = %d", len);
		return -EIO;
	}
	
	if (copy_from_user(&on, data, 1)) {
		MFC_DRV_ERR_LOG("copy_from_user");
		return -EFAULT;
	}

	if (on == D_PON_DEV_HIGH){
		seton = D_PON_DEV_HIGH;
		MFC_DRV_DBG_LOG("pon high.\n");
	}else if (on == D_PON_DEV_LOW){
		MFC_DRV_DBG_LOG("pon low.\n");
		seton = D_PON_DEV_LOW;
	}else {
		MFC_DRV_DBG_LOG("pon err value = %x \n",on );
		return -EFAULT;
	}

	gpio_set_value(MFD_PON_GPIO_NUM , seton );

	MFC_DRV_DBG_LOG("END on = %d, seton = %d", on, seton);
	
	return len;
}
Пример #7
0
static int rate_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg)
{
	int				nRet	= 0;

	MFC_DRV_DBG_LOG("START");
	MFC_DRV_DBG_LOG("cmd = %x\n",cmd);
	switch( cmd ){
		case RATE_REQ_RATE_115:
			g_unrate = 115200;
			g_unbaud = B115200;
			break;
		case RATE_REQ_RATE_230:
			g_unrate = 230400;
			g_unbaud = B230400;
			break;
		case RATE_REQ_RATE_460:
			g_unrate = 460800;
			g_unbaud = B460800;
			break;
		default:
			nRet = -1;
			break;
	}
	MFC_DRV_DBG_LOG("END");
	return nRet;
}
Пример #8
0
/* rws device	*/
ssize_t rws_read(struct file *file, char __user * buf, size_t len, loff_t * ppos)
{
	char rws_val;
	
	MFC_DRV_DBG_LOG("START");

	if (buf == NULL) {
		MFC_DRV_ERR_LOG("rws_read param err");
		return -EIO;
	}

	if ( len < 1 ) {
		MFC_DRV_ERR_LOG("length check len = %d", len);
		return -EIO;
	}

	rws_val = g_rws_data;

	if (copy_to_user(buf, &rws_val, 1)) {
		MFC_DRV_ERR_LOG("copy_to_user");
		return -EFAULT;
	}

	MFC_DRV_DBG_LOG("END rws_val = %d, len = %d", rws_val, len);

	return 1;
}
Пример #9
0
static ssize_t intu_poll_read(struct file *filp, char __user *buf, size_t len, loff_t *ppos)
{
	int ret;
	char on[2];

	MFC_DRV_DBG_LOG("START");

	/* length check */
	if (len < 1) {
		MFC_DRV_ERR_LOG("length check len = %d", len);
		return -EIO;
	}

	if (!g_intu_d.irq_handler_done) {
		if (filp->f_flags & O_NONBLOCK) {
			MFC_DRV_ERR_LOG("NONBLOCK");
			return -EAGAIN;
		}
		/* wait irq handler */
		ret = wait_event_interruptible(g_intu_d.read_wait,
		                               g_intu_d.irq_handler_done == 1);
		if (-ERESTARTSYS == ret) {
			MFC_DRV_DBG_LOG("wait_event_interruptible ret = %d", ret);
			return -EINTR;
		}
	}

	/* read failed */
	if (g_intu_d.read_error) {
		g_intu_d.irq_handler_done = 0;
		g_intu_d.read_error = 0;
		MFC_DRV_ERR_LOG("g_intu_d.read_error = %d", g_intu_d.read_error);
		return -EIO;
	}

	/* set readed data */
	if (g_intu_d.device_status == D_INTU_DEV_HIGH) {
		on[0] = D_INTU_DEV_HIGH;
	} else {
		on[0] = D_INTU_DEV_LOW;
	}
	on[1] = 0x00;

	if (len > 2)
		len = 2;

	if (copy_to_user(buf, on, len)) {
		MFC_DRV_ERR_LOG("copy_to_user");
		return -EFAULT;
	}

	g_intu_d.irq_handler_done = 0;

	MFC_DRV_DBG_LOG("END len = %d, on[0] = %d", len, on[0]);

	return len;
}
Пример #10
0
static int intu_poll_open(struct inode *inode, struct file *filp)
{
	unsigned long irqflag = 0;
	int ret = 0;

	MFC_DRV_DBG_LOG("START");

	if (!(snfc_available())) {
		MFC_DRV_ERR_LOG("snfc_available");
		return -EIO;
	}

	/* only one time success */
	if (g_intu_d.open_flag) {
		MFC_DRV_ERR_LOG("only one time");
		return -EBUSY;
	}
	g_intu_d.open_flag = 1;

	/* preparation of anti-chattering */
	ret = gpio_get_value_cansleep(D_INTU_GPIO_NO);
	if (ret < 0) {
		g_intu_d.open_flag = 0;
		MFC_DRV_ERR_LOG("gpio_get_value_cansleep ret = %d", ret);
		return -EIO;
	}
	g_intu_d.device_status = ret;

	/* set irq handler */
	if (g_intu_d.device_status == D_INTU_DEV_LOW) {
		irqflag = IRQF_TRIGGER_HIGH | IRQF_SHARED;
	} else {
		irqflag = IRQF_TRIGGER_LOW | IRQF_SHARED;
	}

	if (request_irq(gpio_to_irq(D_INTU_GPIO_NO),
					intu_poll_irq_handler,
					irqflag,
					D_INTU_POLL_DEV_NAME,
					(void*)&g_intu_d)) {
		g_intu_d.open_flag = 0;
		MFC_DRV_ERR_LOG("request_irq irqflag = %ld", irqflag);
		return -EIO;
	}

	if (enable_irq_wake(gpio_to_irq(D_INTU_GPIO_NO))) {
		MFC_DRV_ERR_LOG("enable_irq_wake");
		free_irq(gpio_to_irq(D_INTU_GPIO_NO), (void *)&g_intu_d);
		return -EIO;
	}

	g_intu_d.irq_handler_done = 0;

	MFC_DRV_DBG_LOG("END");

	return 0;
}
Пример #11
0
static void int_poll_exit(void)
{
	dev_t dev = MKDEV(MISC_MAJOR, 0);
	MFC_DRV_DBG_LOG("START");
	
	cdev_del(&int_poll_cdev);
	unregister_chrdev_region(dev, D_INT_POLL_DEVS);
	MFC_DRV_DBG_LOG("END");
}
Пример #12
0
static int pon_release(struct inode *inode, struct file *file)
{
	MFC_DRV_DBG_LOG("START");

	gpio_set_value(MFD_PON_GPIO_NUM , D_PON_DEV_LOW);

	MFC_DRV_DBG_LOG("END");

	return 0;
}
Пример #13
0
static void available_exit(void)
{
	dev_t dev = MKDEV(MISC_MAJOR, 0);
	MFC_DRV_DBG_LOG("START");

	cdev_del(&available_cdev);
	unregister_chrdev_region(dev, D_AVAILABLE_DEVS);

	MFC_DRV_DBG_LOG("END");
}
Пример #14
0
static int int_poll_open(struct inode *inode, struct file *file)
{
	struct poll_data *int_d = g_int_d;
	unsigned long irqflag = 0;
	int ret = 0;
	
	MFC_DRV_DBG_LOG("START");
	
	if (int_d->open_flag) {
		MFC_DRV_ERR_LOG("only one time");
		return -EBUSY;
	}
	int_d->open_flag = 1;
	
	ret = gpio_get_value(D_INT_POLL_GPIO_NO);
	if (ret < 0) {
		int_d->open_flag = 0;
		MFC_DRV_ERR_LOG("gpio_get_value ret = %d", ret);
		return -EIO;
	}
	int_d->device_status = ret;
	
	if (int_d->device_status == D_INT_DEV_LOW)
		irqflag = IRQF_TRIGGER_HIGH | IRQF_SHARED;
	else
		irqflag = IRQF_TRIGGER_LOW | IRQF_SHARED;
	
	if (request_irq(gpio_to_irq(D_INT_POLL_GPIO_NO),
	                int_poll_irq_handler,
	                irqflag,
	                D_INT_POLL_DEV_NAME,
	                (void*)int_d)) {
		
		int_d->open_flag = 0;
		
		MFC_DRV_ERR_LOG("request_irq irqflag = %ld", irqflag);
		
		return -EIO;
	}
	
	if (enable_irq_wake(gpio_to_irq(D_INT_POLL_GPIO_NO))){
		
		MFC_DRV_ERR_LOG("enable_irq_wake");
		
		free_irq(gpio_to_irq(D_INT_POLL_GPIO_NO), (void *)int_d);
		
		return -EIO;
	}
	
	int_d->irq_handler_done = 0;
	
	MFC_DRV_DBG_LOG("END");
	
	return 0;
}
Пример #15
0
ssize_t int_poll_read(struct file *file, char __user * buf,
		      size_t len, loff_t * ppos)
{
	struct poll_data *int_d = g_int_d;
	int ret;
	char on[2];
	
	MFC_DRV_DBG_LOG("START");
	
	if ( len < 1 ) {
		MFC_DRV_ERR_LOG("length check len = %d", len);
		return -EIO;
	}
	
	if (!int_d->irq_handler_done) {
		if (file->f_flags & O_NONBLOCK) {
			MFC_DRV_ERR_LOG("NONBLOCK");
			return -EAGAIN;
		}
		MFC_DRV_DBG_LOG("FeliCa int_poll wait irq");
		ret = wait_event_interruptible(int_d->read_wait,
		                               int_d->irq_handler_done == 1);
		if (-ERESTARTSYS == ret) {
			MFC_DRV_DBG_LOG("wait_event_interruptible ret = %d", ret);
			return -EINTR;
		}
	}
	
	if (int_d->read_error) {
		int_d->irq_handler_done = 0;
		int_d->read_error = 0;
		MFC_DRV_ERR_LOG("int_d->read_error = %d", int_d->read_error);
		return -EIO;
	}
	
	if (int_d->device_status == D_INT_DEV_HIGH)
		on[0] = SHMFD_INT_STATUS_HIGH;
	else
		on[0] = SHMFD_INT_STATUS_LOW;
	
	on[1] = 0x00;
	
	if (len > 2)
		len = 2;
	if (copy_to_user(buf, on, len)) {
		MFC_DRV_ERR_LOG("copy_to_user");
		return -EFAULT;
	}
	int_d->irq_handler_done = 0;
	
	MFC_DRV_DBG_LOG("END len = %d, on[0] = %d", len, on[0]);
	
	return len;
}
Пример #16
0
static void succ_exit(void)
{
	dev_t dev = MKDEV(MISC_MAJOR, 0);

	MFC_DRV_DBG_LOG("START");

	cdev_del(&succ_cdev);
	unregister_chrdev_region(dev, D_SUCC_DEVS);

	MFC_DRV_DBG_LOG("END");
}
Пример #17
0
static irqreturn_t intu_poll_irq_handler(int irq, void *dev_id)
{
	MFC_DRV_DBG_LOG("START irq = %d", irq);

	disable_irq_nosync(gpio_to_irq(D_INTU_GPIO_NO));
	/* set workqueue */
	schedule_delayed_work(&g_intu_d.work, msecs_to_jiffies(D_INTU_POLL_DELAY_MSEC));

	MFC_DRV_DBG_LOG("END");

	return IRQ_HANDLED;
}
Пример #18
0
static int available_open(struct inode *inode, struct file *filp)
{
	int ret = 0, status = 0;

	MFC_DRV_DBG_LOG("START");

	if (!(snfc_available())) {
		MFC_DRV_ERR_LOG("snfc_available");
		return -EIO;
	}

	/* only one time success */
	if (g_available_d.open_flag) {
		MFC_DRV_ERR_LOG("only one time");
		return -EBUSY;
	}

	ret = get_cen_value();
	if (ret == CEN_LOCK_OFF) {
		status |= NFC_AVAILABLE_CEN;
	} else if (ret == CEN_LOCK_ON) {
		/* nothing to do */
	} else {
		MFC_DRV_ERR_LOG("get_cen_value ret = %d", ret);
		return -EIO;
	}

	if (g_current_state != SUCC_STATE_FELICA) {
		status |= NFC_AVAILABLE_FELICA;
	}

	if (mfc_rws_sts == D_RWS_RW_ENABLE) {
		status |= NFC_AVAILABLE_RWS;
	}

	/* request rfs irq */
	ret = request_notify_rfs_irq(&available_on_rfs_irq);
	if (ret == D_RFS_DEV_HIGH) {
		status |= NFC_AVAILABLE_RFS;
	} else if (ret == D_RFS_DEV_LOW) {
		/* nothing to do */
	} else {
		MFC_DRV_ERR_LOG("request_notify_rfs_irq ret = %d", ret);
		return -EIO;
	}

	g_available_d.device_status = status;
	g_available_d.open_flag = 1;

	MFC_DRV_DBG_LOG("END status = %d", status);

	return 0;
}
Пример #19
0
static int available_release(struct inode *inode, struct file *filp)
{
	MFC_DRV_DBG_LOG("START");

	/* free rfs irq */
	free_notify_rfs_irq(&available_on_rfs_irq);

	g_available_d.open_flag = 0;

	MFC_DRV_DBG_LOG("END");

	return 0;
}
Пример #20
0
static void pon_exit(void)
{
	dev_t dev = MKDEV(MISC_MAJOR, 0);
	
	MFC_DRV_DBG_LOG("START");

	device_destroy(felica_class, dev);

	cdev_del(&pon_cdev);
	unregister_chrdev_region(dev, D_PON_DEVS);

	MFC_DRV_DBG_LOG("END");
}
Пример #21
0
static int intu_poll_init(void)
{
	int result = 0;
	struct device *class_dev;

	dev_t dev = MKDEV(MISC_MAJOR, 0);

	MFC_DRV_DBG_LOG("START");

	/* get major number */
	result = alloc_chrdev_region(&dev, 0, D_INTU_POLL_DEVS, D_INTU_POLL_DEV_NAME);
	if (result) {
		MFC_DRV_ERR_LOG("alloc_chrdev_region result = %d", result);
		return result;
	}

	/* initialize INTU */
	cdev_init(&intu_poll_cdev, &intu_poll_fileops);
	intu_poll_cdev.owner = THIS_MODULE;

	/* add INTU */
	result = cdev_add(&intu_poll_cdev, dev, D_INTU_POLL_DEVS);
	if (result) {
		unregister_chrdev_region(dev, D_INTU_POLL_DEVS);
		MFC_DRV_ERR_LOG("cdev_add result = %d", result);
		return result;
	}

	/* create INTU */
	class_dev = device_create(snfc_class, NULL, dev, NULL, D_INTU_POLL_DEV_NAME);
	if (IS_ERR(class_dev)) {
		cdev_del(&intu_poll_cdev);
		unregister_chrdev_region(dev, D_INTU_POLL_DEVS);
		result = PTR_ERR(class_dev);
		MFC_DRV_ERR_LOG("device_create result = %d", result);
		return result;
	}

	/* initialize poll_data */
	memset(&g_intu_d, 0x00, sizeof(struct poll_data));
	/* initialize workqueue */
	INIT_DELAYED_WORK(&g_intu_d.work, intu_poll_work_func);
	/* initialize waitqueue */
	init_waitqueue_head(&g_intu_d.read_wait);

	g_intu_d.open_flag = 0;

	MFC_DRV_DBG_LOG("END");

	return result;
}
Пример #22
0
static irqreturn_t int_poll_irq_handler(int irq, void *dev_id)
{
	struct poll_data *int_d = g_int_d;
	
	MFC_DRV_DBG_LOG("START irq = %d", irq);
	
	disable_irq_nosync(gpio_to_irq(D_INT_POLL_GPIO_NO));

	schedule_delayed_work(&int_d->work, msecs_to_jiffies(D_INT_POLL_DELAY_MSEC));
	
	MFC_DRV_DBG_LOG("END");
	
	return IRQ_HANDLED;
}
Пример #23
0
static int available_init(void)
{
	int result = 0;
	struct device *class_dev;

	dev_t dev = MKDEV(MISC_MAJOR, 0);

	MFC_DRV_DBG_LOG("START");

	/* get major number */
	result = alloc_chrdev_region(&dev, 0, D_AVAILABLE_DEVS, D_AVAILABLE_DEV_NAME);
	if (result) {
		MFC_DRV_ERR_LOG("alloc_chrdev_region result = %d", result);
		return result;
	}

	/* initialize Available */
	cdev_init(&available_cdev, &available_fileops);
	available_cdev.owner = THIS_MODULE;

	/* add Available */
	result = cdev_add(&available_cdev, dev, D_AVAILABLE_DEVS);
	if (result) {
		unregister_chrdev_region(dev, D_AVAILABLE_DEVS);
		MFC_DRV_ERR_LOG("cdev_add result = %d", result);
		return result;
	}

	/* create Available */
	class_dev = device_create(snfc_class, NULL, dev, NULL, D_AVAILABLE_DEV_NAME);
	if (IS_ERR(class_dev)) {
		cdev_del(&available_cdev);
		unregister_chrdev_region(dev, D_AVAILABLE_DEVS);
		result = PTR_ERR(class_dev);
		MFC_DRV_ERR_LOG("device_create result = %d", result);
		return result;
	}

	/* initialize available_data */
	memset(&g_available_d, 0, sizeof(g_available_d));
	/* initialize waitqueue */
	init_waitqueue_head(&g_available_d.read_wait);

	g_available_d.open_flag = 0;

	MFC_DRV_DBG_LOG("END");

	return result;
}
Пример #24
0
static void available_on_rfs_irq(int rfs_status)
{
	MFC_DRV_DBG_LOG("START rfs_status = %d", rfs_status);

	if (rfs_status < 0) {
		MFC_DRV_DBG_LOG("read_error");
		g_available_d.read_error = 1;
		g_available_d.irq_handler_done = 1;
		wake_up_interruptible(&g_available_d.read_wait);
	} else {
		notify_nfc_avalable_change(NFC_AVAILABLE_RFS, rfs_status);
	}

	MFC_DRV_DBG_LOG("END");
}
Пример #25
0
unsigned int int_poll_poll(struct file *file, poll_table *wait)
{
	struct poll_data *int_d = g_int_d;
	unsigned int mask = 0;
	
	MFC_DRV_DBG_LOG("START");
	
	poll_wait(file, &int_d->read_wait, wait);
	if (int_d->irq_handler_done)
		mask = POLLIN | POLLRDNORM;
	
	MFC_DRV_DBG_LOG("END mask = %d", mask);
	
	return (mask);
}
Пример #26
0
static unsigned int intu_poll_poll(struct file *filp, poll_table *wait)
{
	unsigned int mask = 0;

	MFC_DRV_DBG_LOG("START");

	/* wait irq handler */
	poll_wait(filp, &g_intu_d.read_wait, wait);
	if (g_intu_d.irq_handler_done)
		mask = POLLIN | POLLRDNORM;

	MFC_DRV_DBG_LOG("END mask = %d", mask);

	return mask;
}
Пример #27
0
static int succ_actOpenFelica(int flags)
{
	MFC_DRV_DBG_LOG("ENTER");
	set_hsel_value(D_HSEL_DEV_LOW);
	notify_nfc_avalable_change(NFC_AVAILABLE_FELICA, AVAILABLE_FALSE);
	return SUCC_RETVAL_OK;
}
Пример #28
0
static int succ_actCloseNfc(int flags)
{
	MFC_DRV_DBG_LOG("ENTER");
	set_pon_value(D_PON_DEV_LOW);
	set_hsel_value(D_HSEL_DEV_LOW);
	return SUCC_RETVAL_OK;
}
Пример #29
0
/*
 * function_intu_poll
 */
static void intu_poll_work_func(struct work_struct *work)
{
	int read_value = 0, old_value = 0;
	unsigned long irqflag = 0;

	MFC_DRV_DBG_LOG("START");

	old_value = g_intu_d.device_status;

	read_value = gpio_get_value_cansleep(D_INTU_GPIO_NO);

	MFC_DRV_DBG_LOG("read_value = %d old_value = %d", read_value, old_value);

	/* read error */
	if (read_value < 0) {
		g_intu_d.read_error = read_value;
	/* read changed data */
	} else if (read_value != old_value) {
		g_intu_d.device_status = read_value;
		g_intu_d.read_error = 0;

		/* change irq flag */
		if (g_intu_d.device_status == D_INTU_DEV_LOW)
			irqflag = IRQF_TRIGGER_HIGH | IRQF_SHARED;
		else
			irqflag = IRQF_TRIGGER_LOW | IRQF_SHARED;
/* COORDINATOR Qualcomm1021 BUILDERR MODIFY start */
		if (irq_set_irq_type(gpio_to_irq(D_INTU_GPIO_NO), irqflag))
			MFC_DRV_ERR_LOG("set_irq_type irqflag = %ld", irqflag);
/* COORDINATOR Qualcomm1021 BUILDERR MODIFY end */
	}

	/* enable irq handler */
	enable_irq(gpio_to_irq(D_INTU_GPIO_NO));

	/* read changed data or error */
	if (read_value != old_value || g_intu_d.read_error) {
		if ((snfc_available()) && (snfc_available_wake_up())) {
			/* wakeup poll and read */
			g_intu_d.irq_handler_done = 1;
			wake_up_interruptible(&g_intu_d.read_wait);
		}
	}

	MFC_DRV_DBG_LOG("END read_value = %d, old_value = %d, g_intu_d.read_error = %d"
					, read_value, old_value, g_intu_d.read_error);
}
Пример #30
0
static int int_poll_init(void)
{
	int sdResult = 0;
	struct device *class_dev;
	
	dev_t dev = MKDEV(MISC_MAJOR, 0);
	
	MFC_DRV_DBG_LOG("START");
	
	sdResult = alloc_chrdev_region(&dev , 0 , D_INT_POLL_DEVS, D_INT_POLL_DEV_NAME);
	if (sdResult) {
		MFC_DRV_ERR_LOG("alloc_chrdev_region sdResult = %d", sdResult);
		return sdResult;
	}
	
	cdev_init(&int_poll_cdev, &int_poll_fileops);
	int_poll_cdev.owner = THIS_MODULE;
	
	sdResult = cdev_add(&int_poll_cdev, dev, D_INT_POLL_DEVS);
	if (sdResult) {
		unregister_chrdev_region(dev, D_INT_POLL_DEVS);
		MFC_DRV_ERR_LOG("cdev_add sdResult = %d",sdResult);
		return sdResult;
	}
	
	class_dev = device_create(felica_class, NULL, dev, NULL, D_INT_POLL_DEV_NAME);
	if (IS_ERR(class_dev)) {
		cdev_del(&int_poll_cdev);
		unregister_chrdev_region(dev, D_INT_POLL_DEVS);
		sdResult = PTR_ERR(class_dev);
		MFC_DRV_ERR_LOG("device_create sdResult = %d", sdResult);
		return sdResult;
	}
	
	memset(g_int_d, 0x00, sizeof(struct poll_data));

	INIT_DELAYED_WORK(&g_int_d->work, int_poll_work_func);

	init_waitqueue_head(&g_int_d->read_wait);
	
	g_int_d->open_flag = 0;
	
	MFC_DRV_DBG_LOG("END");
	
	return sdResult;
}