[media] tvp7002: use dv_timings structs instead of presets
In the functions tvp7002_mbus_fmt(), tvp7002_log_status and tvp7002_probe() we should use the dv_timings data structures instead of dv_preset data structures and functions. This is the second step towards removing the deprecated preset support of this driver. Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Acked-by: Lad, Prabhakar <prabhakar.lad@ti.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
This commit is contained in:
parent
f0cd015e31
commit
f96067af1f
|
@ -677,16 +677,10 @@ static int tvp7002_s_ctrl(struct v4l2_ctrl *ctrl)
|
||||||
static int tvp7002_mbus_fmt(struct v4l2_subdev *sd, struct v4l2_mbus_framefmt *f)
|
static int tvp7002_mbus_fmt(struct v4l2_subdev *sd, struct v4l2_mbus_framefmt *f)
|
||||||
{
|
{
|
||||||
struct tvp7002 *device = to_tvp7002(sd);
|
struct tvp7002 *device = to_tvp7002(sd);
|
||||||
struct v4l2_dv_enum_preset e_preset;
|
const struct v4l2_bt_timings *bt = &device->current_timings->timings.bt;
|
||||||
int error;
|
|
||||||
|
|
||||||
/* Calculate height and width based on current standard */
|
f->width = bt->width;
|
||||||
error = v4l_fill_dv_preset_info(device->current_timings->preset, &e_preset);
|
f->height = bt->height;
|
||||||
if (error)
|
|
||||||
return error;
|
|
||||||
|
|
||||||
f->width = e_preset.width;
|
|
||||||
f->height = e_preset.height;
|
|
||||||
f->code = V4L2_MBUS_FMT_YUYV10_1X20;
|
f->code = V4L2_MBUS_FMT_YUYV10_1X20;
|
||||||
f->field = device->current_timings->scanmode;
|
f->field = device->current_timings->scanmode;
|
||||||
f->colorspace = device->current_timings->color_space;
|
f->colorspace = device->current_timings->color_space;
|
||||||
|
@ -896,35 +890,21 @@ static int tvp7002_s_stream(struct v4l2_subdev *sd, int enable)
|
||||||
*/
|
*/
|
||||||
static int tvp7002_log_status(struct v4l2_subdev *sd)
|
static int tvp7002_log_status(struct v4l2_subdev *sd)
|
||||||
{
|
{
|
||||||
const struct tvp7002_timings_definition *timings = tvp7002_timings;
|
|
||||||
struct tvp7002 *device = to_tvp7002(sd);
|
struct tvp7002 *device = to_tvp7002(sd);
|
||||||
struct v4l2_dv_enum_preset e_preset;
|
const struct v4l2_bt_timings *bt;
|
||||||
struct v4l2_dv_preset detected;
|
int detected;
|
||||||
int i;
|
|
||||||
|
|
||||||
detected.preset = V4L2_DV_INVALID;
|
/* Find my current timings */
|
||||||
/* Find my current standard*/
|
tvp7002_query_dv(sd, &detected);
|
||||||
tvp7002_query_dv_preset(sd, &detected);
|
|
||||||
|
|
||||||
/* Print standard related code values */
|
bt = &device->current_timings->timings.bt;
|
||||||
for (i = 0; i < NUM_TIMINGS; i++, timings++)
|
v4l2_info(sd, "Selected DV Timings: %ux%u\n", bt->width, bt->height);
|
||||||
if (timings->preset == detected.preset)
|
if (detected == NUM_TIMINGS) {
|
||||||
break;
|
v4l2_info(sd, "Detected DV Timings: None\n");
|
||||||
|
|
||||||
if (v4l_fill_dv_preset_info(device->current_timings->preset, &e_preset))
|
|
||||||
return -EINVAL;
|
|
||||||
|
|
||||||
v4l2_info(sd, "Selected DV Preset: %s\n", e_preset.name);
|
|
||||||
v4l2_info(sd, " Pixels per line: %u\n", e_preset.width);
|
|
||||||
v4l2_info(sd, " Lines per frame: %u\n\n", e_preset.height);
|
|
||||||
if (i == NUM_TIMINGS) {
|
|
||||||
v4l2_info(sd, "Detected DV Preset: None\n");
|
|
||||||
} else {
|
} else {
|
||||||
if (v4l_fill_dv_preset_info(timings->preset, &e_preset))
|
bt = &tvp7002_timings[detected].timings.bt;
|
||||||
return -EINVAL;
|
v4l2_info(sd, "Detected DV Timings: %ux%u\n",
|
||||||
v4l2_info(sd, "Detected DV Preset: %s\n", e_preset.name);
|
bt->width, bt->height);
|
||||||
v4l2_info(sd, " Pixels per line: %u\n", e_preset.width);
|
|
||||||
v4l2_info(sd, " Lines per frame: %u\n\n", e_preset.height);
|
|
||||||
}
|
}
|
||||||
v4l2_info(sd, "Streaming enabled: %s\n",
|
v4l2_info(sd, "Streaming enabled: %s\n",
|
||||||
device->streaming ? "yes" : "no");
|
device->streaming ? "yes" : "no");
|
||||||
|
@ -1019,7 +999,7 @@ static int tvp7002_probe(struct i2c_client *c, const struct i2c_device_id *id)
|
||||||
{
|
{
|
||||||
struct v4l2_subdev *sd;
|
struct v4l2_subdev *sd;
|
||||||
struct tvp7002 *device;
|
struct tvp7002 *device;
|
||||||
struct v4l2_dv_preset preset;
|
struct v4l2_dv_timings timings;
|
||||||
int polarity_a;
|
int polarity_a;
|
||||||
int polarity_b;
|
int polarity_b;
|
||||||
u8 revision;
|
u8 revision;
|
||||||
|
@ -1080,8 +1060,8 @@ static int tvp7002_probe(struct i2c_client *c, const struct i2c_device_id *id)
|
||||||
return error;
|
return error;
|
||||||
|
|
||||||
/* Set registers according to default video mode */
|
/* Set registers according to default video mode */
|
||||||
preset.preset = device->current_timings->preset;
|
timings = device->current_timings->timings;
|
||||||
error = tvp7002_s_dv_preset(sd, &preset);
|
error = tvp7002_s_dv_timings(sd, &timings);
|
||||||
|
|
||||||
v4l2_ctrl_handler_init(&device->hdl, 1);
|
v4l2_ctrl_handler_init(&device->hdl, 1);
|
||||||
v4l2_ctrl_new_std(&device->hdl, &tvp7002_ctrl_ops,
|
v4l2_ctrl_new_std(&device->hdl, &tvp7002_ctrl_ops,
|
||||||
|
|
Loading…
Reference in New Issue