static int h2w_switch_remove(struct platform_device *pdev) { struct h2w_switch_dev *hsdev; hsdev = (struct h2w_switch_dev *)platform_get_drvdata(pdev); #ifdef CONFIG_SWITCH_DOCK_H2W #if !TIMER_DEALER NvOdmGpioInterruptUnregister(hsdev->gpio, hsdev->dock_hp_det_pin, hsdev->dock_hp_det_irq); #endif #endif #if !TIMER_DEALER NvOdmGpioInterruptUnregister(hsdev->gpio, hsdev->hp_det_pin, hsdev->hp_det_irq); #endif destroy_workqueue(hsdev->workqueue); switch_dev_unregister(&hsdev->sdev); #ifdef CONFIG_SWITCH_DOCK_H2W NvOdmGpioReleasePinHandle(hsdev->gpio, hsdev->dock_hp_det_pin); #endif NvOdmGpioReleasePinHandle(hsdev->gpio, hsdev->hp_det_pin); NvOdmGpioClose(hsdev->gpio); kfree(hsdev); return 0; }
void Synaptics_OneTouch_Close (NvOdmOneTouchDeviceHandle hDevice) { Synaptics_OneTouch_Device* hTouch = (Synaptics_OneTouch_Device*)hDevice; NVODMTOUCH_PRINTF(("[Touch Driver] Synaptics_OneTouch_Close\n")); if (!hTouch) return; // 20101120 [email protected] power off when Onetouch close #if defined(CONFIG_MACH_STAR_SKT_REV_E) || defined(CONFIG_MACH_STAR_SKT_REV_F) Synaptics_OneTouch_PowerOnOff(&hTouch->OdmOneTouch, NV_FALSE); #endif if (hTouch->hGpio) { if (hTouch->hPin) { if (hTouch->hGpioIntr) NvOdmGpioInterruptUnregister(hTouch->hGpio, hTouch->hPin, hTouch->hGpioIntr); NvOdmGpioReleasePinHandle(hTouch->hGpio, hTouch->hPin); } NvOdmGpioClose(hTouch->hGpio); } if (hTouch->hOdmI2c) NvOdmI2cClose(hTouch->hOdmI2c); NvOdmOsFree(hTouch); }
static int powerkey_remove(struct platform_device *pdev) { //20100703, [email protected], PMIC reset [START] sysfs_remove_group(&pdev->dev.kobj, &star_pmic_group); sysfs_remove_group(&pdev->dev.kobj, &star_hwsku_group); sysfs_remove_group(&pdev->dev.kobj, &star_reset_group); //20101110, [email protected], Function for Warm-boot //20100703, [email protected], PMIC reset [END] //20100610, [email protected], sleep status gpio for modem [START] #ifdef AP_SUSPEND_STATUS NvOdmGpioReleasePinHandle(s_modemCheck.gpioHandle, s_modemCheck.pinHandle); NvOdmGpioClose(s_modemCheck.gpioHandle); #endif //20100610, [email protected], sleep status gpio for modem [END] input_unregister_device(s_powerkey.inputDev); input_free_device(s_powerkey.inputDev); NvOdmGpioInterruptUnregister(s_powerkey.gpioHandle, s_powerkey.pinHandle, s_powerkey.intHandle); NvOdmGpioReleasePinHandle(s_powerkey.gpioHandle, s_powerkey.pinHandle); NvOdmGpioClose(s_powerkey.gpioHandle); #ifdef POWERKEY_DELAYED_WORKQUEUE wake_lock_destroy(&s_powerkey.wlock); #endif return 0; }
void NvOdmAccelClose(NvOdmAccelHandle hDevice) { if(NULL != hDevice) { if(NULL != hDevice->SemaphoreForINT && NULL != hDevice->hGpioINT && NULL != hDevice->hPinINT && NULL != hDevice->hGpioInterrupt) { NvOdmGpioInterruptUnregister(hDevice->hGpioINT, hDevice->hPinINT, hDevice->hGpioInterrupt); NvOdmOsSemaphoreDestroy(hDevice->SemaphoreForINT); NvOdmGpioReleasePinHandle(hDevice->hGpioINT, hDevice->hPinINT); NvOdmGpioClose(hDevice->hGpioINT); } NvAccelerometerI2CClose(hDevice->hOdmI2C); // Power off accelermeter NvAccelerometerSetPowerRail(hDevice->hPmu, hDevice->VddId, NV_FALSE); if (hDevice->hPmu) { //NvAccelerometerSetPowerOn(0); NvOdmServicesPmuClose(hDevice->hPmu); } return; } }
NvOdmTmonIntrHandle Adt7461IntrRegister( NvOdmTmonDeviceHandle hTmon, NvOdmTmonZoneID ZoneId, NvOdmInterruptHandler Callback, void* CallbackArg) { NvU8 Data; ADT7461PrivData* pPrivData; const ADT7461ChannelInfo* pChannel; NvOdmServicesGpioIntrHandle hGpioIntr = NULL; NV_ASSERT(hTmon && hTmon->pPrivate && Callback && CallbackArg); pPrivData = hTmon->pPrivate; // No registration, if no GPIO pin available or interrupt already registred if (!pPrivData->hGpioPin || pPrivData->hGpioIntr) return NULL; // No registration for other than remote channel pChannel = &pPrivData->pDeviceInfo->Channels[( pPrivData->ConnectivityMap[ZoneId])]; if (pChannel->ChannelId != ADT7461ChannelID_Remote) return NULL; // Register GPIO interrupt (will be enabled at SoC IC, but still disabled // at ADT7461 device) pPrivData->Callback = Callback; pPrivData->CallbackArg = CallbackArg; if (!NvOdmGpioInterruptRegister( pPrivData->hGpio, &hGpioIntr, pPrivData->hGpioPin, ADT7461_ODM_INTR_POLARITY, Adt7461Isr, (void *)pPrivData, 0)) { pPrivData->Callback = NULL; pPrivData->CallbackArg = NULL; return NULL; } NV_ASSERT(hGpioIntr); pPrivData->hGpioIntr = hGpioIntr; // Finally enable ADT7461 device interrupt output (interrupt may or may // not be generated depending on temperature and limt settings). #if PRE_ER_WORKAROUND Data = pPrivData->ShadowConfig | (ADT7461ConfigBits_IntrDisabled); #else Data = pPrivData->ShadowConfig & (~ADT7461ConfigBits_IntrDisabled); #endif if(!Adt7461WriteReg(pPrivData, &pPrivData->pDeviceInfo->Config, Data)) { NvOdmGpioInterruptUnregister( pPrivData->hGpio, pPrivData->hGpioPin, hGpioIntr); pPrivData->Callback = NULL; pPrivData->CallbackArg = NULL; pPrivData->hGpioIntr = NULL; return NULL; } pPrivData->ShadowConfig = Data; return (NvOdmTmonIntrHandle)hGpioIntr; }
void NvOdmGyroAccelClose(NvOdmGyroAccelHandle hDevice) { if (NULL != hDevice) { if (NULL != hDevice->SemaphoreForINT && NULL != hDevice->hGpioINT && NULL != hDevice->hPinINT && NULL != hDevice->hGpioInterrupt) { NvOdmGpioInterruptUnregister(hDevice->hGpioINT, hDevice->hPinINT, hDevice->hGpioInterrupt); NvOdmOsSemaphoreDestroy(hDevice->SemaphoreForINT); NvOdmGpioReleasePinHandle(hDevice->hGpioINT, hDevice->hPinINT); NvOdmGpioClose(hDevice->hGpioINT); } NvGyroAccelI2CClose(hDevice->hOdmI2C); #if 1 printk(" ## MPU3050 : [%s:%d] \n",__FUNCTION__, __LINE__) ; #endif // Power off accelermeter NvGyroAccelSetPowerRail(hDevice->hPmu, hDevice->VddId, NV_FALSE); if (hDevice->hPmu) { //NvGyroAccelSetPowerOn(0); NvOdmServicesPmuClose(hDevice->hPmu); } return; } }
static NvBool EETI_Resume(NvOdmTouchDeviceHandle hDevice) { EETI_TouchDevice* hTouch = (EETI_TouchDevice*)hDevice; if (hDevice == NULL) { return NV_FALSE; } #if 0 NvOdmGpioInterruptMask(hTouch->hGpioIntr, NV_TRUE); NvOdmGpioInterruptUnregister(hTouch->hGpio, hTouch->hPin, hTouch->hGpioIntr); #endif NvOdmGpioConfig(hTouch->hGpio, hTouch->hPin, NvOdmGpioPinMode_Output); /* Send reset pulse to touch HW */ NvOdmGpioSetState(hTouch->hGpio, hTouch->hPin, 1); NvOsWaitUS(50); NvOdmGpioSetState(hTouch->hGpio, hTouch->hPin, 0); NvOsSleepMS(50); NvOdmGpioSetState(hTouch->hGpio, hTouch->hPin, 1); NvOdmGpioConfig(hTouch->hGpio, hTouch->hPin, NvOdmGpioPinMode_InputInterruptLow); #if 0 if (NvOdmGpioInterruptRegister(hTouch->hGpio, &hTouch->hGpioIntr, hTouch->hPin, NvOdmGpioPinMode_InputInterruptLow, EETI_GpioIsr, (void*)hTouch, EETI_DEBOUNCE_TIME_MS) == NV_FALSE) { return NV_FALSE; } #endif return NV_TRUE; }
static int headsetdet_remove(struct platform_device *pdev) { lprintk(D_AUDIO, KERN_ERR "##(Headset_det.c)## headsetdet_remove() : headset detection ended..!!\n"); //20100421 [email protected] [LGE] struct headset_switch_data *switch_data = platform_get_drvdata(pdev); //20101125, [email protected], hookkey press is skipped When wakeup from LP1 [START] //wake_lock_destroy(&hook_det_lock); //20101125, [email protected], hookkey press is skipped When wakeup from LP1 [END] if (headset_h_pmu) NvOdmServicesPmuClose(headset_h_pmu); cancel_work_sync(&switch_data->work); cancel_delayed_work_sync(&switch_data->delayed_work); //P990_IFX_GB_PORTING_LGSI_START //FIDO - GB Porting [09/08/2011] - Start #if 1 //defined (STAR_OPERATOR_FIDO) wake_lock_destroy(&headset_wake_lock); //20110425 [email protected] headset wake lock timeout #endif //FIDO - GB Porting [09/08/2011] - End //P990_IFX_GB_PORTING_LGSI_END /*====================== nVidia GPIO Control(S) =======================*/ NvOdmGpioInterruptUnregister(s_hHeadsetHandle.hGpio, s_hHeadsetHandle.h_Headset_Detection, s_hHeadsetHandle.hheadsetInterrupt); NvOdmGpioInterruptUnregister(s_hHeadsetHandle.hGpio, s_hHeadsetHandle.h_Hookkey_Detection, s_hHeadsetHandle.hhookInterrupt); //20100421 [email protected] for Hookkey [LGE] NvOdmGpioReleasePinHandle(s_hHeadsetHandle.hGpio, s_hHeadsetHandle.h_Headset_Detection); NvOdmGpioReleasePinHandle(s_hHeadsetHandle.hGpio, s_hHeadsetHandle.h_Hookkey_Detection); //20100421 [email protected] for Hookkey [LGE] NvOdmGpioClose(s_hHeadsetHandle.hGpio); /*====================== nVidia GPIO Control(E) =======================*/ switch_dev_unregister(&switch_data->sdev); input_unregister_device(switch_data->ip_dev); //20100421 [email protected] for Hookkey [LGE] kfree(switch_data); return 0; }
static int h2w_switch_remove(struct platform_device *pdev) { struct h2w_switch_dev *hsdev; hsdev = (struct h2w_switch_dev *)platform_get_drvdata(pdev); NvOdmGpioInterruptUnregister(hsdev->gpio, hsdev->hp_det_pin, hsdev->hp_det_irq); NvOdmGpioReleasePinHandle(hsdev->gpio, hsdev->hp_det_pin); if (hsdev->have_dock_hp) { NvOdmGpioInterruptUnregister(hsdev->gpio, hsdev->dock_hp_det_pin, hsdev->dock_hp_det_irq); NvOdmGpioReleasePinHandle(hsdev->gpio, hsdev->dock_hp_det_pin); } NvOdmGpioClose(hsdev->gpio); destroy_workqueue(hsdev->workqueue); switch_dev_unregister(&hsdev->sdev); kfree(hsdev); return 0; }
static int headsetdet_remove(struct platform_device *pdev) { lprintk(D_AUDIO, KERN_ERR "##(Headset_det.c)## headsetdet_remove() : headset detection ended..!!\n"); //20100421 [LGE] struct headset_switch_data *switch_data = platform_get_drvdata(pdev); //20101125, , hookkey press is skipped When wakeup from LP1 [START] //wake_lock_destroy(&hook_det_lock); //20101125, , hookkey press is skipped When wakeup from LP1 [END] if (headset_h_pmu) NvOdmServicesPmuClose(headset_h_pmu); cancel_work_sync(&switch_data->work); cancel_delayed_work_sync(&switch_data->delayed_work); /*====================== nVidia GPIO Control(S) =======================*/ NvOdmGpioInterruptUnregister(s_hHeadsetHandle.hGpio, s_hHeadsetHandle.h_Headset_Detection, s_hHeadsetHandle.hheadsetInterrupt); NvOdmGpioInterruptUnregister(s_hHeadsetHandle.hGpio, s_hHeadsetHandle.h_Hookkey_Detection, s_hHeadsetHandle.hhookInterrupt); //20100421 for Hookkey [LGE] NvOdmGpioReleasePinHandle(s_hHeadsetHandle.hGpio, s_hHeadsetHandle.h_Headset_Detection); NvOdmGpioReleasePinHandle(s_hHeadsetHandle.hGpio, s_hHeadsetHandle.h_Hookkey_Detection); //20100421 for Hookkey [LGE] NvOdmGpioClose(s_hHeadsetHandle.hGpio); /*====================== nVidia GPIO Control(E) =======================*/ switch_dev_unregister(&switch_data->sdev); input_unregister_device(switch_data->ip_dev); //20100421 for Hookkey [LGE] kfree(switch_data); return 0; }
static int proximity_remove(struct platform_device *pdev) { struct device *dev = &pdev->dev; star_proxi_disable(&s_proximity); sysfs_remove_group(&dev->kobj, &star_proxi_group); input_unregister_device(s_proximity.input_dev); NvOdmGpioInterruptUnregister(s_proximity.proxi_out_gpio, s_proximity.proxi_out_gpio_pin, s_proximity.proxi_out_intr); NvOdmGpioReleasePinHandle(s_proximity.proxi_out_gpio, s_proximity.proxi_out_gpio_pin); NvOdmGpioClose(s_proximity.proxi_out_gpio); NvOdmI2cClose(s_proximity.gen2_i2c); return 0; }
static void Adt7461FreePrivData(ADT7461PrivData* pPrivData) { if (pPrivData) { if (pPrivData->hGpioIntr) { NvOdmGpioInterruptUnregister( pPrivData->hGpio, pPrivData->hGpioPin, pPrivData->hGpioIntr); } NvOdmI2cClose(pPrivData->hOdmI2C); NvOdmGpioReleasePinHandle(pPrivData->hGpio, pPrivData->hGpioPin); NvOdmGpioClose(pPrivData->hGpio); NvOdmServicesPmuClose(pPrivData->hOdmPmuSevice); NvOdmOsFree(pPrivData); } }
void EETI_Close (NvOdmTouchDeviceHandle hDevice) { EETI_TouchDevice* hTouch = (EETI_TouchDevice*)hDevice; if (!hTouch) return; if (hTouch->hGpio) { if (hTouch->hPin) { if (hTouch->hGpioIntr) NvOdmGpioInterruptUnregister(hTouch->hGpio, hTouch->hPin, hTouch->hGpioIntr); NvOdmGpioReleasePinHandle(hTouch->hGpio, hTouch->hPin); } NvOdmGpioClose(hTouch->hGpio); } if (hTouch->hOdmI2c) NvOdmI2cClose(hTouch->hOdmI2c); NvOdmOsFree(hTouch); }
static int muic_remove(struct platform_device *pdev) { NvOdmGpioInterruptUnregister(s_hMuicHandle.hGpio, s_hMuicHandle.h_INT_N_MUIC, s_hMuicHandle.hGpioInterrupt); NvOdmGpioReleasePinHandle(s_hMuicHandle.hGpio, s_hMuicHandle.h_INT_N_MUIC); NvOdmGpioReleasePinHandle(s_hMuicHandle.hGpio, s_hMuicHandle.h_AP20_UART_SW); NvOdmGpioReleasePinHandle(s_hMuicHandle.hGpio, s_hMuicHandle.h_IFX_UART_SW); NvOdmGpioReleasePinHandle(s_hMuicHandle.hGpio, s_hMuicHandle.h_USIF1_SW); #if defined(CONFIG_MACH_STAR_REV_D) || defined(CONFIG_MACH_STAR_REV_E) || defined(CONFIG_MACH_STAR_REV_F) NvOdmGpioReleasePinHandle(s_hMuicHandle.hGpio, s_hMuicHandle.h_USB_VBUS_EN); #endif NvOdmGpioClose(s_hMuicHandle.hGpio); #ifndef _MUIC_GPIO_I2C_ NvOdmI2cClose(s_hMuicHandle.hOdmI2c); #endif wake_lock_destroy(&s_hMuicHandle.wlock); remove_star_muic_proc_file(); return 0; }
void Adt7461IntrUnregister( NvOdmTmonDeviceHandle hTmon, NvOdmTmonZoneID ZoneId, NvOdmTmonIntrHandle hIntr) { NvU8 Data; ADT7461PrivData* pPrivData; const ADT7461ChannelInfo* pChannel; // Ignore invalid handles if(!hIntr || !hTmon || !hTmon->pPrivate) return; pPrivData = hTmon->pPrivate; if (hIntr != ((NvOdmTmonIntrHandle)pPrivData->hGpioIntr)) return; // Ignore any channel other than remote pChannel = &pPrivData->pDeviceInfo->Channels[( pPrivData->ConnectivityMap[ZoneId])]; if (pChannel->ChannelId != ADT7461ChannelID_Remote) return; // Disable ADT7461 interrupt output Data = pPrivData->ShadowConfig | ADT7461ConfigBits_IntrDisabled; if(Adt7461WriteReg(pPrivData, &pPrivData->pDeviceInfo->Config, Data)) pPrivData->ShadowConfig = Data; // Unregister GPIO interrupt, clear callbacks and handle NvOdmGpioInterruptUnregister( pPrivData->hGpio, pPrivData->hGpioPin, pPrivData->hGpioIntr); pPrivData->Callback = NULL; pPrivData->CallbackArg = NULL; pPrivData->hGpioIntr = NULL; }
static int headsetdet_remove(struct platform_device *pdev) { #if 0 printk(KERN_ERR "##(Headset_det.c)## headsetdet_remove() : headset detection ended..!!\n"); //20100421 [email protected] [LGE] struct headset_switch_data *switch_data = platform_get_drvdata(pdev); cancel_work_sync(&switch_data->work); cancel_delayed_work_sync(&switch_data->delayed_work); /*====================== nVidia GPIO Control(S) =======================*/ NvOdmGpioInterruptUnregister(s_hHeadsetHandle.hGpio, s_hHeadsetHandle.h_Headset_Detection, s_hHeadsetHandle.hGpioInterrupt); //NvOdmGpioInterruptUnregister(s_hHeadsetHandle.hGpio, s_hHeadsetHandle.h_Hookkey_Detection, s_hHeadsetHandle.hGpioInterrupt); //20100421 [email protected] for Hookkey [LGE] NvOdmGpioReleasePinHandle(s_hHeadsetHandle.hGpio, s_hHeadsetHandle.h_Headset_Detection); //NvOdmGpioReleasePinHandle(s_hHeadsetHandle.hGpio, s_hHeadsetHandle.h_Hookkey_Detection); //20100421 [email protected] for Hookkey [LGE] NvOdmGpioClose(s_hHeadsetHandle.hGpio); /*====================== nVidia GPIO Control(E) =======================*/ switch_dev_unregister(&switch_data->sdev); //input_unregister_device(switch_data->ip_dev); //20100421 [email protected] for Hookkey [LGE] kfree(switch_data); #endif return 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; }
static int __init powerkey_probe(struct platform_device *pdev) { int ret; NvU32 pin, port; const NvOdmPeripheralConnectivity *con = NULL; //20101129, [email protected], idle current issue [START] //GPIO configuration s_touchMaker.gpioHandle = NvOdmGpioOpen(); port = 'x'-'a'; pin = 5; s_touchMaker.pinHandle = NvOdmGpioAcquirePinHandle(s_touchMaker.gpioHandle, port, pin); NvOdmGpioConfig(s_touchMaker.gpioHandle, s_touchMaker.pinHandle, NvOdmGpioPinMode_InputData); //20101129, [email protected], idle current issue [END] //20100610, [email protected], sleep status gpio for modem [START] #ifdef AP_SUSPEND_STATUS //GPIO configuration s_modemCheck.gpioHandle = NvOdmGpioOpen(); if (!s_modemCheck.gpioHandle) { printk(KERN_ERR "[star modem_chk] NvOdmGpioOpen Error \n"); goto err_open_modem_chk_gpio_fail; } port = 'r'-'a'; pin = 0; s_modemCheck.pinHandle = NvOdmGpioAcquirePinHandle(s_modemCheck.gpioHandle, port, pin); if (!s_modemCheck.pinHandle) { printk(KERN_ERR "[star modem_chk] NvOdmGpioAcquirePinHandle Error\n"); goto err_modem_chk_gpio_pin_acquire_fail; } NvOdmGpioSetState(s_modemCheck.gpioHandle, s_modemCheck.pinHandle, 1); NvOdmGpioConfig(s_modemCheck.gpioHandle, s_modemCheck.pinHandle, NvOdmGpioPinMode_Output); #endif //20100610, [email protected], sleep status gpio for modem [END] memset(&s_powerkey, 0x00, sizeof(s_powerkey)); //get query con = NvOdmPeripheralGetGuid(NV_ODM_GUID('p','o','w','e','r','k','e','y')); if(!con){ printk(KERN_ERR "[star powerkey] ODM GUID Error \n"); goto err_probe_fail; } if ( con->AddressList[0].Interface == NvOdmIoModule_Gpio){ port = con->AddressList[0].Instance; pin = con->AddressList[0].Address; }else{ printk(KERN_ERR "[star powerkey] cannot find ODM GUID \n"); goto err_probe_fail; } #ifdef POWERKEY_DELAYED_WORKQUEUE INIT_DELAYED_WORK(&s_powerkey.work, powerkey_handle); wake_lock_init(&s_powerkey.wlock, WAKE_LOCK_SUSPEND, "powerkey_delay"); #else INIT_WORK(&s_powerkey.work, powerkey_handle); #endif //GPIO configuration s_powerkey.gpioHandle = NvOdmGpioOpen(); if (!s_powerkey.gpioHandle) { printk(KERN_ERR "[star powerkey] NvOdmGpioOpen Error \n"); goto err_open_gpio_fail; } s_powerkey.pinHandle = NvOdmGpioAcquirePinHandle(s_powerkey.gpioHandle, port, pin); if (!s_powerkey.pinHandle) { printk(KERN_ERR "[star powerkey] NvOdmGpioAcquirePinHandle Error\n"); goto err_gpio_pin_acquire_fail; } //NvOdmGpioSetState(s_powerkey.gpioHandle, s_powerkey.pinHandle, 0); NvOdmGpioConfig(s_powerkey.gpioHandle, s_powerkey.pinHandle, NvOdmGpioPinMode_InputData); //GPIO interrupt registration if (NvOdmGpioInterruptRegister(s_powerkey.gpioHandle, &s_powerkey.intHandle, s_powerkey.pinHandle, NvOdmGpioPinMode_InputInterruptAny, powerkey_interrupt_handler, (void*)&s_powerkey, 0) == NV_FALSE) { printk(KERN_ERR "[star Powerkey] interrupt registeration fail!\n"); goto err_interrupt_register_fail; } // input device s_powerkey.inputDev = input_allocate_device(); if (!s_powerkey.inputDev) { printk(KERN_ERR "[star Powerkey] input_allocate_device Error!\n"); goto err_input_device_allocation_fail; } s_powerkey.inputDev->name = "powerkey"; //s_powerkey.inputDev->id.bustype = BUS_HOST; s_powerkey.inputDev->evbit[0] = BIT(EV_KEY) | BIT(EV_PWR); set_bit(KEY_POWER, s_powerkey.inputDev->keybit); ret = input_register_device(s_powerkey.inputDev); if (ret) { printk(KERN_ERR "[star powerkey] input_register_device Error\n"); goto err_input_device_register_fail; } //20100703, [email protected], PMIC reset [START] ret = sysfs_create_group(&pdev->dev.kobj, &star_pmic_group); if (ret) { printk(KERN_ERR "[star powerkey] sysfs_create_group ERROR\n"); goto err_pmic_sysfs_fail; } //20100703, [email protected], PMIC reset [END] ret = sysfs_create_group(&pdev->dev.kobj, &star_hwsku_group); if (ret) { printk(KERN_ERR "[star powerkey] sysfs_create_group ERROR\n"); goto err_hwsku_sysfs_fail; } //20101110, [email protected], Function for Warm-boot [START] ret = sysfs_create_group(&pdev->dev.kobj, &star_reset_group); if (ret) { printk(KERN_ERR "[star powerkey] sysfs_create_group ERROR\n"); goto err_reset_sysfs_fail; } //20101110, [email protected], Function for Warm-boot [END] // 20110209 [email protected] disable gpio interrupt during power-off [START] ret = sysfs_create_group(&pdev->dev.kobj, &star_poweroff_group); if (ret) { printk(KERN_ERR "[star powerkey] sysfs_create_group <star_poweroff_group> ERROR\n"); goto err_input_device_register_fail; } // 20110209 [email protected] disable gpio interrupt during power-off [END] return 0; err_reset_sysfs_fail: sysfs_remove_group(&pdev->dev.kobj, &star_hwsku_group); err_hwsku_sysfs_fail: sysfs_remove_group(&pdev->dev.kobj, &star_pmic_group); err_pmic_sysfs_fail: input_unregister_device(s_powerkey.inputDev); err_input_device_register_fail: input_free_device(s_powerkey.inputDev); err_input_device_allocation_fail: NvOdmGpioInterruptUnregister(s_powerkey.gpioHandle, s_powerkey.pinHandle, s_powerkey.intHandle); err_interrupt_register_fail: NvOdmGpioReleasePinHandle(s_powerkey.gpioHandle, s_powerkey.pinHandle); err_gpio_pin_acquire_fail: NvOdmGpioClose(s_powerkey.gpioHandle); err_open_gpio_fail: #ifdef POWERKEY_DELAYED_WORKQUEUE wake_lock_destroy(&s_powerkey.wlock); #endif err_probe_fail: //20100610, [email protected], sleep status gpio for modem [START] #ifdef AP_SUSPEND_STATUS NvOdmGpioReleasePinHandle(s_modemCheck.gpioHandle, s_modemCheck.pinHandle); err_modem_chk_gpio_pin_acquire_fail: NvOdmGpioClose(s_modemCheck.gpioHandle); err_open_modem_chk_gpio_fail: #endif //20100610, [email protected], sleep status gpio for modem [END] return -ENOSYS; }
static void headset_shutdown(struct platform_device *pdev) { lprintk(D_AUDIO, KERN_ERR "##(Headset_det.c)## headsetdet_shutdown() : headset detection ended..!!\n"); //20100421 [email protected] [LGE] struct headset_switch_data *switch_data = platform_get_drvdata(pdev); //20101125, [email protected], hookkey press is skipped When wakeup from LP1 [START] //wake_lock_destroy(&hook_det_lock); //20101125, [email protected], hookkey press is skipped When wakeup from LP1 [END] headset_off = 1; if (headset_h_pmu) NvOdmServicesPmuClose(headset_h_pmu); lprintk(D_AUDIO, KERN_ERR "##(Headset_det.c)## headsetdet_shutdown() : NvOdmServicesPmuClose\n"); #if 0 if (&headset_sw_data->work) { cancel_work_sync(&headset_sw_data->work); printk("switch_data->work canceled\n"); } if (&headset_sw_data->delayed_work) { cancel_delayed_work_sync(&headset_sw_data->delayed_work); printk("witch_data->delayed_work canceled\n"); } if(&headset_sw_data->hook_delayed_work) { cancel_delayed_work_sync(&headset_sw_data->hook_delayed_work); printk("headset_sw_data->hook_delayed_work canceled\n"); } #endif /*====================== nVidia GPIO Control(S) =======================*/ NvOdmGpioInterruptUnregister(s_hHeadsetHandle.hGpio, s_hHeadsetHandle.h_Headset_Detection, s_hHeadsetHandle.hheadsetInterrupt); NvOdmGpioSetState(s_hHeadsetHandle.hGpio, s_hHeadsetHandle.h_Headset_Detection, 0); NvOdmGpioConfig(s_hHeadsetHandle.hGpio, s_hHeadsetHandle.h_Headset_Detection, NvOdmGpioPinMode_Output); NvOdmGpioInterruptUnregister(s_hHeadsetHandle.hGpio, s_hHeadsetHandle.h_Hookkey_Detection, s_hHeadsetHandle.hhookInterrupt); //20100421 [email protected] for Hookkey [LGE] NvOdmGpioSetState(s_hHeadsetHandle.hGpio, s_hHeadsetHandle.h_Hookkey_Detection, 0); NvOdmGpioConfig(s_hHeadsetHandle.hGpio, s_hHeadsetHandle.h_Headset_Detection, NvOdmGpioPinMode_Output); NvOdmGpioReleasePinHandle(s_hHeadsetHandle.hGpio, s_hHeadsetHandle.h_Headset_Detection); NvOdmGpioReleasePinHandle(s_hHeadsetHandle.hGpio, s_hHeadsetHandle.h_Hookkey_Detection); //20100421 [email protected] for Hookkey [LGE] NvOdmGpioClose(s_hHeadsetHandle.hGpio); /*====================== nVidia GPIO Control(E) =======================*/ #if 0 switch_dev_unregister(&headset_sw_data->sdev); input_unregister_device(headset_sw_data->ip_dev); //20100421 [email protected] for Hookkey [LGE] if(headset_sw_data) kfree(headset_sw_data); #endif lprintk(D_AUDIO, KERN_ERR "##(Headset_det.c)## headsetdet_shutdown() : completed\n"); }
static int h2w_switch_probe(struct platform_device *pdev) { struct h2w_switch_dev *hsdev; logd("h2w_switch_probe() IN\r\n"); hsdev = kzalloc(sizeof(struct h2w_switch_dev), GFP_KERNEL); if (!hsdev) { loge("err_alloc_hsdev\r\n"); goto err_alloc_hsdev; } hsdev->gpio = NvOdmGpioOpen(); if (!hsdev->gpio) { loge("err open gpio\r\n"); goto err_open_gpio; } hsdev->hp_det_pin = NvOdmGpioAcquirePinHandle(hsdev->gpio, HP_DET_GPIO_PORT, HP_DET_GPIO_PIN); if (!hsdev->hp_det_pin) { loge("err acquire detect pin handle\r\n"); goto err_acquire_det_pin; } NvOdmGpioConfig(hsdev->gpio, hsdev->hp_det_pin, NvOdmGpioPinMode_InputData); #ifdef CONFIG_SWITCH_DOCK_H2W hsdev->dock_hp_det_pin = NvOdmGpioAcquirePinHandle(hsdev->gpio, DOCK_HP_DET_GPIO_PORT, DOCK_HP_DET_GPIO_PIN); if (!hsdev->dock_hp_det_pin) { loge("err acquire dock headphone detect pin handle"); goto err_acquire_dock_det_pin; } NvOdmGpioConfig(hsdev->gpio, hsdev->dock_hp_det_pin, NvOdmGpioPinMode_InputData); #endif hsdev->sdev.name = "h2w"; hsdev->sdev.print_name = h2w_switch_print_name; hsdev->sdev.print_state = h2w_switch_print_state; if (switch_dev_register(&hsdev->sdev)) { loge("err register switch device\r\n"); goto err_register_sdev; } hsdev->workqueue = create_singlethread_workqueue("h2w_switch"); if (!hsdev->workqueue) { goto err_create_workqueue; } INIT_WORK(&hsdev->work, h2w_switch_work); #if !TIMER_DEALER /* Enable the interrupt at last */ if ((NvOdmGpioInterruptRegister(hsdev->gpio, &hsdev->hp_det_irq, hsdev->hp_det_pin, NvOdmGpioPinMode_InputInterruptAny, h2w_switch_irq_isr, hsdev, IRQ_DEBOUNCE) == NV_FALSE) || (hsdev->hp_det_irq == NULL)) { logd("err register irq\r\n"); goto err_register_irq; } #endif #ifdef CONFIG_SWITCH_DOCK_H2W #if !TIMER_DEALER /* Enable the dock hp detect interrupt */ if ((NvOdmGpioInterruptRegister(hsdev->gpio, &hsdev->dock_hp_det_irq, hsdev->dock_hp_det_pin, NvOdmGpioPinMode_InputInterruptAny, dock_h2w_switch_irq_isr, hsdev, IRQ_DEBOUNCE) == NV_FALSE) || (hsdev->dock_hp_det_irq == NULL)) { loge("err register dock hp irq\r\n"); goto err_register_dock_hp_irq; } #endif #endif platform_set_drvdata(pdev, hsdev); p_switch_dev=hsdev; #if !TIMER_DEALER /* After all we simulate a isr */ queue_work(hsdev->workqueue, &hsdev->work); #endif #if TIMER_DEALER init_timer(&hsdev->timer); hsdev->timer.function = h2w_switch_timer_func; hsdev->timer.data = hsdev; mod_timer(&hsdev->timer, jiffies + msecs_to_jiffies(2000)); { hsdev->hp_det_ups=0; hsdev->hp_det_downs=0; hsdev->hp_det_pinstate=0; int state; int counts=80; while(counts) { NvOdmGpioGetState(hsdev->gpio, hsdev->hp_det_pin, &state); if(state){hsdev->hp_det_ups++;hsdev->hp_det_downs=0;} else {hsdev->hp_det_downs++;hsdev->hp_det_ups=0;} msleep(10); if(hsdev->hp_det_downs>=5) { hsdev->hp_det_pinstate=0; switch_set_state(&hsdev->sdev, !hsdev->hp_det_pinstate); logd("h2w_switch_timer_func headphone detect low~ \n"); break; } else if(hsdev->hp_det_ups>=5) { hsdev->hp_det_pinstate=1; switch_set_state(&hsdev->sdev, !hsdev->hp_det_pinstate); logd("h2w_switch_timer_func headphone detect high~ \n"); break; } counts--; } if(counts==0){logd("h2w_switch_timer_func headphone detect failed \n");}; hsdev->hp_det_ups=0; hsdev->hp_det_downs=0; #ifdef CONFIG_SWITCH_DOCK_H2W hsdev->dock_hp_det_ups=0; hsdev->dock_hp_det_downs=0; hsdev->dock_hp_det_pinstate=0; counts=80; while(counts) { NvOdmGpioGetState(hsdev->gpio, hsdev->dock_hp_det_pin, &state); if(state){hsdev->dock_hp_det_ups++;hsdev->dock_hp_det_downs=0;} else {hsdev->dock_hp_det_downs++;hsdev->dock_hp_det_ups=0;} msleep(10); if(hsdev->dock_hp_det_downs>=5) { hsdev->dock_hp_det_pinstate=0; switch_set_state(&hsdev->sdev, hsdev->dock_hp_det_pinstate); logd("h2w_switch_timer_func dock headphone detect low~ \n"); break; } else if(hsdev->dock_hp_det_ups>=5) { hsdev->dock_hp_det_pinstate=1; switch_set_state(&hsdev->sdev, hsdev->dock_hp_det_pinstate); logd("h2w_switch_timer_func dock headphone detect high~ \n"); break; } counts--; } if(counts==0){logd("h2w_switch_timer_func dock headphone detect failed \n");}; hsdev->dock_hp_det_ups=0; hsdev->dock_hp_det_downs=0; #endif } #endif logd("h2w_switch_probe() OUT\r\n"); return 0; #ifdef CONFIG_SWITCH_DOCK_H2W err_register_dock_hp_irq: NvOdmGpioInterruptUnregister(hsdev->gpio, hsdev->hp_det_pin, hsdev->hp_det_irq); #endif err_register_irq: destroy_workqueue(hsdev->workqueue); err_create_workqueue: switch_dev_unregister(&hsdev->sdev); err_register_sdev: #ifdef CONFIG_SWITCH_DOCK_H2W NvOdmGpioReleasePinHandle(hsdev->gpio, hsdev->dock_hp_det_pin); err_acquire_dock_det_pin: #endif NvOdmGpioReleasePinHandle(hsdev->gpio, hsdev->hp_det_pin); err_acquire_det_pin: NvOdmGpioClose(hsdev->gpio); err_open_gpio: kfree(hsdev); err_alloc_hsdev: logd("h2w_switch_probe failed\r\n"); return -1; }
static int h2w_switch_probe(struct platform_device *pdev) { struct h2w_switch_dev *hsdev; struct switch_h2w_platform_data *pdata; logd("h2w_switch_probe\n"); pdata = pdev->dev.platform_data; if (pdata == NULL) { loge("pdata=NULL\n"); return -EFAULT; } hsdev = kzalloc(sizeof(struct h2w_switch_dev), GFP_KERNEL); if (!hsdev) { loge("err_alloc_hsdev\n"); goto err_alloc_hsdev; } hsdev->have_dock_hp = pdata->have_dock_hp; hsdev->hp_det_active_low = pdata->hp_det_active_low; hsdev->gpio = NvOdmGpioOpen(); if (!hsdev->gpio) { loge("err open gpio\n"); goto err_open_gpio; } hsdev->hp_det_pin = NvOdmGpioAcquirePinHandle(hsdev->gpio, pdata->hp_det_port, pdata->hp_det_pin); if (!hsdev->hp_det_pin) { loge("err acquire detect pin handle\n"); goto err_acquire_det_pin; } NvOdmGpioConfig(hsdev->gpio, hsdev->hp_det_pin, NvOdmGpioPinMode_InputData); if (pdata->have_dock_hp) { hsdev->dock_hp_det_active_low = pdata->dock_hp_det_active_low; hsdev->dock_hp_det_pin = NvOdmGpioAcquirePinHandle(hsdev->gpio, pdata->dock_hp_det_port, pdata->dock_hp_det_pin); if (!hsdev->dock_hp_det_pin) { loge("err acquire dock headphone detect pin handle\n"); goto err_acquire_dock_det_pin; } NvOdmGpioConfig(hsdev->gpio, hsdev->dock_hp_det_pin, NvOdmGpioPinMode_InputData); } hsdev->sdev.name = H2W_SWITCH_DEV_NAME; hsdev->sdev.print_name = h2w_switch_print_name; hsdev->sdev.print_state = h2w_switch_print_state; if (switch_dev_register(&hsdev->sdev)) { loge("err register switch device\n"); goto err_register_sdev; } hsdev->workqueue = create_singlethread_workqueue("h2w_switch"); if (!hsdev->workqueue) { loge("create_singlethread_workqueue\n"); goto err_create_workqueue; } INIT_WORK(&hsdev->work, h2w_switch_work); /* Enable the interrupt at last */ if ((NvOdmGpioInterruptRegister(hsdev->gpio, &hsdev->hp_det_irq, hsdev->hp_det_pin, NvOdmGpioPinMode_InputInterruptAny, h2w_switch_irq_isr, hsdev, IRQ_DEBOUNCE) == NV_FALSE) || (hsdev->hp_det_irq == NULL)) { loge("err register irq\n"); goto err_register_irq; } /* Enable the dock hp detect interrupt */ if (hsdev->have_dock_hp) { if ((NvOdmGpioInterruptRegister(hsdev->gpio, &hsdev->dock_hp_det_irq, hsdev->dock_hp_det_pin, NvOdmGpioPinMode_InputInterruptAny, dock_h2w_switch_irq_isr, hsdev, IRQ_DEBOUNCE) == NV_FALSE) || (hsdev->dock_hp_det_irq == NULL)) { loge("err register dock hp irq\n"); goto err_register_dock_hp_irq; } } platform_set_drvdata(pdev, hsdev); /* After all we simulate a isr */ queue_work(hsdev->workqueue, &hsdev->work); logd("h2w_switch_probe success\n"); return 0; err_register_dock_hp_irq: NvOdmGpioInterruptUnregister(hsdev->gpio, hsdev->hp_det_pin, hsdev->hp_det_irq); err_register_irq: destroy_workqueue(hsdev->workqueue); err_create_workqueue: switch_dev_unregister(&hsdev->sdev); err_register_sdev: NvOdmGpioReleasePinHandle(hsdev->gpio, hsdev->dock_hp_det_pin); err_acquire_dock_det_pin: NvOdmGpioReleasePinHandle(hsdev->gpio, hsdev->hp_det_pin); err_acquire_det_pin: NvOdmGpioClose(hsdev->gpio); err_open_gpio: kfree(hsdev); err_alloc_hsdev: loge("h2w_switch_probe failed\n"); return -1; }
static int __init proximity_probe(struct platform_device *pdev) { int i, ret = 0; NvU32 I2cInstance = 0; const NvOdmPeripheralConnectivity *pConnectivity = NULL; NvU32 port = 0, pin = 0; struct device *dev = &pdev->dev; unsigned int pinvalue; atomic_set(&proxi_status, 1); pConnectivity = NvOdmPeripheralGetGuid(PROXIMITY_GUID); for (i = 0; i < pConnectivity->NumAddress; i++) { switch (pConnectivity->AddressList[i].Interface) { case NvOdmIoModule_I2c: s_proximity.i2c_address = (pConnectivity->AddressList[i].Address << 1); I2cInstance = pConnectivity->AddressList[i].Instance; break; case NvOdmIoModule_Gpio: port = pConnectivity->AddressList[i].Instance; pin = pConnectivity->AddressList[i].Address; break; case NvOdmIoModule_Vdd: s_proximity.vddId = pConnectivity->AddressList[i].Address; break; default: break; } } s_proximity.MVO = 0; #if defined(CONFIG_MACH_STAR_MDM_C) port = 'r' - 'a';//'a' - 'a'; pin = 2;//0; #elif defined (CONFIG_MACH_STAR_REV_F) || defined (CONFIG_MACH_STAR_TMUS) port = 'w'-'a'; pin = 2; #else #error PROXI_OUT PIN not assigned #endif lprintk(D_PROXI, "[star Proximity] start!!!--------------------------------------------------------------------------\n"); s_proximity.proxi_out_gpio = NvOdmGpioOpen(); if (!s_proximity.proxi_out_gpio) { lprintk(D_PROXI, "[star Proximity] gpio open fail!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n"); ret = -ENOSYS; goto err_open_gpio_fail; } s_proximity.proxi_out_gpio_pin = NvOdmGpioAcquirePinHandle(s_proximity.proxi_out_gpio, port, pin); if (!s_proximity.proxi_out_gpio_pin) { lprintk(D_PROXI, "[star Proximity] gpio pin acquire fail!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n"); ret = -ENOSYS; goto err_open_gpio_pin_acquire_fail; } // NvOdmGpioSetState(s_proximity.proxi_out_gpio, s_proximity.proxi_out_gpio_pin, 0x1); // NvOdmGpioConfig(s_proximity.proxi_out_gpio, s_proximity.proxi_out_gpio_pin, NvOdmGpioPinMode_InputData); #if 1 INIT_WORK(&s_proximity.work, star_proxi_workqueue_func); s_proximity.gen2_i2c = NvOdmI2cPinMuxOpen(NvOdmIoModule_I2c, 1, NvOdmI2cPinMap_Config2); if (!s_proximity.gen2_i2c) { lprintk(D_PROXI, "[star Proximity] i2c open fail!\n"); ret = -ENOSYS; goto err_open_i2c_handle_fail; } s_proximity.use_int_mode = true; #if 0 NvOdmGpioConfig(s_proximity.proxi_out_gpio, s_proximity.proxi_out_gpio_pin, NvOdmGpioPinMode_Output); NvOdmGpioSetState(s_proximity.proxi_out_gpio, s_proximity.proxi_out_gpio_pin, 0x1); NvOdmOsWaitUS(100000);//100ms NvOdmGpioGetState(s_proximity.proxi_out_gpio, s_proximity.proxi_out_gpio_pin, &pinvalue); printk("interrupt pin level = %d\n----------------", pinvalue ); NvOdmGpioSetState(s_proximity.proxi_out_gpio, s_proximity.proxi_out_gpio_pin, 0x0); NvOdmOsWaitUS(100000);//100ms NvOdmGpioGetState(s_proximity.proxi_out_gpio, s_proximity.proxi_out_gpio_pin, &pinvalue); printk("interrupt pin level = %d\n----------------", pinvalue ); NvOdmGpioSetState(s_proximity.proxi_out_gpio, s_proximity.proxi_out_gpio_pin, 0x1); NvOdmOsWaitUS(100000);//100ms NvOdmGpioGetState(s_proximity.proxi_out_gpio, s_proximity.proxi_out_gpio_pin, &pinvalue); printk("interrupt pin level = %d\n----------------", pinvalue ); NvOdmGpioSetState(s_proximity.proxi_out_gpio, s_proximity.proxi_out_gpio_pin, 0x0); NvOdmOsWaitUS(100000);//100ms NvOdmGpioGetState(s_proximity.proxi_out_gpio, s_proximity.proxi_out_gpio_pin, &pinvalue); printk("interrupt pin level = %d\n----------------", pinvalue ); NvOdmGpioSetState(s_proximity.proxi_out_gpio, s_proximity.proxi_out_gpio_pin, 0x1); NvOdmOsWaitUS(100000);//100ms NvOdmGpioGetState(s_proximity.proxi_out_gpio, s_proximity.proxi_out_gpio_pin, &pinvalue); printk("interrupt pin level = %d\n----------------", pinvalue ); #endif #if 0 while(1) { NvOdmGpioSetState(s_proximity.proxi_out_gpio, s_proximity.proxi_out_gpio_pin, 0x1); NvOdmOsWaitUS(100000);//100ms NvOdmGpioSetState(s_proximity.proxi_out_gpio, s_proximity.proxi_out_gpio_pin, 0x0); NvOdmOsWaitUS(100000);//100ms } #endif NvOdmGpioConfig(s_proximity.proxi_out_gpio, s_proximity.proxi_out_gpio_pin, NvOdmGpioPinMode_InputData); if (s_proximity.use_int_mode == true) { if (NvOdmGpioInterruptRegister(s_proximity.proxi_out_gpio, &s_proximity.proxi_out_intr, s_proximity.proxi_out_gpio_pin, NvOdmGpioPinMode_InputInterruptLow, star_proxi_interrupt_handler, (void*)&s_proximity, 0) == NV_FALSE) { lprintk(D_PROXI, "[star Proximity] interrupt register fail!\n"); ret = -ENOSYS; goto err_open_irq_handle_fail; } } else { if (NvOdmGpioInterruptRegister(s_proximity.proxi_out_gpio, &s_proximity.proxi_out_intr, s_proximity.proxi_out_gpio_pin, NvOdmGpioPinMode_InputInterruptFallingEdge, star_proxi_sleep_handler, (void*)&s_proximity, 0) == NV_FALSE) { lprintk(D_PROXI, "[star Proximity] interrupt register fail!\n"); ret = -ENOSYS; goto err_open_irq_handle_fail; } hrtimer_init(&s_proximity.timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL); s_proximity.timer.function = star_proxi_timer_func; s_proximity.delay = PROXI_DEFAULT_DELAY_NS; } NvOdmGpioInterruptMask(s_proximity.proxi_out_intr, NV_TRUE); s_proximity.input_dev = input_allocate_device(); if (!s_proximity.input_dev) { lprintk(D_PROXI, "[star Proximity] input device alloc fail!\n"); ret = -ENOMEM; goto err_alloc_input_device_fail; } set_bit(EV_KEY, s_proximity.input_dev->evbit); set_bit(KEY_POWER, s_proximity.input_dev->keybit); set_bit(EV_ABS, s_proximity.input_dev->evbit); input_set_abs_params(s_proximity.input_dev, ABS_DISTANCE, 0, 1, 0, 0); s_proximity.input_dev->name = "proximity"; ret = input_register_device(s_proximity.input_dev); if (ret) { lprintk(D_PROXI, "[star Proximity] input device register fail!\n"); ret = -ENOMEM; goto err_alloc_input_device_fail; } if ((ret = sysfs_create_group(&dev->kobj, &star_proxi_group))) { lprintk(D_PROXI, "[star Proximity] sysfs_create_group fail!\n"); ret = -ENOMEM; goto err_sysfs_group_fail; } // star_proxi_power_onoff(&s_proximity, true); return 0; err_sysfs_group_fail: input_unregister_device(s_proximity.input_dev); err_alloc_input_device_fail: NvOdmGpioInterruptUnregister(s_proximity.proxi_out_gpio, s_proximity.proxi_out_gpio_pin, s_proximity.proxi_out_intr); err_open_irq_handle_fail: NvOdmI2cClose(s_proximity.gen2_i2c); err_open_i2c_handle_fail: NvOdmGpioReleasePinHandle(s_proximity.proxi_out_gpio, s_proximity.proxi_out_gpio_pin); err_open_gpio_pin_acquire_fail: NvOdmGpioClose(s_proximity.proxi_out_gpio); err_open_gpio_fail: return ret; #endif }