From patchwork Tue Sep 22 14:27:28 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Prashant Laddha X-Patchwork-Id: 7239481 Return-Path: X-Original-To: patchwork-linux-media@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 94A38BEEC1 for ; Tue, 22 Sep 2015 14:27:40 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id C6120207EB for ; Tue, 22 Sep 2015 14:27:39 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 461F0207EF for ; Tue, 22 Sep 2015 14:27:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757841AbbIVO1g (ORCPT ); Tue, 22 Sep 2015 10:27:36 -0400 Received: from bgl-iport-2.cisco.com ([72.163.197.26]:12077 "EHLO bgl-iport-2.cisco.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756816AbbIVO1e (ORCPT ); Tue, 22 Sep 2015 10:27:34 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=cisco.com; i=@cisco.com; l=2216; q=dns/txt; s=iport; t=1442932055; x=1444141655; h=from:to:cc:subject:date:message-id:in-reply-to: references; bh=2qFRURFUGnueLIT63oSs8jH31Nwu81YzKbwnn8ND2dw=; b=YXfZf/xXI6Yzla/ShH2rKoc1tq4Qtz7Y28T1n6zYNGN0XWZHWgFcYDCk dCuwKEqQH0PCtpaXOOBLwYsAM7fTAqezqWn2YainiyWZs/ftL+zvN8Bax LCsf6x8JL8degtfYlV39ucU6V1huPcXbbq8cfF9ectrNylAAY7OBwPY7X c=; X-IronPort-AV: E=Sophos;i="5.17,573,1437436800"; d="scan'208";a="55316522" Received: from vla196-nat.cisco.com (HELO bgl-core-3.cisco.com) ([72.163.197.24]) by bgl-iport-2.cisco.com with ESMTP; 22 Sep 2015 14:27:32 +0000 Received: from pla-VB.cisco.com ([173.39.30.135]) by bgl-core-3.cisco.com (8.14.5/8.14.5) with ESMTP id t8MERVxi031427; Tue, 22 Sep 2015 14:27:31 GMT From: Prashant Laddha To: linux-media@vger.kernel.org Cc: Hans Verkuil , Prashant Laddha Subject: [RFC v2 1/4] v4l2-dv-timings: add condition checks for reduced fps Date: Tue, 22 Sep 2015 19:57:28 +0530 Message-Id: <1442932051-24972-2-git-send-email-prladdha@cisco.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1442932051-24972-1-git-send-email-prladdha@cisco.com> References: <1442932051-24972-1-git-send-email-prladdha@cisco.com> Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Spam-Status: No, score=-14.5 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY, USER_IN_DEF_DKIM_WL autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Added a helper function to check necessary conditions required for reduced fps. The reduced fps is supported for CVT and CEA861 timings. CVT supports reduced fps only if reduced blanking v2 (indicated by vsync = 8) is true. Whereas CEA861 supports reduced fps if V4L2_DV_FL_CAN_REDUCE_FPS flag is true. Cc: Hans Verkuil Signed-off-by: Prashant Laddha --- drivers/media/v4l2-core/v4l2-dv-timings.c | 5 +++++ include/media/v4l2-dv-timings.h | 21 +++++++++++++++++++++ 2 files changed, 26 insertions(+) diff --git a/drivers/media/v4l2-core/v4l2-dv-timings.c b/drivers/media/v4l2-core/v4l2-dv-timings.c index 6a83d61..d8e62f6 100644 --- a/drivers/media/v4l2-core/v4l2-dv-timings.c +++ b/drivers/media/v4l2-core/v4l2-dv-timings.c @@ -210,7 +210,12 @@ bool v4l2_find_dv_timings_cap(struct v4l2_dv_timings *t, fnc, fnc_handle) && v4l2_match_dv_timings(t, v4l2_dv_timings_presets + i, pclock_delta)) { + u32 flags = t->bt.flags & V4L2_DV_FL_REDUCED_FPS; + *t = v4l2_dv_timings_presets[i]; + if (can_reduce_fps(&t->bt)) + t->bt.flags |= flags; + return true; } } diff --git a/include/media/v4l2-dv-timings.h b/include/media/v4l2-dv-timings.h index b6130b5..49c2328 100644 --- a/include/media/v4l2-dv-timings.h +++ b/include/media/v4l2-dv-timings.h @@ -183,4 +183,25 @@ bool v4l2_detect_gtf(unsigned frame_height, unsigned hfreq, unsigned vsync, */ struct v4l2_fract v4l2_calc_aspect_ratio(u8 hor_landscape, u8 vert_portrait); +/* + * reduce_fps - check if conditions for reduced fps are true. + * bt - v4l2 timing structure + * For different timings reduced fps is allowed if following conditions + * are met - + * For CVT timings: if reduced blanking v2 (vsync == 8) is true. + * For CEA861 timings: if V4L2_DV_FL_CAN_REDUCE_FPS flag is true. + */ +static inline bool can_reduce_fps(struct v4l2_bt_timings *bt) +{ + if ((bt->standards & V4L2_DV_BT_STD_CVT) && (bt->vsync == 8)) + return true; + + if ((bt->standards & V4L2_DV_BT_STD_CEA861) && + (bt->flags & V4L2_DV_FL_CAN_REDUCE_FPS)) + return true; + + return false; +} + + #endif