Loading drivers/usb/gadget/function/f_gsi.c +24 −7 Original line number Diff line number Diff line Loading @@ -580,9 +580,12 @@ static int ipa_connect_channels(struct gsi_data_port *d_port) GSI_EP_OP_GET_CH_INFO); log_event_dbg("%s: USB GSI IN OPS Completed", __func__); in_params->client = (gsi->prot_id != USB_PROT_DIAG_IPA) ? IPA_CLIENT_USB_CONS : IPA_CLIENT_USB_DPL_CONS; if (gsi->prot_id != USB_PROT_DIAG_IPA) in_params->client = (gsi->prot_id != USB_PROT_RMNET_V2X_IPA) ? IPA_CLIENT_USB_CONS : IPA_CLIENT_USB2_CONS; else in_params->client = IPA_CLIENT_USB_DPL_CONS; in_params->ipa_ep_cfg.mode.mode = IPA_BASIC; in_params->teth_prot = (enum ipa_usb_teth_prot)gsi->prot_id; in_params->gevntcount_low_addr = Loading Loading @@ -637,7 +640,8 @@ static int ipa_connect_channels(struct gsi_data_port *d_port) usb_gsi_ep_op(d_port->out_ep, (void *)&gsi_channel_info, GSI_EP_OP_GET_CH_INFO); log_event_dbg("%s: USB GSI OUT OPS Completed", __func__); out_params->client = IPA_CLIENT_USB_PROD; out_params->client = (gsi->prot_id != USB_PROT_RMNET_V2X_IPA) ? IPA_CLIENT_USB_PROD : IPA_CLIENT_USB2_PROD; out_params->ipa_ep_cfg.mode.mode = IPA_BASIC; out_params->teth_prot = (enum ipa_usb_teth_prot)gsi->prot_id; out_params->gevntcount_low_addr = Loading Loading @@ -1499,6 +1503,7 @@ static long gsi_ctrl_dev_ioctl(struct file *fp, unsigned int cmd, case GSI_MBIM_GPS_USB_STATUS: val = atomic_read(&gsi->connected); if (gsi->prot_id == USB_PROT_RMNET_IPA || gsi->prot_id == USB_PROT_RMNET_V2X_IPA || gsi->prot_id == USB_PROT_RMNET_ETHER) val = gsi->rmnet_dtr_status; Loading Loading @@ -1713,6 +1718,9 @@ static int gsi_function_ctrl_port_init(struct f_gsi *gsi) case USB_PROT_RMNET_ETHER: cdev_name = ETHER_RMNET_CTRL_NAME; break; case USB_PROT_RMNET_V2X_IPA: cdev_name = GSI_RMNET_V2X_CTRL_NAME; break; case USB_PROT_MBIM_IPA: cdev_name = GSI_MBIM_CTRL_NAME; break; Loading Loading @@ -2209,6 +2217,7 @@ gsi_setup(struct usb_function *f, const struct usb_ctrlrequest *ctrl) | USB_CDC_REQ_SET_CONTROL_LINE_STATE: line_state = (w_value & GSI_CTRL_DTR ? true : false); if (gsi->prot_id == USB_PROT_RMNET_IPA || gsi->prot_id == USB_PROT_RMNET_V2X_IPA || gsi->prot_id == USB_PROT_RMNET_ETHER) gsi->rmnet_dtr_status = line_state; log_event_dbg("%s: USB_CDC_REQ_SET_CONTROL_LINE_STATE DTR:%d\n", Loading Loading @@ -2312,6 +2321,7 @@ static int gsi_get_alt(struct usb_function *f, unsigned int intf) /* RNDIS, RMNET and DPL only support alt 0*/ if (intf == gsi->ctrl_id || gsi->prot_id == USB_PROT_RNDIS_IPA || gsi->prot_id == USB_PROT_RMNET_IPA || gsi->prot_id == USB_PROT_RMNET_V2X_IPA || gsi->prot_id == USB_PROT_DIAG_IPA || is_ext_prot_ether(gsi->prot_id)) return 0; Loading @@ -2333,6 +2343,7 @@ static int gsi_set_alt(struct usb_function *f, unsigned int intf, /* Control interface has only altsetting 0 */ if (intf == gsi->ctrl_id || gsi->prot_id == USB_PROT_RMNET_IPA || gsi->prot_id == USB_PROT_RMNET_V2X_IPA || gsi->prot_id == USB_PROT_RMNET_ETHER) { if (alt != 0) goto fail; Loading Loading @@ -2369,6 +2380,7 @@ static int gsi_set_alt(struct usb_function *f, unsigned int intf, /* for rndis and rmnet alt is always 0 update alt accordingly */ if (gsi->prot_id == USB_PROT_RNDIS_IPA || gsi->prot_id == USB_PROT_RMNET_IPA || gsi->prot_id == USB_PROT_RMNET_V2X_IPA || gsi->prot_id == USB_PROT_DIAG_IPA || is_ext_prot_ether(gsi->prot_id)) alt = 1; Loading Loading @@ -2398,7 +2410,7 @@ static int gsi_set_alt(struct usb_function *f, unsigned int intf, } /* Configure EPs for GSI */ if (gsi->prot_id <= USB_PROT_DIAG_IPA) { if (gsi->prot_id <= USB_PROT_RMNET_V2X_IPA) { if (gsi->d_port.in_ep) { usb_gsi_ep_op(gsi->d_port.in_ep, &gsi->d_port.in_request, Loading Loading @@ -2501,6 +2513,7 @@ static void gsi_disable(struct usb_function *f) rndis_uninit(gsi->params); if (gsi->prot_id == USB_PROT_RMNET_IPA || gsi->prot_id == USB_PROT_RMNET_V2X_IPA || gsi->prot_id == USB_PROT_RMNET_ETHER) gsi->rmnet_dtr_status = false; Loading Loading @@ -2728,7 +2741,7 @@ static int gsi_update_function_bind_params(struct f_gsi *gsi, info->data_nop_desc->bInterfaceNumber = gsi->data_id; /* allocate instance-specific endpoints */ if (info->fs_in_desc && gsi->prot_id <= USB_PROT_DIAG_IPA) { if (info->fs_in_desc && gsi->prot_id <= USB_PROT_RMNET_V2X_IPA) { ep = usb_ep_autoconfig_by_name(cdev->gadget, info->fs_in_desc, info->in_epname); if (!ep) Loading @@ -2746,7 +2759,7 @@ static int gsi_update_function_bind_params(struct f_gsi *gsi, } } if (info->fs_out_desc && gsi->prot_id <= USB_PROT_DIAG_IPA) { if (info->fs_out_desc && gsi->prot_id <= USB_PROT_RMNET_V2X_IPA) { ep = usb_ep_autoconfig_by_name(cdev->gadget, info->fs_out_desc, info->out_epname); if (!ep) Loading Loading @@ -2898,6 +2911,7 @@ static int gsi_bind(struct usb_configuration *c, struct usb_function *f) if (gsi->prot_id == USB_PROT_RMNET_IPA || gsi->prot_id == USB_PROT_RMNET_V2X_IPA || gsi->prot_id == USB_PROT_DIAG_IPA || is_ext_prot_ether(gsi->prot_id)) gsi->ctrl_id = -ENODEV; Loading Loading @@ -3109,6 +3123,7 @@ static int gsi_bind(struct usb_configuration *c, struct usb_function *f) } break; case USB_PROT_RMNET_IPA: case USB_PROT_RMNET_V2X_IPA: case USB_PROT_RMNET_ETHER: info.string_defs = rmnet_gsi_string_defs; info.data_desc = &rmnet_gsi_interface_desc; Loading Loading @@ -3365,6 +3380,7 @@ static int gsi_bind_config(struct f_gsi *gsi) gsi->function.strings = ecm_gsi_strings; break; case USB_PROT_RMNET_IPA: case USB_PROT_RMNET_V2X_IPA: case USB_PROT_RMNET_ETHER: gsi->function.name = "rmnet"; gsi->function.strings = rmnet_gsi_strings; Loading Loading @@ -3767,6 +3783,7 @@ static int usb_gsi_uevent(struct device *dev, struct kobj_uevent_env *env) switch (gsi->prot_id) { case USB_PROT_RMNET_IPA: case USB_PROT_RMNET_V2X_IPA: case USB_PROT_RMNET_ETHER: str = gsi->rmnet_dtr_status ? "connected" : "disconnected"; break; Loading drivers/usb/gadget/function/f_gsi.h +5 −1 Original line number Diff line number Diff line /* * Copyright (c) 2015-2019, The Linux Foundation. All rights reserved. * Copyright (c) 2015-2020, The Linux Foundation. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and Loading Loading @@ -33,6 +33,7 @@ #include "configfs.h" #define GSI_RMNET_CTRL_NAME "rmnet_ctrl" #define GSI_RMNET_V2X_CTRL_NAME "rmnet_v2x_ctrl" #define GSI_MBIM_CTRL_NAME "android_mbim" #define GSI_DPL_CTRL_NAME "dpl_ctrl" #define ETHER_RMNET_CTRL_NAME "rmnet_ctrl0" Loading Loading @@ -130,6 +131,7 @@ enum usb_prot_id { USB_PROT_RMNET_IPA, USB_PROT_MBIM_IPA, USB_PROT_DIAG_IPA, USB_PROT_RMNET_V2X_IPA, /* non-accelerated */ USB_PROT_RMNET_ETHER, Loading Loading @@ -345,6 +347,8 @@ static int name_to_prot_id(const char *name) return USB_PROT_DIAG_IPA; if (!strncasecmp(name, "rmnet.ether", MAX_INST_NAME_LEN)) return USB_PROT_RMNET_ETHER; if (!strncasecmp(name, "rmnet.v2x", MAX_INST_NAME_LEN)) return USB_PROT_RMNET_V2X_IPA; if (!strncasecmp(name, "dpl.ether", MAX_INST_NAME_LEN)) return USB_PROT_DPL_ETHER; if (!strncasecmp(name, "gps", MAX_INST_NAME_LEN)) Loading Loading
drivers/usb/gadget/function/f_gsi.c +24 −7 Original line number Diff line number Diff line Loading @@ -580,9 +580,12 @@ static int ipa_connect_channels(struct gsi_data_port *d_port) GSI_EP_OP_GET_CH_INFO); log_event_dbg("%s: USB GSI IN OPS Completed", __func__); in_params->client = (gsi->prot_id != USB_PROT_DIAG_IPA) ? IPA_CLIENT_USB_CONS : IPA_CLIENT_USB_DPL_CONS; if (gsi->prot_id != USB_PROT_DIAG_IPA) in_params->client = (gsi->prot_id != USB_PROT_RMNET_V2X_IPA) ? IPA_CLIENT_USB_CONS : IPA_CLIENT_USB2_CONS; else in_params->client = IPA_CLIENT_USB_DPL_CONS; in_params->ipa_ep_cfg.mode.mode = IPA_BASIC; in_params->teth_prot = (enum ipa_usb_teth_prot)gsi->prot_id; in_params->gevntcount_low_addr = Loading Loading @@ -637,7 +640,8 @@ static int ipa_connect_channels(struct gsi_data_port *d_port) usb_gsi_ep_op(d_port->out_ep, (void *)&gsi_channel_info, GSI_EP_OP_GET_CH_INFO); log_event_dbg("%s: USB GSI OUT OPS Completed", __func__); out_params->client = IPA_CLIENT_USB_PROD; out_params->client = (gsi->prot_id != USB_PROT_RMNET_V2X_IPA) ? IPA_CLIENT_USB_PROD : IPA_CLIENT_USB2_PROD; out_params->ipa_ep_cfg.mode.mode = IPA_BASIC; out_params->teth_prot = (enum ipa_usb_teth_prot)gsi->prot_id; out_params->gevntcount_low_addr = Loading Loading @@ -1499,6 +1503,7 @@ static long gsi_ctrl_dev_ioctl(struct file *fp, unsigned int cmd, case GSI_MBIM_GPS_USB_STATUS: val = atomic_read(&gsi->connected); if (gsi->prot_id == USB_PROT_RMNET_IPA || gsi->prot_id == USB_PROT_RMNET_V2X_IPA || gsi->prot_id == USB_PROT_RMNET_ETHER) val = gsi->rmnet_dtr_status; Loading Loading @@ -1713,6 +1718,9 @@ static int gsi_function_ctrl_port_init(struct f_gsi *gsi) case USB_PROT_RMNET_ETHER: cdev_name = ETHER_RMNET_CTRL_NAME; break; case USB_PROT_RMNET_V2X_IPA: cdev_name = GSI_RMNET_V2X_CTRL_NAME; break; case USB_PROT_MBIM_IPA: cdev_name = GSI_MBIM_CTRL_NAME; break; Loading Loading @@ -2209,6 +2217,7 @@ gsi_setup(struct usb_function *f, const struct usb_ctrlrequest *ctrl) | USB_CDC_REQ_SET_CONTROL_LINE_STATE: line_state = (w_value & GSI_CTRL_DTR ? true : false); if (gsi->prot_id == USB_PROT_RMNET_IPA || gsi->prot_id == USB_PROT_RMNET_V2X_IPA || gsi->prot_id == USB_PROT_RMNET_ETHER) gsi->rmnet_dtr_status = line_state; log_event_dbg("%s: USB_CDC_REQ_SET_CONTROL_LINE_STATE DTR:%d\n", Loading Loading @@ -2312,6 +2321,7 @@ static int gsi_get_alt(struct usb_function *f, unsigned int intf) /* RNDIS, RMNET and DPL only support alt 0*/ if (intf == gsi->ctrl_id || gsi->prot_id == USB_PROT_RNDIS_IPA || gsi->prot_id == USB_PROT_RMNET_IPA || gsi->prot_id == USB_PROT_RMNET_V2X_IPA || gsi->prot_id == USB_PROT_DIAG_IPA || is_ext_prot_ether(gsi->prot_id)) return 0; Loading @@ -2333,6 +2343,7 @@ static int gsi_set_alt(struct usb_function *f, unsigned int intf, /* Control interface has only altsetting 0 */ if (intf == gsi->ctrl_id || gsi->prot_id == USB_PROT_RMNET_IPA || gsi->prot_id == USB_PROT_RMNET_V2X_IPA || gsi->prot_id == USB_PROT_RMNET_ETHER) { if (alt != 0) goto fail; Loading Loading @@ -2369,6 +2380,7 @@ static int gsi_set_alt(struct usb_function *f, unsigned int intf, /* for rndis and rmnet alt is always 0 update alt accordingly */ if (gsi->prot_id == USB_PROT_RNDIS_IPA || gsi->prot_id == USB_PROT_RMNET_IPA || gsi->prot_id == USB_PROT_RMNET_V2X_IPA || gsi->prot_id == USB_PROT_DIAG_IPA || is_ext_prot_ether(gsi->prot_id)) alt = 1; Loading Loading @@ -2398,7 +2410,7 @@ static int gsi_set_alt(struct usb_function *f, unsigned int intf, } /* Configure EPs for GSI */ if (gsi->prot_id <= USB_PROT_DIAG_IPA) { if (gsi->prot_id <= USB_PROT_RMNET_V2X_IPA) { if (gsi->d_port.in_ep) { usb_gsi_ep_op(gsi->d_port.in_ep, &gsi->d_port.in_request, Loading Loading @@ -2501,6 +2513,7 @@ static void gsi_disable(struct usb_function *f) rndis_uninit(gsi->params); if (gsi->prot_id == USB_PROT_RMNET_IPA || gsi->prot_id == USB_PROT_RMNET_V2X_IPA || gsi->prot_id == USB_PROT_RMNET_ETHER) gsi->rmnet_dtr_status = false; Loading Loading @@ -2728,7 +2741,7 @@ static int gsi_update_function_bind_params(struct f_gsi *gsi, info->data_nop_desc->bInterfaceNumber = gsi->data_id; /* allocate instance-specific endpoints */ if (info->fs_in_desc && gsi->prot_id <= USB_PROT_DIAG_IPA) { if (info->fs_in_desc && gsi->prot_id <= USB_PROT_RMNET_V2X_IPA) { ep = usb_ep_autoconfig_by_name(cdev->gadget, info->fs_in_desc, info->in_epname); if (!ep) Loading @@ -2746,7 +2759,7 @@ static int gsi_update_function_bind_params(struct f_gsi *gsi, } } if (info->fs_out_desc && gsi->prot_id <= USB_PROT_DIAG_IPA) { if (info->fs_out_desc && gsi->prot_id <= USB_PROT_RMNET_V2X_IPA) { ep = usb_ep_autoconfig_by_name(cdev->gadget, info->fs_out_desc, info->out_epname); if (!ep) Loading Loading @@ -2898,6 +2911,7 @@ static int gsi_bind(struct usb_configuration *c, struct usb_function *f) if (gsi->prot_id == USB_PROT_RMNET_IPA || gsi->prot_id == USB_PROT_RMNET_V2X_IPA || gsi->prot_id == USB_PROT_DIAG_IPA || is_ext_prot_ether(gsi->prot_id)) gsi->ctrl_id = -ENODEV; Loading Loading @@ -3109,6 +3123,7 @@ static int gsi_bind(struct usb_configuration *c, struct usb_function *f) } break; case USB_PROT_RMNET_IPA: case USB_PROT_RMNET_V2X_IPA: case USB_PROT_RMNET_ETHER: info.string_defs = rmnet_gsi_string_defs; info.data_desc = &rmnet_gsi_interface_desc; Loading Loading @@ -3365,6 +3380,7 @@ static int gsi_bind_config(struct f_gsi *gsi) gsi->function.strings = ecm_gsi_strings; break; case USB_PROT_RMNET_IPA: case USB_PROT_RMNET_V2X_IPA: case USB_PROT_RMNET_ETHER: gsi->function.name = "rmnet"; gsi->function.strings = rmnet_gsi_strings; Loading Loading @@ -3767,6 +3783,7 @@ static int usb_gsi_uevent(struct device *dev, struct kobj_uevent_env *env) switch (gsi->prot_id) { case USB_PROT_RMNET_IPA: case USB_PROT_RMNET_V2X_IPA: case USB_PROT_RMNET_ETHER: str = gsi->rmnet_dtr_status ? "connected" : "disconnected"; break; Loading
drivers/usb/gadget/function/f_gsi.h +5 −1 Original line number Diff line number Diff line /* * Copyright (c) 2015-2019, The Linux Foundation. All rights reserved. * Copyright (c) 2015-2020, The Linux Foundation. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and Loading Loading @@ -33,6 +33,7 @@ #include "configfs.h" #define GSI_RMNET_CTRL_NAME "rmnet_ctrl" #define GSI_RMNET_V2X_CTRL_NAME "rmnet_v2x_ctrl" #define GSI_MBIM_CTRL_NAME "android_mbim" #define GSI_DPL_CTRL_NAME "dpl_ctrl" #define ETHER_RMNET_CTRL_NAME "rmnet_ctrl0" Loading Loading @@ -130,6 +131,7 @@ enum usb_prot_id { USB_PROT_RMNET_IPA, USB_PROT_MBIM_IPA, USB_PROT_DIAG_IPA, USB_PROT_RMNET_V2X_IPA, /* non-accelerated */ USB_PROT_RMNET_ETHER, Loading Loading @@ -345,6 +347,8 @@ static int name_to_prot_id(const char *name) return USB_PROT_DIAG_IPA; if (!strncasecmp(name, "rmnet.ether", MAX_INST_NAME_LEN)) return USB_PROT_RMNET_ETHER; if (!strncasecmp(name, "rmnet.v2x", MAX_INST_NAME_LEN)) return USB_PROT_RMNET_V2X_IPA; if (!strncasecmp(name, "dpl.ether", MAX_INST_NAME_LEN)) return USB_PROT_DPL_ETHER; if (!strncasecmp(name, "gps", MAX_INST_NAME_LEN)) Loading