Commit 2228b7cd authored by Andrzej Hajda's avatar Andrzej Hajda Committed by Inki Dae

drm/exynos/hdmi: convert to gpiod API

The patch converts API to gpiod and moves initialization code
to hdmi_resources_init.
Signed-off-by: default avatarAndrzej Hajda <a.hajda@samsung.com>
Signed-off-by: default avatarInki Dae <inki.dae@samsung.com>
parent da5e36ae
...@@ -30,11 +30,11 @@ ...@@ -30,11 +30,11 @@
#include <linux/delay.h> #include <linux/delay.h>
#include <linux/pm_runtime.h> #include <linux/pm_runtime.h>
#include <linux/clk.h> #include <linux/clk.h>
#include <linux/gpio/consumer.h>
#include <linux/regulator/consumer.h> #include <linux/regulator/consumer.h>
#include <linux/io.h> #include <linux/io.h>
#include <linux/of_address.h> #include <linux/of_address.h>
#include <linux/of_device.h> #include <linux/of_device.h>
#include <linux/of_gpio.h>
#include <linux/hdmi.h> #include <linux/hdmi.h>
#include <linux/component.h> #include <linux/component.h>
#include <linux/mfd/syscon.h> #include <linux/mfd/syscon.h>
...@@ -46,8 +46,6 @@ ...@@ -46,8 +46,6 @@
#include "exynos_drm_crtc.h" #include "exynos_drm_crtc.h"
#include "exynos_mixer.h" #include "exynos_mixer.h"
#include <linux/gpio.h>
#define ctx_from_connector(c) container_of(c, struct hdmi_context, connector) #define ctx_from_connector(c) container_of(c, struct hdmi_context, connector)
#define HOTPLUG_DEBOUNCE_MS 1100 #define HOTPLUG_DEBOUNCE_MS 1100
...@@ -129,7 +127,7 @@ struct hdmi_context { ...@@ -129,7 +127,7 @@ struct hdmi_context {
struct hdmi_resources res; struct hdmi_resources res;
const struct hdmi_driver_data *drv_data; const struct hdmi_driver_data *drv_data;
int hpd_gpio; struct gpio_desc *hpd_gpio;
void __iomem *regs_hdmiphy; void __iomem *regs_hdmiphy;
struct regmap *pmureg; struct regmap *pmureg;
...@@ -949,7 +947,7 @@ static enum drm_connector_status hdmi_detect(struct drm_connector *connector, ...@@ -949,7 +947,7 @@ static enum drm_connector_status hdmi_detect(struct drm_connector *connector,
{ {
struct hdmi_context *hdata = ctx_from_connector(connector); struct hdmi_context *hdata = ctx_from_connector(connector);
if (gpio_get_value(hdata->hpd_gpio)) if (gpiod_get_value(hdata->hpd_gpio))
return connector_status_connected; return connector_status_connected;
return connector_status_disconnected; return connector_status_disconnected;
...@@ -1748,6 +1746,17 @@ static int hdmi_resources_init(struct hdmi_context *hdata) ...@@ -1748,6 +1746,17 @@ static int hdmi_resources_init(struct hdmi_context *hdata)
DRM_DEBUG_KMS("HDMI resource init\n"); DRM_DEBUG_KMS("HDMI resource init\n");
hdata->hpd_gpio = devm_gpiod_get(dev, "hpd", GPIOD_IN);
if (IS_ERR(hdata->hpd_gpio)) {
DRM_ERROR("cannot get hpd gpio property\n");
return PTR_ERR(hdata->hpd_gpio);
}
hdata->irq = gpiod_to_irq(hdata->hpd_gpio);
if (hdata->irq < 0) {
DRM_ERROR("failed to get GPIO irq\n");
return hdata->irq;
}
/* get clocks, power */ /* get clocks, power */
res->hdmi = devm_clk_get(dev, "hdmi"); res->hdmi = devm_clk_get(dev, "hdmi");
if (IS_ERR(res->hdmi)) { if (IS_ERR(res->hdmi)) {
...@@ -1909,11 +1918,6 @@ static int hdmi_probe(struct platform_device *pdev) ...@@ -1909,11 +1918,6 @@ static int hdmi_probe(struct platform_device *pdev)
platform_set_drvdata(pdev, hdata); platform_set_drvdata(pdev, hdata);
hdata->dev = dev; hdata->dev = dev;
hdata->hpd_gpio = of_get_named_gpio(dev->of_node, "hpd-gpio", 0);
if (hdata->hpd_gpio < 0) {
DRM_ERROR("cannot get hpd gpio property\n");
return hdata->hpd_gpio;
}
ret = hdmi_resources_init(hdata); ret = hdmi_resources_init(hdata);
if (ret) { if (ret) {
...@@ -1928,12 +1932,6 @@ static int hdmi_probe(struct platform_device *pdev) ...@@ -1928,12 +1932,6 @@ static int hdmi_probe(struct platform_device *pdev)
return ret; return ret;
} }
ret = devm_gpio_request(dev, hdata->hpd_gpio, "HPD");
if (ret) {
DRM_ERROR("failed to request HPD gpio\n");
return ret;
}
ddc_node = hdmi_legacy_ddc_dt_binding(dev); ddc_node = hdmi_legacy_ddc_dt_binding(dev);
if (ddc_node) if (ddc_node)
goto out_get_ddc_adpt; goto out_get_ddc_adpt;
...@@ -1981,13 +1979,6 @@ static int hdmi_probe(struct platform_device *pdev) ...@@ -1981,13 +1979,6 @@ static int hdmi_probe(struct platform_device *pdev)
} }
} }
hdata->irq = gpio_to_irq(hdata->hpd_gpio);
if (hdata->irq < 0) {
DRM_ERROR("failed to get GPIO irq\n");
ret = hdata->irq;
goto err_hdmiphy;
}
INIT_DELAYED_WORK(&hdata->hotplug_work, hdmi_hotplug_work_func); INIT_DELAYED_WORK(&hdata->hotplug_work, hdmi_hotplug_work_func);
ret = devm_request_threaded_irq(dev, hdata->irq, NULL, ret = devm_request_threaded_irq(dev, hdata->irq, NULL,
......
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