diff options
| author | Tomasz Stanislawski <t.stanislaws@samsung.com> | 2011-09-21 10:53:31 -0400 |
|---|---|---|
| committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2012-02-28 16:26:40 -0500 |
| commit | 350f2f4dad64b61376f08abfcdd7a339503ae6b8 (patch) | |
| tree | 97f87897048d4921b56783498b5ca17c975433e5 | |
| parent | 56e1df491b803dc962ba47adcdaf4ad034c697a8 (diff) | |
[media] v4l: s5p-tv: hdmi: add support for platform data
Moving configuration of s5p-hdmi peripherals from driver data to
platfrom data.
Signed-off-by: Tomasz Stanislawski <t.stanislaws@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
| -rw-r--r-- | drivers/media/video/s5p-tv/hdmi_drv.c | 38 | ||||
| -rw-r--r-- | include/media/s5p_hdmi.h | 35 |
2 files changed, 52 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 | ||
| 77 | struct hdmi_driver_data { | ||
| 78 | int hdmiphy_bus; | ||
| 79 | }; | ||
| 80 | |||
| 81 | struct hdmi_tg_regs { | 78 | struct 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 */ | ||
| 133 | static struct i2c_board_info hdmiphy_info = { | ||
| 134 | I2C_BOARD_INFO("hdmiphy", 0x38), | ||
| 135 | }; | ||
| 136 | |||
| 137 | static struct hdmi_driver_data hdmi_driver_data[] = { | ||
| 138 | { .hdmiphy_bus = 3 }, | ||
| 139 | { .hdmiphy_bus = 8 }, | ||
| 140 | }; | ||
| 141 | |||
| 142 | static struct platform_device_id hdmi_driver_types[] = { | 129 | static 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) { |
diff --git a/include/media/s5p_hdmi.h b/include/media/s5p_hdmi.h new file mode 100644 index 000000000000..361a751f73af --- /dev/null +++ b/include/media/s5p_hdmi.h | |||
| @@ -0,0 +1,35 @@ | |||
| 1 | /* | ||
| 2 | * Driver header for S5P HDMI chip. | ||
| 3 | * | ||
| 4 | * Copyright (c) 2011 Samsung Electronics, Co. Ltd | ||
| 5 | * Contact: Tomasz Stanislawski <t.stanislaws@samsung.com> | ||
| 6 | * | ||
| 7 | * This program is free software; you can redistribute it and/or modify | ||
| 8 | * it under the terms of the GNU General Public License as published by | ||
| 9 | * the Free Software Foundation; either version 2 of the License, or | ||
| 10 | * (at your option) any later version. | ||
| 11 | */ | ||
| 12 | |||
| 13 | #ifndef S5P_HDMI_H | ||
| 14 | #define S5P_HDMI_H | ||
| 15 | |||
| 16 | struct i2c_board_info; | ||
| 17 | |||
| 18 | /** | ||
| 19 | * @hdmiphy_bus: controller id for HDMIPHY bus | ||
| 20 | * @hdmiphy_info: template for HDMIPHY I2C device | ||
| 21 | * @mhl_bus: controller id for MHL control bus | ||
| 22 | * @mhl_info: template for MHL I2C device | ||
| 23 | * | ||
| 24 | * NULL pointer for *_info fields indicates that | ||
| 25 | * the corresponding chip is not present | ||
| 26 | */ | ||
| 27 | struct s5p_hdmi_platform_data { | ||
| 28 | int hdmiphy_bus; | ||
| 29 | struct i2c_board_info *hdmiphy_info; | ||
| 30 | int mhl_bus; | ||
| 31 | struct i2c_board_info *mhl_info; | ||
| 32 | }; | ||
| 33 | |||
| 34 | #endif /* S5P_HDMI_H */ | ||
| 35 | |||
