aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-rw-r--r--drivers/media/video/s5p-tv/hdmi_drv.c38
1 files changed, 17 insertions, 21 deletions
diff --git a/drivers/media/video/s5p-tv/hdmi_drv.c b/drivers/media/video/s5p-tv/hdmi_drv.c
index ace1d7f3519a..821136ccd172 100644
--- a/drivers/media/video/s5p-tv/hdmi_drv.c
+++ b/drivers/media/video/s5p-tv/hdmi_drv.c
@@ -30,6 +30,7 @@
30#include <linux/clk.h> 30#include <linux/clk.h>
31#include <linux/regulator/consumer.h> 31#include <linux/regulator/consumer.h>
32 32
33#include <media/s5p_hdmi.h>
33#include <media/v4l2-common.h> 34#include <media/v4l2-common.h>
34#include <media/v4l2-dev.h> 35#include <media/v4l2-dev.h>
35#include <media/v4l2-device.h> 36#include <media/v4l2-device.h>
@@ -74,10 +75,6 @@ struct hdmi_device {
74 struct hdmi_resources res; 75 struct hdmi_resources res;
75}; 76};
76 77
77struct hdmi_driver_data {
78 int hdmiphy_bus;
79};
80
81struct hdmi_tg_regs { 78struct hdmi_tg_regs {
82 u8 cmd; 79 u8 cmd;
83 u8 h_fsz_l; 80 u8 h_fsz_l;
@@ -129,23 +126,11 @@ struct hdmi_preset_conf {
129 struct v4l2_mbus_framefmt mbus_fmt; 126 struct v4l2_mbus_framefmt mbus_fmt;
130}; 127};
131 128
132/* I2C module and id for HDMIPHY */
133static struct i2c_board_info hdmiphy_info = {
134 I2C_BOARD_INFO("hdmiphy", 0x38),
135};
136
137static struct hdmi_driver_data hdmi_driver_data[] = {
138 { .hdmiphy_bus = 3 },
139 { .hdmiphy_bus = 8 },
140};
141
142static struct platform_device_id hdmi_driver_types[] = { 129static struct platform_device_id hdmi_driver_types[] = {
143 { 130 {
144 .name = "s5pv210-hdmi", 131 .name = "s5pv210-hdmi",
145 .driver_data = (unsigned long)&hdmi_driver_data[0],
146 }, { 132 }, {
147 .name = "exynos4-hdmi", 133 .name = "exynos4-hdmi",
148 .driver_data = (unsigned long)&hdmi_driver_data[1],
149 }, { 134 }, {
150 /* end node */ 135 /* end node */
151 } 136 }
@@ -870,11 +855,17 @@ static int __devinit hdmi_probe(struct platform_device *pdev)
870 struct i2c_adapter *phy_adapter; 855 struct i2c_adapter *phy_adapter;
871 struct v4l2_subdev *sd; 856 struct v4l2_subdev *sd;
872 struct hdmi_device *hdmi_dev = NULL; 857 struct hdmi_device *hdmi_dev = NULL;
873 struct hdmi_driver_data *drv_data; 858 struct s5p_hdmi_platform_data *pdata = dev->platform_data;
874 int ret; 859 int ret;
875 860
876 dev_dbg(dev, "probe start\n"); 861 dev_dbg(dev, "probe start\n");
877 862
863 if (!pdata) {
864 dev_err(dev, "platform data is missing\n");
865 ret = -ENODEV;
866 goto fail;
867 }
868
878 hdmi_dev = devm_kzalloc(&pdev->dev, sizeof(*hdmi_dev), GFP_KERNEL); 869 hdmi_dev = devm_kzalloc(&pdev->dev, sizeof(*hdmi_dev), GFP_KERNEL);
879 if (!hdmi_dev) { 870 if (!hdmi_dev) {
880 dev_err(dev, "out of memory\n"); 871 dev_err(dev, "out of memory\n");
@@ -929,9 +920,14 @@ static int __devinit hdmi_probe(struct platform_device *pdev)
929 goto fail_init; 920 goto fail_init;
930 } 921 }
931 922
932 drv_data = (struct hdmi_driver_data *) 923 /* testing if hdmiphy info is present */
933 platform_get_device_id(pdev)->driver_data; 924 if (!pdata->hdmiphy_info) {
934 phy_adapter = i2c_get_adapter(drv_data->hdmiphy_bus); 925 dev_err(dev, "hdmiphy info is missing in platform data\n");
926 ret = -ENXIO;
927 goto fail_vdev;
928 }
929
930 phy_adapter = i2c_get_adapter(pdata->hdmiphy_bus);
935 if (phy_adapter == NULL) { 931 if (phy_adapter == NULL) {
936 dev_err(dev, "adapter request failed\n"); 932 dev_err(dev, "adapter request failed\n");
937 ret = -ENXIO; 933 ret = -ENXIO;
@@ -939,7 +935,7 @@ static int __devinit hdmi_probe(struct platform_device *pdev)
939 } 935 }
940 936
941 hdmi_dev->phy_sd = v4l2_i2c_new_subdev_board(&hdmi_dev->v4l2_dev, 937 hdmi_dev->phy_sd = v4l2_i2c_new_subdev_board(&hdmi_dev->v4l2_dev,
942 phy_adapter, &hdmiphy_info, NULL); 938 phy_adapter, pdata->hdmiphy_info, NULL);
943 /* on failure or not adapter is no longer useful */ 939 /* on failure or not adapter is no longer useful */
944 i2c_put_adapter(phy_adapter); 940 i2c_put_adapter(phy_adapter);
945 if (hdmi_dev->phy_sd == NULL) { 941 if (hdmi_dev->phy_sd == NULL) {