Commit 257030d4 authored by Dmitry Torokhov's avatar Dmitry Torokhov Committed by Helge Deller

fbdev: omapfb: connector-hdmi: switch to using gpiod API

Switch the driver from legacy gpio API that is deprecated to the newer
gpiod API that respects line polarities described in ACPI/DT.
Signed-off-by: default avatarDmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: default avatarHelge Deller <deller@gmx.de>
parent 28f24e90
...@@ -6,11 +6,12 @@ ...@@ -6,11 +6,12 @@
* Author: Tomi Valkeinen <tomi.valkeinen@ti.com> * Author: Tomi Valkeinen <tomi.valkeinen@ti.com>
*/ */
#include <linux/err.h>
#include <linux/gpio/consumer.h>
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/platform_device.h> #include <linux/platform_device.h>
#include <linux/of.h> #include <linux/of.h>
#include <linux/of_gpio.h>
#include <drm/drm_edid.h> #include <drm/drm_edid.h>
...@@ -41,7 +42,7 @@ struct panel_drv_data { ...@@ -41,7 +42,7 @@ struct panel_drv_data {
struct omap_video_timings timings; struct omap_video_timings timings;
int hpd_gpio; struct gpio_desc *hpd_gpio;
}; };
#define to_panel_data(x) container_of(x, struct panel_drv_data, dssdev) #define to_panel_data(x) container_of(x, struct panel_drv_data, dssdev)
...@@ -155,8 +156,8 @@ static bool hdmic_detect(struct omap_dss_device *dssdev) ...@@ -155,8 +156,8 @@ static bool hdmic_detect(struct omap_dss_device *dssdev)
struct panel_drv_data *ddata = to_panel_data(dssdev); struct panel_drv_data *ddata = to_panel_data(dssdev);
struct omap_dss_device *in = ddata->in; struct omap_dss_device *in = ddata->in;
if (gpio_is_valid(ddata->hpd_gpio)) if (ddata->hpd_gpio)
return gpio_get_value_cansleep(ddata->hpd_gpio); return gpiod_get_value_cansleep(ddata->hpd_gpio);
else else
return in->ops.hdmi->detect(in); return in->ops.hdmi->detect(in);
} }
...@@ -197,31 +198,6 @@ static struct omap_dss_driver hdmic_driver = { ...@@ -197,31 +198,6 @@ static struct omap_dss_driver hdmic_driver = {
.set_hdmi_infoframe = hdmic_set_infoframe, .set_hdmi_infoframe = hdmic_set_infoframe,
}; };
static int hdmic_probe_of(struct platform_device *pdev)
{
struct panel_drv_data *ddata = platform_get_drvdata(pdev);
struct device_node *node = pdev->dev.of_node;
struct omap_dss_device *in;
int gpio;
/* HPD GPIO */
gpio = of_get_named_gpio(node, "hpd-gpios", 0);
if (gpio_is_valid(gpio))
ddata->hpd_gpio = gpio;
else
ddata->hpd_gpio = -ENODEV;
in = omapdss_of_find_source_for_first_ep(node);
if (IS_ERR(in)) {
dev_err(&pdev->dev, "failed to find video source\n");
return PTR_ERR(in);
}
ddata->in = in;
return 0;
}
static int hdmic_probe(struct platform_device *pdev) static int hdmic_probe(struct platform_device *pdev)
{ {
struct panel_drv_data *ddata; struct panel_drv_data *ddata;
...@@ -238,15 +214,18 @@ static int hdmic_probe(struct platform_device *pdev) ...@@ -238,15 +214,18 @@ static int hdmic_probe(struct platform_device *pdev)
platform_set_drvdata(pdev, ddata); platform_set_drvdata(pdev, ddata);
ddata->dev = &pdev->dev; ddata->dev = &pdev->dev;
r = hdmic_probe_of(pdev); ddata->hpd_gpio = devm_gpiod_get_optional(&pdev->dev, "hpd", GPIOD_IN);
r = PTR_ERR_OR_ZERO(ddata->hpd_gpio);
if (r) if (r)
return r; return r;
if (gpio_is_valid(ddata->hpd_gpio)) { gpiod_set_consumer_name(ddata->hpd_gpio, "hdmi_hpd");
r = devm_gpio_request_one(&pdev->dev, ddata->hpd_gpio,
GPIOF_DIR_IN, "hdmi_hpd"); ddata->in = omapdss_of_find_source_for_first_ep(pdev->dev.of_node);
if (r) r = PTR_ERR_OR_ZERO(ddata->in);
goto err_reg; if (r) {
dev_err(&pdev->dev, "failed to find video source\n");
return r;
} }
ddata->timings = hdmic_default_timings; ddata->timings = hdmic_default_timings;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment