From patchwork Thu Jun 28 16:20:42 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marco Felsch X-Patchwork-Id: 10494405 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 7C0F9603EE for ; Thu, 28 Jun 2018 16:21:38 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1ACF02A4B3 for ; Thu, 28 Jun 2018 16:21:38 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0DEEF2A4BA; Thu, 28 Jun 2018 16:21:38 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A9F8A2A4B3 for ; Thu, 28 Jun 2018 16:21:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S967290AbeF1QVe (ORCPT ); Thu, 28 Jun 2018 12:21:34 -0400 Received: from metis.ext.pengutronix.de ([85.220.165.71]:59887 "EHLO metis.ext.pengutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753661AbeF1QVY (ORCPT ); Thu, 28 Jun 2018 12:21:24 -0400 Received: from dude.hi.pengutronix.de ([2001:67c:670:100:1d::7]) by metis.ext.pengutronix.de with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1fYZfV-0004pA-Dl; Thu, 28 Jun 2018 18:21:13 +0200 Received: from mfe by dude.hi.pengutronix.de with local (Exim 4.91) (envelope-from ) id 1fYZfQ-0007Fe-MY; Thu, 28 Jun 2018 18:21:08 +0200 From: Marco Felsch To: mchehab@kernel.org, robh+dt@kernel.org, mark.rutland@arm.com Cc: p.zabel@pengutronix.de, afshin.nasser@gmail.com, javierm@redhat.com, sakari.ailus@linux.intel.com, laurent.pinchart@ideasonboard.com, linux-media@vger.kernel.org, devicetree@vger.kernel.org, kernel@pengutronix.de Subject: [PATCH 10/22] [media] tvp5150: split reset/enable routine Date: Thu, 28 Jun 2018 18:20:42 +0200 Message-Id: <20180628162054.25613-11-m.felsch@pengutronix.de> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180628162054.25613-1-m.felsch@pengutronix.de> References: <20180628162054.25613-1-m.felsch@pengutronix.de> X-SA-Exim-Connect-IP: 2001:67c:670:100:1d::7 X-SA-Exim-Mail-From: mfe@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-Virus-Scanned: ClamAV using ClamSMTP From: Philipp Zabel To trigger standard autodetection only the reset part of the routine is necessary during probe(). Split this out to make it callable on its own. Signed-off-by: Philipp Zabel [m.felsch@pengutronix.de: adapt commit message] [m.felsch@pengutronix.de: add tvp5150_enable() to tvp5150_s_stream()] Signed-off-by: Marco Felsch --- drivers/media/i2c/tvp5150.c | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/drivers/media/i2c/tvp5150.c b/drivers/media/i2c/tvp5150.c index 895bc2bfb1d1..284694c21556 100644 --- a/drivers/media/i2c/tvp5150.c +++ b/drivers/media/i2c/tvp5150.c @@ -796,9 +796,6 @@ static v4l2_std_id tvp5150_read_std(struct v4l2_subdev *sd) static int tvp5150_reset(struct v4l2_subdev *sd, u32 val) { - struct tvp5150 *decoder = to_tvp5150(sd); - v4l2_std_id std; - /* Initializes TVP5150 to its default values */ tvp5150_write_inittab(sd, tvp5150_init_default); @@ -808,12 +805,20 @@ static int tvp5150_reset(struct v4l2_subdev *sd, u32 val) /* Selects decoder input */ tvp5150_selmux(sd); - /* Initializes TVP5150 to stream enabled values */ - tvp5150_write_inittab(sd, tvp5150_init_enable); - /* Initialize image preferences */ v4l2_ctrl_handler_setup(&decoder->hdl); + return 0; +} + +static int tvp5150_enable(struct v4l2_subdev *sd) +{ + struct tvp5150 *decoder = to_tvp5150(sd); + v4l2_std_id std; + + /* Initializes TVP5150 to stream enabled values */ + tvp5150_write_inittab(sd, tvp5150_init_enable); + if (decoder->norm == V4L2_STD_ALL) std = tvp5150_read_std(sd); else @@ -1138,6 +1143,8 @@ static int tvp5150_s_stream(struct v4l2_subdev *sd, int enable) TVP5150_MISC_CTL_CLOCK_OE; if (enable) { + tvp5150_enable(sd); + /* * Enable the YCbCr and clock outputs. In discrete sync mode * (non-BT.656) additionally enable the the sync outputs.