Skip to contentSkip to conversation

Remove DV_PRESET API

RFC PATCH In review Hans Verkuil 5 participants 36 messages Feb 16, 2013 – Mar 1, 2013

Subsystems (7)
lore
Share & tools
lore
#0 lore raw

cover Remove DV_PRESET API

Hi all!

This patch series removes the last remnants of the deprecated DV_PRESET API from the kernel:

- remove the dv_preset ops from the tvp7002 driver: all bridge drivers that use this i2c driver have already been converted to the DV_TIMINGS API, so these ops are no longer used. Prabhakar, can you test this for me?

- fix some remaining references to the preset API from the davinci drivers. It's trivial stuff, but I would appreciate it if you can look at it, Prabhakar.

- rename some CUSTOM_TIMINGS defines to DV_TIMINGS since CUSTOM_TIMINGS is deprecated. It certainly shouldn't be used anymore in the kernel. Trivial patches, but please look at it as well, Prabhakar and Scott.

- convert the s5p-tv drivers from the DV_PRESET to the DV_TIMINGS API and remove the DV_PRESET API. Tomasz or Kyungmin Park, can you test this? I do not know whether removal of the DV_PRESET API is possible at this stage for the s5p-tv since I do not know if any code inside Samsung uses the DV_PRESET API. If the DV_PRESET API cannot be removed at this time, then let me know. I would have to make some changes to allow the preset and timings APIs to co-exist. I would really like to remove the preset API some time this year, though, if only to prevent new drivers from attempting to use the preset API.

- finally remove the remaining core DV_PRESET support.

- remove the DV_PRESET API from the videodev2.h header. Note that I am not at all certain if we should do this. I know that the DV_PRESET API has only been used in embedded systems, so the impact should be very limited. But it is probably better to wait for a year or so before actually removing it from the header. The main reason for adding this removal is to verify that I haven't forgotten any driver conversions.

Comments are welcome!

Regards,

Hans

#1 lore raw

RFC PATCH 2/18 tvp7002: use dv_timings structs instead of presets.

From: Hans Verkuil <[email protected]>

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.

---
 drivers/media/i2c/tvp7002.c |   54 ++++++++++++++-----------------------------
 1 file changed, 17 insertions(+), 37 deletions(-)
drivers/media/i2c/tvp7002.c +17 -37
index 7995eeb..d7a08bc 100644
@@ -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)
 {
 	struct tvp7002 *device = to_tvp7002(sd);
-	struct v4l2_dv_enum_preset e_preset;
-	int error;
-
-	/* Calculate height and width based on current standard */
-	error = v4l_fill_dv_preset_info(device->current_timings->preset, &e_preset);
-	if (error)
-		return error;
+	const struct v4l2_bt_timings *bt = &device->current_timings->timings.bt;
 
-	f->width = e_preset.width;
-	f->height = e_preset.height;
+	f->width = bt->width;
+	f->height = bt->height;
 	f->code = V4L2_MBUS_FMT_YUYV10_1X20;
 	f->field = device->current_timings->scanmode;
 	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)
 {
-	const struct tvp7002_timings_definition *timings = tvp7002_timings;
 	struct tvp7002 *device = to_tvp7002(sd);
-	struct v4l2_dv_enum_preset e_preset;
-	struct v4l2_dv_preset detected;
-	int i;
+	const struct v4l2_bt_timings *bt;
+	int detected;
 
-	detected.preset = V4L2_DV_INVALID;
-	/* Find my current standard*/
-	tvp7002_query_dv_preset(sd, &detected);
+	/* Find my current timings */
+	tvp7002_query_dv(sd, &detected);
 
-	/* Print standard related code values */
-	for (i = 0; i < NUM_TIMINGS; i++, timings++)
-		if (timings->preset == detected.preset)
-			break;
-
-	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");
+	bt = &device->current_timings->timings.bt;
+	v4l2_info(sd, "Selected DV Timings: %ux%u\n", bt->width, bt->height);
+	if (detected == NUM_TIMINGS) {
+		v4l2_info(sd, "Detected DV Timings: None\n");
 	} else {
-		if (v4l_fill_dv_preset_info(timings->preset, &e_preset))
-			return -EINVAL;
-		v4l2_info(sd, "Detected 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);
+		bt = &tvp7002_timings[detected].timings.bt;
+		v4l2_info(sd, "Detected DV Timings: %ux%u\n",
+				bt->width, bt->height);
 	}
 	v4l2_info(sd, "Streaming enabled: %s\n",
 					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 tvp7002 *device;
-	struct v4l2_dv_preset preset;
+	struct v4l2_dv_timings timings;
 	int polarity_a;
 	int polarity_b;
 	u8 revision;
@@ -1080,8 +1060,8 @@ static int tvp7002_probe(struct i2c_client *c, const struct i2c_device_id *id)
 		return error;
 
 	/* Set registers according to default video mode */
-	preset.preset = device->current_timings->preset;
-	error = tvp7002_s_dv_preset(sd, &preset);
+	timings = device->current_timings->timings;
+	error = tvp7002_s_dv_timings(sd, &timings);
 
 	v4l2_ctrl_handler_init(&device->hdl, 1);
 	v4l2_ctrl_new_std(&device->hdl, &tvp7002_ctrl_ops,
Signature · 1 line
1.7.10.4
maintainer Acked-by Lad, Prabhakar on v1 2/18
#2 lore raw

Re: [RFC PATCH 02/18] tvp7002: use dv_timings structs instead of presets.

Hi Hans,

Quoted 11 lines · Hans Verkuil

From: Hans Verkuil <[email protected]>

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.

Regards,
--Prabhakar

Quoted 98 lines
---
 drivers/media/i2c/tvp7002.c |   54 ++++++++++++++-----------------------------
 1 file changed, 17 insertions(+), 37 deletions(-)
drivers/media/i2c/tvp7002.c +17 -38
index 7995eeb..d7a08bc 100644
@@ -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)
 {
        struct tvp7002 *device = to_tvp7002(sd);
-       struct v4l2_dv_enum_preset e_preset;
-       int error;
-
-       /* Calculate height and width based on current standard */
-       error = v4l_fill_dv_preset_info(device->current_timings->preset, &e_preset);
-       if (error)
-               return error;
+       const struct v4l2_bt_timings *bt = &device->current_timings->timings.bt;
 
-       f->width = e_preset.width;
-       f->height = e_preset.height;
+       f->width = bt->width;
+       f->height = bt->height;
        f->code = V4L2_MBUS_FMT_YUYV10_1X20;
        f->field = device->current_timings->scanmode;
        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)
 {
-       const struct tvp7002_timings_definition *timings = tvp7002_timings;
        struct tvp7002 *device = to_tvp7002(sd);
-       struct v4l2_dv_enum_preset e_preset;
-       struct v4l2_dv_preset detected;
-       int i;
+       const struct v4l2_bt_timings *bt;
+       int detected;
 
-       detected.preset = V4L2_DV_INVALID;
-       /* Find my current standard*/
-       tvp7002_query_dv_preset(sd, &detected);
+       /* Find my current timings */
+       tvp7002_query_dv(sd, &detected);
 
-       /* Print standard related code values */
-       for (i = 0; i < NUM_TIMINGS; i++, timings++)
-               if (timings->preset == detected.preset)
-                       break;
-
-       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");
+       bt = &device->current_timings->timings.bt;
+       v4l2_info(sd, "Selected DV Timings: %ux%u\n", bt->width, bt->height);
+       if (detected == NUM_TIMINGS) {
+               v4l2_info(sd, "Detected DV Timings: None\n");
        } else {
-               if (v4l_fill_dv_preset_info(timings->preset, &e_preset))
-                       return -EINVAL;
-               v4l2_info(sd, "Detected 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);
+               bt = &tvp7002_timings[detected].timings.bt;
+               v4l2_info(sd, "Detected DV Timings: %ux%u\n",
+                               bt->width, bt->height);
        }
        v4l2_info(sd, "Streaming enabled: %s\n",
                                        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 tvp7002 *device;
-       struct v4l2_dv_preset preset;
+       struct v4l2_dv_timings timings;
        int polarity_a;
        int polarity_b;
        u8 revision;
@@ -1080,8 +1060,8 @@ static int tvp7002_probe(struct i2c_client *c, const struct i2c_device_id *id)
                return error;
 
        /* Set registers according to default video mode */
-       preset.preset = device->current_timings->preset;
-       error = tvp7002_s_dv_preset(sd, &preset);
+       timings = device->current_timings->timings;
+       error = tvp7002_s_dv_timings(sd, &timings);
 
        v4l2_ctrl_handler_init(&device->hdl, 1);
        v4l2_ctrl_new_std(&device->hdl, &tvp7002_ctrl_ops,
--

1.7.10.4

#3 lore raw

RFC PATCH 3/18 tvp7002: remove dv_preset support.

In reply to Hans Verkuil

From: Hans Verkuil <[email protected]>

Finally remove the dv_preset support from this driver. Note that dv_preset support was already removed from any bridge drivers that use this i2c driver, so the dv_preset ops were no longer called and can be removed safely.

---
 drivers/media/i2c/tvp7002.c |   70 -------------------------------------------
 1 file changed, 70 deletions(-)
drivers/media/i2c/tvp7002.c +0 -70
index d7a08bc..7406de9 100644
@@ -328,7 +328,6 @@ static const struct i2c_reg_value tvp7002_parms_720P50[] = {
 
 /* Timings definition for handling device operation */
 struct tvp7002_timings_definition {
-	u32 preset;
 	struct v4l2_dv_timings timings;
 	const struct i2c_reg_value *p_settings;
 	enum v4l2_colorspace color_space;
@@ -342,7 +341,6 @@ struct tvp7002_timings_definition {
 /* Struct list for digital video timings */
 static const struct tvp7002_timings_definition tvp7002_timings[] = {
 	{
-		V4L2_DV_720P60,
 		V4L2_DV_BT_CEA_1280X720P60,
 		tvp7002_parms_720P60,
 		V4L2_COLORSPACE_REC709,
@@ -353,7 +351,6 @@ static const struct tvp7002_timings_definition tvp7002_timings[] = {
 		153
 	},
 	{
-		V4L2_DV_1080I60,
 		V4L2_DV_BT_CEA_1920X1080I60,
 		tvp7002_parms_1080I60,
 		V4L2_COLORSPACE_REC709,
@@ -364,7 +361,6 @@ static const struct tvp7002_timings_definition tvp7002_timings[] = {
 		205
 	},
 	{
-		V4L2_DV_1080I50,
 		V4L2_DV_BT_CEA_1920X1080I50,
 		tvp7002_parms_1080I50,
 		V4L2_COLORSPACE_REC709,
@@ -375,7 +371,6 @@ static const struct tvp7002_timings_definition tvp7002_timings[] = {
 		245
 	},
 	{
-		V4L2_DV_720P50,
 		V4L2_DV_BT_CEA_1280X720P50,
 		tvp7002_parms_720P50,
 		V4L2_COLORSPACE_REC709,
@@ -386,7 +381,6 @@ static const struct tvp7002_timings_definition tvp7002_timings[] = {
 		183
 	},
 	{
-		V4L2_DV_1080P60,
 		V4L2_DV_BT_CEA_1920X1080P60,
 		tvp7002_parms_1080P60,
 		V4L2_COLORSPACE_REC709,
@@ -397,7 +391,6 @@ static const struct tvp7002_timings_definition tvp7002_timings[] = {
 		102
 	},
 	{
-		V4L2_DV_480P59_94,
 		V4L2_DV_BT_CEA_720X480P59_94,
 		tvp7002_parms_480P,
 		V4L2_COLORSPACE_SMPTE170M,
@@ -408,7 +401,6 @@ static const struct tvp7002_timings_definition tvp7002_timings[] = {
 		0xffff
 	},
 	{
-		V4L2_DV_576P50,
 		V4L2_DV_BT_CEA_720X576P50,
 		tvp7002_parms_576P,
 		V4L2_COLORSPACE_SMPTE170M,
@@ -588,32 +580,6 @@ static int tvp7002_write_inittab(struct v4l2_subdev *sd,
 	return error;
 }
 
-/*
- * tvp7002_s_dv_preset() - Set digital video preset
- * @sd: ptr to v4l2_subdev struct
- * @dv_preset: ptr to v4l2_dv_preset struct
- *
- * Set the digital video preset for a TVP7002 decoder device.
- * Returns zero when successful or -EINVAL if register access fails.
- */
-static int tvp7002_s_dv_preset(struct v4l2_subdev *sd,
-					struct v4l2_dv_preset *dv_preset)
-{
-	struct tvp7002 *device = to_tvp7002(sd);
-	u32 preset;
-	int i;
-
-	for (i = 0; i < NUM_TIMINGS; i++) {
-		preset = tvp7002_timings[i].preset;
-		if (preset == dv_preset->preset) {
-			device->current_timings = &tvp7002_timings[i];
-			return tvp7002_write_inittab(sd, tvp7002_timings[i].p_settings);
-		}
-	}
-
-	return -EINVAL;
-}
-
 static int tvp7002_s_dv_timings(struct v4l2_subdev *sd,
 					struct v4l2_dv_timings *dv_timings)
 {
@@ -752,22 +718,6 @@ static int tvp7002_query_dv(struct v4l2_subdev *sd, int *index)
 	return 0;
 }
 
-static int tvp7002_query_dv_preset(struct v4l2_subdev *sd,
-					struct v4l2_dv_preset *qpreset)
-{
-	int index;
-	int err = tvp7002_query_dv(sd, &index);
-
-	if (err || index == NUM_TIMINGS) {
-		qpreset->preset = V4L2_DV_INVALID;
-		if (err == -ENOLINK)
-			err = 0;
-		return err;
-	}
-	qpreset->preset = tvp7002_timings[index].preset;
-	return 0;
-}
-
 static int tvp7002_query_dv_timings(struct v4l2_subdev *sd,
 					struct v4l2_dv_timings *timings)
 {
@@ -915,23 +865,6 @@ static int tvp7002_log_status(struct v4l2_subdev *sd)
 	return 0;
 }
 
-/*
- * tvp7002_enum_dv_presets() - Enum supported digital video formats
- * @sd: pointer to standard V4L2 sub-device structure
- * @preset: pointer to format struct
- *
- * Enumerate supported digital video formats.
- */
-static int tvp7002_enum_dv_presets(struct v4l2_subdev *sd,
-		struct v4l2_dv_enum_preset *preset)
-{
-	/* Check requested format index is within range */
-	if (preset->index >= NUM_TIMINGS)
-		return -EINVAL;
-
-	return v4l_fill_dv_preset_info(tvp7002_timings[preset->index].preset, preset);
-}
-
 static int tvp7002_enum_dv_timings(struct v4l2_subdev *sd,
 		struct v4l2_enum_dv_timings *timings)
 {
@@ -966,9 +899,6 @@ static const struct v4l2_subdev_core_ops tvp7002_core_ops = {
 
 /* Specific video subsystem operation handlers */
 static const struct v4l2_subdev_video_ops tvp7002_video_ops = {
-	.enum_dv_presets = tvp7002_enum_dv_presets,
-	.s_dv_preset = tvp7002_s_dv_preset,
-	.query_dv_preset = tvp7002_query_dv_preset,
 	.g_dv_timings = tvp7002_g_dv_timings,
 	.s_dv_timings = tvp7002_s_dv_timings,
 	.enum_dv_timings = tvp7002_enum_dv_timings,
Signature · 1 line
1.7.10.4
maintainer Acked-by Lad, Prabhakar on v1 3/18
#4 lore raw

Re: [RFC PATCH 03/18] tvp7002: remove dv_preset support.

Hi Hans,

Quoted 9 lines · Hans Verkuil

From: Hans Verkuil <[email protected]>

Finally remove the dv_preset support from this driver. Note that dv_preset support was already removed from any bridge drivers that use this i2c driver, so the dv_preset ops were no longer called and can be removed safely.

Regards,
--Prabhakar

Quoted 165 lines
---
 drivers/media/i2c/tvp7002.c |   70 -------------------------------------------
 1 file changed, 70 deletions(-)
drivers/media/i2c/tvp7002.c +0 -71
index d7a08bc..7406de9 100644
@@ -328,7 +328,6 @@ static const struct i2c_reg_value tvp7002_parms_720P50[] = {
 
 /* Timings definition for handling device operation */
 struct tvp7002_timings_definition {
-       u32 preset;
        struct v4l2_dv_timings timings;
        const struct i2c_reg_value *p_settings;
        enum v4l2_colorspace color_space;
@@ -342,7 +341,6 @@ struct tvp7002_timings_definition {
 /* Struct list for digital video timings */
 static const struct tvp7002_timings_definition tvp7002_timings[] = {
        {
-               V4L2_DV_720P60,
                V4L2_DV_BT_CEA_1280X720P60,
                tvp7002_parms_720P60,
                V4L2_COLORSPACE_REC709,
@@ -353,7 +351,6 @@ static const struct tvp7002_timings_definition tvp7002_timings[] = {
                153
        },
        {
-               V4L2_DV_1080I60,
                V4L2_DV_BT_CEA_1920X1080I60,
                tvp7002_parms_1080I60,
                V4L2_COLORSPACE_REC709,
@@ -364,7 +361,6 @@ static const struct tvp7002_timings_definition tvp7002_timings[] = {
                205
        },
        {
-               V4L2_DV_1080I50,
                V4L2_DV_BT_CEA_1920X1080I50,
                tvp7002_parms_1080I50,
                V4L2_COLORSPACE_REC709,
@@ -375,7 +371,6 @@ static const struct tvp7002_timings_definition tvp7002_timings[] = {
                245
        },
        {
-               V4L2_DV_720P50,
                V4L2_DV_BT_CEA_1280X720P50,
                tvp7002_parms_720P50,
                V4L2_COLORSPACE_REC709,
@@ -386,7 +381,6 @@ static const struct tvp7002_timings_definition tvp7002_timings[] = {
                183
        },
        {
-               V4L2_DV_1080P60,
                V4L2_DV_BT_CEA_1920X1080P60,
                tvp7002_parms_1080P60,
                V4L2_COLORSPACE_REC709,
@@ -397,7 +391,6 @@ static const struct tvp7002_timings_definition tvp7002_timings[] = {
                102
        },
        {
-               V4L2_DV_480P59_94,
                V4L2_DV_BT_CEA_720X480P59_94,
                tvp7002_parms_480P,
                V4L2_COLORSPACE_SMPTE170M,
@@ -408,7 +401,6 @@ static const struct tvp7002_timings_definition tvp7002_timings[] = {
                0xffff
        },
        {
-               V4L2_DV_576P50,
                V4L2_DV_BT_CEA_720X576P50,
                tvp7002_parms_576P,
                V4L2_COLORSPACE_SMPTE170M,
@@ -588,32 +580,6 @@ static int tvp7002_write_inittab(struct v4l2_subdev *sd,
        return error;
 }
 
-/*
- * tvp7002_s_dv_preset() - Set digital video preset
- * @sd: ptr to v4l2_subdev struct
- * @dv_preset: ptr to v4l2_dv_preset struct
- *
- * Set the digital video preset for a TVP7002 decoder device.
- * Returns zero when successful or -EINVAL if register access fails.
- */
-static int tvp7002_s_dv_preset(struct v4l2_subdev *sd,
-                                       struct v4l2_dv_preset *dv_preset)
-{
-       struct tvp7002 *device = to_tvp7002(sd);
-       u32 preset;
-       int i;
-
-       for (i = 0; i < NUM_TIMINGS; i++) {
-               preset = tvp7002_timings[i].preset;
-               if (preset == dv_preset->preset) {
-                       device->current_timings = &tvp7002_timings[i];
-                       return tvp7002_write_inittab(sd, tvp7002_timings[i].p_settings);
-               }
-       }
-
-       return -EINVAL;
-}
-
 static int tvp7002_s_dv_timings(struct v4l2_subdev *sd,
                                        struct v4l2_dv_timings *dv_timings)
 {
@@ -752,22 +718,6 @@ static int tvp7002_query_dv(struct v4l2_subdev *sd, int *index)
        return 0;
 }
 
-static int tvp7002_query_dv_preset(struct v4l2_subdev *sd,
-                                       struct v4l2_dv_preset *qpreset)
-{
-       int index;
-       int err = tvp7002_query_dv(sd, &index);
-
-       if (err || index == NUM_TIMINGS) {
-               qpreset->preset = V4L2_DV_INVALID;
-               if (err == -ENOLINK)
-                       err = 0;
-               return err;
-       }
-       qpreset->preset = tvp7002_timings[index].preset;
-       return 0;
-}
-
 static int tvp7002_query_dv_timings(struct v4l2_subdev *sd,
                                        struct v4l2_dv_timings *timings)
 {
@@ -915,23 +865,6 @@ static int tvp7002_log_status(struct v4l2_subdev *sd)
        return 0;
 }
 
-/*
- * tvp7002_enum_dv_presets() - Enum supported digital video formats
- * @sd: pointer to standard V4L2 sub-device structure
- * @preset: pointer to format struct
- *
- * Enumerate supported digital video formats.
- */
-static int tvp7002_enum_dv_presets(struct v4l2_subdev *sd,
-               struct v4l2_dv_enum_preset *preset)
-{
-       /* Check requested format index is within range */
-       if (preset->index >= NUM_TIMINGS)
-               return -EINVAL;
-
-       return v4l_fill_dv_preset_info(tvp7002_timings[preset->index].preset, preset);
-}
-
 static int tvp7002_enum_dv_timings(struct v4l2_subdev *sd,
                struct v4l2_enum_dv_timings *timings)
 {
@@ -966,9 +899,6 @@ static const struct v4l2_subdev_core_ops tvp7002_core_ops = {
 
 /* Specific video subsystem operation handlers */
 static const struct v4l2_subdev_video_ops tvp7002_video_ops = {
-       .enum_dv_presets = tvp7002_enum_dv_presets,
-       .s_dv_preset = tvp7002_s_dv_preset,
-       .query_dv_preset = tvp7002_query_dv_preset,
        .g_dv_timings = tvp7002_g_dv_timings,
        .s_dv_timings = tvp7002_s_dv_timings,
        .enum_dv_timings = tvp7002_enum_dv_timings,
--

1.7.10.4

#5 lore raw

RFC PATCH 4/18 davinci_vpfe: fix copy-paste errors in several comments.

In reply to Hans Verkuil

From: Hans Verkuil <[email protected]>

This removes some incorrect dv_preset references left over from copy-and-paste errors.

---
 drivers/staging/media/davinci_vpfe/vpfe_video.c |   12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)
drivers/staging/media/davinci_vpfe/vpfe_video.c +6 -6
index 99ccbeb..19dc5b0 100644
@@ -1016,12 +1016,12 @@ vpfe_query_dv_timings(struct file *file, void *fh,
 }
 
 /*
- * vpfe_s_dv_timings() - set dv_preset on external subdev
+ * vpfe_s_dv_timings() - set dv_timings on external subdev
  * @file: file pointer
  * @priv: void pointer
  * @timings: pointer to v4l2_dv_timings structure
  *
- * set dv_timings pointed by preset on external subdev through
+ * set dv_timings pointed by timings on external subdev through
  * v4l2_device_call_until_err, this configures amplifier also
  *
  * Return 0 on success, error code otherwise
@@ -1042,12 +1042,12 @@ vpfe_s_dv_timings(struct file *file, void *fh,
 }
 
 /*
- * vpfe_g_dv_timings() - get dv_preset which is set on external subdev
+ * vpfe_g_dv_timings() - get dv_timings which is set on external subdev
  * @file: file pointer
  * @priv: void pointer
  * @timings: pointer to v4l2_dv_timings structure
  *
- * get dv_preset which is set on external subdev through
+ * get dv_timings which is set on external subdev through
  * v4l2_subdev_call
  *
  * Return 0 on success, error code otherwise
@@ -1423,7 +1423,7 @@ static int vpfe_dqbuf(struct file *file, void *priv,
 }
 
 /*
- * vpfe_streamon() - get dv_preset which is set on external subdev
+ * vpfe_streamon() - start streaming
  * @file: file pointer
  * @priv: void pointer
  * @buf_type: enum v4l2_buf_type
@@ -1472,7 +1472,7 @@ static int vpfe_streamon(struct file *file, void *priv,
 }
 
 /*
- * vpfe_streamoff() - get dv_preset which is set on external subdev
+ * vpfe_streamoff() - stop streaming
  * @file: file pointer
  * @priv: void pointer
  * @buf_type: enum v4l2_buf_type
Signature · 1 line
1.7.10.4
maintainer Acked-by Lad, Prabhakar on v1 4/18
#6 lore raw

Re: [RFC PATCH 04/18] davinci_vpfe: fix copy-paste errors in several comments.

Hi Hans,

Thanks for the patch.

Quoted 7 lines · Hans Verkuil

From: Hans Verkuil <[email protected]>

This removes some incorrect dv_preset references left over from copy-and-paste errors.

Regards,
--Prabhakar

Quoted 59 lines
---
 drivers/staging/media/davinci_vpfe/vpfe_video.c |   12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)
drivers/staging/media/davinci_vpfe/vpfe_video.c +6 -7
index 99ccbeb..19dc5b0 100644
@@ -1016,12 +1016,12 @@ vpfe_query_dv_timings(struct file *file, void *fh,
 }
 
 /*
- * vpfe_s_dv_timings() - set dv_preset on external subdev
+ * vpfe_s_dv_timings() - set dv_timings on external subdev
  * @file: file pointer
  * @priv: void pointer
  * @timings: pointer to v4l2_dv_timings structure
  *
- * set dv_timings pointed by preset on external subdev through
+ * set dv_timings pointed by timings on external subdev through
  * v4l2_device_call_until_err, this configures amplifier also
  *
  * Return 0 on success, error code otherwise
@@ -1042,12 +1042,12 @@ vpfe_s_dv_timings(struct file *file, void *fh,
 }
 
 /*
- * vpfe_g_dv_timings() - get dv_preset which is set on external subdev
+ * vpfe_g_dv_timings() - get dv_timings which is set on external subdev
  * @file: file pointer
  * @priv: void pointer
  * @timings: pointer to v4l2_dv_timings structure
  *
- * get dv_preset which is set on external subdev through
+ * get dv_timings which is set on external subdev through
  * v4l2_subdev_call
  *
  * Return 0 on success, error code otherwise
@@ -1423,7 +1423,7 @@ static int vpfe_dqbuf(struct file *file, void *priv,
 }
 
 /*
- * vpfe_streamon() - get dv_preset which is set on external subdev
+ * vpfe_streamon() - start streaming
  * @file: file pointer
  * @priv: void pointer
  * @buf_type: enum v4l2_buf_type
@@ -1472,7 +1472,7 @@ static int vpfe_streamon(struct file *file, void *priv,
 }
 
 /*
- * vpfe_streamoff() - get dv_preset which is set on external subdev
+ * vpfe_streamoff() - stop streaming
  * @file: file pointer
  * @priv: void pointer
  * @buf_type: enum v4l2_buf_type
--

1.7.10.4

#7 lore raw

RFC PATCH 5/18 davinci: remove VPBE_ENC_DV_PRESET and rename VPBE_ENC_CUSTOM_TIMINGS

In reply to Hans Verkuil

From: Hans Verkuil <[email protected]>

Remove VPBE_ENC_DV_PRESET (the DV_PRESET API is no longer supported) and VPBE_ENC_CUSTOM_TIMINGS is renamed to VPBE_ENC_DV_TIMINGS since the old "CUSTOM_TIMINGS" name is deprecated in favor of "DV_TIMINGS".

---
 arch/arm/mach-davinci/board-dm644x-evm.c      |    4 ++--
 arch/arm/mach-davinci/dm644x.c                |    2 +-
 drivers/media/platform/davinci/vpbe.c         |    8 ++++----
 drivers/media/platform/davinci/vpbe_display.c |    2 +-
 drivers/media/platform/davinci/vpbe_venc.c    |    8 ++++----
 include/media/davinci/vpbe_types.h            |    3 +--
 6 files changed, 13 insertions(+), 14 deletions(-)
arch/arm/mach-davinci/board-dm644x-evm.c +2 -2
index 8e1b4ff..e8dc70b 100644
@@ -649,7 +649,7 @@ static struct vpbe_enc_mode_info dm644xevm_enc_std_timing[] = {
 static struct vpbe_enc_mode_info dm644xevm_enc_preset_timing[] = {
 	{
 		.name		= "480p59_94",
-		.timings_type	= VPBE_ENC_CUSTOM_TIMINGS,
+		.timings_type	= VPBE_ENC_DV_TIMINGS,
 		.dv_timings	= V4L2_DV_BT_CEA_720X480P59_94,
 		.interlaced	= 0,
 		.xres		= 720,
@@ -661,7 +661,7 @@ static struct vpbe_enc_mode_info dm644xevm_enc_preset_timing[] = {
 	},
 	{
 		.name		= "576p50",
-		.timings_type	= VPBE_ENC_CUSTOM_TIMINGS,
+		.timings_type	= VPBE_ENC_DV_TIMINGS,
 		.dv_timings	= V4L2_DV_BT_CEA_720X576P50,
 		.interlaced	= 0,
 		.xres		= 720,
arch/arm/mach-davinci/dm644x.c +1 -1
index db1dd92..ee0e994 100644
@@ -706,7 +706,7 @@ static int dm644x_venc_setup_clock(enum vpbe_enc_timings_type type,
 		v |= DM644X_VPSS_DACCLKEN;
 		writel(v, DAVINCI_SYSMOD_VIRT(SYSMOD_VPSS_CLKCTL));
 		break;
-	case VPBE_ENC_CUSTOM_TIMINGS:
+	case VPBE_ENC_DV_TIMINGS:
 		if (pclock <= 27000000) {
 			v |= DM644X_VPSS_DACCLKEN;
 			writel(v, DAVINCI_SYSMOD_VIRT(SYSMOD_VPSS_CLKCTL));
drivers/media/platform/davinci/vpbe.c +4 -4
index 4ca0f9a..2a49f00 100644
@@ -344,7 +344,7 @@ static int vpbe_s_dv_timings(struct vpbe_device *vpbe_dev,
 		return -EINVAL;
 
 	for (i = 0; i < output->num_modes; i++) {
-		if (output->modes[i].timings_type == VPBE_ENC_CUSTOM_TIMINGS &&
+		if (output->modes[i].timings_type == VPBE_ENC_DV_TIMINGS &&
 		    !memcmp(&output->modes[i].dv_timings,
 				dv_timings, sizeof(*dv_timings)))
 			break;
@@ -385,7 +385,7 @@ static int vpbe_g_dv_timings(struct vpbe_device *vpbe_dev,
 		     struct v4l2_dv_timings *dv_timings)
 {
 	if (vpbe_dev->current_timings.timings_type &
-	  VPBE_ENC_CUSTOM_TIMINGS) {
+	  VPBE_ENC_DV_TIMINGS) {
 		*dv_timings = vpbe_dev->current_timings.dv_timings;
 		return 0;
 	}
@@ -412,7 +412,7 @@ static int vpbe_enum_dv_timings(struct vpbe_device *vpbe_dev,
 		return -EINVAL;
 
 	for (i = 0; i < output->num_modes; i++) {
-		if (output->modes[i].timings_type == VPBE_ENC_CUSTOM_TIMINGS) {
+		if (output->modes[i].timings_type == VPBE_ENC_DV_TIMINGS) {
 			if (j == timings->index)
 				break;
 			j++;
@@ -515,7 +515,7 @@ static int vpbe_set_mode(struct vpbe_device *vpbe_dev,
 				return vpbe_s_std(vpbe_dev,
 						 &preset_mode->std_id);
 			if (preset_mode->timings_type &
-						VPBE_ENC_CUSTOM_TIMINGS) {
+						VPBE_ENC_DV_TIMINGS) {
 				dv_timings =
 					preset_mode->dv_timings;
 				return vpbe_s_dv_timings(vpbe_dev, &dv_timings);
drivers/media/platform/davinci/vpbe_display.c +1 -1
index 5e6b0ca..1f59955 100644
@@ -1202,7 +1202,7 @@ vpbe_display_g_dv_timings(struct file *file, void *priv,
 	/* Get the given standard in the encoder */
 
 	if (vpbe_dev->current_timings.timings_type &
-				VPBE_ENC_CUSTOM_TIMINGS) {
+				VPBE_ENC_DV_TIMINGS) {
 		*dv_timings = vpbe_dev->current_timings.dv_timings;
 	} else {
 		return -EINVAL;
drivers/media/platform/davinci/vpbe_venc.c +4 -4
index bdbebd5..9546d26 100644
@@ -313,7 +313,7 @@ static int venc_set_480p59_94(struct v4l2_subdev *sd)
 		return -EINVAL;
 
 	/* Setup clock at VPSS & VENC for SD */
-	if (pdata->setup_clock(VPBE_ENC_CUSTOM_TIMINGS, 27000000) < 0)
+	if (pdata->setup_clock(VPBE_ENC_DV_TIMINGS, 27000000) < 0)
 		return -EINVAL;
 
 	venc_enabledigitaloutput(sd, 0);
@@ -360,7 +360,7 @@ static int venc_set_576p50(struct v4l2_subdev *sd)
 	    venc->venc_type != VPBE_VERSION_2)
 		return -EINVAL;
 	/* Setup clock at VPSS & VENC for SD */
-	if (pdata->setup_clock(VPBE_ENC_CUSTOM_TIMINGS, 27000000) < 0)
+	if (pdata->setup_clock(VPBE_ENC_DV_TIMINGS, 27000000) < 0)
 		return -EINVAL;
 
 	venc_enabledigitaloutput(sd, 0);
@@ -400,7 +400,7 @@ static int venc_set_720p60_internal(struct v4l2_subdev *sd)
 	struct venc_state *venc = to_state(sd);
 	struct venc_platform_data *pdata = venc->pdata;
 
-	if (pdata->setup_clock(VPBE_ENC_CUSTOM_TIMINGS, 74250000) < 0)
+	if (pdata->setup_clock(VPBE_ENC_DV_TIMINGS, 74250000) < 0)
 		return -EINVAL;
 
 	venc_enabledigitaloutput(sd, 0);
@@ -428,7 +428,7 @@ static int venc_set_1080i30_internal(struct v4l2_subdev *sd)
 	struct venc_state *venc = to_state(sd);
 	struct venc_platform_data *pdata = venc->pdata;
 
-	if (pdata->setup_clock(VPBE_ENC_CUSTOM_TIMINGS, 74250000) < 0)
+	if (pdata->setup_clock(VPBE_ENC_DV_TIMINGS, 74250000) < 0)
 		return -EINVAL;
 
 	venc_enabledigitaloutput(sd, 0);
include/media/davinci/vpbe_types.h +1 -2
index 9b85396..05dbe0b 100644
@@ -26,8 +26,7 @@ enum vpbe_version {
 /* vpbe_timing_type - Timing types used in vpbe device */
 enum vpbe_enc_timings_type {
 	VPBE_ENC_STD = 0x1,
-	VPBE_ENC_DV_PRESET = 0x2,
-	VPBE_ENC_CUSTOM_TIMINGS = 0x4,
+	VPBE_ENC_DV_TIMINGS = 0x4,
 	/* Used when set timings through FB device interface */
 	VPBE_ENC_TIMINGS_INVALID = 0x8,
 };
Signature · 1 line
1.7.10.4
maintainer
#8 lore raw

RFC PATCH 5/18 davinci: remove VPBE_ENC_DV_PRESET and rename VPBE_ENC_CUSTOM_TIMINGS

Cc'ed Sekhar, DLOS, LAK.

Sekhar Can you Ack this patch for platform changes ?

Quoted 8 lines · Hans Verkuil

From: Hans Verkuil <[email protected]>

Remove VPBE_ENC_DV_PRESET (the DV_PRESET API is no longer supported) and VPBE_ENC_CUSTOM_TIMINGS is renamed to VPBE_ENC_DV_TIMINGS since the old "CUSTOM_TIMINGS" name is deprecated in favor of "DV_TIMINGS".

Regards,
--Prabhakar

Quoted 154 lines
---
 arch/arm/mach-davinci/board-dm644x-evm.c      |    4 ++--
 arch/arm/mach-davinci/dm644x.c                |    2 +-
 drivers/media/platform/davinci/vpbe.c         |    8 ++++----
 drivers/media/platform/davinci/vpbe_display.c |    2 +-
 drivers/media/platform/davinci/vpbe_venc.c    |    8 ++++----
 include/media/davinci/vpbe_types.h            |    3 +--
 6 files changed, 13 insertions(+), 14 deletions(-)
arch/arm/mach-davinci/board-dm644x-evm.c +2 -2
index 8e1b4ff..e8dc70b 100644
@@ -649,7 +649,7 @@ static struct vpbe_enc_mode_info dm644xevm_enc_std_timing[] = {
 static struct vpbe_enc_mode_info dm644xevm_enc_preset_timing[] = {
        {
                .name           = "480p59_94",
-               .timings_type   = VPBE_ENC_CUSTOM_TIMINGS,
+               .timings_type   = VPBE_ENC_DV_TIMINGS,
                .dv_timings     = V4L2_DV_BT_CEA_720X480P59_94,
                .interlaced     = 0,
                .xres           = 720,
@@ -661,7 +661,7 @@ static struct vpbe_enc_mode_info dm644xevm_enc_preset_timing[] = {
        },
        {
                .name           = "576p50",
-               .timings_type   = VPBE_ENC_CUSTOM_TIMINGS,
+               .timings_type   = VPBE_ENC_DV_TIMINGS,
                .dv_timings     = V4L2_DV_BT_CEA_720X576P50,
                .interlaced     = 0,
                .xres           = 720,
arch/arm/mach-davinci/dm644x.c +1 -1
index db1dd92..ee0e994 100644
@@ -706,7 +706,7 @@ static int dm644x_venc_setup_clock(enum vpbe_enc_timings_type type,
                v |= DM644X_VPSS_DACCLKEN;
                writel(v, DAVINCI_SYSMOD_VIRT(SYSMOD_VPSS_CLKCTL));
                break;
-       case VPBE_ENC_CUSTOM_TIMINGS:
+       case VPBE_ENC_DV_TIMINGS:
                if (pclock <= 27000000) {
                        v |= DM644X_VPSS_DACCLKEN;
                        writel(v, DAVINCI_SYSMOD_VIRT(SYSMOD_VPSS_CLKCTL));
drivers/media/platform/davinci/vpbe.c +4 -4
index 4ca0f9a..2a49f00 100644
@@ -344,7 +344,7 @@ static int vpbe_s_dv_timings(struct vpbe_device *vpbe_dev,
                return -EINVAL;
 
        for (i = 0; i < output->num_modes; i++) {
-               if (output->modes[i].timings_type == VPBE_ENC_CUSTOM_TIMINGS &&
+               if (output->modes[i].timings_type == VPBE_ENC_DV_TIMINGS &&
                    !memcmp(&output->modes[i].dv_timings,
                                dv_timings, sizeof(*dv_timings)))
                        break;
@@ -385,7 +385,7 @@ static int vpbe_g_dv_timings(struct vpbe_device *vpbe_dev,
                     struct v4l2_dv_timings *dv_timings)
 {
        if (vpbe_dev->current_timings.timings_type &
-         VPBE_ENC_CUSTOM_TIMINGS) {
+         VPBE_ENC_DV_TIMINGS) {
                *dv_timings = vpbe_dev->current_timings.dv_timings;
                return 0;
        }
@@ -412,7 +412,7 @@ static int vpbe_enum_dv_timings(struct vpbe_device *vpbe_dev,
                return -EINVAL;
 
        for (i = 0; i < output->num_modes; i++) {
-               if (output->modes[i].timings_type == VPBE_ENC_CUSTOM_TIMINGS) {
+               if (output->modes[i].timings_type == VPBE_ENC_DV_TIMINGS) {
                        if (j == timings->index)
                                break;
                        j++;
@@ -515,7 +515,7 @@ static int vpbe_set_mode(struct vpbe_device *vpbe_dev,
                                return vpbe_s_std(vpbe_dev,
                                                 &preset_mode->std_id);
                        if (preset_mode->timings_type &
-                                               VPBE_ENC_CUSTOM_TIMINGS) {
+                                               VPBE_ENC_DV_TIMINGS) {
                                dv_timings =
                                        preset_mode->dv_timings;
                                return vpbe_s_dv_timings(vpbe_dev, &dv_timings);
drivers/media/platform/davinci/vpbe_display.c +1 -1
index 5e6b0ca..1f59955 100644
@@ -1202,7 +1202,7 @@ vpbe_display_g_dv_timings(struct file *file, void *priv,
        /* Get the given standard in the encoder */
 
        if (vpbe_dev->current_timings.timings_type &
-                               VPBE_ENC_CUSTOM_TIMINGS) {
+                               VPBE_ENC_DV_TIMINGS) {
                *dv_timings = vpbe_dev->current_timings.dv_timings;
        } else {
                return -EINVAL;
drivers/media/platform/davinci/vpbe_venc.c +4 -4
index bdbebd5..9546d26 100644
@@ -313,7 +313,7 @@ static int venc_set_480p59_94(struct v4l2_subdev *sd)
                return -EINVAL;
 
        /* Setup clock at VPSS & VENC for SD */
-       if (pdata->setup_clock(VPBE_ENC_CUSTOM_TIMINGS, 27000000) < 0)
+       if (pdata->setup_clock(VPBE_ENC_DV_TIMINGS, 27000000) < 0)
                return -EINVAL;
 
        venc_enabledigitaloutput(sd, 0);
@@ -360,7 +360,7 @@ static int venc_set_576p50(struct v4l2_subdev *sd)
            venc->venc_type != VPBE_VERSION_2)
                return -EINVAL;
        /* Setup clock at VPSS & VENC for SD */
-       if (pdata->setup_clock(VPBE_ENC_CUSTOM_TIMINGS, 27000000) < 0)
+       if (pdata->setup_clock(VPBE_ENC_DV_TIMINGS, 27000000) < 0)
                return -EINVAL;
 
        venc_enabledigitaloutput(sd, 0);
@@ -400,7 +400,7 @@ static int venc_set_720p60_internal(struct v4l2_subdev *sd)
        struct venc_state *venc = to_state(sd);
        struct venc_platform_data *pdata = venc->pdata;
 
-       if (pdata->setup_clock(VPBE_ENC_CUSTOM_TIMINGS, 74250000) < 0)
+       if (pdata->setup_clock(VPBE_ENC_DV_TIMINGS, 74250000) < 0)
                return -EINVAL;
 
        venc_enabledigitaloutput(sd, 0);
@@ -428,7 +428,7 @@ static int venc_set_1080i30_internal(struct v4l2_subdev *sd)
        struct venc_state *venc = to_state(sd);
        struct venc_platform_data *pdata = venc->pdata;
 
-       if (pdata->setup_clock(VPBE_ENC_CUSTOM_TIMINGS, 74250000) < 0)
+       if (pdata->setup_clock(VPBE_ENC_DV_TIMINGS, 74250000) < 0)
                return -EINVAL;
 
        venc_enabledigitaloutput(sd, 0);
include/media/davinci/vpbe_types.h +1 -3
index 9b85396..05dbe0b 100644
@@ -26,8 +26,7 @@ enum vpbe_version {
 /* vpbe_timing_type - Timing types used in vpbe device */
 enum vpbe_enc_timings_type {
        VPBE_ENC_STD = 0x1,
-       VPBE_ENC_DV_PRESET = 0x2,
-       VPBE_ENC_CUSTOM_TIMINGS = 0x4,
+       VPBE_ENC_DV_TIMINGS = 0x4,
        /* Used when set timings through FB device interface */
        VPBE_ENC_TIMINGS_INVALID = 0x8,
 };
--

1.7.10.4

#9 lore raw

RFC PATCH 5/18 davinci: remove VPBE_ENC_DV_PRESET and rename VPBE_ENC_CUSTOM_TIMINGS

Quoted 3 lines · Prabhakar Lad

Cc'ed Sekhar, DLOS, LAK.

Sekhar Can you Ack this patch for platform changes ?

Thanks,
Sekhar

#10 lore raw

RFC PATCH 6/18 davinci: replace V4L2_OUT_CAP_CUSTOM_TIMINGS by V4L2_OUT_CAP_DV_TIMINGS

In reply to Hans Verkuil

From: Hans Verkuil <[email protected]>

The use of V4L2_OUT_CAP_CUSTOM_TIMINGS is deprecated, use DV_TIMINGS instead. Note that V4L2_OUT_CAP_CUSTOM_TIMINGS is just a #define for V4L2_OUT_CAP_DV_TIMINGS.

At some point in the future these CUSTOM_TIMINGS defines might be removed.

---
 arch/arm/mach-davinci/board-dm646x-evm.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/mach-davinci/board-dm646x-evm.c +1 -1
index 6e2f163..43f35d6 100644
@@ -514,7 +514,7 @@ static const struct vpif_output dm6467_ch0_outputs[] = {
 			.index = 1,
 			.name = "Component",
 			.type = V4L2_OUTPUT_TYPE_ANALOG,
-			.capabilities = V4L2_OUT_CAP_CUSTOM_TIMINGS,
+			.capabilities = V4L2_OUT_CAP_DV_TIMINGS,
 		},
 		.subdev_name = "adv7343",
 		.output_route = ADV7343_COMPONENT_ID,
Signature · 1 line
1.7.10.4
maintainer
#11 lore raw

RFC PATCH 6/18 davinci: replace V4L2_OUT_CAP_CUSTOM_TIMINGS by V4L2_OUT_CAP_DV_TIMINGS

Cc'ed Sekhar, DLOS, LAK.

Sekhar Can you Ack this patch ? Or maybe you can take this patch through your tree ?

Quoted 10 lines · Hans Verkuil

From: Hans Verkuil <[email protected]>

The use of V4L2_OUT_CAP_CUSTOM_TIMINGS is deprecated, use DV_TIMINGS instead. Note that V4L2_OUT_CAP_CUSTOM_TIMINGS is just a #define for V4L2_OUT_CAP_DV_TIMINGS.

At some point in the future these CUSTOM_TIMINGS defines might be removed.

Regards,
--Prabhakar

Quoted 20 lines
---
 arch/arm/mach-davinci/board-dm646x-evm.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/mach-davinci/board-dm646x-evm.c +1 -2
index 6e2f163..43f35d6 100644
@@ -514,7 +514,7 @@ static const struct vpif_output dm6467_ch0_outputs[] = {
                        .index = 1,
                        .name = "Component",
                        .type = V4L2_OUTPUT_TYPE_ANALOG,
-                       .capabilities = V4L2_OUT_CAP_CUSTOM_TIMINGS,
+                       .capabilities = V4L2_OUT_CAP_DV_TIMINGS,
                },
                .subdev_name = "adv7343",
                .output_route = ADV7343_COMPONENT_ID,
--

1.7.10.4

#12 lore raw

RFC PATCH 6/18 davinci: replace V4L2_OUT_CAP_CUSTOM_TIMINGS by V4L2_OUT_CAP_DV_TIMINGS

Quoted 4 lines · Prabhakar Lad

Cc'ed Sekhar, DLOS, LAK.

Sekhar Can you Ack this patch ? Or maybe you can take this patch through your tree ?

I can take the patch, but I can only send for v3.10 since for v3.9 ARM tree is only accepting bug fixes for already accepted code. If you wish to take this through media tree for v3.9, feel free to add:

Since this appears to be an ARM-only patch, its better to add an 'ARM:' prefix to the subject line as is the norm with all other ARM patches.

Thanks,
Sekhar

#13 lore raw

RFC PATCH 6/18 davinci: replace V4L2_OUT_CAP_CUSTOM_TIMINGS by V4L2_OUT_CAP_DV_TIMINGS

Quoted 9 lines · On Sat February 16 2013 20:23:39 Sekhar Nori wrote:
Quoted 4 lines · Prabhakar Lad

Cc'ed Sekhar, DLOS, LAK.

Sekhar Can you Ack this patch ? Or maybe you can take this patch through your tree ?

I can take the patch, but I can only send for v3.10 since for v3.9 ARM tree is only accepting bug fixes for already accepted code. If you wish to take this through media tree for v3.9, feel free to add:

There is no hurry. If you can take this patch for 3.10, then that is fine by me. This patch series is unlikely to make it in 3.9 anyway, nor does it need to. Just let me know if you take it, then I can drop it from my patch series.

Regards,

Hans

Quoted 9 lines

Since this appears to be an ARM-only patch, its better to add an 'ARM:' prefix to the subject line as is the norm with all other ARM patches.

Thanks,
Sekhar

#14 lore raw

RFC PATCH 6/18 davinci: replace V4L2_OUT_CAP_CUSTOM_TIMINGS by V4L2_OUT_CAP_DV_TIMINGS

Hi Hans,

Quoted 7 lines · Hans Verkuil
Quoted 6 lines · On Sat February 16 2013 20:23:39 Sekhar Nori wrote:
Quoted 4 lines · Prabhakar Lad

Cc'ed Sekhar, DLOS, LAK.

Sekhar Can you Ack this patch ? Or maybe you can take this patch through your tree ?

Quoted 8 lines
Quoted 3 lines

I can take the patch, but I can only send for v3.10 since for v3.9 ARM tree is only accepting bug fixes for already accepted code. If you wish to take this through media tree for v3.9, feel free to add:

There is no hurry. If you can take this patch for 3.10, then that is fine by me. This patch series is unlikely to make it in 3.9 anyway, nor does it need to. Just let me know if you take it, then I can drop it from my patch series.

It appears that it will be simpler if you manage the entire series. I have already acked this one, so please take it through the media tree.

Thanks,
Sekhar

#15 lore raw

RFC PATCH 7/18 blackfin: replace V4L2_IN/OUT_CAP_CUSTOM_TIMINGS by DV_TIMINGS

In reply to Hans Verkuil

From: Hans Verkuil <[email protected]>

The use of V4L2_IN/OUT_CAP_CUSTOM_TIMINGS is obsolete, use DV_TIMINGS instead. Note that V4L2_IN/OUT_CAP_CUSTOM_TIMINGS is just a #define for V4L2_IN/OUT_CAP_DV_TIMINGS.

At some point in the future these CUSTOM_TIMINGS defines might be removed.

---
 arch/blackfin/mach-bf609/boards/ezkit.c        |    8 ++++----
 drivers/media/platform/blackfin/bfin_capture.c |    4 ++--
 2 files changed, 6 insertions(+), 6 deletions(-)
arch/blackfin/mach-bf609/boards/ezkit.c +4 -4
index 61c1f47..97d7016 100644
@@ -936,19 +936,19 @@ static struct v4l2_input adv7842_inputs[] = {
 		.index = 2,
 		.name = "Component",
 		.type = V4L2_INPUT_TYPE_CAMERA,
-		.capabilities = V4L2_IN_CAP_CUSTOM_TIMINGS,
+		.capabilities = V4L2_IN_CAP_DV_TIMINGS,
 	},
 	{
 		.index = 3,
 		.name = "VGA",
 		.type = V4L2_INPUT_TYPE_CAMERA,
-		.capabilities = V4L2_IN_CAP_CUSTOM_TIMINGS,
+		.capabilities = V4L2_IN_CAP_DV_TIMINGS,
 	},
 	{
 		.index = 4,
 		.name = "HDMI",
 		.type = V4L2_INPUT_TYPE_CAMERA,
-		.capabilities = V4L2_IN_CAP_CUSTOM_TIMINGS,
+		.capabilities = V4L2_IN_CAP_DV_TIMINGS,
 	},
 };
 
@@ -1074,7 +1074,7 @@ static struct v4l2_output adv7511_outputs[] = {
 		.index = 0,
 		.name = "HDMI",
 		.type = V4L2_INPUT_TYPE_CAMERA,
-		.capabilities = V4L2_OUT_CAP_CUSTOM_TIMINGS,
+		.capabilities = V4L2_OUT_CAP_DV_TIMINGS,
 	},
 };
 
drivers/media/platform/blackfin/bfin_capture.c +2 -2
index 5f209d5..6691355 100644
@@ -384,7 +384,7 @@ static int bcap_start_streaming(struct vb2_queue *vq, unsigned int count)
 	params.ppi_control = bcap_dev->cfg->ppi_control;
 	params.int_mask = bcap_dev->cfg->int_mask;
 	if (bcap_dev->cfg->inputs[bcap_dev->cur_input].capabilities
-			& V4L2_IN_CAP_CUSTOM_TIMINGS) {
+			& V4L2_IN_CAP_DV_TIMINGS) {
 		struct v4l2_bt_timings *bt = &bcap_dev->dv_timings.bt;
 
 		params.hdelay = bt->hsync + bt->hbackporch;
@@ -1110,7 +1110,7 @@ static int bcap_probe(struct platform_device *pdev)
 		}
 		bcap_dev->std = std;
 	}
-	if (config->inputs[0].capabilities & V4L2_IN_CAP_CUSTOM_TIMINGS) {
+	if (config->inputs[0].capabilities & V4L2_IN_CAP_DV_TIMINGS) {
 		struct v4l2_dv_timings dv_timings;
 		ret = v4l2_subdev_call(bcap_dev->sd, video,
 				g_dv_timings, &dv_timings);
Signature · 1 line
1.7.10.4
Acked-by on v1 7/18
#16 lore raw

Re: [RFC PATCH 07/18] blackfin: replace V4L2_IN/OUT_CAP_CUSTOM_TIMINGS by DV_TIMINGS

2013/2/16 Hans Verkuil <[email protected]>:

Quoted 10 lines

From: Hans Verkuil <[email protected]>

The use of V4L2_IN/OUT_CAP_CUSTOM_TIMINGS is obsolete, use DV_TIMINGS instead. Note that V4L2_IN/OUT_CAP_CUSTOM_TIMINGS is just a #define for V4L2_IN/OUT_CAP_DV_TIMINGS.

At some point in the future these CUSTOM_TIMINGS defines might be removed.

Quoted 66 lines
---
 arch/blackfin/mach-bf609/boards/ezkit.c        |    8 ++++----
 drivers/media/platform/blackfin/bfin_capture.c |    4 ++--
 2 files changed, 6 insertions(+), 6 deletions(-)
arch/blackfin/mach-bf609/boards/ezkit.c +4 -4
index 61c1f47..97d7016 100644
@@ -936,19 +936,19 @@ static struct v4l2_input adv7842_inputs[] = {
                .index = 2,
                .name = "Component",
                .type = V4L2_INPUT_TYPE_CAMERA,
-               .capabilities = V4L2_IN_CAP_CUSTOM_TIMINGS,
+               .capabilities = V4L2_IN_CAP_DV_TIMINGS,
        },
        {
                .index = 3,
                .name = "VGA",
                .type = V4L2_INPUT_TYPE_CAMERA,
-               .capabilities = V4L2_IN_CAP_CUSTOM_TIMINGS,
+               .capabilities = V4L2_IN_CAP_DV_TIMINGS,
        },
        {
                .index = 4,
                .name = "HDMI",
                .type = V4L2_INPUT_TYPE_CAMERA,
-               .capabilities = V4L2_IN_CAP_CUSTOM_TIMINGS,
+               .capabilities = V4L2_IN_CAP_DV_TIMINGS,
        },
 };
 
@@ -1074,7 +1074,7 @@ static struct v4l2_output adv7511_outputs[] = {
                .index = 0,
                .name = "HDMI",
                .type = V4L2_INPUT_TYPE_CAMERA,
-               .capabilities = V4L2_OUT_CAP_CUSTOM_TIMINGS,
+               .capabilities = V4L2_OUT_CAP_DV_TIMINGS,
        },
 };
 
drivers/media/platform/blackfin/bfin_capture.c +2 -3
index 5f209d5..6691355 100644
@@ -384,7 +384,7 @@ static int bcap_start_streaming(struct vb2_queue *vq, unsigned int count)
        params.ppi_control = bcap_dev->cfg->ppi_control;
        params.int_mask = bcap_dev->cfg->int_mask;
        if (bcap_dev->cfg->inputs[bcap_dev->cur_input].capabilities
-                       & V4L2_IN_CAP_CUSTOM_TIMINGS) {
+                       & V4L2_IN_CAP_DV_TIMINGS) {
                struct v4l2_bt_timings *bt = &bcap_dev->dv_timings.bt;
 
                params.hdelay = bt->hsync + bt->hbackporch;
@@ -1110,7 +1110,7 @@ static int bcap_probe(struct platform_device *pdev)
                }
                bcap_dev->std = std;
        }
-       if (config->inputs[0].capabilities & V4L2_IN_CAP_CUSTOM_TIMINGS) {
+       if (config->inputs[0].capabilities & V4L2_IN_CAP_DV_TIMINGS) {
                struct v4l2_dv_timings dv_timings;
                ret = v4l2_subdev_call(bcap_dev->sd, video,
                                g_dv_timings, &dv_timings);
--

1.7.10.4

#17 lore raw

RFC PATCH 8/18 s5p-tv: add dv_timings support for mixer_video.

In reply to Hans Verkuil

From: Hans Verkuil <[email protected]>

This just adds dv_timings support without modifying existing dv_preset support.

Cc Tomasz Stanislawski <[email protected]>
Cc Kyungmin Park <[email protected]>
---
 drivers/media/platform/s5p-tv/mixer_video.c |   78 +++++++++++++++++++++++++++
 1 file changed, 78 insertions(+)
drivers/media/platform/s5p-tv/mixer_video.c +78 -0
index 82142a2..cdfadba 100644
@@ -559,6 +559,79 @@ static int mxr_g_dv_preset(struct file *file, void *fh,
 	return ret ? -EINVAL : 0;
 }
 
+static int mxr_enum_dv_timings(struct file *file, void *fh,
+	struct v4l2_enum_dv_timings *timings)
+{
+	struct mxr_layer *layer = video_drvdata(file);
+	struct mxr_device *mdev = layer->mdev;
+	int ret;
+
+	/* lock protects from changing sd_out */
+	mutex_lock(&mdev->mutex);
+	ret = v4l2_subdev_call(to_outsd(mdev), video, enum_dv_timings, timings);
+	mutex_unlock(&mdev->mutex);
+
+	return ret ? -EINVAL : 0;
+}
+
+static int mxr_s_dv_timings(struct file *file, void *fh,
+	struct v4l2_dv_timings *timings)
+{
+	struct mxr_layer *layer = video_drvdata(file);
+	struct mxr_device *mdev = layer->mdev;
+	int ret;
+
+	/* lock protects from changing sd_out */
+	mutex_lock(&mdev->mutex);
+
+	/* preset change cannot be done while there is an entity
+	 * dependant on output configuration
+	 */
+	if (mdev->n_output > 0) {
+		mutex_unlock(&mdev->mutex);
+		return -EBUSY;
+	}
+
+	ret = v4l2_subdev_call(to_outsd(mdev), video, s_dv_timings, timings);
+
+	mutex_unlock(&mdev->mutex);
+
+	mxr_layer_update_output(layer);
+
+	/* any failure should return EINVAL according to V4L2 doc */
+	return ret ? -EINVAL : 0;
+}
+
+static int mxr_g_dv_timings(struct file *file, void *fh,
+	struct v4l2_dv_timings *timings)
+{
+	struct mxr_layer *layer = video_drvdata(file);
+	struct mxr_device *mdev = layer->mdev;
+	int ret;
+
+	/* lock protects from changing sd_out */
+	mutex_lock(&mdev->mutex);
+	ret = v4l2_subdev_call(to_outsd(mdev), video, g_dv_timings, timings);
+	mutex_unlock(&mdev->mutex);
+
+	return ret ? -EINVAL : 0;
+}
+
+static int mxr_dv_timings_cap(struct file *file, void *fh,
+	struct v4l2_dv_timings_cap *cap)
+{
+	struct mxr_layer *layer = video_drvdata(file);
+	struct mxr_device *mdev = layer->mdev;
+	int ret;
+
+	/* lock protects from changing sd_out */
+	mutex_lock(&mdev->mutex);
+	ret = v4l2_subdev_call(to_outsd(mdev), video, dv_timings_cap, cap);
+	mutex_unlock(&mdev->mutex);
+
+	return ret ? -EINVAL : 0;
+}
+
 static int mxr_s_std(struct file *file, void *fh, v4l2_std_id *norm)
 {
 	struct mxr_layer *layer = video_drvdata(file);
@@ -742,6 +815,11 @@ static const struct v4l2_ioctl_ops mxr_ioctl_ops = {
 	.vidioc_enum_dv_presets = mxr_enum_dv_presets,
 	.vidioc_s_dv_preset = mxr_s_dv_preset,
 	.vidioc_g_dv_preset = mxr_g_dv_preset,
+	/* DV Timings functions */
+	.vidioc_enum_dv_timings = mxr_enum_dv_timings,
+	.vidioc_s_dv_timings = mxr_s_dv_timings,
+	.vidioc_g_dv_timings = mxr_g_dv_timings,
+	.vidioc_dv_timings_cap = mxr_dv_timings_cap,
 	/* analog TV standard functions */
 	.vidioc_s_std = mxr_s_std,
 	.vidioc_g_std = mxr_g_std,
Signature · 1 line
1.7.10.4
#18 lore raw

RFC PATCH 9/18 s5p-tv: add dv_timings support for hdmi.

In reply to Hans Verkuil

From: Hans Verkuil <[email protected]>

This just adds dv_timings support without modifying existing dv_preset support.

Cc Tomasz Stanislawski <[email protected]>
Cc Kyungmin Park <[email protected]>
---
 drivers/media/platform/s5p-tv/hdmi_drv.c |   92 +++++++++++++++++++++++++-----
 1 file changed, 79 insertions(+), 13 deletions(-)
drivers/media/platform/s5p-tv/hdmi_drv.c +79 -13
index 8de1b3d..716d0e4 100644
@@ -31,6 +31,7 @@
 #include <linux/pm_runtime.h>
 #include <linux/clk.h>
 #include <linux/regulator/consumer.h>
+#include <linux/v4l2-dv-timings.h>
 
 #include <media/s5p_hdmi.h>
 #include <media/v4l2-common.h>
@@ -93,6 +94,8 @@ struct hdmi_device {
 	int cur_conf_dirty;
 	/** current preset */
 	u32 cur_preset;
+	/** current timings */
+	struct v4l2_dv_timings cur_timings;
 	/** other resources */
 	struct hdmi_resources res;
 };
@@ -477,19 +480,21 @@ static const struct hdmi_timings hdmi_timings_1080p50 = {
 
 static const struct {
 	u32 preset;
-	const struct hdmi_timings *timings;
+	bool reduced_fps;
+	const struct v4l2_dv_timings dv_timings;
+	const struct hdmi_timings *hdmi_timings;
 } hdmi_timings[] = {
-	{ V4L2_DV_480P59_94, &hdmi_timings_480p },
-	{ V4L2_DV_576P50, &hdmi_timings_576p50 },
-	{ V4L2_DV_720P50, &hdmi_timings_720p50 },
-	{ V4L2_DV_720P59_94, &hdmi_timings_720p60 },
-	{ V4L2_DV_720P60, &hdmi_timings_720p60 },
-	{ V4L2_DV_1080P24, &hdmi_timings_1080p24 },
-	{ V4L2_DV_1080P30, &hdmi_timings_1080p60 },
-	{ V4L2_DV_1080P50, &hdmi_timings_1080p50 },
-	{ V4L2_DV_1080I50, &hdmi_timings_1080i50 },
-	{ V4L2_DV_1080I60, &hdmi_timings_1080i60 },
-	{ V4L2_DV_1080P60, &hdmi_timings_1080p60 },
+	{ V4L2_DV_480P59_94, false, V4L2_DV_BT_CEA_720X480P59_94, &hdmi_timings_480p },
+	{ V4L2_DV_576P50, false, V4L2_DV_BT_CEA_720X576P50, &hdmi_timings_576p50 },
+	{ V4L2_DV_720P50, false, V4L2_DV_BT_CEA_1280X720P50, &hdmi_timings_720p50 },
+	{ V4L2_DV_720P59_94, true, V4L2_DV_BT_CEA_1280X720P60, &hdmi_timings_720p60 },
+	{ V4L2_DV_720P60, false, V4L2_DV_BT_CEA_1280X720P60, &hdmi_timings_720p60 },
+	{ V4L2_DV_1080P24, false, V4L2_DV_BT_CEA_1920X1080P24, &hdmi_timings_1080p24 },
+	{ V4L2_DV_1080P30, false, V4L2_DV_BT_CEA_1920X1080P30, &hdmi_timings_1080p60 },
+	{ V4L2_DV_1080P50, false, V4L2_DV_BT_CEA_1920X1080P50, &hdmi_timings_1080p50 },
+	{ V4L2_DV_1080I50, false, V4L2_DV_BT_CEA_1920X1080I50, &hdmi_timings_1080i50 },
+	{ V4L2_DV_1080I60, false, V4L2_DV_BT_CEA_1920X1080I60, &hdmi_timings_1080i60 },
+	{ V4L2_DV_1080P60, false, V4L2_DV_BT_CEA_1920X1080P60, &hdmi_timings_1080p60 },
 };
 
 static const struct hdmi_timings *hdmi_preset2timings(u32 preset)
@@ -498,7 +503,7 @@ static const struct hdmi_timings *hdmi_preset2timings(u32 preset)
 
 	for (i = 0; i < ARRAY_SIZE(hdmi_timings); ++i)
 		if (hdmi_timings[i].preset == preset)
-			return  hdmi_timings[i].timings;
+			return  hdmi_timings[i].hdmi_timings;
 	return NULL;
 }
 
@@ -647,6 +652,36 @@ static int hdmi_g_dv_preset(struct v4l2_subdev *sd,
 	return 0;
 }
 
+static int hdmi_s_dv_timings(struct v4l2_subdev *sd,
+	struct v4l2_dv_timings *timings)
+{
+	struct hdmi_device *hdev = sd_to_hdmi_dev(sd);
+	struct device *dev = hdev->dev;
+	int i;
+
+	for (i = 0; i < ARRAY_SIZE(hdmi_timings); i++)
+		if (v4l_match_dv_timings(&hdmi_timings[i].dv_timings,
+					timings, 0))
+			break;
+	if (i == ARRAY_SIZE(hdmi_timings)) {
+		dev_err(dev, "timings not supported\n");
+		return -EINVAL;
+	}
+	hdev->cur_conf = hdmi_timings[i].hdmi_timings;
+	hdev->cur_conf_dirty = 1;
+	hdev->cur_timings = *timings;
+	if (!hdmi_timings[i].reduced_fps)
+		hdev->cur_timings.bt.flags &= ~V4L2_DV_FL_CAN_REDUCE_FPS;
+	return 0;
+}
+
+static int hdmi_g_dv_timings(struct v4l2_subdev *sd,
+	struct v4l2_dv_timings *timings)
+{
+	*timings = sd_to_hdmi_dev(sd)->cur_timings;
+	return 0;
+}
+
 static int hdmi_g_mbus_fmt(struct v4l2_subdev *sd,
 	  struct v4l2_mbus_framefmt *fmt)
 {
@@ -679,6 +714,33 @@ static int hdmi_enum_dv_presets(struct v4l2_subdev *sd,
 		preset);
 }
 
+static int hdmi_enum_dv_timings(struct v4l2_subdev *sd,
+	struct v4l2_enum_dv_timings *timings)
+{
+	if (timings->index >= ARRAY_SIZE(hdmi_timings))
+		return -EINVAL;
+	timings->timings = hdmi_timings[timings->index].dv_timings;
+	if (!hdmi_timings[timings->index].reduced_fps)
+		timings->timings.bt.flags &= ~V4L2_DV_FL_CAN_REDUCE_FPS;
+	return 0;
+}
+
+static int hdmi_dv_timings_cap(struct v4l2_subdev *sd,
+	struct v4l2_dv_timings_cap *cap)
+{
+	cap->type = V4L2_DV_BT_656_1120;
+	cap->bt.min_width = 640;
+	cap->bt.max_width = 1920;
+	cap->bt.min_height = 480;
+	cap->bt.max_height = 1080;
+	cap->bt.min_pixelclock = 27000000;
+	cap->bt.max_pixelclock = 148500000;
+	cap->bt.standards = V4L2_DV_BT_STD_CEA861;
+	cap->bt.capabilities = V4L2_DV_BT_CAP_INTERLACED |
+			       V4L2_DV_BT_CAP_PROGRESSIVE;
+	return 0;
+}
+
 static const struct v4l2_subdev_core_ops hdmi_sd_core_ops = {
 	.s_power = hdmi_s_power,
 };
@@ -687,6 +749,10 @@ static const struct v4l2_subdev_video_ops hdmi_sd_video_ops = {
 	.s_dv_preset = hdmi_s_dv_preset,
 	.g_dv_preset = hdmi_g_dv_preset,
 	.enum_dv_presets = hdmi_enum_dv_presets,
+	.s_dv_timings = hdmi_s_dv_timings,
+	.g_dv_timings = hdmi_g_dv_timings,
+	.enum_dv_timings = hdmi_enum_dv_timings,
+	.dv_timings_cap = hdmi_dv_timings_cap,
 	.g_mbus_fmt = hdmi_g_mbus_fmt,
 	.s_stream = hdmi_s_stream,
 };
Signature · 1 line
1.7.10.4
#19 lore raw

Re: [RFC PATCH 09/18] s5p-tv: add dv_timings support for hdmi.

Hi Hans,
Please refer to the comments below.

Quoted 12 lines · Hans Verkuil

From: Hans Verkuil <[email protected]>

This just adds dv_timings support without modifying existing dv_preset support.

Cc Tomasz Stanislawski <[email protected]>
Cc Kyungmin Park <[email protected]>
---
 drivers/media/platform/s5p-tv/hdmi_drv.c |   92 +++++++++++++++++++++++++-----
 1 file changed, 79 insertions(+), 13 deletions(-)

[snip]

Quoted 5 lines
drivers/media/platform/s5p-tv/hdmi_drv.c +5 -0
+static int hdmi_enum_dv_timings(struct v4l2_subdev *sd,
+	struct v4l2_enum_dv_timings *timings)
+{
+	if (timings->index >= ARRAY_SIZE(hdmi_timings))
+		return -EINVAL;

drivers/media/platform/s5p-tv/hdmi_drv.c static int hdmi_enum_dv_presets(struct v4l2_subdev *sd, · line 731

Quoted 10 lines
drivers/media/platform/s5p-tv/hdmi_drv.c +10 -0
+	timings->timings = hdmi_timings[timings->index].dv_timings;
+	if (!hdmi_timings[timings->index].reduced_fps)
+		timings->timings.bt.flags &= ~V4L2_DV_FL_CAN_REDUCE_FPS;
+	return 0;
+}
+
+static int hdmi_dv_timings_cap(struct v4l2_subdev *sd,
+	struct v4l2_dv_timings_cap *cap)
+{
+	cap->type = V4L2_DV_BT_656_1120;

The minimal width among all the supported timings is 720 not 640.

drivers/media/platform/s5p-tv/hdmi_drv.c static int hdmi_enum_dv_presets(struct v4l2_subdev *sd, · line 735

Quoted 4 lines
drivers/media/platform/s5p-tv/hdmi_drv.c +4 -0
+	cap->bt.min_width = 640;
+	cap->bt.max_width = 1920;
+	cap->bt.min_height = 480;
+	cap->bt.max_height = 1080;

The range of pixelclock is a property of hdmiphy. Not all ranges might be supported on all platforms. Therefore it may be a good idea to obtains those values from hdmiphy by chaining hdmi_dv_timings_cap to hdmiphy.

Quoted 23 lines
drivers/media/platform/s5p-tv/hdmi_drv.c +12 -0
+	cap->bt.min_pixelclock = 27000000;
+	cap->bt.max_pixelclock = 148500000;
+	cap->bt.standards = V4L2_DV_BT_STD_CEA861;
+	cap->bt.capabilities = V4L2_DV_BT_CAP_INTERLACED |
+			       V4L2_DV_BT_CAP_PROGRESSIVE;
+	return 0;
+}
+
 static const struct v4l2_subdev_core_ops hdmi_sd_core_ops = {
 	.s_power = hdmi_s_power,
 };
@@ -687,6 +749,10 @@ static const struct v4l2_subdev_video_ops hdmi_sd_video_ops = {
 	.s_dv_preset = hdmi_s_dv_preset,
 	.g_dv_preset = hdmi_g_dv_preset,
 	.enum_dv_presets = hdmi_enum_dv_presets,
+	.s_dv_timings = hdmi_s_dv_timings,
+	.g_dv_timings = hdmi_g_dv_timings,
+	.enum_dv_timings = hdmi_enum_dv_timings,
+	.dv_timings_cap = hdmi_dv_timings_cap,
 	.g_mbus_fmt = hdmi_g_mbus_fmt,
 	.s_stream = hdmi_s_stream,
 };
#20 lore raw

RFC PATCH 10/18 s5p-tv: add dv_timings support for hdmiphy.

In reply to Hans Verkuil

From: Hans Verkuil <[email protected]>

This just adds dv_timings support without modifying existing dv_preset support, although I had to refactor a little bit in order to share hdmiphy_find_conf() between the preset and timings code.

Cc Tomasz Stanislawski <[email protected]>
Cc Kyungmin Park <[email protected]>
---
 drivers/media/platform/s5p-tv/hdmiphy_drv.c |   48 ++++++++++++++++++++++-----
 1 file changed, 39 insertions(+), 9 deletions(-)
drivers/media/platform/s5p-tv/hdmiphy_drv.c +39 -9
index 80717ce..85b4211 100644
@@ -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;
@@ -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;
@@ -271,6 +300,7 @@ 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,
 	.s_stream =  hdmiphy_s_stream,
 };
 
Signature · 1 line
1.7.10.4
#21 lore raw

Re: [RFC PATCH 10/18] s5p-tv: add dv_timings support for hdmiphy.

Hi Hans,
Please refer to the comments below.

Quoted 41 lines · Hans Verkuil

From: Hans Verkuil <[email protected]>

This just adds dv_timings support without modifying existing dv_preset support, although I had to refactor a little bit in order to share hdmiphy_find_conf() between the preset and timings code.

Cc Tomasz Stanislawski <[email protected]>
Cc Kyungmin Park <[email protected]>
---
 drivers/media/platform/s5p-tv/hdmiphy_drv.c |   48 ++++++++++++++++++++++-----
 1 file changed, 39 insertions(+), 9 deletions(-)
drivers/media/platform/s5p-tv/hdmiphy_drv.c +3 -8
index 80717ce..85b4211 100644
@@ -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;
@@ -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];

drivers/media/platform/s5p-tv/hdmiphy_drv.c static int hdmiphy_s_power(struct v4l2_subdev *sd, int on) · line 228

Quoted 10 lines
drivers/media/platform/s5p-tv/hdmiphy_drv.c +3 -1
 	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);

Just nitpicking.
The pixclk might be 0 is the preset is not supported hdmiphy. For some platforms not all frequencies are supported. Anyway, if pixclk is 0 then hdmiphy_find_conf will detect it.

Quoted 19 lines
drivers/media/platform/s5p-tv/hdmiphy_drv.c +19 -0
+	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)

drivers/media/platform/s5p-tv/hdmiphy_drv.c static int hdmiphy_s_power(struct v4l2_subdev *sd, int on) · line 257

Quoted 10 lines
drivers/media/platform/s5p-tv/hdmiphy_drv.c +10 -0
+{
+	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");

Using test against V4L2_DV_FL_REDUCED_FPS and 74250000 looks little hacky to me. Why there is no such a check for 148500000 and 27000000 (REDUCED -> INCREASED?). Maybe it will be better to past both timings->bt.pixelclock and timings->bt.flags as parameters for hdmiphy_find_conf function. The hdmiphy_find_conf could perform pixclk adjustment or some fallback policy based on the flags.

Quoted 15 lines
drivers/media/platform/s5p-tv/hdmiphy_drv.c +4 -0
+	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;
@@ -271,6 +300,7 @@ 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,
 	.s_stream =  hdmiphy_s_stream,
 };
 
#22 lore raw

Re: [RFC PATCH 10/18] s5p-tv: add dv_timings support for hdmiphy.

Quoted 51 lines · On Fri March 1 2013 12:02:14 Tomasz Stanislawski wrote:

Hi Hans,
Please refer to the comments below.

Quoted 47 lines · Hans Verkuil

From: Hans Verkuil <[email protected]>

This just adds dv_timings support without modifying existing dv_preset support, although I had to refactor a little bit in order to share hdmiphy_find_conf() between the preset and timings code.

Cc Tomasz Stanislawski <[email protected]>
Cc Kyungmin Park <[email protected]>
---
 drivers/media/platform/s5p-tv/hdmiphy_drv.c |   48 ++++++++++++++++++++++-----
 1 file changed, 39 insertions(+), 9 deletions(-)
drivers/media/platform/s5p-tv/hdmiphy_drv.c +4 -8
index 80717ce..85b4211 100644
@@ -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;
@@ -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;
 
Quoted 9 lines

drivers/media/platform/s5p-tv/hdmiphy_drv.c static int hdmiphy_s_power(struct v4l2_subdev *sd, int on) · line 228

Quoted 4 lines
drivers/media/platform/s5p-tv/hdmiphy_drv.c +2 -1
 	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);

Just nitpicking.
The pixclk might be 0 is the preset is not supported hdmiphy. For some platforms not all frequencies are supported. Anyway, if pixclk is 0 then hdmiphy_find_conf will detect it.

I'll add a comment clarifying this. I actually was relying on find_conf to handle the 0 case.

Quoted 24 lines
Quoted 24 lines
drivers/media/platform/s5p-tv/hdmiphy_drv.c +24 -0
+	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);
Quoted 8 lines

drivers/media/platform/s5p-tv/hdmiphy_drv.c static int hdmiphy_s_power(struct v4l2_subdev *sd, int on) · line 257

Quoted 5 lines
drivers/media/platform/s5p-tv/hdmiphy_drv.c +5 -0
+	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");

Using test against V4L2_DV_FL_REDUCED_FPS and 74250000 looks little hacky to me. Why there is no such a check for 148500000 and 27000000 (REDUCED -> INCREASED?).

Because that was not supported by the original code. I have no idea whether 1080p59.94 is supported or not, or what pixelclock should be used in that case. So I faithfully reproduced the original functionality.

BTW, it is 'reduced': 74.25 MHz is for 30 fps, 74.176 is for 29.97 fps. Also, REDUCED_FPS doesn't apply to the 27 MHz case which is always 29.97 fps in the NTSC resolution case.

Quoted 3 lines

Maybe it will be better to past both timings->bt.pixelclock and timings->bt.flags as parameters for hdmiphy_find_conf function. The hdmiphy_find_conf could perform pixclk adjustment or some fallback policy based on the flags.

I really prefer to keep the same functionality. I don't want to make changes to the existing functionality, partially to make it easier to prevent regressions, partially because I don't have the setup anyway to test this if I add functionality.

But feel free to provide an additional patch doing this :-)

Regards,

Hans

Quoted 17 lines
Quoted 16 lines
drivers/media/platform/s5p-tv/hdmiphy_drv.c +4 -0
+	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;
@@ -271,6 +300,7 @@ 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,
 	.s_stream =  hdmiphy_s_stream,
 };
 
#23 lore raw

RFC PATCH 11/18 s5p-tv: remove dv_preset support from mixer_video.

In reply to Hans Verkuil

From: Hans Verkuil <[email protected]>

The dv_preset API is deprecated and is replaced by the much improved dv_timings API. Remove the dv_preset support from this driver as this will allow us to remove the dv_preset API altogether (s5p-tv being the last user of this code).

Cc Tomasz Stanislawski <[email protected]>
Cc Kyungmin Park <[email protected]>
---
 drivers/media/platform/s5p-tv/mixer_video.c |   68 ++-------------------------
 1 file changed, 3 insertions(+), 65 deletions(-)
drivers/media/platform/s5p-tv/mixer_video.c +3 -65
index cdfadba..9961e13 100644
@@ -501,64 +501,6 @@ fail:
 	return -ERANGE;
 }
 
-static int mxr_enum_dv_presets(struct file *file, void *fh,
-	struct v4l2_dv_enum_preset *preset)
-{
-	struct mxr_layer *layer = video_drvdata(file);
-	struct mxr_device *mdev = layer->mdev;
-	int ret;
-
-	/* lock protects from changing sd_out */
-	mutex_lock(&mdev->mutex);
-	ret = v4l2_subdev_call(to_outsd(mdev), video, enum_dv_presets, preset);
-	mutex_unlock(&mdev->mutex);
-
-	return ret ? -EINVAL : 0;
-}
-
-static int mxr_s_dv_preset(struct file *file, void *fh,
-	struct v4l2_dv_preset *preset)
-{
-	struct mxr_layer *layer = video_drvdata(file);
-	struct mxr_device *mdev = layer->mdev;
-	int ret;
-
-	/* lock protects from changing sd_out */
-	mutex_lock(&mdev->mutex);
-
-	/* preset change cannot be done while there is an entity
-	 * dependant on output configuration
-	 */
-	if (mdev->n_output > 0) {
-		mutex_unlock(&mdev->mutex);
-		return -EBUSY;
-	}
-
-	ret = v4l2_subdev_call(to_outsd(mdev), video, s_dv_preset, preset);
-
-	mutex_unlock(&mdev->mutex);
-
-	mxr_layer_update_output(layer);
-
-	/* any failure should return EINVAL according to V4L2 doc */
-	return ret ? -EINVAL : 0;
-}
-
-static int mxr_g_dv_preset(struct file *file, void *fh,
-	struct v4l2_dv_preset *preset)
-{
-	struct mxr_layer *layer = video_drvdata(file);
-	struct mxr_device *mdev = layer->mdev;
-	int ret;
-
-	/* lock protects from changing sd_out */
-	mutex_lock(&mdev->mutex);
-	ret = v4l2_subdev_call(to_outsd(mdev), video, g_dv_preset, preset);
-	mutex_unlock(&mdev->mutex);
-
-	return ret ? -EINVAL : 0;
-}
-
 static int mxr_enum_dv_timings(struct file *file, void *fh,
 	struct v4l2_enum_dv_timings *timings)
 {
@@ -584,7 +526,7 @@ static int mxr_s_dv_timings(struct file *file, void *fh,
 	/* lock protects from changing sd_out */
 	mutex_lock(&mdev->mutex);
 
-	/* preset change cannot be done while there is an entity
+	/* timings change cannot be done while there is an entity
 	 * dependant on output configuration
 	 */
 	if (mdev->n_output > 0) {
@@ -689,8 +631,8 @@ static int mxr_enum_output(struct file *file, void *fh, struct v4l2_output *a)
 	/* try to obtain supported tv norms */
 	v4l2_subdev_call(sd, video, g_tvnorms_output, &a->std);
 	a->capabilities = 0;
-	if (sd->ops->video && sd->ops->video->s_dv_preset)
-		a->capabilities |= V4L2_OUT_CAP_PRESETS;
+	if (sd->ops->video && sd->ops->video->s_dv_timings)
+		a->capabilities |= V4L2_OUT_CAP_DV_TIMINGS;
 	if (sd->ops->video && sd->ops->video->s_std_output)
 		a->capabilities |= V4L2_OUT_CAP_STD;
 	a->type = V4L2_OUTPUT_TYPE_ANALOG;
@@ -811,10 +753,6 @@ static const struct v4l2_ioctl_ops mxr_ioctl_ops = {
 	/* Streaming control */
 	.vidioc_streamon = mxr_streamon,
 	.vidioc_streamoff = mxr_streamoff,
-	/* Preset functions */
-	.vidioc_enum_dv_presets = mxr_enum_dv_presets,
-	.vidioc_s_dv_preset = mxr_s_dv_preset,
-	.vidioc_g_dv_preset = mxr_g_dv_preset,
 	/* DV Timings functions */
 	.vidioc_enum_dv_timings = mxr_enum_dv_timings,
 	.vidioc_s_dv_timings = mxr_s_dv_timings,
Signature · 1 line
1.7.10.4
#24 lore raw

Re: [RFC PATCH 11/18] s5p-tv: remove dv_preset support from mixer_video.

Hi Hans,
Please refer to the comments below.

Quoted 13 lines · Hans Verkuil

From: Hans Verkuil <[email protected]>

The dv_preset API is deprecated and is replaced by the much improved dv_timings API. Remove the dv_preset support from this driver as this will allow us to remove the dv_preset API altogether (s5p-tv being the last user of this code).

Cc Tomasz Stanislawski <[email protected]>
Cc Kyungmin Park <[email protected]>
---
 drivers/media/platform/s5p-tv/mixer_video.c |   68 ++-------------------------
 1 file changed, 3 insertions(+), 65 deletions(-)

[snip]

Quoted 13 lines

static int mxr_enum_dv_timings(struct file *file, void *fh,

drivers/media/platform/s5p-tv/mixer_video.c +1 -1
 	struct v4l2_enum_dv_timings *timings)
 {
@@ -584,7 +526,7 @@ static int mxr_s_dv_timings(struct file *file, void *fh,
 	/* lock protects from changing sd_out */
 	mutex_lock(&mdev->mutex);
 
-	/* preset change cannot be done while there is an entity
+	/* timings change cannot be done while there is an entity
 	 * dependant on output configuration
 	 */
 	if (mdev->n_output > 0) {

drivers/media/platform/s5p-tv/mixer_video.c static int mxr_enum_output(struct file *file, void *fh, struct v4l2_output *a) · line 693

Quoted 5 lines
drivers/media/platform/s5p-tv/mixer_video.c +0 -2
@@ -689,8 +631,8 @@ static int mxr_enum_output(struct file *file, void *fh, struct v4l2_output *a)
 	/* try to obtain supported tv norms */
 	v4l2_subdev_call(sd, video, g_tvnorms_output, &a->std);
 	a->capabilities = 0;
-	if (sd->ops->video && sd->ops->video->s_dv_preset)
-		a->capabilities |= V4L2_OUT_CAP_PRESETS;

Could you move the lines below to the patch named
"[RFC PATCH 08/18] s5p-tv: add dv_timings support for mixer_video.".

drivers/media/platform/s5p-tv/mixer_video.c static int mxr_enum_output(struct file *file, void *fh, struct v4l2_output *a) · line 635

Quoted 2 lines
drivers/media/platform/s5p-tv/mixer_video.c +2 -0
+	if (sd->ops->video && sd->ops->video->s_dv_timings)
+		a->capabilities |= V4L2_OUT_CAP_DV_TIMINGS;

Don't you think that all "add" patches should go in reverse order?
I mean that dv_timings hdmiphy should be applied before hdmi. The hdmi before mixer. This way all non-functional features would stay invisible from user-space until they become functional.

Quoted 15 lines
drivers/media/platform/s5p-tv/mixer_video.c +0 -4
 	if (sd->ops->video && sd->ops->video->s_std_output)
 		a->capabilities |= V4L2_OUT_CAP_STD;
 	a->type = V4L2_OUTPUT_TYPE_ANALOG;
@@ -811,10 +753,6 @@ static const struct v4l2_ioctl_ops mxr_ioctl_ops = {
 	/* Streaming control */
 	.vidioc_streamon = mxr_streamon,
 	.vidioc_streamoff = mxr_streamoff,
-	/* Preset functions */
-	.vidioc_enum_dv_presets = mxr_enum_dv_presets,
-	.vidioc_s_dv_preset = mxr_s_dv_preset,
-	.vidioc_g_dv_preset = mxr_g_dv_preset,
 	/* DV Timings functions */
 	.vidioc_enum_dv_timings = mxr_enum_dv_timings,
 	.vidioc_s_dv_timings = mxr_s_dv_timings,
#25 lore raw

RFC PATCH 12/18 s5p-tv: remove the dv_preset API from hdmi.

In reply to Hans Verkuil

From: Hans Verkuil <[email protected]>

The dv_preset API is deprecated and is replaced by the much improved dv_timings API. Remove the dv_preset support from this driver as this will allow us to remove the dv_preset API altogether (s5p-tv being the last user of this code).

Cc Tomasz Stanislawski <[email protected]>
Cc Kyungmin Park <[email protected]>
---
 drivers/media/platform/s5p-tv/hdmi_drv.c |   95 +++++++-----------------------
 1 file changed, 22 insertions(+), 73 deletions(-)
drivers/media/platform/s5p-tv/hdmi_drv.c +22 -73
index 716d0e4..38638b1 100644
@@ -44,9 +44,6 @@ MODULE_AUTHOR("Tomasz Stanislawski, <[email protected]>");
 MODULE_DESCRIPTION("Samsung HDMI");
 MODULE_LICENSE("GPL");
 
-/* default preset configured on probe */
-#define HDMI_DEFAULT_PRESET V4L2_DV_480P59_94
-
 struct hdmi_pulse {
 	u32 beg;
 	u32 end;
@@ -92,8 +89,6 @@ struct hdmi_device {
 	const struct hdmi_timings *cur_conf;
 	/** flag indicating that timings are dirty */
 	int cur_conf_dirty;
-	/** current preset */
-	u32 cur_preset;
 	/** current timings */
 	struct v4l2_dv_timings cur_timings;
 	/** other resources */
@@ -255,7 +250,6 @@ static int hdmi_conf_apply(struct hdmi_device *hdmi_dev)
 {
 	struct device *dev = hdmi_dev->dev;
 	const struct hdmi_timings *conf = hdmi_dev->cur_conf;
-	struct v4l2_dv_preset preset;
 	int ret;
 
 	dev_dbg(dev, "%s\n", __func__);
@@ -270,11 +264,11 @@ static int hdmi_conf_apply(struct hdmi_device *hdmi_dev)
 	hdmi_write_mask(hdmi_dev, HDMI_PHY_RSTOUT,  0, HDMI_PHY_SW_RSTOUT);
 	mdelay(10);
 
-	/* configure presets */
-	preset.preset = hdmi_dev->cur_preset;
-	ret = v4l2_subdev_call(hdmi_dev->phy_sd, video, s_dv_preset, &preset);
+	/* configure timings */
+	ret = v4l2_subdev_call(hdmi_dev->phy_sd, video, s_dv_timings,
+				&hdmi_dev->cur_timings);
 	if (ret) {
-		dev_err(dev, "failed to set preset (%u)\n", preset.preset);
+		dev_err(dev, "failed to set timings\n");
 		return ret;
 	}
 
@@ -478,35 +472,26 @@ static const struct hdmi_timings hdmi_timings_1080p50 = {
 	.vsyn[0] = { .beg = 0 + 4, .end = 5 + 4},
 };
 
+/* default hdmi_timings index of the timings configured on probe */
+#define HDMI_DEFAULT_TIMINGS_IDX (0)
+
 static const struct {
-	u32 preset;
 	bool reduced_fps;
 	const struct v4l2_dv_timings dv_timings;
 	const struct hdmi_timings *hdmi_timings;
 } hdmi_timings[] = {
-	{ V4L2_DV_480P59_94, false, V4L2_DV_BT_CEA_720X480P59_94, &hdmi_timings_480p },
-	{ V4L2_DV_576P50, false, V4L2_DV_BT_CEA_720X576P50, &hdmi_timings_576p50 },
-	{ V4L2_DV_720P50, false, V4L2_DV_BT_CEA_1280X720P50, &hdmi_timings_720p50 },
-	{ V4L2_DV_720P59_94, true, V4L2_DV_BT_CEA_1280X720P60, &hdmi_timings_720p60 },
-	{ V4L2_DV_720P60, false, V4L2_DV_BT_CEA_1280X720P60, &hdmi_timings_720p60 },
-	{ V4L2_DV_1080P24, false, V4L2_DV_BT_CEA_1920X1080P24, &hdmi_timings_1080p24 },
-	{ V4L2_DV_1080P30, false, V4L2_DV_BT_CEA_1920X1080P30, &hdmi_timings_1080p60 },
-	{ V4L2_DV_1080P50, false, V4L2_DV_BT_CEA_1920X1080P50, &hdmi_timings_1080p50 },
-	{ V4L2_DV_1080I50, false, V4L2_DV_BT_CEA_1920X1080I50, &hdmi_timings_1080i50 },
-	{ V4L2_DV_1080I60, false, V4L2_DV_BT_CEA_1920X1080I60, &hdmi_timings_1080i60 },
-	{ V4L2_DV_1080P60, false, V4L2_DV_BT_CEA_1920X1080P60, &hdmi_timings_1080p60 },
+	{ false, V4L2_DV_BT_CEA_720X480P59_94, &hdmi_timings_480p    },
+	{ false, V4L2_DV_BT_CEA_720X576P50,    &hdmi_timings_576p50  },
+	{ false, V4L2_DV_BT_CEA_1280X720P50,   &hdmi_timings_720p50  },
+	{ true,  V4L2_DV_BT_CEA_1280X720P60,   &hdmi_timings_720p60  },
+	{ false, V4L2_DV_BT_CEA_1920X1080P24,  &hdmi_timings_1080p24 },
+	{ false, V4L2_DV_BT_CEA_1920X1080P30,  &hdmi_timings_1080p60 },
+	{ false, V4L2_DV_BT_CEA_1920X1080P50,  &hdmi_timings_1080p50 },
+	{ false, V4L2_DV_BT_CEA_1920X1080I50,  &hdmi_timings_1080i50 },
+	{ false, V4L2_DV_BT_CEA_1920X1080I60,  &hdmi_timings_1080i60 },
+	{ false, V4L2_DV_BT_CEA_1920X1080P60,  &hdmi_timings_1080p60 },
 };
 
-static const struct hdmi_timings *hdmi_preset2timings(u32 preset)
-{
-	int i;
-
-	for (i = 0; i < ARRAY_SIZE(hdmi_timings); ++i)
-		if (hdmi_timings[i].preset == preset)
-			return  hdmi_timings[i].hdmi_timings;
-	return NULL;
-}
-
 static int hdmi_streamon(struct hdmi_device *hdev)
 {
 	struct device *dev = hdev->dev;
@@ -626,32 +611,6 @@ static int hdmi_s_power(struct v4l2_subdev *sd, int on)
 	return IS_ERR_VALUE(ret) ? ret : 0;
 }
 
-static int hdmi_s_dv_preset(struct v4l2_subdev *sd,
-	struct v4l2_dv_preset *preset)
-{
-	struct hdmi_device *hdev = sd_to_hdmi_dev(sd);
-	struct device *dev = hdev->dev;
-	const struct hdmi_timings *conf;
-
-	conf = hdmi_preset2timings(preset->preset);
-	if (conf == NULL) {
-		dev_err(dev, "preset (%u) not supported\n", preset->preset);
-		return -EINVAL;
-	}
-	hdev->cur_conf = conf;
-	hdev->cur_conf_dirty = 1;
-	hdev->cur_preset = preset->preset;
-	return 0;
-}
-
-static int hdmi_g_dv_preset(struct v4l2_subdev *sd,
-	struct v4l2_dv_preset *preset)
-{
-	memset(preset, 0, sizeof(*preset));
-	preset->preset = sd_to_hdmi_dev(sd)->cur_preset;
-	return 0;
-}
-
 static int hdmi_s_dv_timings(struct v4l2_subdev *sd,
 	struct v4l2_dv_timings *timings)
 {
@@ -705,15 +664,6 @@ static int hdmi_g_mbus_fmt(struct v4l2_subdev *sd,
 	return 0;
 }
 
-static int hdmi_enum_dv_presets(struct v4l2_subdev *sd,
-	struct v4l2_dv_enum_preset *preset)
-{
-	if (preset->index >= ARRAY_SIZE(hdmi_timings))
-		return -EINVAL;
-	return v4l_fill_dv_preset_info(hdmi_timings[preset->index].preset,
-		preset);
-}
-
 static int hdmi_enum_dv_timings(struct v4l2_subdev *sd,
 	struct v4l2_enum_dv_timings *timings)
 {
@@ -746,9 +696,6 @@ static const struct v4l2_subdev_core_ops hdmi_sd_core_ops = {
 };
 
 static const struct v4l2_subdev_video_ops hdmi_sd_video_ops = {
-	.s_dv_preset = hdmi_s_dv_preset,
-	.g_dv_preset = hdmi_g_dv_preset,
-	.enum_dv_presets = hdmi_enum_dv_presets,
 	.s_dv_timings = hdmi_s_dv_timings,
 	.g_dv_timings = hdmi_g_dv_timings,
 	.enum_dv_timings = hdmi_enum_dv_timings,
@@ -1022,9 +969,11 @@ static int hdmi_probe(struct platform_device *pdev)
 	sd->owner = THIS_MODULE;
 
 	strlcpy(sd->name, "s5p-hdmi", sizeof(sd->name));
-	hdmi_dev->cur_preset = HDMI_DEFAULT_PRESET;
-	/* FIXME: missing fail preset is not supported */
-	hdmi_dev->cur_conf = hdmi_preset2timings(hdmi_dev->cur_preset);
+	hdmi_dev->cur_timings =
+		hdmi_timings[HDMI_DEFAULT_TIMINGS_IDX].dv_timings;
+	/* FIXME: missing fail timings is not supported */
+	hdmi_dev->cur_conf =
+		hdmi_timings[HDMI_DEFAULT_TIMINGS_IDX].hdmi_timings;
 	hdmi_dev->cur_conf_dirty = 1;
 
 	/* storing subdev for call that have only access to struct device */
Signature · 1 line
1.7.10.4
#26 lore raw

RFC PATCH 13/18 s5p-tv: remove the dv_preset API from hdmiphy.

In reply to Hans Verkuil

From: Hans Verkuil <[email protected]>

The dv_preset API is deprecated and is replaced by the much improved dv_timings API. Remove the dv_preset support from this driver as this will allow us to remove the dv_preset API altogether (s5p-tv being the last user of this code).

Cc Tomasz Stanislawski <[email protected]>
Cc Kyungmin Park <[email protected]>
---
 drivers/media/platform/s5p-tv/hdmiphy_drv.c |   53 ---------------------------
 1 file changed, 53 deletions(-)
drivers/media/platform/s5p-tv/hdmiphy_drv.c +0 -53
index 85b4211..da97124 100644
@@ -176,27 +176,6 @@ static inline struct hdmiphy_ctx *sd_to_ctx(struct v4l2_subdev *sd)
 	return container_of(sd, struct hdmiphy_ctx, sd);
 }
 
-static unsigned long hdmiphy_preset_to_pixclk(u32 preset)
-{
-	static const unsigned long pixclk[] = {
-		[V4L2_DV_480P59_94] =  27000000,
-		[V4L2_DV_576P50]    =  27000000,
-		[V4L2_DV_720P59_94] =  74176000,
-		[V4L2_DV_720P50]    =  74250000,
-		[V4L2_DV_720P60]    =  74250000,
-		[V4L2_DV_1080P24]   =  74250000,
-		[V4L2_DV_1080P30]   =  74250000,
-		[V4L2_DV_1080I50]   =  74250000,
-		[V4L2_DV_1080I60]   =  74250000,
-		[V4L2_DV_1080P50]   = 148500000,
-		[V4L2_DV_1080P60]   = 148500000,
-	};
-	if (preset < ARRAY_SIZE(pixclk))
-		return pixclk[preset];
-	else
-		return 0;
-}
-
 static const u8 *hdmiphy_find_conf(unsigned long pixclk,
 		const struct hdmiphy_conf *conf)
 {
@@ -212,37 +191,6 @@ static int hdmiphy_s_power(struct v4l2_subdev *sd, int on)
 	return 0;
 }
 
-static int hdmiphy_s_dv_preset(struct v4l2_subdev *sd,
-	struct v4l2_dv_preset *preset)
-{
-	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);
-
-	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)
 {
@@ -299,7 +247,6 @@ 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,
 	.s_stream =  hdmiphy_s_stream,
 };
Signature · 1 line
1.7.10.4
#27 lore raw

RFC PATCH 14/18 v4l2-common: remove obsolete v4l_fill_dv_preset_info

In reply to Hans Verkuil

From: Hans Verkuil <[email protected]>

It's no longer used, so it can now be removed.

---
 drivers/media/v4l2-core/v4l2-common.c |   47 ---------------------------------
 include/media/v4l2-common.h           |    1 -
 2 files changed, 48 deletions(-)
drivers/media/v4l2-core/v4l2-common.c +0 -47
index aa044f4..b81f274 100644
@@ -551,53 +551,6 @@ void v4l_bound_align_image(u32 *w, unsigned int wmin, unsigned int wmax,
 EXPORT_SYMBOL_GPL(v4l_bound_align_image);
 
 /**
- * v4l_fill_dv_preset_info - fill description of a digital video preset
- * @preset - preset value
- * @info - pointer to struct v4l2_dv_enum_preset
- *
- * drivers can use this helper function to fill description of dv preset
- * in info.
- */
-int v4l_fill_dv_preset_info(u32 preset, struct v4l2_dv_enum_preset *info)
-{
-	static const struct v4l2_dv_preset_info {
-		u16 width;
-		u16 height;
-		const char *name;
-	} dv_presets[] = {
-		{ 0, 0, "Invalid" },		/* V4L2_DV_INVALID */
-		{ 720,  480, "[email protected]" },	/* V4L2_DV_480P59_94 */
-		{ 720,  576, "576p@50" },	/* V4L2_DV_576P50 */
-		{ 1280, 720, "720p@24" },	/* V4L2_DV_720P24 */
-		{ 1280, 720, "720p@25" },	/* V4L2_DV_720P25 */
-		{ 1280, 720, "720p@30" },	/* V4L2_DV_720P30 */
-		{ 1280, 720, "720p@50" },	/* V4L2_DV_720P50 */
-		{ 1280, 720, "[email protected]" },	/* V4L2_DV_720P59_94 */
-		{ 1280, 720, "720p@60" },	/* V4L2_DV_720P60 */
-		{ 1920, 1080, "[email protected]" },	/* V4L2_DV_1080I29_97 */
-		{ 1920, 1080, "1080i@30" },	/* V4L2_DV_1080I30 */
-		{ 1920, 1080, "1080i@25" },	/* V4L2_DV_1080I25 */
-		{ 1920, 1080, "1080i@50" },	/* V4L2_DV_1080I50 */
-		{ 1920, 1080, "1080i@60" },	/* V4L2_DV_1080I60 */
-		{ 1920, 1080, "1080p@24" },	/* V4L2_DV_1080P24 */
-		{ 1920, 1080, "1080p@25" },	/* V4L2_DV_1080P25 */
-		{ 1920, 1080, "1080p@30" },	/* V4L2_DV_1080P30 */
-		{ 1920, 1080, "1080p@50" },	/* V4L2_DV_1080P50 */
-		{ 1920, 1080, "1080p@60" },	/* V4L2_DV_1080P60 */
-	};
-
-	if (info == NULL || preset >= ARRAY_SIZE(dv_presets))
-		return -EINVAL;
-
-	info->preset = preset;
-	info->width = dv_presets[preset].width;
-	info->height = dv_presets[preset].height;
-	strlcpy(info->name, dv_presets[preset].name, sizeof(info->name));
-	return 0;
-}
-EXPORT_SYMBOL_GPL(v4l_fill_dv_preset_info);
-
-/**
  * v4l_match_dv_timings - check if two timings match
  * @t1 - compare this v4l2_dv_timings struct...
  * @t2 - with this struct.
include/media/v4l2-common.h +0 -1
index ec7c9c0..1d93c48 100644
@@ -201,7 +201,6 @@ void v4l_bound_align_image(unsigned int *w, unsigned int wmin,
 			   unsigned int *h, unsigned int hmin,
 			   unsigned int hmax, unsigned int halign,
 			   unsigned int salign);
-int v4l_fill_dv_preset_info(u32 preset, struct v4l2_dv_enum_preset *info);
 
 struct v4l2_discrete_probe {
 	const struct v4l2_frmsize_discrete	*sizes;
Signature · 1 line
1.7.10.4
#28 lore raw

RFC PATCH 15/18 v4l2-subdev: remove obsolete dv_preset ops.

In reply to Hans Verkuil

From: Hans Verkuil <[email protected]>

These ops are no longer used, so it's time to remove them.

---
 include/media/v4l2-subdev.h |   16 ----------------
 1 file changed, 16 deletions(-)
include/media/v4l2-subdev.h +0 -16
index b137a5e..34ce1a2 100644
@@ -279,14 +279,6 @@ struct v4l2_mbus_frame_desc {
    s_routing: see s_routing in audio_ops, except this version is for video
 	devices.
 
-   s_dv_preset: set dv (Digital Video) preset in the sub device. Similar to
-	s_std()
-
-   g_dv_preset: get current dv (Digital Video) preset in the sub device.
-
-   query_dv_preset: query dv preset in the sub device. This is similar to
-	querystd()
-
    s_dv_timings(): Set custom dv timings in the sub device. This is used
 	when sub device is capable of setting detailed timing information
 	in the hardware to generate/detect the video signal.
@@ -331,14 +323,6 @@ struct v4l2_subdev_video_ops {
 				struct v4l2_subdev_frame_interval *interval);
 	int (*enum_framesizes)(struct v4l2_subdev *sd, struct v4l2_frmsizeenum *fsize);
 	int (*enum_frameintervals)(struct v4l2_subdev *sd, struct v4l2_frmivalenum *fival);
-	int (*enum_dv_presets) (struct v4l2_subdev *sd,
-			struct v4l2_dv_enum_preset *preset);
-	int (*s_dv_preset)(struct v4l2_subdev *sd,
-			struct v4l2_dv_preset *preset);
-	int (*g_dv_preset)(struct v4l2_subdev *sd,
-			struct v4l2_dv_preset *preset);
-	int (*query_dv_preset)(struct v4l2_subdev *sd,
-			struct v4l2_dv_preset *preset);
 	int (*s_dv_timings)(struct v4l2_subdev *sd,
 			struct v4l2_dv_timings *timings);
 	int (*g_dv_timings)(struct v4l2_subdev *sd,
Signature · 1 line
1.7.10.4
#29 lore raw

RFC PATCH 16/18 v4l2 core: remove the obsolete dv_preset support.

In reply to Hans Verkuil

From: Hans Verkuil <[email protected]>

These ioctls are no longer used by any drivers, so remove them.

---
 drivers/media/v4l2-core/v4l2-compat-ioctl32.c |    4 ----
 drivers/media/v4l2-core/v4l2-dev.c            |    4 ----
 drivers/media/v4l2-core/v4l2-ioctl.c          |   27 ++-----------------------
 include/media/v4l2-ioctl.h                    |    9 ---------
 4 files changed, 2 insertions(+), 42 deletions(-)
drivers/media/v4l2-core/v4l2-compat-ioctl32.c +0 -4
index 7157af3..f129551 100644
@@ -1076,10 +1076,6 @@ long v4l2_compat_ioctl32(struct file *file, unsigned int cmd, unsigned long arg)
 	case VIDIOC_DBG_G_REGISTER:
 	case VIDIOC_DBG_G_CHIP_IDENT:
 	case VIDIOC_S_HW_FREQ_SEEK:
-	case VIDIOC_ENUM_DV_PRESETS:
-	case VIDIOC_S_DV_PRESET:
-	case VIDIOC_G_DV_PRESET:
-	case VIDIOC_QUERY_DV_PRESET:
 	case VIDIOC_S_DV_TIMINGS:
 	case VIDIOC_G_DV_TIMINGS:
 	case VIDIOC_DQEVENT:
drivers/media/v4l2-core/v4l2-dev.c +0 -4
index 51b3a77..a4201ff 100644
@@ -685,7 +685,6 @@ static void determine_valid_ioctls(struct video_device *vdev)
 			SET_VALID_IOCTL(ops, VIDIOC_ENUMAUDIO, vidioc_enumaudio);
 			SET_VALID_IOCTL(ops, VIDIOC_G_AUDIO, vidioc_g_audio);
 			SET_VALID_IOCTL(ops, VIDIOC_S_AUDIO, vidioc_s_audio);
-			SET_VALID_IOCTL(ops, VIDIOC_QUERY_DV_PRESET, vidioc_query_dv_preset);
 			SET_VALID_IOCTL(ops, VIDIOC_QUERY_DV_TIMINGS, vidioc_query_dv_timings);
 		}
 		if (is_tx) {
@@ -708,9 +707,6 @@ static void determine_valid_ioctls(struct video_device *vdev)
 					(ops->vidioc_g_std || vdev->current_norm)))
 			set_bit(_IOC_NR(VIDIOC_G_PARM), valid_ioctls);
 		SET_VALID_IOCTL(ops, VIDIOC_S_PARM, vidioc_s_parm);
-		SET_VALID_IOCTL(ops, VIDIOC_ENUM_DV_PRESETS, vidioc_enum_dv_presets);
-		SET_VALID_IOCTL(ops, VIDIOC_S_DV_PRESET, vidioc_s_dv_preset);
-		SET_VALID_IOCTL(ops, VIDIOC_G_DV_PRESET, vidioc_g_dv_preset);
 		SET_VALID_IOCTL(ops, VIDIOC_S_DV_TIMINGS, vidioc_s_dv_timings);
 		SET_VALID_IOCTL(ops, VIDIOC_G_DV_TIMINGS, vidioc_g_dv_timings);
 		SET_VALID_IOCTL(ops, VIDIOC_ENUM_DV_TIMINGS, vidioc_enum_dv_timings);
drivers/media/v4l2-core/v4l2-ioctl.c +2 -25
index aa6e7c7..3f24902 100644
@@ -643,21 +643,6 @@ static void v4l_print_dbg_register(const void *arg, bool write_only)
 			p->reg, p->val);
 }
 
-static void v4l_print_dv_enum_presets(const void *arg, bool write_only)
-{
-	const struct v4l2_dv_enum_preset *p = arg;
-
-	pr_cont("index=%u, preset=%u, name=%s, width=%u, height=%u\n",
-			p->index, p->preset, p->name, p->width, p->height);
-}
-
-static void v4l_print_dv_preset(const void *arg, bool write_only)
-{
-	const struct v4l2_dv_preset *p = arg;
-
-	pr_cont("preset=%u\n", p->preset);
-}
-
 static void v4l_print_dv_timings(const void *arg, bool write_only)
 {
 	const struct v4l2_dv_timings *p = arg;
@@ -1000,15 +985,13 @@ static int v4l_enuminput(const struct v4l2_ioctl_ops *ops,
 	struct v4l2_input *p = arg;
 
 	/*
-	 * We set the flags for CAP_PRESETS, CAP_DV_TIMINGS &
+	 * We set the flags for CAP_DV_TIMINGS &
 	 * CAP_STD here based on ioctl handler provided by the
 	 * driver. If the driver doesn't support these
 	 * for a specific input, it must override these flags.
 	 */
 	if (ops->vidioc_s_std)
 		p->capabilities |= V4L2_IN_CAP_STD;
-	if (ops->vidioc_s_dv_preset)
-		p->capabilities |= V4L2_IN_CAP_PRESETS;
 	if (ops->vidioc_s_dv_timings)
 		p->capabilities |= V4L2_IN_CAP_DV_TIMINGS;
 
@@ -1021,15 +1004,13 @@ static int v4l_enumoutput(const struct v4l2_ioctl_ops *ops,
 	struct v4l2_output *p = arg;
 
 	/*
-	 * We set the flags for CAP_PRESETS, CAP_DV_TIMINGS &
+	 * We set the flags for CAP_DV_TIMINGS &
 	 * CAP_STD here based on ioctl handler provided by the
 	 * driver. If the driver doesn't support these
 	 * for a specific output, it must override these flags.
 	 */
 	if (ops->vidioc_s_std)
 		p->capabilities |= V4L2_OUT_CAP_STD;
-	if (ops->vidioc_s_dv_preset)
-		p->capabilities |= V4L2_OUT_CAP_PRESETS;
 	if (ops->vidioc_s_dv_timings)
 		p->capabilities |= V4L2_OUT_CAP_DV_TIMINGS;
 
@@ -2028,10 +2009,6 @@ static struct v4l2_ioctl_info v4l2_ioctls[] = {
 	IOCTL_INFO_FNC(VIDIOC_DBG_G_REGISTER, v4l_dbg_g_register, v4l_print_dbg_register, 0),
 	IOCTL_INFO_FNC(VIDIOC_DBG_G_CHIP_IDENT, v4l_dbg_g_chip_ident, v4l_print_dbg_chip_ident, 0),
 	IOCTL_INFO_FNC(VIDIOC_S_HW_FREQ_SEEK, v4l_s_hw_freq_seek, v4l_print_hw_freq_seek, INFO_FL_PRIO),
-	IOCTL_INFO_STD(VIDIOC_ENUM_DV_PRESETS, vidioc_enum_dv_presets, v4l_print_dv_enum_presets, 0),
-	IOCTL_INFO_STD(VIDIOC_S_DV_PRESET, vidioc_s_dv_preset, v4l_print_dv_preset, INFO_FL_PRIO),
-	IOCTL_INFO_STD(VIDIOC_G_DV_PRESET, vidioc_g_dv_preset, v4l_print_dv_preset, 0),
-	IOCTL_INFO_STD(VIDIOC_QUERY_DV_PRESET, vidioc_query_dv_preset, v4l_print_dv_preset, 0),
 	IOCTL_INFO_STD(VIDIOC_S_DV_TIMINGS, vidioc_s_dv_timings, v4l_print_dv_timings, INFO_FL_PRIO),
 	IOCTL_INFO_STD(VIDIOC_G_DV_TIMINGS, vidioc_g_dv_timings, v4l_print_dv_timings, 0),
 	IOCTL_INFO_FNC(VIDIOC_DQEVENT, v4l_dqevent, v4l_print_event, 0),
include/media/v4l2-ioctl.h +0 -9
index 4118ad1..daa0065 100644
@@ -254,15 +254,6 @@ struct v4l2_ioctl_ops {
 					   struct v4l2_frmivalenum *fival);
 
 	/* DV Timings IOCTLs */
-	int (*vidioc_enum_dv_presets) (struct file *file, void *fh,
-				       struct v4l2_dv_enum_preset *preset);
-
-	int (*vidioc_s_dv_preset) (struct file *file, void *fh,
-				   struct v4l2_dv_preset *preset);
-	int (*vidioc_g_dv_preset) (struct file *file, void *fh,
-				   struct v4l2_dv_preset *preset);
-	int (*vidioc_query_dv_preset) (struct file *file, void *fh,
-					struct v4l2_dv_preset *qpreset);
 	int (*vidioc_s_dv_timings) (struct file *file, void *fh,
 				    struct v4l2_dv_timings *timings);
 	int (*vidioc_g_dv_timings) (struct file *file, void *fh,
Signature · 1 line
1.7.10.4
#30 lore raw

RFC PATCH 17/18 DocBook/media/v4l: remove the documentation of the obsolete dv_preset API.

In reply to Hans Verkuil

From: Hans Verkuil <[email protected]>

This API is no longer used by any driver and so can be removed from the documentation.

---
 Documentation/DocBook/media/v4l/common.xml         |   14 --
 Documentation/DocBook/media/v4l/v4l2.xml           |    3 -
 .../DocBook/media/v4l/vidioc-enum-dv-presets.xml   |  240 --------------------
 .../DocBook/media/v4l/vidioc-enuminput.xml         |    5 -
 .../DocBook/media/v4l/vidioc-enumoutput.xml        |    5 -
 .../DocBook/media/v4l/vidioc-g-dv-preset.xml       |  113 ---------
 .../DocBook/media/v4l/vidioc-query-dv-preset.xml   |   78 -------
 7 files changed, 458 deletions(-)
 delete mode 100644 Documentation/DocBook/media/v4l/vidioc-enum-dv-presets.xml
 delete mode 100644 Documentation/DocBook/media/v4l/vidioc-g-dv-preset.xml
 delete mode 100644 Documentation/DocBook/media/v4l/vidioc-query-dv-preset.xml
Documentation/DocBook/media/v4l/common.xml +0 -14
index ae06afb..1ddf354 100644
@@ -750,15 +750,6 @@ header can be used to get the timings of the formats in the <xref linkend="cea86
 <xref linkend="vesadmt" /> standards.
 	</para>
 	</listitem>
-	<listitem>
-	<para>DV Presets: Digital Video (DV) presets (<emphasis role="bold">deprecated</emphasis>).
-	These are IDs representing a
-video timing at the input/output. Presets are pre-defined timings implemented
-by the hardware according to video standards. A __u32 data type is used to represent
-a preset unlike the bit mask that is used in &v4l2-std-id; allowing future extensions
-to support as many different presets as needed. This API is deprecated in favor of the DV Timings
-API.</para>
-	</listitem>
 	</itemizedlist>
 	<para>To enumerate and query the attributes of the DV timings supported by a device,
 	applications use the &VIDIOC-ENUM-DV-TIMINGS; and &VIDIOC-DV-TIMINGS-CAP; ioctls.
@@ -766,11 +757,6 @@ API.</para>
 &VIDIOC-S-DV-TIMINGS; ioctl and to get current DV timings they use the
 &VIDIOC-G-DV-TIMINGS; ioctl. To detect the DV timings as seen by the video receiver applications
 use the &VIDIOC-QUERY-DV-TIMINGS; ioctl.</para>
-	<para>To enumerate and query the attributes of DV presets supported by a device,
-applications use the &VIDIOC-ENUM-DV-PRESETS; ioctl. To get the current DV preset,
-applications use the &VIDIOC-G-DV-PRESET; ioctl and to set a preset they use the
-&VIDIOC-S-DV-PRESET; ioctl. To detect the preset as seen by the video receiver applications
-use the &VIDIOC-QUERY-DV-PRESET; ioctl.</para>
 	<para>Applications can make use of the <xref linkend="input-capabilities" /> and
 <xref linkend="output-capabilities"/> flags to decide what ioctls are available to set the
 video timings for the device.</para>
Documentation/DocBook/media/v4l/v4l2.xml +0 -3
index a3cce18..32a10ee 100644
@@ -544,7 +544,6 @@ and discussions on the V4L mailing list.</revremark>
     &sub-encoder-cmd;
     &sub-enumaudio;
     &sub-enumaudioout;
-    &sub-enum-dv-presets;
     &sub-enum-dv-timings;
     &sub-enum-fmt;
     &sub-enum-framesizes;
@@ -558,7 +557,6 @@ and discussions on the V4L mailing list.</revremark>
     &sub-g-audioout;
     &sub-g-crop;
     &sub-g-ctrl;
-    &sub-g-dv-preset;
     &sub-g-dv-timings;
     &sub-g-enc-index;
     &sub-g-ext-ctrls;
@@ -582,7 +580,6 @@ and discussions on the V4L mailing list.</revremark>
     &sub-querybuf;
     &sub-querycap;
     &sub-queryctrl;
-    &sub-query-dv-preset;
     &sub-query-dv-timings;
     &sub-querystd;
     &sub-reqbufs;
Documentation/DocBook/media/v4l/vidioc-enum-dv-presets.xml deleted +0 -240

240 lines not on this page · raw message

Documentation/DocBook/media/v4l/vidioc-enuminput.xml +0 -5
index 3c9a813..493a39a 100644
@@ -278,11 +278,6 @@ input/output interface to [email protected] on 19 Oct 2009.
 	&cs-def;
 	<tbody valign="top">
 	  <row>
-	    <entry><constant>V4L2_IN_CAP_PRESETS</constant></entry>
-	    <entry>0x00000001</entry>
-	    <entry>This input supports setting DV presets by using VIDIOC_S_DV_PRESET.</entry>
-	  </row>
-	  <row>
 	    <entry><constant>V4L2_IN_CAP_DV_TIMINGS</constant></entry>
 	    <entry>0x00000002</entry>
 	    <entry>This input supports setting video timings by using VIDIOC_S_DV_TIMINGS.</entry>
Documentation/DocBook/media/v4l/vidioc-enumoutput.xml +0 -5
index f4ab079..2654e09 100644
@@ -163,11 +163,6 @@ input/output interface to [email protected] on 19 Oct 2009.
 	&cs-def;
 	<tbody valign="top">
 	  <row>
-	    <entry><constant>V4L2_OUT_CAP_PRESETS</constant></entry>
-	    <entry>0x00000001</entry>
-	    <entry>This output supports setting DV presets by using VIDIOC_S_DV_PRESET.</entry>
-	  </row>
-	  <row>
 	    <entry><constant>V4L2_OUT_CAP_DV_TIMINGS</constant></entry>
 	    <entry>0x00000002</entry>
 	    <entry>This output supports setting video timings by using VIDIOC_S_DV_TIMINGS.</entry>
Documentation/DocBook/media/v4l/vidioc-g-dv-preset.xml deleted +0 -113

113 lines not on this page · raw message

Documentation/DocBook/media/v4l/vidioc-query-dv-preset.xml deleted +0 -78

78 lines not on this page · raw message

Signature · 1 line
1.7.10.4
#31 lore raw

RFC PATCH 18/18 videodev2.h: remove obsolete DV_PRESET API.

In reply to Hans Verkuil

From: Hans Verkuil <[email protected]>

This API is now obsolete and can be removed.

---
 include/uapi/linux/videodev2.h |   54 ----------------------------------------
 1 file changed, 54 deletions(-)
include/uapi/linux/videodev2.h +0 -54
index 234d1d8..d1513c3 100644
@@ -980,52 +980,6 @@ struct v4l2_standard {
 	__u32		     reserved[4];
 };
 
-/* The DV Preset API is deprecated in favor of the DV Timings API.
-   New drivers shouldn't use this anymore! */
-
-/*
- *	V I D E O	T I M I N G S	D V	P R E S E T
- */
-struct v4l2_dv_preset {
-	__u32	preset;
-	__u32	reserved[4];
-};
-
-/*
- *	D V	P R E S E T S	E N U M E R A T I O N
- */
-struct v4l2_dv_enum_preset {
-	__u32	index;
-	__u32	preset;
-	__u8	name[32]; /* Name of the preset timing */
-	__u32	width;
-	__u32	height;
-	__u32	reserved[4];
-};
-
-/*
- * 	D V	P R E S E T	V A L U E S
- */
-#define		V4L2_DV_INVALID		0
-#define		V4L2_DV_480P59_94	1 /* BT.1362 */
-#define		V4L2_DV_576P50		2 /* BT.1362 */
-#define		V4L2_DV_720P24		3 /* SMPTE 296M */
-#define		V4L2_DV_720P25		4 /* SMPTE 296M */
-#define		V4L2_DV_720P30		5 /* SMPTE 296M */
-#define		V4L2_DV_720P50		6 /* SMPTE 296M */
-#define		V4L2_DV_720P59_94	7 /* SMPTE 274M */
-#define		V4L2_DV_720P60		8 /* SMPTE 274M/296M */
-#define		V4L2_DV_1080I29_97	9 /* BT.1120/ SMPTE 274M */
-#define		V4L2_DV_1080I30		10 /* BT.1120/ SMPTE 274M */
-#define		V4L2_DV_1080I25		11 /* BT.1120 */
-#define		V4L2_DV_1080I50		12 /* SMPTE 296M */
-#define		V4L2_DV_1080I60		13 /* SMPTE 296M */
-#define		V4L2_DV_1080P24		14 /* SMPTE 296M */
-#define		V4L2_DV_1080P25		15 /* SMPTE 296M */
-#define		V4L2_DV_1080P30		16 /* SMPTE 296M */
-#define		V4L2_DV_1080P50		17 /* BT.1120 */
-#define		V4L2_DV_1080P60		18 /* BT.1120 */
-
 /*
  *	D V 	B T	T I M I N G S
  */
@@ -1239,7 +1193,6 @@ struct v4l2_input {
 #define V4L2_IN_ST_VTR         0x04000000  /* VTR time constant */
 
 /* capabilities flags */
-#define V4L2_IN_CAP_PRESETS		0x00000001 /* Supports S_DV_PRESET */
 #define V4L2_IN_CAP_DV_TIMINGS		0x00000002 /* Supports S_DV_TIMINGS */
 #define V4L2_IN_CAP_CUSTOM_TIMINGS	V4L2_IN_CAP_DV_TIMINGS /* For compatibility */
 #define V4L2_IN_CAP_STD			0x00000004 /* Supports S_STD */
@@ -1263,7 +1216,6 @@ struct v4l2_output {
 #define V4L2_OUTPUT_TYPE_ANALOGVGAOVERLAY	3
 
 /* capabilities flags */
-#define V4L2_OUT_CAP_PRESETS		0x00000001 /* Supports S_DV_PRESET */
 #define V4L2_OUT_CAP_DV_TIMINGS		0x00000002 /* Supports S_DV_TIMINGS */
 #define V4L2_OUT_CAP_CUSTOM_TIMINGS	V4L2_OUT_CAP_DV_TIMINGS /* For compatibility */
 #define V4L2_OUT_CAP_STD		0x00000004 /* Supports S_STD */
@@ -1980,12 +1932,6 @@ struct v4l2_create_buffers {
 
 #define VIDIOC_S_HW_FREQ_SEEK	 _IOW('V', 82, struct v4l2_hw_freq_seek)
 
-/* These four DV Preset ioctls are deprecated in favor of the DV Timings
-   ioctls. */
-#define	VIDIOC_ENUM_DV_PRESETS	_IOWR('V', 83, struct v4l2_dv_enum_preset)
-#define	VIDIOC_S_DV_PRESET	_IOWR('V', 84, struct v4l2_dv_preset)
-#define	VIDIOC_G_DV_PRESET	_IOWR('V', 85, struct v4l2_dv_preset)
-#define	VIDIOC_QUERY_DV_PRESET	_IOR('V',  86, struct v4l2_dv_preset)
 #define	VIDIOC_S_DV_TIMINGS	_IOWR('V', 87, struct v4l2_dv_timings)
 #define	VIDIOC_G_DV_TIMINGS	_IOWR('V', 88, struct v4l2_dv_timings)
 #define	VIDIOC_DQEVENT		 _IOR('V', 89, struct v4l2_event)
Signature · 1 line
1.7.10.4
Tested-by on the v1 series
#32 lore raw
In reply to Hans Verkuil

Hi Hans,
Thank you for the patches.
I applied the patchset on the top of SPRC's 3.8-rc4 kernel. I tested the s5p-tv dv-timings using 0.9.3 using v4l-utils. The test platform was Universal C210 (based on Exynos 4210 SoC).

Every timing mode worked correctly so do not hesitate to add:

to all s5p-tv related patches.

I tested following features:
a) v4l2-ctl --list-dv-timings
Result: got 10 timings entries as expected
b) v4l2-ctl --get-dv-timings-cap
Result: got timings caps. The was minor issue. Minimal with is 720 not 640.
c) for each available timing
v4l2-ctl --set-dv-bt-timings=index={index}
v4l2-ctl --get-dv-bt-timings
Show test image on the screen
Result: TV detected correct timings for all cases

I found some minor issues in the patches.
Please refer to the inlined comments.

BTW.
The v4l2-ctl reports that fps for 1080i50 and 1080i60 as 25 and 30 respectively. I agree that those values correctly reflects relation between
image resolution and the pixel rate.
However, I admit it looks a little bit confusing when suddenly 50 changes into 25. It should clarified if F in FPS stands for "frame" or "field".

Regards,
Tomasz Stanislawski

Quoted 42 lines · Hans Verkuil

Hi all!

This patch series removes the last remnants of the deprecated DV_PRESET API from the kernel:

- remove the dv_preset ops from the tvp7002 driver: all bridge drivers that use this i2c driver have already been converted to the DV_TIMINGS API, so these ops are no longer used. Prabhakar, can you test this for me?

- fix some remaining references to the preset API from the davinci drivers. It's trivial stuff, but I would appreciate it if you can look at it, Prabhakar.

- rename some CUSTOM_TIMINGS defines to DV_TIMINGS since CUSTOM_TIMINGS is deprecated. It certainly shouldn't be used anymore in the kernel. Trivial patches, but please look at it as well, Prabhakar and Scott.

- convert the s5p-tv drivers from the DV_PRESET to the DV_TIMINGS API and remove the DV_PRESET API. Tomasz or Kyungmin Park, can you test this? I do not know whether removal of the DV_PRESET API is possible at this stage for the s5p-tv since I do not know if any code inside Samsung uses the DV_PRESET API. If the DV_PRESET API cannot be removed at this time, then let me know. I would have to make some changes to allow the preset and timings APIs to co-exist. I would really like to remove the preset API some time this year, though, if only to prevent new drivers from attempting to use the preset API.

- finally remove the remaining core DV_PRESET support.

- remove the DV_PRESET API from the videodev2.h header. Note that I am not at all certain if we should do this. I know that the DV_PRESET API has only been used in embedded systems, so the impact should be very limited. But it is probably better to wait for a year or so before actually removing it from the header. The main reason for adding this removal is to verify that I haven't forgotten any driver conversions.

Comments are welcome!

Regards,

Hans

#33 lore raw
Quoted 11 lines · On Fri March 1 2013 12:01:09 Tomasz Stanislawski wrote:

Hi Hans,
Thank you for the patches.
I applied the patchset on the top of SPRC's 3.8-rc4 kernel. I tested the s5p-tv dv-timings using 0.9.3 using v4l-utils. The test platform was Universal C210 (based on Exynos 4210 SoC).

Every timing mode worked correctly so do not hesitate to add:

to all s5p-tv related patches.

Thanks for testing! Much appreciated.

Quoted 12 lines

I tested following features:
a) v4l2-ctl --list-dv-timings
Result: got 10 timings entries as expected
b) v4l2-ctl --get-dv-timings-cap
Result: got timings caps. The was minor issue. Minimal with is 720 not 640.
c) for each available timing
v4l2-ctl --set-dv-bt-timings=index={index}
v4l2-ctl --get-dv-bt-timings
Show test image on the screen
Result: TV detected correct timings for all cases

Quoted 2 lines

I found some minor issues in the patches.
Please refer to the inlined comments.

I'll take those into account for my v2 posting.

Quoted 6 lines

BTW.
The v4l2-ctl reports that fps for 1080i50 and 1080i60 as 25 and 30 respectively. I agree that those values correctly reflects relation between
image resolution and the pixel rate.
However, I admit it looks a little bit confusing when suddenly 50 changes into 25. It should clarified if F in FPS stands for "frame" or "field".

Can you add this patch to v4l2-ctl and see if that looks better?

--------------- cut here ---------------

utils/v4l2-ctl/v4l2-ctl-stds.cpp +2 -3
index 863357a..d39faca 100644
@@ -260,10 +260,9 @@ static void print_dv_timings(const struct v4l2_dv_timings *t)
 				(bt->polarities & V4L2_DV_HSYNC_POS_POL) ? '+' : '-');
 		printf("\tPixelclock: %lld Hz", bt->pixelclock);
 		if (bt->width && bt->height)
-			printf(" (%.2f fps)", (double)bt->pixelclock /
+			printf(" (%.2f fields per second)", (double)bt->pixelclock /
 					((bt->width + bt->hfrontporch + bt->hsync + bt->hbackporch) *
-					 (bt->height + bt->vfrontporch + bt->vsync + bt->vbackporch +
-					  bt->il_vfrontporch + bt->il_vsync + bt->il_vbackporch)));
+					 (bt->height + bt->vfrontporch + bt->vsync + bt->vbackporch)));
 		printf("\n");
 		printf("\tHorizontal frontporch: %d\n", bt->hfrontporch);
 		printf("\tHorizontal sync: %d\n", bt->hsync);

--------------- cut here ---------------

Also, can you run v4l2-compliance as well? See what that reports.

Regards,

Hans

#34 lore raw

RFC PATCH 1/18 tvp7002: replace 'preset' by 'timings' in various structs/variables.

From: Hans Verkuil <[email protected]>

This is the first step towards removing the deprecated preset support of this driver.

---
 drivers/media/i2c/tvp7002.c |   90 +++++++++++++++++++++----------------------
 1 file changed, 45 insertions(+), 45 deletions(-)
drivers/media/i2c/tvp7002.c +45 -45
index 537f6b4..7995eeb 100644
@@ -326,8 +326,8 @@ static const struct i2c_reg_value tvp7002_parms_720P50[] = {
 	{ TVP7002_EOR, 0xff, TVP7002_RESERVED }
 };
 
-/* Preset definition for handling device operation */
-struct tvp7002_preset_definition {
+/* Timings definition for handling device operation */
+struct tvp7002_timings_definition {
 	u32 preset;
 	struct v4l2_dv_timings timings;
 	const struct i2c_reg_value *p_settings;
@@ -339,8 +339,8 @@ struct tvp7002_preset_definition {
 	u16 cpl_max;
 };
 
-/* Struct list for digital video presets */
-static const struct tvp7002_preset_definition tvp7002_presets[] = {
+/* Struct list for digital video timings */
+static const struct tvp7002_timings_definition tvp7002_timings[] = {
 	{
 		V4L2_DV_720P60,
 		V4L2_DV_BT_CEA_1280X720P60,
@@ -420,7 +420,7 @@ static const struct tvp7002_preset_definition tvp7002_presets[] = {
 	}
 };
 
-#define NUM_PRESETS	ARRAY_SIZE(tvp7002_presets)
+#define NUM_TIMINGS ARRAY_SIZE(tvp7002_timings)
 
 /* Device definition */
 struct tvp7002 {
@@ -431,7 +431,7 @@ struct tvp7002 {
 	int ver;
 	int streaming;
 
-	const struct tvp7002_preset_definition *current_preset;
+	const struct tvp7002_timings_definition *current_timings;
 };
 
 /*
@@ -603,11 +603,11 @@ static int tvp7002_s_dv_preset(struct v4l2_subdev *sd,
 	u32 preset;
 	int i;
 
-	for (i = 0; i < NUM_PRESETS; i++) {
-		preset = tvp7002_presets[i].preset;
+	for (i = 0; i < NUM_TIMINGS; i++) {
+		preset = tvp7002_timings[i].preset;
 		if (preset == dv_preset->preset) {
-			device->current_preset = &tvp7002_presets[i];
-			return tvp7002_write_inittab(sd, tvp7002_presets[i].p_settings);
+			device->current_timings = &tvp7002_timings[i];
+			return tvp7002_write_inittab(sd, tvp7002_timings[i].p_settings);
 		}
 	}
 
@@ -623,12 +623,12 @@ static int tvp7002_s_dv_timings(struct v4l2_subdev *sd,
 
 	if (dv_timings->type != V4L2_DV_BT_656_1120)
 		return -EINVAL;
-	for (i = 0; i < NUM_PRESETS; i++) {
-		const struct v4l2_bt_timings *t = &tvp7002_presets[i].timings.bt;
+	for (i = 0; i < NUM_TIMINGS; i++) {
+		const struct v4l2_bt_timings *t = &tvp7002_timings[i].timings.bt;
 
 		if (!memcmp(bt, t, &bt->standards - &bt->width)) {
-			device->current_preset = &tvp7002_presets[i];
-			return tvp7002_write_inittab(sd, tvp7002_presets[i].p_settings);
+			device->current_timings = &tvp7002_timings[i];
+			return tvp7002_write_inittab(sd, tvp7002_timings[i].p_settings);
 		}
 	}
 	return -EINVAL;
@@ -639,7 +639,7 @@ static int tvp7002_g_dv_timings(struct v4l2_subdev *sd,
 {
 	struct tvp7002 *device = to_tvp7002(sd);
 
-	*dv_timings = device->current_preset->timings;
+	*dv_timings = device->current_timings->timings;
 	return 0;
 }
 
@@ -681,15 +681,15 @@ static int tvp7002_mbus_fmt(struct v4l2_subdev *sd, struct v4l2_mbus_framefmt *f
 	int error;
 
 	/* Calculate height and width based on current standard */
-	error = v4l_fill_dv_preset_info(device->current_preset->preset, &e_preset);
+	error = v4l_fill_dv_preset_info(device->current_timings->preset, &e_preset);
 	if (error)
 		return error;
 
 	f->width = e_preset.width;
 	f->height = e_preset.height;
 	f->code = V4L2_MBUS_FMT_YUYV10_1X20;
-	f->field = device->current_preset->scanmode;
-	f->colorspace = device->current_preset->color_space;
+	f->field = device->current_timings->scanmode;
+	f->colorspace = device->current_timings->color_space;
 
 	v4l2_dbg(1, debug, sd, "MBUS_FMT: Width - %d, Height - %d",
 			f->width, f->height);
@@ -697,16 +697,16 @@ static int tvp7002_mbus_fmt(struct v4l2_subdev *sd, struct v4l2_mbus_framefmt *f
 }
 
 /*
- * tvp7002_query_dv_preset() - query DV preset
+ * tvp7002_query_dv() - query DV timings
  * @sd: pointer to standard V4L2 sub-device structure
- * @qpreset: standard V4L2 v4l2_dv_preset structure
+ * @index: index into the tvp7002_timings array
  *
- * Returns the current DV preset by TVP7002. If no active input is
+ * Returns the current DV timings detected by TVP7002. If no active input is
  * detected, returns -EINVAL
  */
 static int tvp7002_query_dv(struct v4l2_subdev *sd, int *index)
 {
-	const struct tvp7002_preset_definition *presets = tvp7002_presets;
+	const struct tvp7002_timings_definition *timings = tvp7002_timings;
 	u8 progressive;
 	u32 lpfr;
 	u32 cpln;
@@ -717,7 +717,7 @@ static int tvp7002_query_dv(struct v4l2_subdev *sd, int *index)
 	u8 cpl_msb;
 
 	/* Return invalid index if no active input is detected */
-	*index = NUM_PRESETS;
+	*index = NUM_TIMINGS;
 
 	/* Read standards from device registers */
 	tvp7002_read_err(sd, TVP7002_L_FRAME_STAT_LSBS, &lpf_lsb, &error);
@@ -738,23 +738,23 @@ static int tvp7002_query_dv(struct v4l2_subdev *sd, int *index)
 	progressive = (lpf_msb & TVP7002_INPR_MASK) >> TVP7002_IP_SHIFT;
 
 	/* Do checking of video modes */
-	for (*index = 0; *index < NUM_PRESETS; (*index)++, presets++)
-		if (lpfr == presets->lines_per_frame &&
-			progressive == presets->progressive) {
-			if (presets->cpl_min == 0xffff)
+	for (*index = 0; *index < NUM_TIMINGS; (*index)++, timings++)
+		if (lpfr == timings->lines_per_frame &&
+			progressive == timings->progressive) {
+			if (timings->cpl_min == 0xffff)
 				break;
-			if (cpln >= presets->cpl_min && cpln <= presets->cpl_max)
+			if (cpln >= timings->cpl_min && cpln <= timings->cpl_max)
 				break;
 		}
 
-	if (*index == NUM_PRESETS) {
+	if (*index == NUM_TIMINGS) {
 		v4l2_dbg(1, debug, sd, "detection failed: lpf = %x, cpl = %x\n",
 								lpfr, cpln);
 		return -ENOLINK;
 	}
 
 	/* Update lines per frame and clocks per line info */
-	v4l2_dbg(1, debug, sd, "detected preset: %d\n", *index);
+	v4l2_dbg(1, debug, sd, "detected timings: %d\n", *index);
 	return 0;
 }
 
@@ -764,13 +764,13 @@ static int tvp7002_query_dv_preset(struct v4l2_subdev *sd,
 	int index;
 	int err = tvp7002_query_dv(sd, &index);
 
-	if (err || index == NUM_PRESETS) {
+	if (err || index == NUM_TIMINGS) {
 		qpreset->preset = V4L2_DV_INVALID;
 		if (err == -ENOLINK)
 			err = 0;
 		return err;
 	}
-	qpreset->preset = tvp7002_presets[index].preset;
+	qpreset->preset = tvp7002_timings[index].preset;
 	return 0;
 }
 
@@ -782,7 +782,7 @@ static int tvp7002_query_dv_timings(struct v4l2_subdev *sd,
 
 	if (err)
 		return err;
-	*timings = tvp7002_presets[index].timings;
+	*timings = tvp7002_timings[index].timings;
 	return 0;
 }
 
@@ -896,7 +896,7 @@ static int tvp7002_s_stream(struct v4l2_subdev *sd, int enable)
  */
 static int tvp7002_log_status(struct v4l2_subdev *sd)
 {
-	const struct tvp7002_preset_definition *presets = tvp7002_presets;
+	const struct tvp7002_timings_definition *timings = tvp7002_timings;
 	struct tvp7002 *device = to_tvp7002(sd);
 	struct v4l2_dv_enum_preset e_preset;
 	struct v4l2_dv_preset detected;
@@ -907,20 +907,20 @@ static int tvp7002_log_status(struct v4l2_subdev *sd)
 	tvp7002_query_dv_preset(sd, &detected);
 
 	/* Print standard related code values */
-	for (i = 0; i < NUM_PRESETS; i++, presets++)
-		if (presets->preset == detected.preset)
+	for (i = 0; i < NUM_TIMINGS; i++, timings++)
+		if (timings->preset == detected.preset)
 			break;
 
-	if (v4l_fill_dv_preset_info(device->current_preset->preset, &e_preset))
+	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_PRESETS) {
+	if (i == NUM_TIMINGS) {
 		v4l2_info(sd, "Detected DV Preset: None\n");
 	} else {
-		if (v4l_fill_dv_preset_info(presets->preset, &e_preset))
+		if (v4l_fill_dv_preset_info(timings->preset, &e_preset))
 			return -EINVAL;
 		v4l2_info(sd, "Detected DV Preset: %s\n", e_preset.name);
 		v4l2_info(sd, "  Pixels per line: %u\n", e_preset.width);
@@ -946,20 +946,20 @@ static int tvp7002_enum_dv_presets(struct v4l2_subdev *sd,
 		struct v4l2_dv_enum_preset *preset)
 {
 	/* Check requested format index is within range */
-	if (preset->index >= NUM_PRESETS)
+	if (preset->index >= NUM_TIMINGS)
 		return -EINVAL;
 
-	return v4l_fill_dv_preset_info(tvp7002_presets[preset->index].preset, preset);
+	return v4l_fill_dv_preset_info(tvp7002_timings[preset->index].preset, preset);
 }
 
 static int tvp7002_enum_dv_timings(struct v4l2_subdev *sd,
 		struct v4l2_enum_dv_timings *timings)
 {
 	/* Check requested format index is within range */
-	if (timings->index >= NUM_PRESETS)
+	if (timings->index >= NUM_TIMINGS)
 		return -EINVAL;
 
-	timings->timings = tvp7002_presets[timings->index].timings;
+	timings->timings = tvp7002_timings[timings->index].timings;
 	return 0;
 }
 
@@ -1043,7 +1043,7 @@ static int tvp7002_probe(struct i2c_client *c, const struct i2c_device_id *id)
 
 	sd = &device->sd;
 	device->pdata = c->dev.platform_data;
-	device->current_preset = tvp7002_presets;
+	device->current_timings = tvp7002_timings;
 
 	/* Tell v4l2 the device is ready */
 	v4l2_i2c_subdev_init(sd, c, &tvp7002_ops);
@@ -1080,7 +1080,7 @@ static int tvp7002_probe(struct i2c_client *c, const struct i2c_device_id *id)
 		return error;
 
 	/* Set registers according to default video mode */
-	preset.preset = device->current_preset->preset;
+	preset.preset = device->current_timings->preset;
 	error = tvp7002_s_dv_preset(sd, &preset);
 
 	v4l2_ctrl_handler_init(&device->hdl, 1);
Signature · 1 line
1.7.10.4
maintainer Acked-by Lad, Prabhakar on v1 1/18
#35 lore raw

Re: [RFC PATCH 01/18] tvp7002: replace 'preset' by 'timings' in various structs/variables.

Hi Hans,

Quoted 7 lines · Hans Verkuil

From: Hans Verkuil <[email protected]>

This is the first step towards removing the deprecated preset support of this driver.

Regards,
--Prabhakar

Quoted 276 lines
---
 drivers/media/i2c/tvp7002.c |   90 +++++++++++++++++++++----------------------
 1 file changed, 45 insertions(+), 45 deletions(-)
drivers/media/i2c/tvp7002.c +45 -46
index 537f6b4..7995eeb 100644
@@ -326,8 +326,8 @@ static const struct i2c_reg_value tvp7002_parms_720P50[] = {
        { TVP7002_EOR, 0xff, TVP7002_RESERVED }
 };
 
-/* Preset definition for handling device operation */
-struct tvp7002_preset_definition {
+/* Timings definition for handling device operation */
+struct tvp7002_timings_definition {
        u32 preset;
        struct v4l2_dv_timings timings;
        const struct i2c_reg_value *p_settings;
@@ -339,8 +339,8 @@ struct tvp7002_preset_definition {
        u16 cpl_max;
 };
 
-/* Struct list for digital video presets */
-static const struct tvp7002_preset_definition tvp7002_presets[] = {
+/* Struct list for digital video timings */
+static const struct tvp7002_timings_definition tvp7002_timings[] = {
        {
                V4L2_DV_720P60,
                V4L2_DV_BT_CEA_1280X720P60,
@@ -420,7 +420,7 @@ static const struct tvp7002_preset_definition tvp7002_presets[] = {
        }
 };
 
-#define NUM_PRESETS    ARRAY_SIZE(tvp7002_presets)
+#define NUM_TIMINGS ARRAY_SIZE(tvp7002_timings)
 
 /* Device definition */
 struct tvp7002 {
@@ -431,7 +431,7 @@ struct tvp7002 {
        int ver;
        int streaming;
 
-       const struct tvp7002_preset_definition *current_preset;
+       const struct tvp7002_timings_definition *current_timings;
 };
 
 /*
@@ -603,11 +603,11 @@ static int tvp7002_s_dv_preset(struct v4l2_subdev *sd,
        u32 preset;
        int i;
 
-       for (i = 0; i < NUM_PRESETS; i++) {
-               preset = tvp7002_presets[i].preset;
+       for (i = 0; i < NUM_TIMINGS; i++) {
+               preset = tvp7002_timings[i].preset;
                if (preset == dv_preset->preset) {
-                       device->current_preset = &tvp7002_presets[i];
-                       return tvp7002_write_inittab(sd, tvp7002_presets[i].p_settings);
+                       device->current_timings = &tvp7002_timings[i];
+                       return tvp7002_write_inittab(sd, tvp7002_timings[i].p_settings);
                }
        }
 
@@ -623,12 +623,12 @@ static int tvp7002_s_dv_timings(struct v4l2_subdev *sd,
 
        if (dv_timings->type != V4L2_DV_BT_656_1120)
                return -EINVAL;
-       for (i = 0; i < NUM_PRESETS; i++) {
-               const struct v4l2_bt_timings *t = &tvp7002_presets[i].timings.bt;
+       for (i = 0; i < NUM_TIMINGS; i++) {
+               const struct v4l2_bt_timings *t = &tvp7002_timings[i].timings.bt;
 
                if (!memcmp(bt, t, &bt->standards - &bt->width)) {
-                       device->current_preset = &tvp7002_presets[i];
-                       return tvp7002_write_inittab(sd, tvp7002_presets[i].p_settings);
+                       device->current_timings = &tvp7002_timings[i];
+                       return tvp7002_write_inittab(sd, tvp7002_timings[i].p_settings);
                }
        }
        return -EINVAL;
@@ -639,7 +639,7 @@ static int tvp7002_g_dv_timings(struct v4l2_subdev *sd,
 {
        struct tvp7002 *device = to_tvp7002(sd);
 
-       *dv_timings = device->current_preset->timings;
+       *dv_timings = device->current_timings->timings;
        return 0;
 }
 
@@ -681,15 +681,15 @@ static int tvp7002_mbus_fmt(struct v4l2_subdev *sd, struct v4l2_mbus_framefmt *f
        int error;
 
        /* Calculate height and width based on current standard */
-       error = v4l_fill_dv_preset_info(device->current_preset->preset, &e_preset);
+       error = v4l_fill_dv_preset_info(device->current_timings->preset, &e_preset);
        if (error)
                return error;
 
        f->width = e_preset.width;
        f->height = e_preset.height;
        f->code = V4L2_MBUS_FMT_YUYV10_1X20;
-       f->field = device->current_preset->scanmode;
-       f->colorspace = device->current_preset->color_space;
+       f->field = device->current_timings->scanmode;
+       f->colorspace = device->current_timings->color_space;
 
        v4l2_dbg(1, debug, sd, "MBUS_FMT: Width - %d, Height - %d",
                        f->width, f->height);
@@ -697,16 +697,16 @@ static int tvp7002_mbus_fmt(struct v4l2_subdev *sd, struct v4l2_mbus_framefmt *f
 }
 
 /*
- * tvp7002_query_dv_preset() - query DV preset
+ * tvp7002_query_dv() - query DV timings
  * @sd: pointer to standard V4L2 sub-device structure
- * @qpreset: standard V4L2 v4l2_dv_preset structure
+ * @index: index into the tvp7002_timings array
  *
- * Returns the current DV preset by TVP7002. If no active input is
+ * Returns the current DV timings detected by TVP7002. If no active input is
  * detected, returns -EINVAL
  */
 static int tvp7002_query_dv(struct v4l2_subdev *sd, int *index)
 {
-       const struct tvp7002_preset_definition *presets = tvp7002_presets;
+       const struct tvp7002_timings_definition *timings = tvp7002_timings;
        u8 progressive;
        u32 lpfr;
        u32 cpln;
@@ -717,7 +717,7 @@ static int tvp7002_query_dv(struct v4l2_subdev *sd, int *index)
        u8 cpl_msb;
 
        /* Return invalid index if no active input is detected */
-       *index = NUM_PRESETS;
+       *index = NUM_TIMINGS;
 
        /* Read standards from device registers */
        tvp7002_read_err(sd, TVP7002_L_FRAME_STAT_LSBS, &lpf_lsb, &error);
@@ -738,23 +738,23 @@ static int tvp7002_query_dv(struct v4l2_subdev *sd, int *index)
        progressive = (lpf_msb & TVP7002_INPR_MASK) >> TVP7002_IP_SHIFT;
 
        /* Do checking of video modes */
-       for (*index = 0; *index < NUM_PRESETS; (*index)++, presets++)
-               if (lpfr == presets->lines_per_frame &&
-                       progressive == presets->progressive) {
-                       if (presets->cpl_min == 0xffff)
+       for (*index = 0; *index < NUM_TIMINGS; (*index)++, timings++)
+               if (lpfr == timings->lines_per_frame &&
+                       progressive == timings->progressive) {
+                       if (timings->cpl_min == 0xffff)
                                break;
-                       if (cpln >= presets->cpl_min && cpln <= presets->cpl_max)
+                       if (cpln >= timings->cpl_min && cpln <= timings->cpl_max)
                                break;
                }
 
-       if (*index == NUM_PRESETS) {
+       if (*index == NUM_TIMINGS) {
                v4l2_dbg(1, debug, sd, "detection failed: lpf = %x, cpl = %x\n",
                                                                lpfr, cpln);
                return -ENOLINK;
        }
 
        /* Update lines per frame and clocks per line info */
-       v4l2_dbg(1, debug, sd, "detected preset: %d\n", *index);
+       v4l2_dbg(1, debug, sd, "detected timings: %d\n", *index);
        return 0;
 }
 
@@ -764,13 +764,13 @@ static int tvp7002_query_dv_preset(struct v4l2_subdev *sd,
        int index;
        int err = tvp7002_query_dv(sd, &index);
 
-       if (err || index == NUM_PRESETS) {
+       if (err || index == NUM_TIMINGS) {
                qpreset->preset = V4L2_DV_INVALID;
                if (err == -ENOLINK)
                        err = 0;
                return err;
        }
-       qpreset->preset = tvp7002_presets[index].preset;
+       qpreset->preset = tvp7002_timings[index].preset;
        return 0;
 }
 
@@ -782,7 +782,7 @@ static int tvp7002_query_dv_timings(struct v4l2_subdev *sd,
 
        if (err)
                return err;
-       *timings = tvp7002_presets[index].timings;
+       *timings = tvp7002_timings[index].timings;
        return 0;
 }
 
@@ -896,7 +896,7 @@ static int tvp7002_s_stream(struct v4l2_subdev *sd, int enable)
  */
 static int tvp7002_log_status(struct v4l2_subdev *sd)
 {
-       const struct tvp7002_preset_definition *presets = tvp7002_presets;
+       const struct tvp7002_timings_definition *timings = tvp7002_timings;
        struct tvp7002 *device = to_tvp7002(sd);
        struct v4l2_dv_enum_preset e_preset;
        struct v4l2_dv_preset detected;
@@ -907,20 +907,20 @@ static int tvp7002_log_status(struct v4l2_subdev *sd)
        tvp7002_query_dv_preset(sd, &detected);
 
        /* Print standard related code values */
-       for (i = 0; i < NUM_PRESETS; i++, presets++)
-               if (presets->preset == detected.preset)
+       for (i = 0; i < NUM_TIMINGS; i++, timings++)
+               if (timings->preset == detected.preset)
                        break;
 
-       if (v4l_fill_dv_preset_info(device->current_preset->preset, &e_preset))
+       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_PRESETS) {
+       if (i == NUM_TIMINGS) {
                v4l2_info(sd, "Detected DV Preset: None\n");
        } else {
-               if (v4l_fill_dv_preset_info(presets->preset, &e_preset))
+               if (v4l_fill_dv_preset_info(timings->preset, &e_preset))
                        return -EINVAL;
                v4l2_info(sd, "Detected DV Preset: %s\n", e_preset.name);
                v4l2_info(sd, "  Pixels per line: %u\n", e_preset.width);
@@ -946,20 +946,20 @@ static int tvp7002_enum_dv_presets(struct v4l2_subdev *sd,
                struct v4l2_dv_enum_preset *preset)
 {
        /* Check requested format index is within range */
-       if (preset->index >= NUM_PRESETS)
+       if (preset->index >= NUM_TIMINGS)
                return -EINVAL;
 
-       return v4l_fill_dv_preset_info(tvp7002_presets[preset->index].preset, preset);
+       return v4l_fill_dv_preset_info(tvp7002_timings[preset->index].preset, preset);
 }
 
 static int tvp7002_enum_dv_timings(struct v4l2_subdev *sd,
                struct v4l2_enum_dv_timings *timings)
 {
        /* Check requested format index is within range */
-       if (timings->index >= NUM_PRESETS)
+       if (timings->index >= NUM_TIMINGS)
                return -EINVAL;
 
-       timings->timings = tvp7002_presets[timings->index].timings;
+       timings->timings = tvp7002_timings[timings->index].timings;
        return 0;
 }
 
@@ -1043,7 +1043,7 @@ static int tvp7002_probe(struct i2c_client *c, const struct i2c_device_id *id)
 
        sd = &device->sd;
        device->pdata = c->dev.platform_data;
-       device->current_preset = tvp7002_presets;
+       device->current_timings = tvp7002_timings;
 
        /* Tell v4l2 the device is ready */
        v4l2_i2c_subdev_init(sd, c, &tvp7002_ops);
@@ -1080,7 +1080,7 @@ static int tvp7002_probe(struct i2c_client *c, const struct i2c_device_id *id)
                return error;
 
        /* Set registers according to default video mode */
-       preset.preset = device->current_preset->preset;
+       preset.preset = device->current_timings->preset;
        error = tvp7002_s_dv_preset(sd, &preset);
 
        v4l2_ctrl_handler_init(&device->hdl, 1);
--

1.7.10.4