bool tegra_udc_charger_detection(void) { NvDdkUsbPhyIoctl_DedicatedChargerDetectionInputArgs Charger; NvDdkUsbPhyIoctl_DedicatedChargerStatusOutputArgs Status; /* clear the input args */ NvOsMemset(&Charger, 0, sizeof(Charger)); /* enable the charger detection logic */ Charger.EnableChargerDetection = NV_TRUE; NV_ASSERT_SUCCESS(NvDdkUsbPhyIoctl( s_hUsbPhy, NvDdkUsbPhyIoctlType_DedicatedChargerDetection, &Charger, NULL)); /* get the charger detection status */ NV_ASSERT_SUCCESS(NvDdkUsbPhyIoctl( s_hUsbPhy, NvDdkUsbPhyIoctlType_DedicatedChargerStatus, NULL, &Status)); /* disable the charger detection */ Charger.EnableChargerDetection = NV_FALSE; NV_ASSERT_SUCCESS(NvDdkUsbPhyIoctl( s_hUsbPhy, NvDdkUsbPhyIoctlType_DedicatedChargerDetection, &Charger, NULL)); return Status.ChargerDetected; }
/* * Work thread function for setting the usb busy hints. * * This work thread is created to avoid the pre-emption from the ISR context. * Busy hints are controlled based on the USB transcations on the bus . * Busy hints function cannot be called from ISR as NvRmPowerBusyHintMulti() * uses vfree and vmalloc functions which are not supposed to call from the * ISR context */ static void tegra_ehci_busy_hint_work(struct work_struct* work) { struct tegra_hcd_platform_data *pdata = container_of(work, struct tegra_hcd_platform_data, work); NvDdkUsbPhyIoctl_UsbBusyHintsOnOffInputArgs busyhint; busyhint.OnOff = true; /* USB transfers will be done with in 1 sec, this need to be * * fine tuned (if required). with safe limit set to 2 sec */ busyhint.BoostDurationMs = 2000; NvDdkUsbPhyIoctl(pdata->hUsbPhy, NvDdkUsbPhyIoctlType_UsbBusyHintsOnOff, &busyhint, NULL); }