Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1623846

[RFC][PATCH 1/3] usb: phy: msm: notify charger after setting charger info

From Damien Riegel <damien.riegel@savoirfairelinux.com>
Newsgroups linux.kernel
Subject [RFC][PATCH 1/3] usb: phy: msm: notify charger after setting charger info
Date 2017-04-14 20:50 +0200
Message-ID <twesa-4Ay-29@gated-at.bofh.it> (permalink)
References <twes9-4Ay-5@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


Move calls to msm_otg_notify_charger after attributes chg_state and
chg_type have been set. That way the function can use them and not rely
only on the "mA" parameter.

Signed-off-by: Damien Riegel <damien.riegel@savoirfairelinux.com>
---
 drivers/usb/phy/phy-msm-usb.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/usb/phy/phy-msm-usb.c b/drivers/usb/phy/phy-msm-usb.c
index 93d9aaad2994..c1460182bc56 100644
--- a/drivers/usb/phy/phy-msm-usb.c
+++ b/drivers/usb/phy/phy-msm-usb.c
@@ -1392,9 +1392,9 @@ static void msm_otg_sm_work(struct work_struct *w)
 				pm_runtime_put_sync(otg->usb_phy->dev);
 				msm_otg_reset(otg->usb_phy);
 			}
-			msm_otg_notify_charger(motg, 0);
 			motg->chg_state = USB_CHG_STATE_UNDEFINED;
 			motg->chg_type = USB_INVALID_CHARGER;
+			msm_otg_notify_charger(motg, 0);
 		}
 
 		if (otg->state == OTG_STATE_B_IDLE)
@@ -1404,10 +1404,10 @@ static void msm_otg_sm_work(struct work_struct *w)
 		dev_dbg(otg->usb_phy->dev, "OTG_STATE_B_PERIPHERAL state\n");
 		if (!test_bit(B_SESS_VLD, &motg->inputs) ||
 				!test_bit(ID, &motg->inputs)) {
-			msm_otg_notify_charger(motg, 0);
-			msm_otg_start_peripheral(otg->usb_phy, 0);
 			motg->chg_state = USB_CHG_STATE_UNDEFINED;
 			motg->chg_type = USB_INVALID_CHARGER;
+			msm_otg_notify_charger(motg, 0);
+			msm_otg_start_peripheral(otg->usb_phy, 0);
 			otg->state = OTG_STATE_B_IDLE;
 			msm_otg_reset(otg->usb_phy);
 			schedule_work(w);
-- 
2.12.2

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[RFC][PATCH 0/3] add EXTCON_CHG_USB_* cables to MSM USB phy Damien Riegel <damien.riegel@savoirfairelinux.com> - 2017-04-14 20:50 +0200
  [RFC][PATCH 1/3] usb: phy: msm: notify charger after setting charger info Damien Riegel <damien.riegel@savoirfairelinux.com> - 2017-04-14 20:50 +0200
  [RFC][PATCH 3/3] usb: phy: msm: use extcon to notify charger Damien Riegel <damien.riegel@savoirfairelinux.com> - 2017-04-14 20:50 +0200
  [RFC][PATCH 2/3] usb: phy: msm: notify charger when power supply is unplugged Damien Riegel <damien.riegel@savoirfairelinux.com> - 2017-04-14 20:50 +0200

csiph-web