Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754897AbdDNSob (ORCPT ); Fri, 14 Apr 2017 14:44:31 -0400 Received: from mail.savoirfairelinux.com ([208.88.110.44]:60084 "EHLO mail.savoirfairelinux.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753352AbdDNSo3 (ORCPT ); Fri, 14 Apr 2017 14:44:29 -0400 From: Damien Riegel To: linux-usb@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Felipe Balbi , Greg Kroah-Hartman , MyungJoo Ham , Chanwoo Choi , kernel@savoirfairelinux.com, Damien Riegel Subject: [RFC][PATCH 2/3] usb: phy: msm: notify charger when power supply is unplugged Date: Fri, 14 Apr 2017 14:43:29 -0400 Message-Id: <20170414184330.22296-3-damien.riegel@savoirfairelinux.com> X-Mailer: git-send-email 2.12.2 In-Reply-To: <20170414184330.22296-1-damien.riegel@savoirfairelinux.com> References: <20170414184330.22296-1-damien.riegel@savoirfairelinux.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1014 Lines: 26 With the current code, msm_otg_notify_charger doesn't get called when a power supply identified as a DCP is unplugged. To work around that, update charger info and call the notify function when switching from idle to host. Signed-off-by: Damien Riegel --- drivers/usb/phy/phy-msm-usb.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/usb/phy/phy-msm-usb.c b/drivers/usb/phy/phy-msm-usb.c index c1460182bc56..f89a2a540f71 100644 --- a/drivers/usb/phy/phy-msm-usb.c +++ b/drivers/usb/phy/phy-msm-usb.c @@ -1349,6 +1349,9 @@ static void msm_otg_sm_work(struct work_struct *w) writel(readl(USB_OTGSC) & ~OTGSC_BSVIE, USB_OTGSC); msm_otg_start_host(otg->usb_phy, 1); otg->state = OTG_STATE_A_HOST; + motg->chg_state = USB_CHG_STATE_UNDEFINED; + motg->chg_type = USB_INVALID_CHARGER; + msm_otg_notify_charger(motg, 0); } else if (test_bit(B_SESS_VLD, &motg->inputs)) { switch (motg->chg_state) { case USB_CHG_STATE_UNDEFINED: -- 2.12.2