From patchwork Wed Apr 29 12:00:20 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 185840 Delivered-To: patch@linaro.org Received: by 2002:a92:3d9a:0:0:0:0:0 with SMTP id k26csp663493ilf; Wed, 29 Apr 2020 05:02:30 -0700 (PDT) X-Google-Smtp-Source: APiQypLXIvqba4pZ4wRzv78xGaK98qrr3+69psmMyO3nbiJIwk//Lrr+tyd3EkPelMx18Q0mspN0 X-Received: by 2002:a17:90b:297:: with SMTP id az23mr2728386pjb.85.1588161750625; Wed, 29 Apr 2020 05:02:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588161750; cv=none; d=google.com; s=arc-20160816; b=BhijG08GqC9mUhD9/gDCimhx7NBTV5JD50A6leN8AoxNUTukRcIdCyJGlvTQ3BTCpV +rI29ebousZ2HRu6/a5GUigefuTZVdCYbUsqzfYvEzoIB0PbihjUdBwcBIGGXW2CDH9d zTHg2K1Z4HLn5o3SbZ6HD4ZcuPhayKJkLr/x1qHDJ88jViWcF1qODm9rP12jcDDXQ2FW ENbflR/QL1Y93bjpADCaR/72xdPMnbzTpug2GgjOIRhB6Lag4BXuy5Tns7HSYDJWvT76 ot4P7C5fLxkvh0dxrKz7F0da2aSaPI7/EHlpaW2SxiyDjQguSkmoIsZH6ooQyepU/+AR y/UQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:cc:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:mime-version:message-id:date:subject:to:from :dkim-signature:delivered-to; bh=AAzdR8UKHM9olyvdxXpV7wE1Y9R565woAkIdCXXf7P0=; b=eKuDLMQIyJCETeWMXDHtbLZB2mHVY7St5VtQ77//TlUtEwiWVYybhRb3wcKpDQF14T hMXEqudZxipT+4TKJa8ScSBafnFcg6oL3FEhaGa/4dvjXuqhwTIV/UQm7mBXxzi1W5Ms iu1Awk6ZNEgQ7OdDjuq9Zr+u1WpedrwxL/+1GROrkup+SEv8xBoZpMwnYumNWwnS9qxi lpvUEFjOi8Ehoo8NfhBC1wYaQzU5rWrarp3aQIFvkh4LdZMMWDdgVSQ7K0lyZDCNAyNT t2RlIP7MomlHrDxJZI2inuGEr4PIwbegLZFUqzkjo2Rgv5Yy1oqTeH84VgDVA6+UBJ+9 oi6Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b="oBE/4KLW"; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 2610:10:20:722:a800:ff:fe36:1795 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from gabe.freedesktop.org (gabe.freedesktop.org. [2610:10:20:722:a800:ff:fe36:1795]) by mx.google.com with ESMTPS id o3si731457pgj.252.2020.04.29.05.02.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 Apr 2020 05:02:30 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 2610:10:20:722:a800:ff:fe36:1795 as permitted sender) client-ip=2610:10:20:722:a800:ff:fe36:1795; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b="oBE/4KLW"; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 2610:10:20:722:a800:ff:fe36:1795 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 3C17C6E42D; Wed, 29 Apr 2020 12:02:29 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-lj1-x244.google.com (mail-lj1-x244.google.com [IPv6:2a00:1450:4864:20::244]) by gabe.freedesktop.org (Postfix) with ESMTPS id 186966E42D for ; Wed, 29 Apr 2020 12:02:28 +0000 (UTC) Received: by mail-lj1-x244.google.com with SMTP id f11so2338456ljp.1 for ; Wed, 29 Apr 2020 05:02:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=3S3sDO+JdEWJmlIrh0oj7PmpqtwsBbrJFzVkLXKqRVw=; b=oBE/4KLW4JucZjFeZhkwzKyXZtOe/PpZmEIJYdu8tp5jzwBAoMNcX0S/DQAG4sMB+M DjLPkYLPjYSL5DKEQOmsokkn+jBHPeFfIA0L/vP8gI396ai+xaE2I7n7MBwoGc74dXb2 zlzxsojFUhM6J1PaD4/qum1ikvMrTGlTK4RVAQSzexqJPloIJGm5KKDxJBmly0qKYjRG 4tirXLt01NKbfNieE0mq50MU8u65QVsT9z7DvhSIG7nrWS483zhC0VsCUSn+sXVVdbqV wPJ/7l/tXlxxiaihNgjJ+zPATB+R3Dix2roaV9nImf8zaF35VcscVeJzYhi0xInbb0Ti s3iw== 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:mime-version :content-transfer-encoding; bh=3S3sDO+JdEWJmlIrh0oj7PmpqtwsBbrJFzVkLXKqRVw=; b=pBI2B1MGkwkgg5zBhLqmFCsmPt0MR0cXjiMO5QKhYghLoVvPIpTD4f2rfPAolUEPim ok+ecW+9JFW0HYI46iSk2TY4S4DpOwRKyEwy6V7eyTZnXnJMHtKbGeIfFk9AF2dfiQil bWh2B3Wa90Mb8jcySm45OTbhdbsLAUzF9j/cMdLULxj0QzGIcW4EvJ+qThPp+Oai6+ZU vCXI5bvFYwzDrJwuoTsuF9Tdpc3siEzA8RhrZlkUyqPa1J0XB1KqXV2tHxJN+g/6261s F9mFb2lYlGJmewReNl1m8v0kK5Ueh/U7JWr6D+48/xToHjWYuYF1ce6vkEwqIXOGllW0 SjYw== X-Gm-Message-State: AGi0PuZS5UEw9HkXZ4PQthHbpghX4B0NVyHqNk8JQT+wl7MOADpuUCN7 66b9yxFR3fITvex5VPLsQW0/dQ== X-Received: by 2002:a2e:9011:: with SMTP id h17mr21365482ljg.138.1588161746378; Wed, 29 Apr 2020 05:02:26 -0700 (PDT) Received: from localhost.localdomain (c-f3d7225c.014-348-6c756e10.bbcust.telenor.se. [92.34.215.243]) by smtp.gmail.com with ESMTPSA id g10sm1891283lfc.95.2020.04.29.05.02.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 Apr 2020 05:02:25 -0700 (PDT) From: Linus Walleij To: Lee Jones , Daniel Thompson , Jingoo Han , dri-devel@lists.freedesktop.org Subject: [PATCH v2] backlight: lms283gf05: Convert to GPIO descriptors Date: Wed, 29 Apr 2020 14:00:20 +0200 Message-Id: <20200429120020.932421-1-linus.walleij@linaro.org> X-Mailer: git-send-email 2.25.2 MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Marek Vasut , Robert Jarzmik , Haojian Zhuang , Daniel Mack Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" This converts the lms283gf05 backlight driver to use GPIO descriptors and switches the single PXA Palm Z2 device over to defining these. Since the platform data was only used to convey GPIO information we can delete the platform data header. Notice that we define the proper active low semantics in the board file GPIO descriptor table (active low) and assert the reset line by bringing it to "1" (asserted). Cc: Marek Vasut Cc: Daniel Mack Cc: Haojian Zhuang Cc: Robert Jarzmik Signed-off-by: Linus Walleij --- ChangeLog v1->v2: - Bring up the GPIO de-asserted in probe() Marek: I saw this was written by you, are you regularly testing the Z2 device? --- arch/arm/mach-pxa/z2.c | 12 ++++++--- drivers/video/backlight/lms283gf05.c | 39 +++++++++++----------------- include/linux/spi/lms283gf05.h | 16 ------------ 3 files changed, 23 insertions(+), 44 deletions(-) delete mode 100644 include/linux/spi/lms283gf05.h -- 2.25.2 _______________________________________________ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel diff --git a/arch/arm/mach-pxa/z2.c b/arch/arm/mach-pxa/z2.c index 21fd76bb09cd..89eb5243c85f 100644 --- a/arch/arm/mach-pxa/z2.c +++ b/arch/arm/mach-pxa/z2.c @@ -20,7 +20,6 @@ #include #include #include -#include #include #include #include @@ -578,8 +577,13 @@ static struct pxa2xx_spi_chip lms283_chip_info = { .gpio_cs = GPIO88_ZIPITZ2_LCD_CS, }; -static const struct lms283gf05_pdata lms283_pdata = { - .reset_gpio = GPIO19_ZIPITZ2_LCD_RESET, +static struct gpiod_lookup_table lms283_gpio_table = { + .dev_id = "spi2.0", /* SPI bus 2 chip select 0 */ + .table = { + GPIO_LOOKUP("gpio-pxa", GPIO19_ZIPITZ2_LCD_RESET, + "reset", GPIO_ACTIVE_LOW), + { }, + }, }; static struct spi_board_info spi_board_info[] __initdata = { @@ -595,7 +599,6 @@ static struct spi_board_info spi_board_info[] __initdata = { { .modalias = "lms283gf05", .controller_data = &lms283_chip_info, - .platform_data = &lms283_pdata, .max_speed_hz = 400000, .bus_num = 2, .chip_select = 0, @@ -615,6 +618,7 @@ static void __init z2_spi_init(void) { pxa2xx_set_spi_info(1, &pxa_ssp1_master_info); pxa2xx_set_spi_info(2, &pxa_ssp2_master_info); + gpiod_add_lookup_table(&lms283_gpio_table); spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info)); } #else diff --git a/drivers/video/backlight/lms283gf05.c b/drivers/video/backlight/lms283gf05.c index 0e45685bcc1c..b749ea71e0d1 100644 --- a/drivers/video/backlight/lms283gf05.c +++ b/drivers/video/backlight/lms283gf05.c @@ -9,16 +9,16 @@ #include #include #include -#include +#include #include #include -#include #include struct lms283gf05_state { struct spi_device *spi; struct lcd_device *ld; + struct gpio_desc *reset; }; struct lms283gf05_seq { @@ -90,13 +90,13 @@ static const struct lms283gf05_seq disp_pdwnseq[] = { }; -static void lms283gf05_reset(unsigned long gpio, bool inverted) +static void lms283gf05_reset(struct gpio_desc *gpiod) { - gpio_set_value(gpio, !inverted); + gpiod_set_value(gpiod, 0); /* De-asserted */ mdelay(100); - gpio_set_value(gpio, inverted); + gpiod_set_value(gpiod, 1); /* Asserted */ mdelay(20); - gpio_set_value(gpio, !inverted); + gpiod_set_value(gpiod, 0); /* De-asserted */ mdelay(20); } @@ -125,18 +125,15 @@ static int lms283gf05_power_set(struct lcd_device *ld, int power) { struct lms283gf05_state *st = lcd_get_data(ld); struct spi_device *spi = st->spi; - struct lms283gf05_pdata *pdata = dev_get_platdata(&spi->dev); if (power <= FB_BLANK_NORMAL) { - if (pdata) - lms283gf05_reset(pdata->reset_gpio, - pdata->reset_inverted); + if (st->reset) + lms283gf05_reset(st->reset); lms283gf05_toggle(spi, disp_initseq, ARRAY_SIZE(disp_initseq)); } else { lms283gf05_toggle(spi, disp_pdwnseq, ARRAY_SIZE(disp_pdwnseq)); - if (pdata) - gpio_set_value(pdata->reset_gpio, - pdata->reset_inverted); + if (st->reset) + gpiod_set_value(st->reset, 1); /* Asserted */ } return 0; @@ -150,18 +147,12 @@ static struct lcd_ops lms_ops = { static int lms283gf05_probe(struct spi_device *spi) { struct lms283gf05_state *st; - struct lms283gf05_pdata *pdata = dev_get_platdata(&spi->dev); struct lcd_device *ld; int ret = 0; - if (pdata != NULL) { - ret = devm_gpio_request_one(&spi->dev, pdata->reset_gpio, - GPIOF_DIR_OUT | (!pdata->reset_inverted ? - GPIOF_INIT_HIGH : GPIOF_INIT_LOW), - "LMS283GF05 RESET"); - if (ret) - return ret; - } + st->reset = gpiod_get_optional(&spi->dev, "reset", GPIOD_OUT_LOW); + if (st->reset) + gpiod_set_consumer_name(st->reset, "LMS283GF05 RESET"); st = devm_kzalloc(&spi->dev, sizeof(struct lms283gf05_state), GFP_KERNEL); @@ -179,8 +170,8 @@ static int lms283gf05_probe(struct spi_device *spi) spi_set_drvdata(spi, st); /* kick in the LCD */ - if (pdata) - lms283gf05_reset(pdata->reset_gpio, pdata->reset_inverted); + if (st->reset) + lms283gf05_reset(st->reset); lms283gf05_toggle(spi, disp_initseq, ARRAY_SIZE(disp_initseq)); return 0; diff --git a/include/linux/spi/lms283gf05.h b/include/linux/spi/lms283gf05.h deleted file mode 100644 index f237b2d062e9..000000000000 --- a/include/linux/spi/lms283gf05.h +++ /dev/null @@ -1,16 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0-only */ -/* - * lms283gf05.h - Platform glue for Samsung LMS283GF05 LCD - * - * Copyright (C) 2009 Marek Vasut -*/ - -#ifndef _INCLUDE_LINUX_SPI_LMS283GF05_H_ -#define _INCLUDE_LINUX_SPI_LMS283GF05_H_ - -struct lms283gf05_pdata { - unsigned long reset_gpio; - bool reset_inverted; -}; - -#endif /* _INCLUDE_LINUX_SPI_LMS283GF05_H_ */