From patchwork Wed Nov 18 16:55:25 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lucas Stach X-Patchwork-Id: 7651011 Return-Path: X-Original-To: patchwork-linux-media@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 641D09F6E4 for ; Wed, 18 Nov 2015 16:55:48 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 6328920426 for ; Wed, 18 Nov 2015 16:55:46 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id CF8E020636 for ; Wed, 18 Nov 2015 16:55:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933253AbbKRQzd (ORCPT ); Wed, 18 Nov 2015 11:55:33 -0500 Received: from metis.ext.4.pengutronix.de ([92.198.50.35]:50551 "EHLO metis.ext.pengutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933207AbbKRQza (ORCPT ); Wed, 18 Nov 2015 11:55:30 -0500 Received: from dude.hi.4.pengutronix.de ([10.1.0.7] helo=dude.pengutronix.de.) by metis.ext.pengutronix.de with esmtp (Exim 4.80) (envelope-from ) id 1Zz612-0007Sk-PN; Wed, 18 Nov 2015 17:55:28 +0100 From: Lucas Stach To: Mauro Carvalho Chehab , linux-media@vger.kernel.org Cc: kernel@pengutronix.de, patchwork-lst@pengutronix.de Subject: [PATCH 6/9] [media] tvp5150: trigger autodetection on subdev open to reset cropping Date: Wed, 18 Nov 2015 17:55:25 +0100 Message-Id: <1447865728-5726-6-git-send-email-l.stach@pengutronix.de> X-Mailer: git-send-email 2.6.2 In-Reply-To: <1447865728-5726-1-git-send-email-l.stach@pengutronix.de> References: <1447865728-5726-1-git-send-email-l.stach@pengutronix.de> X-SA-Exim-Connect-IP: 10.1.0.7 X-SA-Exim-Mail-From: l.stach@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-media@vger.kernel.org Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Spam-Status: No, score=-7.5 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY 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 From: Philipp Zabel If cropping isn't set explicitly by userspace, reset it to the maximum possible rectangle in subdevice open if a standard change is detected. Signed-off-by: Philipp Zabel Signed-off-by: Lucas Stach --- drivers/media/i2c/tvp5150.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/drivers/media/i2c/tvp5150.c b/drivers/media/i2c/tvp5150.c index b6328353404f..791572737ee3 100644 --- a/drivers/media/i2c/tvp5150.c +++ b/drivers/media/i2c/tvp5150.c @@ -46,6 +46,7 @@ struct tvp5150 { struct regmap *regmap; v4l2_std_id norm; /* Current set standard */ + v4l2_std_id detected_norm; u32 input; u32 output; int enable; @@ -1206,13 +1207,19 @@ static int tvp5150_open(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh) struct tvp5150 *decoder = to_tvp5150(sd); v4l2_std_id std; - if (decoder->norm == V4L2_STD_ALL) + if (decoder->norm == V4L2_STD_ALL) { std = tvp5150_read_std(sd); - else - std = decoder->norm; + if (std != decoder->detected_norm) { + decoder->detected_norm = std; + + if (std & V4L2_STD_525_60) + decoder->rect.height = TVP5150_V_MAX_525_60; + else + decoder->rect.height = TVP5150_V_MAX_OTHERS; + decoder->format.height = decoder->rect.height; + } + } - tvp5150_set_default(std, v4l2_subdev_get_try_crop(fh, 0), - v4l2_subdev_get_try_format(fh, 0)); return 0; } @@ -1420,6 +1427,7 @@ static int tvp5150_probe(struct i2c_client *c, } core->norm = V4L2_STD_ALL; /* Default is autodetect */ + core->detected_norm = V4L2_STD_UNKNOWN; core->input = TVP5150_COMPOSITE1; core->enable = 1;