M7350v3_en_gpl

This commit is contained in:
T
2024-09-09 08:55:19 +00:00
parent 801e6d2ad8
commit 2d95e8761a
2791 changed files with 89608 additions and 390711 deletions

View File

@ -1218,21 +1218,7 @@ static int usb_suspend_both(struct usb_device *udev, pm_message_t msg)
} else {
udev->can_submit = 0;
for (i = 0; i < 16; ++i) {
struct urb *urb;
struct usb_host_endpoint *ep = udev->ep_out[i];
bool hbm_enabled_ep = false;
if (ep && !list_empty(&ep->urb_list)) {
urb = list_first_entry(&ep->urb_list,
struct urb, urb_list);
if (urb->priv_data)
hbm_enabled_ep = true;
}
if (hbm_enabled_ep) {
pr_info("Not flushing HBM-EP on susp:%p:%p\n",
urb, urb->priv_data);
} else {
usb_hcd_flush_endpoint(udev, udev->ep_out[i]);
}
usb_hcd_flush_endpoint(udev, udev->ep_out[i]);
usb_hcd_flush_endpoint(udev, udev->ep_in[i]);
}
}

View File

@ -1756,7 +1756,7 @@ static int mass_storage_function_init(struct android_usb_function *f,
config->fsg.nluns = 2;
config->fsg.luns[1].cdrom = 1;
config->fsg.luns[1].ro = 1;
config->fsg.luns[1].removable = 1;
config->fsg.luns[1].removable = 0;
name[1] = "lun0";
}
@ -1825,29 +1825,8 @@ static DEVICE_ATTR(inquiry_string, S_IRUGO | S_IWUSR,
mass_storage_inquiry_show,
mass_storage_inquiry_store);
//[yanghuaying start] export whether mass storage is connect to pc
static int in_suspend_mode = 0;
static ssize_t mass_storage_connect2pc_show(struct device *dev,
struct device_attribute *attr, char *buf)
{
struct android_usb_function *f = dev_get_drvdata(dev);
struct mass_storage_function_config *config = f->config;
int available = 0;
if(config->common->new_fsg != NULL && !in_suspend_mode)
available = 1;
pr_info("in_suspend_mode = %d\n", in_suspend_mode);
return snprintf(buf, PAGE_SIZE, "%d\n", available);
}
static DEVICE_ATTR(connect2pc, 0444,
mass_storage_connect2pc_show,
NULL);
//[yanghuaying end]
static struct device_attribute *mass_storage_function_attributes[] = {
&dev_attr_inquiry_string,
&dev_attr_connect2pc,
NULL
};
@ -2693,11 +2672,6 @@ android_setup(struct usb_gadget *gadget, const struct usb_ctrlrequest *c)
if (value < 0)
value = composite_setup(gadget, c);
/*[yanghuaying] when device discnnect from pc, it will first receive a
suspend event,but when reconnect to pc,may not receive corresponding
resume event(may just receive a connect event), now reinit in_suspend_mode*/
in_suspend_mode = 0;
spin_lock_irqsave(&cdev->lock, flags);
if (!dev->connected) {
dev->connected = 1;
@ -2736,11 +2710,6 @@ static void android_suspend(struct usb_gadget *gadget)
struct android_dev *dev = cdev_to_android_dev(cdev);
unsigned long flags;
/*[yanghuaying] when device connect to pc by hub, afetr hub disconnect
from pc,device will go into suspend mode(a suspend event,not a
disconnect event),mass storage function is unusable*/
in_suspend_mode = 1;
spin_lock_irqsave(&cdev->lock, flags);
dev->suspended = 1;
schedule_work(&dev->work);
@ -2755,10 +2724,6 @@ static void android_resume(struct usb_gadget *gadget)
struct android_dev *dev = cdev_to_android_dev(cdev);
unsigned long flags;
/*[yanghuaying] when device connect to pc by hub, afetr hub reconnect to pc
device will leave suspend mode,mass storage function is usable again*/
in_suspend_mode = 0;
spin_lock_irqsave(&cdev->lock, flags);
dev->suspended = 0;
schedule_work(&dev->work);

View File

@ -3004,11 +3004,6 @@ buffhds_first_it:
i = 0x0399;
}
}
/* [ouyangyi] Change mass storage device's name to "TP-LINK MMC Storage USB Device" */
#if 1
snprintf(common->inquiry_string, sizeof common->inquiry_string,
"TP-LINK MMC Storage");
#else
snprintf(common->inquiry_string, sizeof common->inquiry_string,
"%-8s%-16s%04x", cfg->vendor_name ?: "Linux",
/* Assume product name dependent on the first LUN */
@ -3016,7 +3011,6 @@ buffhds_first_it:
? "File-Stor Gadget"
: "File-CD Gadget"),
i);
#endif
/*
* Some peripheral controllers are known not to be able to

View File

@ -663,9 +663,7 @@ static void ecm_qc_suspend(struct usb_function *f)
{
struct f_ecm_qc *ecm = func_to_ecm_qc(f);
//[yanghuaying] fix reconnect fail after ecm_qc disconnect from MacOS Virtual machine
//if (f->config->cdev->gadget->remote_wakeup) {
if (1) {
if (f->config->cdev->gadget->remote_wakeup) {
bam_data_suspend(ECM_QC_ACTIVE_PORT);
} else {
/*
@ -680,7 +678,6 @@ static void ecm_qc_suspend(struct usb_function *f)
ecm_qc_bam_disconnect(ecm);
}
pr_info("%s remote_wakeup=%d\n",__func__,f->config->cdev->gadget->remote_wakeup);
pr_debug("ecm suspended\n");
}
@ -688,9 +685,7 @@ static void ecm_qc_resume(struct usb_function *f)
{
struct f_ecm_qc *ecm = func_to_ecm_qc(f);
//[yanghuaying] fix reconnect fail after ecm_qc disconnect from MacOS Virtual machine
//if (f->config->cdev->gadget->remote_wakeup) {
if (1) {
if (f->config->cdev->gadget->remote_wakeup) {
bam_data_resume(ECM_QC_ACTIVE_PORT);
} else {
/* Restore endpoint descriptors info. */
@ -698,7 +693,7 @@ static void ecm_qc_resume(struct usb_function *f)
ecm->bam_port.out->desc = ecm->out_ep_desc_backup;
ecm_qc_bam_connect(ecm);
}
pr_info("%s remote_wakeup=%d\n",__func__,f->config->cdev->gadget->remote_wakeup);
pr_debug("ecm resumed\n");
}

View File

@ -126,12 +126,7 @@ static unsigned int bitrate(struct usb_gadget *g)
if (gadget_is_superspeed(g) && g->speed == USB_SPEED_SUPER)
return 13 * 1024 * 8 * 1000 * 8;
else if (gadget_is_dualspeed(g) && g->speed == USB_SPEED_HIGH)
/* [ouyangyi] change rndis' peak rate from 425.9Mbps to 150Mbps */
#if 1
return 150 * 1000 * 1000;
#else
return 13 * 512 * 8 * 1000 * 8;
#endif
else
return 19 * 64 * 1 * 1000 * 8;
}

View File

@ -118,8 +118,8 @@ static int grmnet_ctrl_qti_send_cpkt_tomodem(u8 portno,
/* drop cpkt if port is not open */
if (!port->is_open) {
// pr_err("rmnet file handler %p(index=%d) is not open",
// port, port->index);
pr_err("rmnet file handler %p(index=%d) is not open",
port, port->index);
spin_unlock_irqrestore(&port->lock, flags);
free_rmnet_ctrl_pkt(cpkt);
return 0;

View File

@ -1,6 +1,6 @@
/* ehci-msm-hsic.c - HSUSB Host Controller Driver Implementation
*
* Copyright (c) 2011-2014, The Linux Foundation. All rights reserved.
* Copyright (c) 2011-2013, The Linux Foundation. All rights reserved.
*
* Partly derived from ehci-fsl.c and ehci-hcd.c
* Copyright (c) 2000-2004 by David Brownell
@ -53,7 +53,7 @@
#define MSM_USB_BASE (hcd->regs)
#define USB_REG_START_OFFSET 0x90
#define USB_REG_END_OFFSET 0x324
#define USB_REG_END_OFFSET 0x250
static struct workqueue_struct *ehci_wq;
struct ehci_timer {
@ -127,9 +127,6 @@ module_param(ep_addr_rxdbg_mask, uint, S_IRUGO | S_IWUSR);
static unsigned int ep_addr_txdbg_mask = 9;
module_param(ep_addr_txdbg_mask, uint, S_IRUGO | S_IWUSR);
static unsigned int dbg_qh_addr;
module_param(dbg_qh_addr, uint, S_IRUGO | S_IWUSR);
/* Maximum debug message length */
#define DBG_MSG_LEN 128UL
@ -321,44 +318,6 @@ static inline struct usb_hcd *hsic_to_hcd(struct msm_hsic_hcd *mehci)
return container_of((void *) mehci, struct usb_hcd, hcd_priv);
}
static void dbg_msm_qh(struct ehci_hcd *ehci, struct ehci_qh *qh)
{
struct ehci_qh_hw *hw = qh->hw;
pr_info("EP:%x qh %p info %x %x c_qtd-%08x\n",
(hw->hw_info1 & 0xF00) >> 8, qh, hw->hw_info1,
hw->hw_info2, hw->hw_current);
pr_info("overlay n%08x %08x t-%08x nak-%x c_err %x\n",
hw->hw_qtd_next, hw->hw_alt_next,
hw->hw_token,
(hw->hw_alt_next & 0xE)>>1, (hw->hw_token & 0xC00) >> 10);
}
static void dump_msm_qhs(struct usb_hcd *hcd)
{
struct ehci_hcd *ehci = hcd_to_ehci(hcd);
struct ehci_qh *qh, *qh_next;
unsigned long flags;
int i;
for (i = 0; i < 5; i++) {
pr_info("Dump QHs, iteration:%d\n", i);
spin_lock_irqsave(&ehci->lock, flags);
qh_next = ehci->async->qh_next.qh;
while (qh_next) {
qh = qh_next;
qh_next = qh->qh_next.qh;
if (!dbg_qh_addr ||
((struct ehci_qh *)dbg_qh_addr) == qh)
dbg_msm_qh(ehci, qh);
}
spin_unlock_irqrestore(&ehci->lock, flags);
usleep_range(5000, 10000);
}
}
static void dump_hsic_regs(struct usb_hcd *hcd)
{
int i;
@ -979,14 +938,6 @@ static int msm_hsic_resume(struct msm_hsic_hcd *mehci)
skip_phy_resume:
/* Check HSIC host pipe state before resume. Pipe should be empty. */
if (pdata->consider_ipa_handshake) {
if (!msm_bam_hsic_host_pipe_empty()) {
dev_err(mehci->dev, "Data pending without resumed.\n");
BUG_ON(1);
}
}
usb_hcd_resume_root_hub(hcd);
atomic_set(&mehci->in_lpm, 0);
@ -1840,27 +1791,6 @@ const struct file_operations ehci_hsic_msm_dbg_ctrl_fops = {
.release = single_release,
};
static int ehci_hsic_msm_qh_show(struct seq_file *s, void *unused)
{
struct msm_hsic_hcd *mehci = s->private;
dump_msm_qhs(hsic_to_hcd(mehci));
return 0;
}
static int ehci_hsic_msm_qh_open(struct inode *inode, struct file *f)
{
return single_open(f, ehci_hsic_msm_qh_show, inode->i_private);
}
const struct file_operations ehci_hsic_msm_qh_fops = {
.open = ehci_hsic_msm_qh_open,
.read = seq_read,
.llseek = seq_lseek,
.release = single_release,
};
static struct dentry *ehci_hsic_msm_dbg_root;
static int ehci_hsic_msm_debugfs_init(struct msm_hsic_hcd *mehci)
{
@ -1911,16 +1841,6 @@ static int ehci_hsic_msm_debugfs_init(struct msm_hsic_hcd *mehci)
return -ENODEV;
}
ehci_hsic_msm_dentry = debugfs_create_file("show_hsic_qh",
S_IRUGO,
ehci_hsic_msm_dbg_root, mehci,
&ehci_hsic_msm_qh_fops);
if (!ehci_hsic_msm_dentry) {
debugfs_remove_recursive(ehci_hsic_msm_dbg_root);
return -ENODEV;
}
return 0;
}
@ -2232,10 +2152,8 @@ static int __devinit ehci_hsic_msm_probe(struct platform_device *pdev)
if (pdev->dev.parent)
pm_runtime_put_sync(pdev->dev.parent);
if (mehci->enable_hbm) {
if (mehci->enable_hbm)
hbm_init(hcd, pdata->disable_park_mode);
msm_bam_hsic_reset();
}
if (pdata && pdata->consider_ipa_handshake)
msm_bam_set_hsic_host_dev(&pdev->dev);

View File

@ -1,4 +1,4 @@
/* Copyright (c) 2013-2014, The Linux Foundation. All rights reserved.
/* Copyright (c) 2013, 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
@ -165,16 +165,6 @@ int hbm_pipe_init(u32 QH_addr, u32 pipe_num, bool is_consumer)
return -EINVAL;
}
/* Disable HBM pipe */
hbm_msm_write_reg_field(hbm_ctx->base, USB_OTG_HS_HBM_PIPE_EN,
1 << pipe_num, 0);
/* Reset HBM SideBand */
hbm_msm_write_reg_field(hbm_ctx->base, USB_OTG_HS_HBM_SB_SW_RST,
1 << pipe_num, 1);
hbm_msm_write_reg_field(hbm_ctx->base, USB_OTG_HS_HBM_SB_SW_RST,
1 << pipe_num, 0);
/* map QH(ep) <> pipe */
hbm_msm_write_reg(hbm_ctx->base,
USB_OTG_HS_HBM_QH_MAP_PIPE(pipe_num), QH_addr);
@ -230,11 +220,10 @@ static int hbm_submit_async(struct ehci_hcd *ehci, struct urb *urb,
{
int epnum;
unsigned long flags;
struct ehci_qh *qh = (struct ehci_qh *) urb->ep->hcpriv;
struct ehci_qh *qh = NULL;
int rc;
struct usb_host_bam_type *bam =
(struct usb_host_bam_type *)urb->priv_data;
int cmd;
epnum = urb->ep->desc.bEndpointAddress;
@ -247,9 +236,6 @@ static int hbm_submit_async(struct ehci_hcd *ehci, struct urb *urb,
if (unlikely(rc))
goto done;
if (qh != NULL)
pr_debug("%s: QH NOT NULL (%p)\n", __func__, qh);
qh = qh_append_tds(ehci, urb, qtd_list, epnum, &urb->ep->hcpriv);
if (unlikely(qh == NULL)) {
usb_hcd_unlink_urb_from_ep(ehci_to_hcd(ehci), urb);
@ -257,38 +243,15 @@ static int hbm_submit_async(struct ehci_hcd *ehci, struct urb *urb,
goto done;
}
/* Stop Async Scheduler */
cmd = ehci_readl(ehci, &ehci->regs->command);
if (ehci->rh_state != EHCI_RH_HALTED && !ehci->reclaim) {
ehci_writel(ehci, cmd & ~CMD_ASE, &ehci->regs->command);
wmb();
}
hbm_pipe_init(qh->qh_dma, bam->pipe_num, bam->dir);
if (likely(qh->qh_state == QH_STATE_IDLE)) {
pr_debug("%s: QH was IDLE (%p)\n", __func__, qh);
if (likely(qh->qh_state == QH_STATE_IDLE))
qh_link_async(ehci, qh);
}
/* Start Async Scheduler */
cmd = ehci_readl(ehci, &ehci->regs->command);
if (!(cmd & CMD_ASE)) {
/* in case a clear of CMD_ASE didn't take yet */
(void)handshake(ehci, &ehci->regs->status, STS_ASS, 0, 150);
cmd |= CMD_ASE;
ehci_writel(ehci, cmd, &ehci->regs->command);
}
done:
spin_unlock_irqrestore(&ehci->lock, flags);
pr_debug("QH:%p urb:%p <--> pipe:%u ep:%d(out:%u)\n",
urb->ep->hcpriv, urb, bam->pipe_num, epnum, bam->dir);
if (unlikely(qh == NULL))
qtd_list_free(ehci, urb, qtd_list);
return rc;
}

27
kernel/drivers/usb/otg/msm_otg.c Executable file → Normal file
View File

@ -1327,14 +1327,13 @@ static int msm_otg_notify_power_supply(struct msm_otg *motg, unsigned mA)
goto psy_error;
}
/* [chenchao] Fix reboot when pc reboot */
if (motg->cur_power == 0 && mA > 2) {
/* Enable charging */
if (power_supply_set_online(psy, true))
goto psy_error;
if (power_supply_set_current_limit(psy, 1000*mA))
goto psy_error;
} else if (motg->cur_power > 0 && (mA == 0)) {
} else if (motg->cur_power > 0 && (mA == 0 || mA == 2)) {
/* Disable charging */
if (power_supply_set_online(psy, false))
goto psy_error;
@ -2318,7 +2317,6 @@ static void msm_chg_detect_work(struct work_struct *w)
bool is_dcd = false, tmout, vout, is_aca;
u32 line_state, dm_vlgc;
unsigned long delay;
static bool det_time_out = false;
dev_dbg(phy->dev, "chg detection work\n");
@ -2360,11 +2358,6 @@ static void msm_chg_detect_work(struct work_struct *w)
is_dcd = msm_chg_check_dcd(motg);
motg->dcd_time += MSM_CHG_DCD_POLL_TIME;
tmout = motg->dcd_time >= MSM_CHG_DCD_TIMEOUT;
if (tmout) {
det_time_out = true;
}
if (is_dcd || tmout) {
msm_chg_disable_dcd(motg);
msm_chg_enable_primary_det(motg);
@ -2402,17 +2395,11 @@ static void msm_chg_detect_work(struct work_struct *w)
break;
}
if (line_state) { /* DP > VLGC or/and DM > VLGC */
if (line_state) /* DP > VLGC or/and DM > VLGC */
motg->chg_type = USB_PROPRIETARY_CHARGER;
} else {
else
motg->chg_type = USB_SDP_CHARGER;
if (det_time_out) {
det_time_out = false;
motg->chg_type = USB_DCP_CHARGER;
}
}
motg->chg_state = USB_CHG_STATE_DETECTED;
delay = 0;
}
@ -2583,9 +2570,8 @@ static void msm_otg_sm_work(struct work_struct *w)
case USB_PROPRIETARY_CHARGER:
msm_otg_notify_charger(motg,
IDEV_CHG_MAX);
/* [chenchao] Not suspend when charge with power adapter */
/* pm_runtime_put_noidle(otg->phy->dev); */
/* pm_runtime_suspend(otg->phy->dev); */
pm_runtime_put_noidle(otg->phy->dev);
pm_runtime_suspend(otg->phy->dev);
break;
case USB_ACA_B_CHARGER:
msm_otg_notify_charger(motg,
@ -2610,9 +2596,6 @@ static void msm_otg_sm_work(struct work_struct *w)
OTG_STATE_B_PERIPHERAL;
break;
case USB_SDP_CHARGER:
/* [chenchao] Fix always reboot when connect some notebook */
msm_otg_notify_charger(motg,
IDEV_CHG_MIN);
msm_otg_start_peripheral(otg, 1);
otg->phy->state =
OTG_STATE_B_PERIPHERAL;