aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/exynos/exynos_hdmi.c
diff options
context:
space:
mode:
authorDaniel Kurtz <djkurtz@chromium.org>2014-02-24 04:52:51 -0500
committerInki Dae <daeinki@gmail.com>2014-03-23 11:36:32 -0400
commit2b7681326dc2c6669302b086400bd64af2ff8a4f (patch)
tree6d698d120893d2b8a140670bd199014b1708307b /drivers/gpu/drm/exynos/exynos_hdmi.c
parent080be03de296f68e8c6e13ab7545eae26db6359f (diff)
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: Daniel Kurtz <djkurtz@chromium.org> [seanpaul changed to phandle lookup instead of using of node name] Signed-off-by: Sean Paul <seanpaul@chromium.org> Signed-off-by: Inki Dae <inki.dae@samsung.com>
Diffstat (limited to 'drivers/gpu/drm/exynos/exynos_hdmi.c')
-rw-r--r--drivers/gpu/drm/exynos/exynos_hdmi.c59
1 files changed, 27 insertions, 32 deletions
diff --git a/drivers/gpu/drm/exynos/exynos_hdmi.c b/drivers/gpu/drm/exynos/exynos_hdmi.c
index b51672f53808..b0c58e4fdc56 100644
--- a/drivers/gpu/drm/exynos/exynos_hdmi.c
+++ b/drivers/gpu/drm/exynos/exynos_hdmi.c
@@ -33,6 +33,7 @@
33#include <linux/regulator/consumer.h> 33#include <linux/regulator/consumer.h>
34#include <linux/io.h> 34#include <linux/io.h>
35#include <linux/of.h> 35#include <linux/of.h>
36#include <linux/i2c.h>
36#include <linux/of_gpio.h> 37#include <linux/of_gpio.h>
37#include <linux/hdmi.h> 38#include <linux/hdmi.h>
38 39
@@ -41,8 +42,6 @@
41#include "exynos_drm_drv.h" 42#include "exynos_drm_drv.h"
42#include "exynos_drm_hdmi.h" 43#include "exynos_drm_hdmi.h"
43 44
44#include "exynos_hdmi.h"
45
46#include <linux/gpio.h> 45#include <linux/gpio.h>
47#include <media/s5p_hdmi.h> 46#include <media/s5p_hdmi.h>
48 47
@@ -1907,20 +1906,6 @@ fail:
1907 return -ENODEV; 1906 return -ENODEV;
1908} 1907}
1909 1908
1910static struct i2c_client *hdmi_ddc, *hdmi_hdmiphy;
1911
1912void hdmi_attach_ddc_client(struct i2c_client *ddc)
1913{
1914 if (ddc)
1915 hdmi_ddc = ddc;
1916}
1917
1918void hdmi_attach_hdmiphy_client(struct i2c_client *hdmiphy)
1919{
1920 if (hdmiphy)
1921 hdmi_hdmiphy = hdmiphy;
1922}
1923
1924static struct s5p_hdmi_platform_data *drm_hdmi_dt_parse_pdata 1909static struct s5p_hdmi_platform_data *drm_hdmi_dt_parse_pdata
1925 (struct device *dev) 1910 (struct device *dev)
1926{ 1911{
@@ -1965,6 +1950,7 @@ static int hdmi_probe(struct platform_device *pdev)
1965 struct s5p_hdmi_platform_data *pdata; 1950 struct s5p_hdmi_platform_data *pdata;
1966 struct resource *res; 1951 struct resource *res;
1967 const struct of_device_id *match; 1952 const struct of_device_id *match;
1953 struct device_node *ddc_node, *phy_node;
1968 int ret; 1954 int ret;
1969 1955
1970 if (!dev->of_node) 1956 if (!dev->of_node)
@@ -2015,21 +2001,30 @@ static int hdmi_probe(struct platform_device *pdev)
2015 } 2001 }
2016 2002
2017 /* DDC i2c driver */ 2003 /* DDC i2c driver */
2018 if (i2c_add_driver(&ddc_driver)) { 2004 ddc_node = of_parse_phandle(dev->of_node, "ddc", 0);
2019 DRM_ERROR("failed to register ddc i2c driver\n"); 2005 if (!ddc_node) {
2020 return -ENOENT; 2006 DRM_ERROR("Failed to find ddc node in device tree\n");
2007 return -ENODEV;
2008 }
2009 hdata->ddc_port = of_find_i2c_device_by_node(ddc_node);
2010 if (!hdata->ddc_port) {
2011 DRM_ERROR("Failed to get ddc i2c client by node\n");
2012 return -ENODEV;
2021 } 2013 }
2022
2023 hdata->ddc_port = hdmi_ddc;
2024 2014
2025 /* hdmiphy i2c driver */ 2015 /* hdmiphy i2c driver */
2026 if (i2c_add_driver(&hdmiphy_driver)) { 2016 phy_node = of_parse_phandle(dev->of_node, "phy", 0);
2027 DRM_ERROR("failed to register hdmiphy i2c driver\n"); 2017 if (!phy_node) {
2028 ret = -ENOENT; 2018 DRM_ERROR("Failed to find hdmiphy node in device tree\n");
2019 ret = -ENODEV;
2020 goto err_ddc;
2021 }
2022 hdata->hdmiphy_port = of_find_i2c_device_by_node(phy_node);
2023 if (!hdata->hdmiphy_port) {
2024 DRM_ERROR("Failed to get hdmi phy i2c client from node\n");
2025 ret = -ENODEV;
2029 goto err_ddc; 2026 goto err_ddc;
2030 } 2027 }
2031
2032 hdata->hdmiphy_port = hdmi_hdmiphy;
2033 2028
2034 hdata->irq = gpio_to_irq(hdata->hpd_gpio); 2029 hdata->irq = gpio_to_irq(hdata->hpd_gpio);
2035 if (hdata->irq < 0) { 2030 if (hdata->irq < 0) {
@@ -2060,22 +2055,22 @@ static int hdmi_probe(struct platform_device *pdev)
2060 return 0; 2055 return 0;
2061 2056
2062err_hdmiphy: 2057err_hdmiphy:
2063 i2c_del_driver(&hdmiphy_driver); 2058 put_device(&hdata->hdmiphy_port->dev);
2064err_ddc: 2059err_ddc:
2065 i2c_del_driver(&ddc_driver); 2060 put_device(&hdata->ddc_port->dev);
2066 return ret; 2061 return ret;
2067} 2062}
2068 2063
2069static int hdmi_remove(struct platform_device *pdev) 2064static int hdmi_remove(struct platform_device *pdev)
2070{ 2065{
2071 struct device *dev = &pdev->dev; 2066 struct device *dev = &pdev->dev;
2067 struct exynos_drm_hdmi_context *ctx = get_hdmi_context(dev);
2068 struct hdmi_context *hdata = ctx->ctx;
2072 2069
2073 pm_runtime_disable(dev); 2070 pm_runtime_disable(dev);
2074 2071
2075 /* hdmiphy i2c driver */ 2072 put_device(&hdata->hdmiphy_port->dev);
2076 i2c_del_driver(&hdmiphy_driver); 2073 put_device(&hdata->ddc_port->dev);
2077 /* DDC i2c driver */
2078 i2c_del_driver(&ddc_driver);
2079 2074
2080 return 0; 2075 return 0;
2081} 2076}