コード例 #1
0
static irqreturn_t earjack_debugger_irq_handler(int irq, void *_dev)
{
	struct earjack_debugger_device *adev = _dev;
	unsigned int um = lge_get_uart_mode();
	int detect;

	/* LGE_CHANGE_S
	 * add debounce time because accure earjack popup noise
	 * [email protected] 2012/12/20
	 */
	msleep(400);
	/* LGE_CHANGE_E */

	detect = earjack_debugger_detected(adev);


	if (detect) {
		pr_debug("%s() : in!!\n", __func__);
		if (um & UART_MODE_INIT_BMSK) {
			adev->set_uart_console(1);
		} else {
			lge_set_uart_mode(um | UART_MODE_EN_BMSK);
		}
	} else {
		pr_debug("%s() : out!!\n", __func__);
		if (um & UART_MODE_INIT_BMSK) {
			adev->set_uart_console(0);
		} else {
			lge_set_uart_mode(um & ~UART_MODE_EN_BMSK);
		}
	}

	return IRQ_HANDLED;
}
static irqreturn_t earjack_debugger_irq_handler(int irq, void *_dev)
{
	struct earjack_debugger_device *adev = _dev;
	unsigned int um = lge_get_uart_mode();
	int detect;

	/*             
                                                        
                                    
  */
	msleep(400);
	/*              */

	detect = earjack_debugger_detected(adev);


	if (detect) {
		pr_debug("%s() : in!!\n", __func__);
		if (um & UART_MODE_INIT_BMSK) {
			adev->set_uart_console(1);
		} else {
			lge_set_uart_mode(um | UART_MODE_EN_BMSK);
		}
	} else {
		pr_debug("%s() : out!!\n", __func__);
		if (um & UART_MODE_INIT_BMSK) {
			adev->set_uart_console(0);
		} else {
			lge_set_uart_mode(um & ~UART_MODE_EN_BMSK);
		}
	}

	return IRQ_HANDLED;
}
コード例 #3
0
static int zw_earjack_debugger_notifier_call(struct notifier_block *nb,
					unsigned long state, void *ptr)
{
	struct earjack_debugger_device *dev =
			(struct earjack_debugger_device *)nb->ptr;

	switch (state) {
	case ZW_STATE_OFF:
		if (!zw_keep_uart_console()) {
			/* if earjack-debugger is detected, then enable */
			if (earjack_debugger_detected(dev)) {
				unsigned int um = lge_get_uart_mode();
				if (um & UART_MODE_INIT_BMSK) {
					dev->set_uart_console(1);
				} else {
					lge_set_uart_mode(
						um | UART_MODE_EN_BMSK);
				}
			}
		}
		break;

	case ZW_STATE_ON_SYSTEM:
	case ZW_STATE_ON_USER:
		if (!zw_keep_uart_console()) {
			/* if earjack-debugger is detected, then disable */
			if (earjack_debugger_detected(dev)) {
				unsigned int um = lge_get_uart_mode();
				if (um & UART_MODE_INIT_BMSK) {
					dev->set_uart_console(0);
				} else {
					lge_set_uart_mode(
						um & ~UART_MODE_EN_BMSK);
				}
			}
		}
		break;
	}

	return NOTIFY_DONE;
}
コード例 #4
0
static int __init lge_uart_mode(char *uart_mode)
{
	if (!strncmp("enable", uart_mode, 6)) {
		printk(KERN_INFO"UART CONSOLE : enable\n");
		lge_set_uart_mode((UART_MODE_ALWAYS_ON_BMSK | UART_MODE_EN_BMSK)
				& ~UART_MODE_ALWAYS_OFF_BMSK);
	} else {
		printk(KERN_INFO"UART CONSOLE : disable\n");
	}

	return 1;
}