Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754094AbbKLR5s (ORCPT ); Thu, 12 Nov 2015 12:57:48 -0500 Received: from arroyo.ext.ti.com ([192.94.94.40]:49649 "EHLO arroyo.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753950AbbKLR5p (ORCPT ); Thu, 12 Nov 2015 12:57:45 -0500 From: Felipe Balbi To: Tony Lindgren , Rob Herring , MyungJoo Ham , Chanwoo Choi CC: Linux OMAP Mailing List , Linux ARM Kernel Mailing List , Linux Kernel Mailing List , Felipe Balbi 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 Content-Type: text/plain Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1779 Lines: 56 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, -- 2.6.2 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/