* [PATCH 5/5] fbdev: omap2: panel-dpi: allow specification of a vcc regulator
@ 2015-12-10 13:11 Uwe Kleine-König
2015-12-16 17:38 ` Tomi Valkeinen
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Uwe Kleine-König @ 2015-12-10 13:11 UTC (permalink / raw)
To: linux-fbdev
From: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
To allow supporting displays that need some logic to enable power to the
display add support for a vcc-supply property to drive a regulator.
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
Documentation/devicetree/bindings/video/panel-dpi.txt | 1 +
drivers/video/fbdev/omap2/displays-new/panel-dpi.c | 13 +++++++++++++
2 files changed, 14 insertions(+)
diff --git a/Documentation/devicetree/bindings/video/panel-dpi.txt b/Documentation/devicetree/bindings/video/panel-dpi.txt
index 1a1d8f6f884f..eaa39d1b1279 100644
--- a/Documentation/devicetree/bindings/video/panel-dpi.txt
+++ b/Documentation/devicetree/bindings/video/panel-dpi.txt
@@ -8,6 +8,7 @@ Optional properties:
- label: a symbolic name for the panel
- enable-gpios: panel enable gpio
- reset-gpios: GPIO to control the RESET pin
+- vcc-supply: phandle of regulator that will be used to enable power to the display
Required nodes:
- "panel-timing" containing video timings
diff --git a/drivers/video/fbdev/omap2/displays-new/panel-dpi.c b/drivers/video/fbdev/omap2/displays-new/panel-dpi.c
index 7e2f9e0813dc..65c6d9e6862b 100644
--- a/drivers/video/fbdev/omap2/displays-new/panel-dpi.c
+++ b/drivers/video/fbdev/omap2/displays-new/panel-dpi.c
@@ -15,6 +15,7 @@
#include <linux/slab.h>
#include <linux/of.h>
#include <linux/of_gpio.h>
+#include <linux/regulator/consumer.h>
#include <video/omapdss.h>
#include <video/omap-panel-data.h>
@@ -33,6 +34,7 @@ struct panel_drv_data {
struct gpio_desc *enable_gpio;
struct gpio_desc *reset_gpio;
+ struct regulator *vcc_supply;
};
#define to_panel_data(p) container_of(p, struct panel_drv_data, dssdev)
@@ -84,6 +86,12 @@ static int panel_dpi_enable(struct omap_dss_device *dssdev)
if (r)
return r;
+ r = regulator_enable(ddata->vcc_supply);
+ if (r) {
+ in->ops.dpi->disable(in);
+ return r;
+ }
+
gpiod_set_value_cansleep(ddata->reset_gpio, 0);
gpiod_set_value_cansleep(ddata->enable_gpio, 1);
@@ -107,6 +115,7 @@ static void panel_dpi_disable(struct omap_dss_device *dssdev)
gpio_set_value_cansleep(ddata->backlight_gpio, 0);
gpiod_set_value_cansleep(ddata->enable_gpio, 0);
+ regulator_disable(ddata->vcc_supply);
in->ops.dpi->disable(in);
@@ -218,6 +227,10 @@ static int panel_dpi_probe_of(struct platform_device *pdev)
if (IS_ERR(ddata->reset_gpio))
return PTR_ERR(ddata->reset_gpio);
+ ddata->vcc_supply = devm_regulator_get(&pdev->dev, "vcc");
+ if (IS_ERR(ddata->vcc_supply))
+ return PTR_ERR(ddata->vcc_supply);
+
ddata->backlight_gpio = -ENOENT;
r = of_get_display_timing(node, "panel-timing", &timing);
--
2.6.2
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH 5/5] fbdev: omap2: panel-dpi: allow specification of a vcc regulator
2015-12-10 13:11 [PATCH 5/5] fbdev: omap2: panel-dpi: allow specification of a vcc regulator Uwe Kleine-König
@ 2015-12-16 17:38 ` Tomi Valkeinen
2015-12-19 20:41 ` Adam Ford
2015-12-23 8:32 ` Tomi Valkeinen
2 siblings, 0 replies; 4+ messages in thread
From: Tomi Valkeinen @ 2015-12-16 17:38 UTC (permalink / raw)
To: linux-fbdev
[-- Attachment #1: Type: text/plain, Size: 3183 bytes --]
On 10/12/15 15:11, Uwe Kleine-König wrote:
> From: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
>
> To allow supporting displays that need some logic to enable power to the
> display add support for a vcc-supply property to drive a regulator.
>
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
> ---
> Documentation/devicetree/bindings/video/panel-dpi.txt | 1 +
> drivers/video/fbdev/omap2/displays-new/panel-dpi.c | 13 +++++++++++++
> 2 files changed, 14 insertions(+)
Same comments here about the bindings.
> diff --git a/Documentation/devicetree/bindings/video/panel-dpi.txt b/Documentation/devicetree/bindings/video/panel-dpi.txt
> index 1a1d8f6f884f..eaa39d1b1279 100644
> --- a/Documentation/devicetree/bindings/video/panel-dpi.txt
> +++ b/Documentation/devicetree/bindings/video/panel-dpi.txt
> @@ -8,6 +8,7 @@ Optional properties:
> - label: a symbolic name for the panel
> - enable-gpios: panel enable gpio
> - reset-gpios: GPIO to control the RESET pin
> +- vcc-supply: phandle of regulator that will be used to enable power to the display
>
> Required nodes:
> - "panel-timing" containing video timings
> diff --git a/drivers/video/fbdev/omap2/displays-new/panel-dpi.c b/drivers/video/fbdev/omap2/displays-new/panel-dpi.c
> index 7e2f9e0813dc..65c6d9e6862b 100644
> --- a/drivers/video/fbdev/omap2/displays-new/panel-dpi.c
> +++ b/drivers/video/fbdev/omap2/displays-new/panel-dpi.c
> @@ -15,6 +15,7 @@
> #include <linux/slab.h>
> #include <linux/of.h>
> #include <linux/of_gpio.h>
> +#include <linux/regulator/consumer.h>
>
> #include <video/omapdss.h>
> #include <video/omap-panel-data.h>
> @@ -33,6 +34,7 @@ struct panel_drv_data {
>
> struct gpio_desc *enable_gpio;
> struct gpio_desc *reset_gpio;
> + struct regulator *vcc_supply;
> };
>
> #define to_panel_data(p) container_of(p, struct panel_drv_data, dssdev)
> @@ -84,6 +86,12 @@ static int panel_dpi_enable(struct omap_dss_device *dssdev)
> if (r)
> return r;
>
> + r = regulator_enable(ddata->vcc_supply);
> + if (r) {
> + in->ops.dpi->disable(in);
> + return r;
> + }
> +
> gpiod_set_value_cansleep(ddata->reset_gpio, 0);
> gpiod_set_value_cansleep(ddata->enable_gpio, 1);
>
> @@ -107,6 +115,7 @@ static void panel_dpi_disable(struct omap_dss_device *dssdev)
> gpio_set_value_cansleep(ddata->backlight_gpio, 0);
>
> gpiod_set_value_cansleep(ddata->enable_gpio, 0);
> + regulator_disable(ddata->vcc_supply);
>
> in->ops.dpi->disable(in);
>
> @@ -218,6 +227,10 @@ static int panel_dpi_probe_of(struct platform_device *pdev)
> if (IS_ERR(ddata->reset_gpio))
> return PTR_ERR(ddata->reset_gpio);
>
> + ddata->vcc_supply = devm_regulator_get(&pdev->dev, "vcc");
> + if (IS_ERR(ddata->vcc_supply))
> + return PTR_ERR(ddata->vcc_supply);
> +
> ddata->backlight_gpio = -ENOENT;
>
> r = of_get_display_timing(node, "panel-timing", &timing);
Some panels might need to sleep before/after the regulator, but the same
goes for enable gpio. And we don't have a sane way to handle that at the
moment, so I think this is fine.
Tomi
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 5/5] fbdev: omap2: panel-dpi: allow specification of a vcc regulator
2015-12-10 13:11 [PATCH 5/5] fbdev: omap2: panel-dpi: allow specification of a vcc regulator Uwe Kleine-König
2015-12-16 17:38 ` Tomi Valkeinen
@ 2015-12-19 20:41 ` Adam Ford
2015-12-23 8:32 ` Tomi Valkeinen
2 siblings, 0 replies; 4+ messages in thread
From: Adam Ford @ 2015-12-19 20:41 UTC (permalink / raw)
To: linux-fbdev
Tomi,
Do you have any thought on how to approach adding sleep/delay
functions? I have a display that requires a small delay before and
after the enable gpio toggle. I assume that some may require a delay
after the regulator starts for it to be be ready. For now I have a
temp hack that just inserts a blanket 300mS wait, but I'd rather have
something mainstreamed in the device tree, but I don't want to walk
over someone else's work either.
I'd love to help if you have an idea of how you vision it.
adam
On Wed, Dec 16, 2015 at 11:38 AM, Tomi Valkeinen <tomi.valkeinen@ti.com> wrote:
>
>
> On 10/12/15 15:11, Uwe Kleine-König wrote:
>> From: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
>>
>> To allow supporting displays that need some logic to enable power to the
>> display add support for a vcc-supply property to drive a regulator.
>>
>> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
>> ---
>> Documentation/devicetree/bindings/video/panel-dpi.txt | 1 +
>> drivers/video/fbdev/omap2/displays-new/panel-dpi.c | 13 +++++++++++++
>> 2 files changed, 14 insertions(+)
>
> Same comments here about the bindings.
>
>> diff --git a/Documentation/devicetree/bindings/video/panel-dpi.txt b/Documentation/devicetree/bindings/video/panel-dpi.txt
>> index 1a1d8f6f884f..eaa39d1b1279 100644
>> --- a/Documentation/devicetree/bindings/video/panel-dpi.txt
>> +++ b/Documentation/devicetree/bindings/video/panel-dpi.txt
>> @@ -8,6 +8,7 @@ Optional properties:
>> - label: a symbolic name for the panel
>> - enable-gpios: panel enable gpio
>> - reset-gpios: GPIO to control the RESET pin
>> +- vcc-supply: phandle of regulator that will be used to enable power to the display
>>
>> Required nodes:
>> - "panel-timing" containing video timings
>> diff --git a/drivers/video/fbdev/omap2/displays-new/panel-dpi.c b/drivers/video/fbdev/omap2/displays-new/panel-dpi.c
>> index 7e2f9e0813dc..65c6d9e6862b 100644
>> --- a/drivers/video/fbdev/omap2/displays-new/panel-dpi.c
>> +++ b/drivers/video/fbdev/omap2/displays-new/panel-dpi.c
>> @@ -15,6 +15,7 @@
>> #include <linux/slab.h>
>> #include <linux/of.h>
>> #include <linux/of_gpio.h>
>> +#include <linux/regulator/consumer.h>
>>
>> #include <video/omapdss.h>
>> #include <video/omap-panel-data.h>
>> @@ -33,6 +34,7 @@ struct panel_drv_data {
>>
>> struct gpio_desc *enable_gpio;
>> struct gpio_desc *reset_gpio;
>> + struct regulator *vcc_supply;
>> };
>>
>> #define to_panel_data(p) container_of(p, struct panel_drv_data, dssdev)
>> @@ -84,6 +86,12 @@ static int panel_dpi_enable(struct omap_dss_device *dssdev)
>> if (r)
>> return r;
>>
>> + r = regulator_enable(ddata->vcc_supply);
>> + if (r) {
>> + in->ops.dpi->disable(in);
>> + return r;
>> + }
>> +
>> gpiod_set_value_cansleep(ddata->reset_gpio, 0);
>> gpiod_set_value_cansleep(ddata->enable_gpio, 1);
>>
>> @@ -107,6 +115,7 @@ static void panel_dpi_disable(struct omap_dss_device *dssdev)
>> gpio_set_value_cansleep(ddata->backlight_gpio, 0);
>>
>> gpiod_set_value_cansleep(ddata->enable_gpio, 0);
>> + regulator_disable(ddata->vcc_supply);
>>
>> in->ops.dpi->disable(in);
>>
>> @@ -218,6 +227,10 @@ static int panel_dpi_probe_of(struct platform_device *pdev)
>> if (IS_ERR(ddata->reset_gpio))
>> return PTR_ERR(ddata->reset_gpio);
>>
>> + ddata->vcc_supply = devm_regulator_get(&pdev->dev, "vcc");
>> + if (IS_ERR(ddata->vcc_supply))
>> + return PTR_ERR(ddata->vcc_supply);
>> +
>> ddata->backlight_gpio = -ENOENT;
>>
>> r = of_get_display_timing(node, "panel-timing", &timing);
>
> Some panels might need to sleep before/after the regulator, but the same
> goes for enable gpio. And we don't have a sane way to handle that at the
> moment, so I think this is fine.
>
> Tomi
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 5/5] fbdev: omap2: panel-dpi: allow specification of a vcc regulator
2015-12-10 13:11 [PATCH 5/5] fbdev: omap2: panel-dpi: allow specification of a vcc regulator Uwe Kleine-König
2015-12-16 17:38 ` Tomi Valkeinen
2015-12-19 20:41 ` Adam Ford
@ 2015-12-23 8:32 ` Tomi Valkeinen
2 siblings, 0 replies; 4+ messages in thread
From: Tomi Valkeinen @ 2015-12-23 8:32 UTC (permalink / raw)
To: linux-fbdev
[-- Attachment #1: Type: text/plain, Size: 1169 bytes --]
Hi,
On 19/12/15 22:41, Adam Ford wrote:
> Tomi,
>
> Do you have any thought on how to approach adding sleep/delay
> functions? I have a display that requires a small delay before and
> after the enable gpio toggle. I assume that some may require a delay
> after the regulator starts for it to be be ready. For now I have a
> temp hack that just inserts a blanket 300mS wait, but I'd rather have
> something mainstreamed in the device tree, but I don't want to walk
> over someone else's work either.
I don't think it makes sense to add explicit entries for these, as we'd
just end up with lots of entries in the DT files for "wait-before-vcc",
"wait-after-vcc", etc.
There was a patch series some time ago, trying to add generic power
up/down sequences defined in DT. I don't think that ever got merged, as
there wasn't a consensus on the DT side. I can't find the series right
now, as I don't remember the author or the subject...
I think that kind of generic sequence framework would make sense, and
getting it merged without the DT side should be easier. Then the drivers
could have built-in sequences for certain panels.
Tomi
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2015-12-23 8:32 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-12-10 13:11 [PATCH 5/5] fbdev: omap2: panel-dpi: allow specification of a vcc regulator Uwe Kleine-König
2015-12-16 17:38 ` Tomi Valkeinen
2015-12-19 20:41 ` Adam Ford
2015-12-23 8:32 ` Tomi Valkeinen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).