Commit 350f2f4d authored by Tomasz Stanislawski's avatar Tomasz Stanislawski Committed by Mauro Carvalho Chehab

[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: default avatarTomasz Stanislawski <t.stanislaws@samsung.com>
Signed-off-by: default avatarKyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent 56e1df49
...@@ -30,6 +30,7 @@ ...@@ -30,6 +30,7 @@
#include <linux/clk.h> #include <linux/clk.h>
#include <linux/regulator/consumer.h> #include <linux/regulator/consumer.h>
#include <media/s5p_hdmi.h>
#include <media/v4l2-common.h> #include <media/v4l2-common.h>
#include <media/v4l2-dev.h> #include <media/v4l2-dev.h>
#include <media/v4l2-device.h> #include <media/v4l2-device.h>
...@@ -74,10 +75,6 @@ struct hdmi_device { ...@@ -74,10 +75,6 @@ struct hdmi_device {
struct hdmi_resources res; struct hdmi_resources res;
}; };
struct hdmi_driver_data {
int hdmiphy_bus;
};
struct hdmi_tg_regs { struct hdmi_tg_regs {
u8 cmd; u8 cmd;
u8 h_fsz_l; u8 h_fsz_l;
...@@ -129,23 +126,11 @@ struct hdmi_preset_conf { ...@@ -129,23 +126,11 @@ struct hdmi_preset_conf {
struct v4l2_mbus_framefmt mbus_fmt; struct v4l2_mbus_framefmt mbus_fmt;
}; };
/* I2C module and id for HDMIPHY */
static struct i2c_board_info hdmiphy_info = {
I2C_BOARD_INFO("hdmiphy", 0x38),
};
static struct hdmi_driver_data hdmi_driver_data[] = {
{ .hdmiphy_bus = 3 },
{ .hdmiphy_bus = 8 },
};
static struct platform_device_id hdmi_driver_types[] = { static struct platform_device_id hdmi_driver_types[] = {
{ {
.name = "s5pv210-hdmi", .name = "s5pv210-hdmi",
.driver_data = (unsigned long)&hdmi_driver_data[0],
}, { }, {
.name = "exynos4-hdmi", .name = "exynos4-hdmi",
.driver_data = (unsigned long)&hdmi_driver_data[1],
}, { }, {
/* end node */ /* end node */
} }
...@@ -870,11 +855,17 @@ static int __devinit hdmi_probe(struct platform_device *pdev) ...@@ -870,11 +855,17 @@ static int __devinit hdmi_probe(struct platform_device *pdev)
struct i2c_adapter *phy_adapter; struct i2c_adapter *phy_adapter;
struct v4l2_subdev *sd; struct v4l2_subdev *sd;
struct hdmi_device *hdmi_dev = NULL; struct hdmi_device *hdmi_dev = NULL;
struct hdmi_driver_data *drv_data; struct s5p_hdmi_platform_data *pdata = dev->platform_data;
int ret; int ret;
dev_dbg(dev, "probe start\n"); dev_dbg(dev, "probe start\n");
if (!pdata) {
dev_err(dev, "platform data is missing\n");
ret = -ENODEV;
goto fail;
}
hdmi_dev = devm_kzalloc(&pdev->dev, sizeof(*hdmi_dev), GFP_KERNEL); hdmi_dev = devm_kzalloc(&pdev->dev, sizeof(*hdmi_dev), GFP_KERNEL);
if (!hdmi_dev) { if (!hdmi_dev) {
dev_err(dev, "out of memory\n"); dev_err(dev, "out of memory\n");
...@@ -929,9 +920,14 @@ static int __devinit hdmi_probe(struct platform_device *pdev) ...@@ -929,9 +920,14 @@ static int __devinit hdmi_probe(struct platform_device *pdev)
goto fail_init; goto fail_init;
} }
drv_data = (struct hdmi_driver_data *) /* testing if hdmiphy info is present */
platform_get_device_id(pdev)->driver_data; if (!pdata->hdmiphy_info) {
phy_adapter = i2c_get_adapter(drv_data->hdmiphy_bus); dev_err(dev, "hdmiphy info is missing in platform data\n");
ret = -ENXIO;
goto fail_vdev;
}
phy_adapter = i2c_get_adapter(pdata->hdmiphy_bus);
if (phy_adapter == NULL) { if (phy_adapter == NULL) {
dev_err(dev, "adapter request failed\n"); dev_err(dev, "adapter request failed\n");
ret = -ENXIO; ret = -ENXIO;
...@@ -939,7 +935,7 @@ static int __devinit hdmi_probe(struct platform_device *pdev) ...@@ -939,7 +935,7 @@ static int __devinit hdmi_probe(struct platform_device *pdev)
} }
hdmi_dev->phy_sd = v4l2_i2c_new_subdev_board(&hdmi_dev->v4l2_dev, hdmi_dev->phy_sd = v4l2_i2c_new_subdev_board(&hdmi_dev->v4l2_dev,
phy_adapter, &hdmiphy_info, NULL); phy_adapter, pdata->hdmiphy_info, NULL);
/* on failure or not adapter is no longer useful */ /* on failure or not adapter is no longer useful */
i2c_put_adapter(phy_adapter); i2c_put_adapter(phy_adapter);
if (hdmi_dev->phy_sd == NULL) { if (hdmi_dev->phy_sd == NULL) {
......
/*
* Driver header for S5P HDMI chip.
*
* Copyright (c) 2011 Samsung Electronics, Co. Ltd
* Contact: Tomasz Stanislawski <t.stanislaws@samsung.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*/
#ifndef S5P_HDMI_H
#define S5P_HDMI_H
struct i2c_board_info;
/**
* @hdmiphy_bus: controller id for HDMIPHY bus
* @hdmiphy_info: template for HDMIPHY I2C device
* @mhl_bus: controller id for MHL control bus
* @mhl_info: template for MHL I2C device
*
* NULL pointer for *_info fields indicates that
* the corresponding chip is not present
*/
struct s5p_hdmi_platform_data {
int hdmiphy_bus;
struct i2c_board_info *hdmiphy_info;
int mhl_bus;
struct i2c_board_info *mhl_info;
};
#endif /* S5P_HDMI_H */
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