/*
 * configures interrupts + detection hardware to meet the requirements
 * set by currently attached accessory type.
 */
static void config_accdetect(struct abx500_ad *dd)
{
	switch (dd->jack_type) {
	case JACK_TYPE_UNSPECIFIED:
		dd->config_accdetect1_hw(dd, 1);
		dd->config_accdetect2_hw(dd, 0);

		release_irq(dd, PLUG_IRQ);
		release_irq(dd, UNPLUG_IRQ);
		release_irq(dd, BUTTON_PRESS_IRQ);
		release_irq(dd, BUTTON_RELEASE_IRQ);
		if (dd->set_av_switch)
			dd->set_av_switch(dd, NOT_SET);
		break;

	case JACK_TYPE_DISCONNECTED:
	if (dd->set_av_switch)
		dd->set_av_switch(dd, NOT_SET);
	case JACK_TYPE_HEADPHONE:
	case JACK_TYPE_CVIDEO:
		dd->config_accdetect1_hw(dd, 1);
		dd->config_accdetect2_hw(dd, 0);

		claim_irq(dd, PLUG_IRQ);
		claim_irq(dd, UNPLUG_IRQ);
		release_irq(dd, BUTTON_PRESS_IRQ);
		release_irq(dd, BUTTON_RELEASE_IRQ);
		break;

	case JACK_TYPE_UNSUPPORTED_HEADSET:
		dd->config_accdetect1_hw(dd, 1);
		dd->config_accdetect2_hw(dd, 1);

		release_irq(dd, PLUG_IRQ);
		claim_irq(dd, UNPLUG_IRQ);
		release_irq(dd, BUTTON_PRESS_IRQ);
		release_irq(dd, BUTTON_RELEASE_IRQ);
		if (dd->set_av_switch)
			dd->set_av_switch(dd, NOT_SET);
		break;

	case JACK_TYPE_CONNECTED:
	case JACK_TYPE_HEADSET:
	case JACK_TYPE_CARKIT:
	case JACK_TYPE_OPENCABLE:
		dd->config_accdetect1_hw(dd, 1);
		dd->config_accdetect2_hw(dd, 1);

		release_irq(dd, PLUG_IRQ);
		claim_irq(dd, UNPLUG_IRQ);
		claim_irq(dd, BUTTON_PRESS_IRQ);
		claim_irq(dd, BUTTON_RELEASE_IRQ);
		break;

	default:
		dev_err(&dd->pdev->dev, "%s: Unknown type: %d\n",
			__func__, dd->jack_type);
	}
}
Exemplo n.º 2
0
void serial_suspend(void)
{
    int i, irq;
    for ( i = 0; i < ARRAY_SIZE(com); i++ )
        if ( (irq = serial_irq(i)) >= 0 )
            release_irq(irq);
}
Exemplo n.º 3
0
/* Response to user's close() call. Will also be called by the kernel
 * if the user process dies for any reason. */
int aclpci_close(struct inode *inode, struct file *file) {

  ssize_t result = 0;
  struct aclpci_dev *aclpci = (struct aclpci_dev *)file->private_data;
  ACL_DEBUG (KERN_DEBUG "aclpci = %p, pid = %d, dma_idle = %d",
             aclpci, current->pid, aclpci_dma_get_idle_status(aclpci)); 
  
  if (down_interruptible(&aclpci->sem)) {
    return -ERESTARTSYS;
  }
  
#if 0  
  if (aclpci->user_pid == current->pid) {
    aclpci->user_pid = -1;
  } else {
    ACL_DEBUG (KERN_WARNING "Tried close() by pid %d. Opened by %d", current->pid, aclpci->user_pid);
    result = -EFAULT;
    goto done;
  }
#endif

  release_irq (aclpci->pci_dev, aclpci);

  up (&aclpci->sem);
  return result;
}
Exemplo n.º 4
0
Arquivo: ps2.c Projeto: PyroOS/Pyro
status_t ps2_close( void* pNode, void* pCookie )
{
    uint32 nFlg;
    PS2_Port_s* psPort = (PS2_Port_s*)pNode;
    
    if ( atomic_dec_and_test( &psPort->nOpenCount ) ) {
		release_irq( psPort->nIrq, psPort->nIrqHandle );
    }
    return( 0 );
}
Exemplo n.º 5
0
Arquivo: osl.c Projeto: PyroOS/Pyro
acpi_status
acpi_os_remove_interrupt_handler(u32 irq, acpi_osd_handler handler)
{
	if (irq) {
		release_irq(irq, acpi_irq_irq);
		acpi_irq_handler = NULL;
		acpi_irq_irq = 0;
	}
	
	return AE_OK;
}
Exemplo n.º 6
0
static void my_exit(void)
{
	//Release the IRQ line
	release_irq();

	//Clean up char device
	if (foo_class) {
		device_destroy(foo_class, dev_first);
		class_destroy(foo_class);
	}
	if (my_cdev)
		cdev_del(my_cdev);
	unregister_chrdev_region(dev_first, numr);
	if (ramdisk)
		kfree(ramdisk);

	pr_info("\ndevice unregistered\n");
}
Exemplo n.º 7
0
Arquivo: kbd.c Projeto: PyroOS/Pyro
status_t device_uninit( int nDeviceID )
{
    release_irq( 1, g_sVolume.nIrqHandle );
    printk( "Test device: device_uninit() called\n" );
    return( 0 );
}