1
0
Fork 0

MLK-19850-6 usb: chipidea: introduce flag for enable USB PHY charger detection

Some platforms may want to use USB PHY charger detection function
when VBUS is there, add one flag for it. The user can enable it
at firmware.

Reviewed-by: Jun Li <jun.li@nxp.com>
Signed-off-by: Peter Chen <peter.chen@nxp.com>
pull/10/head
Peter Chen 2018-10-08 17:43:45 +08:00 committed by Jason Liu
parent 28200a49f3
commit 822eb0fe8b
4 changed files with 13 additions and 0 deletions

View File

@ -79,6 +79,7 @@ Optional properties:
maximum_periodic_data_per_frame. The use case is multiple transactions, but
less frame rate.
- ci-disable-lpm: Some chipidea hardware need to disable low power mode
- phy-charger-detection: enable USB PHY charger detection function
i.mx specific properties
- fsl,usbmisc: phandler of non-core register device, with one

View File

@ -690,6 +690,12 @@ static int ci_get_platdata(struct device *dev,
if (of_find_property(dev->of_node, "non-zero-ttctrl-ttha", NULL))
platdata->flags |= CI_HDRC_SET_NON_ZERO_TTHA;
/* "imx-usb-charger-detection is legacy compatible */
if (of_find_property(dev->of_node, "phy-charger-detection", NULL) ||
of_find_property(dev->of_node, "imx-usb-charger-detection",
NULL))
platdata->flags |= CI_HDRC_PHY_CHARGER_DETECTION;
ext_id = ERR_PTR(-ENODEV);
ext_vbus = ERR_PTR(-ENODEV);
if (of_property_read_bool(dev->of_node, "extcon")) {

View File

@ -2016,6 +2016,9 @@ int ci_usb_charger_connect(struct ci_hdrc *ci, int is_active)
if (is_active)
pm_runtime_get_sync(ci->dev);
if (!(ci->platdata->flags & CI_HDRC_PHY_CHARGER_DETECTION))
goto out;
if (ci->usb_phy->charger_detect) {
usb_phy_set_charger_state(ci->usb_phy, is_active ?
USB_CHARGER_PRESENT : USB_CHARGER_ABSENT);
@ -2036,6 +2039,7 @@ int ci_usb_charger_connect(struct ci_hdrc *ci, int is_active)
}
schedule_work(&ci->usb_phy->chg_work);
}
out:
if (!is_active)
pm_runtime_put_sync(ci->dev);

View File

@ -64,6 +64,8 @@ struct ci_hdrc_platform_data {
#define CI_HDRC_IMX_IS_HSIC BIT(15)
/* need request pmqos during low power */
#define CI_HDRC_PMQOS BIT(16)
/* Using PHY's charger detection */
#define CI_HDRC_PHY_CHARGER_DETECTION BIT(17)
enum usb_dr_mode dr_mode;
#define CI_HDRC_CONTROLLER_RESET_EVENT 0
#define CI_HDRC_CONTROLLER_STOPPED_EVENT 1