Exemplo n.º 1
0
static void acm_read_bulk_callback(struct urb *urb)
{
	struct acm_rb *rb = urb->context;
	struct acm *acm = rb->instance;
	unsigned long flags;
	static int eproto_count = 0;
	D("%s - urb %d, len %d\n", __func__,
					rb->index, urb->actual_length);
	set_bit(rb->index, &acm->read_urbs_free);

	if (!acm->dev) {
		D("%s - disconnected\n", __func__);
		return;
	}
	usb_mark_last_busy(acm->dev);

	if (urb->status && !urb->actual_length) {
		if (urb->status == -EPROTO && eproto_count < 20){
			D("%s: cdc-acm EPROTO Hit %d times!\n", __func__, eproto_count+1);			
			if(eproto_count == 0){
				debug_gpio_dump();
			}
			eproto_count++;
			return;
		}else{
			return;
		}
	}

	/* clear count if urb->status = 0 */
	eproto_count = 0;

	acm_process_read_urb(acm, urb);

	/* throttle device if requested by tty */
	spin_lock_irqsave(&acm->read_lock, flags);
	acm->throttled = acm->throttle_req;
	if (!acm->throttled && !acm->susp_count) {
		spin_unlock_irqrestore(&acm->read_lock, flags);
		acm_submit_read_urb(acm, rb->index, GFP_ATOMIC);
	} else {
		spin_unlock_irqrestore(&acm->read_lock, flags);
	}
}
static void baseband_xmm_power2_flashless_pm_ver_ge_1130_step3
	(struct work_struct *work)
{
	int X = XYZ / 1000000;
	int Y = XYZ / 1000 - X * 1000;
	int Z = XYZ % 1000;
	int enum_success = 0;
	int loop = 0;
	int loop_max = 30;

	pr_debug("%s {\n", __func__);

	pr_debug("XYZ=%ld X=%d Y=%d Z=%d\n", XYZ, X, Y, Z);

	/* check for platform data */
	if (!baseband_power2_driver_data)
		return;

	/* polling enumeration every 100msec up to 3sec */
	for(loop = 0; (loop < loop_max)&&(enum_success == 0); loop++) {
		/* wait 100 ms */
		msleep(100);

		/* check if enumeration succeeded */
		{
			mm_segment_t oldfs;
			struct file *filp;
			oldfs = get_fs();
			set_fs(KERNEL_DS);

			filp = filp_open("/dev/ttyACM0",
					O_RDONLY, 0);

			if (IS_ERR(filp) || (filp == NULL))
			{
				if (loop < loop_max-1)
				{
					pr_debug("polling /dev/ttyACM0 %d times\n", loop+1);
				}
				else
				{
					pr_debug("polling /dev/ttyACM0 %d times\n", loop+1);
					pr_err("open /dev/ttyACM0 failed %ld\n",
					PTR_ERR(filp));
#if 0
					debug_gpio_dump();
					if (!board_mfg_mode())
					{
						trigger_radio_fatal_get_coredump("2nd enum step3 failed");
					}
#endif
				}
			}
			else
			{
				enum_success = 1;
				filp_close(filp, NULL);
			}
			set_fs(oldfs);
		}
	}

	/* if enumeration failed, attempt recovery pulse */
	if (!enum_success) {
		pr_debug("attempting recovery pulse...\n");
		/* wait 20 ms */
		msleep(20);
		/* set IPC_HSIC_ACTIVE low */
		gpio_set_value(baseband_power2_driver_data->
			modem.xmm.ipc_hsic_active, 0);
		/* wait 20 ms */
		msleep(20);
		/* set IPC_HSIC_ACTIVE high */
		gpio_set_value(baseband_power2_driver_data->
			modem.xmm.ipc_hsic_active, 1);
		/* check if recovery pulse worked */
		baseband_xmm_power2_work->state =
			BBXMM_WORK_INIT_FLASHLESS_PM_VER_GE_1130_STEP4;
		queue_work(workqueue, (struct work_struct *)
			baseband_xmm_power2_work);
	} else
		pr_debug("%s - enum success\n", __func__);

//	pr_debug("VP:%s - pm qos CPU back to normal\n", __func__);
//	pm_qos_update_request(&modem_boost_cpu_freq_req,
//		(s32)PM_QOS_CPU_FREQ_MIN_DEFAULT_VALUE);

	pr_debug("%s }\n", __func__);
}
Exemplo n.º 3
0
static irqreturn_t tegra_ehci_irq(struct usb_hcd *hcd)
{
	struct tegra_ehci_hcd *tegra = dev_get_drvdata(hcd->self.controller);
	struct ehci_hcd *ehci = hcd_to_ehci(hcd);
	irqreturn_t irq_status;
	bool pmc_remote_wakeup = false;
	struct platform_device *pdev = container_of(hcd->self.controller, struct platform_device, dev);
	int ehci_id = pdev->id;

	spin_lock(&ehci->lock);
	irq_status = tegra_usb_phy_irq(tegra->phy);
	if (irq_status == IRQ_NONE) {
		spin_unlock(&ehci->lock);
		return irq_status;
	}
	if (tegra_usb_phy_remote_wakeup(tegra->phy)) {
		ehci_info(ehci, "remote wakeup detected on controller.%d\n", ehci_id);

		/* +SSD_RIL: workaround for remote wake AT timeout. */
		if (Modem_is_IMC() && ehci_id == MODEM_EHCI_ID)
		{
			debug_gpio_dump();
			//trigger_radio_fatal_get_coredump("remote wakeup in PMC");
		}
		else
		{
			pmc_remote_wakeup = true;
			usb_hcd_resume_root_hub(hcd);
		}
		/* -SSD_RIL: workaround for remote wake AT timeout. */

		spin_unlock(&ehci->lock);
		return irq_status;
	}
	spin_unlock(&ehci->lock);

//	EHCI_DBG("%s() cmd = 0x%x, int_sts = 0x%x, portsc = 0x%x\n", __func__,
//		ehci_readl(ehci, &ehci->regs->command),
//		ehci_readl(ehci, &ehci->regs->status),
//		ehci_readl(ehci, &ehci->regs->port_status[0]));

	irq_status = ehci_irq(hcd);

	if (pmc_remote_wakeup) {
		ehci->controller_remote_wakeup = false;
	}

	if (ehci->controller_remote_wakeup) {
		ehci->controller_remote_wakeup = false;

		/* +SSD_RIL: workaround for remote wake hang. */
		if (Modem_is_IMC() && ehci_id == MODEM_EHCI_ID)
		{
			ehci_info(ehci, "controller.%d remote wakeup detected", ehci_id);
			debug_gpio_dump();
			//trigger_radio_fatal_get_coredump("remote wakeup in controller");
		}
		else
		{
			tegra_usb_phy_pre_resume(tegra->phy, true);
			tegra->port_resuming = 1;
		}
		/* -SSD_RIL: workaround for remote wake hang. */
	}
	return irq_status;
}