diff options
author | Jun Li <jun.li@nxp.com> | 2020-01-23 14:35:58 +0800 |
---|---|---|
committer | Peter Chen <peter.chen@nxp.com> | 2020-05-06 09:42:03 +0800 |
commit | 746f316b753a83e366bfc5f936cbf0d72d1c2d1d (patch) | |
tree | 5e6f66edb3ee829abcad207df3341be9945807af /drivers/usb/chipidea/ci_hdrc_imx.c | |
parent | d755cdb1b9d7e1b645e176b97eb137194bbe8cf9 (diff) |
usb: chipidea: introduce imx7d USB charger detection
imx7d (and imx8mm, imx8mn) uses Samsung PHY and USB generic PHY driver.
The USB generic PHY driver is impossible to have a charger detection
for every user, so we implement USB charger detection routine at glue
layer. After the detection has finished, it will notify USB PHY
charger framework, and the uevents will be triggered.
Signed-off-by: Jun Li <jun.li@nxp.com>
Signed-off-by: Peter Chen <peter.chen@nxp.com>
Diffstat (limited to 'drivers/usb/chipidea/ci_hdrc_imx.c')
-rw-r--r-- | drivers/usb/chipidea/ci_hdrc_imx.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/drivers/usb/chipidea/ci_hdrc_imx.c b/drivers/usb/chipidea/ci_hdrc_imx.c index d8e7eb2f97b9..fb4097f02391 100644 --- a/drivers/usb/chipidea/ci_hdrc_imx.c +++ b/drivers/usb/chipidea/ci_hdrc_imx.c @@ -271,6 +271,7 @@ static int ci_hdrc_imx_notify_event(struct ci_hdrc *ci, unsigned int event) struct device *dev = ci->dev->parent; struct ci_hdrc_imx_data *data = dev_get_drvdata(dev); int ret = 0; + struct imx_usbmisc_data *mdata = data->usbmisc_data; switch (event) { case CI_HDRC_IMX_HSIC_ACTIVE_EVENT: @@ -284,11 +285,19 @@ static int ci_hdrc_imx_notify_event(struct ci_hdrc *ci, unsigned int event) } break; case CI_HDRC_IMX_HSIC_SUSPEND_EVENT: - ret = imx_usbmisc_hsic_set_connect(data->usbmisc_data); + ret = imx_usbmisc_hsic_set_connect(mdata); if (ret) dev_err(dev, "hsic_set_connect failed, err=%d\n", ret); break; + case CI_HDRC_CONTROLLER_VBUS_EVENT: + if (ci->vbus_active) + ret = imx_usbmisc_charger_detection(mdata, true); + else + ret = imx_usbmisc_charger_detection(mdata, false); + if (ci->usb_phy) + schedule_work(&ci->usb_phy->chg_work); + break; default: break; } @@ -415,6 +424,8 @@ static int ci_hdrc_imx_probe(struct platform_device *pdev) } pdata.usb_phy = data->phy; + if (data->usbmisc_data) + data->usbmisc_data->usb_phy = data->phy; if ((of_device_is_compatible(np, "fsl,imx53-usb") || of_device_is_compatible(np, "fsl,imx51-usb")) && pdata.usb_phy && |