From patchwork Thu Nov 19 16:09:47 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: m-karicheri2@ti.com X-Patchwork-Id: 2122 Return-path: Envelope-to: mchehab@infradead.org Delivery-date: Thu, 19 Nov 2009 16:09:51 +0000 Received: from bombadil.infradead.org [18.85.46.34] by pedra.chehab.org with IMAP (fetchmail-6.3.6) for (single-drop); Thu, 19 Nov 2009 14:10:59 -0200 (BRST) Received: from vger.kernel.org ([209.132.176.167]) by bombadil.infradead.org with esmtp (Exim 4.69 #1 (Red Hat Linux)) id 1NB9Zv-0000bR-42; Thu, 19 Nov 2009 16:09:51 +0000 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757241AbZKSQJn (ORCPT + 1 other); Thu, 19 Nov 2009 11:09:43 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1757298AbZKSQJn (ORCPT ); Thu, 19 Nov 2009 11:09:43 -0500 Received: from devils.ext.ti.com ([198.47.26.153]:47117 "EHLO devils.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757092AbZKSQJm (ORCPT ); Thu, 19 Nov 2009 11:09:42 -0500 Received: from dlep36.itg.ti.com ([157.170.170.91]) by devils.ext.ti.com (8.13.7/8.13.7) with ESMTP id nAJG9mF6006885 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Thu, 19 Nov 2009 10:09:48 -0600 Received: from legion.dal.design.ti.com (localhost [127.0.0.1]) by dlep36.itg.ti.com (8.13.8/8.13.8) with ESMTP id nAJG9mpx011564; Thu, 19 Nov 2009 10:09:48 -0600 (CST) Received: from gt516km11.gt.design.ti.com (gt516km11.gt.design.ti.com [158.218.100.179]) by legion.dal.design.ti.com (8.11.7p1+Sun/8.11.7) with ESMTP id nAJG9lZ03663; Thu, 19 Nov 2009 10:09:48 -0600 (CST) Received: from gt516km11.gt.design.ti.com (localhost.localdomain [127.0.0.1]) by gt516km11.gt.design.ti.com (8.13.1/8.13.1) with ESMTP id nAJG9lEM021540; Thu, 19 Nov 2009 11:09:47 -0500 Received: (from a0868495@localhost) by gt516km11.gt.design.ti.com (8.13.1/8.13.1/Submit) id nAJG9lqS021537; Thu, 19 Nov 2009 11:09:47 -0500 From: m-karicheri2@ti.com To: linux-media@vger.kernel.org, hverkuil@xs4all.nl Cc: davinci-linux-open-source@linux.davincidsp.com, Muralidharan Karicheri Subject: [PATCH] Adding helper function to get dv preset description Date: Thu, 19 Nov 2009 11:09:47 -0500 Message-Id: <1258646987-21515-1-git-send-email-m-karicheri2@ti.com> X-Mailer: git-send-email 1.6.0.4 Signed-off-by: Muralidharan Karicheri Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org From: Muralidharan Karicheri This patch add a helper function to get description of a digital video preset added by the video timing API. Hope this will be usefull for drivers implementing the above API. Signed-off-by: Muralidharan Karicheri NOTE: depends on the patch that adds video timing API. --- Applies to V4L-DVB linux-next branch drivers/media/video/v4l2-common.c | 135 +++++++++++++++++++++++++++++++++++++ include/media/v4l2-common.h | 1 + 2 files changed, 136 insertions(+), 0 deletions(-) diff --git a/drivers/media/video/v4l2-common.c b/drivers/media/video/v4l2-common.c index f5a93ae..245e727 100644 --- a/drivers/media/video/v4l2-common.c +++ b/drivers/media/video/v4l2-common.c @@ -1015,3 +1015,138 @@ 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_enum_preset dv_presets[] = { + { + .preset = V4L2_DV_480P59_94, + .name = "480p@59.94", + .width = 720, + .height = 480, + }, + { + .preset = V4L2_DV_576P50, + .name = "576p@50", + .width = 720, + .height = 576, + }, + { + .preset = V4L2_DV_720P24, + .name = "720p@24", + .width = 1280, + .height = 720, + }, + { + .preset = V4L2_DV_720P25, + .name = "720p@25", + .width = 1280, + .height = 720, + }, + { + .preset = V4L2_DV_720P30, + .name = "720p@30", + .width = 1280, + .height = 720, + }, + { + .preset = V4L2_DV_720P50, + .name = "720p@50", + .width = 1280, + .height = 720, + }, + { + .preset = V4L2_DV_720P59_94, + .name = "720p@59.94", + .width = 1280, + .height = 720, + }, + { + .preset = V4L2_DV_720P60, + .name = "720p@60", + .width = 1280, + .height = 720, + }, + { + .preset = V4L2_DV_1080I29_97, + .name = "1080i@29.97", + .width = 1920, + .height = 1080, + }, + { + .preset = V4L2_DV_1080I30, + .name = "1080i@30", + .width = 1920, + .height = 1080, + }, + { + .preset = V4L2_DV_1080I25, + .name = "1080i@25", + .width = 1920, + .height = 1080, + }, + { + .preset = V4L2_DV_1080I50, + .name = "1080i@50", + .width = 1920, + .height = 1080, + }, + { + .preset = V4L2_DV_1080I60, + .name = "1080i@60", + .width = 1920, + .height = 1080, + }, + { + .preset = V4L2_DV_1080P24, + .name = "1080p@24", + .width = 1920, + .height = 1080, + }, + { + .preset = V4L2_DV_1080P25, + .name = "1080p@25", + .width = 1920, + .height = 1080, + }, + { + .preset = V4L2_DV_1080P30, + .name = "1080p@30", + .width = 1920, + .height = 1080, + }, + { + .preset = V4L2_DV_1080P50, + .name = "1080p@50", + .width = 1920, + .height = 1080, + }, + { + .preset = V4L2_DV_1080P60, + .name = "1080p@60", + .width = 1920, + .height = 1080, + }, + }; + int i; + + if (info == NULL) + return -EINVAL; + + for (i = 0; i < ARRAY_SIZE(dv_presets); i++) { + if (preset == dv_presets[i].preset) { + memcpy(info, &dv_presets[i], sizeof(*info)); + return 0; + } + } + return -EINVAL; +} +EXPORT_SYMBOL_GPL(v4l_fill_dv_preset_info); diff --git a/include/media/v4l2-common.h b/include/media/v4l2-common.h index 1c25b10..ddc040f 100644 --- a/include/media/v4l2-common.h +++ b/include/media/v4l2-common.h @@ -213,4 +213,5 @@ void v4l_bound_align_image(unsigned int *w, unsigned int wmin, unsigned int hmax, unsigned int halign, unsigned int salign); +int v4l_fill_dv_preset_info(u32 preset, struct v4l2_dv_enum_preset *info); #endif /* V4L2_COMMON_H_ */