From patchwork Sun Jun 26 07:28:25 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Boyd X-Patchwork-Id: 70860 Delivered-To: patch@linaro.org Received: by 10.140.28.4 with SMTP id 4csp554716qgy; Sun, 26 Jun 2016 00:29:29 -0700 (PDT) X-Received: by 10.98.106.133 with SMTP id f127mr22445559pfc.139.1466926163278; Sun, 26 Jun 2016 00:29:23 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 1si18076330paj.218.2016.06.26.00.29.22; Sun, 26 Jun 2016 00:29:23 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752331AbcFZH3U (ORCPT + 30 others); Sun, 26 Jun 2016 03:29:20 -0400 Received: from mail-pf0-f171.google.com ([209.85.192.171]:33602 "EHLO mail-pf0-f171.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752102AbcFZH2w (ORCPT ); Sun, 26 Jun 2016 03:28:52 -0400 Received: by mail-pf0-f171.google.com with SMTP id i123so51901400pfg.0 for ; Sun, 26 Jun 2016 00:28:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=9V6xSt82IDG3W8RzPuhcWQ7rieB1TkdZjL4QkSMXEQg=; b=Rxx9+cDHi95g08e6V0VUFdYatNVF6IljEZ4RfYg9B0GOTgb3CtvtMGAEJ4GrTY/yOo ba2D8lOj+e8WSJB4tcYFEsIT/xMlda4I7r0VJrPuQRCAM93WcgFmjpXNPo6OuuFSlEgr jpAEo0mf/WpeDQMwCWtnQA369X+Lc3b2dQ8rg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=9V6xSt82IDG3W8RzPuhcWQ7rieB1TkdZjL4QkSMXEQg=; b=AcaTmVwH66RMNxY98akfOLaUZFT7ZDUOjJC0aMUse1rYHol/vqmEtg9Egqz/SFC+2y xWg+RiqmIV+jEbaSQOvzWUE7gL7PNqjx/BoHnVw8mmvc+7CmOuSsuJPQiwSgNHM3sEQr XI6jiEMFtsyFWlbndo1BbQd8RxaaF+bCNA46bb4tWMfhutO6WETl6wMOG9DTekGRORZr rdu57NFJSSmMoR7WugtIpsRyjqfh0ooKO2sxxO4opKUgIpm/cB3XM7i8Yr/MQ+VP5yIB 4xVILn0RxFC+kuV9wAO/AalsJylGRr4sZhwY9CP99bOW+w4DAQQs+ZuMtM/6rDUc7YNi O/Sg== X-Gm-Message-State: ALyK8tLG2eqa1wcIUhqvuTQykPg0IWVnLlq4b2t8sO3x8tPf5NTwWLnwPW72IiADFdTcjUrl X-Received: by 10.98.26.148 with SMTP id a142mr22099417pfa.46.1466926132142; Sun, 26 Jun 2016 00:28:52 -0700 (PDT) Received: from localhost.localdomain (ip68-101-172-78.sd.sd.cox.net. [68.101.172.78]) by smtp.gmail.com with ESMTPSA id f138sm3790495pfa.17.2016.06.26.00.28.51 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 26 Jun 2016 00:28:51 -0700 (PDT) From: Stephen Boyd To: linux-usb@vger.kernel.org Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, Andy Gross , Bjorn Andersson , Neil Armstrong , Arnd Bergmann , Felipe Balbi , Peter Chen , Greg Kroah-Hartman Subject: [PATCH 08/21] usb: chipidea: Kick OTG state machine for AVVIS with vbus extcon Date: Sun, 26 Jun 2016 00:28:25 -0700 Message-Id: <20160626072838.28082-9-stephen.boyd@linaro.org> X-Mailer: git-send-email 2.9.0.rc2.8.ga28705d In-Reply-To: <20160626072838.28082-1-stephen.boyd@linaro.org> References: <20160626072838.28082-1-stephen.boyd@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Force the OTG state machine to go forward when we're using an extcon for vbus detection. In this case, the controller may never raise an interrupt for AVVIS, so we need to simulate the event by toggling the appropriate OTG fsm bits and kicking the state machine again. Cc: Peter Chen Cc: Greg Kroah-Hartman Signed-off-by: Stephen Boyd --- drivers/usb/chipidea/otg_fsm.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) -- 2.9.0.rc2.8.ga28705d diff --git a/drivers/usb/chipidea/otg_fsm.c b/drivers/usb/chipidea/otg_fsm.c index de8e22ec3902..aab076fc4d82 100644 --- a/drivers/usb/chipidea/otg_fsm.c +++ b/drivers/usb/chipidea/otg_fsm.c @@ -475,6 +475,14 @@ static void ci_otg_drv_vbus(struct otg_fsm *fsm, int on) return; } } + /* + * Force state machine forward if we use extcon + * to detect vbus state (i.e. simulate AVVIS event) + */ + if (!IS_ERR(ci->platdata->vbus_extcon.edev)) { + fsm->a_vbus_vld = 1; + ci_otg_queue_work(ci); + } /* Disable data pulse irq */ hw_write_otgsc(ci, OTGSC_DPIE, 0); @@ -486,6 +494,15 @@ static void ci_otg_drv_vbus(struct otg_fsm *fsm, int on) fsm->a_bus_drop = 1; fsm->a_bus_req = 0; + /* + * Force state machine forward if we use extcon + * to detect vbus state (i.e. simulate AVVIS event) + */ + if (!IS_ERR(ci->platdata->vbus_extcon.edev)) { + fsm->a_vbus_vld = 0; + fsm->b_conn = 0; + ci_otg_queue_work(ci); + } } }