From patchwork Sun Nov 25 11:27:15 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nishad Kamdar X-Patchwork-Id: 10696779 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 83D4D5A4 for ; Sun, 25 Nov 2018 11:27:25 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 684912921E for ; Sun, 25 Nov 2018 11:27:25 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5B30E2929C; Sun, 25 Nov 2018 11:27:25 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 090B02921E for ; Sun, 25 Nov 2018 11:27:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726023AbeKYWSO (ORCPT ); Sun, 25 Nov 2018 17:18:14 -0500 Received: from mail-pl1-f195.google.com ([209.85.214.195]:41874 "EHLO mail-pl1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725936AbeKYWSO (ORCPT ); Sun, 25 Nov 2018 17:18:14 -0500 Received: by mail-pl1-f195.google.com with SMTP id u6so12512142plm.8; Sun, 25 Nov 2018 03:27:22 -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:references:mime-version :content-disposition:in-reply-to:user-agent; bh=QTX5F1P72hjQd1AFqlGIAwaMVuW69avsjASbM/JcCUI=; b=e6DyWwlixZPSA9qzk/AF+ursJ6/BR4kLzUBwNIo1Kin671y8bietM4KUkl9WCr12de ZURw68WUHNDEMqZCOPKwRTPB1xOQo4YKKUlCTPuZhLSdh7hDvzy+fVvJp7n+xQma/ifA DaMd2Y65Y2veGqdaglIXvlaAM5X0OfSIk2RjlM1qclFfkMIc5bR6WfTWCQWaDOm8PiYX o40v/bQwJg7j8aJHoISP4bPWHX7pXMOOZWwKaH1PXKqFEkxls8gP/nhoi/IEdbGZbo8Q 81tPIln94lO/jZuliivUK/0EAsGQeHF5fYC0EYbcQ3AfT4V4L6+Inp0fJRVk0VM9dmNu NKwg== 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:references :mime-version:content-disposition:in-reply-to:user-agent; bh=QTX5F1P72hjQd1AFqlGIAwaMVuW69avsjASbM/JcCUI=; b=VMZeGXWj9Oq5IY0CDVdApMmu17Lj8BuqD/iPS9S71/Ux0FEBlRbJerj3kKx2McWJ1J UTMJIt4kdN/jFz064IqTyxVDIRDfG5NvaWV78vU66prNafVH0e+jT4/Qr5fikR1kqD9t Vs/p4mTzKzc60UAvl13p8rRPwd9dFuXvNZNGz4tfxyEg45Ai9y22S4EFo9ahVktru/lN /nQUNlm8TkU6bJKU62kDX3KmO6XwSPfaVr4fuT5ldtW8PO5zdnYeZ8emsVKau0ZIDiQ8 t3CS3biqsaG4Yv15wPRjbEQrRXXt8cymCEon0PQG6LueM3vUngGUEW09tecmbdF9KrFi sdHw== X-Gm-Message-State: AA+aEWbWTFKZ8NLPk9uJ9tLGuFfe19fEyCGsazSZfQupLF1hq5fnfQWh oab4rxlxfCKXYTFskGsHxJk7MqEizTsN5Q== X-Google-Smtp-Source: AFSGD/WPLODuDnyh/BcfHOpIByXup4dC15tSJPn+K9zvcoeoQkVHF9UGjPirGB4DD53KErB2RXdkow== X-Received: by 2002:a17:902:aa0a:: with SMTP id be10mr22716027plb.266.1543145241629; Sun, 25 Nov 2018 03:27:21 -0800 (PST) Received: from nishad ([106.51.27.228]) by smtp.gmail.com with ESMTPSA id m20sm63565243pgb.56.2018.11.25.03.27.18 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sun, 25 Nov 2018 03:27:21 -0800 (PST) Date: Sun, 25 Nov 2018 16:57:15 +0530 From: Nishad Kamdar To: Greg Kroah-Hartman Cc: Thomas Petazzoni , devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-fbdev@vger.kernel.org Subject: [PATCH 05/26] Staging: fbtft: fbtft-device: Switch to the gpio descriptor interface Message-ID: References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.4 (2018-02-28) Sender: linux-fbdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fbdev@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This switches the fbtft-device.c to use GPIO descriptors rather than numerical gpios: Remove gpios from platform device structure. Neither assign statically numbers to gpios in platform device nor allow gpios to be parsed as module parameters. Signed-off-by: Nishad Kamdar --- drivers/staging/fbtft/fbtft-core.c | 87 ------- drivers/staging/fbtft/fbtft.h | 1 - drivers/staging/fbtft/fbtft_device.c | 344 +-------------------------- 3 files changed, 8 insertions(+), 424 deletions(-) diff --git a/drivers/staging/fbtft/fbtft-core.c b/drivers/staging/fbtft/fbtft-core.c index 75ee16074126..904ba7470abf 100644 --- a/drivers/staging/fbtft/fbtft-core.c +++ b/drivers/staging/fbtft/fbtft-core.c @@ -70,92 +70,6 @@ void fbtft_dbg_hex(const struct device *dev, int groupsize, } EXPORT_SYMBOL(fbtft_dbg_hex); -static unsigned long fbtft_request_gpios_match(struct fbtft_par *par, - struct fbtft_gpio *gpio) -{ - int ret; - unsigned int val; - - fbtft_par_dbg(DEBUG_REQUEST_GPIOS_MATCH, par, "%s('%s')\n", - __func__, gpio->name); - - if (strcasecmp(gpio->name, "reset") == 0) { - par->gpio.reset = gpio->gpio; - return GPIOD_OUT_HIGH; - } else if (strcasecmp(gpio->name, "dc") == 0) { - par->gpio.dc = gpio->gpio; - return GPIOD_OUT_LOW; - } else if (strcasecmp(gpio->name, "cs") == 0) { - par->gpio.cs = gpio->gpio; - return GPIOD_OUT_HIGH; - } else if (strcasecmp(gpio->name, "wr") == 0) { - par->gpio.wr = gpio->gpio; - return GPIOD_OUT_HIGH; - } else if (strcasecmp(gpio->name, "rd") == 0) { - par->gpio.rd = gpio->gpio; - return GPIOD_OUT_HIGH; - } else if (strcasecmp(gpio->name, "latch") == 0) { - par->gpio.latch = gpio->gpio; - return GPIOD_OUT_LOW; - } else if (gpio->name[0] == 'd' && gpio->name[1] == 'b') { - ret = kstrtouint(&gpio->name[2], 10, &val); - if (ret == 0 && val < 16) { - par->gpio.db[val] = gpio->gpio; - return GPIOD_OUT_LOW; - } - } else if (strcasecmp(gpio->name, "led") == 0) { - par->gpio.led[0] = gpio->gpio; - return GPIOD_OUT_LOW; - } else if (strcasecmp(gpio->name, "led_") == 0) { - par->gpio.led[0] = gpio->gpio; - return GPIOD_OUT_HIGH; - } - - return FBTFT_GPIO_NO_MATCH; -} - -static int fbtft_request_gpios(struct fbtft_par *par) -{ - struct fbtft_platform_data *pdata = par->pdata; - struct device *dev = par->info->device; - struct fbtft_gpio *gpio; - unsigned long flags; - int ret; - - if (!(pdata && pdata->gpios)) - return 0; - - gpio = pdata->gpios; - while (gpio->name[0]) { - flags = FBTFT_GPIO_NO_MATCH; - /* if driver provides match function, try it first, - * if no match use our own - */ - if (par->fbtftops.request_gpios_match) - flags = par->fbtftops.request_gpios_match(par, gpio); - if (flags == FBTFT_GPIO_NO_MATCH) - flags = fbtft_request_gpios_match(par, gpio); - if (flags != FBTFT_GPIO_NO_MATCH) { - gpio->gpio = devm_gpiod_get(dev, - dev->driver->name, flags); - if (IS_ERR(gpio->gpio)) { - ret = PTR_ERR(gpio->gpio); - dev_err(dev, - "%s: Failed to request %s GPIO:%d\n", - __func__, gpio->name, ret); - return ret; - - } - fbtft_par_dbg(DEBUG_REQUEST_GPIOS, par, - "%s: '%s' GPIO\n", - __func__, gpio->name); - } - gpio++; - } - - return 0; -} - #ifdef CONFIG_OF static int fbtft_request_one_gpio(struct fbtft_par *par, const char *name, int index, @@ -836,7 +750,6 @@ struct fb_info *fbtft_framebuffer_alloc(struct fbtft_display *display, par->fbtftops.reset = fbtft_reset; par->fbtftops.mkdirty = fbtft_mkdirty; par->fbtftops.update_display = fbtft_update_display; - par->fbtftops.request_gpios = fbtft_request_gpios; if (display->backlight) par->fbtftops.register_backlight = fbtft_register_backlight; diff --git a/drivers/staging/fbtft/fbtft.h b/drivers/staging/fbtft/fbtft.h index a9eed11c29b0..7fdd3b0851ef 100644 --- a/drivers/staging/fbtft/fbtft.h +++ b/drivers/staging/fbtft/fbtft.h @@ -134,7 +134,6 @@ struct fbtft_display { */ struct fbtft_platform_data { struct fbtft_display display; - struct fbtft_gpio *gpios; unsigned int rotate; bool bgr; unsigned int fps; diff --git a/drivers/staging/fbtft/fbtft_device.c b/drivers/staging/fbtft/fbtft_device.c index 50e97da993e7..1917712cda90 100644 --- a/drivers/staging/fbtft/fbtft_device.c +++ b/drivers/staging/fbtft/fbtft_device.c @@ -8,7 +8,7 @@ #include #include #include -#include +#include #include #include