参考文件:
kernel/drivers/usb/phy/phy-msm-usb.c
kernel/msm-3.18/drivers/usb/phy/phy-msm-usb.c
+//begin:stone modify for usb id
+static bool usb_id_flag = 1;
+bool get_usb_id(void)
+{
+ return usb_id_flag;
+}
+EXPORT_SYMBOL(get_usb_id);
+//end:stone modify for usb id
在msm_id_status_w函数中添加即可:
static void msm_id_status_w(struct work_struct *w)
{
struct msm_otg *motg = container_of(w, struct msm_otg,
id_status_work.work);
int work = 0;
int id_state = 0;
dev_dbg(motg->phy.dev, "ID status_w\n");
if (motg->pdata->pmic_id_irq)
id_state = msm_otg_read_pmic_id_state(motg);
else if (motg->ext_id_irq)
id_state = gpio_get_value(motg->pdata->usb_id_gpio);
/******************************************************/
else if (motg->phy_irq)
id_state = msm_otg_read_phy_id_state(motg);
//usb_otg: usb@78d9000 {中定义了:
//interrupt-names = "core_irq", "async_irq","phy_irq";
//motg->phy_irq = platform_get_irq_byname(pdev, "phy_irq");
//所以phy_irq不为空,走到这里
/******************************************************/
if (id_state) {
if (!test_and_set_bit(ID, &motg->inputs)) {
pr_debug("ID set\n");
msm_otg_dbg_log_event(&motg->phy, "ID SET",
motg->inputs, motg->phy.state);
work = 1;
}
} else {
if (test_and_clear_bit(ID, &motg->inputs)) {
pr_debug