예제 #1
0
static NvBool touchLED_Control(NvU8 value)
{
	NvU32 settle_us;

	/* set the rail volatage to the recommended */
	if(value)
	{
// 20100820 [email protected] LGE Touch LED Control [START]
#ifdef TOUCH_LED_TIMER
		hrtimer_cancel(&s_touchLED.timer);
		hrtimer_start(&s_touchLED.timer, ktime_set(s_touchLED.delay, 0), HRTIMER_MODE_REL);
#endif
// 20100820 [email protected] LGE Touch LED Control [END]
        NvOdmServicesPmuSetVoltage(s_touchLED.hPmu, s_touchLED.conn->AddressList[0].Address, s_touchLED.setVal, &settle_us);
	}
	else
	{
// 20100820 [email protected] LGE Touch LED Control [START]
#ifdef TOUCH_LED_TIMER
		hrtimer_cancel(&s_touchLED.timer);
#endif
// 20100820 [email protected] LGE Touch LED Control [END]
		NvOdmServicesPmuSetVoltage(s_touchLED.hPmu, s_touchLED.conn->AddressList[0].Address, NVODM_VOLTAGE_OFF, &settle_us);
	}
	
	return NV_TRUE;
}
예제 #2
0
static void
ConfigPowerRail(
    NvOdmServicesPmuHandle hPMUDevice,
    NvU32 Id,
    NvBool IsEnable)
{
    NvOdmServicesPmuVddRailCapabilities vddrailcap;
    NvU32 settletime;

    if (hPMUDevice && Id)
    {
        NvOdmServicesPmuGetCapabilities(hPMUDevice, Id, &vddrailcap);
        if (IsEnable)
        {
            NvOdmServicesPmuSetVoltage(hPMUDevice, Id,
                vddrailcap.requestMilliVolts, &settletime);
        }
        else
        {
            NvOdmServicesPmuSetVoltage(hPMUDevice, Id,
                vddrailcap.MinMilliVolts, &settletime);
        }
    if (settletime)
        NvOdmOsWaitUS(settletime);
    }
}
예제 #3
0
static int 	vib_set_power_rail( NvU32 vdd_id, NvBool is_enable )
{
	NvOdmServicesPmuHandle 			h_pmu = NvOdmServicesPmuOpen( );
	NvOdmServicesPmuVddRailCapabilities 	vddrailcap;
	NvU32 							settletime;

	if ( h_pmu ) {
    	NvOdmServicesPmuGetCapabilities( h_pmu, vdd_id, &vddrailcap );
    	if ( is_enable ) {
    		DbgOut(( "[ImmVibeSPI] vibrator PMU enable\n" ));
    		NvOdmServicesPmuSetVoltage( h_pmu, vdd_id, vddrailcap.requestMilliVolts, &settletime );
    	} else {
    		DbgOut(( "[ImmVibeSPI] vibrator PMU do not enable\n" ));
    		NvOdmServicesPmuSetVoltage(h_pmu, vdd_id, NVODM_VOLTAGE_OFF, &settletime);
    	}

    	if ( settletime )
    		NvOdmOsWaitUS( settletime );

    	NvOdmServicesPmuClose( h_pmu );
    	DbgOut(( "[ImmVibeSPI] vibrator voltage =  %d or %d \n", vddrailcap.requestMilliVolts, vddrailcap.MinMilliVolts ));
    	return 0;
	}

	return -1;

}
예제 #4
0
static void star_proxi_vddio_vi_power_onoff( NvU32 vdd_id, NvBool is_enable )
{
	NvOdmServicesPmuHandle h_pmu = NvOdmServicesPmuOpen();
	NvOdmServicesPmuVddRailCapabilities vddrailcap;
	NvU32 settletime;
	if(h_pmu)
	{
		NvOdmServicesPmuGetCapabilities(h_pmu, vdd_id, &vddrailcap);
		if( is_enable )
		{
			#if 1
				printk("VDDID_VI's pmu enable for PROXI_OUT\n");
			#endif
			NvOdmServicesPmuSetVoltage(h_pmu, vdd_id, vddrailcap.requestMilliVolts, &settletime);
		}
		else
		{
			#if 1
				printk("VDDID_VI's pmu do not enable for PROXI_OUT\n");
			#endif
			NvOdmServicesPmuSetVoltage(h_pmu, vdd_id, NVODM_VOLTAGE_OFF, &settletime);
		}
		if(settletime)
			NvOdmOsWaitUS(settletime);
	}

	NvOdmServicesPmuClose(h_pmu);
}
NvBool Synaptics_OneTouch_PowerOnOff (NvOdmOneTouchDeviceHandle hDevice, NvBool OnOff)
{
// 20101120 [email protected] power off when Onetouch close    
#if defined(CONFIG_MACH_STAR_SKT_REV_E) || defined(CONFIG_MACH_STAR_SKT_REV_F)
	NvOdmServicesPmuVddRailCapabilities vddrailcap;
	NvU32 settletime;

    Synaptics_OneTouch_Device* hTouch = (Synaptics_OneTouch_Device*)hDevice;

    hTouch->hPmu = NvOdmServicesPmuOpen();

	printk("[ONETOUCH] Synaptics_OneTouch_PowerOnOff\n");
	
    if (!hTouch->hPmu)
    {
		printk("[ONETOUCH] NvOdmServicesPmuOpen Error\n");
		return NV_FALSE;
    }
    
	NvOdmServicesPmuGetCapabilities( hTouch->hPmu, hTouch->VddId, &vddrailcap);

	printk("[ONETOUCH] power on[%d], vol[%d]\n", OnOff, vddrailcap.requestMilliVolts);
		
	if(OnOff)
	{
// 20101223 [email protected] [SU660] block touch interrupt when onetouch is on reset [START]
#if defined(CONFIG_MACH_STAR_SKT_REV_E) || defined(CONFIG_MACH_STAR_SKT_REV_F)
		if(hGpioIntr_touch)
			NvOdmGpioInterruptMask(hGpioIntr_touch, NV_TRUE);
#endif
// 20101223 [email protected] [SU660] block touch interrupt when onetouch is on reset [END]
			
	    NvOdmServicesPmuSetVoltage( hTouch->hPmu, hTouch->I2cVddId, NVODM_VOLTAGE_OFF, &settletime);
        NvOdmOsWaitUS(SYNAPTICS_POR_DELAY_MS*1000); // wait to settle power
		NvOdmServicesPmuSetVoltage( hTouch->hPmu, Max8907PmuSupply_LDO16, NVODM_VOLTAGE_OFF, &settletime);
		NvOdmOsWaitUS(SYNAPTICS_POR_DELAY_MS*2*1000); // wait to settle power

		NvOdmServicesPmuSetVoltage( hTouch->hPmu, Max8907PmuSupply_LDO16, MAX8907_REQUESTVOLTAGE_LDO16, &settletime);
		NvOdmServicesPmuSetVoltage( hTouch->hPmu, hTouch->I2cVddId, MAX8907_REQUESTVOLTAGE_LDO19, &settletime);

// 20101223 [email protected] [SU660] block touch interrupt when onetouch is on reset [START]
#if defined(CONFIG_MACH_STAR_SKT_REV_E) || defined(CONFIG_MACH_STAR_SKT_REV_F)
		if(hGpioIntr_touch)
			NvOdmGpioInterruptMask(hGpioIntr_touch, NV_FALSE);
#endif
// 20101223 [email protected] [SU660] block touch interrupt when onetouch is on reset [END]
	}else
		NvOdmServicesPmuSetVoltage( hTouch->hPmu, Max8907PmuSupply_LDO16, NVODM_VOLTAGE_OFF, &settletime);

		NvOdmOsWaitUS(SYNAPTICS_POR_DELAY_MS*5*1000); // wait to settle power

    NvOdmServicesPmuClose(hTouch->hPmu);
#endif
    return NV_TRUE;
}
예제 #6
0
static void NvOdmSetPowerOnSdio(NvOdmSdioHandle pDevice, NvBool enable)
{
    const NvOdmPeripheralConnectivity *pConn;
    NvU32 i;

    pConn = pDevice->pConnectivity;

    for (i=0; i<pConn->NumAddress; i++)
    {
        const NvOdmIoAddress *addr = &pConn->AddressList[i];
        NvU32 settle;
        NvU32 voltage;

        if (addr->Interface != NvOdmIoModule_Vdd)
            continue;

        if (enable)
        {
            NvOdmServicesPmuVddRailCapabilities caps;
            NvOdmServicesPmuGetCapabilities(pDevice->hPmu, addr->Address, &caps);
            voltage = caps.requestMilliVolts;
        }
        else
        {
            voltage = ODM_VOLTAGE_OFF;
        }

        NvOdmServicesPmuSetVoltage(pDevice->hPmu, addr->Address,
                                   voltage, &settle);

        if (settle)
            NvOdmOsWaitUS(settle);
    }
}
예제 #7
0
static int headset_resume(struct platform_device *pdev)
{
//20101117, [email protected], gpio wakeup from LP1 [START]
    if(core_lock_on && headset_vdd_address){
        NvOdmServicesPmuSetVoltage(headset_h_pmu, headset_vdd_address, NVODM_VOLTAGE_OFF, NULL);
    } 
    suspend_status = 0;
//20101117, [email protected], gpio wakeup from LP1 [END]

	 //[email protected] 20110726 detecting headset when resuming [START]
	 star_Mic_bias(1);
	 headset_det_work(&headset_sw_data->work);
	 //[email protected] 20110726 detecting headset when resuming [END]
    
    if(core_lock_on){
        lprintk(D_AUDIO, KERN_ERR "##(Headset_det.c)## headset_resume()!! wakeup form LP1 headset detect\n");
                
        input_report_key(headset_sw_data->ip_dev_wake, KEY_VOLUMEDOWN, 1);
        input_sync(headset_sw_data->ip_dev_wake);
        input_report_key(headset_sw_data->ip_dev_wake, KEY_VOLUMEDOWN, 0);
		input_sync(headset_sw_data->ip_dev_wake);
        
//P990_IFX_GB_PORTING_LGSI_START
#if !defined (STAR_OPERATOR_FIDO)
	  cancel_delayed_work_sync(&headset_sw_data->delayed_work); //20111017 [email protected] Problem that no wake up when disconn headset in calling
#endif
//P990_IFX_GB_PORTING_LGSI_END
	  
        schedule_delayed_work(&headset_sw_data->delayed_work,	msecs_to_jiffies(300));	
    }
    
	return 0;
}
/**
 *  @brief Stops the Vibro motor
 *  @param hOdmVibrate  [IN] Opaque handle to the device.
 *  @return NV_TRUE on success and NV_FALSE on error
 */
NvBool
NvOdmVibStop(NvOdmVibDeviceHandle hOdmVibrate)
{
    NvU32 SettlingTime;

    NV_ASSERT(hOdmVibrate);

    if (!hOdmVibrate)
    {
        return NV_FALSE;
    }

#if (defined(CONFIG_7546Y_V10))
    NvOdmGpioSetState(hOdmVibrate->vibrate_gpio, hOdmVibrate->vibrate_pin, 0); //Hzj added
     NvOdmGpioSetState(hOdmVibrate->vibrate_segpio, hOdmVibrate->vibrate_sepin, 0); //Hzj added
#else
    if (hOdmVibrate->hOdmServicePmuDevice != NULL)
    {
        // Search for the Vdd rail and power Off the module
        if (hOdmVibrate->VddId)
        {
            NvOdmServicesPmuSetVoltage(hOdmVibrate->hOdmServicePmuDevice,
                        hOdmVibrate->VddId, NVODM_VOLTAGE_OFF, &SettlingTime);

            if (SettlingTime)
                NvOdmOsWaitUS(SettlingTime);
        }
    }
#endif
    return NV_TRUE;
}
예제 #9
0
static int headset_resume(struct platform_device *pdev)
{
//20101117, , gpio wakeup from LP1 [START]
    if(core_lock_on && headset_vdd_address){
        NvOdmServicesPmuSetVoltage(headset_h_pmu, headset_vdd_address, NVODM_VOLTAGE_OFF, NULL);
    } 
    suspend_status = 0;
//20101117, , gpio wakeup from LP1 [END]


	// 20110726 detecting headset when resuming [START]
	 star_Mic_bias(1);
	 headset_det_work(&headset_sw_data->work);
    // 20110726 detecting headset when resuming [END]
    
    if(core_lock_on){
        lprintk(D_AUDIO, KERN_ERR "##(Headset_det.c)## headset_resume()!! wakeup form LP1 headset detect\n");
                
        input_report_key(headset_sw_data->ip_dev_wake, KEY_VOLUMEDOWN, 1);
        input_sync(headset_sw_data->ip_dev_wake);
        input_report_key(headset_sw_data->ip_dev_wake, KEY_VOLUMEDOWN, 0);
		input_sync(headset_sw_data->ip_dev_wake);
        
        schedule_delayed_work(&headset_sw_data->delayed_work,	msecs_to_jiffies(300));	
    }
    
	return 0;
}
예제 #10
0
static void NvOdmSetPowerOnSdio(NvOdmSdioHandle pDevice,
                                NvBool IsEnable)
{
    NvU32 Index = 0;
    NvOdmServicesPmuVddRailCapabilities RailCaps;
    NvU32 SettlingTime = 0;
    const NvOdmPeripheralConnectivity *pConnectivity;

    pConnectivity = pDevice->pConnectivity;
    if (IsEnable) // Turn on Power
    {
        // 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)
            {
                NvOdmServicesPmuGetCapabilities(pDevice->hPmu, pConnectivity->AddressList[Index].Address, &RailCaps);
                NvOdmServicesPmuSetVoltage(pDevice->hPmu, pConnectivity->AddressList[Index].Address,
                                           RailCaps.requestMilliVolts, &SettlingTime);
                if (SettlingTime)
                {
                    NvOdmOsWaitUS(SettlingTime);
                }
            }
        }
    }
    else // Shutdown Power
    {
        // Search for the Vdd rail and power Off the module
        for (Index = 0; Index < pConnectivity->NumAddress; ++Index)
        {
            if (pConnectivity->AddressList[Index].Interface == NvOdmIoModule_Vdd)
            {
                NvOdmServicesPmuGetCapabilities(pDevice->hPmu, pConnectivity->AddressList[Index].Address, &RailCaps);
                NvOdmServicesPmuSetVoltage(pDevice->hPmu, pConnectivity->AddressList[Index].Address,
                                           ODM_VOLTAGE_OFF, &SettlingTime);
                if (SettlingTime)
                {
                    NvOdmOsWaitUS(SettlingTime);
                }
            }
        }
    }
}
예제 #11
0
void NvAccelerometerSetPowerRail(NvOdmServicesPmuHandle hPMUDevice, NvU32 Id, NvBool IsEnable)
{
    NvOdmServicesPmuVddRailCapabilities vddrailcap;
    NvU32 settletime;

    if (hPMUDevice)
    {       
        NvOdmServicesPmuGetCapabilities(hPMUDevice, Id, &vddrailcap);
        if (IsEnable)
        {
            NvOdmServicesPmuSetVoltage(hPMUDevice, Id, vddrailcap.requestMilliVolts, &settletime);
        }
        else
        {
            NvOdmServicesPmuSetVoltage(hPMUDevice, Id, vddrailcap.MinMilliVolts, &settletime);
        }
        NvOdmOsWaitUS(settletime);  // wait to settle power
    }
}
예제 #12
0
void NvGyroAccelSetPowerRail(NvOdmServicesPmuHandle hPMUDevice, NvU32 Id, NvBool IsEnable)
{
	NvOdmServicesPmuVddRailCapabilities vddrailcap;
	NvU32 settletime;
	printk(" ## MPU3050 : 3 \n") ;

	Accel_PRail = Id;

	if (hPMUDevice) {
		NvOdmServicesPmuGetCapabilities(hPMUDevice, Id, &vddrailcap);
		if (IsEnable) {
			NvOdmServicesPmuSetVoltage(hPMUDevice, Id, vddrailcap.requestMilliVolts, &settletime);
		} else {
			NvOdmServicesPmuSetVoltage(hPMUDevice, Id, NVODM_VOLTAGE_OFF, &settletime);
		}

		if (settletime)
			NvOdmOsWaitUS(settletime);  // wait to settle power
	}
}
예제 #13
0
/*
 * sdhci_simple_host_init - initialize this SDHCI host interface
 *
 * @id: the controller interface index (i.e. the port)
 */
int sdhci_simple_host_init(int id)
{
	struct sdhci_host *sdhost;
	struct tegra_sdhci_simple *host;
	NvU32 SettlingTime = 0;
	int ret = 0;

	sdhost = sdhci_simple_alloc_host(id);
	host = &tegra_sdhci_simple_host;

	NvOdmServicesPmuSetVoltage(host->hPmu,
			           host->VddAddress,
				   host->VddRailCaps.requestMilliVolts,
				   &SettlingTime);
	if (SettlingTime)
	{
		udelay(SettlingTime);
	}

	if (host->pinmux && host->nr_pins)
		tegra_pinmux_config_tristate_table(host->pinmux,
			host->nr_pins, TEGRA_TRI_NORMAL);
	clk_set_rate(host->clk, host->max_clk);
	clk_enable(host->clk);
	host->max_clk = clk_get_rate(host->clk);
	host->clk_enable = true;

	sdhost->ioaddr = host->ioaddr;
	sdhost->data_width = host->data_width;
	sdhost->start_offset = host->start_offset;
	sdhost->ops = &tegra_sdhci_simple_ops;
	sdhost->quirks =
		SDHCI_QUIRK_BROKEN_TIMEOUT_VAL |
		SDHCI_QUIRK_SINGLE_POWER_WRITE |
		SDHCI_QUIRK_ENABLE_INTERRUPT_AT_BLOCK_GAP |
		SDHCI_QUIRK_BROKEN_WRITE_PROTECT |
		SDHCI_QUIRK_BROKEN_CARD_DETECTION |
		SDHCI_QUIRK_BROKEN_CTRL_HISPD |
		SDHCI_QUIRK_RUNTIME_DISABLE |
		SDHCI_QUIRK_BROKEN_DMA |
		SDHCI_QUIRK_BROKEN_PIO;
#ifdef CONFIG_ARCH_TEGRA_2x_SOC
	sdhost->quirks |= SDHCI_QUIRK_BROKEN_SPEC_VERSION |
		SDHCI_QUIRK_NO_64KB_ADMA;
	sdhost->version = SDHCI_SPEC_200;
#endif

	ret = sdhci_simple_add_host(sdhost);
	if (ret) {
		pr_err("%s: failed to add host: %d (ignoring)\n", __func__, ret);
	}

	return ret;
}
예제 #14
0
static int star_vib_set_power_rail( u32 vdd_id, u8 is_enable )
{
printk("vib: %s,%d\n", __FUNCTION__, __LINE__);
#if	0	// by DENNIS
    NvOdmServicesPmuHandle h_pmu = NvOdmServicesPmuOpen();
    NvOdmServicesPmuVddRailCapabilities vddrailcap;
    u32 settletime;

    if(h_pmu)
    {
        NvOdmServicesPmuGetCapabilities( h_pmu, vdd_id, &vddrailcap );
        if( is_enable )
        {
#if VIB_DEBUG
            printk("[skhwang] vibrator PMU enable\n");
#endif
            NvOdmServicesPmuSetVoltage(h_pmu, vdd_id, vddrailcap.requestMilliVolts, &settletime);
        }
        else
        {
#if VIB_DEBUG
            printk("[skhwang] vibrator PMU do not enable\n");
#endif
            NvOdmServicesPmuSetVoltage(h_pmu, vdd_id, NVODM_VOLTAGE_OFF, &settletime);
        }

        if(settletime)
            NvOdmOsWaitUS(settletime);

        NvOdmServicesPmuClose(h_pmu);
#if VIB_DEBUG
        printk("[skhwang] vibrator voltage =  %d or %d \n", vddrailcap.requestMilliVolts, vddrailcap.MinMilliVolts);
#endif

        return 0;
    }

    return -1;
#endif
}
예제 #15
0
static void star_proxi_power_onoff(ProximityDevice *data, bool enable)
{
#if 1
    NvOdmServicesPmuHandle ldo_pmu = NvOdmServicesPmuOpen();
    NvOdmServicesPmuVddRailCapabilities vddrailcap;
    NvU32 settletime = 0;
    
        if (enable)
        {
            NvOdmServicesPmuGetCapabilities(ldo_pmu, data->vddId, &vddrailcap);
            NvOdmServicesPmuSetVoltage(ldo_pmu, data->vddId, vddrailcap.requestMilliVolts, &settletime);
        }
        else
        {
            NvOdmServicesPmuSetVoltage(ldo_pmu, data->vddId, NVODM_VOLTAGE_OFF, &settletime);
        }

    //if (settletime)
        NvOdmOsWaitUS(10000);   

        NvOdmServicesPmuClose(ldo_pmu);
#endif
}
예제 #16
0
static int __init touchLED_probe(struct platform_device *pdev)
{
    s_touchLED.conn = NvOdmPeripheralGetGuid( NV_ODM_GUID('t','o','u','c','h','L','E','D') );

    /* enable the power rail */
    s_touchLED.hPmu = NvOdmServicesPmuOpen();
    if( s_touchLED.conn->AddressList[0].Interface == NvOdmIoModule_Vdd )
    {
        NvOdmServicesPmuVddRailCapabilities cap;
        NvU32 settle_us;

        /* address is the vdd rail id */
        NvOdmServicesPmuGetCapabilities( s_touchLED.hPmu,
            s_touchLED.conn->AddressList[0].Address, &cap );

        s_touchLED.setVal = cap.requestMilliVolts;
        s_touchLED.maxVal = 100;    /*10.0mA*/

        /* set the rail volatage to the recommended */
        NvOdmServicesPmuSetVoltage( s_touchLED.hPmu,
            s_touchLED.conn->AddressList[0].Address, cap.requestMilliVolts,
            &settle_us );

        /* wait for rail to settle */
        NvOdmOsWaitUS( settle_us );
    }
    INIT_WORK(&s_touchLED.work, touchLED_timeout);

#ifdef TOUCH_LED_TIMER 
    hrtimer_init(&s_touchLED.timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
    s_touchLED.timer.function = touchLED_timer_func;
    s_touchLED.delay = TOUCH_DELAY_SEC;
    hrtimer_start(&s_touchLED.timer, ktime_set(BOOT_DELAY_SEC, 0), HRTIMER_MODE_REL);
#endif

#ifdef CONFIG_HAS_EARLYSUSPEND
    s_touchLED.early_suspend.level = EARLY_SUSPEND_LEVEL_BLANK_SCREEN + 1;
    s_touchLED.early_suspend.suspend = touchLED_early_suspend;
    s_touchLED.early_suspend.resume = touchLED_late_resume;
    register_early_suspend(&s_touchLED.early_suspend);
#endif

    //20101104, [email protected], WLED set [START]
    if (sysfs_create_group(&pdev->dev.kobj, &star_wled_group)) {
        printk(KERN_ERR "[star touch led] sysfs_create_group ERROR\n");
    }
    //20101104, [email protected], WLED set [END]

    return 0;
}
예제 #17
0
// 20100903  Power control bug fix [START]
static int star_hall_set_power_rail( NvU32 vdd_id, NvBool is_enable )
{
    NvOdmServicesPmuHandle h_pmu = NvOdmServicesPmuOpen();
    NvOdmServicesPmuVddRailCapabilities vddrailcap;
    NvU32 settletime;

    if(h_pmu)
    {   
        NvOdmServicesPmuGetCapabilities( h_pmu, vdd_id, &vddrailcap );
        if( is_enable )
        {   
            #if HALL_DEBUG
            printk("HALL IC PMU enable\n");
            #endif
            NvOdmServicesPmuSetVoltage(h_pmu, vdd_id, vddrailcap.requestMilliVolts, &settletime);
        }   
        else
        {   
            #if HALL_DEBUG
            printk("HALL IC PMU do not enable\n");
            #endif
            NvOdmServicesPmuSetVoltage(h_pmu, vdd_id, NVODM_VOLTAGE_OFF, &settletime);
        }   

        if(settletime)
            NvOdmOsWaitUS(settletime);

    	NvOdmServicesPmuClose(h_pmu);
#if HALL_DEBUG
        printk("[skhwang] HALL IC voltage =  %d or %d \n", vddrailcap.requestMilliVolts, vddrailcap.MinMilliVolts);
#endif
        return 0;
    }

    return -1;
}
예제 #18
0
/**
 *  @brief Stops the Vibro motor
 *  @param hOdmVibrate  [IN] Opaque handle to the device.
 *  @return NV_TRUE on success and NV_FALSE on error
 */
NvBool
NvOdmVibStop(NvOdmVibDeviceHandle hOdmVibrate)
{
/** 
 *  yuyang(20100801)
 *  ER vibration behavior is opposite to PR
 */
 
#if 1
 	int rv;
	
	if (Vib_mode) /* ER board */
	{
		rv = I2C_Write(hOdmVibrate, TPS6586x_R5B_PWM, 0xFF);
	}else{ /* PR board */
		rv = I2C_Write(hOdmVibrate, TPS6586x_R5B_PWM, 0x00);
	}
	
	if (rv != NV_TRUE)
		NV_ODM_TRACE(("Vibrator off: failed!\n"));
#else
    NvU32 SettlingTime;

    NV_ASSERT(hOdmVibrate);

    if (!hOdmVibrate)
    {
        return NV_FALSE;
    }

    if (hOdmVibrate->hOdmServicePmuDevice != NULL)
    {
        // Search for the Vdd rail and power Off the module
        if (hOdmVibrate->VddId)
        {
            NvOdmServicesPmuSetVoltage(hOdmVibrate->hOdmServicePmuDevice,
                        hOdmVibrate->VddId, NVODM_VOLTAGE_OFF, &SettlingTime);

            if (SettlingTime)
                NvOdmOsWaitUS(SettlingTime);
        }
    }
#endif	/* __yuyang(20100801) */

    return NV_TRUE;
}
예제 #19
0
static int headset_suspend(struct platform_device *pdev, pm_message_t state)
{
//20101117, [email protected], gpio wakeup from LP1 [START]
    if(core_lock_on && headset_vdd_address){
        NvOdmServicesPmuSetVoltage(headset_h_pmu, headset_vdd_address, headset_vdd_voltage, NULL);
    }
    suspend_status = 1;
//20101117, [email protected], gpio wakeup from LP1 [END]
    if(core_lock_on == 0){
    block_hook_int =1;
	headset_type = STAR_NONE;
    lprintk(D_AUDIO, KERN_ERR "##(Headset_det.c)## headset_suspend()!! disable hook int\n");
    }
	cancel_delayed_work_sync(&headset_sw_data->delayed_work);
	cancel_delayed_work_sync(&headset_sw_data->hook_delayed_work);
    
	return 0;
}
예제 #20
0
static ssize_t star_wled_store(struct device *dev, 
            struct device_attribute *attr, char *buf, size_t count)
{
    NvU8 val = 0;

    val = (NvU8)simple_strtoul(buf, NULL, 10);

    // 0~100 (0.0mA~10.0mA)
    if(val > s_touchLED.maxVal)
        s_touchLED.setVal = s_touchLED.maxVal;
    else
        s_touchLED.setVal = val;
    
#ifdef TOUCH_LED_TIMER
    hrtimer_cancel(&s_touchLED.timer);
#endif
    NvOdmServicesPmuSetVoltage(s_touchLED.hPmu, s_touchLED.conn->AddressList[0].Address, s_touchLED.setVal, NULL);

    return sprintf(buf, "wled : %duA\n", (int)s_touchLED.setVal*100);
}
예제 #21
0
static ssize_t star_pmic_store(struct device *dev, 
            struct device_attribute *attr, char *buf, size_t count)
{
    u32 val = 0;

    val = simple_strtoul(buf, NULL, 10);
    if(val){
        NvOdmPeripheralConnectivity const *conn = NULL;
        NvOdmServicesPmuHandle hPmu;

        conn = NvOdmPeripheralGetGuid( NV_ODM_GUID('p','m','_','r','e','s','e','t') );
        hPmu = NvOdmServicesPmuOpen();

        if(!conn){
            printk("ERROR : invalid GUID\n");
            sprintf(buf, "PMIC reset fail\n");
            return (ssize_t)(strlen(buf) + 1); 
        }
        
        if( conn->AddressList[0].Interface == NvOdmIoModule_Vdd )
        {
            NvU32 settle_us;
        
            /* set the rail volatage to the recommended */
            NvOdmServicesPmuSetVoltage( hPmu,
                conn->AddressList[0].Address, NVODM_VOLTAGE_OFF, &settle_us );
        
            /* wait for rail to settle */
            NvOdmOsWaitUS( settle_us );
        }

        NvOdmServicesPmuClose(hPmu);
    }
    sprintf(buf, "PMIC reset\n");
    printk("PMIC reset\n");

    return (ssize_t)(strlen(buf) + 1);
}
예제 #22
0
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;
}