示例#1
0
static void
GpioInterruptHandler(void *arg)
{
	NvOdmGpioPinMode mode;

	NvU32 pinValue = 0;
	NvOdmGyroAccelHandle hDevice =  (NvOdmGyroAccelHandle)arg;
	printk(" ## MPU3050 : 5 \n") ;

	NvOdmGpioGetState(hDevice->hGpioINT, hDevice->hPinINT, &pinValue);

	if (pinValue == 1) {
		mode = NvOdmGpioPinMode_InputInterruptLow;
	} else {
		mode = NvOdmGpioPinMode_InputInterruptHigh;
	}

	NvOdmGpioConfig(hDevice->hGpioINT, hDevice->hPinINT, mode);

	if (pinValue == 1) {
		NvOdmOsSemaphoreSignal(hDevice->SemaphoreForINT);
	}
	NvOdmGpioInterruptDone(hDevice->hGpioInterrupt);

	return;
}
示例#2
0
static void EETI_GpioIsr(void *arg) {
    EETI_TouchDevice* hTouch = (EETI_TouchDevice*)arg;

    /* Signal the touch thread to read the sample. After it is done reading the
     * sample it should re-enable the interrupt. */
    NvOdmOsSemaphoreSignal(hTouch->hIntSema);            
}
示例#3
0
static void headset_irq_handler(void* arg)
{
    NvU32 states;

    //printk("===============================> headset_irq_handler\n");

    NvOdmGpioGetState(s_hGpio,s_hHeadphoneGpioPin,&states);
    if( !states )
    {     
        gHeadsetInsertStatus = HEADSET_STATUS_REMOVE;
        NvOdmGpioConfig(s_hGpio,s_hHeadphoneGpioPin,NvOdmGpioPinMode_InputInterruptHigh );
    }
    else
    {        
        gHeadsetInsertStatus = HEADSET_STATUS_INSERT;
        NvOdmGpioConfig(s_hGpio,s_hHeadphoneGpioPin,NvOdmGpioPinMode_InputInterruptLow );
    }


	//schedule_work(&switch_data->work);
    if ( g_hDetectEventSema )
        NvOdmOsSemaphoreSignal( g_hDetectEventSema );


    if (s_hGpioIntr_Headphone)
        NvOdmGpioInterruptDone(s_hGpioIntr_Headphone);

	return;
}
static void Synaptics_OneTouch_GpioIsr(void *arg)
{
    Synaptics_OneTouch_Device* hTouch = (Synaptics_OneTouch_Device*)arg;
	NVODMTOUCH_PRINTF(("[ONETOUCH] Synaptics_OneTouch_GpioIsr\n"));

    /* Signal the touch thread to read the sample. After it is done reading the
        * sample it should re-enable the interrupt. */
    NvOdmOsSemaphoreSignal(hTouch->hIntSema);
}
static void GpioInterruptHandler(void *arg)
{
    NvU32 pinValue;
    NvOdmEcompassHandle hDevice =  (NvOdmEcompassHandle)arg;
	
    NvOdmGpioGetState(hDevice->hGpioINT, hDevice->hPinINT, &pinValue);
    if (pinValue == 1)
    {
		NvOdmEcompasspioInterruptMask(hDevice);				/* Daniel 20101122 <<< */
		NvOdmOsSemaphoreSignal(hDevice->SemaphoreForINT);
    }
    NvOdmGpioInterruptDone(hDevice->hGpioInterrupt);
    return;
}
void NvOdmCirDeInit(void)
{
	
    (void)NvEcUnregisterForEvents(s_hEcEventRegistration);
    s_hEcEventRegistration = NULL;

    s_CirDeinit = NV_TRUE;
    NvOdmOsSemaphoreSignal(s_hCirKeyScanRecvSema);
    NvOdmOsSemaphoreDestroy(s_hCirKeyScanRecvSema);
    s_hCirKeyScanRecvSema = NULL;

    NvEcClose(s_NvEcHandle);
    s_NvEcHandle = NULL;
}
static void GpioInterruptHandler(void *arg)
{
    NvU32 pinValue;
    NvU8 ret;
    NvU8 buffer[SENSOR_DATA_SIZE];
    NvU8 i;
    NvOdmEcompassHandle hDevice =  (NvOdmEcompassHandle)arg;
    NvOdmGpioGetState(hDevice->hGpioINT, hDevice->hPinINT, &pinValue);

    if (pinValue == 1)
    {
        ret=ReadReg(hDevice, AK8975_REG_ST1, buffer, SENSOR_DATA_SIZE);
        if (ret<0) {
            NVODMECOMPASS_PRINTF(("AKM8975 compass driver: I2C failed\n"));
            return;
        }
        /* Check ST bit */
        if ((buffer[0] & 0x01) != 0x01)
        {
            NVODMECOMPASS_PRINTF(("AKM8975 akm8975_work_func: ST is not set\n"));
            return;
        }
        /* Check ST2 bit */
        if (((buffer[7]&0x04)==0x04)||((buffer[7]&0x08)==0x08))
        {
            NVODMECOMPASS_PRINTF(("AKM8975 akm8975_work_func: Data is Fail\n"));
            return;
        }
        NvOdmOsMemcpy(ecompass_buffer,buffer,SENSOR_DATA_SIZE);
#if 0
        NVODMECOMPASS_PRINTF(("\n"));
        NVODMECOMPASS_PRINTF((" GPIO handle :\n"));
        for (i=0; i<SENSOR_DATA_SIZE; i++) {
            NVODMECOMPASS_PRINTF((" Reg %d : [%02x]\n",i,ecompass_buffer[i]));
        }
#endif
        NvOdmOsSemaphoreSignal(hDevice->SemaphoreForINT);
    }
    NvOdmGpioInterruptDone(hDevice->hGpioInterrupt);
    return;
}
void NvOdmKeyboardDeInit(void)
{
#if WAKE_FROM_KEYBOARD
	NvRmGpioInterruptUnregister(s_hGpioGlobal, s_hRmGlobal, hOdm->GpioIntrHandle);
	hOdm->GpioIntrHandle = NULL;
	NvRmGpioReleasePinHandles(s_hGpioGlobal, &hOdm->hPin, hOdm->PinCount);
	hOdm->PinCount = 0;
	NvOdmOsFree(hOdm);
	hOdm = NULL;
#endif

    (void)NvEcUnregisterForEvents(s_hEcEventRegistration);
    s_hEcEventRegistration = NULL;

    s_KeyboardDeinit = NV_TRUE;
    NvOdmOsSemaphoreSignal(s_hKbcKeyScanRecvSema);
    NvOdmOsSemaphoreDestroy(s_hKbcKeyScanRecvSema);
    s_hKbcKeyScanRecvSema = NULL;

    NvEcClose(s_NvEcHandle);
    s_NvEcHandle = NULL;
}
示例#9
0
static int __devexit headset_switch_remove(struct platform_device *pdev)
{

	struct gpio_switch_data *switch_data = platform_get_drvdata(pdev);

	cancel_work_sync(&switch_data->work);
	

    //remove interrupt
    NvOdmGpioInterruptUnregister(
        s_hGpio, s_hHeadphoneGpioPin, s_hGpioIntr_Headphone);
    NvOdmGpioReleasePinHandle(s_hGpio, s_hHeadphoneGpioPin);
    s_hHeadphoneGpioPin = NULL;

    //remove thread
    //terminate thread 
    g_DetectThread_exit = 1;
    if ( g_hDetectEventSema )
        NvOdmOsSemaphoreSignal( g_hDetectEventSema );
    
    if( !g_hDetectThread )
        NvOdmOsThreadJoin( g_hDetectThread );
    g_hDetectThread = NULL;

    if ( g_hDetectEventSema )
    {
        NvOdmOsSemaphoreDestroy( g_hDetectEventSema );
        g_hDetectEventSema = 0;
    }

    switch_dev_unregister(&switch_data->sdev);
	kfree(switch_data);


	return 0;
}
示例#10
0
void NvOdmAccelSignal(NvOdmAccelHandle hDevice)
{
    NvOdmOsSemaphoreSignal(hDevice->SemaphoreForINT);
}