* [PATCH 1/3] OMAPDSS: panel-lgphilips-lb035q02: use gpiod for enable gpio
2014-05-15 10:10 [PATCH 0/3] OMAPDSS: DT support for panel-lgphilips-lb035q02 Tomi Valkeinen
@ 2014-05-15 10:10 ` Tomi Valkeinen
2014-05-15 10:10 ` [PATCH 2/3] OMAPDSS: panel-lgphilips-lb035q02: Add DT support Tomi Valkeinen
` (2 subsequent siblings)
3 siblings, 0 replies; 8+ messages in thread
From: Tomi Valkeinen @ 2014-05-15 10:10 UTC (permalink / raw)
To: linux-fbdev, linux-omap; +Cc: Archit Taneja, Florian Vaussard, Tomi Valkeinen
The new gpiod API supports automatic handling of active-high/active-low
with DT. To make it possible to use that when booting with DT, change
the driver's handling of the enable GPIO to use gpiod.
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
---
.../omap2/displays-new/panel-lgphilips-lb035q02.c | 32 ++++++++++++----------
1 file changed, 18 insertions(+), 14 deletions(-)
diff --git a/drivers/video/fbdev/omap2/displays-new/panel-lgphilips-lb035q02.c b/drivers/video/fbdev/omap2/displays-new/panel-lgphilips-lb035q02.c
index 2e6b513222d9..6e6acd696a70 100644
--- a/drivers/video/fbdev/omap2/displays-new/panel-lgphilips-lb035q02.c
+++ b/drivers/video/fbdev/omap2/displays-new/panel-lgphilips-lb035q02.c
@@ -50,9 +50,10 @@ struct panel_drv_data {
struct omap_video_timings videomode;
- int reset_gpio;
+ /* used for non-DT boot, to be removed */
int backlight_gpio;
- int enable_gpio;
+
+ struct gpio_desc *enable_gpio;
};
#define to_panel_data(p) container_of(p, struct panel_drv_data, dssdev)
@@ -165,8 +166,8 @@ static int lb035q02_enable(struct omap_dss_device *dssdev)
if (r)
return r;
- if (gpio_is_valid(ddata->enable_gpio))
- gpio_set_value_cansleep(ddata->enable_gpio, 1);
+ if (ddata->enable_gpio)
+ gpiod_set_value_cansleep(ddata->enable_gpio, 1);
if (gpio_is_valid(ddata->backlight_gpio))
gpio_set_value_cansleep(ddata->backlight_gpio, 1);
@@ -184,8 +185,8 @@ static void lb035q02_disable(struct omap_dss_device *dssdev)
if (!omapdss_device_is_enabled(dssdev))
return;
- if (gpio_is_valid(ddata->enable_gpio))
- gpio_set_value_cansleep(ddata->enable_gpio, 0);
+ if (ddata->enable_gpio)
+ gpiod_set_value_cansleep(ddata->enable_gpio, 0);
if (gpio_is_valid(ddata->backlight_gpio))
gpio_set_value_cansleep(ddata->backlight_gpio, 0);
@@ -243,6 +244,7 @@ static int lb035q02_probe_pdata(struct spi_device *spi)
const struct panel_lb035q02_platform_data *pdata;
struct panel_drv_data *ddata = dev_get_drvdata(&spi->dev);
struct omap_dss_device *dssdev, *in;
+ int r;
pdata = dev_get_platdata(&spi->dev);
@@ -260,10 +262,19 @@ static int lb035q02_probe_pdata(struct spi_device *spi)
dssdev = &ddata->dssdev;
dssdev->name = pdata->name;
- ddata->enable_gpio = pdata->enable_gpio;
+ r = devm_gpio_request_one(&spi->dev, pdata->enable_gpio,
+ GPIOF_OUT_INIT_LOW, "panel enable");
+ if (r)
+ goto err_gpio;
+
+ ddata->enable_gpio = gpio_to_desc(pdata->enable_gpio);
+
ddata->backlight_gpio = pdata->backlight_gpio;
return 0;
+err_gpio:
+ omap_dss_put_device(ddata->in);
+ return r;
}
static int lb035q02_panel_spi_probe(struct spi_device *spi)
@@ -288,13 +299,6 @@ static int lb035q02_panel_spi_probe(struct spi_device *spi)
return -ENODEV;
}
- if (gpio_is_valid(ddata->enable_gpio)) {
- r = devm_gpio_request_one(&spi->dev, ddata->enable_gpio,
- GPIOF_OUT_INIT_LOW, "panel enable");
- if (r)
- goto err_gpio;
- }
-
if (gpio_is_valid(ddata->backlight_gpio)) {
r = devm_gpio_request_one(&spi->dev, ddata->backlight_gpio,
GPIOF_OUT_INIT_LOW, "panel backlight");
--
1.9.1
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH 2/3] OMAPDSS: panel-lgphilips-lb035q02: Add DT support
2014-05-15 10:10 [PATCH 0/3] OMAPDSS: DT support for panel-lgphilips-lb035q02 Tomi Valkeinen
2014-05-15 10:10 ` [PATCH 1/3] OMAPDSS: panel-lgphilips-lb035q02: use gpiod for enable gpio Tomi Valkeinen
@ 2014-05-15 10:10 ` Tomi Valkeinen
2014-05-20 10:58 ` Florian Vaussard
2014-05-15 10:10 ` [PATCH 3/3] Doc/DT: Add binding doc for lgphilips,lb035q02.txt Tomi Valkeinen
2014-05-20 11:04 ` [PATCH 0/3] OMAPDSS: DT support for panel-lgphilips-lb035q02 Florian Vaussard
3 siblings, 1 reply; 8+ messages in thread
From: Tomi Valkeinen @ 2014-05-15 10:10 UTC (permalink / raw)
To: linux-fbdev, linux-omap; +Cc: Archit Taneja, Florian Vaussard, Tomi Valkeinen
Add DT support for panel-lgphilips-lb035q02.
We disable the use of the backlight_gpio as it should be handled via
backlight framework with DT boots.
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
---
.../omap2/displays-new/panel-lgphilips-lb035q02.c | 44 +++++++++++++++++++++-
1 file changed, 43 insertions(+), 1 deletion(-)
diff --git a/drivers/video/fbdev/omap2/displays-new/panel-lgphilips-lb035q02.c b/drivers/video/fbdev/omap2/displays-new/panel-lgphilips-lb035q02.c
index 6e6acd696a70..76c4fdc51c31 100644
--- a/drivers/video/fbdev/omap2/displays-new/panel-lgphilips-lb035q02.c
+++ b/drivers/video/fbdev/omap2/displays-new/panel-lgphilips-lb035q02.c
@@ -159,7 +159,8 @@ static int lb035q02_enable(struct omap_dss_device *dssdev)
if (omapdss_device_is_enabled(dssdev))
return 0;
- in->ops.dpi->set_data_lines(in, ddata->data_lines);
+ if (ddata->data_lines)
+ in->ops.dpi->set_data_lines(in, ddata->data_lines);
in->ops.dpi->set_timings(in, &ddata->videomode);
r = in->ops.dpi->enable(in);
@@ -277,6 +278,35 @@ err_gpio:
return r;
}
+static int lb035q02_probe_of(struct spi_device *spi)
+{
+ struct device_node *node = spi->dev.of_node;
+ struct panel_drv_data *ddata = dev_get_drvdata(&spi->dev);
+ struct omap_dss_device *in;
+ struct gpio_desc *gpio;
+
+ gpio = devm_gpiod_get(&spi->dev, "enable");
+ if (IS_ERR(gpio)) {
+ dev_err(&spi->dev, "failed to parse enable gpio\n");
+ return PTR_ERR(gpio);
+ } else {
+ gpiod_direction_output(gpio, 0);
+ ddata->enable_gpio = gpio;
+ }
+
+ ddata->backlight_gpio = -ENOENT;
+
+ in = omapdss_of_find_source_for_first_ep(node);
+ if (IS_ERR(in)) {
+ dev_err(&spi->dev, "failed to find video source\n");
+ return PTR_ERR(in);
+ }
+
+ ddata->in = in;
+
+ return 0;
+}
+
static int lb035q02_panel_spi_probe(struct spi_device *spi)
{
struct panel_drv_data *ddata;
@@ -295,6 +325,10 @@ static int lb035q02_panel_spi_probe(struct spi_device *spi)
r = lb035q02_probe_pdata(spi);
if (r)
return r;
+ } else if (spi->dev.of_node) {
+ r = lb035q02_probe_of(spi);
+ if (r)
+ return r;
} else {
return -ENODEV;
}
@@ -346,6 +380,13 @@ static int lb035q02_panel_spi_remove(struct spi_device *spi)
return 0;
}
+static const struct of_device_id lb035q02_of_match[] = {
+ { .compatible = "omapdss,lgphilips,lb035q02", },
+ {},
+};
+
+MODULE_DEVICE_TABLE(of, lb035q02_of_match);
+
static struct spi_driver lb035q02_spi_driver = {
.probe = lb035q02_panel_spi_probe,
.remove = lb035q02_panel_spi_remove,
@@ -357,6 +398,7 @@ static struct spi_driver lb035q02_spi_driver = {
module_spi_driver(lb035q02_spi_driver);
+MODULE_ALIAS("spi:lgphilips,lb035q02");
MODULE_AUTHOR("Tomi Valkeinen <tomi.valkeinen@ti.com>");
MODULE_DESCRIPTION("LG.Philips LB035Q02 LCD Panel driver");
MODULE_LICENSE("GPL");
--
1.9.1
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH 2/3] OMAPDSS: panel-lgphilips-lb035q02: Add DT support
2014-05-15 10:10 ` [PATCH 2/3] OMAPDSS: panel-lgphilips-lb035q02: Add DT support Tomi Valkeinen
@ 2014-05-20 10:58 ` Florian Vaussard
2014-05-20 11:36 ` Tomi Valkeinen
0 siblings, 1 reply; 8+ messages in thread
From: Florian Vaussard @ 2014-05-20 10:58 UTC (permalink / raw)
To: Tomi Valkeinen, linux-fbdev, linux-omap; +Cc: Archit Taneja
Hi Tomi,
On 05/15/2014 12:10 PM, Tomi Valkeinen wrote:
> Add DT support for panel-lgphilips-lb035q02.
>
> We disable the use of the backlight_gpio as it should be handled via
> backlight framework with DT boots.
>
> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
> ---
> .../omap2/displays-new/panel-lgphilips-lb035q02.c | 44 +++++++++++++++++++++-
> 1 file changed, 43 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/video/fbdev/omap2/displays-new/panel-lgphilips-lb035q02.c b/drivers/video/fbdev/omap2/displays-new/panel-lgphilips-lb035q02.c
> index 6e6acd696a70..76c4fdc51c31 100644
> --- a/drivers/video/fbdev/omap2/displays-new/panel-lgphilips-lb035q02.c
> +++ b/drivers/video/fbdev/omap2/displays-new/panel-lgphilips-lb035q02.c
> @@ -159,7 +159,8 @@ static int lb035q02_enable(struct omap_dss_device *dssdev)
> if (omapdss_device_is_enabled(dssdev))
> return 0;
>
> - in->ops.dpi->set_data_lines(in, ddata->data_lines);
> + if (ddata->data_lines)
> + in->ops.dpi->set_data_lines(in, ddata->data_lines);
> in->ops.dpi->set_timings(in, &ddata->videomode);
>
> r = in->ops.dpi->enable(in);
> @@ -277,6 +278,35 @@ err_gpio:
> return r;
> }
>
> +static int lb035q02_probe_of(struct spi_device *spi)
> +{
> + struct device_node *node = spi->dev.of_node;
> + struct panel_drv_data *ddata = dev_get_drvdata(&spi->dev);
> + struct omap_dss_device *in;
> + struct gpio_desc *gpio;
> +
> + gpio = devm_gpiod_get(&spi->dev, "enable");
> + if (IS_ERR(gpio)) {
> + dev_err(&spi->dev, "failed to parse enable gpio\n");
> + return PTR_ERR(gpio);
> + } else {
> + gpiod_direction_output(gpio, 0);
> + ddata->enable_gpio = gpio;
> + }
> +
> + ddata->backlight_gpio = -ENOENT;
> +
> + in = omapdss_of_find_source_for_first_ep(node);
> + if (IS_ERR(in)) {
> + dev_err(&spi->dev, "failed to find video source\n");
> + return PTR_ERR(in);
> + }
> +
> + ddata->in = in;
> +
> + return 0;
> +}
> +
> static int lb035q02_panel_spi_probe(struct spi_device *spi)
> {
> struct panel_drv_data *ddata;
> @@ -295,6 +325,10 @@ static int lb035q02_panel_spi_probe(struct spi_device *spi)
> r = lb035q02_probe_pdata(spi);
> if (r)
> return r;
> + } else if (spi->dev.of_node) {
> + r = lb035q02_probe_of(spi);
> + if (r)
> + return r;
> } else {
> return -ENODEV;
> }
> @@ -346,6 +380,13 @@ static int lb035q02_panel_spi_remove(struct spi_device *spi)
> return 0;
> }
>
> +static const struct of_device_id lb035q02_of_match[] = {
> + { .compatible = "omapdss,lgphilips,lb035q02", },
> + {},
> +};
> +
> +MODULE_DEVICE_TABLE(of, lb035q02_of_match);
> +
> static struct spi_driver lb035q02_spi_driver = {
> .probe = lb035q02_panel_spi_probe,
> .remove = lb035q02_panel_spi_remove,
> @@ -357,6 +398,7 @@ static struct spi_driver lb035q02_spi_driver = {
>
.of_match_table = lb035q02_of_match,
is missing.
> module_spi_driver(lb035q02_spi_driver);
>
> +MODULE_ALIAS("spi:lgphilips,lb035q02");
> MODULE_AUTHOR("Tomi Valkeinen <tomi.valkeinen@ti.com>");
> MODULE_DESCRIPTION("LG.Philips LB035Q02 LCD Panel driver");
> MODULE_LICENSE("GPL");
>
Regards,
Florian
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 2/3] OMAPDSS: panel-lgphilips-lb035q02: Add DT support
2014-05-20 10:58 ` Florian Vaussard
@ 2014-05-20 11:36 ` Tomi Valkeinen
0 siblings, 0 replies; 8+ messages in thread
From: Tomi Valkeinen @ 2014-05-20 11:36 UTC (permalink / raw)
To: florian.vaussard, linux-fbdev, linux-omap; +Cc: Archit Taneja
[-- Attachment #1: Type: text/plain, Size: 440 bytes --]
On 20/05/14 13:58, Florian Vaussard wrote:
>> static struct spi_driver lb035q02_spi_driver = {
>> .probe = lb035q02_panel_spi_probe,
>> .remove = lb035q02_panel_spi_remove,
>> @@ -357,6 +398,7 @@ static struct spi_driver lb035q02_spi_driver = {
>>
>
> .of_match_table = lb035q02_of_match,
>
> is missing.
Thanks. I seem to have missed it with the other panels also in the
patches I sent last week.
Tomi
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH 3/3] Doc/DT: Add binding doc for lgphilips,lb035q02.txt
2014-05-15 10:10 [PATCH 0/3] OMAPDSS: DT support for panel-lgphilips-lb035q02 Tomi Valkeinen
2014-05-15 10:10 ` [PATCH 1/3] OMAPDSS: panel-lgphilips-lb035q02: use gpiod for enable gpio Tomi Valkeinen
2014-05-15 10:10 ` [PATCH 2/3] OMAPDSS: panel-lgphilips-lb035q02: Add DT support Tomi Valkeinen
@ 2014-05-15 10:10 ` Tomi Valkeinen
2014-05-20 11:01 ` Florian Vaussard
2014-05-20 11:04 ` [PATCH 0/3] OMAPDSS: DT support for panel-lgphilips-lb035q02 Florian Vaussard
3 siblings, 1 reply; 8+ messages in thread
From: Tomi Valkeinen @ 2014-05-15 10:10 UTC (permalink / raw)
To: linux-fbdev, linux-omap
Cc: Archit Taneja, Florian Vaussard, Tomi Valkeinen, devicetree
Add DT bindings documentation for LG.Philips LB035Q02 LCD panel.
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
Cc: devicetree@vger.kernel.org
---
.../bindings/video/lgphilips,lb035q02.txt | 33 ++++++++++++++++++++++
1 file changed, 33 insertions(+)
create mode 100644 Documentation/devicetree/bindings/video/lgphilips,lb035q02.txt
diff --git a/Documentation/devicetree/bindings/video/lgphilips,lb035q02.txt b/Documentation/devicetree/bindings/video/lgphilips,lb035q02.txt
new file mode 100644
index 000000000000..1a1e653e5407
--- /dev/null
+++ b/Documentation/devicetree/bindings/video/lgphilips,lb035q02.txt
@@ -0,0 +1,33 @@
+LG.Philips LB035Q02 Panel
+============+
+Required properties:
+- compatible: "lgphilips,lb035q02"
+- enable-gpios: panel enable gpio
+
+Optional properties:
+- label: a symbolic name for the panel
+
+Required nodes:
+- Video port for DPI input
+
+Example
+-------
+
+lcd-panel: panel@0 {
+ compatible = "lgphilips,lb035q02";
+ reg = <0>;
+ spi-max-frequency = <100000>;
+ spi-cpol;
+ spi-cpha;
+
+ label = "lcd";
+
+ enable-gpios = <&gpio7 7 0>;
+
+ port {
+ lcd_in: endpoint {
+ remote-endpoint = <&dpi_out>;
+ };
+ };
+};
--
1.9.1
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH 3/3] Doc/DT: Add binding doc for lgphilips,lb035q02.txt
2014-05-15 10:10 ` [PATCH 3/3] Doc/DT: Add binding doc for lgphilips,lb035q02.txt Tomi Valkeinen
@ 2014-05-20 11:01 ` Florian Vaussard
0 siblings, 0 replies; 8+ messages in thread
From: Florian Vaussard @ 2014-05-20 11:01 UTC (permalink / raw)
To: Tomi Valkeinen, linux-fbdev, linux-omap; +Cc: Archit Taneja, devicetree
Hi Tomi,
On 05/15/2014 12:10 PM, Tomi Valkeinen wrote:
> Add DT bindings documentation for LG.Philips LB035Q02 LCD panel.
>
> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
> Cc: devicetree@vger.kernel.org
> ---
> .../bindings/video/lgphilips,lb035q02.txt | 33 ++++++++++++++++++++++
> 1 file changed, 33 insertions(+)
> create mode 100644 Documentation/devicetree/bindings/video/lgphilips,lb035q02.txt
>
> diff --git a/Documentation/devicetree/bindings/video/lgphilips,lb035q02.txt b/Documentation/devicetree/bindings/video/lgphilips,lb035q02.txt
> new file mode 100644
> index 000000000000..1a1e653e5407
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/video/lgphilips,lb035q02.txt
> @@ -0,0 +1,33 @@
> +LG.Philips LB035Q02 Panel
> +============> +
> +Required properties:
> +- compatible: "lgphilips,lb035q02"
> +- enable-gpios: panel enable gpio
> +
> +Optional properties:
> +- label: a symbolic name for the panel
> +
> +Required nodes:
> +- Video port for DPI input
> +
> +Example
> +-------
> +
> +lcd-panel: panel@0 {
> + compatible = "lgphilips,lb035q02";
> + reg = <0>;
> + spi-max-frequency = <100000>;
> + spi-cpol;
> + spi-cpha;
> +
> + label = "lcd";
> +
> + enable-gpios = <&gpio7 7 0>;
> +
> + port {
> + lcd_in: endpoint {
> + remote-endpoint = <&dpi_out>;
> + };
> + };
> +};
>
The lcd-panel should be a child node of a SPI controller. Maybe this
could be mentioned? Or the example could be more explicit, like:
&mcspi1 {
lcd-panel: panel@0 {
....
};
};
Regards,
Florian
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 0/3] OMAPDSS: DT support for panel-lgphilips-lb035q02
2014-05-15 10:10 [PATCH 0/3] OMAPDSS: DT support for panel-lgphilips-lb035q02 Tomi Valkeinen
` (2 preceding siblings ...)
2014-05-15 10:10 ` [PATCH 3/3] Doc/DT: Add binding doc for lgphilips,lb035q02.txt Tomi Valkeinen
@ 2014-05-20 11:04 ` Florian Vaussard
3 siblings, 0 replies; 8+ messages in thread
From: Florian Vaussard @ 2014-05-20 11:04 UTC (permalink / raw)
To: Tomi Valkeinen, linux-fbdev, linux-omap; +Cc: Archit Taneja
Hi Tomi,
On 05/15/2014 12:10 PM, Tomi Valkeinen wrote:
> Hi,
>
> This adds DT support to panel-lgphilips-lb035q02. Compile tested only.
>
> This panel is used on some Overo boards (alto35, if I'm not mistaken).
>
I tested with the Alto35. Using the small fix for patch 2, I was able to
use the panel. I will post the related DTS changes soon.
Tested-by: Florian Vaussard <florian.vaussard@epfl.ch>
> Tomi
>
> Tomi Valkeinen (3):
> OMAPDSS: panel-lgphilips-lb035q02: use gpiod for enable gpio
> OMAPDSS: panel-lgphilips-lb035q02: Add DT support
> Doc/DT: Add binding doc for lgphilips,lb035q02.txt
>
> .../bindings/video/lgphilips,lb035q02.txt | 33 ++++++++++
> .../omap2/displays-new/panel-lgphilips-lb035q02.c | 76 +++++++++++++++++-----
> 2 files changed, 94 insertions(+), 15 deletions(-)
> create mode 100644 Documentation/devicetree/bindings/video/lgphilips,lb035q02.txt
>
^ permalink raw reply [flat|nested] 8+ messages in thread