diff options
author | Mats Randgaard <mats.randgaard@cisco.com> | 2010-12-16 10:17:42 -0500 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2011-01-19 08:28:15 -0500 |
commit | aa4444063505983c5971bc8fb832385dfba16b41 (patch) | |
tree | 6c9e1642c9350a6395d72755a290c475407aeeff /drivers/media | |
parent | 7036d6a73c88428764e4a12f30846279346f4382 (diff) |
[media] vpif: Consolidate formats from capture and display
- The ch_params tables in vpif_capture.c and vpif_display.c are moved to a common
table in vpif.c. Then it is easier to maintain the table.
- The field "fps" is removed from the struct vpif_channel_config_params because it
is not used.
Signed-off-by: Mats Randgaard <mats.randgaard@cisco.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Acked-by : Murali Karicheri <mkaricheri@gmail.com>
Acked-by: Manjunath Hadli <manjunath.hadli@ti.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media')
-rw-r--r-- | drivers/media/video/davinci/vpif.c | 50 | ||||
-rw-r--r-- | drivers/media/video/davinci/vpif.h | 4 | ||||
-rw-r--r-- | drivers/media/video/davinci/vpif_capture.c | 18 | ||||
-rw-r--r-- | drivers/media/video/davinci/vpif_display.c | 17 |
4 files changed, 58 insertions, 31 deletions
diff --git a/drivers/media/video/davinci/vpif.c b/drivers/media/video/davinci/vpif.c index 1f532e31cd49..54cc0dadd755 100644 --- a/drivers/media/video/davinci/vpif.c +++ b/drivers/media/video/davinci/vpif.c | |||
@@ -41,6 +41,56 @@ spinlock_t vpif_lock; | |||
41 | 41 | ||
42 | void __iomem *vpif_base; | 42 | void __iomem *vpif_base; |
43 | 43 | ||
44 | /** | ||
45 | * ch_params: video standard configuration parameters for vpif | ||
46 | * The table must include all presets from supported subdevices. | ||
47 | */ | ||
48 | const struct vpif_channel_config_params ch_params[] = { | ||
49 | /* SDTV formats */ | ||
50 | { | ||
51 | .name = "NTSC_M", | ||
52 | .width = 720, | ||
53 | .height = 480, | ||
54 | .frm_fmt = 0, | ||
55 | .ycmux_mode = 1, | ||
56 | .eav2sav = 268, | ||
57 | .sav2eav = 1440, | ||
58 | .l1 = 1, | ||
59 | .l3 = 23, | ||
60 | .l5 = 263, | ||
61 | .l7 = 266, | ||
62 | .l9 = 286, | ||
63 | .l11 = 525, | ||
64 | .vsize = 525, | ||
65 | .capture_format = 0, | ||
66 | .vbi_supported = 1, | ||
67 | .hd_sd = 0, | ||
68 | .stdid = V4L2_STD_525_60, | ||
69 | }, | ||
70 | { | ||
71 | .name = "PAL_BDGHIK", | ||
72 | .width = 720, | ||
73 | .height = 576, | ||
74 | .frm_fmt = 0, | ||
75 | .ycmux_mode = 1, | ||
76 | .eav2sav = 280, | ||
77 | .sav2eav = 1440, | ||
78 | .l1 = 1, | ||
79 | .l3 = 23, | ||
80 | .l5 = 311, | ||
81 | .l7 = 313, | ||
82 | .l9 = 336, | ||
83 | .l11 = 624, | ||
84 | .vsize = 625, | ||
85 | .capture_format = 0, | ||
86 | .vbi_supported = 1, | ||
87 | .hd_sd = 0, | ||
88 | .stdid = V4L2_STD_625_50, | ||
89 | }, | ||
90 | }; | ||
91 | |||
92 | const unsigned int vpif_ch_params_count = ARRAY_SIZE(ch_params); | ||
93 | |||
44 | static inline void vpif_wr_bit(u32 reg, u32 bit, u32 val) | 94 | static inline void vpif_wr_bit(u32 reg, u32 bit, u32 val) |
45 | { | 95 | { |
46 | if (val) | 96 | if (val) |
diff --git a/drivers/media/video/davinci/vpif.h b/drivers/media/video/davinci/vpif.h index ebd5c4338ebb..d14e36e5c90d 100644 --- a/drivers/media/video/davinci/vpif.h +++ b/drivers/media/video/davinci/vpif.h | |||
@@ -577,7 +577,6 @@ struct vpif_channel_config_params { | |||
577 | char name[VPIF_MAX_NAME]; /* Name of the mode */ | 577 | char name[VPIF_MAX_NAME]; /* Name of the mode */ |
578 | u16 width; /* Indicates width of the image */ | 578 | u16 width; /* Indicates width of the image */ |
579 | u16 height; /* Indicates height of the image */ | 579 | u16 height; /* Indicates height of the image */ |
580 | u8 fps; | ||
581 | u8 frm_fmt; /* Indicates whether this is interlaced | 580 | u8 frm_fmt; /* Indicates whether this is interlaced |
582 | * or progressive format */ | 581 | * or progressive format */ |
583 | u8 ycmux_mode; /* Indicates whether this mode requires | 582 | u8 ycmux_mode; /* Indicates whether this mode requires |
@@ -594,6 +593,9 @@ struct vpif_channel_config_params { | |||
594 | v4l2_std_id stdid; | 593 | v4l2_std_id stdid; |
595 | }; | 594 | }; |
596 | 595 | ||
596 | extern const unsigned int vpif_ch_params_count; | ||
597 | extern const struct vpif_channel_config_params ch_params[]; | ||
598 | |||
597 | struct vpif_video_params; | 599 | struct vpif_video_params; |
598 | struct vpif_params; | 600 | struct vpif_params; |
599 | struct vpif_vbi_params; | 601 | struct vpif_vbi_params; |
diff --git a/drivers/media/video/davinci/vpif_capture.c b/drivers/media/video/davinci/vpif_capture.c index 9446dbc476fd..0a7ebb0e151a 100644 --- a/drivers/media/video/davinci/vpif_capture.c +++ b/drivers/media/video/davinci/vpif_capture.c | |||
@@ -82,20 +82,6 @@ static struct vpif_device vpif_obj = { {NULL} }; | |||
82 | static struct device *vpif_dev; | 82 | static struct device *vpif_dev; |
83 | 83 | ||
84 | /** | 84 | /** |
85 | * ch_params: video standard configuration parameters for vpif | ||
86 | */ | ||
87 | static const struct vpif_channel_config_params ch_params[] = { | ||
88 | { | ||
89 | "NTSC_M", 720, 480, 30, 0, 1, 268, 1440, 1, 23, 263, 266, | ||
90 | 286, 525, 525, 0, 1, 0, V4L2_STD_525_60, | ||
91 | }, | ||
92 | { | ||
93 | "PAL_BDGHIK", 720, 576, 25, 0, 1, 280, 1440, 1, 23, 311, 313, | ||
94 | 336, 624, 625, 0, 1, 0, V4L2_STD_625_50, | ||
95 | }, | ||
96 | }; | ||
97 | |||
98 | /** | ||
99 | * vpif_uservirt_to_phys : translate user/virtual address to phy address | 85 | * vpif_uservirt_to_phys : translate user/virtual address to phy address |
100 | * @virtp: user/virtual address | 86 | * @virtp: user/virtual address |
101 | * | 87 | * |
@@ -444,7 +430,7 @@ static int vpif_update_std_info(struct channel_obj *ch) | |||
444 | 430 | ||
445 | std_info = &vpifparams->std_info; | 431 | std_info = &vpifparams->std_info; |
446 | 432 | ||
447 | for (index = 0; index < ARRAY_SIZE(ch_params); index++) { | 433 | for (index = 0; index < vpif_ch_params_count; index++) { |
448 | config = &ch_params[index]; | 434 | config = &ch_params[index]; |
449 | if (config->stdid & vid_ch->stdid) { | 435 | if (config->stdid & vid_ch->stdid) { |
450 | memcpy(std_info, config, sizeof(*config)); | 436 | memcpy(std_info, config, sizeof(*config)); |
@@ -453,7 +439,7 @@ static int vpif_update_std_info(struct channel_obj *ch) | |||
453 | } | 439 | } |
454 | 440 | ||
455 | /* standard not found */ | 441 | /* standard not found */ |
456 | if (index == ARRAY_SIZE(ch_params)) | 442 | if (index == vpif_ch_params_count) |
457 | return -EINVAL; | 443 | return -EINVAL; |
458 | 444 | ||
459 | common->fmt.fmt.pix.width = std_info->width; | 445 | common->fmt.fmt.pix.width = std_info->width; |
diff --git a/drivers/media/video/davinci/vpif_display.c b/drivers/media/video/davinci/vpif_display.c index 2d55e3e86a84..9de0062eca59 100644 --- a/drivers/media/video/davinci/vpif_display.c +++ b/drivers/media/video/davinci/vpif_display.c | |||
@@ -85,17 +85,6 @@ static struct vpif_config_params config_params = { | |||
85 | static struct vpif_device vpif_obj = { {NULL} }; | 85 | static struct vpif_device vpif_obj = { {NULL} }; |
86 | static struct device *vpif_dev; | 86 | static struct device *vpif_dev; |
87 | 87 | ||
88 | static const struct vpif_channel_config_params ch_params[] = { | ||
89 | { | ||
90 | "NTSC", 720, 480, 30, 0, 1, 268, 1440, 1, 23, 263, 266, | ||
91 | 286, 525, 525, 0, 1, 0, V4L2_STD_525_60, | ||
92 | }, | ||
93 | { | ||
94 | "PAL", 720, 576, 25, 0, 1, 280, 1440, 1, 23, 311, 313, | ||
95 | 336, 624, 625, 0, 1, 0, V4L2_STD_625_50, | ||
96 | }, | ||
97 | }; | ||
98 | |||
99 | /* | 88 | /* |
100 | * vpif_uservirt_to_phys: This function is used to convert user | 89 | * vpif_uservirt_to_phys: This function is used to convert user |
101 | * space virtual address to physical address. | 90 | * space virtual address to physical address. |
@@ -388,7 +377,7 @@ static int vpif_get_std_info(struct channel_obj *ch) | |||
388 | if (!std_info->stdid) | 377 | if (!std_info->stdid) |
389 | return -1; | 378 | return -1; |
390 | 379 | ||
391 | for (index = 0; index < ARRAY_SIZE(ch_params); index++) { | 380 | for (index = 0; index < vpif_ch_params_count; index++) { |
392 | config = &ch_params[index]; | 381 | config = &ch_params[index]; |
393 | if (config->stdid & std_info->stdid) { | 382 | if (config->stdid & std_info->stdid) { |
394 | memcpy(std_info, config, sizeof(*config)); | 383 | memcpy(std_info, config, sizeof(*config)); |
@@ -396,8 +385,8 @@ static int vpif_get_std_info(struct channel_obj *ch) | |||
396 | } | 385 | } |
397 | } | 386 | } |
398 | 387 | ||
399 | if (index == ARRAY_SIZE(ch_params)) | 388 | if (index == vpif_ch_params_count) |
400 | return -1; | 389 | return -EINVAL; |
401 | 390 | ||
402 | common->fmt.fmt.pix.width = std_info->width; | 391 | common->fmt.fmt.pix.width = std_info->width; |
403 | common->fmt.fmt.pix.height = std_info->height; | 392 | common->fmt.fmt.pix.height = std_info->height; |