From patchwork Tue Aug 21 13:55:52 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Loic Poulain X-Patchwork-Id: 144728 Delivered-To: patch@linaro.org Received: by 2002:a2e:9754:0:0:0:0:0 with SMTP id f20-v6csp5306634ljj; Tue, 21 Aug 2018 06:56:03 -0700 (PDT) X-Google-Smtp-Source: AA+uWPzrFEOafVQ1TFN4JGsZm/cbPXNJahScrMaYMCOx6Wxn6xV8/pbb5zNW2x9A2dq72y1p+A6v X-Received: by 2002:a63:cd02:: with SMTP id i2-v6mr46350169pgg.93.1534859763732; Tue, 21 Aug 2018 06:56:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1534859763; cv=none; d=google.com; s=arc-20160816; b=VnIsay0BOENnxvQpa7bHzrQaIcSfeEt3fYSyj/3r3/1N9r6qZ9TIomBEvy/sjlnVbJ S0mJon40r2f2dT38BxTw54IE1ICv0yP8FxoBhS1WN094i1oxyhmGp2yXWN5HFyHyod8X fz+5AB/694wVvlu7jk/LTWc47wMWDTRMemidb7uBRsn4xtbatMkGnLQRbDhHvLUI7Jwz 3XCsA/v3a44lUSWy71no2zEE5tpi1B5kS9DcijAhLwbOp01SI6bVnSPrA3sVxRfWaeWu 3E4ttl9tdEiDyXm4e0KQ1UQd/WiG8fROQv3eaRsGKda6SAX3kcd+mry9No4dioG2jyMc 6x0Q== 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=T16gbVCP6TPIcumFu0woImacmMgPy6bKhyqUl+bq5LE=; b=hH9mdAZDE9wCCrj9YweZcunRQaNMuNhqTsAMqrIJZTVWdem6yjP3TsZIdRizsNm7wY FN9YS6D69pdTpZwvxCW7kJ51cb3brqp5y2JB9YUQK5mpvS8gdwKshBLWUd0py/LZMhPa fENLyLYaL4PQlRIccBc+J23ERoxcI+cSRlsWQeAAqx1HE8frU+DsrvqUR08ojDCEPsb4 /JduqPxarNH8dTTnWmshdStQyodAnzKs5hZuyhSr9ray57D8xoI95YFSOeFz9qTYPGo0 i9V0RBvn3nHFR2ewcOHz9oIpCEcVNz6yewAkVKLhEFI4jcGnUlZBSHj/pMioNHTztVHV U6eg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=FTo6HcaY; spf=pass (google.com: best guess record for domain of linux-usb-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-usb-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 f25-v6si7569484pgm.58.2018.08.21.06.56.03; Tue, 21 Aug 2018 06:56:03 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-usb-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=FTo6HcaY; spf=pass (google.com: best guess record for domain of linux-usb-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-usb-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 S1727306AbeHURQR (ORCPT + 5 others); Tue, 21 Aug 2018 13:16:17 -0400 Received: from mail-wr1-f66.google.com ([209.85.221.66]:42098 "EHLO mail-wr1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727252AbeHURQR (ORCPT ); Tue, 21 Aug 2018 13:16:17 -0400 Received: by mail-wr1-f66.google.com with SMTP id v17-v6so1324129wrr.9 for ; Tue, 21 Aug 2018 06:56:01 -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=T16gbVCP6TPIcumFu0woImacmMgPy6bKhyqUl+bq5LE=; b=FTo6HcaYZ8iuUmXMVLP8yIl008bSIoNQwT9yw/4Lnc1SqaByuXqd/WSokQE/5X6nsg m2buIkbaDVM9DPiEj7OooVCrW6lKWT4DpkNGNJ/mWPQO/fj2yYtvOQDPTdbMivCXcNmM lQBpuC5WSEjx1xKS0hsbNYBybwE+6H2VQPJko= 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=T16gbVCP6TPIcumFu0woImacmMgPy6bKhyqUl+bq5LE=; b=jvBOT+5IjI+SeopGV7haE+sVbtZJq1ET2TmPOhsZKyMrgFNHLyBV7pV/6s4fORi1VA 9mT4vqW6oxNMWIlBUaoqdH5MgJbNMdf0RxWnxqxOzjPYbIApUDVC9LKn3WtBlSKL2PcJ WKXeuWuTckdd4LELwbDGcJlS5EIDV71uvnvTp4kNDwK2eQjh5UpiKCXiHjzacAIpBRwL DI5U60WvTn5Yvfcywslx0Mchlsv1RZ4eKcDiNayZ1B8uDx6R6bBeXrbUiP5z1hVAXk08 4i8+Uj7ng1d8lwn+76B2o6CnH5V7hvGtZ2jXl3QCtbXGS6PUUfoCbMgRRuAWjM8CwMfM tUpQ== X-Gm-Message-State: APzg51DyrOxHRnIEIBw2IQ+eZlWHKg25ZxjJvVAJchR8K0tiBq7iJZYX aoS7kDz75WJLWpX80rhym3/bQg3rlyw= X-Received: by 2002:adf:ea92:: with SMTP id s18-v6mr1316053wrm.284.1534859761228; Tue, 21 Aug 2018 06:56:01 -0700 (PDT) Received: from lpoulain-ThinkPad-T470p.home (AToulouse-655-1-762-165.w109-220.abo.wanadoo.fr. [109.220.142.165]) by smtp.gmail.com with ESMTPSA id l24-v6sm16728523wrb.65.2018.08.21.06.56.00 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 21 Aug 2018 06:56:00 -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, Loic Poulain Subject: [PATCH 2/6] usb: chipidea: Support generic usb extcon Date: Tue, 21 Aug 2018 15:55:52 +0200 Message-Id: <1534859756-6955-2-git-send-email-loic.poulain@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1534859756-6955-1-git-send-email-loic.poulain@linaro.org> References: <1534859756-6955-1-git-send-email-loic.poulain@linaro.org> Sender: linux-usb-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org Add compatibility for extcon-usb-gpio which can handle more than one cable per instance, allowing coherency of USB cable states (USB/USB-HOST). These states can be generated from ID or/and VBUS pins. In case only one extcon device is associated to the USB device, and this device supports USB and USB-HOST cable states, we now use it for both VBUS (USB) and ID (USB-HOST) notifier. Signed-off-by: Loic Poulain --- drivers/usb/chipidea/core.c | 11 +++++++++++ 1 file changed, 11 insertions(+) -- 2.7.4 diff --git a/drivers/usb/chipidea/core.c b/drivers/usb/chipidea/core.c index 03e52fc..c595718 100644 --- a/drivers/usb/chipidea/core.c +++ b/drivers/usb/chipidea/core.c @@ -699,6 +699,17 @@ static int ci_get_platdata(struct device *dev, ext_id = extcon_get_edev_by_phandle(dev, 1); if (IS_ERR(ext_id) && PTR_ERR(ext_id) != -ENODEV) return PTR_ERR(ext_id); + + /* + * Some extcon devices like extcon-usb-gpio have only one + * instance for both USB and USB-HOST cable states. + */ + if (!IS_ERR(ext_vbus) && IS_ERR(ext_id)) { + if (extcon_get_state(ext_vbus, EXTCON_USB) >= 0 && + extcon_get_state(ext_vbus, EXTCON_USB_HOST) >= 0) { + ext_id = ext_vbus; + } + } } cable = &platdata->vbus_extcon; From patchwork Tue Aug 21 13:55:53 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Loic Poulain X-Patchwork-Id: 144729 Delivered-To: patch@linaro.org Received: by 2002:a2e:9754:0:0:0:0:0 with SMTP id f20-v6csp5306663ljj; Tue, 21 Aug 2018 06:56:06 -0700 (PDT) X-Google-Smtp-Source: AA+uWPx9MM5RPTmHq7SGXpPHZHLZce3iDSOV8JKNn5Sts+CFhv0PZn4IivLl4cMAqCGEqV7luPd3 X-Received: by 2002:a62:d74f:: with SMTP id v15-v6mr21439886pfl.257.1534859765904; Tue, 21 Aug 2018 06:56:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1534859765; cv=none; d=google.com; s=arc-20160816; b=bV9VLZQ1MMoun3cZVZs44jJ/zXIfm5iKr11ERQU4qDOpxIrOej1TZDb04GBc1fZiCP NMDK8+xNoY84+esrDNb13kGzkD3u1Uq9wc8zW29et9JGBW94kxLdmtLHoMgkw1/T4wf/ 9Ime+e10VO7zTKNu/Ye6VtcnNGIBYsmGxkjJLHmLJfzdggHsYegGouPfh1UcuHOTXex3 aMNmTmz3AmY1noisbGdxZhuyKDfnTAjoROQHYs7YQxqSafj7HI9Cp11wrQakdbIfcnD9 mIHBS2HFlgs4Ngup0zLM3TrQp0JUWEcu1DRb7WSRP/Ttb7gAXNsgbi6TIWdDSPWwCFtU uxTw== 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=K+768cvU4pPkRaQ3YhlP5lEiMFUDD4Pvl2Aw6Stu7VM=; b=Y9UJ73Rv/wkInU8xXFLqJj8BW3q7jXaHq9VZTh7PJmV5CDxpAnWXRs58+4Qp9c7Yrv VjDZhUnSos0FaTG4zm+Hpaf8sqA5qIYj7zXV5N8vTWxmqBROwXkN1RYxT5OBAoBtz379 7PDL87ke1aL5C5GPuktSzd33aX/RF+e+HhG8zR6Dmfnbv/ve9khgSz1WbBDkXgbVJy0l QQD8cFNWRfZhD3e2YQGv8Tkzz+NEuZ20JBBXCn9FkPK7DpFtKooYdT3Dwr9SqN0SD7rz yvwh44St2+vdhO645RqVDnLNSgNik5pSX51J9k5sYL8Bo7gnZwstUsezfHQ+gOVGXcmJ sw9w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=aV4isIV0; spf=pass (google.com: best guess record for domain of linux-usb-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-usb-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 f25-v6si7569484pgm.58.2018.08.21.06.56.05; Tue, 21 Aug 2018 06:56:05 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-usb-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=aV4isIV0; spf=pass (google.com: best guess record for domain of linux-usb-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-usb-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 S1727345AbeHURQT (ORCPT + 5 others); Tue, 21 Aug 2018 13:16:19 -0400 Received: from mail-wr1-f66.google.com ([209.85.221.66]:43771 "EHLO mail-wr1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727252AbeHURQS (ORCPT ); Tue, 21 Aug 2018 13:16:18 -0400 Received: by mail-wr1-f66.google.com with SMTP id k5-v6so4411707wre.10 for ; Tue, 21 Aug 2018 06:56:03 -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=K+768cvU4pPkRaQ3YhlP5lEiMFUDD4Pvl2Aw6Stu7VM=; b=aV4isIV01NCTUOo6lJhKgs30jUfcFF3l/qpAEyM49F48jfqvWCfTmU8gZmHLTWkwdz V1IXZoSNK2KngMx0OwWYclZCROMzyfim8waLfH+vxKyqu59zYH2BcjzHSKWfjFnkz4UT avvxY2ZMyM6baGcvj8yzI3mvlOuzRUS872nzw= 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=K+768cvU4pPkRaQ3YhlP5lEiMFUDD4Pvl2Aw6Stu7VM=; b=OG4MRRdNwJybLFnD8nprYy/u43/oxdcaab1LtyxMyAwSoApRp+yL0sjz5RuCMzVZqB uxjPfH7avSJu8RZdv58WVttD1YZm9CcZF+TFt1kSmYaRAdRTd4/TWkVnf3Lc0Sjr0P+w Nd2F6ztcNvK938UAA/CL0AQ8as2L0ErarFahg8cWk6pANnmbJMP4iaw2dOQ+CTpQRQPn 6Np0xkRRH4nvbE1FFSoLA0UcGTIPHVjHjOZScD4QWgk02IKAWNLYRnTE/UI+kf9gKt5J 5QnuhY0TvIsMugm5hSRX993QaVq8V8Sq4QD1/fwAmCIb6IZvZt0BIENWDLDkZ2R1jjtL nsfw== X-Gm-Message-State: APzg51Cido8XaqbrGNRTKtqA8/fC5LvuWe5oQqxoKzrCmihaOXa+KzMl sz6RIgguRJyUYq47U+YlDIxEVw== X-Received: by 2002:a5d:4fc3:: with SMTP id h3-v6mr3183393wrw.261.1534859762734; Tue, 21 Aug 2018 06:56:02 -0700 (PDT) Received: from lpoulain-ThinkPad-T470p.home (AToulouse-655-1-762-165.w109-220.abo.wanadoo.fr. [109.220.142.165]) by smtp.gmail.com with ESMTPSA id l24-v6sm16728523wrb.65.2018.08.21.06.56.01 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 21 Aug 2018 06:56:02 -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, Loic Poulain Subject: [PATCH 3/6] usb: chipidea: Prevent unbalanced IRQ disable Date: Tue, 21 Aug 2018 15:55:53 +0200 Message-Id: <1534859756-6955-3-git-send-email-loic.poulain@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1534859756-6955-1-git-send-email-loic.poulain@linaro.org> References: <1534859756-6955-1-git-send-email-loic.poulain@linaro.org> Sender: linux-usb-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org The ChipIdea IRQ is disabled before scheduling the otg work and re-enabled on otg work completion. However if the job is already scheduled we have to undo the effect of disable_irq int order to balance the IRQ disable-depth value. Fixes: be6b0c1bd0be ("usb: chipidea: using one inline function to cover queue work operations") Signed-off-by: Loic Poulain --- drivers/usb/chipidea/otg.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) -- 2.7.4 diff --git a/drivers/usb/chipidea/otg.h b/drivers/usb/chipidea/otg.h index 7e7428e..4f8b817 100644 --- a/drivers/usb/chipidea/otg.h +++ b/drivers/usb/chipidea/otg.h @@ -17,7 +17,8 @@ void ci_handle_vbus_change(struct ci_hdrc *ci); static inline void ci_otg_queue_work(struct ci_hdrc *ci) { disable_irq_nosync(ci->irq); - queue_work(ci->wq, &ci->work); + if (queue_work(ci->wq, &ci->work) == false) + enable_irq(ci->irq); } #endif /* __DRIVERS_USB_CHIPIDEA_OTG_H */