Commit 2b768132 authored by Daniel Kurtz's avatar Daniel Kurtz Committed by Inki Dae

drm/exynos: hdmi: remove the i2c drivers and use

The i2c client was previously being passed into the hdmi driver via a
dedicated i2c driver, and then a global variable. This patch removes all
of that and just uses the device tree to get the i2c_client. This patch
also properly references the client so we don't lose it before we're
done with it.
Signed-off-by: default avatarDaniel Kurtz <djkurtz@chromium.org>
[seanpaul changed to phandle lookup instead of using of node name]
Signed-off-by: default avatarSean Paul <seanpaul@chromium.org>
Signed-off-by: default avatarInki Dae <inki.dae@samsung.com>
parent 080be03d
...@@ -25,6 +25,9 @@ Required properties: ...@@ -25,6 +25,9 @@ Required properties:
sclk_pixel. sclk_pixel.
- clock-names: aliases as per driver requirements for above clock IDs: - clock-names: aliases as per driver requirements for above clock IDs:
"hdmi", "sclk_hdmi", "sclk_pixel", "sclk_hdmiphy" and "mout_hdmi". "hdmi", "sclk_hdmi", "sclk_pixel", "sclk_hdmiphy" and "mout_hdmi".
- ddc: phandle to the hdmi ddc node
- phy: phandle to the hdmi phy node
Example: Example:
hdmi { hdmi {
...@@ -32,4 +35,6 @@ Example: ...@@ -32,4 +35,6 @@ Example:
reg = <0x14530000 0x100000>; reg = <0x14530000 0x100000>;
interrupts = <0 95 0>; interrupts = <0 95 0>;
hpd-gpio = <&gpx3 7 1>; hpd-gpio = <&gpx3 7 1>;
ddc = <&hdmi_ddc_node>;
phy = <&hdmi_phy_node>;
}; };
...@@ -12,7 +12,6 @@ exynosdrm-$(CONFIG_DRM_EXYNOS_IOMMU) += exynos_drm_iommu.o ...@@ -12,7 +12,6 @@ exynosdrm-$(CONFIG_DRM_EXYNOS_IOMMU) += exynos_drm_iommu.o
exynosdrm-$(CONFIG_DRM_EXYNOS_DMABUF) += exynos_drm_dmabuf.o exynosdrm-$(CONFIG_DRM_EXYNOS_DMABUF) += exynos_drm_dmabuf.o
exynosdrm-$(CONFIG_DRM_EXYNOS_FIMD) += exynos_drm_fimd.o exynosdrm-$(CONFIG_DRM_EXYNOS_FIMD) += exynos_drm_fimd.o
exynosdrm-$(CONFIG_DRM_EXYNOS_HDMI) += exynos_hdmi.o exynos_mixer.o \ exynosdrm-$(CONFIG_DRM_EXYNOS_HDMI) += exynos_hdmi.o exynos_mixer.o \
exynos_ddc.o exynos_hdmiphy.o \
exynos_drm_hdmi.o exynos_drm_hdmi.o
exynosdrm-$(CONFIG_DRM_EXYNOS_VIDI) += exynos_drm_vidi.o exynosdrm-$(CONFIG_DRM_EXYNOS_VIDI) += exynos_drm_vidi.o
exynosdrm-$(CONFIG_DRM_EXYNOS_G2D) += exynos_drm_g2d.o exynosdrm-$(CONFIG_DRM_EXYNOS_G2D) += exynos_drm_g2d.o
......
...@@ -33,6 +33,7 @@ ...@@ -33,6 +33,7 @@
#include <linux/regulator/consumer.h> #include <linux/regulator/consumer.h>
#include <linux/io.h> #include <linux/io.h>
#include <linux/of.h> #include <linux/of.h>
#include <linux/i2c.h>
#include <linux/of_gpio.h> #include <linux/of_gpio.h>
#include <linux/hdmi.h> #include <linux/hdmi.h>
...@@ -41,8 +42,6 @@ ...@@ -41,8 +42,6 @@
#include "exynos_drm_drv.h" #include "exynos_drm_drv.h"
#include "exynos_drm_hdmi.h" #include "exynos_drm_hdmi.h"
#include "exynos_hdmi.h"
#include <linux/gpio.h> #include <linux/gpio.h>
#include <media/s5p_hdmi.h> #include <media/s5p_hdmi.h>
...@@ -1907,20 +1906,6 @@ static int hdmi_resources_init(struct hdmi_context *hdata) ...@@ -1907,20 +1906,6 @@ static int hdmi_resources_init(struct hdmi_context *hdata)
return -ENODEV; return -ENODEV;
} }
static struct i2c_client *hdmi_ddc, *hdmi_hdmiphy;
void hdmi_attach_ddc_client(struct i2c_client *ddc)
{
if (ddc)
hdmi_ddc = ddc;
}
void hdmi_attach_hdmiphy_client(struct i2c_client *hdmiphy)
{
if (hdmiphy)
hdmi_hdmiphy = hdmiphy;
}
static struct s5p_hdmi_platform_data *drm_hdmi_dt_parse_pdata static struct s5p_hdmi_platform_data *drm_hdmi_dt_parse_pdata
(struct device *dev) (struct device *dev)
{ {
...@@ -1965,6 +1950,7 @@ static int hdmi_probe(struct platform_device *pdev) ...@@ -1965,6 +1950,7 @@ static int hdmi_probe(struct platform_device *pdev)
struct s5p_hdmi_platform_data *pdata; struct s5p_hdmi_platform_data *pdata;
struct resource *res; struct resource *res;
const struct of_device_id *match; const struct of_device_id *match;
struct device_node *ddc_node, *phy_node;
int ret; int ret;
if (!dev->of_node) if (!dev->of_node)
...@@ -2015,21 +2001,30 @@ static int hdmi_probe(struct platform_device *pdev) ...@@ -2015,21 +2001,30 @@ static int hdmi_probe(struct platform_device *pdev)
} }
/* DDC i2c driver */ /* DDC i2c driver */
if (i2c_add_driver(&ddc_driver)) { ddc_node = of_parse_phandle(dev->of_node, "ddc", 0);
DRM_ERROR("failed to register ddc i2c driver\n"); if (!ddc_node) {
return -ENOENT; DRM_ERROR("Failed to find ddc node in device tree\n");
return -ENODEV;
}
hdata->ddc_port = of_find_i2c_device_by_node(ddc_node);
if (!hdata->ddc_port) {
DRM_ERROR("Failed to get ddc i2c client by node\n");
return -ENODEV;
} }
hdata->ddc_port = hdmi_ddc;
/* hdmiphy i2c driver */ /* hdmiphy i2c driver */
if (i2c_add_driver(&hdmiphy_driver)) { phy_node = of_parse_phandle(dev->of_node, "phy", 0);
DRM_ERROR("failed to register hdmiphy i2c driver\n"); if (!phy_node) {
ret = -ENOENT; DRM_ERROR("Failed to find hdmiphy node in device tree\n");
ret = -ENODEV;
goto err_ddc;
}
hdata->hdmiphy_port = of_find_i2c_device_by_node(phy_node);
if (!hdata->hdmiphy_port) {
DRM_ERROR("Failed to get hdmi phy i2c client from node\n");
ret = -ENODEV;
goto err_ddc; goto err_ddc;
} }
hdata->hdmiphy_port = hdmi_hdmiphy;
hdata->irq = gpio_to_irq(hdata->hpd_gpio); hdata->irq = gpio_to_irq(hdata->hpd_gpio);
if (hdata->irq < 0) { if (hdata->irq < 0) {
...@@ -2060,22 +2055,22 @@ static int hdmi_probe(struct platform_device *pdev) ...@@ -2060,22 +2055,22 @@ static int hdmi_probe(struct platform_device *pdev)
return 0; return 0;
err_hdmiphy: err_hdmiphy:
i2c_del_driver(&hdmiphy_driver); put_device(&hdata->hdmiphy_port->dev);
err_ddc: err_ddc:
i2c_del_driver(&ddc_driver); put_device(&hdata->ddc_port->dev);
return ret; return ret;
} }
static int hdmi_remove(struct platform_device *pdev) static int hdmi_remove(struct platform_device *pdev)
{ {
struct device *dev = &pdev->dev; struct device *dev = &pdev->dev;
struct exynos_drm_hdmi_context *ctx = get_hdmi_context(dev);
struct hdmi_context *hdata = ctx->ctx;
pm_runtime_disable(dev); pm_runtime_disable(dev);
/* hdmiphy i2c driver */ put_device(&hdata->hdmiphy_port->dev);
i2c_del_driver(&hdmiphy_driver); put_device(&hdata->ddc_port->dev);
/* DDC i2c driver */
i2c_del_driver(&ddc_driver);
return 0; return 0;
} }
......
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