From patchwork Tue Jun 25 16:34:23 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 11016015 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 D7A5F76 for ; Tue, 25 Jun 2019 16:35:45 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C8FC0283AF for ; Tue, 25 Jun 2019 16:35:45 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BD0BC283BB; Tue, 25 Jun 2019 16:35:45 +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=-7.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,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 5F60B283AF for ; Tue, 25 Jun 2019 16:35:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729198AbfFYQe4 (ORCPT ); Tue, 25 Jun 2019 12:34:56 -0400 Received: from mail-wr1-f65.google.com ([209.85.221.65]:34816 "EHLO mail-wr1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727944AbfFYQez (ORCPT ); Tue, 25 Jun 2019 12:34:55 -0400 Received: by mail-wr1-f65.google.com with SMTP id f15so8742922wrp.2 for ; Tue, 25 Jun 2019 09:34:53 -0700 (PDT) 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=2ZSWbqFAdYMHZSBHSRb1jfufvzOhyuDcLok5vmyDpAk=; b=SJOSCbrBbZkjOqrPgnuNAn3R5vfXS6muglF3i2rYm4u0+9MfY8ZtiyCWhaoSYkXO8w eOFkyeVW0jcrhK2bzRVm7OVFfxNNRuPXIaA1Pc5QIbfMItUzavJ+NDMN8n9e0L9FS8p6 tq7TTeGdzaX0136DmFa1LftA7xw+cPs//R7BxHfmQaa/vNwriSWQhE6HYmKQuFbGDxDq Bg5erLaGp0cgJlgeiEOIPYKLnoR9icCMSctMhsB1HZzmQqp3udL5+Sn4pNOcL9yKERsx Z5y5KpcxAJ9+MaE4zx8TVcaHvHGAnMEpPRGOC89hkmJe4zcmW8hColHnvm5z1nJEKHx+ Lt5A== 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=2ZSWbqFAdYMHZSBHSRb1jfufvzOhyuDcLok5vmyDpAk=; b=iW4s9Uxa/Vh9qFIxan3VMwsXaaT5c7tzmceyH7NpS0e+q3o4FM7h7jgnc5NUWPV6G1 QZ7QUyqeWbqs6uXMewk1A03S4cI8MZuz25MDOUE92DCYFYtkZoR7tRwz3TwggH74qOmK oVNSFFnFm4yRV6KhdPsUbeGQOEbUPC/HmYka0XDWyIgS+Ml6yacXdQ/dFLNWnquAY0rc HsM30EaVfnVqtz9MmBOyhWQCoVlronioedQBppc4tbTUxae6+hn8F2xTRrN/gFhdGcQC 3QALSxQLi3PYnxmjV7lLXqYAAKjamtD41UC3WftZWnV2K+y+ZtVZaCPA3gk9OZvRaovX Qu8w== X-Gm-Message-State: APjAAAWaz5W1uQrfa3z+FAs9ZGKB2DZKwQuPUD6whQf3HdTmgs0ahRqY 0ImCS5vLOOernWsoFbkpwip0cA== X-Google-Smtp-Source: APXvYqxBEmrDBznAn14GIGVfoHIVRb3pDwaOfikmLmN/GvkdUV1EAMzyMBq7WLZPIpw1AC69xAAo+Q== X-Received: by 2002:a05:6000:114b:: with SMTP id d11mr47787109wrx.167.1561480492966; Tue, 25 Jun 2019 09:34:52 -0700 (PDT) Received: from debian-brgl.home ([2a01:cb1d:af:5b00:6d6c:8493:1ab5:dad7]) by smtp.gmail.com with ESMTPSA id g8sm2683795wme.20.2019.06.25.09.34.51 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 25 Jun 2019 09:34:52 -0700 (PDT) From: Bartosz Golaszewski To: Sekhar Nori , Kevin Hilman , Lee Jones , Daniel Thompson , Jingoo Han , Bartlomiej Zolnierkiewicz , David Lechner , Linus Walleij Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-fbdev@vger.kernel.org, Bartosz Golaszewski Subject: [PATCH 01/12] backlight: gpio: allow to probe non-pdata devices from board files Date: Tue, 25 Jun 2019 18:34:23 +0200 Message-Id: <20190625163434.13620-2-brgl@bgdev.pl> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190625163434.13620-1-brgl@bgdev.pl> References: <20190625163434.13620-1-brgl@bgdev.pl> MIME-Version: 1.0 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 From: Bartosz Golaszewski Currently we can only probe devices that either use device tree or pass platform data to probe(). Rename gpio_backlight_probe_dt() to gpio_backlight_probe_prop() and use generic device properties instead of OF specific helpers. Reverse the logic checking the presence of platform data in probe(). This way we can probe devices() registered from machine code that neither have a DT node nor use platform data. Signed-off-by: Bartosz Golaszewski Reviewed-by: Bartlomiej Zolnierkiewicz --- drivers/video/backlight/gpio_backlight.c | 24 ++++++++---------------- 1 file changed, 8 insertions(+), 16 deletions(-) diff --git a/drivers/video/backlight/gpio_backlight.c b/drivers/video/backlight/gpio_backlight.c index b9300f3e1ee6..654c19d3a81d 100644 --- a/drivers/video/backlight/gpio_backlight.c +++ b/drivers/video/backlight/gpio_backlight.c @@ -54,15 +54,14 @@ 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) +static int gpio_backlight_probe_prop(struct platform_device *pdev, + struct gpio_backlight *gbl) { struct device *dev = &pdev->dev; - struct device_node *np = dev->of_node; enum gpiod_flags flags; int ret; - gbl->def_value = of_property_read_bool(np, "default-on"); + 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); @@ -86,26 +85,15 @@ static int gpio_backlight_probe(struct platform_device *pdev) struct backlight_properties props; struct backlight_device *bl; struct gpio_backlight *gbl; - struct device_node *np = pdev->dev.of_node; int ret; - if (!pdata && !np) { - dev_err(&pdev->dev, - "failed to find platform data or device tree node.\n"); - return -ENODEV; - } - gbl = devm_kzalloc(&pdev->dev, sizeof(*gbl), GFP_KERNEL); if (gbl == NULL) return -ENOMEM; gbl->dev = &pdev->dev; - if (np) { - 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 @@ -126,6 +114,10 @@ static int gpio_backlight_probe(struct platform_device *pdev) gbl->gpiod = gpio_to_desc(pdata->gpio); if (!gbl->gpiod) return -EINVAL; + } else { + ret = gpio_backlight_probe_prop(pdev, gbl); + if (ret) + return ret; } memset(&props, 0, sizeof(props)); From patchwork Tue Jun 25 16:34:24 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 11015991 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 2420776 for ; Tue, 25 Jun 2019 16:34:58 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 15CD128396 for ; Tue, 25 Jun 2019 16:34:58 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 09BAB283A6; Tue, 25 Jun 2019 16:34:58 +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=-7.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,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 A624928396 for ; Tue, 25 Jun 2019 16:34:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729603AbfFYQe5 (ORCPT ); Tue, 25 Jun 2019 12:34:57 -0400 Received: from mail-wr1-f68.google.com ([209.85.221.68]:44006 "EHLO mail-wr1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727034AbfFYQe4 (ORCPT ); Tue, 25 Jun 2019 12:34:56 -0400 Received: by mail-wr1-f68.google.com with SMTP id p13so18609968wru.10 for ; Tue, 25 Jun 2019 09:34:54 -0700 (PDT) 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=8iezztZquUE7VOJu2VvhRUb2IfrZ8cIwgoI4gm0DrkM=; b=rgxXlRAaV6xZXnZFHal/gjCfi7ThDBTYi4zQlerr90dKuypsYo0mb+p33lydeL4eKn 2Cg8TDpnk1TQyWRPgE7auXmAdnsrV7xq0CkHwBoS14Z8stdjg5sO1sgEu4CXM0obe8GT HtDtgDT/yuWJ/6FSenaU3s3kQIgEWAOjiCDWUhU8Pfhoj3WCpQG547MgKdHM7a0QE2ml oMYIbV67RK1VeetSwtj5yG0Sb0iifz24h/amsfYK1tn89rbBjiyJy6Dq7HfJ6k7U1O2X NjWCVLOG8O2PA2zG7LLOXV9LLX5jw93wHA6dgCylVM+dJAI+sj7QPNmJX6O7U4MR7nGO 8GcQ== 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=8iezztZquUE7VOJu2VvhRUb2IfrZ8cIwgoI4gm0DrkM=; b=ptWERHL9kkdarVWvL3hKnPvr1x81boWC5pzCZpy+IUbQJKbkg8Y8pq3HHBoKQAu5bt N2npny8A7LiQpSZcak/kJxDCm5wlCISbXA7j6wbYcCtFmptvCxiJ2os98E2hsv2JQFvO H9u4ja6jcNY59Xww8ZcPrUI9Jjw4QpH44bzhzomsZr4NY4qEwZOXG6K9DCQ0ECPpAYzZ ZXDYM5Rv8Bd+y0Op9nXVekIwhE0vwSsqi0wV1tYzTvIYV3JuQd9YjNUHVclCpYW8Dx9g JEYvyETCIRcMIJOSjuS21GJmYE/JvG1FntC3mrnW/HrddtkReTtQKhkCBATJTjj6gom9 KWHA== X-Gm-Message-State: APjAAAWnzelSXFQdfzb2ZEu+3nNbe4ffJDj24HCRBNzVNf4WSl8gUpBJ PPHVkWqxP7TpTVEWMZW0COfZ5A== X-Google-Smtp-Source: APXvYqzDDJRCAp4r9gihTWEjB9YUiMxhVdwQYB5zhog7hsqmsGPPt4gRXpZAivYIHwx1NdMTVydW+w== X-Received: by 2002:adf:81c8:: with SMTP id 66mr110996508wra.261.1561480494146; Tue, 25 Jun 2019 09:34:54 -0700 (PDT) Received: from debian-brgl.home ([2a01:cb1d:af:5b00:6d6c:8493:1ab5:dad7]) by smtp.gmail.com with ESMTPSA id g8sm2683795wme.20.2019.06.25.09.34.53 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 25 Jun 2019 09:34:53 -0700 (PDT) From: Bartosz Golaszewski To: Sekhar Nori , Kevin Hilman , Lee Jones , Daniel Thompson , Jingoo Han , Bartlomiej Zolnierkiewicz , David Lechner , Linus Walleij Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-fbdev@vger.kernel.org, Bartosz Golaszewski Subject: [PATCH 02/12] backlight: gpio: use a helper variable for &pdev->dev Date: Tue, 25 Jun 2019 18:34:24 +0200 Message-Id: <20190625163434.13620-3-brgl@bgdev.pl> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190625163434.13620-1-brgl@bgdev.pl> References: <20190625163434.13620-1-brgl@bgdev.pl> MIME-Version: 1.0 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 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: Bartlomiej Zolnierkiewicz --- drivers/video/backlight/gpio_backlight.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/video/backlight/gpio_backlight.c b/drivers/video/backlight/gpio_backlight.c index 654c19d3a81d..8adbc8d75097 100644 --- a/drivers/video/backlight/gpio_backlight.c +++ b/drivers/video/backlight/gpio_backlight.c @@ -83,15 +83,16 @@ static int gpio_backlight_probe(struct platform_device *pdev) struct gpio_backlight_platform_data *pdata = dev_get_platdata(&pdev->dev); struct backlight_properties props; + struct device *dev = &pdev->dev; struct backlight_device *bl; struct gpio_backlight *gbl; int ret; - 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) { /* @@ -108,7 +109,7 @@ static int gpio_backlight_probe(struct platform_device *pdev) 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"); + dev_err(dev, "unable to request GPIO\n"); return ret; } gbl->gpiod = gpio_to_desc(pdata->gpio); @@ -123,11 +124,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); } From patchwork Tue Jun 25 16:34:25 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 11016013 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 4FF6876 for ; Tue, 25 Jun 2019 16:35:44 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 412E7283AF for ; Tue, 25 Jun 2019 16:35:44 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 34E45283BB; Tue, 25 Jun 2019 16:35:44 +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=-7.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,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 CD6A6283AF for ; Tue, 25 Jun 2019 16:35:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729664AbfFYQe5 (ORCPT ); Tue, 25 Jun 2019 12:34:57 -0400 Received: from mail-wr1-f67.google.com ([209.85.221.67]:41774 "EHLO mail-wr1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727944AbfFYQe4 (ORCPT ); Tue, 25 Jun 2019 12:34:56 -0400 Received: by mail-wr1-f67.google.com with SMTP id c2so18613600wrm.8 for ; Tue, 25 Jun 2019 09:34:56 -0700 (PDT) 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=9jHnEFpHn7uzznoO3/dgHPquJFVDhGL7Sa3AB/IK/o8=; b=hn0sJGMrU38ycKfPEcke4oemjMf5nF19She6rrogMdb5v0F2pBQBNKFb+k/+2MJbvv x0AL7iJN38li9VNodfle2pG9gu9d2FJ3tvO7WCdfFllzJdndvifHLTLjRDM4aDml+Kuj ARXR5bllOgDLUQO3pl4c5PKCRuEuqrBRd/sgqgOD1M5Honf1Q9rxMnOT9Gtrbba1Pc6q WCixZR6JX0xgDU+5eMlm3aDNlNwAqfajTgyiKEnyZ2eYijvvzNfmrix4ZFYvnBzoboQW vWSvbCOsW9ZdQYXrDXj4UOEBCHTBJKcTLpDkXcvPZbiDAcrZsqeJshpkE3iV/v/oMDyN QHOw== 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=9jHnEFpHn7uzznoO3/dgHPquJFVDhGL7Sa3AB/IK/o8=; b=VlDgZ+dPG6sAOBGOYdhmbBUkXk1wOBadVVevPf3xirxQEvM0VV8CDpqcVjAadpgrhg pkgdh6G31FVS6CyptknpxjfaHvPEcnFLqwPQJbrlEs+gWDCRSNQmZMW4USi5MKQX+xWZ BRpBQv/uNS1VShctEPet5GgNNZfVN4ZEo+jIoTlvtREPaRAcpc7tczSHpN2Ki0RD/Woy OrX3ZhkXA3NNr0y8/1tbVPvy4vsWBB9FTAKc/4dBxEy5N/8QMPrIbNMDehQG57YtIFsc xk+sSm9zI0CcrQ6EQEHOTIcUfbqnH9hM7NUmnFCRb7QGMXEolo+j5jej3R6b6of/cvIc EiRw== X-Gm-Message-State: APjAAAUIFSQr3qssFRUClojdS6wbtbelhbKnulYQkWRDMXbG4FXKC1MY JXO42IabXiDE9BAT/OJakEG5ig== X-Google-Smtp-Source: APXvYqwy7zacb5a2dIAzBH+DNPJmE7Ud9HzGmZ8XgxvKZbiQHoYeDIvLxGo471H1Sy/xZiRyc+Eftg== X-Received: by 2002:a5d:4fc8:: with SMTP id h8mr26465755wrw.124.1561480495518; Tue, 25 Jun 2019 09:34:55 -0700 (PDT) Received: from debian-brgl.home ([2a01:cb1d:af:5b00:6d6c:8493:1ab5:dad7]) by smtp.gmail.com with ESMTPSA id g8sm2683795wme.20.2019.06.25.09.34.54 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 25 Jun 2019 09:34:54 -0700 (PDT) From: Bartosz Golaszewski To: Sekhar Nori , Kevin Hilman , Lee Jones , Daniel Thompson , Jingoo Han , Bartlomiej Zolnierkiewicz , David Lechner , Linus Walleij Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-fbdev@vger.kernel.org, Bartosz Golaszewski Subject: [PATCH 03/12] backlight: gpio: pull the non-pdata device probing code into probe() Date: Tue, 25 Jun 2019 18:34:25 +0200 Message-Id: <20190625163434.13620-4-brgl@bgdev.pl> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190625163434.13620-1-brgl@bgdev.pl> References: <20190625163434.13620-1-brgl@bgdev.pl> MIME-Version: 1.0 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 From: Bartosz Golaszewski There's no good reason to have the generic probing code in a separate routine. This function is short and is inlined by the compiler anyway. Move it into probe under the pdata-specific part. Signed-off-by: Bartosz Golaszewski Reviewed-by: Linus Walleij Reviewed-by: Bartlomiej Zolnierkiewicz Acked-by: Daniel Thompson --- drivers/video/backlight/gpio_backlight.c | 39 ++++++++---------------- 1 file changed, 13 insertions(+), 26 deletions(-) diff --git a/drivers/video/backlight/gpio_backlight.c b/drivers/video/backlight/gpio_backlight.c index 8adbc8d75097..89e10bccfd3c 100644 --- a/drivers/video/backlight/gpio_backlight.c +++ b/drivers/video/backlight/gpio_backlight.c @@ -54,30 +54,6 @@ static const struct backlight_ops gpio_backlight_ops = { .check_fb = gpio_backlight_check_fb, }; -static int gpio_backlight_probe_prop(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 = @@ -86,6 +62,7 @@ static int gpio_backlight_probe(struct platform_device *pdev) struct device *dev = &pdev->dev; struct backlight_device *bl; struct gpio_backlight *gbl; + enum gpiod_flags flags; int ret; gbl = devm_kzalloc(dev, sizeof(*gbl), GFP_KERNEL); @@ -116,9 +93,19 @@ static int gpio_backlight_probe(struct platform_device *pdev) if (!gbl->gpiod) return -EINVAL; } else { - ret = gpio_backlight_probe_prop(pdev, gbl); - if (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; + } } memset(&props, 0, sizeof(props)); From patchwork Tue Jun 25 16:34:26 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 11016011 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 134FA17D2 for ; Tue, 25 Jun 2019 16:35:39 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0477C283AF for ; Tue, 25 Jun 2019 16:35:39 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id EC2EA283B0; Tue, 25 Jun 2019 16:35:38 +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=-7.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI,TVD_SPACE_RATIO, UPPERCASE_50_75 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 8E625283C5 for ; Tue, 25 Jun 2019 16:35:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730203AbfFYQfi (ORCPT ); Tue, 25 Jun 2019 12:35:38 -0400 Received: from mail-wr1-f66.google.com ([209.85.221.66]:41775 "EHLO mail-wr1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729854AbfFYQe6 (ORCPT ); Tue, 25 Jun 2019 12:34:58 -0400 Received: by mail-wr1-f66.google.com with SMTP id c2so18613670wrm.8 for ; Tue, 25 Jun 2019 09:34:57 -0700 (PDT) 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=2g1huIVKZozNkv7icnrH8UYyhFSdx5OaAzsnOBD/wug=; b=XfV694/+ba+iJjm7XndfMMr4t/G9R6WZsl7ZClO8hbM2sE6598a/agfQtKVXIRT+/V AoWfR7WcIGSYP9NtRwQLMxrVuN8omLG3udtaeoq83oK2iDO6nbVLJEHwc4tAlzDRKnUW gS/on6mUn/wFH3kWwFQKEFahEkn+l8s83Ssn4MxCUCfZZpg6XEZM2S6oO7wDsjKHlSzK 6DdCjzey8fw1L2Sr3nfWJAfvgsIF/hpbPE/j6G7N0faVlvQgkRP+V8rn2kBlHP6VSfn7 CBY8w6r9dg4x854xvpQB8f/T0kExSZQfy1QZEFOwDaubHwfdoPP9zoCw6SwKAt13nfeI zNkg== 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=2g1huIVKZozNkv7icnrH8UYyhFSdx5OaAzsnOBD/wug=; b=R4gTQWq3xwBL2qzcrxVICcO5/liziqDplgI03ewkejKvTEuCHiAZLORPkT2vWcd9/x v+uiIW33sSvhrk1oMAozrIt38xe9Mv+tG5hnOAx+j6/s6Ia0mnarHCyPJP2B8vrD13kR rFCPUlX1Cnc73PBdZWZ+pNGv8nQXWdLTspKXIXmwVA0Y2nV3es/6JVvbfoHVM/qgxC2x y4VPVAbyOI6jOz7jOygiVrE5AWuS6oSlfnhFRfJRpXdEunRhk07WzojrT0u+WmU8P5kW oVXvHePz6Fc92pSOSpKnPDWrXCGUQ4THzVqi8YuHzHLlOc2Z7bjuBLSWHJMCCozyddbF MdkQ== X-Gm-Message-State: APjAAAWS6IfZbzYahCsMQdScMOBOxOMzQVrGDHqi1xeE/jr46/dPLB76 SpDTbtOy2cfKHuSEFMBfolzEhQ== X-Google-Smtp-Source: APXvYqwvUGzuhdRcRqrCnTEpE5XZ6xpDDtphMfdnxdkKNg7ns8U+hGGMdSWdjbAlt4fd7Q2s17qqjA== X-Received: by 2002:a5d:4e4d:: with SMTP id r13mr27001554wrt.295.1561480496798; Tue, 25 Jun 2019 09:34:56 -0700 (PDT) Received: from debian-brgl.home ([2a01:cb1d:af:5b00:6d6c:8493:1ab5:dad7]) by smtp.gmail.com with ESMTPSA id g8sm2683795wme.20.2019.06.25.09.34.55 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 25 Jun 2019 09:34:56 -0700 (PDT) From: Bartosz Golaszewski To: Sekhar Nori , Kevin Hilman , Lee Jones , Daniel Thompson , Jingoo Han , Bartlomiej Zolnierkiewicz , David Lechner , Linus Walleij Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-fbdev@vger.kernel.org, Bartosz Golaszewski Subject: [PATCH 04/12] ARM: davinci: refresh davinci_all_defconfig Date: Tue, 25 Jun 2019 18:34:26 +0200 Message-Id: <20190625163434.13620-5-brgl@bgdev.pl> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190625163434.13620-1-brgl@bgdev.pl> References: <20190625163434.13620-1-brgl@bgdev.pl> MIME-Version: 1.0 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 From: Bartosz Golaszewski Refresh davinci_all_defconfig with current master. Signed-off-by: Bartosz Golaszewski --- arch/arm/configs/davinci_all_defconfig | 27 ++++++++++---------------- 1 file changed, 10 insertions(+), 17 deletions(-) diff --git a/arch/arm/configs/davinci_all_defconfig b/arch/arm/configs/davinci_all_defconfig index 4a8cad4d3707..13d7846c613d 100644 --- a/arch/arm/configs/davinci_all_defconfig +++ b/arch/arm/configs/davinci_all_defconfig @@ -3,6 +3,7 @@ CONFIG_SYSVIPC=y CONFIG_POSIX_MQUEUE=y CONFIG_NO_HZ=y CONFIG_HIGH_RES_TIMERS=y +CONFIG_PREEMPT=y CONFIG_IKCONFIG=y CONFIG_IKCONFIG_PROC=y CONFIG_LOG_BUF_SHIFT=14 @@ -10,13 +11,6 @@ CONFIG_CGROUPS=y CONFIG_CHECKPOINT_RESTORE=y CONFIG_BLK_DEV_INITRD=y CONFIG_EXPERT=y -CONFIG_MODULES=y -CONFIG_MODULE_UNLOAD=y -CONFIG_MODULE_FORCE_UNLOAD=y -CONFIG_MODVERSIONS=y -CONFIG_PARTITION_ADVANCED=y -# CONFIG_IOSCHED_DEADLINE is not set -# CONFIG_IOSCHED_CFQ is not set CONFIG_ARCH_DAVINCI=y CONFIG_ARCH_DAVINCI_DM644x=y CONFIG_ARCH_DAVINCI_DM355=y @@ -31,9 +25,7 @@ CONFIG_MACH_MITYOMAPL138=y CONFIG_MACH_OMAPL138_HAWKBOARD=y CONFIG_DAVINCI_MUX_DEBUG=y CONFIG_DAVINCI_MUX_WARNINGS=y -CONFIG_PREEMPT=y CONFIG_AEABI=y -CONFIG_CMA=y CONFIG_SECCOMP=y CONFIG_ZBOOT_ROM_TEXT=0x0 CONFIG_ZBOOT_ROM_BSS=0x0 @@ -46,6 +38,12 @@ CONFIG_CPU_FREQ_GOV_PERFORMANCE=m CONFIG_CPU_FREQ_GOV_POWERSAVE=m CONFIG_CPU_FREQ_GOV_ONDEMAND=m CONFIG_CPU_IDLE=y +CONFIG_MODULES=y +CONFIG_MODULE_UNLOAD=y +CONFIG_MODULE_FORCE_UNLOAD=y +CONFIG_MODVERSIONS=y +CONFIG_PARTITION_ADVANCED=y +CONFIG_CMA=y CONFIG_NET=y CONFIG_PACKET=y CONFIG_UNIX=y @@ -63,7 +61,6 @@ CONFIG_BT_HCIUART_LL=y CONFIG_DEVTMPFS=y CONFIG_DEVTMPFS_MOUNT=y CONFIG_FW_LOADER=m -CONFIG_DMA_CMA=y CONFIG_DA8XX_MSTPRI=y CONFIG_MTD=m CONFIG_MTD_TESTS=m @@ -167,8 +164,6 @@ CONFIG_SOUND=m CONFIG_SND=m CONFIG_SND_USB_AUDIO=m CONFIG_SND_SOC=m -CONFIG_SND_SOC_TLV320AIC3X=m -CONFIG_SND_SOC_DAVINCI_MCASP=m CONFIG_SND_SOC_DAVINCI_EVM=m CONFIG_SND_SIMPLE_CARD=m CONFIG_HID=m @@ -213,14 +208,12 @@ CONFIG_MMC_DAVINCI=y CONFIG_NEW_LEDS=y CONFIG_LEDS_CLASS=m CONFIG_LEDS_GPIO=m -CONFIG_LEDS_TRIGGERS=y CONFIG_LEDS_TRIGGER_TIMER=m CONFIG_LEDS_TRIGGER_HEARTBEAT=m CONFIG_LEDS_TRIGGER_DEFAULT_ON=m CONFIG_RTC_CLASS=y CONFIG_RTC_DRV_OMAP=m CONFIG_DMADEVICES=y -CONFIG_TI_EDMA=y CONFIG_COMMON_CLK_PWM=m CONFIG_REMOTEPROC=m CONFIG_DA8XX_REMOTEPROC=m @@ -258,10 +251,10 @@ CONFIG_NLS_CODEPAGE_437=y CONFIG_NLS_ASCII=m CONFIG_NLS_ISO8859_1=y CONFIG_NLS_UTF8=m +# CONFIG_CRYPTO_HW is not set +CONFIG_CRC_T10DIF=m +CONFIG_DMA_CMA=y CONFIG_DEBUG_FS=y CONFIG_DEBUG_RT_MUTEXES=y CONFIG_DEBUG_MUTEXES=y -# CONFIG_ARM_UNWIND is not set CONFIG_DEBUG_USER=y -# CONFIG_CRYPTO_HW is not set -CONFIG_CRC_T10DIF=m From patchwork Tue Jun 25 16:34:27 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 11016009 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 0FBAA76 for ; Tue, 25 Jun 2019 16:35:33 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 017E9283AF for ; Tue, 25 Jun 2019 16:35:33 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E6688283BB; Tue, 25 Jun 2019 16:35:32 +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=-7.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,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 9D9B6283AF for ; Tue, 25 Jun 2019 16:35:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730232AbfFYQfA (ORCPT ); Tue, 25 Jun 2019 12:35:00 -0400 Received: from mail-wr1-f65.google.com ([209.85.221.65]:44009 "EHLO mail-wr1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730123AbfFYQfA (ORCPT ); Tue, 25 Jun 2019 12:35:00 -0400 Received: by mail-wr1-f65.google.com with SMTP id p13so18610210wru.10 for ; Tue, 25 Jun 2019 09:34:58 -0700 (PDT) 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=sFDObtAhBFoq+e3uGBncXCZh94u1gqoIy533R027F8g=; b=G4Pw99p7XQ8OGBF3dnF0u8nsP2gzt973olZmzxwCvcharaKDy85867vLHAfEEMeOY6 WbvGNVaQTvX6o6k0m03Dbg3bqJePqRGuhQt3WSt/PGG8Cb/oCVEqY2X6FLotNA0IXfJm ARyniYvJZe/t7VQyJcxGxpDqPU66WCtZIWCej1JRYrPbhTKgeT2by3xxii6Mp4ieweY4 kcGKmEFn2Ow9kyf3HS2AOfy4WfOxqLajkqnTEHqnZVLC2+gcImOh2N06MabRO5E7+Uh0 Rz8cDgo9FQcCj48JgPkYsVbGknrWRKT8C9/qsCP3bGmyaklMqjuX8zcNjbTiVOhmz5fy wOUA== 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=sFDObtAhBFoq+e3uGBncXCZh94u1gqoIy533R027F8g=; b=JvlYl03VjfAxW2zYjfJAFdMakrlotzbWYMv6K5QQ2SHhiy2QYgvUETIXujTEfvvJ2N x/mkI239++4L2Gmmo8rio1UzuvPd+2vWJjLS1mo9Ycwrva1MijC/w/207WF1x/uS6wMn D17sG3CEt4RPyhuKQPX1n18l0MkvsQ1k41sAEBPYz0euSurWztzpXqWNoO+DK4QCs0Vo tToCkkRjWLeBD3I+7PzR2CxF7G3jvMsukhNQ4BCVUujM03KLxvUi6LH1JfmenS36l/Zf zY17jn3JKavzIy7CUVQnCcKy2au8IQRIQWTNVTrXUdbaGW016LqrU+qnzycdmKg7nKa0 IEKQ== X-Gm-Message-State: APjAAAWzAcFbJK6sliwFix+CICAHuXteZBbdO/7EsEoYfj3eweU/6Cm7 oBTGPC0G3ELDe2269vUwabsCfg== X-Google-Smtp-Source: APXvYqw0FlaqXL9keBHWR7KbT8zOx0gQKa57yMr4s6cP5zk/w1cWEybKYPn7W1s8wCZ4fu5o6W6zoA== X-Received: by 2002:adf:fc91:: with SMTP id g17mr25182759wrr.194.1561480498103; Tue, 25 Jun 2019 09:34:58 -0700 (PDT) Received: from debian-brgl.home ([2a01:cb1d:af:5b00:6d6c:8493:1ab5:dad7]) by smtp.gmail.com with ESMTPSA id g8sm2683795wme.20.2019.06.25.09.34.56 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 25 Jun 2019 09:34:57 -0700 (PDT) From: Bartosz Golaszewski To: Sekhar Nori , Kevin Hilman , Lee Jones , Daniel Thompson , Jingoo Han , Bartlomiej Zolnierkiewicz , David Lechner , Linus Walleij Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-fbdev@vger.kernel.org, Bartosz Golaszewski Subject: [PATCH 05/12] ARM: davinci_all_defconfig: enable GPIO backlight Date: Tue, 25 Jun 2019 18:34:27 +0200 Message-Id: <20190625163434.13620-6-brgl@bgdev.pl> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190625163434.13620-1-brgl@bgdev.pl> References: <20190625163434.13620-1-brgl@bgdev.pl> MIME-Version: 1.0 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 From: Bartosz Golaszewski Enable the GPIO backlight module in davinci_all_defconfig. Signed-off-by: Bartosz Golaszewski --- arch/arm/configs/davinci_all_defconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/arm/configs/davinci_all_defconfig b/arch/arm/configs/davinci_all_defconfig index 13d7846c613d..06855b2bce7e 100644 --- a/arch/arm/configs/davinci_all_defconfig +++ b/arch/arm/configs/davinci_all_defconfig @@ -158,6 +158,7 @@ CONFIG_FB=y CONFIG_FIRMWARE_EDID=y CONFIG_FB_DA8XX=y CONFIG_BACKLIGHT_PWM=m +CONFIG_BACKLIGHT_GPIO=m CONFIG_FRAMEBUFFER_CONSOLE=y CONFIG_LOGO=y CONFIG_SOUND=m From patchwork Tue Jun 25 16:34:28 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 11016007 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 7E06276 for ; Tue, 25 Jun 2019 16:35:31 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6E6CA283AF for ; Tue, 25 Jun 2019 16:35:31 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 60DA3283BB; Tue, 25 Jun 2019 16:35:31 +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=-7.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,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 0154E283AF for ; Tue, 25 Jun 2019 16:35:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730360AbfFYQfC (ORCPT ); Tue, 25 Jun 2019 12:35:02 -0400 Received: from mail-wr1-f66.google.com ([209.85.221.66]:40898 "EHLO mail-wr1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730206AbfFYQfB (ORCPT ); Tue, 25 Jun 2019 12:35:01 -0400 Received: by mail-wr1-f66.google.com with SMTP id p11so18613441wre.7 for ; Tue, 25 Jun 2019 09:34:59 -0700 (PDT) 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=n5d3BfSnmnwO/hS4dFGhcrIk5LVowo1/qQQdF1Vy3jk=; b=mi3aYH337XfZeD6KCGPODvIEDc6lpAsrLiBKenynyTgeBAflzEuAFOSSRaIv7QCcw0 cU5hYTlgn0flazzm/uE9V2gsr0kjBHT5y/98Qo74IaK5b50eEFHQWnCUmKzphCf694cO LDW7BmNVzoFJZ5NIlzjd+HVONir3l9AyrAj5png44VBdtFHeh3uryIXOkGa1wJPvA5LN WvCLOTnyGe8CkM/Fz5OUnv1HjtcHnzID+6CRcBFR3JznXuOHp5DQfeF10qw9RKY3r25S CYTFos7dPmJNHROYanCTBvFs7gU6PLh/xVeNfeRVmRWdHzC44plIWFbBhF8yvimaw5KZ jexw== 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=n5d3BfSnmnwO/hS4dFGhcrIk5LVowo1/qQQdF1Vy3jk=; b=dCN8DV9XGfc8yYyZWz5q6xZbec1qmjjO5K5OD+HsCplFGtshheLF8S94O+MNtmlauk kzDMjK36J0d+YtY90tth4kfUzcQwCYiifExqODPy1ffySqUnRY+Ug95MFpuIlPi92zQq oH3iuBkI2DSS7YjsUxp9Z2nNwTLkOklq0Cv1+e4VpemIza2yZLV3GTvQoy1Gp7MLmKI9 e7QYjvWr+gk08m2U/haje/PtHzZ8J4zGsIDSGBFSCjR4G0Zacdx6MfSJCmZwr81sMXUm NBXIdRSXsvfxc6S9c4aJBZ90jStefp9E0U6G/mHgHZh6hcli0v9i7RDBeYeM/hxU26wk /Zqw== X-Gm-Message-State: APjAAAW0peNxCkcsFjf3V+nD/5CJyiZJ3DWz6fpFJ7+29vLiyxIRG7IV oPZ2Od9Csv9t0ZaJdJKKQfn37w== X-Google-Smtp-Source: APXvYqxYtpw4EEVsdGnQVBBLUuXARVZGsIrOsocPZwN44dsA/Y8ZCTQWBqOBfRU7qmBFqnACXLnZHw== X-Received: by 2002:a5d:5189:: with SMTP id k9mr71415wrv.45.1561480499309; Tue, 25 Jun 2019 09:34:59 -0700 (PDT) Received: from debian-brgl.home ([2a01:cb1d:af:5b00:6d6c:8493:1ab5:dad7]) by smtp.gmail.com with ESMTPSA id g8sm2683795wme.20.2019.06.25.09.34.58 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 25 Jun 2019 09:34:58 -0700 (PDT) From: Bartosz Golaszewski To: Sekhar Nori , Kevin Hilman , Lee Jones , Daniel Thompson , Jingoo Han , Bartlomiej Zolnierkiewicz , David Lechner , Linus Walleij Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-fbdev@vger.kernel.org, Bartosz Golaszewski Subject: [PATCH 06/12] ARM: davinci: da850-evm: model the backlight GPIO as an actual device Date: Tue, 25 Jun 2019 18:34:28 +0200 Message-Id: <20190625163434.13620-7-brgl@bgdev.pl> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190625163434.13620-1-brgl@bgdev.pl> References: <20190625163434.13620-1-brgl@bgdev.pl> MIME-Version: 1.0 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 From: Bartosz Golaszewski Instead of enabling the panel backlight in a callback defined in board file using deprecated legacy GPIO API calls, model the line as a GPIO backlight device. Signed-off-by: Bartosz Golaszewski Reviewed-by: Linus Walleij --- arch/arm/mach-davinci/board-da850-evm.c | 40 +++++++++++++++++-------- 1 file changed, 28 insertions(+), 12 deletions(-) diff --git a/arch/arm/mach-davinci/board-da850-evm.c b/arch/arm/mach-davinci/board-da850-evm.c index 31ae3be5741d..ffda623bb543 100644 --- a/arch/arm/mach-davinci/board-da850-evm.c +++ b/arch/arm/mach-davinci/board-da850-evm.c @@ -36,6 +36,7 @@ #include #include #include +#include #include #include #include @@ -803,34 +804,49 @@ static const short da850_evm_mmcsd0_pins[] __initconst = { static void da850_panel_power_ctrl(int val) { - /* lcd backlight */ - gpio_set_value(DA850_LCD_BL_PIN, val); - /* lcd power */ gpio_set_value(DA850_LCD_PWR_PIN, val); } +static struct property_entry da850_lcd_backlight_props[] = { + PROPERTY_ENTRY_BOOL("default-on"), + { } +}; + +static struct gpiod_lookup_table da850_lcd_backlight_gpio_table = { + .dev_id = "gpio-backlight", + .table = { + GPIO_LOOKUP("davinci_gpio", DA850_LCD_BL_PIN, NULL, 0), + { } + }, +}; + +static const struct platform_device_info da850_lcd_backlight_info = { + .name = "gpio-backlight", + .id = PLATFORM_DEVID_NONE, + .properties = da850_lcd_backlight_props, +}; + static int da850_lcd_hw_init(void) { + struct platform_device *backlight; int status; - status = gpio_request(DA850_LCD_BL_PIN, "lcd bl"); - if (status < 0) - return status; + gpiod_add_lookup_table(&da850_lcd_backlight_gpio_table); + backlight = platform_device_register_full(&da850_lcd_backlight_info); + if (IS_ERR(backlight)) + return PTR_ERR(backlight); status = gpio_request(DA850_LCD_PWR_PIN, "lcd pwr"); - if (status < 0) { - gpio_free(DA850_LCD_BL_PIN); + if (status < 0) return status; - } - gpio_direction_output(DA850_LCD_BL_PIN, 0); gpio_direction_output(DA850_LCD_PWR_PIN, 0); - /* Switch off panel power and backlight */ + /* Switch off panel power */ da850_panel_power_ctrl(0); - /* Switch on panel power and backlight */ + /* Switch on panel power */ da850_panel_power_ctrl(1); return 0; From patchwork Tue Jun 25 16:34:29 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 11015995 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 09AF317D2 for ; Tue, 25 Jun 2019 16:35:06 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EF4EA2838F for ; Tue, 25 Jun 2019 16:35:05 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E234F283A5; Tue, 25 Jun 2019 16:35:05 +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=-7.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,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 70F3428396 for ; Tue, 25 Jun 2019 16:35:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731160AbfFYQfD (ORCPT ); Tue, 25 Jun 2019 12:35:03 -0400 Received: from mail-wm1-f65.google.com ([209.85.128.65]:53218 "EHLO mail-wm1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730316AbfFYQfC (ORCPT ); Tue, 25 Jun 2019 12:35:02 -0400 Received: by mail-wm1-f65.google.com with SMTP id s3so3512631wms.2 for ; Tue, 25 Jun 2019 09:35:01 -0700 (PDT) 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=vrI0W6bS0McQj19QWXhKoVrTSOU0J8VgPihi8/PszeI=; b=PYAuZLZQuMDcDy7kn4Dp7xi/9RxRvvmyhWfmfEj68PC+BfshQ01WkAwGIFz2Da1Nu+ fxfiOLaJUQq7w6ykZylcXfZUuPHsZ3QWQG9yMCbvo7QyQqz2UMUWT4l9Bitl3VVC6K2F L0TjcltZHBHKtRxFLyb/o3NDTieiROr8YZNhTb0X1rLsVpHx1JJ74w87BtRXHFzpCYQf Wjg+jLmX1G+RFC9yctx6GObshpk1AW2BRvH9tlZHm8ACITW1NnC8h0JpNJIgY6I59Tlx W1FrPl0FZrpBpkkF00+aiDfjd23rUrllhCN8yi7UD5PpvhOsm1qUbM3ztTMuRAB3EHQP 29Ig== 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=vrI0W6bS0McQj19QWXhKoVrTSOU0J8VgPihi8/PszeI=; b=lYtzlMQEf1hCcSPZZwRZqmt5z5mg/0eqEGSLqBAi6dmQC3fUF2+pjfUsJlHbjlmHXz /zyugv/GqObP1UaZWLILzYGPBT7UqUfPrqYTCPRaYicLrQt4MuPlhctzHIgGZVTKDAa5 hHSdJ+TLFDx+cuK7IsEnM0+WoAs8htKfYIzQnhEW76Tg725LIrit1ty0GWo8kHUXbSMo ndQMkeqopSEQurzo0p4XylNFic4Z9UFnu47GJViLnULFqy1AojT5zbhiabzD3+cyG8Ta O7RtccFoh2uNjHKGNCm7+tJjs4601/x8IHrQAtz5Z42n9VvfxQmh3OdfCPXCGT/a+Mdy GUng== X-Gm-Message-State: APjAAAVO0vuzzP7J+QgQt+xBz/vIszWlVt3SWA3+8LpHSKOwDm5F0QCs UVHB/VGH+qzG7HsucULME5AVAw== X-Google-Smtp-Source: APXvYqz3kMtpzixVnxZc9H1Kfh+kHcls8129A5lmZg5kt5LowzOPkBnkiHOHjACo8VCQc8yPPH0pyA== X-Received: by 2002:a1c:6555:: with SMTP id z82mr21077680wmb.129.1561480500524; Tue, 25 Jun 2019 09:35:00 -0700 (PDT) Received: from debian-brgl.home ([2a01:cb1d:af:5b00:6d6c:8493:1ab5:dad7]) by smtp.gmail.com with ESMTPSA id g8sm2683795wme.20.2019.06.25.09.34.59 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 25 Jun 2019 09:35:00 -0700 (PDT) From: Bartosz Golaszewski To: Sekhar Nori , Kevin Hilman , Lee Jones , Daniel Thompson , Jingoo Han , Bartlomiej Zolnierkiewicz , David Lechner , Linus Walleij Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-fbdev@vger.kernel.org, Bartosz Golaszewski Subject: [PATCH 07/12] fbdev: da8xx: add support for a regulator Date: Tue, 25 Jun 2019 18:34:29 +0200 Message-Id: <20190625163434.13620-8-brgl@bgdev.pl> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190625163434.13620-1-brgl@bgdev.pl> References: <20190625163434.13620-1-brgl@bgdev.pl> MIME-Version: 1.0 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 From: Bartosz Golaszewski We want to remove the hacky platform data callback for power control. Add a regulator to the driver data and enable/disable it next to the current panel_power_ctrl() calls. We will use it in subsequent patch on da850-evm. Signed-off-by: Bartosz Golaszewski Acked-by: Bartlomiej Zolnierkiewicz --- drivers/video/fbdev/da8xx-fb.c | 54 ++++++++++++++++++++++++++++++---- 1 file changed, 49 insertions(+), 5 deletions(-) diff --git a/drivers/video/fbdev/da8xx-fb.c b/drivers/video/fbdev/da8xx-fb.c index 9ea817ac1d81..4fa99ff79f3b 100644 --- a/drivers/video/fbdev/da8xx-fb.c +++ b/drivers/video/fbdev/da8xx-fb.c @@ -19,6 +19,7 @@ #include #include #include +#include #include #include #include @@ -165,6 +166,7 @@ struct da8xx_fb_par { #endif unsigned int lcdc_clk_rate; void (*panel_power_ctrl)(int); + struct regulator *lcd_supply; u32 pseudo_palette[16]; struct fb_videomode mode; struct lcd_ctrl_config cfg; @@ -1066,6 +1068,7 @@ static void lcd_da8xx_cpufreq_deregister(struct da8xx_fb_par *par) static int fb_remove(struct platform_device *dev) { struct fb_info *info = dev_get_drvdata(&dev->dev); + int ret; if (info) { struct da8xx_fb_par *par = info->par; @@ -1073,8 +1076,13 @@ static int fb_remove(struct platform_device *dev) #ifdef CONFIG_CPU_FREQ lcd_da8xx_cpufreq_deregister(par); #endif - if (par->panel_power_ctrl) + if (par->panel_power_ctrl) { par->panel_power_ctrl(0); + } else if (par->lcd_supply) { + ret = regulator_disable(par->lcd_supply); + if (ret) + return ret; + } lcd_disable_raster(DA8XX_FRAME_WAIT); lcdc_write(0, LCD_RASTER_CTRL_REG); @@ -1179,15 +1187,25 @@ static int cfb_blank(int blank, struct fb_info *info) case FB_BLANK_UNBLANK: lcd_enable_raster(); - if (par->panel_power_ctrl) + if (par->panel_power_ctrl) { par->panel_power_ctrl(1); + } else if (par->lcd_supply) { + ret = regulator_enable(par->lcd_supply); + if (ret) + return ret; + } break; case FB_BLANK_NORMAL: case FB_BLANK_VSYNC_SUSPEND: case FB_BLANK_HSYNC_SUSPEND: case FB_BLANK_POWERDOWN: - if (par->panel_power_ctrl) + if (par->panel_power_ctrl) { par->panel_power_ctrl(0); + } else if (par->lcd_supply) { + ret = regulator_disable(par->lcd_supply); + if (ret) + return ret; + } lcd_disable_raster(DA8XX_FRAME_WAIT); break; @@ -1401,6 +1419,20 @@ static int fb_probe(struct platform_device *device) par->panel_power_ctrl(1); } + par->lcd_supply = devm_regulator_get_optional(&device->dev, "lcd"); + if (IS_ERR(par->lcd_supply)) { + if (PTR_ERR(par->lcd_supply) == -EPROBE_DEFER) { + ret = -EPROBE_DEFER; + goto err_pm_runtime_disable; + } + + par->lcd_supply = NULL; + } else { + ret = regulator_enable(par->lcd_supply); + if (ret) + goto err_pm_runtime_disable; + } + fb_videomode_to_var(&da8xx_fb_var, lcdc_info); par->cfg = *lcd_cfg; @@ -1604,10 +1636,16 @@ static int fb_suspend(struct device *dev) { struct fb_info *info = dev_get_drvdata(dev); struct da8xx_fb_par *par = info->par; + int ret; console_lock(); - if (par->panel_power_ctrl) + if (par->panel_power_ctrl) { par->panel_power_ctrl(0); + } else if (par->lcd_supply) { + ret = regulator_disable(par->lcd_supply); + if (ret) + return ret; + } fb_set_suspend(info, 1); lcd_disable_raster(DA8XX_FRAME_WAIT); @@ -1621,6 +1659,7 @@ static int fb_resume(struct device *dev) { struct fb_info *info = dev_get_drvdata(dev); struct da8xx_fb_par *par = info->par; + int ret; console_lock(); pm_runtime_get_sync(dev); @@ -1628,8 +1667,13 @@ static int fb_resume(struct device *dev) if (par->blank == FB_BLANK_UNBLANK) { lcd_enable_raster(); - if (par->panel_power_ctrl) + if (par->panel_power_ctrl) { par->panel_power_ctrl(1); + } else if (par->lcd_supply) { + ret = regulator_enable(par->lcd_supply); + if (ret) + return ret; + } } fb_set_suspend(info, 0); From patchwork Tue Jun 25 16:34:30 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 11015993 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 DD3C914B6 for ; Tue, 25 Jun 2019 16:35:05 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CAE382838F for ; Tue, 25 Jun 2019 16:35:05 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B9380283A5; Tue, 25 Jun 2019 16:35:05 +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=-7.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,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 479B22838F for ; Tue, 25 Jun 2019 16:35:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730134AbfFYQfE (ORCPT ); Tue, 25 Jun 2019 12:35:04 -0400 Received: from mail-wm1-f65.google.com ([209.85.128.65]:40123 "EHLO mail-wm1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730545AbfFYQfE (ORCPT ); Tue, 25 Jun 2019 12:35:04 -0400 Received: by mail-wm1-f65.google.com with SMTP id v19so3618320wmj.5 for ; Tue, 25 Jun 2019 09:35:02 -0700 (PDT) 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=pPfiVDgc5mzijoolmBgAn7nj9hFIGXkNoey2vIeezPw=; b=PH6PJoOty745v5HCYWGPCWBeeSNGmb9UwwqkfUOiMl1dAeUCOfW64MYeP65AJk34q9 QVGkrvI13TaiQUcKO3PAzYhR+SlYTOCGOCEmHOZl8pzZnDrgU3OgL2F4sF4t8Wuu45bI O0s/CEA9VySw6B9MT6SnlA85lLwIQMHTWKRdJ5dPWzlthv0Mp9kYKxLDYTI2NT9eAsHs 9Bzih0UeynmsFxiAwYLqO5DU6VEut6rYd9k7eNOqFJNdg09L0b6P5zp0kJwKKrUMpgTh 0ABqdJwysPXZFSMGHbolipLeMxh0463L8lROsmZybF2G0ckfGkRbbW/NOxebpA6Ut4Ft dJyg== 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=pPfiVDgc5mzijoolmBgAn7nj9hFIGXkNoey2vIeezPw=; b=EfNjDO+zc0QxuRQEOwJmbPVbhJYYyif1hHXL/zywNKstRporCCVMrVU54X5NaJMJtM a94XA1goN/xWAdf1/6BpQSNbZcQzVEOdLATvYKi+6NzmJRwUlrAwkRkPljoNCvtpUcuO yUC66eeY+yQKMzSbxz+UwEHI4TnOGTGQ13MjDaQin3l6unpQJLCXdcsGFO3rVy9md+Pb jl4PSm0uuLe21aGtpUqUCFqwbs2DjSh0ngOTqfIdSZzzH+cwdhZf6Lx7dpqGmBgrkYtD UX89a4wfm4TZd2oyxM7+MSL49vPPo55YhwQ2kzmGQNNqJ7lV6RCz88W568TrzzjqUtQ0 gGCA== X-Gm-Message-State: APjAAAVwqwVV9fonwC2+TAlWLHYU3NFtahiF+j4RLgi5++C8nlJO8jIL VQhpZ4dr4dTrU7/ORoqovSJJGg== X-Google-Smtp-Source: APXvYqxt8oVzolPe1n9o8Uiv/T6+/noYyCssxvgjcGdkHFXUOpA/NNpR2yPO4gsel41nlJ0REFrQ8Q== X-Received: by 2002:a1c:a842:: with SMTP id r63mr20223185wme.117.1561480501837; Tue, 25 Jun 2019 09:35:01 -0700 (PDT) Received: from debian-brgl.home ([2a01:cb1d:af:5b00:6d6c:8493:1ab5:dad7]) by smtp.gmail.com with ESMTPSA id g8sm2683795wme.20.2019.06.25.09.35.00 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 25 Jun 2019 09:35:01 -0700 (PDT) From: Bartosz Golaszewski To: Sekhar Nori , Kevin Hilman , Lee Jones , Daniel Thompson , Jingoo Han , Bartlomiej Zolnierkiewicz , David Lechner , Linus Walleij Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-fbdev@vger.kernel.org, Bartosz Golaszewski Subject: [PATCH 08/12] ARM: davinci: da850-evm: switch to using a fixed regulator for lcdc Date: Tue, 25 Jun 2019 18:34:30 +0200 Message-Id: <20190625163434.13620-9-brgl@bgdev.pl> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190625163434.13620-1-brgl@bgdev.pl> References: <20190625163434.13620-1-brgl@bgdev.pl> MIME-Version: 1.0 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 From: Bartosz Golaszewski Now that the da8xx fbdev driver supports power control with an actual regulator, switch to using a fixed power supply for da850-evm. Signed-off-by: Bartosz Golaszewski Reviewed-by: Linus Walleij --- arch/arm/mach-davinci/board-da850-evm.c | 62 ++++++++++++++++++------- 1 file changed, 44 insertions(+), 18 deletions(-) diff --git a/arch/arm/mach-davinci/board-da850-evm.c b/arch/arm/mach-davinci/board-da850-evm.c index ffda623bb543..d26950f605f4 100644 --- a/arch/arm/mach-davinci/board-da850-evm.c +++ b/arch/arm/mach-davinci/board-da850-evm.c @@ -802,12 +802,6 @@ static const short da850_evm_mmcsd0_pins[] __initconst = { -1 }; -static void da850_panel_power_ctrl(int val) -{ - /* lcd power */ - gpio_set_value(DA850_LCD_PWR_PIN, val); -} - static struct property_entry da850_lcd_backlight_props[] = { PROPERTY_ENTRY_BOOL("default-on"), { } @@ -827,28 +821,61 @@ static const struct platform_device_info da850_lcd_backlight_info = { .properties = da850_lcd_backlight_props, }; +static struct regulator_consumer_supply da850_lcd_supplies[] = { + REGULATOR_SUPPLY("lcd", NULL), +}; + +static struct regulator_init_data da850_lcd_supply_data = { + .consumer_supplies = da850_lcd_supplies, + .num_consumer_supplies = ARRAY_SIZE(da850_lcd_supplies), + .constraints = { + .valid_ops_mask = REGULATOR_CHANGE_STATUS, + }, +}; + +static struct fixed_voltage_config da850_lcd_supply = { + .supply_name = "lcd", + .microvolts = 33000000, + .init_data = &da850_lcd_supply_data, +}; + +static struct platform_device da850_lcd_supply_device = { + .name = "reg-fixed-voltage", + .id = 1, /* Dummy fixed regulator is 0 */ + .dev = { + .platform_data = &da850_lcd_supply, + }, +}; + +static struct gpiod_lookup_table da850_lcd_supply_gpio_table = { + .dev_id = "reg-fixed-voltage.1", + .table = { + GPIO_LOOKUP("davinci_gpio", DA850_LCD_PWR_PIN, NULL, 0), + { } + }, +}; + +static struct gpiod_lookup_table *da850_lcd_gpio_lookups[] = { + &da850_lcd_backlight_gpio_table, + &da850_lcd_supply_gpio_table, +}; + static int da850_lcd_hw_init(void) { struct platform_device *backlight; int status; - gpiod_add_lookup_table(&da850_lcd_backlight_gpio_table); + gpiod_add_lookup_tables(da850_lcd_gpio_lookups, + ARRAY_SIZE(da850_lcd_gpio_lookups)); + backlight = platform_device_register_full(&da850_lcd_backlight_info); if (IS_ERR(backlight)) return PTR_ERR(backlight); - status = gpio_request(DA850_LCD_PWR_PIN, "lcd pwr"); - if (status < 0) + status = platform_device_register(&da850_lcd_supply_device); + if (status) return status; - gpio_direction_output(DA850_LCD_PWR_PIN, 0); - - /* Switch off panel power */ - da850_panel_power_ctrl(0); - - /* Switch on panel power */ - da850_panel_power_ctrl(1); - return 0; } @@ -1458,7 +1485,6 @@ static __init void da850_evm_init(void) if (ret) pr_warn("%s: LCD initialization failed: %d\n", __func__, ret); - sharp_lk043t1dg01_pdata.panel_power_ctrl = da850_panel_power_ctrl, ret = da8xx_register_lcdc(&sharp_lk043t1dg01_pdata); if (ret) pr_warn("%s: LCDC registration failed: %d\n", __func__, ret); From patchwork Tue Jun 25 16:34:31 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 11016003 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 0375F17D2 for ; Tue, 25 Jun 2019 16:35:30 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E8F0E283BB for ; Tue, 25 Jun 2019 16:35:29 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DCCEA283AF; Tue, 25 Jun 2019 16:35:29 +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.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI,TVD_SUBJ_WIPE_DEBT 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 6B15C283AF for ; Tue, 25 Jun 2019 16:35:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730235AbfFYQfV (ORCPT ); Tue, 25 Jun 2019 12:35:21 -0400 Received: from mail-wm1-f65.google.com ([209.85.128.65]:55057 "EHLO mail-wm1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731363AbfFYQfE (ORCPT ); Tue, 25 Jun 2019 12:35:04 -0400 Received: by mail-wm1-f65.google.com with SMTP id g135so3506373wme.4 for ; Tue, 25 Jun 2019 09:35:03 -0700 (PDT) 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=q8CTKhWBWFU1fqIPJGLSNQd9vJ1aS8JWPNlYGCmcN8g=; b=jrA5ZxxSlBscH60wVMRBFqwb9J9maa3kZ+JU/Fp6J34myN9KJoXuFwMIV3ZMmz7DNl JG1+U+oqjwTTtkfTBwVSTD9L0stYYQBCQZkkcL3caSVFgC7U6RXMgCV/zfQrx45vdTPR ayJ9TIWzXGPqIe9iL9vtxCexuyN/YsuaVdU4T1Q4mDvSPLx+u2zB3+l0GtmMMSE7vAuY HbLhX9dVYD7+9Iarnn6PZ2NDdK94xvM49thFHPfOOqjj+zAUG4SbHrwUzjnbuK/64XdC 3fSgoI3x6TSweLX2gY1e5b8i24ts0cvG/7te0F0uN7yuIYRTLlPHbaTRofncPw/XoXFE Gz/w== 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=q8CTKhWBWFU1fqIPJGLSNQd9vJ1aS8JWPNlYGCmcN8g=; b=V8B6lVKb941os1Kkz/otb3BgDG/CSAMWXHZxP34R55pDHyp5LvWd3Kv3+3EjZ1M3D/ qm5D1TbHsaRuPc/wl3KhniD2LbbXlKBhGIZsZ7VnOxCBddOZ9Hb/OHouD0V9zAGiJ/nP VO5X1qxnARfxagubZ1mO5RSIorntJxcbnaNx7qbQOwZrWSkMSGHEvQXU1QNYGtsBiEPS t1BJ9542o01zot3NUbM+nKKxAjE3sGaQWtnbha3Wb6RSE1OV4ovXCCUWZ/tXONVS1bTy VwzlJWSxD18LGVWsrYm+uWnT8kKmXbM9+8wRhkw5hxV/iSMGBuwDrQc78FquOgnChkTy jxPQ== X-Gm-Message-State: APjAAAXci9qUFmWvQnyAhjqWAqxN4wAaqF9I1V2nw1eEdyFcXPS/pxBs VVfAOEy5fWHpIMgdK7tKnUinFw== X-Google-Smtp-Source: APXvYqy9vA8JJyTM1z74NApjY88ZDcDlQT7HuRw6dubZNjHezxo9Xp8wOa5eR0G69DpWTbPZXt+I1w== X-Received: by 2002:a1c:40c6:: with SMTP id n189mr19922351wma.118.1561480502950; Tue, 25 Jun 2019 09:35:02 -0700 (PDT) Received: from debian-brgl.home ([2a01:cb1d:af:5b00:6d6c:8493:1ab5:dad7]) by smtp.gmail.com with ESMTPSA id g8sm2683795wme.20.2019.06.25.09.35.01 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 25 Jun 2019 09:35:02 -0700 (PDT) From: Bartosz Golaszewski To: Sekhar Nori , Kevin Hilman , Lee Jones , Daniel Thompson , Jingoo Han , Bartlomiej Zolnierkiewicz , David Lechner , Linus Walleij Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-fbdev@vger.kernel.org, Bartosz Golaszewski Subject: [PATCH 09/12] fbdev: da8xx: remove panel_power_ctrl() callback from platform data Date: Tue, 25 Jun 2019 18:34:31 +0200 Message-Id: <20190625163434.13620-10-brgl@bgdev.pl> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190625163434.13620-1-brgl@bgdev.pl> References: <20190625163434.13620-1-brgl@bgdev.pl> MIME-Version: 1.0 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 From: Bartosz Golaszewski There are no more users of panel_power_ctrl(). Remove it from the driver. Signed-off-by: Bartosz Golaszewski Acked-by: Bartlomiej Zolnierkiewicz --- drivers/video/fbdev/da8xx-fb.c | 25 +++++-------------------- include/video/da8xx-fb.h | 1 - 2 files changed, 5 insertions(+), 21 deletions(-) diff --git a/drivers/video/fbdev/da8xx-fb.c b/drivers/video/fbdev/da8xx-fb.c index 4fa99ff79f3b..328de29c4933 100644 --- a/drivers/video/fbdev/da8xx-fb.c +++ b/drivers/video/fbdev/da8xx-fb.c @@ -165,7 +165,6 @@ struct da8xx_fb_par { struct notifier_block freq_transition; #endif unsigned int lcdc_clk_rate; - void (*panel_power_ctrl)(int); struct regulator *lcd_supply; u32 pseudo_palette[16]; struct fb_videomode mode; @@ -1076,9 +1075,7 @@ static int fb_remove(struct platform_device *dev) #ifdef CONFIG_CPU_FREQ lcd_da8xx_cpufreq_deregister(par); #endif - if (par->panel_power_ctrl) { - par->panel_power_ctrl(0); - } else if (par->lcd_supply) { + if (par->lcd_supply) { ret = regulator_disable(par->lcd_supply); if (ret) return ret; @@ -1187,9 +1184,7 @@ static int cfb_blank(int blank, struct fb_info *info) case FB_BLANK_UNBLANK: lcd_enable_raster(); - if (par->panel_power_ctrl) { - par->panel_power_ctrl(1); - } else if (par->lcd_supply) { + if (par->lcd_supply) { ret = regulator_enable(par->lcd_supply); if (ret) return ret; @@ -1199,9 +1194,7 @@ static int cfb_blank(int blank, struct fb_info *info) case FB_BLANK_VSYNC_SUSPEND: case FB_BLANK_HSYNC_SUSPEND: case FB_BLANK_POWERDOWN: - if (par->panel_power_ctrl) { - par->panel_power_ctrl(0); - } else if (par->lcd_supply) { + if (par->lcd_supply) { ret = regulator_disable(par->lcd_supply); if (ret) return ret; @@ -1414,10 +1407,6 @@ static int fb_probe(struct platform_device *device) par->dev = &device->dev; par->lcdc_clk = tmp_lcdc_clk; par->lcdc_clk_rate = clk_get_rate(par->lcdc_clk); - if (fb_pdata->panel_power_ctrl) { - par->panel_power_ctrl = fb_pdata->panel_power_ctrl; - par->panel_power_ctrl(1); - } par->lcd_supply = devm_regulator_get_optional(&device->dev, "lcd"); if (IS_ERR(par->lcd_supply)) { @@ -1639,9 +1628,7 @@ static int fb_suspend(struct device *dev) int ret; console_lock(); - if (par->panel_power_ctrl) { - par->panel_power_ctrl(0); - } else if (par->lcd_supply) { + if (par->lcd_supply) { ret = regulator_disable(par->lcd_supply); if (ret) return ret; @@ -1667,9 +1654,7 @@ static int fb_resume(struct device *dev) if (par->blank == FB_BLANK_UNBLANK) { lcd_enable_raster(); - if (par->panel_power_ctrl) { - par->panel_power_ctrl(1); - } else if (par->lcd_supply) { + if (par->lcd_supply) { ret = regulator_enable(par->lcd_supply); if (ret) return ret; diff --git a/include/video/da8xx-fb.h b/include/video/da8xx-fb.h index efed3c3383d6..1d19ae62b844 100644 --- a/include/video/da8xx-fb.h +++ b/include/video/da8xx-fb.h @@ -32,7 +32,6 @@ struct da8xx_lcdc_platform_data { const char manu_name[10]; void *controller_data; const char type[25]; - void (*panel_power_ctrl)(int); }; struct lcd_ctrl_config { From patchwork Tue Jun 25 16:34:32 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 11016001 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 0B8F314B6 for ; Tue, 25 Jun 2019 16:35:21 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F1C0C28066 for ; Tue, 25 Jun 2019 16:35:20 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E635F28399; Tue, 25 Jun 2019 16:35:20 +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=-7.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,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 96BFF28066 for ; Tue, 25 Jun 2019 16:35:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731684AbfFYQfH (ORCPT ); Tue, 25 Jun 2019 12:35:07 -0400 Received: from mail-wm1-f67.google.com ([209.85.128.67]:37422 "EHLO mail-wm1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731439AbfFYQfG (ORCPT ); Tue, 25 Jun 2019 12:35:06 -0400 Received: by mail-wm1-f67.google.com with SMTP id f17so3645195wme.2 for ; Tue, 25 Jun 2019 09:35:04 -0700 (PDT) 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=xjvgqiqZzglCEryM8XBbJiMmioEThPc/Ew98mkOW+30=; b=dsz03gRN+B8sj18/khuc/IOGJ4ZAac3MpDKb3Zv/Bc9PoYBZsScWcIBR66+WT13q4A tN8EW3Vfjzl0srOYa1HtJEj4YWDxKeLJeFxcOpAU1yqzULbgKdw7lI1k9uJYS2TLwLfq nJu10QxZk+xzeoc8TdS7m0YAZ+oQffTcRYbFO9YXz55433gHQs5zlWTN1V3cyKJa1Q2A iPJuT54NssEe53FbS36r8nVdcdRnBqTyep+QMieQHsg6JfL23Iqv4l0ggpRn13oHMR0p AZG9QARW/pNBZ52Cg4cBykzft5A+BRios2hbeleUvawVzlsiZYnAcBm99WZBoCSgvzcU PqsA== 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=xjvgqiqZzglCEryM8XBbJiMmioEThPc/Ew98mkOW+30=; b=LCj5jqEUXxd5X3j7H4BvlS2ieCtUEbN/0K6QLYD6WOw8Oga1mDQrjhAK8gjY7hXgLX Xx9etNnUfjjM1f6OzgGHUUJ+JNNKciqoATfBO29AwF4DHwtkMxLNIGqYC7YSuAxhmn7y 5xcCW9g8KPHWvycSX55GYYt3p67qtWvBpd0rvoVjVDOo18zZEWbKgqLrZBC/fyPIIbj2 f+WHaC+82FF2KVvNw84zs7LtfIMDeufnf7eceeJQ5r3C94y29IUqIXSw+3lVDAjPdB4H wrpQwEgj6ey/Dg6Lw6kc2fXbkNwVwxgHloAYkk9hP02NBokcN+NLLL2QdBG3mHEWiZ8S rN7g== X-Gm-Message-State: APjAAAVdjmFA+InyuJqBBVqwQp6uNO4QgZbsYvSdWlkNVt2s39fldsvp Bjtq3NXCFqSlRPU3N7B32iRpcQ== X-Google-Smtp-Source: APXvYqz13wXYAnILJ9E9trPlEzD6Yeo7CCy/mNFNreUVqazy0miJn87+1vh+k2XQcsjx0bfSNxAnqA== X-Received: by 2002:a1c:c74a:: with SMTP id x71mr20501151wmf.121.1561480504153; Tue, 25 Jun 2019 09:35:04 -0700 (PDT) Received: from debian-brgl.home ([2a01:cb1d:af:5b00:6d6c:8493:1ab5:dad7]) by smtp.gmail.com with ESMTPSA id g8sm2683795wme.20.2019.06.25.09.35.03 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 25 Jun 2019 09:35:03 -0700 (PDT) From: Bartosz Golaszewski To: Sekhar Nori , Kevin Hilman , Lee Jones , Daniel Thompson , Jingoo Han , Bartlomiej Zolnierkiewicz , David Lechner , Linus Walleij Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-fbdev@vger.kernel.org, Bartosz Golaszewski Subject: [PATCH 10/12] fbdev: da8xx-fb: use devm_platform_ioremap_resource() Date: Tue, 25 Jun 2019 18:34:32 +0200 Message-Id: <20190625163434.13620-11-brgl@bgdev.pl> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190625163434.13620-1-brgl@bgdev.pl> References: <20190625163434.13620-1-brgl@bgdev.pl> MIME-Version: 1.0 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 From: Bartosz Golaszewski Shrink the code a bit by using the new helper wrapping the calls to platform_get_resource() and devm_ioremap_resource() together. Signed-off-by: Bartosz Golaszewski Acked-by: Bartlomiej Zolnierkiewicz --- drivers/video/fbdev/da8xx-fb.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/video/fbdev/da8xx-fb.c b/drivers/video/fbdev/da8xx-fb.c index 328de29c4933..4dda194d6b8f 100644 --- a/drivers/video/fbdev/da8xx-fb.c +++ b/drivers/video/fbdev/da8xx-fb.c @@ -1339,7 +1339,6 @@ static int fb_probe(struct platform_device *device) { struct da8xx_lcdc_platform_data *fb_pdata = dev_get_platdata(&device->dev); - struct resource *lcdc_regs; struct lcd_ctrl_config *lcd_cfg; struct fb_videomode *lcdc_info; struct fb_info *da8xx_fb_info; @@ -1357,8 +1356,7 @@ static int fb_probe(struct platform_device *device) if (lcdc_info == NULL) return -ENODEV; - lcdc_regs = platform_get_resource(device, IORESOURCE_MEM, 0); - da8xx_fb_reg_base = devm_ioremap_resource(&device->dev, lcdc_regs); + da8xx_fb_reg_base = devm_platform_ioremap_resource(device, 0); if (IS_ERR(da8xx_fb_reg_base)) return PTR_ERR(da8xx_fb_reg_base); From patchwork Tue Jun 25 16:34:33 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 11015999 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 4F44F14B6 for ; Tue, 25 Jun 2019 16:35:20 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 40D4328066 for ; Tue, 25 Jun 2019 16:35:20 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 34AC028399; Tue, 25 Jun 2019 16:35:20 +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=-7.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,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 D1D5428066 for ; Tue, 25 Jun 2019 16:35:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731670AbfFYQfS (ORCPT ); Tue, 25 Jun 2019 12:35:18 -0400 Received: from mail-wr1-f67.google.com ([209.85.221.67]:36558 "EHLO mail-wr1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731514AbfFYQfH (ORCPT ); Tue, 25 Jun 2019 12:35:07 -0400 Received: by mail-wr1-f67.google.com with SMTP id n4so17428935wrs.3 for ; Tue, 25 Jun 2019 09:35:05 -0700 (PDT) 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=bAOkVHO1BfkTnSJLTBWlqsTsKKDk8gdZ6nODPU4c1tE=; b=i50TzhxoE0EVWRZb7FuSgJwILA4rx2iPG77Mv3xcrrEJhVN4B/h7MPBBWVugqYxWp2 z/toOghI0xFLzo4j20BFkcTCK+t9oS1ur5Zxjuv68/EUxdI7HLW8oC2Nj9IGNwbxlkcf ppV6VXclq/A8Z0b+pcsB0R3xp2T8dBZGYEgPFrzfJRHQCawfFi+1EpUaRPuEwp5oe/TE cjUFukQoM00ogBXYvTqt763tfq4G+xwbOAaEuus8bhR4jpNdbtNk1PP3kxzDeiAC6IY4 zhd+wjbHvP1qPE3kwpdpje4Jp/GVei4mLQW7Kg6+P3xNN65ClIzjaWSbuQstQ63Hv5H+ 570A== 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=bAOkVHO1BfkTnSJLTBWlqsTsKKDk8gdZ6nODPU4c1tE=; b=LIeKzJNmcxse1iFAN22BQqGxsi6c7xd2w1e0otzMeGbVpOqGZ1S7etdQr7sib/DxeD X8U4woWLqMIX0CyKFuq+oCLNoj+510qwvFUqZznxBEmHyhcfyFUbAUvwJe0TjkSc6ovb cPtlBswFMVeZXdOQuqxS64JL0w5Xc9eFjPQoVKOMAUTO5YVJBU6cQ50ncdr3j/YY2Ja5 mDW4lvW+8dy5wk7C1xyaYOL7lzBFZcuOlrDPxefsCCKSxaAe4TRvMS1NAXvkdUu6WiWw 7KU4M87RXglyUOdxAsbAFsZPshj3kN3VzLkuyuJhwDgEOnB8IYuBvY0XguGq+gKKS3AO yxEw== X-Gm-Message-State: APjAAAVF0PIabp3A5JxQV3HLmWM8WF+ab2B43Gxwm6nudrohHlpdVOFP ukO57UtRou0cjRJNlS5Toj9Qww== X-Google-Smtp-Source: APXvYqytytlRfo6YGBjwFJZaCuSVzWH7Bv4+NP+iZBeBXrfYOEHyoR/Ueaj3FUGfeHDYPIHfHNmD2A== X-Received: by 2002:adf:e691:: with SMTP id r17mr62365819wrm.67.1561480505225; Tue, 25 Jun 2019 09:35:05 -0700 (PDT) Received: from debian-brgl.home ([2a01:cb1d:af:5b00:6d6c:8493:1ab5:dad7]) by smtp.gmail.com with ESMTPSA id g8sm2683795wme.20.2019.06.25.09.35.04 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 25 Jun 2019 09:35:04 -0700 (PDT) From: Bartosz Golaszewski To: Sekhar Nori , Kevin Hilman , Lee Jones , Daniel Thompson , Jingoo Han , Bartlomiej Zolnierkiewicz , David Lechner , Linus Walleij Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-fbdev@vger.kernel.org, Bartosz Golaszewski Subject: [PATCH 11/12] fbdev: da8xx-fb: drop a redundant if Date: Tue, 25 Jun 2019 18:34:33 +0200 Message-Id: <20190625163434.13620-12-brgl@bgdev.pl> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190625163434.13620-1-brgl@bgdev.pl> References: <20190625163434.13620-1-brgl@bgdev.pl> MIME-Version: 1.0 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 From: Bartosz Golaszewski The driver data is always set in probe. The remove() callback won't be called if probe failed which is the only way for it to be NULL. Remove the redundant if. Signed-off-by: Bartosz Golaszewski Acked-by: Bartlomiej Zolnierkiewicz --- drivers/video/fbdev/da8xx-fb.c | 43 ++++++++++++++++------------------ 1 file changed, 20 insertions(+), 23 deletions(-) diff --git a/drivers/video/fbdev/da8xx-fb.c b/drivers/video/fbdev/da8xx-fb.c index 4dda194d6b8f..6b11a8108108 100644 --- a/drivers/video/fbdev/da8xx-fb.c +++ b/drivers/video/fbdev/da8xx-fb.c @@ -1067,37 +1067,34 @@ static void lcd_da8xx_cpufreq_deregister(struct da8xx_fb_par *par) static int fb_remove(struct platform_device *dev) { struct fb_info *info = dev_get_drvdata(&dev->dev); + struct da8xx_fb_par *par = info->par; int ret; - if (info) { - struct da8xx_fb_par *par = info->par; - #ifdef CONFIG_CPU_FREQ - lcd_da8xx_cpufreq_deregister(par); + lcd_da8xx_cpufreq_deregister(par); #endif - if (par->lcd_supply) { - ret = regulator_disable(par->lcd_supply); - if (ret) - return ret; - } + if (par->lcd_supply) { + ret = regulator_disable(par->lcd_supply); + if (ret) + return ret; + } - lcd_disable_raster(DA8XX_FRAME_WAIT); - lcdc_write(0, LCD_RASTER_CTRL_REG); + lcd_disable_raster(DA8XX_FRAME_WAIT); + lcdc_write(0, LCD_RASTER_CTRL_REG); - /* disable DMA */ - lcdc_write(0, LCD_DMA_CTRL_REG); + /* disable DMA */ + lcdc_write(0, LCD_DMA_CTRL_REG); - unregister_framebuffer(info); - fb_dealloc_cmap(&info->cmap); - dma_free_coherent(par->dev, PALETTE_SIZE, par->v_palette_base, - par->p_palette_base); - dma_free_coherent(par->dev, par->vram_size, par->vram_virt, - par->vram_phys); - pm_runtime_put_sync(&dev->dev); - pm_runtime_disable(&dev->dev); - framebuffer_release(info); + unregister_framebuffer(info); + fb_dealloc_cmap(&info->cmap); + dma_free_coherent(par->dev, PALETTE_SIZE, par->v_palette_base, + par->p_palette_base); + dma_free_coherent(par->dev, par->vram_size, par->vram_virt, + par->vram_phys); + pm_runtime_put_sync(&dev->dev); + pm_runtime_disable(&dev->dev); + framebuffer_release(info); - } return 0; } From patchwork Tue Jun 25 16:34:34 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 11015997 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 BC3CF76 for ; Tue, 25 Jun 2019 16:35:18 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AA62E28066 for ; Tue, 25 Jun 2019 16:35:18 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9B57028399; Tue, 25 Jun 2019 16:35:18 +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=-7.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,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 3930428066 for ; Tue, 25 Jun 2019 16:35:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731640AbfFYQfR (ORCPT ); Tue, 25 Jun 2019 12:35:17 -0400 Received: from mail-wr1-f67.google.com ([209.85.221.67]:38954 "EHLO mail-wr1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731670AbfFYQfI (ORCPT ); Tue, 25 Jun 2019 12:35:08 -0400 Received: by mail-wr1-f67.google.com with SMTP id x4so18611636wrt.6 for ; Tue, 25 Jun 2019 09:35:07 -0700 (PDT) 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=ga+YwIrD2LqYZ2tJvuqiZTtIXkFbIASL3x6BxdYUV7E=; b=AHkej/B1mfm2h6OHO9LRjul+QcnubPRDTF056QLWkadd6YmPrnjIQ0undO3cGCLteJ vDiXd6NaEvKkuA/Ov1EU6GibR2fq54JcogmaTLJSE1w8VxFhBCKMQa6nMSc7ama2AQUQ MXjYRzIQXao10HPHfkljNhFskfJ1miN0PiAO2WXQdrS+ZTVMirEH1Q6Xpg47b+c9njcv +AACxr8d7oedC2TVbLqVhCM7LVV6mcxDlsoJqTfbUea3qLJwtE8gHdguCFLj0gCiAbWC v37fEvz+TIlhi8gACKPDc1wJUhIQBhzZpszZhnPvYhMiEv2bxIIzjLBufGN9GEE3sxzT cfTA== 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=ga+YwIrD2LqYZ2tJvuqiZTtIXkFbIASL3x6BxdYUV7E=; b=lSgIfZYQl9NjPj8V5dvxGbXer5YeNYx7cw9ukj/hqUvIxn1eXtKQQJH00NAbW1BnJW LaTGZ/nmPSUhmtnm6n7Rr0LWjyk3uEI2VxgdGOC8S2y5c61Jq9Cj6PM8M7y0/ac+mkxF 75pnpHtH97OxfkysASTrmTwVWCPBiCypDHxmqhVUAGqPS6RD41N9Hkd1/Fx1JUXj4ajw R1l87SewZyJzHzYGyWL/JR0MowmTB34G0UwBiMmDjv/NJdV/G+rmyBjEsh6GJEVYCpNx RB+pjXkYh0fmyBPqoCPBAQaAJt/PyKs0OTXUQLtqun9h56yguHmcc9JoUm/oZRjRl/qq sOdQ== X-Gm-Message-State: APjAAAVBHUIe1pOz4TOsHbXImhOLi1on5rx6TSTjN8aLUsTZQ+D4OL3T TbR7e39OepO8+114nuH0s5iQmw== X-Google-Smtp-Source: APXvYqyvWx9JbKk03RcDjA3pShyMvYT0hK97AL2s1HrAwQ3kyP6xBm3hM8uqoOdedFI3inNXlGh+zw== X-Received: by 2002:a5d:528b:: with SMTP id c11mr299403wrv.25.1561480506602; Tue, 25 Jun 2019 09:35:06 -0700 (PDT) Received: from debian-brgl.home ([2a01:cb1d:af:5b00:6d6c:8493:1ab5:dad7]) by smtp.gmail.com with ESMTPSA id g8sm2683795wme.20.2019.06.25.09.35.05 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 25 Jun 2019 09:35:06 -0700 (PDT) From: Bartosz Golaszewski To: Sekhar Nori , Kevin Hilman , Lee Jones , Daniel Thompson , Jingoo Han , Bartlomiej Zolnierkiewicz , David Lechner , Linus Walleij Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-fbdev@vger.kernel.org, Bartosz Golaszewski Subject: [PATCH 12/12] fbdev: da8xx: use resource management for dma Date: Tue, 25 Jun 2019 18:34:34 +0200 Message-Id: <20190625163434.13620-13-brgl@bgdev.pl> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190625163434.13620-1-brgl@bgdev.pl> References: <20190625163434.13620-1-brgl@bgdev.pl> MIME-Version: 1.0 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 From: Bartosz Golaszewski Use managed variants of dma alloc functions in the da8xx fbdev driver. Signed-off-by: Bartosz Golaszewski Acked-by: Bartlomiej Zolnierkiewicz --- drivers/video/fbdev/da8xx-fb.c | 32 ++++++++++---------------------- 1 file changed, 10 insertions(+), 22 deletions(-) diff --git a/drivers/video/fbdev/da8xx-fb.c b/drivers/video/fbdev/da8xx-fb.c index 6b11a8108108..22f79b3c2326 100644 --- a/drivers/video/fbdev/da8xx-fb.c +++ b/drivers/video/fbdev/da8xx-fb.c @@ -1087,10 +1087,6 @@ static int fb_remove(struct platform_device *dev) unregister_framebuffer(info); fb_dealloc_cmap(&info->cmap); - dma_free_coherent(par->dev, PALETTE_SIZE, par->v_palette_base, - par->p_palette_base); - dma_free_coherent(par->dev, par->vram_size, par->vram_virt, - par->vram_phys); pm_runtime_put_sync(&dev->dev); pm_runtime_disable(&dev->dev); framebuffer_release(info); @@ -1428,10 +1424,10 @@ static int fb_probe(struct platform_device *device) par->vram_size = roundup(par->vram_size/8, ulcm); par->vram_size = par->vram_size * LCD_NUM_BUFFERS; - par->vram_virt = dma_alloc_coherent(par->dev, - par->vram_size, - &par->vram_phys, - GFP_KERNEL | GFP_DMA); + par->vram_virt = dmam_alloc_coherent(par->dev, + par->vram_size, + &par->vram_phys, + GFP_KERNEL | GFP_DMA); if (!par->vram_virt) { dev_err(&device->dev, "GLCD: kmalloc for frame buffer failed\n"); @@ -1449,20 +1445,20 @@ static int fb_probe(struct platform_device *device) da8xx_fb_fix.line_length - 1; /* allocate palette buffer */ - par->v_palette_base = dma_alloc_coherent(par->dev, PALETTE_SIZE, - &par->p_palette_base, - GFP_KERNEL | GFP_DMA); + par->v_palette_base = dmam_alloc_coherent(par->dev, PALETTE_SIZE, + &par->p_palette_base, + GFP_KERNEL | GFP_DMA); if (!par->v_palette_base) { dev_err(&device->dev, "GLCD: kmalloc for palette buffer failed\n"); ret = -EINVAL; - goto err_release_fb_mem; + goto err_release_fb; } par->irq = platform_get_irq(device, 0); if (par->irq < 0) { ret = -ENOENT; - goto err_release_pl_mem; + goto err_release_fb; } da8xx_fb_var.grayscale = @@ -1480,7 +1476,7 @@ static int fb_probe(struct platform_device *device) ret = fb_alloc_cmap(&da8xx_fb_info->cmap, PALETTE_SIZE, 0); if (ret) - goto err_release_pl_mem; + goto err_release_fb; da8xx_fb_info->cmap.len = par->palette_sz; /* initialize var_screeninfo */ @@ -1534,14 +1530,6 @@ static int fb_probe(struct platform_device *device) err_dealloc_cmap: fb_dealloc_cmap(&da8xx_fb_info->cmap); -err_release_pl_mem: - dma_free_coherent(par->dev, PALETTE_SIZE, par->v_palette_base, - par->p_palette_base); - -err_release_fb_mem: - dma_free_coherent(par->dev, par->vram_size, par->vram_virt, - par->vram_phys); - err_release_fb: framebuffer_release(da8xx_fb_info);