From patchwork Thu Mar 15 22:42:02 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Torokhov X-Patchwork-Id: 10285887 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id ACE1460621 for ; Thu, 15 Mar 2018 22:42:46 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9973626220 for ; Thu, 15 Mar 2018 22:42:46 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8E3DF2877E; Thu, 15 Mar 2018 22:42:46 +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=-6.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,FREEMAIL_FROM,RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=unavailable 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 2711728689 for ; Thu, 15 Mar 2018 22:42:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932819AbeCOWmc (ORCPT ); Thu, 15 Mar 2018 18:42:32 -0400 Received: from mail-pl0-f67.google.com ([209.85.160.67]:39873 "EHLO mail-pl0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932729AbeCOWmM (ORCPT ); Thu, 15 Mar 2018 18:42:12 -0400 Received: by mail-pl0-f67.google.com with SMTP id k22-v6so3860143pls.6; Thu, 15 Mar 2018 15:42:12 -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; bh=9BYbo+5ni0t3EJLLc4X8iQVDzMMSzzxyjCIO0uy5tKI=; b=ew7iy445BxdrwAavSdsDWj7bVlC2s96MrCgJ0sNWssgFzojkBnx8TJnAbgpkrDkZ74 5J/CVOz8Bqt/kInCA9cluSz2TEgz5eiu1sKcL8FgTwDx7BEIALPU1mnmBRJkuM45iOG5 HMax9UjPjogVN0jv49SqfMb6miy9gzHWBa3R4w7EICxUR7/XBl3tiOL1DVpp6fIPy+qs a+k0eL/8eq7zTOrY3oSCvrPzh/8jBnCe4fB7OI2KpbXV2dxWkBRaXBmGZyhvm9Yh80WR 7CEsE/vhrlCGV8Swrt6n1a+RrFFt7sIdpnZdmm+LMV373CiKFVAcdqIaPJ6OAGBx/kgk 22wg== 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; bh=9BYbo+5ni0t3EJLLc4X8iQVDzMMSzzxyjCIO0uy5tKI=; b=A2Nlq/mZ7os6tESYHZ7Agqny9QuKeYkZzaKPZS+pvKHJeGk8NdMX5FfmhURVE3ecec GZXHXVXDeDs6FncPsSSk6Xrl/LfE9O3WM3em2TR5oyU1F6pU3LdrWHuEDNLGJLeQE+nt spy5ghfSJT49NQCq6IRMwh9T4pc0JDi2ZFl/U21dfc+k0qv8hrhMLa/mGv81PwSB+Erg pKGFqtgy1fF7+WedWZulm2Feoe9PoNMHFuktDYSgu/vbx7MDgbZeo6sX7Gd4a0ULCz87 e90NTysbRFXusythNcd2o/d5BAva1Vn69F1C/a/hAJGOFVf8EseEbDAlV1Kk2qC/z+Ba HSBA== X-Gm-Message-State: AElRT7Ezhu+anHE37OlQU9P4ke7ujjgZWcGfH8Hj2tso+Cq6J5lOX3bY 6AmblePQ5fG5svk2l1hXDg8= X-Google-Smtp-Source: AG47ELt8JtmjKd7e49V/NqtsZtqk1/Y2ZMNm7GLLSI8wr1esiS4lxRYLCj+S0w6ixLh+DeyIPNP34w== X-Received: by 2002:a17:902:8b85:: with SMTP id ay5-v6mr9711526plb.329.1521153731611; Thu, 15 Mar 2018 15:42:11 -0700 (PDT) Received: from dtor-ws.mtv.corp.google.com ([2620:0:1000:1511:8de6:27a8:ed13:2ef5]) by smtp.gmail.com with ESMTPSA id c62sm4607888pfk.179.2018.03.15.15.42.10 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 15 Mar 2018 15:42:11 -0700 (PDT) From: Dmitry Torokhov To: Laurent Pinchart , Lee Jones Cc: Daniel Thompson , Jingoo Han , linux-fbdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-sh@vger.kernel.org, Yoshinori Sato , Rich Felker , Linus Walleij Subject: [RFC 4/4] backlight: gpio_backlight: remove platform data support Date: Thu, 15 Mar 2018 15:42:02 -0700 Message-Id: <20180315224202.96668-5-dmitry.torokhov@gmail.com> X-Mailer: git-send-email 2.16.2.804.g6dcf76e118-goog In-Reply-To: <20180315224202.96668-1-dmitry.torokhov@gmail.com> References: <20180315224202.96668-1-dmitry.torokhov@gmail.com> Sender: linux-sh-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-sh@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Legacy boards can use static property sets/GPIO lookup tables to describe backlight connections, there is no need to maintain legacy platform data. Signed-off-by: Dmitry Torokhov Reviewed-by: Linus Walleij --- drivers/video/backlight/gpio_backlight.c | 85 ++++---------------- include/linux/platform_data/gpio_backlight.h | 20 ----- 2 files changed, 14 insertions(+), 91 deletions(-) delete mode 100644 include/linux/platform_data/gpio_backlight.h diff --git a/drivers/video/backlight/gpio_backlight.c b/drivers/video/backlight/gpio_backlight.c index 173fc4aafb89b..795359deeb700 100644 --- a/drivers/video/backlight/gpio_backlight.c +++ b/drivers/video/backlight/gpio_backlight.c @@ -15,17 +15,12 @@ #include #include #include -#include -#include #include +#include #include struct gpio_backlight { - struct device *dev; - struct device *fbdev; - struct gpio_desc *gpiod; - int def_value; }; static int gpio_backlight_update_status(struct backlight_device *bl) @@ -43,84 +38,32 @@ static int gpio_backlight_update_status(struct backlight_device *bl) return 0; } -static int gpio_backlight_check_fb(struct backlight_device *bl, - struct fb_info *info) -{ - struct gpio_backlight *gbl = bl_get_data(bl); - - return gbl->fbdev == NULL || gbl->fbdev == info->dev; -} - static const struct backlight_ops gpio_backlight_ops = { .options = BL_CORE_SUSPENDRESUME, .update_status = gpio_backlight_update_status, - .check_fb = gpio_backlight_check_fb, }; -static int gpio_backlight_probe_dt(struct platform_device *pdev, - struct gpio_backlight *gbl) -{ - struct device *dev = &pdev->dev; - enum gpiod_flags flags; - int ret; - - gbl->def_value = device_property_read_bool(dev, "default-on"); - flags = gbl->def_value ? GPIOD_OUT_HIGH : GPIOD_OUT_LOW; - - gbl->gpiod = devm_gpiod_get(dev, NULL, flags); - if (IS_ERR(gbl->gpiod)) { - ret = PTR_ERR(gbl->gpiod); - - if (ret != -EPROBE_DEFER) { - dev_err(dev, - "Error: The gpios parameter is missing or invalid.\n"); - } - return ret; - } - - return 0; -} - static int gpio_backlight_probe(struct platform_device *pdev) { - struct gpio_backlight_platform_data *pdata = - dev_get_platdata(&pdev->dev); + struct device *dev = &pdev->dev; struct backlight_properties props; struct backlight_device *bl; struct gpio_backlight *gbl; + int def_value; int ret; - gbl = devm_kzalloc(&pdev->dev, sizeof(*gbl), GFP_KERNEL); - if (gbl == NULL) + gbl = devm_kzalloc(dev, sizeof(*gbl), GFP_KERNEL); + if (!gbl) return -ENOMEM; - gbl->dev = &pdev->dev; - - if (!pdata) { - ret = gpio_backlight_probe_dt(pdev, gbl); - if (ret) - return ret; - } else { - /* - * Legacy platform data GPIO retrieveal. Do not expand - * the use of this code path, currently only used by one - * SH board. - */ - unsigned long flags = GPIOF_DIR_OUT; - - gbl->fbdev = pdata->fbdev; - gbl->def_value = pdata->def_value; - flags |= gbl->def_value ? GPIOF_INIT_HIGH : GPIOF_INIT_LOW; - - ret = devm_gpio_request_one(gbl->dev, pdata->gpio, flags, - pdata ? pdata->name : "backlight"); - if (ret < 0) { - dev_err(&pdev->dev, "unable to request GPIO\n"); - return ret; - } - gbl->gpiod = gpio_to_desc(pdata->gpio); - if (!gbl->gpiod) - return -EINVAL; + def_value = device_property_read_bool(dev, "default-on"); + gbl->gpiod = devm_gpiod_get(dev, NULL, + def_value ? GPIOD_OUT_HIGH : GPIOD_OUT_LOW); + if (IS_ERR(gbl->gpiod)) { + ret = PTR_ERR(gbl->gpiod); + if (ret != -EPROBE_DEFER) + dev_err(dev, "unable to request GPIO: %d\n", ret); + return ret; } memset(&props, 0, sizeof(props)); @@ -134,7 +77,7 @@ static int gpio_backlight_probe(struct platform_device *pdev) return PTR_ERR(bl); } - bl->props.brightness = gbl->def_value; + bl->props.brightness = def_value; backlight_update_status(bl); platform_set_drvdata(pdev, bl); diff --git a/include/linux/platform_data/gpio_backlight.h b/include/linux/platform_data/gpio_backlight.h deleted file mode 100644 index 683d90453c419..0000000000000 --- a/include/linux/platform_data/gpio_backlight.h +++ /dev/null @@ -1,20 +0,0 @@ -/* - * gpio_backlight.h - Simple GPIO-controlled backlight - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - */ -#ifndef __GPIO_BACKLIGHT_H__ -#define __GPIO_BACKLIGHT_H__ - -struct device; - -struct gpio_backlight_platform_data { - struct device *fbdev; - int gpio; - int def_value; - const char *name; -}; - -#endif