提交 36864082 编写于 作者: H Hans Verkuil 提交者: Mauro Carvalho Chehab

[media] dm644x: replace the obsolete preset API by the timings API

This patch replaces the preset API by the timings API, and
appropriate changes in board file.
Signed-off-by: NHans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: NLad, Prabhakar <prabhakar.lad@ti.com>
Signed-off-by: NManjunath Hadli <manjunath.hadli@ti.com>
Acked-by: NSekhar Nori <nsekhar@ti.com>
Signed-off-by: NMauro Carvalho Chehab <mchehab@redhat.com>
上级 182b967e
...@@ -23,6 +23,7 @@ ...@@ -23,6 +23,7 @@
#include <linux/phy.h> #include <linux/phy.h>
#include <linux/clk.h> #include <linux/clk.h>
#include <linux/videodev2.h> #include <linux/videodev2.h>
#include <linux/v4l2-dv-timings.h>
#include <linux/export.h> #include <linux/export.h>
#include <media/tvp514x.h> #include <media/tvp514x.h>
...@@ -620,7 +621,7 @@ static struct vpbe_enc_mode_info dm644xevm_enc_std_timing[] = { ...@@ -620,7 +621,7 @@ static struct vpbe_enc_mode_info dm644xevm_enc_std_timing[] = {
{ {
.name = "ntsc", .name = "ntsc",
.timings_type = VPBE_ENC_STD, .timings_type = VPBE_ENC_STD,
.timings = {V4L2_STD_525_60}, .std_id = V4L2_STD_525_60,
.interlaced = 1, .interlaced = 1,
.xres = 720, .xres = 720,
.yres = 480, .yres = 480,
...@@ -632,7 +633,7 @@ static struct vpbe_enc_mode_info dm644xevm_enc_std_timing[] = { ...@@ -632,7 +633,7 @@ static struct vpbe_enc_mode_info dm644xevm_enc_std_timing[] = {
{ {
.name = "pal", .name = "pal",
.timings_type = VPBE_ENC_STD, .timings_type = VPBE_ENC_STD,
.timings = {V4L2_STD_625_50}, .std_id = V4L2_STD_625_50,
.interlaced = 1, .interlaced = 1,
.xres = 720, .xres = 720,
.yres = 576, .yres = 576,
...@@ -647,8 +648,8 @@ static struct vpbe_enc_mode_info dm644xevm_enc_std_timing[] = { ...@@ -647,8 +648,8 @@ static struct vpbe_enc_mode_info dm644xevm_enc_std_timing[] = {
static struct vpbe_enc_mode_info dm644xevm_enc_preset_timing[] = { static struct vpbe_enc_mode_info dm644xevm_enc_preset_timing[] = {
{ {
.name = "480p59_94", .name = "480p59_94",
.timings_type = VPBE_ENC_DV_PRESET, .timings_type = VPBE_ENC_CUSTOM_TIMINGS,
.timings = {V4L2_DV_480P59_94}, .dv_timings = V4L2_DV_BT_CEA_720X480P59_94,
.interlaced = 0, .interlaced = 0,
.xres = 720, .xres = 720,
.yres = 480, .yres = 480,
...@@ -659,8 +660,8 @@ static struct vpbe_enc_mode_info dm644xevm_enc_preset_timing[] = { ...@@ -659,8 +660,8 @@ static struct vpbe_enc_mode_info dm644xevm_enc_preset_timing[] = {
}, },
{ {
.name = "576p50", .name = "576p50",
.timings_type = VPBE_ENC_DV_PRESET, .timings_type = VPBE_ENC_CUSTOM_TIMINGS,
.timings = {V4L2_DV_576P50}, .dv_timings = V4L2_DV_BT_CEA_720X576P50,
.interlaced = 0, .interlaced = 0,
.xres = 720, .xres = 720,
.yres = 576, .yres = 576,
...@@ -698,7 +699,7 @@ static struct vpbe_output dm644xevm_vpbe_outputs[] = { ...@@ -698,7 +699,7 @@ static struct vpbe_output dm644xevm_vpbe_outputs[] = {
.index = 1, .index = 1,
.name = "Component", .name = "Component",
.type = V4L2_OUTPUT_TYPE_ANALOG, .type = V4L2_OUTPUT_TYPE_ANALOG,
.capabilities = V4L2_OUT_CAP_PRESETS, .capabilities = V4L2_OUT_CAP_CUSTOM_TIMINGS,
}, },
.subdev_name = VPBE_VENC_SUBDEV_NAME, .subdev_name = VPBE_VENC_SUBDEV_NAME,
.default_mode = "480p59_94", .default_mode = "480p59_94",
......
...@@ -701,7 +701,7 @@ static struct resource dm644x_venc_resources[] = { ...@@ -701,7 +701,7 @@ static struct resource dm644x_venc_resources[] = {
#define DM644X_VPSS_DACCLKEN BIT(4) #define DM644X_VPSS_DACCLKEN BIT(4)
static int dm644x_venc_setup_clock(enum vpbe_enc_timings_type type, static int dm644x_venc_setup_clock(enum vpbe_enc_timings_type type,
unsigned int mode) unsigned int pclock)
{ {
int ret = 0; int ret = 0;
u32 v = DM644X_VPSS_VENCLKEN; u32 v = DM644X_VPSS_VENCLKEN;
...@@ -711,27 +711,18 @@ static int dm644x_venc_setup_clock(enum vpbe_enc_timings_type type, ...@@ -711,27 +711,18 @@ static int dm644x_venc_setup_clock(enum vpbe_enc_timings_type type,
v |= DM644X_VPSS_DACCLKEN; v |= DM644X_VPSS_DACCLKEN;
writel(v, DAVINCI_SYSMOD_VIRT(SYSMOD_VPSS_CLKCTL)); writel(v, DAVINCI_SYSMOD_VIRT(SYSMOD_VPSS_CLKCTL));
break; break;
case VPBE_ENC_DV_PRESET: case VPBE_ENC_CUSTOM_TIMINGS:
switch (mode) { if (pclock <= 27000000) {
case V4L2_DV_480P59_94:
case V4L2_DV_576P50:
v |= DM644X_VPSS_MUXSEL_PLL2_MODE | v |= DM644X_VPSS_MUXSEL_PLL2_MODE |
DM644X_VPSS_DACCLKEN; DM644X_VPSS_DACCLKEN;
writel(v, DAVINCI_SYSMOD_VIRT(SYSMOD_VPSS_CLKCTL)); writel(v, DAVINCI_SYSMOD_VIRT(SYSMOD_VPSS_CLKCTL));
break; } else {
case V4L2_DV_720P60:
case V4L2_DV_1080I60:
case V4L2_DV_1080P30:
/* /*
* For HD, use external clock source since * For HD, use external clock source since
* HD requires higher clock rate * HD requires higher clock rate
*/ */
v |= DM644X_VPSS_MUXSEL_VPBECLK_MODE; v |= DM644X_VPSS_MUXSEL_VPBECLK_MODE;
writel(v, DAVINCI_SYSMOD_VIRT(SYSMOD_VPSS_CLKCTL)); writel(v, DAVINCI_SYSMOD_VIRT(SYSMOD_VPSS_CLKCTL));
break;
default:
ret = -EINVAL;
break;
} }
break; break;
default: default:
......
...@@ -174,26 +174,6 @@ static int vpbe_get_current_mode_info(struct vpbe_device *vpbe_dev, ...@@ -174,26 +174,6 @@ static int vpbe_get_current_mode_info(struct vpbe_device *vpbe_dev,
return 0; return 0;
} }
static int vpbe_get_dv_preset_info(struct vpbe_device *vpbe_dev,
unsigned int dv_preset)
{
struct vpbe_config *cfg = vpbe_dev->cfg;
struct vpbe_enc_mode_info var;
int curr_output = vpbe_dev->current_out_index;
int i;
for (i = 0; i < vpbe_dev->cfg->outputs[curr_output].num_modes; i++) {
var = cfg->outputs[curr_output].modes[i];
if ((var.timings_type & VPBE_ENC_DV_PRESET) &&
(var.timings.dv_preset == dv_preset)) {
vpbe_dev->current_timings = var;
return 0;
}
}
return -EINVAL;
}
/* Get std by std id */ /* Get std by std id */
static int vpbe_get_std_info(struct vpbe_device *vpbe_dev, static int vpbe_get_std_info(struct vpbe_device *vpbe_dev,
v4l2_std_id std_id) v4l2_std_id std_id)
...@@ -206,7 +186,7 @@ static int vpbe_get_std_info(struct vpbe_device *vpbe_dev, ...@@ -206,7 +186,7 @@ static int vpbe_get_std_info(struct vpbe_device *vpbe_dev,
for (i = 0; i < vpbe_dev->cfg->outputs[curr_output].num_modes; i++) { for (i = 0; i < vpbe_dev->cfg->outputs[curr_output].num_modes; i++) {
var = cfg->outputs[curr_output].modes[i]; var = cfg->outputs[curr_output].modes[i];
if ((var.timings_type & VPBE_ENC_STD) && if ((var.timings_type & VPBE_ENC_STD) &&
(var.timings.std_id & std_id)) { (var.std_id & std_id)) {
vpbe_dev->current_timings = var; vpbe_dev->current_timings = var;
return 0; return 0;
} }
...@@ -344,38 +324,42 @@ static unsigned int vpbe_get_output(struct vpbe_device *vpbe_dev) ...@@ -344,38 +324,42 @@ static unsigned int vpbe_get_output(struct vpbe_device *vpbe_dev)
} }
/** /**
* vpbe_s_dv_preset - Set the given preset timings in the encoder * vpbe_s_dv_timings - Set the given preset timings in the encoder
* *
* Sets the preset if supported by the current encoder. Return the status. * Sets the timings if supported by the current encoder. Return the status.
* 0 - success & -EINVAL on error * 0 - success & -EINVAL on error
*/ */
static int vpbe_s_dv_preset(struct vpbe_device *vpbe_dev, static int vpbe_s_dv_timings(struct vpbe_device *vpbe_dev,
struct v4l2_dv_preset *dv_preset) struct v4l2_dv_timings *dv_timings)
{ {
struct vpbe_config *cfg = vpbe_dev->cfg; struct vpbe_config *cfg = vpbe_dev->cfg;
int out_index = vpbe_dev->current_out_index; int out_index = vpbe_dev->current_out_index;
struct vpbe_output *output = &cfg->outputs[out_index];
int sd_index = vpbe_dev->current_sd_index; int sd_index = vpbe_dev->current_sd_index;
int ret; int ret, i;
if (!(cfg->outputs[out_index].output.capabilities & if (!(cfg->outputs[out_index].output.capabilities &
V4L2_OUT_CAP_PRESETS)) V4L2_OUT_CAP_CUSTOM_TIMINGS))
return -EINVAL; return -EINVAL;
ret = vpbe_get_dv_preset_info(vpbe_dev, dv_preset->preset); for (i = 0; i < output->num_modes; i++) {
if (output->modes[i].timings_type == VPBE_ENC_CUSTOM_TIMINGS &&
if (ret) !memcmp(&output->modes[i].dv_timings,
return ret; dv_timings, sizeof(*dv_timings)))
break;
}
if (i >= output->num_modes)
return -EINVAL;
vpbe_dev->current_timings = output->modes[i];
mutex_lock(&vpbe_dev->lock); mutex_lock(&vpbe_dev->lock);
ret = v4l2_subdev_call(vpbe_dev->encoders[sd_index], video, ret = v4l2_subdev_call(vpbe_dev->encoders[sd_index], video,
s_dv_preset, dv_preset); s_dv_timings, dv_timings);
if (!ret && (vpbe_dev->amp != NULL)) { if (!ret && (vpbe_dev->amp != NULL)) {
/* Call amplifier subdevice */ /* Call amplifier subdevice */
ret = v4l2_subdev_call(vpbe_dev->amp, video, ret = v4l2_subdev_call(vpbe_dev->amp, video,
s_dv_preset, dv_preset); s_dv_timings, dv_timings);
} }
/* set the lcd controller output for the given mode */ /* set the lcd controller output for the given mode */
if (!ret) { if (!ret) {
...@@ -392,17 +376,17 @@ static int vpbe_s_dv_preset(struct vpbe_device *vpbe_dev, ...@@ -392,17 +376,17 @@ static int vpbe_s_dv_preset(struct vpbe_device *vpbe_dev,
} }
/** /**
* vpbe_g_dv_preset - Get the preset in the current encoder * vpbe_g_dv_timings - Get the timings in the current encoder
* *
* Get the preset in the current encoder. Return the status. 0 - success * Get the timings in the current encoder. Return the status. 0 - success
* -EINVAL on error * -EINVAL on error
*/ */
static int vpbe_g_dv_preset(struct vpbe_device *vpbe_dev, static int vpbe_g_dv_timings(struct vpbe_device *vpbe_dev,
struct v4l2_dv_preset *dv_preset) struct v4l2_dv_timings *dv_timings)
{ {
if (vpbe_dev->current_timings.timings_type & if (vpbe_dev->current_timings.timings_type &
VPBE_ENC_DV_PRESET) { VPBE_ENC_CUSTOM_TIMINGS) {
dv_preset->preset = vpbe_dev->current_timings.timings.dv_preset; *dv_timings = vpbe_dev->current_timings.dv_timings;
return 0; return 0;
} }
...@@ -410,13 +394,13 @@ static int vpbe_g_dv_preset(struct vpbe_device *vpbe_dev, ...@@ -410,13 +394,13 @@ static int vpbe_g_dv_preset(struct vpbe_device *vpbe_dev,
} }
/** /**
* vpbe_enum_dv_presets - Enumerate the dv presets in the current encoder * vpbe_enum_dv_timings - Enumerate the dv timings in the current encoder
* *
* Get the preset in the current encoder. Return the status. 0 - success * Get the timings in the current encoder. Return the status. 0 - success
* -EINVAL on error * -EINVAL on error
*/ */
static int vpbe_enum_dv_presets(struct vpbe_device *vpbe_dev, static int vpbe_enum_dv_timings(struct vpbe_device *vpbe_dev,
struct v4l2_dv_enum_preset *preset_info) struct v4l2_enum_dv_timings *timings)
{ {
struct vpbe_config *cfg = vpbe_dev->cfg; struct vpbe_config *cfg = vpbe_dev->cfg;
int out_index = vpbe_dev->current_out_index; int out_index = vpbe_dev->current_out_index;
...@@ -424,12 +408,12 @@ static int vpbe_enum_dv_presets(struct vpbe_device *vpbe_dev, ...@@ -424,12 +408,12 @@ static int vpbe_enum_dv_presets(struct vpbe_device *vpbe_dev,
int j = 0; int j = 0;
int i; int i;
if (!(output->output.capabilities & V4L2_OUT_CAP_PRESETS)) if (!(output->output.capabilities & V4L2_OUT_CAP_CUSTOM_TIMINGS))
return -EINVAL; return -EINVAL;
for (i = 0; i < output->num_modes; i++) { for (i = 0; i < output->num_modes; i++) {
if (output->modes[i].timings_type == VPBE_ENC_DV_PRESET) { if (output->modes[i].timings_type == VPBE_ENC_CUSTOM_TIMINGS) {
if (j == preset_info->index) if (j == timings->index)
break; break;
j++; j++;
} }
...@@ -437,9 +421,8 @@ static int vpbe_enum_dv_presets(struct vpbe_device *vpbe_dev, ...@@ -437,9 +421,8 @@ static int vpbe_enum_dv_presets(struct vpbe_device *vpbe_dev,
if (i == output->num_modes) if (i == output->num_modes)
return -EINVAL; return -EINVAL;
timings->timings = output->modes[i].dv_timings;
return v4l_fill_dv_preset_info(output->modes[i].timings.dv_preset, return 0;
preset_info);
} }
/** /**
...@@ -489,10 +472,10 @@ static int vpbe_s_std(struct vpbe_device *vpbe_dev, v4l2_std_id *std_id) ...@@ -489,10 +472,10 @@ static int vpbe_s_std(struct vpbe_device *vpbe_dev, v4l2_std_id *std_id)
*/ */
static int vpbe_g_std(struct vpbe_device *vpbe_dev, v4l2_std_id *std_id) static int vpbe_g_std(struct vpbe_device *vpbe_dev, v4l2_std_id *std_id)
{ {
struct vpbe_enc_mode_info cur_timings = vpbe_dev->current_timings; struct vpbe_enc_mode_info *cur_timings = &vpbe_dev->current_timings;
if (cur_timings.timings_type & VPBE_ENC_STD) { if (cur_timings->timings_type & VPBE_ENC_STD) {
*std_id = cur_timings.timings.std_id; *std_id = cur_timings->std_id;
return 0; return 0;
} }
...@@ -511,7 +494,7 @@ static int vpbe_set_mode(struct vpbe_device *vpbe_dev, ...@@ -511,7 +494,7 @@ static int vpbe_set_mode(struct vpbe_device *vpbe_dev,
{ {
struct vpbe_enc_mode_info *preset_mode = NULL; struct vpbe_enc_mode_info *preset_mode = NULL;
struct vpbe_config *cfg = vpbe_dev->cfg; struct vpbe_config *cfg = vpbe_dev->cfg;
struct v4l2_dv_preset dv_preset; struct v4l2_dv_timings dv_timings;
struct osd_state *osd_device; struct osd_state *osd_device;
int out_index = vpbe_dev->current_out_index; int out_index = vpbe_dev->current_out_index;
int ret = 0; int ret = 0;
...@@ -530,11 +513,12 @@ static int vpbe_set_mode(struct vpbe_device *vpbe_dev, ...@@ -530,11 +513,12 @@ static int vpbe_set_mode(struct vpbe_device *vpbe_dev,
*/ */
if (preset_mode->timings_type & VPBE_ENC_STD) if (preset_mode->timings_type & VPBE_ENC_STD)
return vpbe_s_std(vpbe_dev, return vpbe_s_std(vpbe_dev,
&preset_mode->timings.std_id); &preset_mode->std_id);
if (preset_mode->timings_type & VPBE_ENC_DV_PRESET) { if (preset_mode->timings_type &
dv_preset.preset = VPBE_ENC_CUSTOM_TIMINGS) {
preset_mode->timings.dv_preset; dv_timings =
return vpbe_s_dv_preset(vpbe_dev, &dv_preset); preset_mode->dv_timings;
return vpbe_s_dv_timings(vpbe_dev, &dv_timings);
} }
} }
} }
...@@ -810,9 +794,9 @@ static struct vpbe_device_ops vpbe_dev_ops = { ...@@ -810,9 +794,9 @@ static struct vpbe_device_ops vpbe_dev_ops = {
.enum_outputs = vpbe_enum_outputs, .enum_outputs = vpbe_enum_outputs,
.set_output = vpbe_set_output, .set_output = vpbe_set_output,
.get_output = vpbe_get_output, .get_output = vpbe_get_output,
.s_dv_preset = vpbe_s_dv_preset, .s_dv_timings = vpbe_s_dv_timings,
.g_dv_preset = vpbe_g_dv_preset, .g_dv_timings = vpbe_g_dv_timings,
.enum_dv_presets = vpbe_enum_dv_presets, .enum_dv_timings = vpbe_enum_dv_timings,
.s_std = vpbe_s_std, .s_std = vpbe_s_std,
.g_std = vpbe_g_std, .g_std = vpbe_g_std,
.initialize = vpbe_initialize, .initialize = vpbe_initialize,
......
...@@ -393,7 +393,7 @@ vpbe_disp_calculate_scale_factor(struct vpbe_display *disp_dev, ...@@ -393,7 +393,7 @@ vpbe_disp_calculate_scale_factor(struct vpbe_display *disp_dev,
int h_scale; int h_scale;
int v_scale; int v_scale;
v4l2_std_id standard_id = vpbe_dev->current_timings.timings.std_id; v4l2_std_id standard_id = vpbe_dev->current_timings.std_id;
/* /*
* Application initially set the image format. Current display * Application initially set the image format. Current display
...@@ -943,7 +943,7 @@ static int vpbe_display_g_std(struct file *file, void *priv, ...@@ -943,7 +943,7 @@ static int vpbe_display_g_std(struct file *file, void *priv,
/* Get the standard from the current encoder */ /* Get the standard from the current encoder */
if (vpbe_dev->current_timings.timings_type & VPBE_ENC_STD) { if (vpbe_dev->current_timings.timings_type & VPBE_ENC_STD) {
*std_id = vpbe_dev->current_timings.timings.std_id; *std_id = vpbe_dev->current_timings.std_id;
return 0; return 0;
} }
...@@ -1029,29 +1029,29 @@ static int vpbe_display_g_output(struct file *file, void *priv, ...@@ -1029,29 +1029,29 @@ static int vpbe_display_g_output(struct file *file, void *priv,
} }
/** /**
* vpbe_display_enum_dv_presets - Enumerate the dv presets * vpbe_display_enum_dv_timings - Enumerate the dv timings
* *
* enum the preset in the current encoder. Return the status. 0 - success * enum the timings in the current encoder. Return the status. 0 - success
* -EINVAL on error * -EINVAL on error
*/ */
static int static int
vpbe_display_enum_dv_presets(struct file *file, void *priv, vpbe_display_enum_dv_timings(struct file *file, void *priv,
struct v4l2_dv_enum_preset *preset) struct v4l2_enum_dv_timings *timings)
{ {
struct vpbe_fh *fh = priv; struct vpbe_fh *fh = priv;
struct vpbe_device *vpbe_dev = fh->disp_dev->vpbe_dev; struct vpbe_device *vpbe_dev = fh->disp_dev->vpbe_dev;
int ret; int ret;
v4l2_dbg(1, debug, &vpbe_dev->v4l2_dev, "VIDIOC_ENUM_DV_PRESETS\n"); v4l2_dbg(1, debug, &vpbe_dev->v4l2_dev, "VIDIOC_ENUM_DV_TIMINGS\n");
/* Enumerate outputs */ /* Enumerate outputs */
if (NULL == vpbe_dev->ops.enum_dv_presets) if (NULL == vpbe_dev->ops.enum_dv_timings)
return -EINVAL; return -EINVAL;
ret = vpbe_dev->ops.enum_dv_presets(vpbe_dev, preset); ret = vpbe_dev->ops.enum_dv_timings(vpbe_dev, timings);
if (ret) { if (ret) {
v4l2_err(&vpbe_dev->v4l2_dev, v4l2_err(&vpbe_dev->v4l2_dev,
"Failed to enumerate dv presets info\n"); "Failed to enumerate dv timings info\n");
return -EINVAL; return -EINVAL;
} }
...@@ -1059,21 +1059,21 @@ vpbe_display_enum_dv_presets(struct file *file, void *priv, ...@@ -1059,21 +1059,21 @@ vpbe_display_enum_dv_presets(struct file *file, void *priv,
} }
/** /**
* vpbe_display_s_dv_preset - Set the dv presets * vpbe_display_s_dv_timings - Set the dv timings
* *
* Set the preset in the current encoder. Return the status. 0 - success * Set the timings in the current encoder. Return the status. 0 - success
* -EINVAL on error * -EINVAL on error
*/ */
static int static int
vpbe_display_s_dv_preset(struct file *file, void *priv, vpbe_display_s_dv_timings(struct file *file, void *priv,
struct v4l2_dv_preset *preset) struct v4l2_dv_timings *timings)
{ {
struct vpbe_fh *fh = priv; struct vpbe_fh *fh = priv;
struct vpbe_layer *layer = fh->layer; struct vpbe_layer *layer = fh->layer;
struct vpbe_device *vpbe_dev = fh->disp_dev->vpbe_dev; struct vpbe_device *vpbe_dev = fh->disp_dev->vpbe_dev;
int ret; int ret;
v4l2_dbg(1, debug, &vpbe_dev->v4l2_dev, "VIDIOC_S_DV_PRESETS\n"); v4l2_dbg(1, debug, &vpbe_dev->v4l2_dev, "VIDIOC_S_DV_TIMINGS\n");
/* If streaming is started, return error */ /* If streaming is started, return error */
...@@ -1083,13 +1083,13 @@ vpbe_display_s_dv_preset(struct file *file, void *priv, ...@@ -1083,13 +1083,13 @@ vpbe_display_s_dv_preset(struct file *file, void *priv,
} }
/* Set the given standard in the encoder */ /* Set the given standard in the encoder */
if (!vpbe_dev->ops.s_dv_preset) if (!vpbe_dev->ops.s_dv_timings)
return -EINVAL; return -EINVAL;
ret = vpbe_dev->ops.s_dv_preset(vpbe_dev, preset); ret = vpbe_dev->ops.s_dv_timings(vpbe_dev, timings);
if (ret) { if (ret) {
v4l2_err(&vpbe_dev->v4l2_dev, v4l2_err(&vpbe_dev->v4l2_dev,
"Failed to set the dv presets info\n"); "Failed to set the dv timings info\n");
return -EINVAL; return -EINVAL;
} }
/* set the current norm to zero to be consistent. If STD is used /* set the current norm to zero to be consistent. If STD is used
...@@ -1101,26 +1101,25 @@ vpbe_display_s_dv_preset(struct file *file, void *priv, ...@@ -1101,26 +1101,25 @@ vpbe_display_s_dv_preset(struct file *file, void *priv,
} }
/** /**
* vpbe_display_g_dv_preset - Set the dv presets * vpbe_display_g_dv_timings - Set the dv timings
* *
* Get the preset in the current encoder. Return the status. 0 - success * Get the timings in the current encoder. Return the status. 0 - success
* -EINVAL on error * -EINVAL on error
*/ */
static int static int
vpbe_display_g_dv_preset(struct file *file, void *priv, vpbe_display_g_dv_timings(struct file *file, void *priv,
struct v4l2_dv_preset *dv_preset) struct v4l2_dv_timings *dv_timings)
{ {
struct vpbe_fh *fh = priv; struct vpbe_fh *fh = priv;
struct vpbe_device *vpbe_dev = fh->disp_dev->vpbe_dev; struct vpbe_device *vpbe_dev = fh->disp_dev->vpbe_dev;
v4l2_dbg(1, debug, &vpbe_dev->v4l2_dev, "VIDIOC_G_DV_PRESETS\n"); v4l2_dbg(1, debug, &vpbe_dev->v4l2_dev, "VIDIOC_G_DV_TIMINGS\n");
/* Get the given standard in the encoder */ /* Get the given standard in the encoder */
if (vpbe_dev->current_timings.timings_type & if (vpbe_dev->current_timings.timings_type &
VPBE_ENC_DV_PRESET) { VPBE_ENC_CUSTOM_TIMINGS) {
dv_preset->preset = *dv_timings = vpbe_dev->current_timings.dv_timings;
vpbe_dev->current_timings.timings.dv_preset;
} else { } else {
return -EINVAL; return -EINVAL;
} }
...@@ -1572,9 +1571,9 @@ static const struct v4l2_ioctl_ops vpbe_ioctl_ops = { ...@@ -1572,9 +1571,9 @@ static const struct v4l2_ioctl_ops vpbe_ioctl_ops = {
.vidioc_enum_output = vpbe_display_enum_output, .vidioc_enum_output = vpbe_display_enum_output,
.vidioc_s_output = vpbe_display_s_output, .vidioc_s_output = vpbe_display_s_output,
.vidioc_g_output = vpbe_display_g_output, .vidioc_g_output = vpbe_display_g_output,
.vidioc_s_dv_preset = vpbe_display_s_dv_preset, .vidioc_s_dv_timings = vpbe_display_s_dv_timings,
.vidioc_g_dv_preset = vpbe_display_g_dv_preset, .vidioc_g_dv_timings = vpbe_display_g_dv_timings,
.vidioc_enum_dv_presets = vpbe_display_enum_dv_presets, .vidioc_enum_dv_timings = vpbe_display_enum_dv_timings,
#ifdef CONFIG_VIDEO_ADV_DEBUG #ifdef CONFIG_VIDEO_ADV_DEBUG
.vidioc_g_register = vpbe_display_g_register, .vidioc_g_register = vpbe_display_g_register,
.vidioc_s_register = vpbe_display_s_register, .vidioc_s_register = vpbe_display_s_register,
...@@ -1639,8 +1638,7 @@ static __devinit int init_vpbe_layer(int i, struct vpbe_display *disp_dev, ...@@ -1639,8 +1638,7 @@ static __devinit int init_vpbe_layer(int i, struct vpbe_display *disp_dev,
VPBE_ENC_STD) { VPBE_ENC_STD) {
vbd->tvnorms = (V4L2_STD_525_60 | V4L2_STD_625_50); vbd->tvnorms = (V4L2_STD_525_60 | V4L2_STD_625_50);
vbd->current_norm = vbd->current_norm =
disp_dev->vpbe_dev-> disp_dev->vpbe_dev->current_timings.std_id;
current_timings.timings.std_id;
} else } else
vbd->current_norm = 0; vbd->current_norm = 0;
......
...@@ -298,7 +298,7 @@ static int venc_set_480p59_94(struct v4l2_subdev *sd) ...@@ -298,7 +298,7 @@ static int venc_set_480p59_94(struct v4l2_subdev *sd)
return -EINVAL; return -EINVAL;
/* Setup clock at VPSS & VENC for SD */ /* Setup clock at VPSS & VENC for SD */
if (pdata->setup_clock(VPBE_ENC_DV_PRESET, V4L2_DV_480P59_94) < 0) if (pdata->setup_clock(VPBE_ENC_CUSTOM_TIMINGS, 27000000) < 0)
return -EINVAL; return -EINVAL;
venc_enabledigitaloutput(sd, 0); venc_enabledigitaloutput(sd, 0);
...@@ -345,7 +345,7 @@ static int venc_set_576p50(struct v4l2_subdev *sd) ...@@ -345,7 +345,7 @@ static int venc_set_576p50(struct v4l2_subdev *sd)
(pdata->venc_type != VPBE_VERSION_2)) (pdata->venc_type != VPBE_VERSION_2))
return -EINVAL; return -EINVAL;
/* Setup clock at VPSS & VENC for SD */ /* Setup clock at VPSS & VENC for SD */
if (pdata->setup_clock(VPBE_ENC_DV_PRESET, V4L2_DV_576P50) < 0) if (pdata->setup_clock(VPBE_ENC_CUSTOM_TIMINGS, 27000000) < 0)
return -EINVAL; return -EINVAL;
venc_enabledigitaloutput(sd, 0); venc_enabledigitaloutput(sd, 0);
...@@ -385,7 +385,7 @@ static int venc_set_720p60_internal(struct v4l2_subdev *sd) ...@@ -385,7 +385,7 @@ static int venc_set_720p60_internal(struct v4l2_subdev *sd)
struct venc_state *venc = to_state(sd); struct venc_state *venc = to_state(sd);
struct venc_platform_data *pdata = venc->pdata; struct venc_platform_data *pdata = venc->pdata;
if (pdata->setup_clock(VPBE_ENC_DV_PRESET, V4L2_DV_720P60) < 0) if (pdata->setup_clock(VPBE_ENC_CUSTOM_TIMINGS, 74250000) < 0)
return -EINVAL; return -EINVAL;
venc_enabledigitaloutput(sd, 0); venc_enabledigitaloutput(sd, 0);
...@@ -413,7 +413,7 @@ static int venc_set_1080i30_internal(struct v4l2_subdev *sd) ...@@ -413,7 +413,7 @@ static int venc_set_1080i30_internal(struct v4l2_subdev *sd)
struct venc_state *venc = to_state(sd); struct venc_state *venc = to_state(sd);
struct venc_platform_data *pdata = venc->pdata; struct venc_platform_data *pdata = venc->pdata;
if (pdata->setup_clock(VPBE_ENC_DV_PRESET, V4L2_DV_1080P30) < 0) if (pdata->setup_clock(VPBE_ENC_CUSTOM_TIMINGS, 74250000) < 0)
return -EINVAL; return -EINVAL;
venc_enabledigitaloutput(sd, 0); venc_enabledigitaloutput(sd, 0);
...@@ -446,26 +446,27 @@ static int venc_s_std_output(struct v4l2_subdev *sd, v4l2_std_id norm) ...@@ -446,26 +446,27 @@ static int venc_s_std_output(struct v4l2_subdev *sd, v4l2_std_id norm)
return -EINVAL; return -EINVAL;
} }
static int venc_s_dv_preset(struct v4l2_subdev *sd, static int venc_s_dv_timings(struct v4l2_subdev *sd,
struct v4l2_dv_preset *dv_preset) struct v4l2_dv_timings *dv_timings)
{ {
struct venc_state *venc = to_state(sd); struct venc_state *venc = to_state(sd);
u32 height = dv_timings->bt.height;
int ret; int ret;
v4l2_dbg(debug, 1, sd, "venc_s_dv_preset\n"); v4l2_dbg(debug, 1, sd, "venc_s_dv_timings\n");
if (dv_preset->preset == V4L2_DV_576P50) if (height == 576)
return venc_set_576p50(sd); return venc_set_576p50(sd);
else if (dv_preset->preset == V4L2_DV_480P59_94) else if (height == 480)
return venc_set_480p59_94(sd); return venc_set_480p59_94(sd);
else if ((dv_preset->preset == V4L2_DV_720P60) && else if ((height == 720) &&
(venc->pdata->venc_type == VPBE_VERSION_2)) { (venc->pdata->venc_type == VPBE_VERSION_2)) {
/* TBD setup internal 720p mode here */ /* TBD setup internal 720p mode here */
ret = venc_set_720p60_internal(sd); ret = venc_set_720p60_internal(sd);
/* for DM365 VPBE, there is DAC inside */ /* for DM365 VPBE, there is DAC inside */
vdaccfg_write(sd, VDAC_CONFIG_HD_V2); vdaccfg_write(sd, VDAC_CONFIG_HD_V2);
return ret; return ret;
} else if ((dv_preset->preset == V4L2_DV_1080I30) && } else if ((height == 1080) &&
(venc->pdata->venc_type == VPBE_VERSION_2)) { (venc->pdata->venc_type == VPBE_VERSION_2)) {
/* TBD setup internal 1080i mode here */ /* TBD setup internal 1080i mode here */
ret = venc_set_1080i30_internal(sd); ret = venc_set_1080i30_internal(sd);
...@@ -518,7 +519,7 @@ static const struct v4l2_subdev_core_ops venc_core_ops = { ...@@ -518,7 +519,7 @@ static const struct v4l2_subdev_core_ops venc_core_ops = {
static const struct v4l2_subdev_video_ops venc_video_ops = { static const struct v4l2_subdev_video_ops venc_video_ops = {
.s_routing = venc_s_routing, .s_routing = venc_s_routing,
.s_std_output = venc_s_std_output, .s_std_output = venc_s_std_output,
.s_dv_preset = venc_s_dv_preset, .s_dv_timings = venc_s_dv_timings,
}; };
static const struct v4l2_subdev_ops venc_ops = { static const struct v4l2_subdev_ops venc_ops = {
......
...@@ -35,7 +35,7 @@ struct osd_config_info { ...@@ -35,7 +35,7 @@ struct osd_config_info {
struct vpbe_output { struct vpbe_output {
struct v4l2_output output; struct v4l2_output output;
/* /*
* If output capabilities include dv_preset, list supported presets * If output capabilities include dv_timings, list supported timings
* below * below
*/ */
char *subdev_name; char *subdev_name;
...@@ -120,16 +120,16 @@ struct vpbe_device_ops { ...@@ -120,16 +120,16 @@ struct vpbe_device_ops {
unsigned int (*get_output)(struct vpbe_device *vpbe_dev); unsigned int (*get_output)(struct vpbe_device *vpbe_dev);
/* Set DV preset at current output */ /* Set DV preset at current output */
int (*s_dv_preset)(struct vpbe_device *vpbe_dev, int (*s_dv_timings)(struct vpbe_device *vpbe_dev,
struct v4l2_dv_preset *dv_preset); struct v4l2_dv_timings *dv_timings);
/* Get DV presets supported at the output */ /* Get DV presets supported at the output */
int (*g_dv_preset)(struct vpbe_device *vpbe_dev, int (*g_dv_timings)(struct vpbe_device *vpbe_dev,
struct v4l2_dv_preset *dv_preset); struct v4l2_dv_timings *dv_timings);
/* Enumerate the DV Presets supported at the output */ /* Enumerate the DV Presets supported at the output */
int (*enum_dv_presets)(struct vpbe_device *vpbe_dev, int (*enum_dv_timings)(struct vpbe_device *vpbe_dev,
struct v4l2_dv_enum_preset *preset_info); struct v4l2_enum_dv_timings *timings_info);
/* Set std at the output */ /* Set std at the output */
int (*s_std)(struct vpbe_device *vpbe_dev, v4l2_std_id *std_id); int (*s_std)(struct vpbe_device *vpbe_dev, v4l2_std_id *std_id);
......
...@@ -32,11 +32,6 @@ enum vpbe_enc_timings_type { ...@@ -32,11 +32,6 @@ enum vpbe_enc_timings_type {
VPBE_ENC_TIMINGS_INVALID = 0x8, VPBE_ENC_TIMINGS_INVALID = 0x8,
}; };
union vpbe_timings {
v4l2_std_id std_id;
unsigned int dv_preset;
};
/* /*
* struct vpbe_enc_mode_info * struct vpbe_enc_mode_info
* @name: ptr to name string of the standard, "NTSC", "PAL" etc * @name: ptr to name string of the standard, "NTSC", "PAL" etc
...@@ -73,7 +68,8 @@ union vpbe_timings { ...@@ -73,7 +68,8 @@ union vpbe_timings {
struct vpbe_enc_mode_info { struct vpbe_enc_mode_info {
unsigned char *name; unsigned char *name;
enum vpbe_enc_timings_type timings_type; enum vpbe_enc_timings_type timings_type;
union vpbe_timings timings; v4l2_std_id std_id;
struct v4l2_dv_timings dv_timings;
unsigned int interlaced; unsigned int interlaced;
unsigned int xres; unsigned int xres;
unsigned int yres; unsigned int yres;
......
...@@ -32,7 +32,7 @@ struct venc_platform_data { ...@@ -32,7 +32,7 @@ struct venc_platform_data {
int (*setup_pinmux)(enum v4l2_mbus_pixelcode if_type, int (*setup_pinmux)(enum v4l2_mbus_pixelcode if_type,
int field); int field);
int (*setup_clock)(enum vpbe_enc_timings_type type, int (*setup_clock)(enum vpbe_enc_timings_type type,
unsigned int mode); unsigned int pixclock);
int (*setup_if_config)(enum v4l2_mbus_pixelcode pixcode); int (*setup_if_config)(enum v4l2_mbus_pixelcode pixcode);
/* Number of LCD outputs supported */ /* Number of LCD outputs supported */
int num_lcd_outputs; int num_lcd_outputs;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册