From: Bartosz Golaszewski <brgl@bgdev.pl>
To: Sekhar Nori <nsekhar@ti.com>, Kevin Hilman <khilman@kernel.org>,
Lee Jones <lee.jones@linaro.org>,
Daniel Thompson <daniel.thompson@linaro.org>,
Jingoo Han <jingoohan1@gmail.com>,
Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>,
David Lechner <david@lechnology.com>,
Linus Walleij <linus.walleij@linaro.org>
Cc: linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org,
linux-fbdev@vger.kernel.org,
Bartosz Golaszewski <bgolaszewski@baylibre.com>
Subject: [PATCH 06/12] ARM: davinci: da850-evm: model the backlight GPIO as an actual device
Date: Tue, 25 Jun 2019 16:34:28 +0000 [thread overview]
Message-ID: <20190625163434.13620-7-brgl@bgdev.pl> (raw)
In-Reply-To: <20190625163434.13620-1-brgl@bgdev.pl>
From: Bartosz Golaszewski <bgolaszewski@baylibre.com>
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 <bgolaszewski@baylibre.com>
---
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 <linux/platform_data/ti-aemif.h>
#include <linux/platform_data/spi-davinci.h>
#include <linux/platform_data/uio_pruss.h>
+#include <linux/property.h>
#include <linux/regulator/machine.h>
#include <linux/regulator/tps6507x.h>
#include <linux/regulator/fixed.h>
@@ -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;
--
2.21.0
WARNING: multiple messages have this Message-ID (diff)
From: Bartosz Golaszewski <brgl@bgdev.pl>
To: Sekhar Nori <nsekhar@ti.com>, Kevin Hilman <khilman@kernel.org>,
Lee Jones <lee.jones@linaro.org>,
Daniel Thompson <daniel.thompson@linaro.org>,
Jingoo Han <jingoohan1@gmail.com>,
Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>,
David Lechner <david@lechnology.com>,
Linus Walleij <linus.walleij@linaro.org>
Cc: Bartosz Golaszewski <bgolaszewski@baylibre.com>,
dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
linux-fbdev@vger.kernel.org
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 [thread overview]
Message-ID: <20190625163434.13620-7-brgl@bgdev.pl> (raw)
In-Reply-To: <20190625163434.13620-1-brgl@bgdev.pl>
From: Bartosz Golaszewski <bgolaszewski@baylibre.com>
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 <bgolaszewski@baylibre.com>
---
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 <linux/platform_data/ti-aemif.h>
#include <linux/platform_data/spi-davinci.h>
#include <linux/platform_data/uio_pruss.h>
+#include <linux/property.h>
#include <linux/regulator/machine.h>
#include <linux/regulator/tps6507x.h>
#include <linux/regulator/fixed.h>
@@ -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;
--
2.21.0
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
WARNING: multiple messages have this Message-ID (diff)
From: Bartosz Golaszewski <brgl@bgdev.pl>
To: Sekhar Nori <nsekhar@ti.com>, Kevin Hilman <khilman@kernel.org>,
Lee Jones <lee.jones@linaro.org>,
Daniel Thompson <daniel.thompson@linaro.org>,
Jingoo Han <jingoohan1@gmail.com>,
Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>,
David Lechner <david@lechnology.com>,
Linus Walleij <linus.walleij@linaro.org>
Cc: linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org,
linux-fbdev@vger.kernel.org,
Bartosz Golaszewski <bgolaszewski@baylibre.com>
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 [thread overview]
Message-ID: <20190625163434.13620-7-brgl@bgdev.pl> (raw)
In-Reply-To: <20190625163434.13620-1-brgl@bgdev.pl>
From: Bartosz Golaszewski <bgolaszewski@baylibre.com>
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 <bgolaszewski@baylibre.com>
---
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 <linux/platform_data/ti-aemif.h>
#include <linux/platform_data/spi-davinci.h>
#include <linux/platform_data/uio_pruss.h>
+#include <linux/property.h>
#include <linux/regulator/machine.h>
#include <linux/regulator/tps6507x.h>
#include <linux/regulator/fixed.h>
@@ -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;
--
2.21.0
next prev parent reply other threads:[~2019-06-25 16:34 UTC|newest]
Thread overview: 93+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-06-25 16:34 [PATCH 00/12] ARM: davinci: da850-evm: remove more legacy GPIO calls Bartosz Golaszewski
2019-06-25 16:34 ` Bartosz Golaszewski
2019-06-25 16:34 ` Bartosz Golaszewski
2019-06-25 16:34 ` [PATCH 01/12] backlight: gpio: allow to probe non-pdata devices from board files Bartosz Golaszewski
2019-06-25 16:34 ` Bartosz Golaszewski
2019-06-25 16:34 ` Bartosz Golaszewski
2019-06-28 12:58 ` Bartlomiej Zolnierkiewicz
2019-06-28 12:58 ` Bartlomiej Zolnierkiewicz
2019-06-28 12:58 ` Bartlomiej Zolnierkiewicz
2019-07-02 9:02 ` Daniel Thompson
2019-07-02 9:02 ` Daniel Thompson
2019-07-02 9:02 ` Daniel Thompson
2019-07-02 9:02 ` Daniel Thompson
2019-06-25 16:34 ` [PATCH 02/12] backlight: gpio: use a helper variable for &pdev->dev Bartosz Golaszewski
2019-06-25 16:34 ` Bartosz Golaszewski
2019-06-25 16:34 ` Bartosz Golaszewski
2019-06-28 12:59 ` Bartlomiej Zolnierkiewicz
2019-06-28 12:59 ` Bartlomiej Zolnierkiewicz
2019-06-28 12:59 ` Bartlomiej Zolnierkiewicz
2019-06-28 12:59 ` Bartlomiej Zolnierkiewicz
2019-07-02 9:05 ` Daniel Thompson
2019-07-02 9:05 ` Daniel Thompson
2019-07-02 9:05 ` Daniel Thompson
2019-06-25 16:34 ` [PATCH 03/12] backlight: gpio: pull the non-pdata device probing code into probe() Bartosz Golaszewski
2019-06-25 16:34 ` Bartosz Golaszewski
2019-06-25 16:34 ` Bartosz Golaszewski
2019-06-27 11:14 ` Linus Walleij
2019-06-27 11:14 ` Linus Walleij
2019-06-27 11:14 ` Linus Walleij
2019-06-27 11:14 ` Linus Walleij
2019-06-28 12:59 ` Bartlomiej Zolnierkiewicz
2019-06-28 12:59 ` Bartlomiej Zolnierkiewicz
2019-06-28 12:59 ` Bartlomiej Zolnierkiewicz
2019-07-02 9:11 ` Daniel Thompson
2019-07-02 9:11 ` Daniel Thompson
2019-07-02 9:11 ` Daniel Thompson
2019-06-25 16:34 ` [PATCH 04/12] ARM: davinci: refresh davinci_all_defconfig Bartosz Golaszewski
2019-06-25 16:34 ` Bartosz Golaszewski
2019-06-25 16:34 ` Bartosz Golaszewski
2019-06-25 16:34 ` [PATCH 05/12] ARM: davinci_all_defconfig: enable GPIO backlight Bartosz Golaszewski
2019-06-25 16:34 ` Bartosz Golaszewski
2019-06-25 16:34 ` Bartosz Golaszewski
2019-06-25 16:34 ` Bartosz Golaszewski [this message]
2019-06-25 16:34 ` [PATCH 06/12] ARM: davinci: da850-evm: model the backlight GPIO as an actual device Bartosz Golaszewski
2019-06-25 16:34 ` Bartosz Golaszewski
2019-06-27 11:16 ` Linus Walleij
2019-06-27 11:16 ` Linus Walleij
2019-06-27 11:16 ` Linus Walleij
2019-06-25 16:34 ` [PATCH 07/12] fbdev: da8xx: add support for a regulator Bartosz Golaszewski
2019-06-25 16:34 ` Bartosz Golaszewski
2019-06-25 16:34 ` Bartosz Golaszewski
2019-06-28 13:03 ` Bartlomiej Zolnierkiewicz
2019-06-28 13:03 ` Bartlomiej Zolnierkiewicz
2019-06-28 13:03 ` Bartlomiej Zolnierkiewicz
2019-06-25 16:34 ` [PATCH 08/12] ARM: davinci: da850-evm: switch to using a fixed regulator for lcdc Bartosz Golaszewski
2019-06-25 16:34 ` Bartosz Golaszewski
2019-06-25 16:34 ` Bartosz Golaszewski
2019-06-27 11:18 ` Linus Walleij
2019-06-27 11:18 ` Linus Walleij
2019-06-27 11:18 ` Linus Walleij
2019-06-25 16:34 ` [PATCH 09/12] fbdev: da8xx: remove panel_power_ctrl() callback from platform data Bartosz Golaszewski
2019-06-25 16:34 ` Bartosz Golaszewski
2019-06-28 13:04 ` Bartlomiej Zolnierkiewicz
2019-06-28 13:04 ` Bartlomiej Zolnierkiewicz
2019-06-25 16:34 ` [PATCH 10/12] fbdev: da8xx-fb: use devm_platform_ioremap_resource() Bartosz Golaszewski
2019-06-25 16:34 ` Bartosz Golaszewski
2019-06-25 16:34 ` Bartosz Golaszewski
2019-06-28 13:04 ` Bartlomiej Zolnierkiewicz
2019-06-28 13:04 ` Bartlomiej Zolnierkiewicz
2019-06-28 13:04 ` Bartlomiej Zolnierkiewicz
2019-06-28 13:04 ` Bartlomiej Zolnierkiewicz
2019-06-25 16:34 ` [PATCH 11/12] fbdev: da8xx-fb: drop a redundant if Bartosz Golaszewski
2019-06-25 16:34 ` Bartosz Golaszewski
2019-06-25 16:34 ` Bartosz Golaszewski
2019-06-28 13:05 ` Bartlomiej Zolnierkiewicz
2019-06-28 13:05 ` Bartlomiej Zolnierkiewicz
2019-06-28 13:05 ` Bartlomiej Zolnierkiewicz
2019-06-25 16:34 ` [PATCH 12/12] fbdev: da8xx: use resource management for dma Bartosz Golaszewski
2019-06-25 16:34 ` Bartosz Golaszewski
2019-06-25 16:34 ` Bartosz Golaszewski
2019-06-28 13:06 ` Bartlomiej Zolnierkiewicz
2019-06-28 13:06 ` Bartlomiej Zolnierkiewicz
2019-06-28 13:06 ` Bartlomiej Zolnierkiewicz
2019-07-01 14:40 ` [PATCH 00/12] ARM: davinci: da850-evm: remove more legacy GPIO calls Sekhar Nori
2019-07-01 14:52 ` Sekhar Nori
2019-07-01 14:40 ` Sekhar Nori
2019-07-01 14:40 ` Sekhar Nori
2019-07-02 6:36 ` Lee Jones
2019-07-02 6:36 ` Lee Jones
2019-07-02 6:36 ` Lee Jones
2019-07-02 10:06 ` Daniel Thompson
2019-07-02 10:06 ` Daniel Thompson
2019-07-02 10:06 ` Daniel Thompson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190625163434.13620-7-brgl@bgdev.pl \
--to=brgl@bgdev.pl \
--cc=b.zolnierkie@samsung.com \
--cc=bgolaszewski@baylibre.com \
--cc=daniel.thompson@linaro.org \
--cc=david@lechnology.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=jingoohan1@gmail.com \
--cc=khilman@kernel.org \
--cc=lee.jones@linaro.org \
--cc=linus.walleij@linaro.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-fbdev@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=nsekhar@ti.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.