From patchwork Fri Nov 20 05:44:18 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chanwoo Choi X-Patchwork-Id: 7664541 Return-Path: X-Original-To: patchwork-linux-omap@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 17CC29F2EC for ; Fri, 20 Nov 2015 05:44:39 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id DC65720497 for ; Fri, 20 Nov 2015 05:44:37 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id E20DA20430 for ; Fri, 20 Nov 2015 05:44:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751692AbbKTFoX (ORCPT ); Fri, 20 Nov 2015 00:44:23 -0500 Received: from mailout1.samsung.com ([203.254.224.24]:48030 "EHLO mailout1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751489AbbKTFoV (ORCPT ); Fri, 20 Nov 2015 00:44:21 -0500 MIME-version: 1.0 Content-type: text/plain; charset=utf-8 Received: from epcpsbgr1.samsung.com (u141.gpu120.samsung.co.kr [203.254.230.141]) by mailout1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTP id <0NY302P8HMLVER10@mailout1.samsung.com>; Fri, 20 Nov 2015 14:44:19 +0900 (KST) Received: from epcpsbgm1new.samsung.com ( [172.20.52.116]) by epcpsbgr1.samsung.com (EPCPMTA) with SMTP id B7.61.29987.333BE465; Fri, 20 Nov 2015 14:44:19 +0900 (KST) X-AuditID: cbfee68d-f79286d000007523-33-564eb333c03e Received: from epmmp1.local.host ( [203.254.227.16]) by epcpsbgm1new.samsung.com (EPCPMTA) with SMTP id 2C.21.24993.333BE465; Fri, 20 Nov 2015 14:44:19 +0900 (KST) Content-transfer-encoding: 8BIT Received: from [10.252.81.195] by mmp1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0NY300A52MLURG30@mmp1.samsung.com>; Fri, 20 Nov 2015 14:44:19 +0900 (KST) Message-id: <564EB332.5090406@samsung.com> Date: Fri, 20 Nov 2015 14:44:18 +0900 From: Chanwoo Choi User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.6.0 To: Felipe Balbi , Tony Lindgren , Rob Herring , MyungJoo Ham Cc: Linux OMAP Mailing List , Linux ARM Kernel Mailing List , Linux Kernel Mailing List Subject: Re: [PATCH] extcon: palmas: add support for using VBUSDET output References: <1447350781-20649-1-git-send-email-balbi@ti.com> <1447351034-21150-1-git-send-email-balbi@ti.com> <564EB0A6.4060407@samsung.com> In-reply-to: <564EB0A6.4060407@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrMIsWRmVeSWpSXmKPExsWyRsSkRNd4s1+Ywdu9QhYH79dbbHp8jdXi 8q45bBazl/SzWNxuXMFm0br3CLvF/iteDuwe375OYvHYtKqTzWPzknqPvi2rGD2O39jO5PF5 k1wAWxSXTUpqTmZZapG+XQJXxsIpa1kLfslUdE9tYmtgbBfvYuTkkBAwkdi3fCUrhC0mceHe erYuRi4OIYEVjBIdV/4DORxgRc1rTCDiSxklmnv72UAaeAUEJX5MvscCUsMsIC9x5FI2hKku MWVKLkT5A0aJg3/6oMq1JDbt6WIHsVkEVCVeTrzABGKzAcX3v7gBtkpUIEKi+0QlSK+IQB+j xPQJ/8DuYRbYwygxYdd0sAZhAU+J1W/72CE2AFWdbNrCApLgFNCW2HPyCyNIQkLgErvEg3eH odYJSHybfIgF4htZiU0HmCE+lpQ4uOIGywRGsVlI/pmF8M8shH8WMDKvYhRNLUguKE5KLzLU K07MLS7NS9dLzs/dxAiMu9P/nvX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+/LO+qeaMnCvXXI9rmTGNue8pSz3dEw/rqvOP/hRS2FGkuGt TX02uQ2Ff+48+rjF8xIfm9MkjZkKPqop61P++6R1VAcy6y9q65U/fmXKVLspdbeC3E33zXwZ 2zLlwRl+n6po0x9+J9Yf+plV8d1GXYmlOCPRUIu5qDgRAOlL3QUDAwAA DLP-Filter: Pass X-MTR: 20000000000000000@CPGS X-CFilter-Loop: Reflected Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org X-Spam-Status: No, score=-7.5 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, 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 Hi Felipe, On 2015? 11? 20? 14:33, Chanwoo Choi wrote: > Hi Felipe, > > Looks good to me. But I have one comment. > > On 2015? 11? 13? 02:57, Felipe Balbi wrote: >> 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)); > > PALMAS_PRIMARY_SECONDARY_PAD1_GPIO_1_SHIFT is appropriate instead of using '3'. > Also, I don't recommend the over line 80. The everything else is good > > >> + 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, >> > > Thanks, > Chanwoo Choi > -- > 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/ > If you are OK about following patch, I'll apply it on extcon branch. diff --git a/drivers/extcon/extcon-palmas.c b/drivers/extcon/extcon-palmas.c index 93c30a885740..f601370c9466 100644 --- a/drivers/extcon/extcon-palmas.c +++ b/drivers/extcon/extcon-palmas.c @@ -296,10 +296,29 @@ 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 << PALMAS_PRIMARY_SECONDARY_PAD1_GPIO_1_SHIFT)); + 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,