Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp7321979imu; Thu, 27 Dec 2018 17:46:12 -0800 (PST) X-Google-Smtp-Source: ALg8bN4fx1EGKIDtF3ZGor+9csrgIeCwPS2BcqOieEeAFf09eR81wdOQQAo99yGHSkYG746pvMVa X-Received: by 2002:a63:6ac5:: with SMTP id f188mr24859538pgc.165.1545961572774; Thu, 27 Dec 2018 17:46:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1545961572; cv=none; d=google.com; s=arc-20160816; b=zKyjmn4D6TYVk8+RLxOWtua+uQAk3uwzfQ5FXzPq9wmmw85wE08D76NjXYFRDcDxEH BVXvQeKZoymB1inKk5LMwCIRD1oGxZG6XXK96T43++Rp/SOe/hxb6qQPW/EQ9fNH7gdg 8RuOXF8BGxTjThwONf9ikepz5vYaTHxrWvM0BSG8vhO67veJHtMk7SnkSLQeQA8r0ftN 7FBDfO2RenEAxaS1/wTFxZKEkM7oqwb0S31JG2CF+tmvYbE1IKBY623md3cXD7rHOD65 HPfDSBVDgdmF3QdnzODo9g41O0wkyT+jkTY7IhSzAGqZqxnusW8JO7kM4PrgWMhqkNAf 2+kw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:content-disposition :mime-version:message-id:subject:cc:to:from:date:dkim-signature; bh=A1Fk6XuZaJwDoJhSao1a3h1AAr188VgBL9TY1r4IONg=; b=Vwd2uffbRRxH3NuH84DrSUZz9xVmVlg6pJjYJNaK8a2RDKUWoEIuIrBJeW6kDFz/i+ zuHxNm4igcGOnPXXiOey0gp0v6CsKCfzy7CGJAlwmPvvJ0HCX8z24j9qufSL66OnVLcu oyhuyxmfofbStvQsPN1t5xVj6tEmkxqlFAqbvQRLDmZnUWgj2I+kSo74Ab5eJWOcUszJ 4vA+qVJQhkJPZlEDKT6Vl473qhlzHQulcrYelIjI53Kd4QJcuOaVYNA1bBdEBx/5MGPF AG0XDRnIWLuy/7sBGWuGVewKW2/wyRTx63l2YcP8jGpmYzbT+7x2BVdVzNUxhCmkGa0r rHEA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b="S/iNCpo+"; 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=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a23si5954955plm.334.2018.12.27.17.45.57; Thu, 27 Dec 2018 17:46:12 -0800 (PST) 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=@gmail.com header.s=20161025 header.b="S/iNCpo+"; 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=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731234AbeL0RVj (ORCPT + 99 others); Thu, 27 Dec 2018 12:21:39 -0500 Received: from mail-pl1-f194.google.com ([209.85.214.194]:42232 "EHLO mail-pl1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726816AbeL0RVi (ORCPT ); Thu, 27 Dec 2018 12:21:38 -0500 Received: by mail-pl1-f194.google.com with SMTP id y1so8982985plp.9 for ; Thu, 27 Dec 2018 09:21:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:mime-version:content-disposition :user-agent; bh=A1Fk6XuZaJwDoJhSao1a3h1AAr188VgBL9TY1r4IONg=; b=S/iNCpo+jDTNam9kTN/+w4xynNAK4xe2hU55hWPSBnMFl1/kaCQN48S0orWUifPjAd b66WmYIxOv9LU6toBySy+Iv2gX1mhaUcbmrs28XZ+sgC48hsackxJyu9BkLaGFmbZZE7 5cgvpQhp8chRkAha8AScFujnj8TJE5Wt5+OwP1QcfRtWEK18TBJUTUQT+ulRgUiiD8O5 qEAo1EQhRIyhVD163WGUbmKwjB+9fU/EswgnMMUxsWwMCgEZsAQhpUpZlRYpKzcP+Nr4 O/oFw7cNu2hDg/GCIoLSvx+TJ9CMafMj+nYvEad2XKGUxW96p8CznlopdQhJo9ABPQr1 tFww== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:mime-version :content-disposition:user-agent; bh=A1Fk6XuZaJwDoJhSao1a3h1AAr188VgBL9TY1r4IONg=; b=s64+r3GFtodpO2gZCYJnr16cQK16v8o5lrP53saXUfhaQY7izNxJiXo2mRejuNbCIw oQkeeOvQ8Bfq8kp1hDoh/59r8+WJ6PNuGp+tGlQ/QXM78Hh41dTMFAQgse5C0r81NP8w FiS+78LvlTAa8cRWmV/jv/mcH2I1Al5t1YptKilPJJNigCKy93L6Yo/IgOAG2DMNTrAu 9YLlO7h7pKo44UWX+6xHWtiy+F2rfhnAgKBFpoFS2g9a99/zcXwm5sRdFVm4O3N6iB0U Pe/4D8ibYfCBnjLnwn4BgT9Iwper5qtLEYjppdZ/knoRcXFyu00C/zBrNW5ssI8t/USC Bv6g== X-Gm-Message-State: AJcUukcua6ag/oEg4ZDtTUtLuwkmK8urX4hhTNziuhF/Z9UlQIW/9aDa HcY37R3ojV3ifAk9Pulx11c= X-Received: by 2002:a17:902:7402:: with SMTP id g2mr23877762pll.198.1545931297483; Thu, 27 Dec 2018 09:21:37 -0800 (PST) Received: from nishad ([106.51.25.107]) by smtp.gmail.com with ESMTPSA id v12sm57121777pgg.41.2018.12.27.09.21.33 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 27 Dec 2018 09:21:36 -0800 (PST) Date: Thu, 27 Dec 2018 22:51:29 +0530 From: Nishad Kamdar To: Greg Kroah-Hartman Cc: Carmeli Tamir , Cristian Sicilia , Dan Carpenter , Nathan Chancellor , Christopher Diaz Riveros , Nishad Kamdar , Arkadiusz Lis , devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org Subject: [PATCH] Staging: emxx_udc: Switch to the gpio descriptor interface Message-ID: <20181227172124.GA28790@nishad> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.9.4 (2018-02-28) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Convert VBUS GPIO to use GPIO descriptors from and stop using the old GPIO API. Signed-off-by: Nishad Kamdar --- drivers/staging/emxx_udc/emxx_udc.c | 31 +++++++++++++++-------------- drivers/staging/emxx_udc/emxx_udc.h | 2 ++ 2 files changed, 18 insertions(+), 15 deletions(-) diff --git a/drivers/staging/emxx_udc/emxx_udc.c b/drivers/staging/emxx_udc/emxx_udc.c index 8e8f57c4f029..a913d40f0801 100644 --- a/drivers/staging/emxx_udc/emxx_udc.c +++ b/drivers/staging/emxx_udc/emxx_udc.c @@ -27,7 +27,7 @@ #include #include -#include +#include #include "emxx_udc.h" @@ -2220,7 +2220,7 @@ static inline void _nbu2ss_check_vbus(struct nbu2ss_udc *udc) mdelay(VBUS_CHATTERING_MDELAY); /* wait (ms) */ /* VBUS ON Check*/ - reg_dt = gpio_get_value(VBUS_VALUE); + reg_dt = gpiod_get_value(vbus_gpio); if (reg_dt == 0) { udc->linux_suspended = 0; @@ -2247,7 +2247,7 @@ static inline void _nbu2ss_check_vbus(struct nbu2ss_udc *udc) } } else { mdelay(5); /* wait (5ms) */ - reg_dt = gpio_get_value(VBUS_VALUE); + reg_dt = gpiod_get_value(vbus_gpio); if (reg_dt == 0) return; @@ -2311,7 +2311,7 @@ static inline void _nbu2ss_int_usb_suspend(struct nbu2ss_udc *udc) u32 reg_dt; if (udc->usb_suspended == 0) { - reg_dt = gpio_get_value(VBUS_VALUE); + reg_dt = gpiod_get_value(vbus_gpio); if (reg_dt == 0) return; @@ -2351,7 +2351,7 @@ static irqreturn_t _nbu2ss_udc_irq(int irq, void *_udc) struct nbu2ss_udc *udc = (struct nbu2ss_udc *)_udc; struct fc_regs __iomem *preg = udc->p_regs; - if (gpio_get_value(VBUS_VALUE) == 0) { + if (gpiod_get_value(vbus_gpio) == 0) { _nbu2ss_writel(&preg->USB_INT_STA, ~USB_INT_STA_RW); _nbu2ss_writel(&preg->USB_INT_ENA, 0); return IRQ_HANDLED; @@ -2360,7 +2360,7 @@ static irqreturn_t _nbu2ss_udc_irq(int irq, void *_udc) spin_lock(&udc->lock); for (;;) { - if (gpio_get_value(VBUS_VALUE) == 0) { + if (gpiod_get_value(vbus_gpio) == 0) { _nbu2ss_writel(&preg->USB_INT_STA, ~USB_INT_STA_RW); _nbu2ss_writel(&preg->USB_INT_ENA, 0); status = 0; @@ -2750,7 +2750,7 @@ static int nbu2ss_ep_fifo_status(struct usb_ep *_ep) preg = udc->p_regs; - data = gpio_get_value(VBUS_VALUE); + data = gpiod_get_value(vbus_gpio); if (data == 0) return -EINVAL; @@ -2790,7 +2790,7 @@ static void nbu2ss_ep_fifo_flush(struct usb_ep *_ep) return; } - data = gpio_get_value(VBUS_VALUE); + data = gpiod_get_value(vbus_gpio); if (data == 0) return; @@ -2832,7 +2832,7 @@ static int nbu2ss_gad_get_frame(struct usb_gadget *pgadget) } udc = container_of(pgadget, struct nbu2ss_udc, gadget); - data = gpio_get_value(VBUS_VALUE); + data = gpiod_get_value(vbus_gpio); if (data == 0) return -EINVAL; @@ -2854,7 +2854,7 @@ static int nbu2ss_gad_wakeup(struct usb_gadget *pgadget) udc = container_of(pgadget, struct nbu2ss_udc, gadget); - data = gpio_get_value(VBUS_VALUE); + data = gpiod_get_value(vbus_gpio); if (data == 0) { dev_warn(&pgadget->dev, "VBUS LEVEL = %d\n", data); return -EINVAL; @@ -3119,12 +3119,13 @@ static int nbu2ss_drv_probe(struct platform_device *pdev) } /* VBUS Interrupt */ - irq_set_irq_type(INT_VBUS, IRQ_TYPE_EDGE_BOTH); - status = request_irq(INT_VBUS, + vbus_irq = gpiod_to_irq(vbus_gpio); + irq_set_irq_type(vbus_irq, IRQ_TYPE_EDGE_BOTH); + status = request_irq(vbus_irq, _nbu2ss_vbus_irq, IRQF_SHARED, driver_name, udc); if (status != 0) { - dev_err(udc->dev, "request_irq(INT_VBUS) failed\n"); + dev_err(udc->dev, "request_irq(vbus_irq) failed\n"); return status; } @@ -3160,7 +3161,7 @@ static int nbu2ss_drv_remove(struct platform_device *pdev) } /* Interrupt Handler - Release */ - free_irq(INT_VBUS, udc); + free_irq(vbus_irq, udc); return 0; } @@ -3201,7 +3202,7 @@ static int nbu2ss_drv_resume(struct platform_device *pdev) if (!udc) return 0; - data = gpio_get_value(VBUS_VALUE); + data = gpiod_get_value(vbus_gpio); if (data) { udc->vbus_active = 1; udc->devstate = USB_STATE_POWERED; diff --git a/drivers/staging/emxx_udc/emxx_udc.h b/drivers/staging/emxx_udc/emxx_udc.h index e28a74da9633..b8c3dee5626c 100644 --- a/drivers/staging/emxx_udc/emxx_udc.h +++ b/drivers/staging/emxx_udc/emxx_udc.h @@ -30,6 +30,8 @@ /* below hacked up for staging integration */ #define GPIO_VBUS 0 /* GPIO_P153 on KZM9D */ #define INT_VBUS 0 /* IRQ for GPIO_P153 */ +struct gpio_desc *vbus_gpio; +int vbus_irq; /*------------ Board dependence(Wait) */ -- 2.17.1