From patchwork Tue Sep 4 15:18:58 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Loic Poulain X-Patchwork-Id: 145934 Delivered-To: patch@linaro.org Received: by 2002:a2e:1648:0:0:0:0:0 with SMTP id 8-v6csp3791578ljw; Tue, 4 Sep 2018 08:19:12 -0700 (PDT) X-Google-Smtp-Source: ANB0VdYWMIEd0tXUKGooQ957rwtUDK7Gwe+dJjl1iNwRF8aPg9ZPrZS5t/vc9WUSQIWbv/UJcZ3z X-Received: by 2002:a63:3dc6:: with SMTP id k189-v6mr17102573pga.191.1536074351588; Tue, 04 Sep 2018 08:19:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536074351; cv=none; d=google.com; s=arc-20160816; b=sR/tWF5+Qs8EtIFhp916GsdSWvO8fDEbghdoLCE8g1XYqEWeqSm9hRc7OX2YIxnCiW 48FUrPVDWztjsqiFyJbTw4M8g0Bv6INAioWsRoAsluzcH5EUbOZT2BdPYXgTkgt5p8nJ LmR7G4VFcYP6MUZbFfzr87KVecD1oup63KklUptSv+MfR8DAPC7E+lQxS3ct3ncmmwvi hM6Z9l2XsoEVzP9cE5i3AvFihMXqLSs1NCtpkvOVVgJ2dAHBMdrzFCDjLVpyiXNA0Spx OTicmpnq3OSL8plpHXi27enZudggRzt4qpkl+oui/JTIgLoTaaA/GYNZdQ5guF9rqBo+ A/iQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=DaoitWn4N4E8MxKe6c9On/izFsNnJ18tWXmCQk3yml4=; b=l2Q3nS8qUSjxWOSbYQn7S5RNWNhfbAngdzUoXqxXh52dpiEsLI8X17VlTGi6up7wP2 C94+zocsGxqD1EwYHpcchiLptiiLoeRGU3KeqBpLw6J3di5IIbAG8aIhDtNHwPhyMveQ iJxeeZrlUpOcKK+2f5hLNZekG/QGkUq7fDAdL9bnypKgikmjmXNw6L2Ng8M8HnsNDDFp +rlO6yKitsA2giX4wDnS5sqaxu01aak07BMPqg9vQpoJXCn1vphpe5O3HdBLaQ/lbGiP awm9mjYB9GnBD5S4dSoV1DB1SIg6VJnfGzmdZmzNHr0wqr2OnuwW1aDvfrWSd5Aoq7EK i+qA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=fa1LNNpX; spf=pass (google.com: best guess record for domain of linux-arm-msm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-arm-msm-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n15-v6si23319017pgc.309.2018.09.04.08.19.11; Tue, 04 Sep 2018 08:19:11 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-arm-msm-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 header.s=google header.b=fa1LNNpX; spf=pass (google.com: best guess record for domain of linux-arm-msm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-arm-msm-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727613AbeIDTom (ORCPT + 13 others); Tue, 4 Sep 2018 15:44:42 -0400 Received: from mail-wr1-f67.google.com ([209.85.221.67]:36572 "EHLO mail-wr1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727615AbeIDTom (ORCPT ); Tue, 4 Sep 2018 15:44:42 -0400 Received: by mail-wr1-f67.google.com with SMTP id m27-v6so4420447wrf.3 for ; Tue, 04 Sep 2018 08:19:09 -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=DaoitWn4N4E8MxKe6c9On/izFsNnJ18tWXmCQk3yml4=; b=fa1LNNpXRiUjwIDuNA5uLZ6TgYcZTxhpgDq4ZIE7lYKoik1y+ZYlTXjdgEwblpAiVN 6cAmmsIejoGUQyqAI/6NlFIuccnQ/8ndhU51CkHkyl0rDpqN64cWY/mK/HNDw8z7B2J3 cYFbIT4PeXZCjTnNtIyo4joLyYLfb9RS1obsw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=DaoitWn4N4E8MxKe6c9On/izFsNnJ18tWXmCQk3yml4=; b=sEV+G8smbZCV2rRXwoWFwsqxRWG+sWVuu2mKNjutf9SJwp0cgp3d8mcix58Gf40IeK mON6N6jImpP43YDH2j5/SOZ8ylEa7eM7dRf+PG0bezHeTsPR6uOyWUYJDokHzctVvY53 IAnd/mRZf/hxy1G3lrxwUjP55pydfYW+kS4Ay9RhpcEu/xRuyREBAMxTWLHzJH8bcHfZ sTKm5QWDnHRIQGmDxTT7LfP6DsIUKeny/Uvqq35A9SmSdvhR7w+Ql1ri38iXdvmUHsqS DUO40BU56qJ7vhApvqPp61Rm3XyPVi36m4Bv3RYndSPoJCxtnjHYphuDoZegYk9glyRX 9A8w== X-Gm-Message-State: APzg51D5COVp3LntWA+lJAWO7JPKIbeXR8IxpHRaDdjW8xkitz6iGP9G d5BRDSpmG5zwdPuQNbbW3r6OYQ== X-Received: by 2002:adf:be81:: with SMTP id i1-v6mr21422160wrh.235.1536074348497; Tue, 04 Sep 2018 08:19:08 -0700 (PDT) Received: from lpoulain-ThinkPad-T470p.home (AToulouse-654-1-394-222.w90-55.abo.wanadoo.fr. [90.55.193.222]) by smtp.gmail.com with ESMTPSA id l24-v6sm40255033wrb.65.2018.09.04.08.19.07 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 04 Sep 2018 08:19:07 -0700 (PDT) From: Loic Poulain To: Peter.Chen@nxp.com Cc: linux-usb@vger.kernel.org, linux-arm-msm@vger.kernel.org, david.brown@linaro.org, robh+dt@kernel.org, bjorn.andersson@linaro.org, andy.gross@linaro.org, andy.shevchenko@gmail.com, Loic Poulain Subject: [PATCH v3 4/6] usb: chipidea: Fix otg event handler Date: Tue, 4 Sep 2018 17:18:58 +0200 Message-Id: <1536074340-14840-4-git-send-email-loic.poulain@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1536074340-14840-1-git-send-email-loic.poulain@linaro.org> References: <1536074340-14840-1-git-send-email-loic.poulain@linaro.org> Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org At OTG work running time, it's possible that several events need to be addressed (e.g. ID and VBUS events). The current implementation handles only one event at a time which leads to ignoring the other one. Fix it. Signed-off-by: Loic Poulain --- v2: v3: no change drivers/usb/chipidea/otg.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) -- 2.7.4 diff --git a/drivers/usb/chipidea/otg.c b/drivers/usb/chipidea/otg.c index db4ceff..f25d482 100644 --- a/drivers/usb/chipidea/otg.c +++ b/drivers/usb/chipidea/otg.c @@ -203,14 +203,17 @@ static void ci_otg_work(struct work_struct *work) } pm_runtime_get_sync(ci->dev); + if (ci->id_event) { ci->id_event = false; ci_handle_id_switch(ci); - } else if (ci->b_sess_valid_event) { + } + + if (ci->b_sess_valid_event) { ci->b_sess_valid_event = false; ci_handle_vbus_change(ci); - } else - dev_err(ci->dev, "unexpected event occurs at %s\n", __func__); + } + pm_runtime_put_sync(ci->dev); enable_irq(ci->irq);