aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChanwoo Choi <cw00.choi@samsung.com>2017-08-15 20:22:55 -0400
committerChanwoo Choi <cw00.choi@samsung.com>2017-08-15 20:22:55 -0400
commitae3614fda98c5dc2e34ed3145f933e11a339916a (patch)
tree8e22b980bdba1ea22659c4b759bd3229e3b3f4e4
parent1cf76c4eeb07ba31a03066c6540d96fd64d7a34f (diff)
parent808ae8f3c7fefef3aece08820c108b68cdb06e1e (diff)
Merge branch 'ib-extcon-usb-phy-4.14' into extcon-next
-rw-r--r--drivers/phy/broadcom/phy-bcm-ns2-usbdrd.c8
-rw-r--r--drivers/phy/qualcomm/phy-qcom-usb-hs.c14
-rw-r--r--drivers/phy/rockchip/phy-rockchip-inno-usb2.c10
-rw-r--r--drivers/usb/gadget/udc/snps_udc_plat.c6
-rw-r--r--include/linux/extcon.h11
5 files changed, 15 insertions, 34 deletions
diff --git a/drivers/phy/broadcom/phy-bcm-ns2-usbdrd.c b/drivers/phy/broadcom/phy-bcm-ns2-usbdrd.c
index 9ae59e223131..d099a0c8cee5 100644
--- a/drivers/phy/broadcom/phy-bcm-ns2-usbdrd.c
+++ b/drivers/phy/broadcom/phy-bcm-ns2-usbdrd.c
@@ -253,16 +253,16 @@ static void extcon_work(struct work_struct *work)
253 vbus = gpiod_get_value_cansleep(driver->vbus_gpiod); 253 vbus = gpiod_get_value_cansleep(driver->vbus_gpiod);
254 254
255 if (!id && vbus) { /* Host connected */ 255 if (!id && vbus) { /* Host connected */
256 extcon_set_cable_state_(driver->edev, EXTCON_USB_HOST, true); 256 extcon_set_state_sync(driver->edev, EXTCON_USB_HOST, true);
257 pr_debug("Host cable connected\n"); 257 pr_debug("Host cable connected\n");
258 driver->data->new_state = EVT_HOST; 258 driver->data->new_state = EVT_HOST;
259 connect_change(driver); 259 connect_change(driver);
260 } else if (id && !vbus) { /* Disconnected */ 260 } else if (id && !vbus) { /* Disconnected */
261 extcon_set_cable_state_(driver->edev, EXTCON_USB_HOST, false); 261 extcon_set_state_sync(driver->edev, EXTCON_USB_HOST, false);
262 extcon_set_cable_state_(driver->edev, EXTCON_USB, false); 262 extcon_set_state_sync(driver->edev, EXTCON_USB, false);
263 pr_debug("Cable disconnected\n"); 263 pr_debug("Cable disconnected\n");
264 } else if (id && vbus) { /* Device connected */ 264 } else if (id && vbus) { /* Device connected */
265 extcon_set_cable_state_(driver->edev, EXTCON_USB, true); 265 extcon_set_state_sync(driver->edev, EXTCON_USB, true);
266 pr_debug("Device cable connected\n"); 266 pr_debug("Device cable connected\n");
267 driver->data->new_state = EVT_DEVICE; 267 driver->data->new_state = EVT_DEVICE;
268 connect_change(driver); 268 connect_change(driver);
diff --git a/drivers/phy/qualcomm/phy-qcom-usb-hs.c b/drivers/phy/qualcomm/phy-qcom-usb-hs.c
index 4b20abc3ae2f..2d0c70b5589f 100644
--- a/drivers/phy/qualcomm/phy-qcom-usb-hs.c
+++ b/drivers/phy/qualcomm/phy-qcom-usb-hs.c
@@ -155,12 +155,12 @@ static int qcom_usb_hs_phy_power_on(struct phy *phy)
155 } 155 }
156 156
157 if (uphy->vbus_edev) { 157 if (uphy->vbus_edev) {
158 state = extcon_get_cable_state_(uphy->vbus_edev, EXTCON_USB); 158 state = extcon_get_state(uphy->vbus_edev, EXTCON_USB);
159 /* setup initial state */ 159 /* setup initial state */
160 qcom_usb_hs_phy_vbus_notifier(&uphy->vbus_notify, state, 160 qcom_usb_hs_phy_vbus_notifier(&uphy->vbus_notify, state,
161 uphy->vbus_edev); 161 uphy->vbus_edev);
162 ret = extcon_register_notifier(uphy->vbus_edev, EXTCON_USB, 162 ret = devm_extcon_register_notifier(&ulpi->dev, uphy->vbus_edev,
163 &uphy->vbus_notify); 163 EXTCON_USB, &uphy->vbus_notify);
164 if (ret) 164 if (ret)
165 goto err_ulpi; 165 goto err_ulpi;
166 } 166 }
@@ -179,16 +179,8 @@ err_sleep:
179 179
180static int qcom_usb_hs_phy_power_off(struct phy *phy) 180static int qcom_usb_hs_phy_power_off(struct phy *phy)
181{ 181{
182 int ret;
183 struct qcom_usb_hs_phy *uphy = phy_get_drvdata(phy); 182 struct qcom_usb_hs_phy *uphy = phy_get_drvdata(phy);
184 183
185 if (uphy->vbus_edev) {
186 ret = extcon_unregister_notifier(uphy->vbus_edev, EXTCON_USB,
187 &uphy->vbus_notify);
188 if (ret)
189 return ret;
190 }
191
192 regulator_disable(uphy->v3p3); 184 regulator_disable(uphy->v3p3);
193 regulator_disable(uphy->v1p8); 185 regulator_disable(uphy->v1p8);
194 clk_disable_unprepare(uphy->sleep_clk); 186 clk_disable_unprepare(uphy->sleep_clk);
diff --git a/drivers/phy/rockchip/phy-rockchip-inno-usb2.c b/drivers/phy/rockchip/phy-rockchip-inno-usb2.c
index 626883d9d176..ef033089b7a0 100644
--- a/drivers/phy/rockchip/phy-rockchip-inno-usb2.c
+++ b/drivers/phy/rockchip/phy-rockchip-inno-usb2.c
@@ -545,7 +545,7 @@ static void rockchip_usb2phy_otg_sm_work(struct work_struct *work)
545 rockchip_usb2phy_power_off(rport->phy); 545 rockchip_usb2phy_power_off(rport->phy);
546 /* fall through */ 546 /* fall through */
547 case OTG_STATE_B_IDLE: 547 case OTG_STATE_B_IDLE:
548 if (extcon_get_cable_state_(rphy->edev, EXTCON_USB_HOST) > 0) { 548 if (extcon_get_state(rphy->edev, EXTCON_USB_HOST) > 0) {
549 dev_dbg(&rport->phy->dev, "usb otg host connect\n"); 549 dev_dbg(&rport->phy->dev, "usb otg host connect\n");
550 rport->state = OTG_STATE_A_HOST; 550 rport->state = OTG_STATE_A_HOST;
551 rockchip_usb2phy_power_on(rport->phy); 551 rockchip_usb2phy_power_on(rport->phy);
@@ -598,7 +598,7 @@ static void rockchip_usb2phy_otg_sm_work(struct work_struct *work)
598 rport->vbus_attached = vbus_attach; 598 rport->vbus_attached = vbus_attach;
599 599
600 if (notify_charger && rphy->edev) { 600 if (notify_charger && rphy->edev) {
601 extcon_set_cable_state_(rphy->edev, 601 extcon_set_state_sync(rphy->edev,
602 cable, vbus_attach); 602 cable, vbus_attach);
603 if (cable == EXTCON_CHG_USB_SDP) 603 if (cable == EXTCON_CHG_USB_SDP)
604 extcon_set_state_sync(rphy->edev, 604 extcon_set_state_sync(rphy->edev,
@@ -619,7 +619,7 @@ static void rockchip_usb2phy_otg_sm_work(struct work_struct *work)
619 sch_work = true; 619 sch_work = true;
620 break; 620 break;
621 case OTG_STATE_A_HOST: 621 case OTG_STATE_A_HOST:
622 if (extcon_get_cable_state_(rphy->edev, EXTCON_USB_HOST) == 0) { 622 if (extcon_get_state(rphy->edev, EXTCON_USB_HOST) == 0) {
623 dev_dbg(&rport->phy->dev, "usb otg host disconnect\n"); 623 dev_dbg(&rport->phy->dev, "usb otg host disconnect\n");
624 rport->state = OTG_STATE_B_IDLE; 624 rport->state = OTG_STATE_B_IDLE;
625 rockchip_usb2phy_power_off(rport->phy); 625 rockchip_usb2phy_power_off(rport->phy);
@@ -1006,8 +1006,8 @@ static int rockchip_usb2phy_otg_port_init(struct rockchip_usb2phy *rphy,
1006 if (!IS_ERR(rphy->edev)) { 1006 if (!IS_ERR(rphy->edev)) {
1007 rport->event_nb.notifier_call = rockchip_otg_event; 1007 rport->event_nb.notifier_call = rockchip_otg_event;
1008 1008
1009 ret = extcon_register_notifier(rphy->edev, EXTCON_USB_HOST, 1009 ret = devm_extcon_register_notifier(rphy->dev, rphy->edev,
1010 &rport->event_nb); 1010 EXTCON_USB_HOST, &rport->event_nb);
1011 if (ret) 1011 if (ret)
1012 dev_err(rphy->dev, "register USB HOST notifier failed\n"); 1012 dev_err(rphy->dev, "register USB HOST notifier failed\n");
1013 } 1013 }
diff --git a/drivers/usb/gadget/udc/snps_udc_plat.c b/drivers/usb/gadget/udc/snps_udc_plat.c
index 2e11f19e07ae..0ce7b3ba60ff 100644
--- a/drivers/usb/gadget/udc/snps_udc_plat.c
+++ b/drivers/usb/gadget/udc/snps_udc_plat.c
@@ -184,7 +184,7 @@ static int udc_plat_probe(struct platform_device *pdev)
184 goto exit_phy; 184 goto exit_phy;
185 } 185 }
186 186
187 ret = extcon_get_cable_state_(udc->edev, EXTCON_USB); 187 ret = extcon_get_state(udc->edev, EXTCON_USB);
188 if (ret < 0) { 188 if (ret < 0) {
189 dev_err(dev, "Can't get cable state\n"); 189 dev_err(dev, "Can't get cable state\n");
190 goto exit_extcon; 190 goto exit_extcon;
@@ -273,7 +273,7 @@ static int udc_plat_suspend(struct device *dev)
273 udc = dev_get_drvdata(dev); 273 udc = dev_get_drvdata(dev);
274 stop_udc(udc); 274 stop_udc(udc);
275 275
276 if (extcon_get_cable_state_(udc->edev, EXTCON_USB) > 0) { 276 if (extcon_get_state(udc->edev, EXTCON_USB) > 0) {
277 dev_dbg(udc->dev, "device -> idle\n"); 277 dev_dbg(udc->dev, "device -> idle\n");
278 stop_udc(udc); 278 stop_udc(udc);
279 } 279 }
@@ -303,7 +303,7 @@ static int udc_plat_resume(struct device *dev)
303 return ret; 303 return ret;
304 } 304 }
305 305
306 if (extcon_get_cable_state_(udc->edev, EXTCON_USB) > 0) { 306 if (extcon_get_state(udc->edev, EXTCON_USB) > 0) {
307 dev_dbg(udc->dev, "idle -> device\n"); 307 dev_dbg(udc->dev, "idle -> device\n");
308 start_udc(udc); 308 start_udc(udc);
309 } 309 }
diff --git a/include/linux/extcon.h b/include/linux/extcon.h
index 7e206a9f88db..3ba02eecba2e 100644
--- a/include/linux/extcon.h
+++ b/include/linux/extcon.h
@@ -422,15 +422,4 @@ static inline int extcon_unregister_interest(struct extcon_specific_cable_nb
422{ 422{
423 return -EINVAL; 423 return -EINVAL;
424} 424}
425
426static inline int extcon_get_cable_state_(struct extcon_dev *edev, unsigned int id)
427{
428 return extcon_get_state(edev, id);
429}
430
431static inline int extcon_set_cable_state_(struct extcon_dev *edev, unsigned int id,
432 bool cable_state)
433{
434 return extcon_set_state_sync(edev, id, cable_state);
435}
436#endif /* __LINUX_EXTCON_H__ */ 425#endif /* __LINUX_EXTCON_H__ */