int mdm_reset(void) { unsigned int pin_val = 0; NvOdmServicesGpioHandle h_gpio; NvOdmGpioPinHandle h_gpiopin; NvOdmGpioPinHandle h_uart1_rtspin; printk("%s \n", __func__); h_gpio = NvOdmGpioOpen(); if (!h_gpio) { printk("%s: NvOdmGpioOpen Error\n", __func__); goto error_open_gpio_fail; } h_gpiopin = NvOdmGpioAcquirePinHandle(h_gpio, 'v' - 'a', 0); if (!h_gpiopin) { printk("%s: Couldn't NvOdmGpioAcquirePinHandle pin\n", __func__); goto error_open_gpio_pin_acquire_fail; } h_uart1_rtspin = NvOdmGpioAcquirePinHandle(h_gpio, 'o' - 'a', 3); if (!h_uart1_rtspin) { printk("%s: Couldn't NvOdmGpioAcquirePinHandle pin\n", __func__); goto error_open_gpio_pin_acquire_fail; } NvOdmGpioSetState( h_gpio, h_uart1_rtspin, 0x1); NvOdmGpioConfig( h_gpio, h_uart1_rtspin, NvOdmGpioPinMode_Output); NvOdmGpioGetState( h_gpio, h_uart1_rtspin, &pin_val); printk("ifx_reset_high - [CP RTS]: pin %d\n", pin_val); //reset Communication Processor (GPIO_PV0: high -> 1000ms -> low -> 3000ms -> high) NvOdmGpioSetState( h_gpio, h_gpiopin, 0x1); NvOdmGpioConfig( h_gpio, h_gpiopin, NvOdmGpioPinMode_Output); msleep(1000); NvOdmGpioSetState( h_gpio, h_gpiopin, 0x0); msleep(3000); NvOdmGpioSetState( h_gpio, h_gpiopin, 0x1); NvOdmGpioGetState( h_gpio, h_gpiopin, &pin_val); printk("ifx_reset_high - [CP RESET]: pin %d\n", pin_val); NvOdmGpioReleasePinHandle(h_gpio, h_uart1_rtspin); NvOdmGpioReleasePinHandle(h_gpio, h_gpiopin); NvOdmGpioClose(h_gpio); return 0; error_open_gpio_pin_acquire_fail: NvOdmGpioClose(h_gpio); error_open_gpio_fail: return -ENOSYS; }
int mdm_rts_low(void) { unsigned int pin_val = 0; NvOdmServicesGpioHandle h_gpio; NvOdmGpioPinHandle h_uart1_rtspin; printk("%s \n", __func__); h_gpio = NvOdmGpioOpen(); if (!h_gpio) { printk("%s: NvOdmGpioOpen Error\n", __func__); goto error_open_gpio_fail; } h_uart1_rtspin = NvOdmGpioAcquirePinHandle(h_gpio, 'o' - 'a', 3); if (!h_uart1_rtspin) { printk("%s: Couldn't NvOdmGpioAcquirePinHandle pin\n", __func__); goto error_open_gpio_pin_acquire_fail; } NvOdmGpioSetState( h_gpio, h_uart1_rtspin, 0x1); NvOdmGpioConfig( h_gpio, h_uart1_rtspin, NvOdmGpioPinMode_Output); NvOdmGpioGetState( h_gpio, h_uart1_rtspin, &pin_val); printk("ifx_reset_high - [CP RTS]: pin %d\n", pin_val); NvOdmGpioReleasePinHandle(h_gpio, h_uart1_rtspin); NvOdmGpioClose(h_gpio); return 0; error_open_gpio_pin_acquire_fail: NvOdmGpioClose(h_gpio); error_open_gpio_fail: return -ENOSYS; }
NvOdmUsbUlpiHandle NvOdmUsbUlpiOpen(NvU32 Instance) { NvOdmUsbUlpi*pDevice = NULL; NvU32 ClockInstances[MAX_CLOCKS]; NvU32 ClockFrequencies[MAX_CLOCKS]; NvU32 NumClocks; pDevice = NvOdmOsAlloc(sizeof(NvOdmUsbUlpi)); if(pDevice == NULL) return NULL; if(!NvOdmExternalClockConfig(SMSC3317GUID, NV_FALSE, ClockInstances, ClockFrequencies, &NumClocks)) { NV_DRIVER_TRACE (("ERROR NvOdmUsbUlpiOpen: " "NvOdmExternalClockConfig fail\n")); goto ExitUlpiOdm; } NvOdmOsSleepMS(10); if (!s_hGpio) s_hGpio = NvOdmGpioOpen(); if (!s_hGpio) { NV_DRIVER_TRACE (("ERROR NvOdmUsbUlpiOpen: " "Not able to open gpio handle\n")); goto ExitUlpiOdm; } if (!s_hResetPin) s_hResetPin = NvOdmGpioAcquirePinHandle(s_hGpio, ULPI_RESET_PORT, ULPI_RESET_PIN); if (!s_hResetPin) { NvOdmGpioClose(s_hGpio); s_hGpio = NULL; NV_DRIVER_TRACE (("ERROR NvOdmGpioAcquirePinHandle: " "Not able to Acq pinhandle\n")); goto ExitUlpiOdm; } // Pull high on RESETB ( 22nd pin of smsc3315) // config as out put pin NvOdmGpioConfig(s_hGpio,s_hResetPin, NvOdmGpioPinMode_Output); // Set low to write high on ULPI_RESETB pin NvOdmGpioSetState(s_hGpio, s_hResetPin, 0x01); NvOdmGpioSetState(s_hGpio, s_hResetPin, 0x0); NvOdmOsSleepMS(5); NvOdmGpioSetState(s_hGpio, s_hResetPin, 0x01); pDevice->CurrentGUID = SMSC3317GUID; return pDevice; ExitUlpiOdm: NvOdmOsFree(pDevice); return NULL; }
static int MUIC_Gpio_i2c_init(Muic_Device *s_hMuicHandle) { if(!s_hMuicHandle->hGpio) { return -1; } s_hMuicHandle->hSdaGpioPinHandle = NvOdmGpioAcquirePinHandle(s_hMuicHandle->hGpio, MUIC_SDA_PORT, MUIC_SDA_PIN); s_hMuicHandle->hSclGpioPinHandle = NvOdmGpioAcquirePinHandle(s_hMuicHandle->hGpio, MUIC_SCL_PORT, MUIC_SCL_PIN); g_hdelay = HALF_DELAY; g_fdelay = FULL_DELAY; I2C_SDA_HI; I2C_SCL_HI; I2C_SDA_DIR(DIR_OUT); I2C_SCL_DIR(DIR_OUT); return NV_TRUE; }
//101106, [email protected], FOTA update [START] int fota_ebl_download(void) { static NvOdmServicesGpioHandle hCprom = NULL; static NvOdmGpioPinHandle hIFX_Reset = NULL; int ret; if(hCprom == NULL) { hCprom = NvOdmGpioOpen(); if (!hCprom) { lprintk(D_MUIC, "%s: NvOdmGpioOpen Error \n", __func__); goto error_open_gpio_fail; } } if(hIFX_Reset == NULL) { hIFX_Reset = NvOdmGpioAcquirePinHandle(hCprom, 'v' - 'a', 0); if (!hIFX_Reset) { lprintk(D_MUIC, "%s: Couldn't NvOdmGpioAcquirePinHandle pin \n", __func__); goto error_open_gpio_pin_acquire_fail; } } NvOdmGpioConfig(hCprom, hIFX_Reset, NvOdmGpioPinMode_Output); #if defined(CONFIG_MACH_STAR_REV_D) || defined(CONFIG_MACH_STAR_REV_E) NvOdmGpioSetState(s_hMuicHandle.hGpio, s_hMuicHandle.h_USB_VBUS_EN, DISABLE); #endif NvOdmGpioSetState(s_hMuicHandle.hGpio, s_hMuicHandle.h_AP20_UART_SW, 0x0); NvOdmGpioSetState(s_hMuicHandle.hGpio, s_hMuicHandle.h_IFX_UART_SW, 0x0); //change USB path from AP to CP //Set_MAX14526_CP_USB_Mode(); NvOdmOsSleepMS(5000); //change TEST_GPIO state from low to high (GPIO_PV0) NvOdmGpioSetState(hCprom, hIFX_Reset, 0); NvOdmGpioGetState(hCprom, hIFX_Reset, &ret); lprintk(D_MUIC, "%s: hIFX_Reset is %d \n", __func__, ret); NvOdmOsSleepMS(10); NvOdmGpioSetState(hCprom, hIFX_Reset, 1); NvOdmGpioGetState(hCprom, hIFX_Reset, &ret); lprintk(D_MUIC, "%s: hIFX_Reset is %d \n", __func__, ret); return 0; error_open_gpio_pin_acquire_fail: NvOdmGpioClose(hCprom); error_open_gpio_fail: return -ENOSYS; }
static int Msensor_probe(struct platform_device *pdev) { int ret = 0; //printk("==============>Msensor_probe\r\n"); if( !s_hGpio ) s_hGpio = NvOdmGpioOpen(); if( !s_hResetGpioPin ) s_hResetGpioPin = NvOdmGpioAcquirePinHandle(s_hGpio,'x'-'a',1); ms3c_ControlStatus(STATUS_ACTIVE); return ret; }
void ifx_power_low(void) { unsigned int pin_val = 0; NvOdmServicesGpioHandle h_gpio; NvOdmGpioPinHandle h_gpiopin; printk("%s LOW\n", __func__); h_gpio = NvOdmGpioOpen(); h_gpiopin = NvOdmGpioAcquirePinHandle(h_gpio, 'v' - 'a', 1); NvOdmGpioConfig( h_gpio, h_gpiopin, NvOdmGpioPinMode_Output); NvOdmGpioSetState( h_gpio, h_gpiopin, 0x0); NvOdmGpioGetState( h_gpio, h_gpiopin, &pin_val); printk("ifx_power_low - [CP POWER]: pin %d\n", pin_val); NvOdmGpioReleasePinHandle(h_gpio, h_gpiopin); NvOdmGpioClose(h_gpio); }
void ifx_reset_high(void) { unsigned int pin_val = 0; NvOdmServicesGpioHandle h_gpio; NvOdmGpioPinHandle h_gpiopin; printk("%s HIGH\n", __func__); h_gpio = NvOdmGpioOpen(); h_gpiopin = NvOdmGpioAcquirePinHandle(h_gpio, 'v' - 'a', 0); NvOdmGpioConfig( h_gpio, h_gpiopin, NvOdmGpioPinMode_Output); NvOdmGpioSetState( h_gpio, h_gpiopin, 0x1); NvOdmGpioGetState( h_gpio, h_gpiopin, &pin_val); printk("ifx_reset_high - [CP RESET]: pin %d\n", pin_val); NvOdmGpioReleasePinHandle(h_gpio, h_gpiopin); NvOdmGpioClose(h_gpio); }
NvBool NvOdmVibStart(NvOdmVibDeviceHandle hDevice) { NvOdmPeripheralConnectivity const *conn; NvU64 guid; /* get the main panel */ guid = VIBRATOR_GUID; /* get the connectivity info */ conn = NvOdmPeripheralGetGuid(guid); if(conn == NULL) { return NV_FALSE; } /* acquire GPIO pins */ ghGpio = NvOdmGpioOpen(); if (ghGpio == NULL) { return NV_FALSE; } if (ghVibGpioPin == NULL) { /* Search for the GPIO pin */ if (conn->AddressList[0].Interface == NvOdmIoModule_Gpio) { ghVibGpioPin = NvOdmGpioAcquirePinHandle(ghGpio, conn->AddressList[0].Instance, conn->AddressList[0].Address); } } if (ghVibGpioPin == NULL) { return NV_FALSE; } NvOdmGpioSetState(ghGpio, ghVibGpioPin, 0x1); NvOdmGpioConfig(ghGpio, ghVibGpioPin, NvOdmGpioPinMode_Output); VIBE_TPS658620_I2cWrite8(TPS658620_PWM1_ADDR, hDevice->CurrentIndex); return NV_TRUE; }
/* * Connect semaphore with interrupt pins according to your configuration. */ NvBool NvAccelerometerConnectSemaphore(NvOdmAccelHandle hDevice) { NvOdmGpioPinMode mode; NvOdmInterruptHandler callback = (NvOdmInterruptHandler)GpioInterruptHandler; hDevice->hGpioINT = (NvOdmServicesGpioHandle)NvOdmGpioOpen(); if(!(hDevice->hGpioINT)) { //NVODMACCELEROMETER_PRINTF("NvOdm Accelerometer : NvOdmGpioOpen Error \n"); return NV_FALSE; } hDevice->hPinINT = NvOdmGpioAcquirePinHandle(hDevice->hGpioINT, hDevice->GPIOPortINT, hDevice->GPIOPinINT); hDevice->SemaphoreForINT = NvOdmOsSemaphoreCreate(0); if(!(hDevice->SemaphoreForINT)) { //NVODMACCELEROMETER_PRINTF("NvOdm Accelerometer : NvOdmOsSemaphoreCreate Error \n"); NvOdmGpioClose(hDevice->hGpioINT); return NV_FALSE; } mode = NvOdmGpioPinMode_InputInterruptHigh; if (NvOdmGpioInterruptRegister(hDevice->hGpioINT, &hDevice->hGpioInterrupt, hDevice->hPinINT, mode, callback, hDevice, NV_DEBOUNCE_TIME_MS) == NV_FALSE) { return NV_FALSE; } if(!(hDevice->hGpioInterrupt)) { //NVODMACCELEROMETER_PRINTF("NvOdm Accelerometer : NvOdmGpioInterruptRegister Error \n"); NvOdmGpioClose(hDevice->hGpioINT); NvOdmOsSemaphoreDestroy(hDevice->SemaphoreForINT); return NV_FALSE; } return NV_TRUE; }
static NvBool ConnectSemaphore(NvOdmEcompassHandle hDevice) { NvOdmGpioPinMode mode; NvOdmInterruptHandler callback = (NvOdmInterruptHandler)GpioInterruptHandler; hDevice->hGpioINT = (NvOdmServicesGpioHandle)NvOdmGpioOpen(); if (!(hDevice->hGpioINT)) { NVODMECOMPASS_PRINTF(("AKM8975 compass driver: NvOdmGpioOpenError \n")); return NV_FALSE; } hDevice->hPinINT = NvOdmGpioAcquirePinHandle(hDevice->hGpioINT, hDevice->GPIOPortINT, hDevice->GPIOPinINT); hDevice->SemaphoreForINT = NvOdmOsSemaphoreCreate(0); if (!(hDevice->SemaphoreForINT)) { NVODMECOMPASS_PRINTF(( "AKM8975 compass driver: NvOdmOsSemaphoreCreate Error \n")); NvOdmGpioClose(hDevice->hGpioINT); return NV_FALSE; } mode = NvOdmGpioPinMode_InputInterruptHigh; if (NvOdmGpioInterruptRegister(hDevice->hGpioINT, &hDevice->hGpioInterrupt, hDevice->hPinINT, mode, callback, hDevice, NV_DEBOUNCE_TIME_MS) == NV_FALSE) { return NV_FALSE; } if (!(hDevice->hGpioInterrupt)) { NVODMECOMPASS_PRINTF(("AKM8975 compass driver: NvOdm Ecompass NvOdmGpioInterruptRegister Error \n")); NvOdmGpioClose(hDevice->hGpioINT); NvOdmOsSemaphoreDestroy(hDevice->SemaphoreForINT); return NV_FALSE; } return NV_TRUE; }
NvBool NvGyroAccelConnectSemaphore(NvOdmGyroAccelHandle hDevice) { NvOdmGpioPinMode mode; NvOdmInterruptHandler callback = (NvOdmInterruptHandler)GpioInterruptHandler; printk(" ## MPU3050 : NvGyroAccelConnectSemaphore \n") ; hDevice->hGpioINT = (NvOdmServicesGpioHandle)NvOdmGpioOpen(); if (!(hDevice->hGpioINT)) { printk("## NvOdm GyroAccel : NvOdmGpioOpen Error ## \n"); return NV_FALSE; } hDevice->hPinINT = NvOdmGpioAcquirePinHandle(hDevice->hGpioINT, hDevice->GPIOPortINT, hDevice->GPIOPinINT); hDevice->SemaphoreForINT = NvOdmOsSemaphoreCreate(0); if (!(hDevice->SemaphoreForINT)) { printk("## NvOdm GyroAccel : NvOdmOsSemaphoreCreate Error ## \n"); NvOdmGpioClose(hDevice->hGpioINT); return NV_FALSE; } mode = NvOdmGpioPinMode_InputInterruptHigh; if (NvOdmGpioInterruptRegister(hDevice->hGpioINT, &hDevice->hGpioInterrupt, hDevice->hPinINT, mode, callback, hDevice, NV_DEBOUNCE_TIME_MS) == NV_FALSE) { printk("NvOdm GyroAccel : cannot register interrupt.\n") ; return NV_FALSE; } if (!(hDevice->hGpioInterrupt)) { NvOdmGpioClose(hDevice->hGpioINT); NvOdmOsSemaphoreDestroy(hDevice->SemaphoreForINT); return NV_FALSE; } return NV_TRUE; }
NvOdmUsbUlpiHandle NvOdmUsbUlpiOpen(NvU32 Instance) { NvOdmUsbUlpi *pDevice = NULL; NvU32 ClockInstances[MAX_CLOCKS]; NvU32 ClockFrequencies[MAX_CLOCKS]; NvU32 NumClocks; NvOdmServicesGpioHandle hGpio; NvOdmGpioPinHandle hResetPin; NvU32 Port = NVODM_PORT('v'); NvU32 Pin = 1; pDevice = NvOdmOsAlloc(sizeof(NvOdmUsbUlpi)); if (pDevice == NULL) return NULL; if(!NvOdmExternalClockConfig(SMSC3317GUID, NV_FALSE, ClockInstances, ClockFrequencies, &NumClocks)) { NvOdmOsDebugPrintf("NvOdmUsbUlpiOpen: NvOdmExternalClockConfig fail\n"); goto ExitUlpiOdm; } NvOdmOsSleepMS(10); // Pull high on RESETB ( 22nd pin of smsc3315) hGpio = NvOdmGpioOpen(); hResetPin = NvOdmGpioAcquirePinHandle(hGpio, Port, Pin); // config as out put pin NvOdmGpioConfig(hGpio,hResetPin, NvOdmGpioPinMode_Output); // Set low to write high on ULPI_RESETB pin NvOdmGpioSetState(hGpio, hResetPin, 0x01); NvOdmGpioSetState(hGpio, hResetPin, 0x0); NvOdmOsSleepMS(5); NvOdmGpioSetState(hGpio, hResetPin, 0x01); pDevice->CurrentGUID = SMSC3317GUID; return pDevice; ExitUlpiOdm: NvOdmOsFree(pDevice); return NULL; }
void ms3c_ControlStatus(int status) { if( !s_hGpio ) s_hGpio = NvOdmGpioOpen(); if( s_hGpio ) { //GPIO_PX1 if( !s_hResetGpioPin ) s_hResetGpioPin = NvOdmGpioAcquirePinHandle(s_hGpio,'x'-'a',1); if( s_hResetGpioPin ) { //active reset if( status == STATUS_ACTIVE) { printk("==============>Msensor_ACTIVE\r\n"); NvOdmGpioSetState(s_hGpio, s_hResetGpioPin, 0x1); NvOdmGpioConfig( s_hGpio, s_hResetGpioPin, NvOdmGpioPinMode_Output); } else if( status == STATUS_RESET) // reset { NvOdmGpioSetState(s_hGpio, s_hResetGpioPin, 0x0); NvOdmGpioConfig( s_hGpio, s_hResetGpioPin, NvOdmGpioPinMode_Output); } else { printk("==============>Msensor_SUSPEND\r\n"); NvOdmGpioSetState(s_hGpio, s_hResetGpioPin, 0x0); NvOdmGpioConfig(s_hGpio, s_hResetGpioPin, NvOdmGpioPinMode_Tristate); } } } }
static int cpcap_usb_connected_probe(struct platform_device *pdev) { struct cpcap_usb_connected_data *data; struct cpcap_accy_platform_data *pdata = pdev->dev.platform_data; data = kzalloc(sizeof(*data), GFP_KERNEL); if(!data) return -ENOMEM; data->accy = pdata->accy; /* Configure CPCAP-AP20 USB Mux to AP20 */ data->port = NVODM_PORT('v'); data->pin = 6; data->h_gpio = NvOdmGpioOpen(); data->h_pin = NvOdmGpioAcquirePinHandle(data->h_gpio, data->port, data->pin); NvOdmGpioConfig(data->h_gpio, data->h_pin, NvOdmGpioPinMode_Output); NvOdmGpioSetState(data->h_gpio, data->h_pin, 0x1); platform_set_drvdata(pdev, data); /* when the phone is the host do not start the gadget driver */ if((data->accy == CPCAP_ACCY_USB) || (data->accy == CPCAP_ACCY_FACTORY)) { #ifdef CONFIG_USB_TEGRA_OTG tegra_otg_set_mode(0); #endif android_usb_set_connected(1, data->accy); } if(data->accy == CPCAP_ACCY_USB_DEVICE) { #ifdef CONFIG_USB_TEGRA_OTG tegra_otg_set_mode(1); #endif } mdm_ctrl_set_usb_ipc(true); return 0; }
/** * @brief Allocates a handle to the device. Configures the PWM * control to the Vibro motor with default values. To change * the amplitude and frequency use NvOdmVibrateSetParameter API. * @param hOdmVibrate [IN] Opaque handle to the device. * @return NV_TRUE on success and NV_FALSE on error */ NvBool NvOdmVibOpen(NvOdmVibDeviceHandle *hOdmVibrate) { const NvOdmPeripheralConnectivity *pConnectivity = NULL; NvU32 Index = 0; NV_ASSERT(hOdmVibrate); /* Allocate the handle */ (*hOdmVibrate) = (NvOdmVibDeviceHandle)NvOdmOsAlloc(sizeof(NvOdmVibDevice)); if (*hOdmVibrate == NULL) { NV_ODM_TRACE(("Error Allocating NvOdmPmuDevice. \n")); return NV_FALSE; } NvOsMemset((*hOdmVibrate), 0, sizeof(NvOdmVibDevice)); #if (defined(CONFIG_7546Y_V10)) /*HZJ ADD FOR VIBRATE*/ (*hOdmVibrate)->vibrate_gpio= NvOdmGpioOpen(); if (!(*hOdmVibrate)->vibrate_gpio) { NV_ODM_TRACE("err open gpio vibrate hzj added\r\n"); kfree(*hOdmVibrate); return -1; } (*hOdmVibrate)->vibrate_pin = NvOdmGpioAcquirePinHandle((*hOdmVibrate)->vibrate_gpio, VIBRATE_DET_ENABLE_PORT, VIBRATE_DET_ENABLE_PIN); if (!(*hOdmVibrate)->vibrate_pin) { NV_ODM_TRACE("err acquire detect pin handle vibrate\r\n"); NvOdmGpioClose((*hOdmVibrate)->vibrate_gpio); return -1; } NvOdmGpioConfig((*hOdmVibrate)->vibrate_gpio, (*hOdmVibrate)->vibrate_pin, NvOdmGpioPinMode_Output); /*End Hzj aded*/ (*hOdmVibrate)->vibrate_segpio= NvOdmGpioOpen(); if (!(*hOdmVibrate)->vibrate_segpio) { NV_ODM_TRACE("err open gpio vibrate hzj added\r\n"); kfree(*hOdmVibrate); return -1; } (*hOdmVibrate)->vibrate_sepin = NvOdmGpioAcquirePinHandle((*hOdmVibrate)->vibrate_segpio, VIBRATE_SE_PORT, VIBRATE_SE_PIN); if (!(*hOdmVibrate)->vibrate_sepin) { NV_ODM_TRACE("err acquire detect pin handle vibrate\r\n"); NvOdmGpioClose((*hOdmVibrate)->vibrate_segpio); return -1; } NvOdmGpioConfig((*hOdmVibrate)->vibrate_segpio, (*hOdmVibrate)->vibrate_sepin, NvOdmGpioPinMode_Output); #endif /* Get the PMU handle */ (*hOdmVibrate)->hOdmServicePmuDevice = NvOdmServicesPmuOpen(); if (!(*hOdmVibrate)->hOdmServicePmuDevice) { NV_ODM_TRACE(("Error Opening Pmu device. \n")); NvOdmOsFree(*hOdmVibrate); *hOdmVibrate = NULL; return NV_FALSE; } // Get the peripheral connectivity information pConnectivity = NvOdmPeripheralGetGuid(VIBRATE_DEVICE_GUID); if (pConnectivity == NULL) return NV_FALSE; // Search for the Vdd rail and set the proper volage to the rail. for (Index = 0; Index < pConnectivity->NumAddress; ++Index) { if (pConnectivity->AddressList[Index].Interface == NvOdmIoModule_Vdd) { (*hOdmVibrate)->VddId = pConnectivity->AddressList[Index].Address; NvOdmServicesPmuGetCapabilities((*hOdmVibrate)->hOdmServicePmuDevice, (*hOdmVibrate)->VddId, &((*hOdmVibrate)->RailCaps)); break; } } return NV_TRUE; }
static int __init star_hall_probe( struct platform_device *pdev ) { int err = 0; struct device *dev = &pdev->dev; atomic_set( &sensing_hall, 1 ); printk("\n================================================================\n"); printk("[HALL:%s] probing hall ic driver\n", __func__); printk("================================================================\n"); g_hall = kzalloc( sizeof(*g_hall), GFP_KERNEL ); if(g_hall == NULL) { err = -1; printk("[HALL:%s] Fail to alloc the memory for HALL IC\n",__func__); goto error; } /*g_hall->h_hall_pmu = NvOdmServicesPmuOpen(); if(!g_hall->h_hall_pmu) { err = -1; printk("[HALL:%s] Fail to Open the pmu!\n", __func__); goto error; }*/ if (star_hall_set_power_rail(12, NV_TRUE) != 0) { err = -1; goto error; } g_hall->h_hall_gpio = NvOdmGpioOpen(); if(!g_hall->h_hall_gpio) { printk("[HALL:%s] Fail to open gpio\n", __func__); err = -1; goto error; } g_hall->is_int_mode = true; g_hall->hall_intr_port = 'u' - 'a'; g_hall->hall_intr_pin = 5; g_hall->h_hall_gpio_pin = NvOdmGpioAcquirePinHandle(g_hall->h_hall_gpio, g_hall->hall_intr_port, g_hall->hall_intr_pin ); if( !g_hall->h_hall_gpio_pin ) { printk("[HALL:%s] Fail to acquire pin handle!\n", __func__); err = -1; goto error; } NvOdmGpioConfig(g_hall->h_hall_gpio, g_hall->h_hall_gpio_pin, NvOdmGpioPinMode_InputData); // NvOdmGpioConfig( g_hall->h_hall_gpio, g_hall->hall_intr_port, NvOdmGpioPinMode_InputData ); if( !g_hall->is_int_mode ){ //for polling mode INIT_DELAYED_WORK(&g_hall->delayed_work_hall, star_hall_work_func); schedule_delayed_work(&g_hall->delayed_work_hall, 100 ); } else{ //int mode #if 0 if(NvOdmGpioInterruptRegister(g_hall->h_hall_gpio, &g_hall->h_hall_intr, g_hall->h_hall_gpio_pin, NvOdmGpioPinMode_InputInterruptFallingEdge, star_hall_intr_handler, (void*)g_hall, 0 ) == NV_FALSE ){ printk("[HALL:%s] Fail to register hall's interrupt\n", __func__ ); goto err_irq_request; } #endif if (NvOdmGpioInterruptRegister(g_hall->h_hall_gpio, &(g_hall->h_hall_intr), g_hall->h_hall_gpio_pin, NvOdmGpioPinMode_InputInterruptAny, /*NvOdmGpioPinMode_InputInterruptFallingEdge,*/ star_hall_intr_handler, (void*)&g_hall, 0) == NV_FALSE){ printk("[HALL:%s] Fail to register hall's interrupt\n", __func__ ); goto err_irq_request; } } g_hall->input_device = input_allocate_device(); if(!g_hall->input_device){ printk("Error to allocate the input device of HALL IC\n"); err = -ENOMEM; goto err_irq_request; } set_bit(EV_KEY, g_hall->input_device->evbit); set_bit(KEY_POWER, g_hall->input_device->keybit); set_bit(EV_ABS, g_hall->input_device->evbit); input_set_abs_params(g_hall->input_device, ABS_HAT2X, 0, 1, 0, 0); g_hall->input_device->name = "hall_ic"; err = input_register_device(g_hall->input_device); if(err){ printk("error to register the input device of hall\n"); err = -ENOMEM; goto err_irq_request; } err = sysfs_create_group(&dev->kobj, &star_hall_group ); if(err){ printk("error to create sys file system\n"); err = -ENOMEM; goto err_irq_request; } g_hall->sdev.name = "dock"; switch_dev_register(&g_hall->sdev); return 0; error: return err; err_irq_request: NvOdmGpioClose(g_hall->h_hall_gpio); return err; }
static int vib_init( ) { const NvOdmPeripheralConnectivity *pcon; int err; NvBool found_gpio = NV_FALSE; int loop; g_vib = kzalloc( sizeof(*g_vib), GFP_KERNEL ); if ( g_vib == NULL ) { err = -1; printk( "[%s] fail vib\n", __func__ ); return err; } pcon = ( NvOdmPeripheralConnectivity* ) NvOdmPeripheralGetGuid( NV_ODM_GUID('v','i','b','r','a','t','o','r') ); for ( loop=0; loop< pcon->NumAddress; loop++ ) { switch ( pcon->AddressList[loop].Interface ) { case NvOdmIoModule_Gpio: g_vib->en_port = pcon->AddressList[loop].Instance; g_vib->en_pin = pcon->AddressList[loop].Address; found_gpio = NV_TRUE; break; case NvOdmIoModule_Vdd: g_vib->vdd_id = pcon->AddressList[loop].Address; DbgOut(( "VIB POWER %d\n", g_vib->vdd_id )); if ( vib_set_power_rail( g_vib->vdd_id, NV_TRUE) != 0 ) return -ENOSYS; break; default: break; } // end of switch } // end of for DbgOut(( "[ImmVibeSPI][%s] : vibrator Int Port = %c, Int Pin = %d\n", __func__, (g_vib->en_port+'a'), g_vib->en_pin )); g_vib->h_vib_gpio = NvOdmGpioOpen( ); if( ! g_vib->h_vib_gpio ) { printk( "[ImmVibeSPI][%s] : Failed to open gpio\n", __func__ ); err = - ENOSYS; return err; } #ifdef MACH_STAR_REV_A g_vib->en_port = 'u' - 'a'; g_vib->en_pin = 5; #endif #if defined ( CONFIG_MACH_STAR ) g_vib->en_port = 'u' - 'a'; g_vib->en_pin = 4; #endif g_vib->h_vib_gpio_pin = NvOdmGpioAcquirePinHandle( g_vib->h_vib_gpio, g_vib->en_port, g_vib->en_pin ); if ( ! g_vib->h_vib_gpio_pin ) { printk( "[ImmVibeSPI][%s] : Failed to acquire the pin handle\n", __func__ ); err = -ENOSYS; return err; } g_vib->hOdmPwm = NvOdmPwmOpen( ); if ( ! g_vib->hOdmPwm ) { printk( "[ImmVibeSPI][%s] : Failed to acquire the PWM handle\n", __func__ ); err = - ENOSYS; return err; } return 0; }
static int headsetdet_probe(struct platform_device *pdev) { struct gpio_switch_platform_data *pdata = pdev->dev.platform_data; struct headset_switch_data *switch_data; int ret = 0; NvS32 err = 0; struct input_dev *ip_dev; struct input_dev *ip_dev_wake; int i, j; NvU32 I2cInstance = 0; NvU32 pin[4], port[4]; const NvOdmPeripheralConnectivity *pConnectivity = NULL; pConnectivity = NvOdmPeripheralGetGuid(HEADSET_GUID); for (i = 0, j = 0 ; i < pConnectivity->NumAddress; i++) { switch (pConnectivity->AddressList[i].Interface) { case NvOdmIoModule_Gpio: port[j] = pConnectivity->AddressList[i].Instance; pin[j] = pConnectivity->AddressList[i].Address; j++; break; //20101117, [email protected], gpio wakeup from LP1 [START] case NvOdmIoModule_Vdd: { NvOdmServicesPmuVddRailCapabilities vddrailcap; headset_h_pmu = NvOdmServicesPmuOpen(); headset_vdd_address = pConnectivity->AddressList[i].Address; NvOdmServicesPmuGetCapabilities(headset_h_pmu, pConnectivity->AddressList[i].Address, &vddrailcap); headset_vdd_voltage = vddrailcap.requestMilliVolts; } break; //20101117, [email protected], gpio wakeup from LP1 [END] default: break; } } if (!pdata) return -EBUSY; switch_data = kzalloc(sizeof(struct headset_switch_data), GFP_KERNEL); if (!switch_data) return -ENOMEM; switch_data->sdev.name = pdata->name; switch_data->gpio = pdata->gpio; switch_data->name_on = pdata->name_on; switch_data->name_off = pdata->name_off; switch_data->state_on = pdata->state_on; switch_data->state_off = pdata->state_off; switch_data->sdev.print_state = switch_gpio_print_state; lprintk(D_AUDIO, KERN_ERR "##(Headset_det.c)## headsetdet_probe() => headset detection started..!!\n"); //20100421 [email protected] [LGE] ret = switch_dev_register(&switch_data->sdev); //20100421 [email protected] Headset Detection by Headset Observer [LGE] if (ret < 0) goto err_switch_dev_register; lprintk(D_AUDIO, KERN_ERR "##(Headset_det.c)## headset detection - switch device registered..!!\n"); //20100421 [email protected] [LGE] /*====================== nVidia GPIO Control(S) =======================*/ s_hHeadsetHandle.hGpio = NvOdmGpioOpen(); if (!s_hHeadsetHandle.hGpio) { lprintk(D_AUDIO, "%s: NvOdmGpioOpen Error \n", __func__); goto err_open_gpio_fail; } lprintk(D_AUDIO, KERN_ERR "##(Headset_det.c)## headset detection - NvOdmGpioOpen() success..!! : s_hHeadsetHandle.hGpio = %d, port[0] = %d, pin[0] = %d\n", s_hHeadsetHandle.hGpio, port[0], pin[0]); //20100421 [email protected] [LGE] s_hHeadsetHandle.h_Headset_Detection = NvOdmGpioAcquirePinHandle(s_hHeadsetHandle.hGpio, port[0], pin[0]); if (!s_hHeadsetHandle.h_Headset_Detection) { lprintk(D_AUDIO, "%s: Couldn't NvOdmGpioAcquirePinHandle pin \n", __func__); goto err_open_gpio_pin_acquire_fail; } lprintk(D_AUDIO, KERN_ERR "##(Headset_det.c)## headset detection - NvOdmGpioAcquirePinHandle() success..!!\n"); //20100421 [email protected] [LGE] NvOdmGpioConfig(s_hHeadsetHandle.hGpio, s_hHeadsetHandle.h_Headset_Detection, NvOdmGpioPinMode_InputData/*NvOdmGpioPinMode_InputInterruptHigh*/); lprintk(D_AUDIO, KERN_ERR "##(Headset_det.c)## headset detection - NvOdmGpioConfig() success..!! - NvOdmGpioPinMode_InputData"); //20100421 [email protected] [LGE] s_hHeadsetHandle.h_Hookkey_Detection = NvOdmGpioAcquirePinHandle(s_hHeadsetHandle.hGpio, port[1], pin[1]); if (!s_hHeadsetHandle.h_Hookkey_Detection) { lprintk(D_AUDIO, "%s:Couldn't NvOdmGpioAcquirePinHandle pin \n", __func__); goto err_open_gpio_pin_acquire_fail; } NvOdmGpioConfig(s_hHeadsetHandle.hGpio, s_hHeadsetHandle.h_Hookkey_Detection, NvOdmGpioPinMode_InputData); ip_dev = input_allocate_device(); switch_data->ip_dev = ip_dev; set_bit(EV_SYN, switch_data->ip_dev->evbit); set_bit(EV_KEY, switch_data->ip_dev->evbit); set_bit(KEY_HOOK, switch_data->ip_dev->keybit); switch_data->ip_dev->name = "star_headset_hook"; ip_dev_wake = input_allocate_device(); switch_data->ip_dev_wake = ip_dev_wake; set_bit(EV_SYN, switch_data->ip_dev_wake->evbit); set_bit(EV_KEY, switch_data->ip_dev_wake->evbit); set_bit(KEY_VOLUMEDOWN, switch_data->ip_dev_wake->keybit); switch_data->ip_dev_wake->name = "star_headset_wake"; ret = input_register_device(switch_data->ip_dev); INIT_DELAYED_WORK(&switch_data->hook_delayed_work, hook_det_work); if (NvOdmGpioInterruptRegister(s_hHeadsetHandle.hGpio, &s_hHeadsetHandle.hhookInterrupt, s_hHeadsetHandle.h_Hookkey_Detection, NvOdmGpioPinMode_InputInterruptAny, headset_hook_int_handler, switch_data, 0) == NV_FALSE) { lprintk(D_AUDIO, KERN_ERR "%s: cannot register interrupt.\n", __func__); goto err_get_interrupt_handler; } block_hook_int =1; //20101005 [email protected] Gpio MicBias[START_LGE_LAB1] #if defined(STAR_COUNTRY_KR)&& !defined(CONFIG_MACH_STAR_SKT_REV_A) s_hHeadsetHandle.h_Headset_MicBias = NvOdmGpioAcquirePinHandle(s_hHeadsetHandle.hGpio, port[2], pin[2]); if (!s_hHeadsetHandle.h_Headset_MicBias) { lprintk(D_AUDIO, "%s: Couldn't NvOdmGpioAcquirePinHandle pin \n", __func__); goto err_open_gpio_pin_acquire_fail; } lprintk(D_AUDIO, KERN_ERR "##(Headset_det.c)## headset MicBias - NvOdmGpioAcquirePinHandle() success..!!\n"); //20100421 [email protected] [LGE] NvOdmGpioConfig(s_hHeadsetHandle.hGpio, s_hHeadsetHandle.h_Headset_MicBias, NvOdmGpioPinMode_Output); lprintk(D_AUDIO, KERN_ERR "##(Headset_det.c)## headset MicBias- NvOdmGpioConfig() success..!! - NvOdmGpioPinMode_Output"); //20100421 [email protected] [LGE] #endif //20101005 [email protected] Gpio MicBias[END_LGE_LAB1] INIT_WORK(&switch_data->work, headset_det_work); INIT_DELAYED_WORK(&switch_data->delayed_work, type_det_work); lprintk(D_AUDIO, KERN_ERR "##(Headset_det.c)## headset detection - INIT_WORK() & INIT_DELAYED_WORK() success..!!\n"); //20100421 [email protected] [LGE] if (NvOdmGpioInterruptRegister(s_hHeadsetHandle.hGpio, &s_hHeadsetHandle.hheadsetInterrupt, s_hHeadsetHandle.h_Headset_Detection, NvOdmGpioPinMode_InputInterruptAny/*NvOdmGpioPinMode_InputInterruptFallingEdge*//*NvOdmGpioPinMode_InputInterruptRisingEdge*/, headset_int_handler, switch_data, 0) == NV_FALSE) { lprintk(D_AUDIO, KERN_ERR "%s: cannot register interrupt.\n", __func__); goto err_get_interrupt_handler; } lprintk(D_AUDIO, KERN_ERR "##(Headset_det.c)## headset detection - NvOdmGpioInterruptRegister() success..!!\n"); //20100421 [email protected] [LGE] //20101125, [email protected], hookkey press is skipped When wakeup from LP1 [START] //wake_lock_init(&hook_det_lock, WAKE_LOCK_SUSPEND, "hook_det_wake"); //20101125, [email protected], hookkey press is skipped When wakeup from LP1 [END] /*====================== nVidia GPIO Control(E) =======================*/ /* Perform initial detection */ headset_sw_data = switch_data; //P990_IFX_GB_PORTING_LGSI_START //FIDO - GB Porting [09/08/2011] - Start #if 1 //defined (STAR_OPERATOR_FIDO) wake_lock_init(&headset_wake_lock, WAKE_LOCK_SUSPEND, "headset_wlock"); //20110425 [email protected] headset wake lock timeout #endif //FIDO - GB Porting [09/08/2011] - End //P990_IFX_GB_PORTING_LGSI_END //headset_det_work(&switch_data->work); lprintk(D_AUDIO, KERN_ERR "##(Headset_det.c)## headset detection - headset_det_work() first detection - success..!!\n"); //20100421 [email protected] [LGE] err = device_create_file(&pdev->dev, &dev_attr_detect); err = device_create_file(&pdev->dev, &dev_attr_block_hook); err = device_create_file(&pdev->dev, &dev_attr_factory_test); return 0; err_open_gpio_fail: switch_dev_unregister(&switch_data->sdev); err_switch_dev_register: kfree(switch_data); err_open_gpio_pin_acquire_fail: NvOdmGpioClose(s_hHeadsetHandle.hGpio); err_get_interrupt_handler: NvOdmGpioReleasePinHandle(s_hHeadsetHandle.hGpio, s_hHeadsetHandle.h_Headset_Detection); NvOdmGpioReleasePinHandle(s_hHeadsetHandle.hGpio, s_hHeadsetHandle.h_Hookkey_Detection); //20100421 [email protected] for Hookkey [LGE] return ret; }
static int gps_control_probe(struct platform_device *pdev) { struct gps_control_dev *dev = &s_gps_control_dev; logd(TAG "gps_control_probe\r\n"); memset(dev, 0, sizeof(struct gps_control_dev)); dev->input_dev = input_allocate_device(); if (dev->input_dev == NULL) { goto failed; } set_bit(EV_SYN, dev->input_dev->evbit); dev->input_dev->name = "gps_control"; if (input_register_device(dev->input_dev) != 0) { goto failed_register_input; } dev->gpio_handle = NvOdmGpioOpen(); if (!dev->gpio_handle) { goto failed_open_gpio; } dev->pin_handle = NvOdmGpioAcquirePinHandle(dev->gpio_handle, GPS_ENABLE_GPIO_PORT, GPS_ENABLE_GPIO_PIN); if (!dev->pin_handle) { goto failed_acquire_pin; } NvOdmGpioConfig(dev->gpio_handle, dev->pin_handle, NvOdmGpioPinMode_Output); #ifdef CONFIG_7379Y_V11 /* * GPS and Magnetic sensor use the sampe power pin on 7379Y_V11, so we * need to open this power while booting. */ NvOdmGpioSetState(dev->gpio_handle, dev->pin_handle, 1); #else NvOdmGpioSetState(dev->gpio_handle, dev->pin_handle, 0); #endif init_MUTEX(&dev->sem); platform_set_drvdata(pdev, dev); if (device_create_file(&pdev->dev, &dev_attr_enable) != 0) { goto failed_add_sysfs; } logd(TAG "gps_control_probe success\r\n"); return 0; failed_add_sysfs: platform_set_drvdata(pdev, NULL); NvOdmGpioReleasePinHandle(dev->gpio_handle, dev->pin_handle); failed_acquire_pin: NvOdmGpioClose(dev->gpio_handle); failed_open_gpio: input_unregister_device(dev->input_dev); failed_register_input: input_free_device(dev->input_dev); failed: logd(TAG "gps_control_probe failed"); return -1; }
static int headset_switch_probe(struct platform_device *pdev) { struct gpio_switch_platform_data *pdata = pdev->dev.platform_data; struct gpio_switch_data *switch_data; int ret = 0; NvU32 states; if (!pdata) return -EBUSY; switch_data = kzalloc(sizeof(struct gpio_switch_data), GFP_KERNEL); if (!switch_data) return -ENOMEM; switch_data->sdev.name = pdata->name; switch_data->gpio = pdata->gpio; //switch_data->pin = pdata->pin; switch_data->name_on = pdata->name_on; switch_data->name_off = pdata->name_off; switch_data->state_on = pdata->state_on; switch_data->state_off = pdata->state_off; switch_data->sdev.print_state = switch_headset_print_state; ret = switch_dev_register(&switch_data->sdev); if (ret < 0) goto err_switch_dev_register; if( !s_hGpio ) { s_hGpio = NvOdmGpioOpen(); if( !s_hGpio ) { goto err_request_gpio; } } s_hHeadphoneGpioPin = NvOdmGpioAcquirePinHandle(s_hGpio, 'w'-'a', 2); //switch_data->gpio, switch_data->pin); NvOdmGpioConfig( s_hGpio, s_hHeadphoneGpioPin, NvOdmGpioPinMode_InputData); INIT_WORK(&switch_data->work, headset_switch_work); //create thread if( !g_hDetectEventSema ) g_hDetectEventSema = NvOdmOsSemaphoreCreate(0); g_DetectThread_exit = 0; if( !g_hDetectThread ) g_hDetectThread = NvOdmOsThreadCreate( (NvOdmOsThreadFunction)DetectThreadFun, (void*)switch_data); // headphone ISR if (!NvOdmGpioInterruptRegister( s_hGpio, &s_hGpioIntr_Headphone, s_hHeadphoneGpioPin, NvOdmGpioPinMode_InputInterruptLow, headset_irq_handler, (void*)switch_data, 0)) { return NV_FALSE; } //detect headphone right now 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 ); } /* Perform initial detection */ //headset_switch_work(&switch_data->work); return 0; err_request_gpio: switch_dev_unregister(&switch_data->sdev); err_switch_dev_register: kfree(switch_data); return ret; }
NvBool Adt7461Init(NvOdmTmonDeviceHandle hTmon) { NvU8 Data; NvBool ExtRange; NvU32 i = 0; NvU32 I2cInstance = 0; NvOdmIoModule I2cModule = NvOdmIoModule_Num; // Inavlid module const ADT7461RegisterInfo* pReg = NULL; ADT7461PrivData* pPrivData = NULL; NV_ASSERT(hTmon && hTmon->pConn && hTmon->pConn->AddressList); // Allocate and clear priavte data pPrivData = (ADT7461PrivData*) NvOdmOsAlloc(sizeof(ADT7461PrivData)); if (pPrivData == NULL) { NVODM_ADT7461_PRINTF(("ADT7461: Error Allocating PrivData. \n")); return NV_FALSE; } NvOdmOsMemset(pPrivData, 0, sizeof(ADT7461PrivData)); hTmon->pPrivate = pPrivData; // Register for PMU services pPrivData->hOdmPmuSevice = NvOdmServicesPmuOpen(); if (pPrivData->hOdmPmuSevice == NULL) { NVODM_ADT7461_PRINTF(("ADT7461: Error Open PMU service. \n")); goto fail; } // Register for GPIO services pPrivData->hGpio = NvOdmGpioOpen(); if (pPrivData->hOdmPmuSevice == NULL) { NVODM_ADT7461_PRINTF(("ADT7461: Error Open GPIO service. \n")); goto fail; } /* * Parse connectivity data: turn On power to the device, acquire I2C * interface and GPIO interrupt (optional); map device channels to * thermal zones */ for (i = 0; i < hTmon->pConn->NumAddress; i ++) { const NvOdmIoAddress* pIoAddress = &hTmon->pConn->AddressList[i]; if (pIoAddress->Interface == NvOdmIoModule_I2c_Pmu) { I2cModule = NvOdmIoModule_I2c_Pmu; I2cInstance = pIoAddress->Instance; NV_ASSERT(pIoAddress->Address != 0); pPrivData->DeviceI2cAddr = pIoAddress->Address; } else if (pIoAddress->Interface == NvOdmIoModule_Tsense) { NV_ASSERT(pIoAddress->Instance < NvOdmTmonZoneID_Num); NV_ASSERT(pIoAddress->Address < ADT7461ChannelID_Num); pPrivData->ConnectivityMap[pIoAddress->Instance] = pIoAddress->Address; } else if (pIoAddress->Interface == NvOdmIoModule_Vdd) { NvU32 usec = 0; NvU32 RailAddress = pIoAddress->Address; NvOdmServicesPmuVddRailCapabilities RailCapabilities; NvOdmServicesPmuGetCapabilities( pPrivData->hOdmPmuSevice, RailAddress, &RailCapabilities); NvOdmServicesPmuSetVoltage(pPrivData->hOdmPmuSevice, RailAddress, RailCapabilities.requestMilliVolts, &usec); NvOdmOsWaitUS(usec + (ADT7461_POWERUP_DELAY_MS * 1000)); } else if (pIoAddress->Interface == NvOdmIoModule_Gpio) { NvU32 port = pIoAddress->Instance; NvU32 pin = pIoAddress->Address; pPrivData->hGpioPin = NvOdmGpioAcquirePinHandle( pPrivData->hGpio, port, pin); } } NV_ASSERT(I2cModule == NvOdmIoModule_I2c_Pmu); pPrivData->hOdmI2C = NvOdmI2cOpen(I2cModule, I2cInstance); if (pPrivData->hOdmI2C == NULL) { NVODM_ADT7461_PRINTF(("ADT7461: Error Open I2C device. \n")); goto fail; } /* * Initialize device info and configuration. Force standby mode to avoid * glitch on shutdown comparator output when temperature range and/or * comparator limit is changing during initialization. The Adt7461Run() * call from the hal that follows initialization will switch device to * run mode and re-start temperature monitoring (note that out of limit * interrupt is always masked during and after initialization) */ pPrivData->pDeviceInfo = &s_Adt7461Info; pPrivData->ShadowRegPtr = ADT7461_INVALID_ADDR; pReg = &pPrivData->pDeviceInfo->Config; if (!Adt7461ReadReg(pPrivData, pReg, &Data)) goto fail; if ((Data & ADT7461ConfigBits_ExtendedRange) != (ADT7461_INITIAL_CONFIG & ADT7461ConfigBits_ExtendedRange)) { // Only switch from standard to extended range is supported NV_ASSERT((Data & ADT7461ConfigBits_ExtendedRange) == 0); Data |= ADT7461ConfigBits_Standby; if(!Adt7461WriteReg(pPrivData, pReg, Data)) goto fail; } Data = ADT7461_INITIAL_CONFIG | ADT7461ConfigBits_Standby; if(!Adt7461WriteReg(pPrivData, pReg, Data)) goto fail; pPrivData->ShadowConfig = Data; #if PRE_ER_GMT_THERMALSENSOR ExtRange = 0; /* not support ADT thermal sensor*/ #else ExtRange = ((Data & ADT7461ConfigBits_ExtendedRange) != 0); #endif // Program shutdown comparators settings Data = ADT7461_T_VALUE_TO_DATA( ExtRange, ADT7461_ODM_LOCAL_COMPARATOR_LIMIT_VALUE); pReg = &pPrivData->pDeviceInfo->Channels[ ADT7461ChannelID_Local].ComparatorLimit; if(!Adt7461WriteReg(pPrivData, pReg, Data)) goto fail; Data = ADT7461_T_VALUE_TO_DATA( ExtRange, ADT7461_ODM_REMOTE_COMPARATOR_LIMIT_VALUE); pReg = &pPrivData->pDeviceInfo->Channels[ ADT7461ChannelID_Remote].ComparatorLimit; if(!Adt7461WriteReg(pPrivData, pReg, Data)) goto fail; // Set interrupt limits to the range boundaries to prevent out of limit // interrupt Data = ADT7461_T_VALUE_TO_DATA( ExtRange, ADT7461_T_RANGE_LIMIT_HIGH(ExtRange)); pReg = &pPrivData->pDeviceInfo->Channels[ ADT7461ChannelID_Local].IntrLimitHigh; if(!Adt7461WriteReg(pPrivData, pReg, Data)) goto fail; pReg = &pPrivData->pDeviceInfo->Channels[ ADT7461ChannelID_Remote].IntrLimitHigh; if(!Adt7461WriteReg(pPrivData, pReg, Data)) goto fail; Data = ADT7461_T_VALUE_TO_DATA( ExtRange, ADT7461_T_RANGE_LIMIT_LOW(ExtRange)); pReg = &pPrivData->pDeviceInfo->Channels[ ADT7461ChannelID_Local].IntrLimitLow; if(!Adt7461WriteReg(pPrivData, pReg, Data)) goto fail; pReg = &pPrivData->pDeviceInfo->Channels[ ADT7461ChannelID_Remote].IntrLimitLow; if(!Adt7461WriteReg(pPrivData, pReg, Data)) goto fail; // Set initial rate Data = ADT7461_INITIAL_RATE_SETTING; pReg = &pPrivData->pDeviceInfo->Rate; if(!Adt7461WriteReg(pPrivData, pReg, Data)) goto fail; pPrivData->ShadowRate = Data; // Set remote channel offset (8-bit 2's complement value for any range) Data = ((NvU8)ADT7461_ODM_REMOTE_OFFSET_VALUE); pReg = &pPrivData->pDeviceInfo->Channels[ ADT7461ChannelID_Remote].Toffset; if(!Adt7461WriteReg(pPrivData, pReg, Data)) goto fail; // Read ADT7461 status and ARA (clear pending Alert interrupt, if any) pReg = &pPrivData->pDeviceInfo->Status; if (!Adt7461ReadReg(pPrivData, pReg, &Data)) goto fail; // TODO: check open remote circuit error Adt7461ReadAra(pPrivData); return NV_TRUE; fail: Adt7461FreePrivData(pPrivData); hTmon->pPrivate = NULL; return NV_FALSE; }
NvBool EETI_Open (NvOdmTouchDeviceHandle* hDevice) { EETI_TouchDevice* hTouch; NvU32 i; NvU32 found = 0; NvU32 GpioPort = 0; NvU32 GpioPin = 0; NvU32 I2cInstance = 0; const NvOdmPeripheralConnectivity *pConnectivity = NULL; hTouch = NvOdmOsAlloc(sizeof(EETI_TouchDevice)); if (!hTouch) return NV_FALSE; NvOdmOsMemset(hTouch, 0, sizeof(EETI_TouchDevice)); NvOdmOsMemset(tempReport, 0, sizeof(struct fingerReport_s) * 4); /* set function pointers */ InitOdmTouch(&hTouch->OdmTouch); pConnectivity = NvOdmPeripheralGetGuid(EETI_TOUCH_DEVICE_GUID); if (!pConnectivity) { NVODMTOUCH_PRINTF(("NvOdm Touch : pConnectivity is NULL Error \n")); goto fail; } if (pConnectivity->Class != NvOdmPeripheralClass_HCI) { NVODMTOUCH_PRINTF(("NvOdm Touch : didn't find any periperal in discovery query for touch device Error \n")); goto fail; } for (i = 0; i < pConnectivity->NumAddress; i++) { switch (pConnectivity->AddressList[i].Interface) { case NvOdmIoModule_I2c: hTouch->DeviceAddr = (pConnectivity->AddressList[i].Address << 1); I2cInstance = pConnectivity->AddressList[i].Instance; found |= 1; break; case NvOdmIoModule_Gpio: GpioPort = pConnectivity->AddressList[i].Instance; GpioPin = pConnectivity->AddressList[i].Address; found |= 2; break; case NvOdmIoModule_Vdd: hTouch->VddId = pConnectivity->AddressList[i].Address; found |= 4; break; default: break; } } if ((found & 3) != 3) { NVODMTOUCH_PRINTF(("NvOdm Touch : peripheral connectivity problem \n")); goto fail; } if ((found & 4) != 0) { if (NV_FALSE == EETI_PowerOnOff(&hTouch->OdmTouch, 1)) goto fail; } else { hTouch->VddId = 0xFF; } hTouch->hOdmI2c = NvOdmI2cOpen(NvOdmIoModule_I2c, I2cInstance); if (!hTouch->hOdmI2c) { NVODMTOUCH_PRINTF(("NvOdm Touch : NvOdmI2cOpen Error \n")); goto fail; } hTouch->hGpio = NvOdmGpioOpen(); if (!hTouch->hGpio) { NVODMTOUCH_PRINTF(("NvOdm Touch : NvOdmGpioOpen Error \n")); goto fail; } hTouch->hPin = NvOdmGpioAcquirePinHandle(hTouch->hGpio, GpioPort, GpioPin); if (!hTouch->hPin) { NVODMTOUCH_PRINTF(("NvOdm Touch : Couldn't get GPIO pin \n")); goto fail; } NvOdmGpioConfig(hTouch->hGpio, hTouch->hPin, NvOdmGpioPinMode_InputData); NvOdmGpioGetState(hTouch->hGpio, hTouch->hPin, &i); /* set default capabilities */ NvOdmOsMemcpy(&hTouch->Caps, &EETI_Capabilities, sizeof(NvOdmTouchCapabilities)); /* set default I2C speed */ hTouch->I2cClockSpeedKHz = EETI_I2C_SPEED_KHZ; #if 1 if (EETI_ProbeTouchDevice (hTouch) != NV_TRUE) { NvOdmOsPrintf("NvOdm Touch : Multitouch detection failure \n"); goto fail; } #endif hTouch->Caps.XMaxPosition = 32767; hTouch->Caps.YMaxPosition = 32767; *hDevice = &hTouch->OdmTouch; return NV_TRUE; fail: EETI_Close(&hTouch->OdmTouch); return NV_FALSE; }
static int cpcap_usb_connected_probe(struct platform_device *pdev) { /* struct cpcap_usb_connected_data *data;*/ struct cpcap_accy_platform_data *pdata = pdev->dev.platform_data; int nr_gpio; int ret; static int count_f7 = 0; #if 0 data = kzalloc(sizeof(*data), GFP_KERNEL); if(!data) return -ENOMEM; data->accy = pdata->accy; /* Configure CPCAP-AP20 USB Mux to AP20 */ data->port = NVODM_PORT('v'); printk(KERN_INFO "pICS_%s: data->port = NVODM_PORT('v') = %lu\n",__func__, data->port); data->pin = 6; data->h_gpio = NvOdmGpioOpen(); printk(KERN_INFO "pICS_%s: data->h_gpio = NvOdmGpioOpen()\n",__func__); data->h_pin = NvOdmGpioAcquirePinHandle(data->h_gpio, data->port, data->pin); printk(KERN_INFO "pICS_%s: data->h_pin = NvOdmGpioAcquirePinHandle(data->h_gpio, data->port, data->pin)\n",__func__); NvOdmGpioConfig(data->h_gpio, data->h_pin, NvOdmGpioPinMode_Output); printk(KERN_INFO "pICS_%s: NvOdmGpioConfig(data->h_gpio, data->h_pin, NvOdmGpioPinMode_Output)\n",__func__); NvOdmGpioSetState(data->h_gpio, data->h_pin, 0x1); printk(KERN_INFO "pICS_%s: NvOdmGpioSetState(data->h_gpio, data->h_pin, 0x1)\n",__func__); #endif /* data->port = 21; data->pin = 6; data->h_gpio = 174; data->h_pin = */ try_f7: nr_gpio = 174; ret = gpio_request(nr_gpio, "nvrm_gpio"); printk(KERN_INFO "pICS_%s: gpio_request(nr_gpio=%i, 'nvrm_gpio') => %i;\n",__func__, nr_gpio, ret); if (ret) { if(TEGRA_GPIO_PF7 == nr_gpio && !count_f7) { pr_err("%s: gpio_request for 47 failed (%d). Special case to free and retry\n", __func__, ret); // F7 is allocated early by lights driver but really should be owned by disp driver gpio_free(nr_gpio); /*gpio_data[nr_gpio].val = false; gpio_data[nr_gpio].alloc = false;*/ count_f7 = 1; goto try_f7; } /*gpio_to_name(nr_gpio, gpio_name);*/ pr_err("%s: gpio_request for %d failed (%d)\n", __func__, nr_gpio, ret); } /* gpio_data[nr_gpio].alloc = true; gpio_data[nr_gpio].val = false;*/ tegra_gpio_enable(nr_gpio); gpio_direction_output(nr_gpio, 0); gpio_set_value(nr_gpio, 1); platform_set_drvdata(pdev, pdata); /* when the phone is the host do not start the gadget driver */ if((pdata->accy == CPCAP_ACCY_USB) || (pdata->accy == CPCAP_ACCY_FACTORY)) { tegra_otg_set_mode(0); #ifdef CONFIG_USB_MOT_ANDROID android_usb_set_connected(1, pdata->accy); #endif } if(pdata->accy == CPCAP_ACCY_USB_DEVICE) { tegra_otg_set_mode(1); } #ifdef CONFIG_MDM_CTRL mdm_ctrl_set_usb_ipc(true); #endif return 0; }
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 }
static int __init muic_probe(struct platform_device *pdev) { int i, j, ret; #ifdef _MUIC_GPIO_I2C_ int ret_val; #else NvU32 I2cInstance = 0; #endif #if defined(CONFIG_MACH_STAR_REV_D) || defined(CONFIG_MACH_STAR_REV_E) || defined(CONFIG_MACH_STAR_REV_F) NvU32 pin[5], port[5]; #else NvU32 pin[4], port[4]; #endif const NvOdmPeripheralConnectivity *pConnectivity = NULL; printk(KERN_INFO "muic_probe\n"); pConnectivity = NvOdmPeripheralGetGuid(MUIC_GUID); for (i = 0, j = 0 ; i < pConnectivity->NumAddress; i++) { switch (pConnectivity->AddressList[i].Interface) { #ifndef _MUIC_GPIO_I2C_ case NvOdmIoModule_I2c: s_hMuicHandle.DeviceAddr = (pConnectivity->AddressList[i].Address << 1); I2cInstance = pConnectivity->AddressList[i].Instance; break; #endif case NvOdmIoModule_Gpio: port[j] = pConnectivity->AddressList[i].Instance; pin[j] = pConnectivity->AddressList[i].Address; j++; break; default: break; } } s_hMuicHandle.hGpio = NvOdmGpioOpen(); if (!s_hMuicHandle.hGpio) { lprintk(D_MUIC, "%s: NvOdmGpioOpen Error \n", __func__); goto err_open_gpio_fail; } s_hMuicHandle.h_INT_N_MUIC = NvOdmGpioAcquirePinHandle(s_hMuicHandle.hGpio, port[0], pin[0]); if (!s_hMuicHandle.h_INT_N_MUIC) { lprintk(D_MUIC, "%s: Couldn't NvOdmGpioAcquirePinHandle pin \n", __func__); goto err_open_gpio_pin_acquire_fail; } s_hMuicHandle.h_AP20_UART_SW = NvOdmGpioAcquirePinHandle(s_hMuicHandle.hGpio, port[1], pin[1]); if (!s_hMuicHandle.h_AP20_UART_SW) { lprintk(D_MUIC, "%s:Couldn't NvOdmGpioAcquirePinHandle pin \n", __func__); goto err_open_gpio_pin_acquire_fail; } s_hMuicHandle.h_IFX_UART_SW = NvOdmGpioAcquirePinHandle(s_hMuicHandle.hGpio, port[2], pin[2]); if (!s_hMuicHandle.h_IFX_UART_SW) { lprintk(D_MUIC, "%s:Couldn't NvOdmGpioAcquirePinHandle pin \n", __func__); goto err_open_gpio_pin_acquire_fail; } s_hMuicHandle.h_USIF1_SW = NvOdmGpioAcquirePinHandle(s_hMuicHandle.hGpio, port[3], pin[3]); if (!s_hMuicHandle.h_USIF1_SW) { lprintk(D_MUIC, "%s: Couldn't NvOdmGpioAcquirePinHandle pin \n", __func__); goto err_open_gpio_pin_acquire_fail; } #if defined(CONFIG_MACH_STAR_REV_D) || defined(CONFIG_MACH_STAR_REV_E) || defined(CONFIG_MACH_STAR_REV_F) s_hMuicHandle.h_USB_VBUS_EN = NvOdmGpioAcquirePinHandle(s_hMuicHandle.hGpio, port[4], pin[4]); if (!s_hMuicHandle.h_USB_VBUS_EN) { lprintk(D_MUIC, "%s: Couldn't NvOdmGpioAcquirePinHandle pin \n", __func__); goto err_open_gpio_pin_acquire_fail; } #endif NvOdmGpioConfig(s_hMuicHandle.hGpio, s_hMuicHandle.h_INT_N_MUIC, NvOdmGpioPinMode_InputData); NvOdmGpioConfig(s_hMuicHandle.hGpio, s_hMuicHandle.h_AP20_UART_SW, NvOdmGpioPinMode_Output); NvOdmGpioConfig(s_hMuicHandle.hGpio, s_hMuicHandle.h_IFX_UART_SW, NvOdmGpioPinMode_Output); NvOdmGpioConfig(s_hMuicHandle.hGpio, s_hMuicHandle.h_USIF1_SW, NvOdmGpioPinMode_Output); #if defined(CONFIG_MACH_STAR_REV_D) || defined(CONFIG_MACH_STAR_REV_E) || defined(CONFIG_MACH_STAR_REV_F) NvOdmGpioConfig(s_hMuicHandle.hGpio, s_hMuicHandle.h_USB_VBUS_EN, NvOdmGpioPinMode_Output); #endif #ifdef _MUIC_GPIO_I2C_ ret_val = MUIC_Gpio_i2c_init(&s_hMuicHandle); if (ret_val < 0) { lprintk(D_MUIC, "%s: MUIC_Gpio_i2c_init Error \n", __func__); goto err_open_i2c_handle; } #else s_hMuicHandle.hOdmI2c = NvOdmI2cOpen(NvOdmIoModule_I2c, I2cInstance); if (!s_hMuicHandle.hOdmI2c) { lprintk(D_MUIC, "%s: NvOdmI2cOpen Error \n", __func__); goto err_open_i2c_handle; } #endif wake_lock_init(&s_hMuicHandle.wlock, WAKE_LOCK_SUSPEND, "muic_active"); //20101117, [email protected], for autorun [START] #ifdef CONFIG_USB_SUPPORT_LGE_ANDROID_AUTORUN s_hMuicHandle.sdev_autorun.name = DRIVER_NAME_FOR_AUTORUN; s_hMuicHandle.sdev_autorun.print_name = print_switch_name_for_autorun; s_hMuicHandle.sdev_autorun.print_state = print_switch_state_for_autorun; ret = switch_dev_register(&s_hMuicHandle.sdev_autorun); if (ret) { goto err_sdev_unregister; } #endif //20101117, [email protected], for autorun [END] INIT_DELAYED_WORK(&muic_wq, muic_wq_func); if (NvOdmGpioInterruptRegister(s_hMuicHandle.hGpio, &s_hMuicHandle.hGpioInterrupt, s_hMuicHandle.h_INT_N_MUIC, NvOdmGpioPinMode_InputInterruptFallingEdge , muic_interrupt_handler, (void*)&s_hMuicHandle, 0) == NV_FALSE) { lprintk(D_MUIC, KERN_ERR "%s: cannot register interrupt.\n", __func__); goto err_get_interrupt_handler; } create_star_muic_proc_file(); current_device = DEVICE_NONE; muic_initialize_max(RESET); //20100915, [email protected], move to late_initcall [START] #if 0 NvOdmOsSleepMS(400) ; MAX14526_Device_Detection(); #endif //20100915, [email protected], move to late_initcall [STOP] return 0; err_get_interrupt_handler: #ifndef _MUIC_GPIO_I2C_ NvOdmI2cClose(s_hMuicHandle.hOdmI2c); #endif //20101117, [email protected], for autorun [START] #ifdef CONFIG_USB_SUPPORT_LGE_ANDROID_AUTORUN err_sdev_unregister: switch_dev_unregister(&s_hMuicHandle.sdev_autorun); #endif //20101117, [email protected], for autorun [END] err_open_i2c_handle: 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 err_open_gpio_pin_acquire_fail: NvOdmGpioClose(s_hMuicHandle.hGpio); err_open_gpio_fail: return -ENOSYS; }
NvOdmSdioHandle NvOdmSdioOpen(NvU32 Instance) { static NvOdmSdio *pDevice = NULL; NvOdmServicesGpioHandle hGpioTemp = NULL; NvOdmPeripheralConnectivity *pConnectivity; NvU32 NumOfGuids = 1; NvU64 guid; NvU32 searchVals[2]; const NvU32 *pOdmConfigs; NvU32 NumOdmConfigs; NvBool Status = NV_TRUE; NvU32 DutyCycle; NvU32 gRequestedFreqHzOrPeriod; NvU32 ReturnedFreq; const NvOdmPeripheralSearch searchAttrs[] = { NvOdmPeripheralSearch_IoModule, NvOdmPeripheralSearch_Instance, }; searchVals[0] = NvOdmIoModule_Sdio; searchVals[1] = Instance; NvOdmQueryPinMux(NvOdmIoModule_Sdio, &pOdmConfigs, &NumOdmConfigs); if (Instance >= NumOdmConfigs ) return NULL; if( pOdmConfigs[Instance] == 0 ) return NULL; NumOfGuids = NvOdmPeripheralEnumerate( searchAttrs, searchVals, 2, &guid, NumOfGuids); // Get the peripheral connectivity information pConnectivity = (NvOdmPeripheralConnectivity *)NvOdmPeripheralGetGuid(guid); if (pConnectivity == NULL) return NULL; pDevice = NvOdmOsAlloc(sizeof(NvOdmSdio)); pDevice->hPmu = NULL; if(pDevice == NULL) return (pDevice); if (pDevice->hPmu == NULL) { pDevice->hPmu = NvOdmServicesPmuOpen(); if(pDevice->hPmu == NULL) { NvOdmOsFree(pDevice); pDevice = NULL; return (NULL); } } pDevice->pConnectivity = pConnectivity; NvOdmSetPowerOnSdio(pDevice, NV_TRUE); if (pConnectivity->Guid == WLAN_GUID) { // Getting the OdmGpio Handle hGpioTemp = NvOdmGpioOpen(); if (hGpioTemp == NULL) { NvOdmOsFree(pDevice); pDevice = NULL; return (pDevice); } // Search for the Vdd rail and set the proper volage to the rail. /* if (pConnectivity->AddressList[1].Interface == NvOdmIoModule_Gpio) { // Acquiring Pin Handles for Power Pin pDevice->hPwrPin= NvOdmGpioAcquirePinHandle(hGpioTemp, pConnectivity->AddressList[1].Instance, pConnectivity->AddressList[1].Address); } */// Sam --- if (pConnectivity->AddressList[2].Interface == NvOdmIoModule_Gpio) { // Acquiring Pin Handles for Reset Pin pDevice->hResetPin= NvOdmGpioAcquirePinHandle(hGpioTemp, pConnectivity->AddressList[2].Instance, pConnectivity->AddressList[2].Address); } // Setting the ON/OFF pin to output mode. //NvOdmGpioConfig(hGpioTemp, pDevice->hPwrPin, NvOdmGpioPinMode_Output);// Sam --- NvOdmGpioConfig(hGpioTemp, pDevice->hResetPin, NvOdmGpioPinMode_Output); // Setting the Output Pin to Low //NvOdmGpioSetState(hGpioTemp, pDevice->hPwrPin, 0x0); //Sam --- NvOdmGpioSetState(hGpioTemp, pDevice->hResetPin, 0x0); pDevice->hGpio = hGpioTemp; s_hOdmPwm = NvOdmPwmOpen(); gRequestedFreqHzOrPeriod = 32000; //32KHz DutyCycle = 3211264; NvOdmPwmConfig(s_hOdmPwm, NvOdmPwmOutputId_Blink, NvOdmPwmMode_Blink_32KHzClockOutput, DutyCycle, &gRequestedFreqHzOrPeriod, &ReturnedFreq); Status = SdioOdmWlanSetPowerOn(pDevice, NV_TRUE); if (Status != NV_TRUE) { NvOdmOsFree(pDevice); pDevice = NULL; return (pDevice); } } pDevice->PoweredOn = NV_TRUE; pDevice->Instance = Instance; NV_DRIVER_TRACE(("Open SDIO%d", Instance)); return pDevice; }
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 __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; }
NvOdmSdioHandle NvOdmSdioOpen(NvU32 Instance) { static NvOdmSdio *pDevice = NULL; NvOdmServicesGpioHandle hGpioTemp = NULL; NvOdmPeripheralConnectivity *pConnectivity; NvU32 NumOfGuids = 1; NvU64 guid; NvU32 searchVals[4]; const NvU32 *pOdmConfigs; NvU32 NumOdmConfigs; NvBool Status = NV_TRUE; const NvOdmPeripheralSearch searchAttrs[] = { NvOdmPeripheralSearch_PeripheralClass, NvOdmPeripheralSearch_IoModule, NvOdmPeripheralSearch_Instance, NvOdmPeripheralSearch_Address, }; NvOdmBoardInfo BoardInfo; NvBool status = NV_FALSE; searchVals[0] = NvOdmPeripheralClass_Other; searchVals[1] = NvOdmIoModule_Sdio; searchVals[2] = Instance; NvOdmQueryPinMux(NvOdmIoModule_Sdio, &pOdmConfigs, &NumOdmConfigs); if ((Instance == 0) && (pOdmConfigs[0] == NvOdmSdioPinMap_Config1)) { // sdio is connected to sdio2 slot. searchVals[3] = NvOdmSdioDiscoveryAddress_1; } else { // sdio is connected to wifi module. searchVals[3] = NvOdmSdioDiscoveryAddress_0; } NumOfGuids = NvOdmPeripheralEnumerate(searchAttrs, searchVals, 4, &guid, NumOfGuids); // Get the peripheral connectivity information pConnectivity = (NvOdmPeripheralConnectivity *)NvOdmPeripheralGetGuid(guid); if (pConnectivity == NULL) return NULL; pDevice = NvOdmOsAlloc(sizeof(NvOdmSdio)); if(pDevice == NULL) return (pDevice); pDevice->hPmu = NvOdmServicesPmuOpen(); if(pDevice->hPmu == NULL) { NvOdmOsFree(pDevice); pDevice = NULL; return (NULL); } if (pConnectivity->Guid == WLAN_GUID) { // WARNING: This function *cannot* be called before RmOpen(). status = NvOdmPeripheralGetBoardInfo((BOARD_ID_E951), &BoardInfo); if (NV_TRUE != status) { // whistler should have E951 Module, if it is not presnt return NULL Handle. NvOdmServicesPmuClose(pDevice->hPmu); NvOdmOsFree(pDevice); pDevice = NULL; NvOdmOsDebugPrintf(("No E951 Detected")); return (pDevice); } } pDevice->pConnectivity = pConnectivity; NvOdmSetPowerOnSdio(pDevice, NV_TRUE); if (pConnectivity->Guid == WLAN_GUID) { // Getting the OdmGpio Handle hGpioTemp = NvOdmGpioOpen(); if (hGpioTemp == NULL) { NvOdmServicesPmuClose(pDevice->hPmu); NvOdmOsFree(pDevice); pDevice = NULL; return (pDevice); } // Search for the Vdd rail and set the proper volage to the rail. if (pConnectivity->AddressList[1].Interface == NvOdmIoModule_Gpio) { // Acquiring Pin Handles for Power Pin pDevice->hPwrPin= NvOdmGpioAcquirePinHandle(hGpioTemp, pConnectivity->AddressList[1].Instance, pConnectivity->AddressList[1].Address); } if (pConnectivity->AddressList[2].Interface == NvOdmIoModule_Gpio) { // Acquiring Pin Handles for Reset Pin pDevice->hResetPin= NvOdmGpioAcquirePinHandle(hGpioTemp, pConnectivity->AddressList[2].Instance, pConnectivity->AddressList[2].Address); } // Setting the ON/OFF pin to output mode. NvOdmGpioConfig(hGpioTemp, pDevice->hPwrPin, NvOdmGpioPinMode_Output); NvOdmGpioConfig(hGpioTemp, pDevice->hResetPin, NvOdmGpioPinMode_Output); // Setting the Output Pin to Low NvOdmGpioSetState(hGpioTemp, pDevice->hPwrPin, 0x0); NvOdmGpioSetState(hGpioTemp, pDevice->hResetPin, 0x0); pDevice->hGpio = hGpioTemp; Status = SdioOdmWlanSetPowerOn(pDevice, NV_TRUE); if (Status != NV_TRUE) { NvOdmServicesPmuClose(pDevice->hPmu); NvOdmGpioReleasePinHandle(pDevice->hGpio, pDevice->hPwrPin); NvOdmGpioReleasePinHandle(pDevice->hGpio, pDevice->hResetPin); NvOdmGpioClose(pDevice->hGpio); NvOdmOsFree(pDevice); pDevice = NULL; return (pDevice); } } pDevice->PoweredOn = NV_TRUE; pDevice->Instance = Instance; NV_DRIVER_TRACE(("Open SDIO%d", Instance)); return pDevice; }