Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 366732
b: refs/heads/master
c: 8cf2f7a
h: refs/heads/master
v: v3
  • Loading branch information
Hans Verkuil authored and Mauro Carvalho Chehab committed Mar 23, 2013
1 parent 146b512 commit 5a0f58b
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 10 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 8b2c3da108b08751ac65911e1797ef9a5342c727
refs/heads/master: 8cf2f7ad9749980a455d61b5664ccb553c12fd0e
60 changes: 51 additions & 9 deletions trunk/drivers/media/platform/s5p-tv/hdmiphy_drv.c
Original file line number Diff line number Diff line change
Expand Up @@ -197,14 +197,9 @@ static unsigned long hdmiphy_preset_to_pixclk(u32 preset)
return 0;
}

static const u8 *hdmiphy_find_conf(u32 preset, const struct hdmiphy_conf *conf)
static const u8 *hdmiphy_find_conf(unsigned long pixclk,
const struct hdmiphy_conf *conf)
{
unsigned long pixclk;

pixclk = hdmiphy_preset_to_pixclk(preset);
if (!pixclk)
return NULL;

for (; conf->pixclk; ++conf)
if (conf->pixclk == pixclk)
return conf->data;
Expand All @@ -220,15 +215,49 @@ static int hdmiphy_s_power(struct v4l2_subdev *sd, int on)
static int hdmiphy_s_dv_preset(struct v4l2_subdev *sd,
struct v4l2_dv_preset *preset)
{
const u8 *data;
const u8 *data = NULL;
u8 buffer[32];
int ret;
struct hdmiphy_ctx *ctx = sd_to_ctx(sd);
struct i2c_client *client = v4l2_get_subdevdata(sd);
unsigned long pixclk;
struct device *dev = &client->dev;

dev_info(dev, "s_dv_preset(preset = %d)\n", preset->preset);
data = hdmiphy_find_conf(preset->preset, ctx->conf_tab);

pixclk = hdmiphy_preset_to_pixclk(preset->preset);
data = hdmiphy_find_conf(pixclk, ctx->conf_tab);
if (!data) {
dev_err(dev, "format not supported\n");
return -EINVAL;
}

/* storing configuration to the device */
memcpy(buffer, data, 32);
ret = i2c_master_send(client, buffer, 32);
if (ret != 32) {
dev_err(dev, "failed to configure HDMIPHY via I2C\n");
return -EIO;
}

return 0;
}

static int hdmiphy_s_dv_timings(struct v4l2_subdev *sd,
struct v4l2_dv_timings *timings)
{
const u8 *data;
u8 buffer[32];
int ret;
struct hdmiphy_ctx *ctx = sd_to_ctx(sd);
struct i2c_client *client = v4l2_get_subdevdata(sd);
struct device *dev = &client->dev;
unsigned long pixclk = timings->bt.pixelclock;

dev_info(dev, "s_dv_timings\n");
if ((timings->bt.flags & V4L2_DV_FL_REDUCED_FPS) && pixclk == 74250000)
pixclk = 74176000;
data = hdmiphy_find_conf(pixclk, ctx->conf_tab);
if (!data) {
dev_err(dev, "format not supported\n");
return -EINVAL;
Expand All @@ -245,6 +274,17 @@ static int hdmiphy_s_dv_preset(struct v4l2_subdev *sd,
return 0;
}

static int hdmiphy_dv_timings_cap(struct v4l2_subdev *sd,
struct v4l2_dv_timings_cap *cap)
{
cap->type = V4L2_DV_BT_656_1120;
/* The phy only determines the pixelclock, leave the other values
* at 0 to signify that we have no information for them. */
cap->bt.min_pixelclock = 27000000;
cap->bt.max_pixelclock = 148500000;
return 0;
}

static int hdmiphy_s_stream(struct v4l2_subdev *sd, int enable)
{
struct i2c_client *client = v4l2_get_subdevdata(sd);
Expand All @@ -271,6 +311,8 @@ static const struct v4l2_subdev_core_ops hdmiphy_core_ops = {

static const struct v4l2_subdev_video_ops hdmiphy_video_ops = {
.s_dv_preset = hdmiphy_s_dv_preset,
.s_dv_timings = hdmiphy_s_dv_timings,
.dv_timings_cap = hdmiphy_dv_timings_cap,
.s_stream = hdmiphy_s_stream,
};

Expand Down

0 comments on commit 5a0f58b

Please sign in to comment.