Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp46312imm; Fri, 25 May 2018 15:50:10 -0700 (PDT) X-Google-Smtp-Source: AB8JxZqHrPJyIsOHzFfvfZCGgIeBfp+JhQAe2AL7sypSrSy0+dHLVHWEu0uW9tOBhDQGHggbIBtG X-Received: by 2002:a65:45c7:: with SMTP id m7-v6mr3445889pgr.109.1527288610541; Fri, 25 May 2018 15:50:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527288610; cv=none; d=google.com; s=arc-20160816; b=C8DZiZVl+b8NVynPlagERvTzQbFKJGSFG2JE+URjYsG56aaA49Pf4c1eNtjscCrWv0 Q6c3VOvffIEuY06SisdCBSV2X6YrRxKM4jpq9P+CctPm/u2UFLgfQif5DO/axpZW4OQk EC+yKEimCVxxq/VCh9hTdzQd1iprG8DWkZEQHSk02y+vA2EonEtkTMTSh4RzTN73SOcI Ak49WHgv8povaBUtyW/SseJhBRjOdAOmN5vPlh4mcoPadkqj3dLIh3EIfQ1xwpbX9Bu3 XtBOZ/h5BrzaxIRkTmY55AColWCd8drsCzWVpLbnJflidf+MENKdVupzyQ8PbVt3ifGZ Pt7A== 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:arc-authentication-results; bh=HmU9hDW+YI/pltNF5yYmDwa0g80rLFfUR4sfMKxIR50=; b=PhIg3gHrsSchMx6/aF9JMH8oazAQKmgZ7UdBVQoviW2w5A9KR9DjnBe2okzOkdJps1 v7+lv7AsJz7V2jV5KjpmZWIMRD2IN0+p09aD/by2fRxKa7oIj8wlqo7q1sItYbxs5at/ 4SlO6KZOX/1/+RLymcE0PYKmFLDK2KslflsaDyFEbfXxcmOGJoN4nLknUiu6IYU/MnaT 1YEGABRsY6hpfIGfsx1AXBixDAjes7Ujd52EODf6doYPx5NiapZDUwmG+WLY4LR3zvnS V5T+i/CJ0k3tQNglAZ1FaAYyGAv2g/szy11VOsB3eBdysUPVaEsCoDYzz0klHivNf5g+ uRzQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=KBF6hy7C; 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 61-v6si25189244plf.63.2018.05.25.15.49.44; Fri, 25 May 2018 15:50:10 -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=@gmail.com header.s=20161025 header.b=KBF6hy7C; 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 S1030683AbeEYWte (ORCPT + 99 others); Fri, 25 May 2018 18:49:34 -0400 Received: from mail-wm0-f65.google.com ([74.125.82.65]:33138 "EHLO mail-wm0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1030538AbeEYWtc (ORCPT ); Fri, 25 May 2018 18:49:32 -0400 Received: by mail-wm0-f65.google.com with SMTP id x12-v6so34437080wmc.0; Fri, 25 May 2018 15:49:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=HmU9hDW+YI/pltNF5yYmDwa0g80rLFfUR4sfMKxIR50=; b=KBF6hy7CgPOPcPgBjpRUobD0ZCZWhWd0UfpxQPPYvrVf/mS+ol7HZBRluX2gmJVKot 6h2szkfDMP3uoyrNWe+mB5UXk63VIZuvL+yn4CJi7MnlMzrab2XFD28eFR9vwerl/U5+ qi5/VwCwOAqQGp3LysCNvMfA3xLeCaby2u3j4Z+b6f9wk29VNT5QaZwOkQWGpa0RvbYl PtLUdHBFN7A41YJIvior+9PgD3AtGzh/JC/apZaZ3AVeO/PV/PDEPdQ7u+nbkSqv9Q/q dS54wzt1ksYiTxL/dyCI17Y192auvZLpycFdnws2V65vzCWa7Rydr0J+kBGCfUe+NoZY t3ow== 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=HmU9hDW+YI/pltNF5yYmDwa0g80rLFfUR4sfMKxIR50=; b=cAm1kpyqKRvXvwBr5qw874VPBBYuJDUU4vj1Zhlux49LR/pNfp+pKvk+bp47hMDjFC pDkXk4YUJU6hc9f9mQXeekSyOWD6uX0OQ5DpHEr7aSYZZw19NoriK02Ii6xkFNQU90gK Pzt8yK2IQK2NEHdRzT4z/k+XNUkDQinpnuzooujCQRumQSJu010YKo1wfpmIpxKEsuhZ YuDThbkv45auVKao0hOqWpdAwWR/dkRg3A/Tn7fxkV2QicuZUDztMETdluoQH3cxqfLp SQ6kn61BAw+1VnwfhOz8p3FWsGObnNRvvBonNGhN+4QDiCbpx3ViB2KNE6FUYaF5ktfy 2zPA== X-Gm-Message-State: ALKqPwdHxGXwdRB0h1Ot/I+Ju3CEO6rlLD1vRYk9YGNYKJ50kDeBQn0K pXBZLd+/wEvFdzfivfOezCE= X-Received: by 2002:a2e:9b4a:: with SMTP id o10-v6mr2833686ljj.49.1527288571213; Fri, 25 May 2018 15:49:31 -0700 (PDT) Received: from z50.localnet (apn-31-0-67-177.dynamic.gprs.plus.pl. [31.0.67.177]) by smtp.gmail.com with ESMTPSA id r81-v6sm4548917lja.36.2018.05.25.15.49.29 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 25 May 2018 15:49:30 -0700 (PDT) From: Janusz Krzysztofik To: Tomi Valkeinen , Bartlomiej Zolnierkiewicz Cc: Tony Lindgren , linux-kernel@vger.kernel.org, linux-fbdev@vger.kernel.org, linux-omap@vger.kernel.org Subject: [Resend] [PATCH 4/6] fbdev: omapfb: lcd_ams_delta: use GPIO lookup table Date: Sat, 26 May 2018 00:49:44 +0200 Message-ID: <6289024.FygGQHSFcZ@z50> In-Reply-To: <20180518210954.29044-4-jmkrzyszt@gmail.com> References: <20180518210954.29044-1-jmkrzyszt@gmail.com> <20180518210954.29044-4-jmkrzyszt@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Friday, May 18, 2018 11:09:52 PM CEST Janusz Krzysztofik wrote: > Now as the Amstrad Delta board provides GPIO lookup tables, switch from > GPIO numbers to GPIO descriptors and use the table to locate required > GPIO pins. > > Declare static variables for storing GPIO descriptors and replace > gpio_ functions with their gpiod_ equivalents. Move GPIO lookup > to the driver probe function so device initialization can be postponed > instead of aborted if the GPIO pin is not yet available. > > Pin naming used by the driver should be followed while respective GPIO > lookup table is initialized by a board init code. > > Created and tested against linux-4.17-rc3, on top of patch 1/6 "ARM: > OMAP1: ams-delta: add GPIO lookup tables" > > Signed-off-by: Janusz Krzysztofik > --- > drivers/video/fbdev/omap/lcd_ams_delta.c | 59 > ++++++++++++++------------------ 1 file changed, 26 insertions(+), 33 > deletions(-) > > diff --git a/drivers/video/fbdev/omap/lcd_ams_delta.c > b/drivers/video/fbdev/omap/lcd_ams_delta.c index a4ee947006c7..19b6425b54be > 100644 > --- a/drivers/video/fbdev/omap/lcd_ams_delta.c > +++ b/drivers/video/fbdev/omap/lcd_ams_delta.c > @@ -24,11 +24,10 @@ > #include > #include > #include > +#include > #include > -#include > > #include > -#include > > #include "omapfb.h" > > @@ -41,6 +40,8 @@ > /* LCD class device section */ > > static int ams_delta_lcd; > +static struct gpio_desc *gpiod_vblen; > +static struct gpio_desc *gpiod_ndisp; > > static int ams_delta_lcd_set_power(struct lcd_device *dev, int power) > { > @@ -99,41 +100,17 @@ static struct lcd_ops ams_delta_lcd_ops = { > > /* omapfb panel section */ > > -static const struct gpio _gpios[] = { > - { > - .gpio = AMS_DELTA_GPIO_PIN_LCD_VBLEN, > - .flags = GPIOF_OUT_INIT_LOW, > - .label = "lcd_vblen", > - }, > - { > - .gpio = AMS_DELTA_GPIO_PIN_LCD_NDISP, > - .flags = GPIOF_OUT_INIT_LOW, > - .label = "lcd_ndisp", > - }, > -}; > - > -static int ams_delta_panel_init(struct lcd_panel *panel, > - struct omapfb_device *fbdev) > -{ > - return gpio_request_array(_gpios, ARRAY_SIZE(_gpios)); > -} > - > -static void ams_delta_panel_cleanup(struct lcd_panel *panel) > -{ > - gpio_free_array(_gpios, ARRAY_SIZE(_gpios)); > -} > - > static int ams_delta_panel_enable(struct lcd_panel *panel) > { > - gpio_set_value(AMS_DELTA_GPIO_PIN_LCD_NDISP, 1); > - gpio_set_value(AMS_DELTA_GPIO_PIN_LCD_VBLEN, 1); > + gpiod_set_value(gpiod_ndisp, 1); > + gpiod_set_value(gpiod_vblen, 1); > return 0; > } > > static void ams_delta_panel_disable(struct lcd_panel *panel) > { > - gpio_set_value(AMS_DELTA_GPIO_PIN_LCD_VBLEN, 0); > - gpio_set_value(AMS_DELTA_GPIO_PIN_LCD_NDISP, 0); > + gpiod_set_value(gpiod_vblen, 0); > + gpiod_set_value(gpiod_ndisp, 0); > } > > static struct lcd_panel ams_delta_panel = { > @@ -154,8 +131,6 @@ static struct lcd_panel ams_delta_panel = { > .pcd = 0, > .acb = 37, > > - .init = ams_delta_panel_init, > - .cleanup = ams_delta_panel_cleanup, > .enable = ams_delta_panel_enable, > .disable = ams_delta_panel_disable, > }; > @@ -166,9 +141,27 @@ static struct lcd_panel ams_delta_panel = { > static int ams_delta_panel_probe(struct platform_device *pdev) > { > struct lcd_device *lcd_device = NULL; > -#ifdef CONFIG_LCD_CLASS_DEVICE > int ret; > > + gpiod_vblen = devm_gpiod_get(&pdev->dev, "vblen", GPIOD_OUT_LOW); > + if (IS_ERR(gpiod_vblen)) { > + ret = PTR_ERR(gpiod_vblen); > + dev_err(&pdev->dev, "VBLEN GPIO request failed (%d)\n", ret); > + if (ret == -ENODEV || ret == -ENOENT) > + ret = -EPROBE_DEFER; > + return ret; > + } > + > + gpiod_ndisp = devm_gpiod_get(&pdev->dev, "ndisp", GPIOD_OUT_LOW); > + if (IS_ERR(gpiod_ndisp)) { > + ret = PTR_ERR(gpiod_ndisp); > + dev_err(&pdev->dev, "NDISP GPIO request failed (%d)\n", ret); > + if (ret == -ENODEV || ret == -ENOENT) > + ret = -EPROBE_DEFER; > + return ret; > + } > + > +#ifdef CONFIG_LCD_CLASS_DEVICE > lcd_device = lcd_device_register("omapfb", &pdev->dev, NULL, > &ams_delta_lcd_ops);