Merge branch 'ib-extcon-usb-phy-4.14' into extcon-next
This commit is contained in:
@@ -253,16 +253,16 @@ static void extcon_work(struct work_struct *work)
|
|||||||
vbus = gpiod_get_value_cansleep(driver->vbus_gpiod);
|
vbus = gpiod_get_value_cansleep(driver->vbus_gpiod);
|
||||||
|
|
||||||
if (!id && vbus) { /* Host connected */
|
if (!id && vbus) { /* Host connected */
|
||||||
extcon_set_cable_state_(driver->edev, EXTCON_USB_HOST, true);
|
extcon_set_state_sync(driver->edev, EXTCON_USB_HOST, true);
|
||||||
pr_debug("Host cable connected\n");
|
pr_debug("Host cable connected\n");
|
||||||
driver->data->new_state = EVT_HOST;
|
driver->data->new_state = EVT_HOST;
|
||||||
connect_change(driver);
|
connect_change(driver);
|
||||||
} else if (id && !vbus) { /* Disconnected */
|
} else if (id && !vbus) { /* Disconnected */
|
||||||
extcon_set_cable_state_(driver->edev, EXTCON_USB_HOST, false);
|
extcon_set_state_sync(driver->edev, EXTCON_USB_HOST, false);
|
||||||
extcon_set_cable_state_(driver->edev, EXTCON_USB, false);
|
extcon_set_state_sync(driver->edev, EXTCON_USB, false);
|
||||||
pr_debug("Cable disconnected\n");
|
pr_debug("Cable disconnected\n");
|
||||||
} else if (id && vbus) { /* Device connected */
|
} else if (id && vbus) { /* Device connected */
|
||||||
extcon_set_cable_state_(driver->edev, EXTCON_USB, true);
|
extcon_set_state_sync(driver->edev, EXTCON_USB, true);
|
||||||
pr_debug("Device cable connected\n");
|
pr_debug("Device cable connected\n");
|
||||||
driver->data->new_state = EVT_DEVICE;
|
driver->data->new_state = EVT_DEVICE;
|
||||||
connect_change(driver);
|
connect_change(driver);
|
||||||
|
@@ -155,12 +155,12 @@ static int qcom_usb_hs_phy_power_on(struct phy *phy)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (uphy->vbus_edev) {
|
if (uphy->vbus_edev) {
|
||||||
state = extcon_get_cable_state_(uphy->vbus_edev, EXTCON_USB);
|
state = extcon_get_state(uphy->vbus_edev, EXTCON_USB);
|
||||||
/* setup initial state */
|
/* setup initial state */
|
||||||
qcom_usb_hs_phy_vbus_notifier(&uphy->vbus_notify, state,
|
qcom_usb_hs_phy_vbus_notifier(&uphy->vbus_notify, state,
|
||||||
uphy->vbus_edev);
|
uphy->vbus_edev);
|
||||||
ret = extcon_register_notifier(uphy->vbus_edev, EXTCON_USB,
|
ret = devm_extcon_register_notifier(&ulpi->dev, uphy->vbus_edev,
|
||||||
&uphy->vbus_notify);
|
EXTCON_USB, &uphy->vbus_notify);
|
||||||
if (ret)
|
if (ret)
|
||||||
goto err_ulpi;
|
goto err_ulpi;
|
||||||
}
|
}
|
||||||
@@ -179,16 +179,8 @@ err_sleep:
|
|||||||
|
|
||||||
static int qcom_usb_hs_phy_power_off(struct phy *phy)
|
static int qcom_usb_hs_phy_power_off(struct phy *phy)
|
||||||
{
|
{
|
||||||
int ret;
|
|
||||||
struct qcom_usb_hs_phy *uphy = phy_get_drvdata(phy);
|
struct qcom_usb_hs_phy *uphy = phy_get_drvdata(phy);
|
||||||
|
|
||||||
if (uphy->vbus_edev) {
|
|
||||||
ret = extcon_unregister_notifier(uphy->vbus_edev, EXTCON_USB,
|
|
||||||
&uphy->vbus_notify);
|
|
||||||
if (ret)
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
regulator_disable(uphy->v3p3);
|
regulator_disable(uphy->v3p3);
|
||||||
regulator_disable(uphy->v1p8);
|
regulator_disable(uphy->v1p8);
|
||||||
clk_disable_unprepare(uphy->sleep_clk);
|
clk_disable_unprepare(uphy->sleep_clk);
|
||||||
|
@@ -545,7 +545,7 @@ static void rockchip_usb2phy_otg_sm_work(struct work_struct *work)
|
|||||||
rockchip_usb2phy_power_off(rport->phy);
|
rockchip_usb2phy_power_off(rport->phy);
|
||||||
/* fall through */
|
/* fall through */
|
||||||
case OTG_STATE_B_IDLE:
|
case OTG_STATE_B_IDLE:
|
||||||
if (extcon_get_cable_state_(rphy->edev, EXTCON_USB_HOST) > 0) {
|
if (extcon_get_state(rphy->edev, EXTCON_USB_HOST) > 0) {
|
||||||
dev_dbg(&rport->phy->dev, "usb otg host connect\n");
|
dev_dbg(&rport->phy->dev, "usb otg host connect\n");
|
||||||
rport->state = OTG_STATE_A_HOST;
|
rport->state = OTG_STATE_A_HOST;
|
||||||
rockchip_usb2phy_power_on(rport->phy);
|
rockchip_usb2phy_power_on(rport->phy);
|
||||||
@@ -598,7 +598,7 @@ static void rockchip_usb2phy_otg_sm_work(struct work_struct *work)
|
|||||||
rport->vbus_attached = vbus_attach;
|
rport->vbus_attached = vbus_attach;
|
||||||
|
|
||||||
if (notify_charger && rphy->edev) {
|
if (notify_charger && rphy->edev) {
|
||||||
extcon_set_cable_state_(rphy->edev,
|
extcon_set_state_sync(rphy->edev,
|
||||||
cable, vbus_attach);
|
cable, vbus_attach);
|
||||||
if (cable == EXTCON_CHG_USB_SDP)
|
if (cable == EXTCON_CHG_USB_SDP)
|
||||||
extcon_set_state_sync(rphy->edev,
|
extcon_set_state_sync(rphy->edev,
|
||||||
@@ -619,7 +619,7 @@ static void rockchip_usb2phy_otg_sm_work(struct work_struct *work)
|
|||||||
sch_work = true;
|
sch_work = true;
|
||||||
break;
|
break;
|
||||||
case OTG_STATE_A_HOST:
|
case OTG_STATE_A_HOST:
|
||||||
if (extcon_get_cable_state_(rphy->edev, EXTCON_USB_HOST) == 0) {
|
if (extcon_get_state(rphy->edev, EXTCON_USB_HOST) == 0) {
|
||||||
dev_dbg(&rport->phy->dev, "usb otg host disconnect\n");
|
dev_dbg(&rport->phy->dev, "usb otg host disconnect\n");
|
||||||
rport->state = OTG_STATE_B_IDLE;
|
rport->state = OTG_STATE_B_IDLE;
|
||||||
rockchip_usb2phy_power_off(rport->phy);
|
rockchip_usb2phy_power_off(rport->phy);
|
||||||
@@ -1006,8 +1006,8 @@ static int rockchip_usb2phy_otg_port_init(struct rockchip_usb2phy *rphy,
|
|||||||
if (!IS_ERR(rphy->edev)) {
|
if (!IS_ERR(rphy->edev)) {
|
||||||
rport->event_nb.notifier_call = rockchip_otg_event;
|
rport->event_nb.notifier_call = rockchip_otg_event;
|
||||||
|
|
||||||
ret = extcon_register_notifier(rphy->edev, EXTCON_USB_HOST,
|
ret = devm_extcon_register_notifier(rphy->dev, rphy->edev,
|
||||||
&rport->event_nb);
|
EXTCON_USB_HOST, &rport->event_nb);
|
||||||
if (ret)
|
if (ret)
|
||||||
dev_err(rphy->dev, "register USB HOST notifier failed\n");
|
dev_err(rphy->dev, "register USB HOST notifier failed\n");
|
||||||
}
|
}
|
||||||
|
@@ -184,7 +184,7 @@ static int udc_plat_probe(struct platform_device *pdev)
|
|||||||
goto exit_phy;
|
goto exit_phy;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = extcon_get_cable_state_(udc->edev, EXTCON_USB);
|
ret = extcon_get_state(udc->edev, EXTCON_USB);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
dev_err(dev, "Can't get cable state\n");
|
dev_err(dev, "Can't get cable state\n");
|
||||||
goto exit_extcon;
|
goto exit_extcon;
|
||||||
@@ -273,7 +273,7 @@ static int udc_plat_suspend(struct device *dev)
|
|||||||
udc = dev_get_drvdata(dev);
|
udc = dev_get_drvdata(dev);
|
||||||
stop_udc(udc);
|
stop_udc(udc);
|
||||||
|
|
||||||
if (extcon_get_cable_state_(udc->edev, EXTCON_USB) > 0) {
|
if (extcon_get_state(udc->edev, EXTCON_USB) > 0) {
|
||||||
dev_dbg(udc->dev, "device -> idle\n");
|
dev_dbg(udc->dev, "device -> idle\n");
|
||||||
stop_udc(udc);
|
stop_udc(udc);
|
||||||
}
|
}
|
||||||
@@ -303,7 +303,7 @@ static int udc_plat_resume(struct device *dev)
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (extcon_get_cable_state_(udc->edev, EXTCON_USB) > 0) {
|
if (extcon_get_state(udc->edev, EXTCON_USB) > 0) {
|
||||||
dev_dbg(udc->dev, "idle -> device\n");
|
dev_dbg(udc->dev, "idle -> device\n");
|
||||||
start_udc(udc);
|
start_udc(udc);
|
||||||
}
|
}
|
||||||
|
@@ -422,15 +422,4 @@ static inline int extcon_unregister_interest(struct extcon_specific_cable_nb
|
|||||||
{
|
{
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline int extcon_get_cable_state_(struct extcon_dev *edev, unsigned int id)
|
|
||||||
{
|
|
||||||
return extcon_get_state(edev, id);
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline int extcon_set_cable_state_(struct extcon_dev *edev, unsigned int id,
|
|
||||||
bool cable_state)
|
|
||||||
{
|
|
||||||
return extcon_set_state_sync(edev, id, cable_state);
|
|
||||||
}
|
|
||||||
#endif /* __LINUX_EXTCON_H__ */
|
#endif /* __LINUX_EXTCON_H__ */
|
||||||
|
Reference in New Issue
Block a user