static void bam2bam_data_suspend_work(struct work_struct *w)
{
	struct bam_data_port *port =
			container_of(w, struct bam_data_port, suspend_w);
	struct bam_data_ch_info *d = &port->data_ch;
	int ret;

	pr_debug("%s: suspend work started\n", __func__);

	if (!port->is_connected) {
		pr_info("%s: Port is disconnected. Bailing out.\n", __func__);
		return;
	}

	ret = usb_bam_register_wake_cb(d->dst_connection_idx,
					bam_data_wake_cb, port);
	if (ret) {
		pr_err("%s(): Failed to register BAM wake callback.\n",
			__func__);
		return;
	}

	if (d->trans == USB_GADGET_XPORT_BAM2BAM_IPA) {
		usb_bam_register_start_stop_cbs(d->dst_connection_idx,
						bam_data_start, bam_data_stop,
						port);
		usb_bam_suspend(&d->ipa_params);
	}
}
static void bam2bam_data_suspend_work(struct work_struct *w)
{
    struct bam_data_port *port =
        container_of(w, struct bam_data_port, suspend_w);
    struct bam_data_ch_info *d = &port->data_ch;

    pr_debug("%s: suspend work started\n", __func__);

    usb_bam_register_wake_cb(d->dst_connection_idx, bam_data_wake_cb, port);
    if (d->trans == USB_GADGET_XPORT_BAM2BAM_IPA) {
        usb_bam_register_start_stop_cbs(bam_data_start, bam_data_stop,
                                        port);
        usb_bam_suspend(&d->ipa_params);
    }
}
Esempio n. 3
0
/**
 * ipa_data_suspend() - Initiate USB BAM IPA suspend functionality
 * @gp: Gadget IPA port
 * @port_num: port number used by function
 *
 * It is being used to initiate USB BAM IPA suspend functionality
 * for USB bus suspend functionality.
 */
void ipa_data_suspend(struct gadget_ipa_port *gp, u8 port_num)
{
	struct ipa_data_ch_info *port;
	int ret;

	pr_debug("dev:%p port number:%d\n", gp, port_num);

	if (port_num >= n_ipa_ports) {
		pr_err("invalid ipa portno#%d\n", port_num);
		return;
	}

	if (!gp) {
		pr_err("data port is null\n");
		return;
	}

	port = ipa_data_ports[port_num];
	if (!port) {
		pr_err("port %u is NULL", port_num);
		return;
	}

	pr_debug("%s: suspend started\n", __func__);
	ret = usb_bam_register_wake_cb(port->dst_connection_idx,
						NULL, port);
	if (ret) {
		pr_err("%s(): Failed to register BAM wake callback.\n",
				__func__);
		return;
	}

	usb_bam_register_start_stop_cbs(port->dst_connection_idx,
				ipa_data_start, ipa_data_stop, port);
	usb_bam_suspend(&port->ipa_params);
}