Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp4414576img; Tue, 26 Mar 2019 08:58:43 -0700 (PDT) X-Google-Smtp-Source: APXvYqw74LptCFad4cDHAtc8I0YLp3QvIugOHamgN6ek80V2MFDo0DW67k58jfUgDSf9NzunyHrY X-Received: by 2002:a62:3996:: with SMTP id u22mr29457734pfj.28.1553615922895; Tue, 26 Mar 2019 08:58:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553615922; cv=none; d=google.com; s=arc-20160816; b=xMbjrRE2O1PVSPBcN2LZpKDyn1BzuqIQAuzzX9Mkp/xFvbUcFCxkj6RpdtAurHAWFc qz3GRbVgSNIsyubjCDXf4Rz7OgugJdPyaGuu/LmOc8qu8s0H6o2e3L+AWeO4DV+wJcZ6 76M2s6ZZpjPDRnKReGwrilE+ND2F12TgiBAhSaVkVng1C+KnT3obYod3dglvXFyFV+r5 tSQ1h6G4Mjkbh0MHo1/u4BGU/kem93eu1fuRtl5YBCyU8dPilU7xpXR+v3ZB9abdRFN/ mrZPCyVVeBLC60wApEBCHIAv/DKJgaafSRJAG3lv9orNjKW0bUJIFQmErXNgDezax8KQ yUoQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=oFSbPR6gZ80NJT0kvphV1uF3Ic6xnPJohJygHS7zRgQ=; b=bdE5i8Y91wyYgEHTnmkdV0SDpzWWM6/mBmbK9pu6FpR/8l8pRcMl4K1O5s0ViM6vrW tMq9ECvjXcNvdTAFbzSRB5hlAOxLe0ElmeSCkougwWaBu/8ABWtRzwxhobMfQgYvgigZ cmJ6RwzYipRP4jN7lMDkxde40M/nAaNwDAq/9nejWwUfpQRMf9gC5jtghwmmpoEYDO48 hfI5KFLlzh/jghHj7U8pCO/6TfHjk/honDH1vWo24HNo3v69+RI07RUHVsGzzTmayalJ h5+WNdgZVXvyfuwzn32l+bhAFDbFlYDu/EZn1S3GS/RERfWhPGQZx5l0It5LfUfI8A5E pdXA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bgdev-pl.20150623.gappssmtp.com header.s=20150623 header.b=aOyyfHUd; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id cs12si17861252plb.127.2019.03.26.08.58.27; Tue, 26 Mar 2019 08:58:42 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-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=@bgdev-pl.20150623.gappssmtp.com header.s=20150623 header.b=aOyyfHUd; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731881AbfCZP5o (ORCPT + 99 others); Tue, 26 Mar 2019 11:57:44 -0400 Received: from mail-wr1-f65.google.com ([209.85.221.65]:34068 "EHLO mail-wr1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731599AbfCZP5l (ORCPT ); Tue, 26 Mar 2019 11:57:41 -0400 Received: by mail-wr1-f65.google.com with SMTP id p10so15032135wrq.1 for ; Tue, 26 Mar 2019 08:57:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=oFSbPR6gZ80NJT0kvphV1uF3Ic6xnPJohJygHS7zRgQ=; b=aOyyfHUdTD+0/C9sDYB9DC3OSZ8vRYaurmgBJITGhusdwLsJ+dzzvg8NJz9IDzsEKa DPDRv1KfS3coVpzetOLZg95go1aCY7GmwKWqc31K3ocNQGJepodvoncJjGWy06H4kcYp 9Gb71Rqh5Jzcn6fNi7A9BMsmFFNtDoUO2m6b2YMHBLlGa66B3BQCm5EtYI7BtytV5tD/ 3SyhpzCfA0ggyUSgzWpQO6TxliKpXsB0t+jOoFREzmuzEpLMHsWAp5i4fDxYVyutvgCB xpWXqq/4SvYmGf02ysXCWU12RYuHrRr+qaZiSDwOXAWrdm/3XrIn00HOcdMfIjXCk34q IoOw== 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:mime-version:content-transfer-encoding; bh=oFSbPR6gZ80NJT0kvphV1uF3Ic6xnPJohJygHS7zRgQ=; b=qtkTVY+YJ0U02/P10m4oqV7SrHjmZuqNc+sLaBHl+ttcxhlt+jo5ybj6KODZ1NgW+0 +BYqLB3TmecRmTr6eutaFFK4ImBLDUQR6eXvC2ibvdNS//yPrR2wpL64fObWQY8xs4fx 4p6PnQnraD2bNnl972nKilKTrmFh2CFUtNSz9dFYlBZE/5nXRhNVWu81mGlCancMqhv4 lZQCShnZg2NE7u1YUYtTaqDFP3A1K2LPo7GDdU7yJFZFjjyF6oJ2FT4VtxtTrc3/0E50 IUSmfEwA1E7D07UyzbjrKerNjKfDW1+MMvVlMxfmR1f+n0HL4iNmiCN9FqJ3NOBVBiWd 1jVg== X-Gm-Message-State: APjAAAWXdpJ1BOTNmKwPklHVZWR6f49ID/sF/hcj7XsxIkgpf1LrWzEa +VLIVElAd6FFGIOBNVy+ZPkdPqKCT18= X-Received: by 2002:adf:f8c1:: with SMTP id f1mr21129403wrq.151.1553615859235; Tue, 26 Mar 2019 08:57:39 -0700 (PDT) Received: from debian-brgl.home ([2a01:cb1d:af:5b00:6d6c:8493:1ab5:dad7]) by smtp.gmail.com with ESMTPSA id 204sm28522999wmc.1.2019.03.26.08.57.38 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 26 Mar 2019 08:57:38 -0700 (PDT) From: Bartosz Golaszewski To: Sekhar Nori , Kevin Hilman , Alan Stern , Greg Kroah-Hartman Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org, Bartosz Golaszewski Subject: [PATCH 3/3] usb: ohci-da8xx: drop the vbus GPIO Date: Tue, 26 Mar 2019 16:57:28 +0100 Message-Id: <20190326155728.5432-4-brgl@bgdev.pl> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190326155728.5432-1-brgl@bgdev.pl> References: <20190326155728.5432-1-brgl@bgdev.pl> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Bartosz Golaszewski All users now setup a fixed regulator for the vbus supply. We can drop the vbus GPIO code. We need to modify the over-current interrupt handler to use a threaded irq as we cannot disable a regulator from interrupt context. Signed-off-by: Bartosz Golaszewski --- drivers/usb/host/ohci-da8xx.c | 39 ++++++++++++++++------------------- 1 file changed, 18 insertions(+), 21 deletions(-) diff --git a/drivers/usb/host/ohci-da8xx.c b/drivers/usb/host/ohci-da8xx.c index ca8a94f15ac0..f3892034de58 100644 --- a/drivers/usb/host/ohci-da8xx.c +++ b/drivers/usb/host/ohci-da8xx.c @@ -41,7 +41,6 @@ struct da8xx_ohci_hcd { struct regulator *vbus_reg; struct notifier_block nb; unsigned int reg_enabled; - struct gpio_desc *vbus_gpio; struct gpio_desc *oc_gpio; }; @@ -92,11 +91,6 @@ static int ohci_da8xx_set_power(struct usb_hcd *hcd, int on) struct device *dev = hcd->self.controller; int ret; - if (da8xx_ohci->vbus_gpio) { - gpiod_set_value_cansleep(da8xx_ohci->vbus_gpio, on); - return 0; - } - if (!da8xx_ohci->vbus_reg) return 0; @@ -124,9 +118,6 @@ static int ohci_da8xx_get_power(struct usb_hcd *hcd) { struct da8xx_ohci_hcd *da8xx_ohci = to_da8xx_ohci(hcd); - if (da8xx_ohci->vbus_gpio) - return gpiod_get_value_cansleep(da8xx_ohci->vbus_gpio); - if (da8xx_ohci->vbus_reg) return regulator_is_enabled(da8xx_ohci->vbus_reg); @@ -159,9 +150,6 @@ static int ohci_da8xx_has_set_power(struct usb_hcd *hcd) { struct da8xx_ohci_hcd *da8xx_ohci = to_da8xx_ohci(hcd); - if (da8xx_ohci->vbus_gpio) - return 1; - if (da8xx_ohci->vbus_reg) return 1; @@ -211,7 +199,16 @@ static irqreturn_t ohci_da8xx_oc_handler(int irq, void *data) struct da8xx_ohci_hcd *da8xx_ohci = data; if (gpiod_get_value(da8xx_ohci->oc_gpio)) - gpiod_set_value(da8xx_ohci->vbus_gpio, 0); + return IRQ_WAKE_THREAD; + + return IRQ_HANDLED; +} + +static irqreturn_t ohci_da8xx_oc_thread(int irq, void *data) +{ + struct da8xx_ohci_hcd *da8xx_ohci = data; + + regulator_disable(da8xx_ohci->vbus_reg); return IRQ_HANDLED; } @@ -424,11 +421,6 @@ static int ohci_da8xx_probe(struct platform_device *pdev) } } - da8xx_ohci->vbus_gpio = devm_gpiod_get_optional(dev, "vbus", - GPIOD_OUT_HIGH); - if (IS_ERR(da8xx_ohci->vbus_gpio)) - goto err; - da8xx_ohci->oc_gpio = devm_gpiod_get_optional(dev, "oc", GPIOD_IN); if (IS_ERR(da8xx_ohci->oc_gpio)) goto err; @@ -438,9 +430,14 @@ static int ohci_da8xx_probe(struct platform_device *pdev) if (oc_irq < 0) goto err; - error = devm_request_irq(dev, oc_irq, ohci_da8xx_oc_handler, - IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING, - "OHCI over-current indicator", da8xx_ohci); + error = devm_request_threaded_irq(dev, oc_irq, + ohci_da8xx_oc_handler, + ohci_da8xx_oc_thread, + IRQF_TRIGGER_RISING | + IRQF_TRIGGER_FALLING | + IRQF_ONESHOT, + "OHCI over-current indicator", + da8xx_ohci); if (error) goto err; } -- 2.20.1