From 8af72e14692cfa735f65368c74496acb988d30bb Mon Sep 17 00:00:00 2001 From: Peter Chen Date: Sun, 15 Feb 2015 15:44:43 +0800 Subject: [PATCH] MLK-10279-2 usb: chipidea: imx: only do charger detection if we enable it We should only do charger detection if both we have enabled usb charger at kernel configuration and set usb charger enable at dts. Otherwise, we will do useless things, like toggle dp. Signed-off-by: Peter Chen (cherry picked from commit 6b677c09dbda0274c6b2e1d61ea0d7f1cc73f621) --- drivers/usb/chipidea/ci_hdrc_imx.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/drivers/usb/chipidea/ci_hdrc_imx.c b/drivers/usb/chipidea/ci_hdrc_imx.c index 708c486b49a2..ce659d632c00 100644 --- a/drivers/usb/chipidea/ci_hdrc_imx.c +++ b/drivers/usb/chipidea/ci_hdrc_imx.c @@ -204,11 +204,12 @@ static int ci_hdrc_imx_notify_event(struct ci_hdrc *ci, unsigned event) switch (event) { case CI_HDRC_CONTROLLER_VBUS_EVENT: if (data->usbmisc_data && ci->vbus_active) { - if (data->imx6_usb_charger_detection) + if (data->imx6_usb_charger_detection) { ret = imx6_usb_vbus_connect(&data->charger); - if (!ret && data->charger.psy.type != - POWER_SUPPLY_TYPE_USB) - ret = CI_HDRC_NOTIFY_RET_DEFER_EVENT; + if (!ret && data->charger.psy.type != + POWER_SUPPLY_TYPE_USB) + ret = CI_HDRC_NOTIFY_RET_DEFER_EVENT; + } } else if (data->usbmisc_data && !ci->vbus_active) { if (data->imx6_usb_charger_detection) ret = imx6_usb_vbus_disconnect(&data->charger); -- 2.39.2