static int tegra_lvibrator_power_on(int freq, int duty_cycle) { NvU32 ReqPeriod, RetPeriod; printk("tegra_lvibrator_power_on\n"); if (hOdmPwm) { NvOdmPwmClose(hOdmPwm); hOdmPwm = NULL; } hOdmPwm = NvOdmPwmOpen(); if (!hOdmPwm) { printk("pwm vib: NvOdmPwmOpen failed\n"); return NV_FALSE; } ReqPeriod = freq; NvOdmPwmConfig(hOdmPwm, NvOdmPwmOutputId_PWM1, NvOdmPwmMode_Enable, duty_cycle, &ReqPeriod, &RetPeriod); printk("Requested %d, ReturnPeriod=%d \n", ReqPeriod, RetPeriod); regulator_set_voltage(tegra_vibrator_regulator, 3000000, 3000000); return regulator_enable(tegra_vibrator_regulator); }
static NvBool SdioOdmWlanPower(NvOdmSdioHandle hOdmSdio, NvBool IsEnable) { NvU32 RequestedPeriod, ReturnedPeriod; NvOdmServicesPwmHandle hOdmPwm = NULL; if (IsEnable) { // Wlan Power On Reset Sequence NvOdmGpioSetState(hOdmSdio->hGpio, hOdmSdio->hPwrPin, 0x0); NvOdmGpioSetState(hOdmSdio->hGpio, hOdmSdio->hResetPin, 0x0); NvOdmOsSleepMS(200); NvOdmGpioSetState(hOdmSdio->hGpio, hOdmSdio->hPwrPin, 0x1); NvOdmGpioSetState(hOdmSdio->hGpio, hOdmSdio->hResetPin, 0x1); NvOdmOsSleepMS(200); // Enable 32KHz clock out hOdmPwm = NvOdmPwmOpen(); if (!hOdmPwm) { NvOsDebugPrintf("sdio_odm: NvOdmPwmOpen failed\n"); return NV_FALSE; } RequestedPeriod = 0; NvOdmPwmConfig(hOdmPwm, NvOdmPwmOutputId_Blink, NvOdmPwmMode_Blink_32KHzClockOutput, 0, &RequestedPeriod, &ReturnedPeriod); NvOdmPwmClose(hOdmPwm); } else { // Power Off sequence NvOdmGpioSetState(hOdmSdio->hGpio, hOdmSdio->hPwrPin, 0x0); } return NV_TRUE; }
static void tegra_lvibrator_exit(void) { if(hOdmPwm != NULL) { NvOdmPwmClose(hOdmPwm); } regulator_put(tegra_vibrator_regulator); }
// enable 32Khz clock used by bcm4329 wifi, bluetooth and gps static void __init tegra_setup_32khz_clock(void) { int RequestedPeriod, ReturnedPeriod; NvOdmServicesPwmHandle hOdmPwm = NULL; hOdmPwm = NvOdmPwmOpen(); if (!hOdmPwm) { pr_err("%s: failed to open NvOdmPwmOpen\n", __func__); return; } RequestedPeriod = 0; NvOdmPwmConfig(hOdmPwm, NvOdmPwmOutputId_Blink, NvOdmPwmMode_Blink_32KHzClockOutput, 0, &RequestedPeriod, &ReturnedPeriod); NvOdmPwmClose(hOdmPwm); }
static int tegra_lvibrator_power_off(void) { NvU32 ReqPeriod, RetPeriod; ReqPeriod = 0; if (hOdmPwm != NULL) { NvOdmPwmConfig(hOdmPwm, NvOdmPwmOutputId_PWM1, NvOdmPwmMode_Disable, 0, &ReqPeriod, &RetPeriod); NvOdmPwmClose(hOdmPwm); hOdmPwm = NULL; } if (tegra_vibrator_regulator) return regulator_disable(tegra_vibrator_regulator); }