From patchwork Sat Oct 19 08:35:48 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 11200515 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 6AF7B1599 for ; Sun, 20 Oct 2019 00:07:45 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 530192064A for ; Sun, 20 Oct 2019 00:07:45 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 530192064A Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=bgdev.pl Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id ECBB189D49; Sun, 20 Oct 2019 00:07:04 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-wr1-x442.google.com (mail-wr1-x442.google.com [IPv6:2a00:1450:4864:20::442]) by gabe.freedesktop.org (Postfix) with ESMTPS id 2F91089E19 for ; Sat, 19 Oct 2019 08:36:12 +0000 (UTC) Received: by mail-wr1-x442.google.com with SMTP id t16so3412277wrr.1 for ; Sat, 19 Oct 2019 01:36:12 -0700 (PDT) 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=XXUGs3TD/mQ9EDaZ43OuKw31dOCYSa+NG57KsS4H5LI=; b=o4XY0Xo2w/qOoOO78YwtUQfiAkeZIE6sxHXYIvOS+A0KE9BrvS2bEHzpZs3Vnpzz+F XXlMxqDzuy5B5j4pkDtO18AuA6S4z5aTzkE5rF5deAPca1NggyNhq5mhHPmV3eqTKj0u h+dDCK5HsZ+qsqTOFU/jeq83gJWRhFDQlfOEkx8vQwTHFLjWn4l3FfK23C7A0sZunu4M 19N3SCzdGF0FhlVoYloZPadgKwR9e617OoThZXZqhDY0DMBOOIvR6vi7q+8coMCpcF7E 9jekeU/qGxuon0eFlbuRwNs9VpwvqLIi7wzLHZt2qgygAsPcfGY+E61IH40Gz3aAZCIP BuxQ== X-Gm-Message-State: APjAAAXFehHfydWPmR2RK0gqKCPiOiOU5a/j9cIJzIOSmer1hCHuOTZq 3N+HPuvWJk/AsK3N2QmQL/WUMw== X-Google-Smtp-Source: APXvYqxPlR4nFfXz0/v7vOrifsB6kSjQvy0Wc6RIcmJ4sgheny/orFuy+qohKi8LgVIRjVcx5C5DJg== X-Received: by 2002:a5d:4f8b:: with SMTP id d11mr758160wru.25.1571474170742; Sat, 19 Oct 2019 01:36:10 -0700 (PDT) Received: from debian-brgl.home ([2a01:cb1d:af:5b00:6d6c:8493:1ab5:dad7]) by smtp.gmail.com with ESMTPSA id u1sm7242627wmc.38.2019.10.19.01.36.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 19 Oct 2019 01:36:10 -0700 (PDT) From: Bartosz Golaszewski To: Yoshinori Sato , Rich Felker , Lee Jones , Daniel Thompson , Jingoo Han , Bartlomiej Zolnierkiewicz , Linus Walleij , Andy Shevchenko , Jacopo Mondi Subject: [PATCH v6 1/9] backlight: gpio: remove unneeded include Date: Sat, 19 Oct 2019 10:35:48 +0200 Message-Id: <20191019083556.19466-2-brgl@bgdev.pl> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191019083556.19466-1-brgl@bgdev.pl> References: <20191019083556.19466-1-brgl@bgdev.pl> MIME-Version: 1.0 X-Mailman-Approved-At: Sun, 20 Oct 2019 00:06:45 +0000 X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=XXUGs3TD/mQ9EDaZ43OuKw31dOCYSa+NG57KsS4H5LI=; b=BwfSeKvNQho1S2E0R2jApkJ/vho0BYWPz+4V23X7TOnHYSRx3lpOCWdHMbDRFkxEBY d17qES1EiwEJenWdMuh8jPg5mCZrt53cDRFr1wi4aQbOGodZoZjInfEvDZXE1XvGwekY 1/6Y7IIWM6Ub5sX6wkkPbWZhx0ViiXmKPmf8I3A9keQoHm8nmBtNzKut+RPGquxny5Xx XQstSrDGl7h2Onpoi4YTSp0XNaFglAgp5x1e7ywXrAnZWfp5jh+RDh5VCfLaCxNDLGWk xiZXU3GLEsnOYQ18EI3ciR5deo3EiCnpeWXE5hO8DYE3+FhSTW5LU3DaapmmQYvki14c wXuA== X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Bartosz Golaszewski , linux-fbdev@vger.kernel.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-sh@vger.kernel.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" From: Bartosz Golaszewski We no longer use any symbols from of_gpio.h. Remove this include. Signed-off-by: Bartosz Golaszewski Reviewed-by: Linus Walleij Reviewed-by: Daniel Thompson Reviewed-by: Andy Shevchenko --- drivers/video/backlight/gpio_backlight.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/video/backlight/gpio_backlight.c b/drivers/video/backlight/gpio_backlight.c index 18e053e4716c..7e1990199fae 100644 --- a/drivers/video/backlight/gpio_backlight.c +++ b/drivers/video/backlight/gpio_backlight.c @@ -12,7 +12,6 @@ #include #include #include -#include #include #include #include From patchwork Sat Oct 19 08:35:49 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 11200485 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id B85B1913 for ; Sun, 20 Oct 2019 00:07:12 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id A08922064A for ; Sun, 20 Oct 2019 00:07:12 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A08922064A Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=bgdev.pl Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 2D52889CAA; Sun, 20 Oct 2019 00:06:49 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-wm1-x341.google.com (mail-wm1-x341.google.com [IPv6:2a00:1450:4864:20::341]) by gabe.freedesktop.org (Postfix) with ESMTPS id 8FDEC89E19 for ; Sat, 19 Oct 2019 08:36:13 +0000 (UTC) Received: by mail-wm1-x341.google.com with SMTP id 3so8169105wmi.3 for ; Sat, 19 Oct 2019 01:36:13 -0700 (PDT) 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=A5bBJYbCyuRW60GB1XX7z+M5+e/gSwELCNj1WMzvFBY=; b=ZBV8uv7s5JWMZixJtfA3K7ZO0XLWsSFoNcT3YWxcL/zAM84cefG9H/F60gD3q3GmPs P6CXPieINZ1JOE4qpHyI686asmu1bTOCS8fre1qBI9Uw4FjkG92dVZTYAObhCfyVMcTr DsdVd3lG2kNj2rPN7r9MsLP4RuXZbWFEgAk4+UZ0J77q3epDGhnSXTMiE3M6MzPHx6Od mIyzdztgFMVaucaoO36KC8skryOZzVco2IN3Ptt7EvuuN+IZ1lVS3HWyivzgJMr5mY7I DdXUYZFo+yK678hk8Ber/WsFyUSAoXhUOwuincrj1K1ZXb9EmpuimshGW6BaU6bZbfaU n33g== X-Gm-Message-State: APjAAAUCvV+b3s/xzmi3CPuFVxcbERdSbDHVLjh8BJKqL7stznRAkSqO fESiIW9LY9xcbhWiHXdijUtDYQ== X-Google-Smtp-Source: APXvYqxeYmGu5PXx2s97sAMDcdiXX69oA5DXi1FfFsUYc8NVqOjz+0qhCX+j4MhOe+oQg8Ct+ADcyw== X-Received: by 2002:a05:600c:2196:: with SMTP id e22mr7093447wme.1.1571474172029; Sat, 19 Oct 2019 01:36:12 -0700 (PDT) Received: from debian-brgl.home ([2a01:cb1d:af:5b00:6d6c:8493:1ab5:dad7]) by smtp.gmail.com with ESMTPSA id u1sm7242627wmc.38.2019.10.19.01.36.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 19 Oct 2019 01:36:11 -0700 (PDT) From: Bartosz Golaszewski To: Yoshinori Sato , Rich Felker , Lee Jones , Daniel Thompson , Jingoo Han , Bartlomiej Zolnierkiewicz , Linus Walleij , Andy Shevchenko , Jacopo Mondi Subject: [PATCH v6 2/9] backlight: gpio: remove stray newline Date: Sat, 19 Oct 2019 10:35:49 +0200 Message-Id: <20191019083556.19466-3-brgl@bgdev.pl> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191019083556.19466-1-brgl@bgdev.pl> References: <20191019083556.19466-1-brgl@bgdev.pl> MIME-Version: 1.0 X-Mailman-Approved-At: Sun, 20 Oct 2019 00:06:45 +0000 X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=A5bBJYbCyuRW60GB1XX7z+M5+e/gSwELCNj1WMzvFBY=; b=PJcwaQcGOcOoFaLJc055qdw97PLYGQoFfRDf67LSJ8X9W1A1iGnc9ys8Qho6+Mvx3h q/BFei4zPDPOU7WWher6lqxzBZF921nW9bY9N/y3aYxEH5RCHkBFNNKK65i1iHilMwMx Bz5ZuyNmoSChqk8Alt/jNZxnZqQEOrxMTDWfzo3emNhzVjH46dK92qzd54hVyvJf31u0 OBDyP/yUyKOOquD3ZA6N6xzMMLUi79NYGl2MFLOziQgEr0BvASZOtEAm9CbkzeI6nQmj TZKydUBlM9LXTKGo77rB8gA35rZvsGzwKchlILK1iLHpGXX9lg/299GPbb3BTZgyjnCj +SGw== X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Bartosz Golaszewski , linux-fbdev@vger.kernel.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-sh@vger.kernel.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" From: Bartosz Golaszewski Remove a double newline from the driver. Signed-off-by: Bartosz Golaszewski Reviewed-by: Daniel Thompson --- drivers/video/backlight/gpio_backlight.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/video/backlight/gpio_backlight.c b/drivers/video/backlight/gpio_backlight.c index 7e1990199fae..3955b513f2f8 100644 --- a/drivers/video/backlight/gpio_backlight.c +++ b/drivers/video/backlight/gpio_backlight.c @@ -91,7 +91,6 @@ static int gpio_backlight_initial_power_state(struct gpio_backlight *gbl) return FB_BLANK_UNBLANK; } - static int gpio_backlight_probe(struct platform_device *pdev) { struct gpio_backlight_platform_data *pdata = From patchwork Sat Oct 19 08:35:50 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 11200513 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 40B331599 for ; Sun, 20 Oct 2019 00:07:43 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 28DE02064A for ; Sun, 20 Oct 2019 00:07:43 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 28DE02064A Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=bgdev.pl Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id B4DC989CF6; Sun, 20 Oct 2019 00:07:03 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-wm1-x342.google.com (mail-wm1-x342.google.com [IPv6:2a00:1450:4864:20::342]) by gabe.freedesktop.org (Postfix) with ESMTPS id DD7B889E26 for ; Sat, 19 Oct 2019 08:36:14 +0000 (UTC) Received: by mail-wm1-x342.google.com with SMTP id q70so1183062wme.1 for ; Sat, 19 Oct 2019 01:36:14 -0700 (PDT) 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=+S1F9dGo/ErbKc+5MFUBRKg7ZKdxaGhAR9G3FlyzzL8=; b=ltpAUq4aO6vdI9yrgl4cpyCLqXNgR3+o8WmKtOSXbRozhKzGLBNbKro1vd7827SB95 O9iAuerHJDlx5plBbhU4JEkL7LKIl4905z/lQQA13D9rWRfw52GeogTi9FdMvlYenDbD 43cgHG5FXKxkxOe8Szv+BriTbFv7xYFG2z0cFU4oWXrIIvlKi0jeVJSoUnBmNz9UHwfF Nt1KtaCoF91W6Pspa1awSHKTUH68N74BKvO6L7oE6Rm+WxkpfBAO3ey/8xAuULbLt1Sa 1GaOszL1waKhGaSYsL6oQjG3EW+KKIsNRjg7m45MHxdFoAO6pH2daUkmvF2qxLFvpxaL nw4Q== X-Gm-Message-State: APjAAAVE0qP9HTJviSYZoDPJ1dzVkd0DePzDyGalfW5fPrAmloody212 RE/3++T7ib1/jdz2461NcBQNRg== X-Google-Smtp-Source: APXvYqyGbXOURlCI3MAwmOrcJg5aZDgiyvPwiSPVXZJ2NBbEzH3nY7FwT+floFDAlMGcDtVWgxKA1w== X-Received: by 2002:a1c:8157:: with SMTP id c84mr10602738wmd.56.1571474173411; Sat, 19 Oct 2019 01:36:13 -0700 (PDT) Received: from debian-brgl.home ([2a01:cb1d:af:5b00:6d6c:8493:1ab5:dad7]) by smtp.gmail.com with ESMTPSA id u1sm7242627wmc.38.2019.10.19.01.36.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 19 Oct 2019 01:36:12 -0700 (PDT) From: Bartosz Golaszewski To: Yoshinori Sato , Rich Felker , Lee Jones , Daniel Thompson , Jingoo Han , Bartlomiej Zolnierkiewicz , Linus Walleij , Andy Shevchenko , Jacopo Mondi Subject: [PATCH v6 3/9] backlight: gpio: explicitly set the direction of the GPIO Date: Sat, 19 Oct 2019 10:35:50 +0200 Message-Id: <20191019083556.19466-4-brgl@bgdev.pl> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191019083556.19466-1-brgl@bgdev.pl> References: <20191019083556.19466-1-brgl@bgdev.pl> MIME-Version: 1.0 X-Mailman-Approved-At: Sun, 20 Oct 2019 00:06:45 +0000 X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=+S1F9dGo/ErbKc+5MFUBRKg7ZKdxaGhAR9G3FlyzzL8=; b=0LLfhTrcJfkDD2KAFAf2MOHq0yJVpuFZpKnviLv848iy8t7hqY+CGdVLo3/g5BzAnP Vmh1RNwwivxdx6HOxcryCtVTIx1NP3zdU3hhJF4LXX8poyhw6UbZy12/dERrSdt7b5L9 TGO6h+x33e73YSGHYwVFplerlB38wTr663PRMwBBzMcgU2gIDpuQSYG5VDCkuoQh0T21 l4Tbe6CyZ6122rckrz/yK1AQZfrsa2U/DC2+ep4qqNVIvr2TqG5o4XGlnLdguOBzftfm DWBdQAc/YGRkHAthUyAoIVEN+OfKp5K8t/sUuhPJqeDIclC6LBHEW6SutvjPGJ3KyY7n K0DQ== X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Bartosz Golaszewski , linux-fbdev@vger.kernel.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-sh@vger.kernel.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" From: Bartosz Golaszewski The GPIO backlight driver currently requests the line 'as is', without acively setting its direction. This can lead to problems: if the line is in input mode by default, we won't be able to drive it later when updating the status and also reading its initial value doesn't make sense for backlight setting. Request the line 'as is' initially, so that we can read its value without affecting it but then change the direction to output explicitly when setting the initial brightness. Also: check the current direction and only read the value if it's output. Signed-off-by: Bartosz Golaszewski --- drivers/video/backlight/gpio_backlight.c | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/drivers/video/backlight/gpio_backlight.c b/drivers/video/backlight/gpio_backlight.c index 3955b513f2f8..a36ac3a45b81 100644 --- a/drivers/video/backlight/gpio_backlight.c +++ b/drivers/video/backlight/gpio_backlight.c @@ -25,9 +25,8 @@ struct gpio_backlight { int def_value; }; -static int gpio_backlight_update_status(struct backlight_device *bl) +static int gpio_backlight_get_curr_brightness(struct backlight_device *bl) { - struct gpio_backlight *gbl = bl_get_data(bl); int brightness = bl->props.brightness; if (bl->props.power != FB_BLANK_UNBLANK || @@ -35,6 +34,14 @@ static int gpio_backlight_update_status(struct backlight_device *bl) bl->props.state & (BL_CORE_SUSPENDED | BL_CORE_FBBLANK)) brightness = 0; + return brightness; +} + +static int gpio_backlight_update_status(struct backlight_device *bl) +{ + struct gpio_backlight *gbl = bl_get_data(bl); + int brightness = gpio_backlight_get_curr_brightness(bl); + gpiod_set_value_cansleep(gbl->gpiod, brightness); return 0; @@ -85,7 +92,8 @@ static int gpio_backlight_initial_power_state(struct gpio_backlight *gbl) return gbl->def_value ? FB_BLANK_UNBLANK : FB_BLANK_POWERDOWN; /* if the enable GPIO is disabled, do not enable the backlight */ - if (gpiod_get_value_cansleep(gbl->gpiod) == 0) + if (gpiod_get_direction(gbl->gpiod) == 0 && + gpiod_get_value_cansleep(gbl->gpiod) == 0) return FB_BLANK_POWERDOWN; return FB_BLANK_UNBLANK; @@ -98,7 +106,7 @@ static int gpio_backlight_probe(struct platform_device *pdev) struct backlight_properties props; struct backlight_device *bl; struct gpio_backlight *gbl; - int ret; + int ret, init_brightness; gbl = devm_kzalloc(&pdev->dev, sizeof(*gbl), GFP_KERNEL); if (gbl == NULL) @@ -151,7 +159,12 @@ static int gpio_backlight_probe(struct platform_device *pdev) bl->props.power = gpio_backlight_initial_power_state(gbl); bl->props.brightness = 1; - backlight_update_status(bl); + init_brightness = gpio_backlight_get_curr_brightness(bl); + ret = gpiod_direction_output(gbl->gpiod, init_brightness); + if (ret) { + dev_err(&pdev->dev, "failed to set initial brightness\n"); + return ret; + } platform_set_drvdata(pdev, bl); return 0; From patchwork Sat Oct 19 08:35:51 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 11200475 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 3F5451599 for ; Sun, 20 Oct 2019 00:06:56 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 27A192064A for ; Sun, 20 Oct 2019 00:06:56 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 27A192064A Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=bgdev.pl Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 5879089C49; Sun, 20 Oct 2019 00:06:47 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-wm1-x344.google.com (mail-wm1-x344.google.com [IPv6:2a00:1450:4864:20::344]) by gabe.freedesktop.org (Postfix) with ESMTPS id 97B5889E98 for ; Sat, 19 Oct 2019 08:36:16 +0000 (UTC) Received: by mail-wm1-x344.google.com with SMTP id f22so8169586wmc.2 for ; Sat, 19 Oct 2019 01:36:16 -0700 (PDT) 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=l2IW6NowdeBUIPfd3VNaI3dgAIYTgpRJtcprF0UeLqs=; b=ES7tjfGWggwR1CIu+VVBicMHitpsaPzLvDz8S6LZwqQ29R96Fiv3SyVk9Nnl9udV34 XzUMu0EUNw1PKHgdYytwd6vCrB8HoOEQKKeaeCjOmielAcNZNWxEJVm+Cp54xuBV6kMn tCs14NsqkHCkuUX2SGxtR4XUdw/2RVupg9VYY7GQn35S8wbbPYIdOV3qdOeimmgdu073 092f+HD8XV9N/FrwFB5l1w/U/Ia4qf2nvVRObOe28cwc+RuxQNN07aprgAnShwSh4ttk rKnVo49+ykCX7hV2rz/+Lszxe/hWlXUFUz5CdqJDpY8AoGUF/IbNI7ESW45AFuSaXK3U FCkQ== X-Gm-Message-State: APjAAAU/U3pAFal6SfSLnmeQS0GUvEIT1/DF7saaREgWGFIlEj76wM4Z jRuyMxoepqXl63wfEuF1NriuXA== X-Google-Smtp-Source: APXvYqw3NydOO+Nuq280jVny5Giey8kePuzmSc0rGbxCZeyXpiGDAaroan7UA2mv4I22jq8kYvhYpQ== X-Received: by 2002:a1c:9cc6:: with SMTP id f189mr10385114wme.144.1571474175115; Sat, 19 Oct 2019 01:36:15 -0700 (PDT) Received: from debian-brgl.home ([2a01:cb1d:af:5b00:6d6c:8493:1ab5:dad7]) by smtp.gmail.com with ESMTPSA id u1sm7242627wmc.38.2019.10.19.01.36.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 19 Oct 2019 01:36:14 -0700 (PDT) From: Bartosz Golaszewski To: Yoshinori Sato , Rich Felker , Lee Jones , Daniel Thompson , Jingoo Han , Bartlomiej Zolnierkiewicz , Linus Walleij , Andy Shevchenko , Jacopo Mondi Subject: [PATCH v6 4/9] sh: ecovec24: add additional properties to the backlight device Date: Sat, 19 Oct 2019 10:35:51 +0200 Message-Id: <20191019083556.19466-5-brgl@bgdev.pl> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191019083556.19466-1-brgl@bgdev.pl> References: <20191019083556.19466-1-brgl@bgdev.pl> MIME-Version: 1.0 X-Mailman-Approved-At: Sun, 20 Oct 2019 00:06:45 +0000 X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=l2IW6NowdeBUIPfd3VNaI3dgAIYTgpRJtcprF0UeLqs=; b=HMLHp/EOn7D85bvZcEzeR75AlaOniQc19ENmHjj8gJXXdEEkq6jPm42L87jXMJEsrv sewZFUp34htOHovu0XlCfkXlcVXNND+ijmRLoBkT0CXyUBpBTtzL2MN1PzuN0Se+NIwi IC+V5Mt5H/7iKH7vTUOg0kCalZ3PwNEsWCuIw5VyQcln48tzMcrRVQkIJVVaSp0g4tWT tqGxZzPrS0Trm7oaF+Td7cyfMuWG8vuAWRMfbZSxpYVobQaZyJONblOO4q3VyTXZdFvg zMgaQMhUvogJWVDu0cKeilyNoJGYARpuA73fg4vIebg8CzLUFoi3V0FN6M/NZfjfYcBN 6isg== X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Bartosz Golaszewski , linux-fbdev@vger.kernel.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-sh@vger.kernel.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" From: Bartosz Golaszewski Add a GPIO lookup entry and a device property for GPIO backlight to the board file. Tie them to the platform device which is now registered using platform_device_register_full() because of the properties. These changes are inactive now but will be used once the gpio backlight driver is modified. Signed-off-by: Bartosz Golaszewski Reviewed-by: Andy Shevchenko Reviewed-by: Linus Walleij --- arch/sh/boards/mach-ecovec24/setup.c | 30 +++++++++++++++++++++++----- 1 file changed, 25 insertions(+), 5 deletions(-) diff --git a/arch/sh/boards/mach-ecovec24/setup.c b/arch/sh/boards/mach-ecovec24/setup.c index acaa97459531..aaa8ea62636f 100644 --- a/arch/sh/boards/mach-ecovec24/setup.c +++ b/arch/sh/boards/mach-ecovec24/setup.c @@ -371,6 +371,19 @@ static struct platform_device lcdc_device = { }, }; +static struct gpiod_lookup_table gpio_backlight_lookup = { + .dev_id = "gpio-backlight.0", + .table = { + GPIO_LOOKUP("sh7724_pfc", GPIO_PTR1, NULL, GPIO_ACTIVE_HIGH), + { } + }, +}; + +static struct property_entry gpio_backlight_props[] = { + PROPERTY_ENTRY_BOOL("default-on"), + { } +}; + static struct gpio_backlight_platform_data gpio_backlight_data = { .fbdev = &lcdc_device.dev, .gpio = GPIO_PTR1, @@ -378,13 +391,15 @@ static struct gpio_backlight_platform_data gpio_backlight_data = { .name = "backlight", }; -static struct platform_device gpio_backlight_device = { +static const struct platform_device_info gpio_backlight_device_info = { .name = "gpio-backlight", - .dev = { - .platform_data = &gpio_backlight_data, - }, + .data = &gpio_backlight_data, + .size_data = sizeof(gpio_backlight_data), + .properties = gpio_backlight_props, }; +static struct platform_device *gpio_backlight_device; + /* CEU0 */ static struct ceu_platform_data ceu0_pdata = { .num_subdevs = 2, @@ -1006,7 +1021,6 @@ static struct platform_device *ecovec_devices[] __initdata = { &usb1_common_device, &usbhs_device, &lcdc_device, - &gpio_backlight_device, &keysc_device, &cn12_power, #if defined(CONFIG_MMC_SDHI) || defined(CONFIG_MMC_SDHI_MODULE) @@ -1462,6 +1476,12 @@ static int __init arch_setup(void) #endif #endif + gpiod_add_lookup_table(&gpio_backlight_lookup); + gpio_backlight_device = platform_device_register_full( + &gpio_backlight_device_info); + if (IS_ERR(gpio_backlight_device)) + return PTR_ERR(gpio_backlight_device); + return platform_add_devices(ecovec_devices, ARRAY_SIZE(ecovec_devices)); } From patchwork Sat Oct 19 08:35:52 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 11200495 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id B67631599 for ; Sun, 20 Oct 2019 00:07:23 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 9EC072064A for ; Sun, 20 Oct 2019 00:07:23 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 9EC072064A Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=bgdev.pl Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 29DAB89CB2; Sun, 20 Oct 2019 00:07:01 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-wr1-x442.google.com (mail-wr1-x442.google.com [IPv6:2a00:1450:4864:20::442]) by gabe.freedesktop.org (Postfix) with ESMTPS id C290489E98 for ; Sat, 19 Oct 2019 08:36:17 +0000 (UTC) Received: by mail-wr1-x442.google.com with SMTP id o18so8510049wrv.13 for ; Sat, 19 Oct 2019 01:36:17 -0700 (PDT) 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=ksGbh2X5I7ivactCI4jvvNOH5FLCJouedGn4qvIRcNU=; b=STckBBShsnCU1t/2YRh3uuUODePVw5DOfPLMuIREtN3Pf1AKmusnh+N4o/wjJ5LdRz 724bMLlW5TDX5jazDzosuTUVMsbxgpYD9f9XtHSi1o9pJ5n7v6E0ItqSK1d0CNp8ywqC zRGSkzi81YezTyfWvU68foK7N2Hwdu2qc5PO49I4IvgHeFt2oMphTVBrKcXfrnc7M88n x87FYiYg+BmTJjf/wQJqdFOHz2sqe2xWmDGaV46PScQpBDCGjI4mZh8EXGHo10ZgGe77 ztf2glschyk2uRv1QnzB+evBlkb8zpqQAmcdfTAXRP+bDCs1QUpHV3LzHIbwZu3AKHGF BIRw== X-Gm-Message-State: APjAAAXjyS8Qixs1VnHaJHg7M4f2K6knAYu2mYh+Px2tsH857Iip/49V prIidT85MMmr+OseOA0Pqor+4g== X-Google-Smtp-Source: APXvYqzhnMfMaC2te5kIWP+ytu4oY/8aZLqHAo+n+DgYWHtp3A8jMe6Heme4rvVnO3syXrWNgDgWzQ== X-Received: by 2002:a5d:6b81:: with SMTP id n1mr441610wrx.254.1571474176300; Sat, 19 Oct 2019 01:36:16 -0700 (PDT) Received: from debian-brgl.home ([2a01:cb1d:af:5b00:6d6c:8493:1ab5:dad7]) by smtp.gmail.com with ESMTPSA id u1sm7242627wmc.38.2019.10.19.01.36.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 19 Oct 2019 01:36:15 -0700 (PDT) From: Bartosz Golaszewski To: Yoshinori Sato , Rich Felker , Lee Jones , Daniel Thompson , Jingoo Han , Bartlomiej Zolnierkiewicz , Linus Walleij , Andy Shevchenko , Jacopo Mondi Subject: [PATCH v6 5/9] backlight: gpio: simplify the platform data handling Date: Sat, 19 Oct 2019 10:35:52 +0200 Message-Id: <20191019083556.19466-6-brgl@bgdev.pl> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191019083556.19466-1-brgl@bgdev.pl> References: <20191019083556.19466-1-brgl@bgdev.pl> MIME-Version: 1.0 X-Mailman-Approved-At: Sun, 20 Oct 2019 00:06:45 +0000 X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=ksGbh2X5I7ivactCI4jvvNOH5FLCJouedGn4qvIRcNU=; b=qeOCviH9003fSdmW3/WDVHuU60mlmScEI6hXW5V2tWsOYH2Z4L87RI3RE1zmNsjFpz HU/WC9cjHVDL0FKV3NBNOJIKPKlaNzplvhQ0GWgwxpCJkm2beIaNXRkvTzCIPiO5dOhI qP1saqHI/GypMHBl7SCYCSGsxJD3CTqvrHoRgxMpibdKCppYCOa2+xrnocMVE+7bRgHZ b4NvHCz0m/hig86Pi2rwAIiHwPjXrj7PdZQLDxWmXA8QZihX0I5T92Gla+rWCWCScrpC WfjxCm5QKFuvKG62W/GiP41uYibEfNhmWh/7WQrePCdGYVmbtl5/1+HmURyjDw+EHdKK obtQ== X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Bartosz Golaszewski , linux-fbdev@vger.kernel.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-sh@vger.kernel.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" From: Bartosz Golaszewski Now that the last user of platform data (sh ecovec24) defines a proper GPIO lookup and sets the 'default-on' device property, we can drop the platform_data-specific GPIO handling and unify a big chunk of code. The only field used from the platform data is now the fbdev pointer. Signed-off-by: Bartosz Golaszewski Reviewed-by: Linus Walleij Reviewed-by: Daniel Thompson Reviewed-by: Andy Shevchenko --- drivers/video/backlight/gpio_backlight.c | 62 +++++------------------- 1 file changed, 11 insertions(+), 51 deletions(-) diff --git a/drivers/video/backlight/gpio_backlight.c b/drivers/video/backlight/gpio_backlight.c index a36ac3a45b81..c829b82f5372 100644 --- a/drivers/video/backlight/gpio_backlight.c +++ b/drivers/video/backlight/gpio_backlight.c @@ -6,7 +6,6 @@ #include #include #include -#include /* Only for legacy support */ #include #include #include @@ -61,28 +60,6 @@ static const struct backlight_ops gpio_backlight_ops = { .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; - int ret; - - gbl->def_value = device_property_read_bool(dev, "default-on"); - - gbl->gpiod = devm_gpiod_get(dev, NULL, GPIOD_ASIS); - 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_initial_power_state(struct gpio_backlight *gbl) { struct device_node *node = gbl->dev->of_node; @@ -114,35 +91,18 @@ static int gpio_backlight_probe(struct platform_device *pdev) gbl->dev = &pdev->dev; - if (pdev->dev.fwnode) { - ret = gpio_backlight_probe_dt(pdev, gbl); - if (ret) - return ret; - } else if (pdata) { - /* - * 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; - + if (pdata) 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; - } else { - dev_err(&pdev->dev, - "failed to find platform data or device tree node.\n"); - return -ENODEV; + + gbl->def_value = device_property_read_bool(&pdev->dev, "default-on"); + + gbl->gpiod = devm_gpiod_get(&pdev->dev, NULL, GPIOD_ASIS); + if (IS_ERR(gbl->gpiod)) { + ret = PTR_ERR(gbl->gpiod); + if (ret != -EPROBE_DEFER) + dev_err(&pdev->dev, + "Error: The gpios parameter is missing or invalid.\n"); + return ret; } memset(&props, 0, sizeof(props)); From patchwork Sat Oct 19 08:35:53 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 11200481 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 0589B913 for ; Sun, 20 Oct 2019 00:07:06 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id E1F2B2064A for ; Sun, 20 Oct 2019 00:07:05 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E1F2B2064A Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=bgdev.pl Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 768F589C54; Sun, 20 Oct 2019 00:06:47 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-wr1-x441.google.com (mail-wr1-x441.google.com [IPv6:2a00:1450:4864:20::441]) by gabe.freedesktop.org (Postfix) with ESMTPS id 1AA0E89EBD for ; Sat, 19 Oct 2019 08:36:19 +0000 (UTC) Received: by mail-wr1-x441.google.com with SMTP id l10so8129122wrb.2 for ; Sat, 19 Oct 2019 01:36:18 -0700 (PDT) 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=YdPiqrMx4DGxjMQly7Bs8yH/i3WsBA2bl/JSPtLQAlU=; b=hJA5hVo2HJxNP3Xebyg5IQm0CUey5DJRUUSeSTMUkUhxQLdAHr24aUsnIxCuLG2t1D ZMjib+OTeSlWBbvVBG3eiWpl7v9QHoEF5iztfhVM50C/f3Ip37g6/KF5+jnkpdekGP64 hehkIyPY7Aopxs4s0bkKYws4rfLkDTD6UttX/DxzWzA20Ay2OUTbTla3SVrxzivLA7p/ +ylG4sjxBdJdLDm8dtSB0MK+zKqgmZgsMMeXSa7PhEq4k7ZDPyfngWHjTFZdMh0GGAeA NsBbTFnRbQ0tC1ycc8wzQWtZ67ger99vq+giLI8/3mW5JIEnW8yvuzD1cQFvPsnaQlaR yXTw== X-Gm-Message-State: APjAAAWOImMP4byBgjVgufKwCQAMNo9foQLcIcKB+Nw/5CaardxHnmgr SKKPpCpwvWIWX6HdkWpSiFY6Yw== X-Google-Smtp-Source: APXvYqyMb3UE4kvzJU/RtmQDyFjei6QR5gPK148b8ly3ekSY2I6LEvUTkS+/jEFISaVozTN+hXpUFA== X-Received: by 2002:adf:c105:: with SMTP id r5mr4342828wre.125.1571474177563; Sat, 19 Oct 2019 01:36:17 -0700 (PDT) Received: from debian-brgl.home ([2a01:cb1d:af:5b00:6d6c:8493:1ab5:dad7]) by smtp.gmail.com with ESMTPSA id u1sm7242627wmc.38.2019.10.19.01.36.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 19 Oct 2019 01:36:17 -0700 (PDT) From: Bartosz Golaszewski To: Yoshinori Sato , Rich Felker , Lee Jones , Daniel Thompson , Jingoo Han , Bartlomiej Zolnierkiewicz , Linus Walleij , Andy Shevchenko , Jacopo Mondi Subject: [PATCH v6 6/9] sh: ecovec24: don't set unused fields in platform data Date: Sat, 19 Oct 2019 10:35:53 +0200 Message-Id: <20191019083556.19466-7-brgl@bgdev.pl> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191019083556.19466-1-brgl@bgdev.pl> References: <20191019083556.19466-1-brgl@bgdev.pl> MIME-Version: 1.0 X-Mailman-Approved-At: Sun, 20 Oct 2019 00:06:45 +0000 X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=YdPiqrMx4DGxjMQly7Bs8yH/i3WsBA2bl/JSPtLQAlU=; b=KTrWMJfcSsNsU/hInH+8etvSbXWxmCunj3myy9w3kenbKYKLPvPV2HXvi/9ONkNlby JlacPZ3LR4yVNif1PlgZpYgm6GvDWNCsxclVp+7fpsz9MlOznlaVrG9I85dnSyZcPjuK zZTZrKKoHTU/wnkEaBL9oEttLxsLvew/TtYzrVTXdL4dWZQ4NtjZyZq6UYkDskdNSgWP Aw7QdUQ0Pi9iYxj9wqB9guvcDwKlzlHqSbrPiqZ9iUULr1G+gvARZZTFhGNhXxAxkcXm EBhC3iFA9YN46vY/ako/Gp2L4ASzbDaTlcUsXZxo3XR04DIEVlIbKINwG1cLyh8dPg2u /HUg== X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Bartosz Golaszewski , linux-fbdev@vger.kernel.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-sh@vger.kernel.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" From: Bartosz Golaszewski Platform data fields other than fbdev are no longer used by the backlight driver. Remove them. Signed-off-by: Bartosz Golaszewski Reviewed-by: Andy Shevchenko Reviewed-by: Linus Walleij --- arch/sh/boards/mach-ecovec24/setup.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/arch/sh/boards/mach-ecovec24/setup.c b/arch/sh/boards/mach-ecovec24/setup.c index aaa8ea62636f..dd427bac5cde 100644 --- a/arch/sh/boards/mach-ecovec24/setup.c +++ b/arch/sh/boards/mach-ecovec24/setup.c @@ -386,9 +386,6 @@ static struct property_entry gpio_backlight_props[] = { static struct gpio_backlight_platform_data gpio_backlight_data = { .fbdev = &lcdc_device.dev, - .gpio = GPIO_PTR1, - .def_value = 1, - .name = "backlight", }; static const struct platform_device_info gpio_backlight_device_info = { From patchwork Sat Oct 19 08:35:54 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 11200493 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 1B61D1599 for ; Sun, 20 Oct 2019 00:07:22 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 0373C2064A for ; Sun, 20 Oct 2019 00:07:22 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 0373C2064A Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=bgdev.pl Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id E38EA89CAF; Sun, 20 Oct 2019 00:07:00 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-wr1-x443.google.com (mail-wr1-x443.google.com [IPv6:2a00:1450:4864:20::443]) by gabe.freedesktop.org (Postfix) with ESMTPS id 797E989F08 for ; Sat, 19 Oct 2019 08:36:20 +0000 (UTC) Received: by mail-wr1-x443.google.com with SMTP id o28so8548279wro.7 for ; Sat, 19 Oct 2019 01:36:20 -0700 (PDT) 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=fJb9zTJUFk5gt04WV606l1pH2Oso/m6U1KjJZ/jsQAQ=; b=LFA7gtdoPwqdORQqoLl9xbhdjgh7D8JAzuZyWLgKw9bVRBWaFedNKlnxyAZurR/DEe wlKiFbqvE2gV32U9g7m3BVOAJULJyG8tUNva/20UtoExUpk/WOwI2getzZpcEytJyuxy eLWY/XAp3U1hCyp8m386XtvQE5ZdeogNUE7BkF98AVKcROAz3WJWp09E040cqsv8/42J r3F6f8PhziFGtJfKKLMS7X0emvrJjw/ECMOc9UH8cHwxg8igElg/ECwdAlgMQdNFQrp0 r7MUy9Ad8pwVPJXogopP+cO06moNRQOWpZS8kmW+XPP/S1svM2wvHDXBAjjO/fZGSlFm Z66g== X-Gm-Message-State: APjAAAWHzfy/ZpmykKK0Gai12KmTfs6OvuX1FcNvDsyoQoLfhbsMU3zP Ojxpz+LnImVY93To/ZM+AkzrYg== X-Google-Smtp-Source: APXvYqyC7Ckh43yEeLj+N7+h+UruFS+0KKtHRNyoTyt/JpzLBEE5Q2IIWFp45JPp3FFZIDaUQ2sQwg== X-Received: by 2002:a5d:6984:: with SMTP id g4mr1432291wru.43.1571474179094; Sat, 19 Oct 2019 01:36:19 -0700 (PDT) Received: from debian-brgl.home ([2a01:cb1d:af:5b00:6d6c:8493:1ab5:dad7]) by smtp.gmail.com with ESMTPSA id u1sm7242627wmc.38.2019.10.19.01.36.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 19 Oct 2019 01:36:18 -0700 (PDT) From: Bartosz Golaszewski To: Yoshinori Sato , Rich Felker , Lee Jones , Daniel Thompson , Jingoo Han , Bartlomiej Zolnierkiewicz , Linus Walleij , Andy Shevchenko , Jacopo Mondi Subject: [PATCH v6 7/9] backlight: gpio: remove unused fields from platform data Date: Sat, 19 Oct 2019 10:35:54 +0200 Message-Id: <20191019083556.19466-8-brgl@bgdev.pl> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191019083556.19466-1-brgl@bgdev.pl> References: <20191019083556.19466-1-brgl@bgdev.pl> MIME-Version: 1.0 X-Mailman-Approved-At: Sun, 20 Oct 2019 00:06:45 +0000 X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=fJb9zTJUFk5gt04WV606l1pH2Oso/m6U1KjJZ/jsQAQ=; b=P1X7rjfTUJ3nuQIt5WgPxo/bWVF1kNL7UC7z6D3mpB5+R/b/fRt812wGTpBYsf1l4X yLrW5jtqYTj9YCVhQyVaKhVahExaGBVsQ24kF8hxTisINKX9Ki9dkJoqd2OpUJpey5aw RJJfG8f4obCZrlt1J0H/Aed3CeK19+tFD1NoDtUEVAktPR+PGIL/dtASqLofSrkNqxKp OuTN9is8GL3bPXKg141be4zDoB0/wM51Cbdiu+mJ4FQidBEmd8QXf3ney/4vuQGHJQlL h+uHFSpFqfIzhmhbYrFM7LUnDmKWRncFKOUNY6CY2/IQnjXIx1JqTuDAaUOQDcS+FrRP UXAg== X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Bartosz Golaszewski , linux-fbdev@vger.kernel.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-sh@vger.kernel.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" From: Bartosz Golaszewski Remove the platform data fields that nobody uses. Signed-off-by: Bartosz Golaszewski Reviewed-by: Andy Shevchenko Reviewed-by: Linus Walleij Reviewed-by: Daniel Thompson --- include/linux/platform_data/gpio_backlight.h | 3 --- 1 file changed, 3 deletions(-) diff --git a/include/linux/platform_data/gpio_backlight.h b/include/linux/platform_data/gpio_backlight.h index 34179d600360..1a8b5b1946fe 100644 --- a/include/linux/platform_data/gpio_backlight.h +++ b/include/linux/platform_data/gpio_backlight.h @@ -9,9 +9,6 @@ struct device; struct gpio_backlight_platform_data { struct device *fbdev; - int gpio; - int def_value; - const char *name; }; #endif From patchwork Sat Oct 19 08:35:55 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 11200499 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 7BB5B1599 for ; Sun, 20 Oct 2019 00:07:28 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 6439F2064A for ; Sun, 20 Oct 2019 00:07:28 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 6439F2064A Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=bgdev.pl Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 8CB5389CB9; Sun, 20 Oct 2019 00:07:01 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-wm1-x344.google.com (mail-wm1-x344.google.com [IPv6:2a00:1450:4864:20::344]) by gabe.freedesktop.org (Postfix) with ESMTPS id 3CEF689F2D for ; Sat, 19 Oct 2019 08:36:22 +0000 (UTC) Received: by mail-wm1-x344.google.com with SMTP id i16so8366109wmd.3 for ; Sat, 19 Oct 2019 01:36:22 -0700 (PDT) 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=+aYo/jE0l+r2VpUneeIaMs1HWjXHH9okkuy6GJ4hUcw=; b=QorKHs8fZPKlSk22EQplhL9TSYJ7vzZCWXrhHd88QA8A49cAmjM13JmZjsxDi6Z33B Nj/e0eg9EzyFsb4gbXes/5nCMthXV4JoOScNdEA2J92IAhqj2lwGm4CXixqcx3+S/LH6 ojH5yoKm451pw4AoNmmIj8mW1xSiAVSYYbmzEjdnCg9lMumLMeJdoMHj4yLmlXi7ZJlp pbHL6R0s3jUFVga2Qjo4dMzPEJ5mFpxEGUmwTZXLstvjd5BC/gIN4dD5Ztya8N6jfxrI GPVnIHg16UjOTrprZaM0y1nC/8AMZllnFBMXzxYjn5qYcMOrQ+R58LtnCbs8sOs3Oxtz iihw== X-Gm-Message-State: APjAAAVqE8zlvoP5lk+VRvKRtv054IsE8Cn5EuGGNXUoD9vOtVN6SmP4 ykP6pUZKyC90gd3IDJJtv1hCTWiBtIc= X-Google-Smtp-Source: APXvYqwmPVh7r2j/5vnVETV3Itb96Hdk3RmxzyJeWRMyIuLuB2/Jd+9kynJT4aIzf2BZC4ibMUZKdA== X-Received: by 2002:a1c:9894:: with SMTP id a142mr10577174wme.70.1571474180785; Sat, 19 Oct 2019 01:36:20 -0700 (PDT) Received: from debian-brgl.home ([2a01:cb1d:af:5b00:6d6c:8493:1ab5:dad7]) by smtp.gmail.com with ESMTPSA id u1sm7242627wmc.38.2019.10.19.01.36.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 19 Oct 2019 01:36:19 -0700 (PDT) From: Bartosz Golaszewski To: Yoshinori Sato , Rich Felker , Lee Jones , Daniel Thompson , Jingoo Han , Bartlomiej Zolnierkiewicz , Linus Walleij , Andy Shevchenko , Jacopo Mondi Subject: [PATCH v6 8/9] backlight: gpio: use a helper variable for &pdev->dev Date: Sat, 19 Oct 2019 10:35:55 +0200 Message-Id: <20191019083556.19466-9-brgl@bgdev.pl> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191019083556.19466-1-brgl@bgdev.pl> References: <20191019083556.19466-1-brgl@bgdev.pl> MIME-Version: 1.0 X-Mailman-Approved-At: Sun, 20 Oct 2019 00:06:45 +0000 X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=+aYo/jE0l+r2VpUneeIaMs1HWjXHH9okkuy6GJ4hUcw=; b=h0zJaikzGMrQw/8lBb8sYuz2WDIJK2djdadS0yQaFn8WT5woxc5FUsuVZG+wAXttYG iHwMNTLMjhuKALsd3KJvXMCsxUdR+J58mQ6O1+I8jBn+8yDzdtEkwgPtbZKE9jUa3qLF UOlhDeSMehnwZiRaWSDC2KjDp6B3UEMLcX/BO//N3Odg99NHuaYUVRLmkJceoGeVxIoD 4op/vdrRCqyx9zBi0qM+4v1vUKsvdAxXa5lzG28v5SviLf1vGhNZvTamx8PZkKA5Momy qyDXuhvg2Hn2smrWGwoY6GH+GwXdsPfjHPTETa4xb6YommzinQgnvlZmWP4hg0P6vzat +Png== X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Bartosz Golaszewski , linux-fbdev@vger.kernel.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-sh@vger.kernel.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" From: Bartosz Golaszewski Instead of dereferencing pdev each time, use a helper variable for the associated device pointer. Signed-off-by: Bartosz Golaszewski Reviewed-by: Linus Walleij Reviewed-by: Daniel Thompson Reviewed-by: Andy Shevchenko --- drivers/video/backlight/gpio_backlight.c | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/drivers/video/backlight/gpio_backlight.c b/drivers/video/backlight/gpio_backlight.c index c829b82f5372..7b411f6ee15a 100644 --- a/drivers/video/backlight/gpio_backlight.c +++ b/drivers/video/backlight/gpio_backlight.c @@ -78,29 +78,29 @@ static int gpio_backlight_initial_power_state(struct gpio_backlight *gbl) 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 gpio_backlight_platform_data *pdata = dev_get_platdata(dev); struct backlight_properties props; struct backlight_device *bl; struct gpio_backlight *gbl; int ret, init_brightness; - gbl = devm_kzalloc(&pdev->dev, sizeof(*gbl), GFP_KERNEL); + gbl = devm_kzalloc(dev, sizeof(*gbl), GFP_KERNEL); if (gbl == NULL) return -ENOMEM; - gbl->dev = &pdev->dev; + gbl->dev = dev; if (pdata) gbl->fbdev = pdata->fbdev; - gbl->def_value = device_property_read_bool(&pdev->dev, "default-on"); + gbl->def_value = device_property_read_bool(dev, "default-on"); - gbl->gpiod = devm_gpiod_get(&pdev->dev, NULL, GPIOD_ASIS); + gbl->gpiod = devm_gpiod_get(dev, NULL, GPIOD_ASIS); if (IS_ERR(gbl->gpiod)) { ret = PTR_ERR(gbl->gpiod); if (ret != -EPROBE_DEFER) - dev_err(&pdev->dev, + dev_err(dev, "Error: The gpios parameter is missing or invalid.\n"); return ret; } @@ -108,11 +108,10 @@ static int gpio_backlight_probe(struct platform_device *pdev) memset(&props, 0, sizeof(props)); props.type = BACKLIGHT_RAW; props.max_brightness = 1; - bl = devm_backlight_device_register(&pdev->dev, dev_name(&pdev->dev), - &pdev->dev, gbl, &gpio_backlight_ops, - &props); + bl = devm_backlight_device_register(dev, dev_name(dev), dev, gbl, + &gpio_backlight_ops, &props); if (IS_ERR(bl)) { - dev_err(&pdev->dev, "failed to register backlight\n"); + dev_err(dev, "failed to register backlight\n"); return PTR_ERR(bl); } @@ -122,7 +121,7 @@ static int gpio_backlight_probe(struct platform_device *pdev) init_brightness = gpio_backlight_get_curr_brightness(bl); ret = gpiod_direction_output(gbl->gpiod, init_brightness); if (ret) { - dev_err(&pdev->dev, "failed to set initial brightness\n"); + dev_err(dev, "failed to set initial brightness\n"); return ret; } From patchwork Sat Oct 19 08:35:56 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 11200471 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 06A59913 for ; Sun, 20 Oct 2019 00:06:51 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id D92BA2064A for ; Sun, 20 Oct 2019 00:06:50 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D92BA2064A Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=bgdev.pl Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 1895E89A91; Sun, 20 Oct 2019 00:06:46 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-wr1-x442.google.com (mail-wr1-x442.google.com [IPv6:2a00:1450:4864:20::442]) by gabe.freedesktop.org (Postfix) with ESMTPS id B016F89F2D for ; Sat, 19 Oct 2019 08:36:23 +0000 (UTC) Received: by mail-wr1-x442.google.com with SMTP id r3so8553728wrj.6 for ; Sat, 19 Oct 2019 01:36:23 -0700 (PDT) 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=qycHXMO6hwxhUdb3jdVqS6gIVNXR0dtaUr+q4ZsWEBE=; b=otqun2oT+qiR2BsAtHs7TFifHMUxaR7Sj0/Q9iMw4yjaje5YrO+STUyQqZY5R3EcDb xjDnfPcWDtNAHRGhgWMZHzgCfKpmRHJRBxJOnmk4tTFw50qnVU9AfFoaUvgsRwDR+/kT Ynlq6EFAhvxZkJQkVa0l/5seSs+zScM2iHVOkYEM0+hlZ8KeJzg5+ct7Usp3HM+mq/y0 kwzkmFaS8UElXyOyP4YWxGUG1KVXIIZxVaTFhcg6p1pKu7Hq3zx87DbHGmCO1etFJQ7m l078pb3PvayVWlW7KGzWM1JB4OWIsTTbgEonf6Gsexjtp8S3RbyGxORXKHFNlvnkNQsd RK5A== X-Gm-Message-State: APjAAAWU6wkEyy3Zy71YdB0zXz6J2zlfEwWfzLylICvhZGFLLxOAeC0y p3tM3WXM8Z969c28tgcaV3ontg== X-Google-Smtp-Source: APXvYqxL4ngNwJD3Ia6U3FUSz7NI06K8MQss3MsCYJfxqtNfTF2X+Kq18B1s3ij+8TKee2gNA8Mvcg== X-Received: by 2002:adf:fcc5:: with SMTP id f5mr10803495wrs.37.1571474182248; Sat, 19 Oct 2019 01:36:22 -0700 (PDT) Received: from debian-brgl.home ([2a01:cb1d:af:5b00:6d6c:8493:1ab5:dad7]) by smtp.gmail.com with ESMTPSA id u1sm7242627wmc.38.2019.10.19.01.36.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 19 Oct 2019 01:36:21 -0700 (PDT) From: Bartosz Golaszewski To: Yoshinori Sato , Rich Felker , Lee Jones , Daniel Thompson , Jingoo Han , Bartlomiej Zolnierkiewicz , Linus Walleij , Andy Shevchenko , Jacopo Mondi Subject: [PATCH v6 9/9] backlight: gpio: pull gpio_backlight_initial_power_state() into probe Date: Sat, 19 Oct 2019 10:35:56 +0200 Message-Id: <20191019083556.19466-10-brgl@bgdev.pl> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191019083556.19466-1-brgl@bgdev.pl> References: <20191019083556.19466-1-brgl@bgdev.pl> MIME-Version: 1.0 X-Mailman-Approved-At: Sun, 20 Oct 2019 00:06:45 +0000 X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=qycHXMO6hwxhUdb3jdVqS6gIVNXR0dtaUr+q4ZsWEBE=; b=Jk5EBmYa+f25dVL0ytlmaRtf8WAVFhl1TWLYulD/cjGDX1wCaySBwWD/vh2NWZbHVD 5niPb2mYSBspLggl0tema5K8Qd8+JzAAcvvu2lPy3+1NRihUAq2JxJ+U490BS8+w0udd t4XfieezI2QS399OfGYDN0hIKV10tM5OK2EICaKM2qjVBAoJ4TJWV1ckCVAhKi4xVHVR QrENWpsMNxsrVai6eEP6BAsNmRZHafdwOW+Q7Y1XYH+rqy2dJEVhPp/9PkmRjJrViH5x tQvWbNZ6yFRV4KParbooJKpz3bzQ20Mn0F+ULmYO5KMaC4yAG2FyBZfAd3ofmJEjIwBm IcjQ== X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Bartosz Golaszewski , linux-fbdev@vger.kernel.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-sh@vger.kernel.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" From: Bartosz Golaszewski The probe function in the gpio-backlight driver is quite short. If we pull gpio_backlight_initial_power_state() into probe we can drop two more fields from struct gpio_backlight and shrink the driver code. Signed-off-by: Bartosz Golaszewski Acked-by: Daniel Thompson --- drivers/video/backlight/gpio_backlight.c | 38 +++++++++--------------- 1 file changed, 14 insertions(+), 24 deletions(-) diff --git a/drivers/video/backlight/gpio_backlight.c b/drivers/video/backlight/gpio_backlight.c index 7b411f6ee15a..4336db6bf6b5 100644 --- a/drivers/video/backlight/gpio_backlight.c +++ b/drivers/video/backlight/gpio_backlight.c @@ -17,11 +17,8 @@ #include struct gpio_backlight { - struct device *dev; struct device *fbdev; - struct gpio_desc *gpiod; - int def_value; }; static int gpio_backlight_get_curr_brightness(struct backlight_device *bl) @@ -60,41 +57,24 @@ static const struct backlight_ops gpio_backlight_ops = { .check_fb = gpio_backlight_check_fb, }; -static int gpio_backlight_initial_power_state(struct gpio_backlight *gbl) -{ - struct device_node *node = gbl->dev->of_node; - - /* Not booted with device tree or no phandle link to the node */ - if (!node || !node->phandle) - return gbl->def_value ? FB_BLANK_UNBLANK : FB_BLANK_POWERDOWN; - - /* if the enable GPIO is disabled, do not enable the backlight */ - if (gpiod_get_direction(gbl->gpiod) == 0 && - gpiod_get_value_cansleep(gbl->gpiod) == 0) - return FB_BLANK_POWERDOWN; - - return FB_BLANK_UNBLANK; -} - static int gpio_backlight_probe(struct platform_device *pdev) { struct device *dev = &pdev->dev; struct gpio_backlight_platform_data *pdata = dev_get_platdata(dev); + struct device_node *of_node = dev->of_node; struct backlight_properties props; struct backlight_device *bl; struct gpio_backlight *gbl; - int ret, init_brightness; + int ret, init_brightness, def_value; gbl = devm_kzalloc(dev, sizeof(*gbl), GFP_KERNEL); if (gbl == NULL) return -ENOMEM; - gbl->dev = dev; - if (pdata) gbl->fbdev = pdata->fbdev; - gbl->def_value = device_property_read_bool(dev, "default-on"); + def_value = device_property_read_bool(dev, "default-on"); gbl->gpiod = devm_gpiod_get(dev, NULL, GPIOD_ASIS); if (IS_ERR(gbl->gpiod)) { @@ -115,7 +95,17 @@ static int gpio_backlight_probe(struct platform_device *pdev) return PTR_ERR(bl); } - bl->props.power = gpio_backlight_initial_power_state(gbl); + /* Set the initial power state */ + if (!of_node || !of_node->phandle) + /* Not booted with device tree or no phandle link to the node */ + bl->props.power = def_value ? FB_BLANK_UNBLANK + : FB_BLANK_POWERDOWN; + else if (gpiod_get_direction(gbl->gpiod) == 0 && + gpiod_get_value_cansleep(gbl->gpiod) == 0) + bl->props.power = FB_BLANK_POWERDOWN; + else + bl->props.power = FB_BLANK_UNBLANK; + bl->props.brightness = 1; init_brightness = gpio_backlight_get_curr_brightness(bl);