Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp289459yba; Fri, 12 Apr 2019 03:41:30 -0700 (PDT) X-Google-Smtp-Source: APXvYqzNrCoDq0zrCjU7rwa4Wt8RsG/Q339h3GuCBXWFcS1S4ghgr6tOI5csTy3oiL1rmkzxGBWd X-Received: by 2002:a17:902:294b:: with SMTP id g69mr7233627plb.57.1555065690760; Fri, 12 Apr 2019 03:41:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1555065690; cv=none; d=google.com; s=arc-20160816; b=ww5MooLmfwjgOWUwh4ZDXnuPo8UiAMylJVHUcvSaZ5Q9j+jCpSwVZsCHqdduNFbshK zID9B/wdI3Mwtup3SZ0WIbyh5AIUcr3JCG8tJ6hlAqzG7HN3Kw9IAnD0J2JrCY57eAJB cFk+j0SsTe2P3r79mWi67m2wmm062DMJVK2Y15w0K5htb5CAlKlU2IdRygKEm1q0/6a8 7ad8qo8EZYuq6hbLdKqVcIBJm4pVaSTqsIOxAwFaZ7Ksrns0w/JNFe2QKQ1TSNLK4WsT 3kkcw6L4QwHxMbafPDt5vwX9qYaXte1pYqbsypexBzWWrmqLNUghUMeAtbz5jPtF+wXB I6Fg== 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 :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=pGmkMFZyA1iAhFzWS7v56JDSKk1xDXLjmYUA9FEMtIY=; b=ZZPr9zOy/WLWaPTnw5BCylj0oUluIdW62bKVVpeCX/P2bQNIC1RV8plKP4ZGuXRShv J0oe26XX4NgVCRT/EYrlFNCsl9fUBjdfyN/UEoUFh33dd3j5iaqommBT0iTVEkpEga7l Mwk/ZvMFX/WIMz8MOPzYdE74R9QNz41r4qqXsLF8CVdDJUkYU56o3ZGIy3H8lXM4kXOm WwQFS9IGqTD9zuUYGZ5/ovkLZX3KdcljG8oPmuBRv9CRlEWaDKwqLXD7hqte+rl9pVMC 7viao5z2m9+2DCZsfLhM39+S/69ghjOQ4jcLqP0hFXBFIld0mxm7+gxg/gj/qKHl0LED Q8ZA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=DWh4NBZz; 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; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s9si37201954pgr.443.2019.04.12.03.41.15; Fri, 12 Apr 2019 03:41:30 -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=@ti.com header.s=ti-com-17Q1 header.b=DWh4NBZz; 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; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727297AbfDLKj0 (ORCPT + 99 others); Fri, 12 Apr 2019 06:39:26 -0400 Received: from lelv0142.ext.ti.com ([198.47.23.249]:49262 "EHLO lelv0142.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726244AbfDLKjZ (ORCPT ); Fri, 12 Apr 2019 06:39:25 -0400 Received: from fllv0035.itg.ti.com ([10.64.41.0]) by lelv0142.ext.ti.com (8.15.2/8.15.2) with ESMTP id x3CAdHvN054033; Fri, 12 Apr 2019 05:39:17 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1555065557; bh=pGmkMFZyA1iAhFzWS7v56JDSKk1xDXLjmYUA9FEMtIY=; h=Subject:To:CC:References:From:Date:In-Reply-To; b=DWh4NBZzybLz0eBiZUpRbcCKYJ7qDjlfrs11slTWouf15EB0eg8qwZILpAQpJhWVn W2AVPP07TZU1mY7GbjrkLt9mGGxlrkKOmqaQKNxmVkgCl16wpj/epcSSVL6dR7NyMi regCkeHg+7HE8wuJ/foHgv60lRojOW6teRF1+DmI= Received: from DLEE112.ent.ti.com (dlee112.ent.ti.com [157.170.170.23]) by fllv0035.itg.ti.com (8.15.2/8.15.2) with ESMTPS id x3CAdHoM109692 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Fri, 12 Apr 2019 05:39:17 -0500 Received: from DLEE115.ent.ti.com (157.170.170.26) by DLEE112.ent.ti.com (157.170.170.23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1713.5; Fri, 12 Apr 2019 05:39:16 -0500 Received: from lelv0327.itg.ti.com (10.180.67.183) by DLEE115.ent.ti.com (157.170.170.26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1713.5 via Frontend Transport; Fri, 12 Apr 2019 05:39:16 -0500 Received: from [172.24.190.172] (ileax41-snat.itg.ti.com [10.172.224.153]) by lelv0327.itg.ti.com (8.15.2/8.15.2) with ESMTP id x3CAdDJu066203; Fri, 12 Apr 2019 05:39:14 -0500 Subject: Re: [PATCH v4 3/6] usb: ohci-da8xx: disable the regulator if the overcurrent irq fired To: Bartosz Golaszewski , Kevin Hilman , Alan Stern , Greg Kroah-Hartman CC: , , , Bartosz Golaszewski References: <20190411093024.23555-1-brgl@bgdev.pl> <20190411093024.23555-4-brgl@bgdev.pl> From: Sekhar Nori Message-ID: <4a022050-73ad-cbed-bf30-416abb2196e0@ti.com> Date: Fri, 12 Apr 2019 16:09:13 +0530 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.6.1 MIME-Version: 1.0 In-Reply-To: <20190411093024.23555-4-brgl@bgdev.pl> Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 7bit X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Bartosz, On 11/04/19 3:00 PM, Bartosz Golaszewski wrote: > From: Bartosz Golaszewski > > Historically the power supply management in this driver has been handled > in two separate places in parallel. Device-tree users simply defined an > appropriate regulator, while two boards with no DT support (da830-evm and > omapl138-hawk) passed functions defined in their respective board files > over platform data. These functions simply used legacy GPIO calls to > watch the oc GPIO for interrupts and disable the vbus GPIO when the irq > fires. > > Commit d193abf1c913 ("usb: ohci-da8xx: add vbus and overcurrent gpios") > updated these GPIO calls to the modern API and moved them inside the > driver. > > This however is not the optimal solution for the vbus GPIO which should > be modeled as a fixed regulator that can be controlled with a GPIO. > > In order to keep the overcurrent protection available once we move the > board files to using fixed regulators we need to disable the enable_reg > regulator when the overcurrent indicator interrupt fires. Since we > cannot call regulator_disable() from interrupt context, we need to > switch to using a oneshot threaded interrupt. > > Signed-off-by: Bartosz Golaszewski I thought a bit on whether it makes sense to merge this patch into 6/6 since that is modifying some code you introduce here. But I think its probably better to keep it separate like you have it now. 6/6 is about dropping support for vbus gpio, where as here you are letting regulator be used for handing overcurrent detected using oci gpio. Having it separate makes it possible to revert dropping support for vbus gpio while keeping this functionality ;) > -static irqreturn_t ohci_da8xx_oc_handler(int irq, void *data) > +static irqreturn_t ohci_da8xx_oc_thread(int irq, void *data) > { > struct da8xx_ohci_hcd *da8xx_ohci = data; > + struct device *dev = da8xx_ohci->hcd->self.controller; > + int ret; > > - if (gpiod_get_value(da8xx_ohci->oc_gpio)) > - gpiod_set_value(da8xx_ohci->vbus_gpio, 0); > + if (gpiod_get_value_cansleep(da8xx_ohci->oc_gpio)) { > + if (da8xx_ohci->vbus_gpio) { > + gpiod_set_value_cansleep(da8xx_ohci->vbus_gpio, 0); > + } else if (da8xx_ohci->vbus_reg) { > + ret = regulator_disable(da8xx_ohci->vbus_reg); > + if (ret) > + dev_err(dev, > + "Failed to disable regulator: %d\n", > + ret); > + } > + Unnecessary empty line here, that too one that introduces white space error. Please drop. Thanks, Sekhar