mirror of
https://github.com/team-infusion-developers/android_kernel_samsung_msm8976.git
synced 2024-11-01 02:21:16 +00:00
usb_bam: changes for HSIC IPA functionality
Add support for HSIC device mode Change-Id: Ibe20b01ef657cb820e3b94d4b85ace828fad58ba Signed-off-by: Mayank Rana <mrana@codeaurora.org> Signed-off-by: Gilad Broner <gbroner@codeaurora.org> Signed-off-by: Lena Salman <esalman@codeaurora.org>
This commit is contained in:
parent
ed57b23277
commit
5a11767bc9
4 changed files with 56 additions and 28 deletions
|
@ -262,7 +262,8 @@ static int get_bam_type_from_core_name(const char *name)
|
|||
strnstr(name, "dwc3", USB_BAM_MAX_STR_LEN))
|
||||
return DWC3_CTRL;
|
||||
else if (strnstr(name, bam_enable_strings[HSIC_CTRL],
|
||||
USB_BAM_MAX_STR_LEN))
|
||||
USB_BAM_MAX_STR_LEN) ||
|
||||
strnstr(name, "ci13xxx_msm_hsic", USB_BAM_MAX_STR_LEN))
|
||||
return HSIC_CTRL;
|
||||
else if (strnstr(name, bam_enable_strings[CI_CTRL],
|
||||
USB_BAM_MAX_STR_LEN) ||
|
||||
|
@ -3480,6 +3481,12 @@ int usb_bam_get_connection_idx(const char *core_name, enum peer_bam client,
|
|||
}
|
||||
EXPORT_SYMBOL(usb_bam_get_connection_idx);
|
||||
|
||||
int usb_bam_get_bam_type(int connection_idx)
|
||||
{
|
||||
return usb_bam_connections[connection_idx].bam_type;
|
||||
}
|
||||
EXPORT_SYMBOL(usb_bam_get_bam_type);
|
||||
|
||||
bool msm_bam_device_lpm_ok(enum usb_ctrl bam_type)
|
||||
{
|
||||
pr_debug("%s: enter bam%s\n", __func__, bam_enable_strings[bam_type]);
|
||||
|
|
|
@ -3613,8 +3613,8 @@ static int android_create_device(struct android_dev *dev, u8 usb_core_id)
|
|||
snprintf(device_node_name, ANDROID_DEVICE_NODE_NAME_LENGTH,
|
||||
"android%d", usb_core_id);
|
||||
pr_debug("%s(): creating android%d device\n", __func__, usb_core_id);
|
||||
dev->dev = device_create(android_class, NULL,
|
||||
MKDEV(0, 0), NULL, device_node_name);
|
||||
dev->dev = device_create(android_class, NULL, MKDEV(0, usb_core_id),
|
||||
NULL, device_node_name);
|
||||
if (IS_ERR(dev->dev))
|
||||
return PTR_ERR(dev->dev);
|
||||
|
||||
|
|
|
@ -910,22 +910,20 @@ static void bam2bam_data_connect_work(struct work_struct *w)
|
|||
|
||||
d_port->ipa_consumer_ep = d->ipa_params.ipa_cons_ep_idx;
|
||||
|
||||
if (gadget_is_dwc3(gadget)) {
|
||||
d->src_bam_idx = usb_bam_get_connection_idx(
|
||||
gadget->name,
|
||||
IPA_P_BAM, USB_TO_PEER_PERIPHERAL,
|
||||
USB_BAM_DEVICE, 0);
|
||||
if (d->src_bam_idx < 0) {
|
||||
pr_err("%s: get_connection_idx failed\n",
|
||||
__func__);
|
||||
return;
|
||||
}
|
||||
d->src_bam_idx = usb_bam_get_connection_idx(
|
||||
gadget->name,
|
||||
IPA_P_BAM, USB_TO_PEER_PERIPHERAL,
|
||||
USB_BAM_DEVICE, 0);
|
||||
if (d->src_bam_idx < 0) {
|
||||
pr_err("%s: get_connection_idx failed\n",
|
||||
__func__);
|
||||
return;
|
||||
}
|
||||
|
||||
if (gadget_is_dwc3(gadget))
|
||||
configure_usb_data_fifo(d->src_bam_idx,
|
||||
port->port_usb->out,
|
||||
d->src_pipe_type);
|
||||
}
|
||||
|
||||
|
||||
/* Remove support for UL using system-to-IPA towards DL */
|
||||
if (d->src_pipe_type == USB_BAM_PIPE_SYS2BAM) {
|
||||
|
@ -966,21 +964,20 @@ static void bam2bam_data_connect_work(struct work_struct *w)
|
|||
__func__, d_port->ipa_producer_ep,
|
||||
d_port->ipa_consumer_ep);
|
||||
|
||||
if (gadget_is_dwc3(gadget)) {
|
||||
d->dst_bam_idx = usb_bam_get_connection_idx(
|
||||
gadget->name,
|
||||
IPA_P_BAM, PEER_PERIPHERAL_TO_USB,
|
||||
USB_BAM_DEVICE, 0);
|
||||
if (d->dst_bam_idx < 0) {
|
||||
pr_err("%s: get_connection_idx failed\n",
|
||||
__func__);
|
||||
return;
|
||||
}
|
||||
d->dst_bam_idx = usb_bam_get_connection_idx(
|
||||
gadget->name,
|
||||
IPA_P_BAM, PEER_PERIPHERAL_TO_USB,
|
||||
USB_BAM_DEVICE, 0);
|
||||
if (d->dst_bam_idx < 0) {
|
||||
pr_err("%s: get_connection_idx failed\n",
|
||||
__func__);
|
||||
return;
|
||||
}
|
||||
|
||||
if (gadget_is_dwc3(gadget))
|
||||
configure_usb_data_fifo(d->dst_bam_idx,
|
||||
port->port_usb->in,
|
||||
d->dst_pipe_type);
|
||||
}
|
||||
|
||||
/* Upadate BAM specific attributes in usb_request */
|
||||
if (gadget_is_dwc3(gadget)) {
|
||||
|
@ -1210,8 +1207,6 @@ int bam2bam_data_port_select(int portno)
|
|||
d = &port->data_ch;
|
||||
d->port = port;
|
||||
bam2bam_data_ports[portno] = port;
|
||||
d->ipa_params.src_client = IPA_CLIENT_USB_PROD;
|
||||
d->ipa_params.dst_client = IPA_CLIENT_USB_CONS;
|
||||
|
||||
/* UL workaround requirements */
|
||||
skb_queue_head_init(&d->rx_skb_q);
|
||||
|
@ -1365,6 +1360,18 @@ int bam_data_connect(struct data_port *gr, u8 port_num,
|
|||
d->rx_buffer_size = (gr->rx_buffer_size ? gr->rx_buffer_size :
|
||||
bam_mux_rx_req_size);
|
||||
|
||||
/*
|
||||
* Both source (consumer) and destination (producer) use the same
|
||||
* controller, so checking just one of them should suffice.
|
||||
*/
|
||||
if (usb_bam_get_bam_type(src_connection_idx) == HSIC_CTRL) {
|
||||
d->ipa_params.src_client = IPA_CLIENT_HSIC1_PROD;
|
||||
d->ipa_params.dst_client = IPA_CLIENT_HSIC1_CONS;
|
||||
} else {
|
||||
d->ipa_params.src_client = IPA_CLIENT_USB_PROD;
|
||||
d->ipa_params.dst_client = IPA_CLIENT_USB_CONS;
|
||||
}
|
||||
|
||||
pr_debug("%s(): rx_buffer_size:%d\n", __func__, d->rx_buffer_size);
|
||||
if (trans == USB_GADGET_XPORT_BAM2BAM_IPA) {
|
||||
d->ipa_params.src_pipe = &(d->src_pipe_idx);
|
||||
|
|
|
@ -413,6 +413,15 @@ void usb_bam_set_qdss_core(const char *qdss_core);
|
|||
int usb_bam_get_connection_idx(const char *name, enum peer_bam client,
|
||||
enum usb_bam_pipe_dir dir, enum usb_bam_mode bam_mode, u32 num);
|
||||
|
||||
/**
|
||||
* return the usb controller bam type used for the supplied connection index
|
||||
*
|
||||
* @connection_idx - Connection index
|
||||
*
|
||||
* @return usb control bam type
|
||||
*/
|
||||
int usb_bam_get_bam_type(int connection_idx);
|
||||
|
||||
/**
|
||||
* Indicates the type of connection the USB side of the connection is.
|
||||
*
|
||||
|
@ -527,6 +536,11 @@ static inline int usb_bam_get_connection_idx(const char *name,
|
|||
return -ENODEV;
|
||||
}
|
||||
|
||||
static inline int usb_bam_get_bam_type(int connection_idx)
|
||||
{
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
static inline int usb_bam_get_pipe_type(u8 idx, enum usb_bam_pipe_type *type)
|
||||
{
|
||||
return -ENODEV;
|
||||
|
|
Loading…
Reference in a new issue