From patchwork Thu Nov 12 17:57:14 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Felipe Balbi X-Patchwork-Id: 7604531 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id BF5BDBF90C for ; Thu, 12 Nov 2015 17:59:40 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id F37D02081F for ; Thu, 12 Nov 2015 17:59:39 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 30D9420825 for ; Thu, 12 Nov 2015 17:59:38 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1Zww81-0000F2-AL; Thu, 12 Nov 2015 17:57:45 +0000 Received: from arroyo.ext.ti.com ([192.94.94.40]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1Zww7x-0008Qh-B0 for linux-arm-kernel@lists.infradead.org; Thu, 12 Nov 2015 17:57:42 +0000 Received: from dflxv15.itg.ti.com ([128.247.5.124]) by arroyo.ext.ti.com (8.13.7/8.13.7) with ESMTP id tACHvGrj012111; Thu, 12 Nov 2015 11:57:16 -0600 Received: from DLEE70.ent.ti.com (dlee70.ent.ti.com [157.170.170.113]) by dflxv15.itg.ti.com (8.14.3/8.13.8) with ESMTP id tACHvG7g026747; Thu, 12 Nov 2015 11:57:16 -0600 Received: from dflp32.itg.ti.com (10.64.6.15) by DLEE70.ent.ti.com (157.170.170.113) with Microsoft SMTP Server id 14.3.224.2; Thu, 12 Nov 2015 11:57:16 -0600 Received: from localhost (ileax41-snat.itg.ti.com [10.172.224.153]) by dflp32.itg.ti.com (8.14.3/8.13.8) with ESMTP id tACHvFvb024711; Thu, 12 Nov 2015 11:57:16 -0600 From: Felipe Balbi To: Tony Lindgren , Rob Herring , MyungJoo Ham , Chanwoo Choi Subject: [PATCH] extcon: palmas: add support for using VBUSDET output Date: Thu, 12 Nov 2015 11:57:14 -0600 Message-ID: <1447351034-21150-1-git-send-email-balbi@ti.com> X-Mailer: git-send-email 2.6.2 In-Reply-To: <1447350781-20649-1-git-send-email-balbi@ti.com> References: <1447350781-20649-1-git-send-email-balbi@ti.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20151112_095741_502535_E08E929C X-CRM114-Status: GOOD ( 13.16 ) X-Spam-Score: -7.3 (-------) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Linux OMAP Mailing List , Felipe Balbi , Linux Kernel Mailing List , Linux ARM Kernel Mailing List Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP TPS659038 can remux its GPIO_1 as VBUSDET output, which can be tied to a SoC GPIO and used as a VBUS interrupt. Beagle X15 uses that, in fact, and without it, I could not get USB peripheral working with that board. Signed-off-by: Felipe Balbi --- drivers/extcon/extcon-palmas.c | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/drivers/extcon/extcon-palmas.c b/drivers/extcon/extcon-palmas.c index 93c30a885740..7985d092c069 100644 --- a/drivers/extcon/extcon-palmas.c +++ b/drivers/extcon/extcon-palmas.c @@ -296,10 +296,28 @@ static int palmas_usb_probe(struct platform_device *pdev) } if (palmas_usb->enable_vbus_detection) { + int irq = platform_get_irq(pdev, 0); + + if (irq > 0) { + /* remux GPIO_1 as VBUSDET */ + status = palmas_update_bits(palmas, PALMAS_PU_PD_OD_BASE, + PALMAS_PRIMARY_SECONDARY_PAD1, + PALMAS_PRIMARY_SECONDARY_PAD1_GPIO_1_MASK, + (1 << 3)); + if (status < 0) { + dev_err(&pdev->dev, "can't remux GPIO1\n"); + return status; + } + + palmas_usb->vbus_irq = irq; + } else { + irq = regmap_irq_get_virq(palmas->irq_data, + PALMAS_VBUS_IRQ); + palmas_usb->vbus_irq = irq; + } + palmas_usb->vbus_otg_irq = regmap_irq_get_virq(palmas->irq_data, PALMAS_VBUS_OTG_IRQ); - palmas_usb->vbus_irq = regmap_irq_get_virq(palmas->irq_data, - PALMAS_VBUS_IRQ); status = devm_request_threaded_irq(palmas_usb->dev, palmas_usb->vbus_irq, NULL, palmas_vbus_irq_handler,