From patchwork Thu Sep 20 12:06:31 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hans Verkuil X-Patchwork-Id: 1484191 Return-Path: X-Original-To: patchwork-davinci@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from comal.ext.ti.com (comal.ext.ti.com [198.47.26.152]) by patchwork1.kernel.org (Postfix) with ESMTP id 5E12A3FD40 for ; Thu, 20 Sep 2012 12:14:01 +0000 (UTC) Received: from dlelxv30.itg.ti.com ([172.17.2.17]) by comal.ext.ti.com (8.13.7/8.13.7) with ESMTP id q8KCBxag003925; Thu, 20 Sep 2012 07:11:59 -0500 Received: from DLEE74.ent.ti.com (dlee74.ent.ti.com [157.170.170.8]) by dlelxv30.itg.ti.com (8.13.8/8.13.8) with ESMTP id q8KCBxhl019882; Thu, 20 Sep 2012 07:11:59 -0500 Received: from dlelxv24.itg.ti.com (172.17.1.199) by DLEE74.ent.ti.com (157.170.170.8) with Microsoft SMTP Server id 14.1.323.3; Thu, 20 Sep 2012 07:11:58 -0500 Received: from linux.omap.com (dlelxs01.itg.ti.com [157.170.227.31]) by dlelxv24.itg.ti.com (8.13.8/8.13.8) with ESMTP id q8KCBw1k025047; Thu, 20 Sep 2012 07:11:58 -0500 Received: from linux.omap.com (localhost [127.0.0.1]) by linux.omap.com (Postfix) with ESMTP id BAB8980626; Thu, 20 Sep 2012 07:11:58 -0500 (CDT) X-Original-To: davinci-linux-open-source@linux.davincidsp.com Delivered-To: davinci-linux-open-source@linux.davincidsp.com Received: from dflp53.itg.ti.com (dflp53.itg.ti.com [128.247.5.6]) by linux.omap.com (Postfix) with ESMTP id 43EA080628 for ; Thu, 20 Sep 2012 07:07:29 -0500 (CDT) Received: from red.ext.ti.com (red.ext.ti.com [192.94.93.37]) by dflp53.itg.ti.com (8.13.8/8.13.8) with ESMTP id q8KC7Tfl007002 for ; Thu, 20 Sep 2012 07:07:29 -0500 (CDT) Received: from psmtp.com (na3sys009amx216.postini.com [74.125.149.56]) by red.ext.ti.com (8.13.7/8.13.7) with SMTP id q8KC7RFu025352 for ; Thu, 20 Sep 2012 07:07:27 -0500 Received: from smtp-vbr16.xs4all.nl ([194.109.24.36]) by na3sys009amx216.postini.com ([74.125.148.10]) with SMTP; Thu, 20 Sep 2012 05:07:28 PDT Received: from alastor.dyndns.org (166.80-203-20.nextgentel.com [80.203.20.166]) (authenticated bits=0) by smtp-vbr16.xs4all.nl (8.13.8/8.13.8) with ESMTP id q8KC6jfV099988 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=FAIL); Thu, 20 Sep 2012 14:06:46 +0200 (CEST) (envelope-from hverkuil@xs4all.nl) Received: from tschai.lan (tschai.lan [192.168.1.10]) (Authenticated sender: hans) by alastor.dyndns.org (Postfix) with ESMTPSA id E7CC735C014F; Thu, 20 Sep 2012 14:06:39 +0200 (CEST) From: Hans Verkuil To: Subject: [RFCv2 PATCH 12/14] vpif_display: use a v4l2_subdev pointer to call a subdev. Date: Thu, 20 Sep 2012 14:06:31 +0200 Message-ID: <9c002597feebefaaf15bc8e0a570556d23a9bfb1.1348142407.git.hans.verkuil@cisco.com> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <15fd87671d173ae4b943df4114aafb55d7e958fa.1348142407.git.hans.verkuil@cisco.com> References: <15fd87671d173ae4b943df4114aafb55d7e958fa.1348142407.git.hans.verkuil@cisco.com> X-Virus-Scanned: by XS4ALL Virus Scanner X-pstn-levels: (S:89.21744/99.90000 CV:99.9000 FC:95.5390 LC:95.5390 R:95.9108 P:95.9108 M:97.0282 C:98.6951 ) X-pstn-dkim: 0 skipped:not-enabled X-pstn-settings: 2 (0.5000:0.5000) s cv gt3 gt2 gt1 r p m c X-pstn-addresses: from [82/3] CC: Hans Verkuil , DLOS X-BeenThere: davinci-linux-open-source@linux.davincidsp.com X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: Errors-To: davinci-linux-open-source-bounces@linux.davincidsp.com From: Hans Verkuil This makes it easier to have outputs without subdevs. This needs more work. The way the outputs are configured should be identical to how inputs are configured. Signed-off-by: Hans Verkuil --- drivers/media/platform/davinci/vpif_display.c | 17 +++++++++-------- drivers/media/platform/davinci/vpif_display.h | 1 + 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/drivers/media/platform/davinci/vpif_display.c b/drivers/media/platform/davinci/vpif_display.c index 66b4b32..8d1ce09 100644 --- a/drivers/media/platform/davinci/vpif_display.c +++ b/drivers/media/platform/davinci/vpif_display.c @@ -1246,6 +1246,8 @@ static int vpif_s_output(struct file *file, void *priv, unsigned int i) vpif_err("Failed to set output standard\n"); ch->output_idx = i; + if (vpif_obj.sd[i]) + ch->sd = vpif_obj.sd[i]; return ret; } @@ -1317,14 +1319,13 @@ static int vpif_s_dv_timings(struct file *file, void *priv, } /* Configure subdevice timings, if any */ - ret = v4l2_subdev_call(vpif_obj.sd[ch->output_idx], - video, s_dv_timings, timings); + ret = v4l2_subdev_call(ch->sd, video, s_dv_timings, timings); if (ret == -ENOIOCTLCMD) { vpif_dbg(2, debug, "Custom DV timings not supported by " "subdevice\n"); - return -EINVAL; + return -ENODATA; } - if (ret < 0) { + if (ret < 0 && ret != -ENODEV) { vpif_dbg(2, debug, "Error setting custom DV timings\n"); return ret; } @@ -1449,8 +1450,7 @@ static int vpif_dbg_g_register(struct file *file, void *priv, struct vpif_fh *fh = priv; struct channel_obj *ch = fh->channel; - return v4l2_subdev_call(vpif_obj.sd[ch->output_idx], core, - g_register, reg); + return v4l2_subdev_call(ch->sd, core, g_register, reg); } /* @@ -1467,8 +1467,7 @@ static int vpif_dbg_s_register(struct file *file, void *priv, struct vpif_fh *fh = priv; struct channel_obj *ch = fh->channel; - return v4l2_subdev_call(vpif_obj.sd[ch->output_idx], core, - s_register, reg); + return v4l2_subdev_call(ch->sd, core, s_register, reg); } #endif @@ -1737,6 +1736,8 @@ static __init int vpif_probe(struct platform_device *pdev) } ch->initialized = 0; + if (subdev_count) + ch->sd = vpif_obj.sd[0]; ch->channel_id = j; if (j < 2) ch->common[VPIF_VIDEO_INDEX].numbuffers = diff --git a/drivers/media/platform/davinci/vpif_display.h b/drivers/media/platform/davinci/vpif_display.h index 805704c..dca2a8c0 100644 --- a/drivers/media/platform/davinci/vpif_display.h +++ b/drivers/media/platform/davinci/vpif_display.h @@ -125,6 +125,7 @@ struct channel_obj { u8 initialized; /* flag to indicate whether * encoder is initialized */ u32 output_idx; /* Current output index */ + struct v4l2_subdev *sd; /* Current output subdev (may be NULL) */ enum vpif_channel_id channel_id;/* Identifies channel */ struct vpif_params vpifparams;