* [PATCH] drm/tilcdc: panel: make better use of gpiod API
@ 2015-06-09 9:43 Uwe Kleine-König
2015-06-10 2:25 ` Alexandre Courbot
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: Uwe Kleine-König @ 2015-06-09 9:43 UTC (permalink / raw)
To: David Airlie; +Cc: dri-devel, kernel, Ezequiel Garcia
Since 39b2bbe3d715 (gpio: add flags argument to gpiod_get*() functions)
which appeared in v3.17-rc1, the gpiod_get* functions take an additional
parameter that allows to specify direction and initial value for output.
Furthermore there is devm_gpiod_get_optional which is designed to get
optional gpios.
Simplify driver accordingly.
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
drivers/gpu/drm/tilcdc/tilcdc_panel.c | 22 +++++++---------------
1 file changed, 7 insertions(+), 15 deletions(-)
diff --git a/drivers/gpu/drm/tilcdc/tilcdc_panel.c b/drivers/gpu/drm/tilcdc/tilcdc_panel.c
index 7a0315855e90..0af8bed7ce1e 100644
--- a/drivers/gpu/drm/tilcdc/tilcdc_panel.c
+++ b/drivers/gpu/drm/tilcdc/tilcdc_panel.c
@@ -375,25 +375,17 @@ static int panel_probe(struct platform_device *pdev)
dev_info(&pdev->dev, "found backlight\n");
}
- panel_mod->enable_gpio = devm_gpiod_get(&pdev->dev, "enable");
+ panel_mod->enable_gpio = devm_gpiod_get_optional(&pdev->dev, "enable",
+ GPIOD_OUT_LOW);
if (IS_ERR(panel_mod->enable_gpio)) {
ret = PTR_ERR(panel_mod->enable_gpio);
- if (ret != -ENOENT) {
- dev_err(&pdev->dev, "failed to request enable GPIO\n");
- goto fail_backlight;
- }
-
- /* Optional GPIO is not here, continue silently. */
- panel_mod->enable_gpio = NULL;
- } else {
- ret = gpiod_direction_output(panel_mod->enable_gpio, 0);
- if (ret < 0) {
- dev_err(&pdev->dev, "failed to setup GPIO\n");
- goto fail_backlight;
- }
- dev_info(&pdev->dev, "found enable GPIO\n");
+ dev_err(&pdev->dev, "failed to request enable GPIO\n");
+ goto fail_backlight;
}
+ if (panel_mod->enable_gpio)
+ dev_info(&pdev->dev, "found enable GPIO\n");
+
mod = &panel_mod->base;
pdev->dev.platform_data = mod;
--
2.1.4
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH] drm/tilcdc: panel: make better use of gpiod API
2015-06-09 9:43 [PATCH] drm/tilcdc: panel: make better use of gpiod API Uwe Kleine-König
@ 2015-06-10 2:25 ` Alexandre Courbot
2015-06-10 6:59 ` Uwe Kleine-König
2015-06-10 13:04 ` Linus Walleij
2015-06-15 21:11 ` Uwe Kleine-König
2 siblings, 1 reply; 6+ messages in thread
From: Alexandre Courbot @ 2015-06-10 2:25 UTC (permalink / raw)
To: Uwe Kleine-König, David Airlie; +Cc: dri-devel, kernel, Ezequiel Garcia
On 06/09/2015 06:43 PM, Uwe Kleine-König wrote:
> Since 39b2bbe3d715 (gpio: add flags argument to gpiod_get*() functions)
> which appeared in v3.17-rc1, the gpiod_get* functions take an additional
> parameter that allows to specify direction and initial value for output.
>
> Furthermore there is devm_gpiod_get_optional which is designed to get
> optional gpios.
>
> Simplify driver accordingly.
Nice!
Acked-by: Alexandre Courbot <acourbot@nvidia.com>
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] drm/tilcdc: panel: make better use of gpiod API
2015-06-10 2:25 ` Alexandre Courbot
@ 2015-06-10 6:59 ` Uwe Kleine-König
2015-06-10 7:01 ` Alexandre Courbot
0 siblings, 1 reply; 6+ messages in thread
From: Uwe Kleine-König @ 2015-06-10 6:59 UTC (permalink / raw)
To: Alexandre Courbot; +Cc: dri-devel, kernel, Ezequiel Garcia
On Wed, Jun 10, 2015 at 11:25:25AM +0900, Alexandre Courbot wrote:
> On 06/09/2015 06:43 PM, Uwe Kleine-König wrote:
> >Since 39b2bbe3d715 (gpio: add flags argument to gpiod_get*() functions)
> >which appeared in v3.17-rc1, the gpiod_get* functions take an additional
> >parameter that allows to specify direction and initial value for output.
> >
> >Furthermore there is devm_gpiod_get_optional which is designed to get
> >optional gpios.
> >
> >Simplify driver accordingly.
>
> Nice!
>
> Acked-by: Alexandre Courbot <acourbot@nvidia.com>
By the way, my tree based on 4.1-rc7 has all instances fixed and I sent
out all required patches. So I'd say we can make the flags argument
mandatory for 4.3.
Best regards
Uwe
--
Pengutronix e.K. | Uwe Kleine-König |
Industrial Linux Solutions | http://www.pengutronix.de/ |
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] drm/tilcdc: panel: make better use of gpiod API
2015-06-10 6:59 ` Uwe Kleine-König
@ 2015-06-10 7:01 ` Alexandre Courbot
0 siblings, 0 replies; 6+ messages in thread
From: Alexandre Courbot @ 2015-06-10 7:01 UTC (permalink / raw)
To: Uwe Kleine-König; +Cc: dri-devel, kernel, Ezequiel Garcia
On 06/10/2015 03:59 PM, Uwe Kleine-König wrote:
> On Wed, Jun 10, 2015 at 11:25:25AM +0900, Alexandre Courbot wrote:
>> On 06/09/2015 06:43 PM, Uwe Kleine-König wrote:
>>> Since 39b2bbe3d715 (gpio: add flags argument to gpiod_get*() functions)
>>> which appeared in v3.17-rc1, the gpiod_get* functions take an additional
>>> parameter that allows to specify direction and initial value for output.
>>>
>>> Furthermore there is devm_gpiod_get_optional which is designed to get
>>> optional gpios.
>>>
>>> Simplify driver accordingly.
>>
>> Nice!
>>
>> Acked-by: Alexandre Courbot <acourbot@nvidia.com>
> By the way, my tree based on 4.1-rc7 has all instances fixed and I sent
> out all required patches. So I'd say we can make the flags argument
> mandatory for 4.3.
Great, let's go for it then! Feel free to send a patch removing the
hackish macros once things are clean in -next.
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] drm/tilcdc: panel: make better use of gpiod API
2015-06-09 9:43 [PATCH] drm/tilcdc: panel: make better use of gpiod API Uwe Kleine-König
2015-06-10 2:25 ` Alexandre Courbot
@ 2015-06-10 13:04 ` Linus Walleij
2015-06-15 21:11 ` Uwe Kleine-König
2 siblings, 0 replies; 6+ messages in thread
From: Linus Walleij @ 2015-06-10 13:04 UTC (permalink / raw)
To: Uwe Kleine-König
Cc: open list:DRM PANEL DRIVERS, Sascha Hauer, Ezequiel Garcia
On Tue, Jun 9, 2015 at 11:43 AM, Uwe Kleine-König
<u.kleine-koenig@pengutronix.de> wrote:
> Since 39b2bbe3d715 (gpio: add flags argument to gpiod_get*() functions)
> which appeared in v3.17-rc1, the gpiod_get* functions take an additional
> parameter that allows to specify direction and initial value for output.
>
> Furthermore there is devm_gpiod_get_optional which is designed to get
> optional gpios.
>
> Simplify driver accordingly.
>
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Acked-by: Linus Walleij <linus.walleij@linaro.org>
Yours,
Linus Walleij
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] drm/tilcdc: panel: make better use of gpiod API
2015-06-09 9:43 [PATCH] drm/tilcdc: panel: make better use of gpiod API Uwe Kleine-König
2015-06-10 2:25 ` Alexandre Courbot
2015-06-10 13:04 ` Linus Walleij
@ 2015-06-15 21:11 ` Uwe Kleine-König
2 siblings, 0 replies; 6+ messages in thread
From: Uwe Kleine-König @ 2015-06-15 21:11 UTC (permalink / raw)
To: David Airlie; +Cc: dri-devel, kernel, Ezequiel Garcia
Hello,
On Tue, Jun 09, 2015 at 11:43:02AM +0200, Uwe Kleine-König wrote:
> Since 39b2bbe3d715 (gpio: add flags argument to gpiod_get*() functions)
> which appeared in v3.17-rc1, the gpiod_get* functions take an additional
> parameter that allows to specify direction and initial value for output.
>
> Furthermore there is devm_gpiod_get_optional which is designed to get
> optional gpios.
>
> Simplify driver accordingly.
>
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Same question as for the drm/msm/dp patch:
I intend to make the flags parameter mandatory for 4.3. So if this patch
doesn't make it in for 4.2-rc1 I'd like to take it as part of the
respective gpio change via the gpio tree.
What's your plan regarding this change?
Best regards
Uwe
--
Pengutronix e.K. | Uwe Kleine-König |
Industrial Linux Solutions | http://www.pengutronix.de/ |
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2015-06-15 21:11 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-06-09 9:43 [PATCH] drm/tilcdc: panel: make better use of gpiod API Uwe Kleine-König
2015-06-10 2:25 ` Alexandre Courbot
2015-06-10 6:59 ` Uwe Kleine-König
2015-06-10 7:01 ` Alexandre Courbot
2015-06-10 13:04 ` Linus Walleij
2015-06-15 21:11 ` Uwe Kleine-König
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.