From patchwork Tue Sep 18 10:53:12 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hans Verkuil X-Patchwork-Id: 1528021 Return-Path: X-Original-To: patchwork-davinci@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from bear.ext.ti.com (bear.ext.ti.com [192.94.94.41]) by patchwork1.kernel.org (Postfix) with ESMTP id 961F93FE80 for ; Sat, 29 Sep 2012 06:52:06 +0000 (UTC) Received: from dlelxv30.itg.ti.com ([172.17.2.17]) by bear.ext.ti.com (8.13.7/8.13.7) with ESMTP id q8T6q5iV021125 for ; Sat, 29 Sep 2012 01:52:05 -0500 Received: from DFLE73.ent.ti.com (dfle73.ent.ti.com [128.247.5.110]) by dlelxv30.itg.ti.com (8.13.8/8.13.8) with ESMTP id q8T6q54Z011962 for ; Sat, 29 Sep 2012 01:52:05 -0500 Received: from dlelxv23.itg.ti.com (172.17.1.198) by dfle73.ent.ti.com (128.247.5.110) with Microsoft SMTP Server id 14.1.323.3; Sat, 29 Sep 2012 01:52:05 -0500 Received: from linux.omap.com (dlelxs01.itg.ti.com [157.170.227.31]) by dlelxv23.itg.ti.com (8.13.8/8.13.8) with ESMTP id q8T6q5sW011733 for ; Sat, 29 Sep 2012 01:52:05 -0500 Received: from linux.omap.com (localhost [127.0.0.1]) by linux.omap.com (Postfix) with ESMTP id 9BD618062A for ; Sat, 29 Sep 2012 01:52:05 -0500 (CDT) X-Original-To: davinci-linux-open-source@linux.davincidsp.com Delivered-To: davinci-linux-open-source@linux.davincidsp.com Received: from dflp52.itg.ti.com (dflp52.itg.ti.com [128.247.22.96]) by linux.omap.com (Postfix) with ESMTP id 5E8B580626 for ; Tue, 18 Sep 2012 05:53:32 -0500 (CDT) Received: from medina.ext.ti.com (medina.ext.ti.com [192.91.81.31]) by dflp52.itg.ti.com (8.13.7/8.13.8) with ESMTP id q8IArWTY009367 for ; Tue, 18 Sep 2012 05:53:32 -0500 (CDT) Received: from psmtp.com (na3sys009amx226.postini.com [74.125.149.110]) by medina.ext.ti.com (8.13.7/8.13.7) with SMTP id q8IArUQ3001763 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Tue, 18 Sep 2012 05:53:31 -0500 Received: from ams-iport-3.cisco.com ([144.254.224.146]) (using TLSv1) by na3sys009amx226.postini.com ([74.125.148.10]) with SMTP; Tue, 18 Sep 2012 10:53:31 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=cisco.com; i=@cisco.com; l=2947; q=dns/txt; s=iport; t=1347965611; x=1349175211; h=from:to:cc:subject:date:message-id; bh=LYQnu4V+krtZrUAIkS4Jsqvv2GFI/+IoqwPfn2PsowU=; b=gTgSaVOLcHSVnMv4AYcVBNh/3b1HtQfrXMqI6jZkVn/p7JdPLHaY4yAu ZIcpjYp+jQlzOyeLB+/MLLvqMAWNVI8aN1mgICGegqDOZRIIa7lRcf+Zz NwcYxLRuh+iBdOIhdU0ZREEmifbiN7nHhqP2oMTjAio8Uqh+L1VNSOQIU 0=; X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Av0EALJRWFCQ/khR/2dsb2JhbABFvDOBB4IhAQEEEgEUUhBRVxkih16aIqA1jmqDHwOVYok1hQOBaYJo X-IronPort-AV: E=Sophos;i="4.80,442,1344211200"; d="scan'208";a="8120099" Received: from ams-core-1.cisco.com ([144.254.72.81]) by ams-iport-3.cisco.com with ESMTP; 18 Sep 2012 10:53:29 +0000 Received: from cobaltpc1.cisco.com (dhcp-10-54-92-107.cisco.com [10.54.92.107]) by ams-core-1.cisco.com (8.14.5/8.14.5) with ESMTP id q8IArQ4Y012350; Tue, 18 Sep 2012 10:53:29 GMT From: Hans Verkuil To: Subject: [RFCv1 PATCH 10/11] vpif_display: use a v4l2_subdev pointer to call a subdev. Date: Tue, 18 Sep 2012 12:53:12 +0200 Message-ID: <65a795e86372648bb126c35048b749a9be1c68ad.1347965140.git.hans.verkuil@cisco.com> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: References: X-pstn-neptune: 0/0/0.00/0 X-pstn-levels: (S:99.90000/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: 1 skipped:not-enabled X-pstn-settings: 2 (0.5000:0.0003) s cv gt3 GT2 gt1 r p m c X-pstn-addresses: from [82/3] X-Mailman-Approved-At: Sat, 29 Sep 2012 01:48:44 -0500 CC: 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+patchwork-davinci=patchwork.kernel.org@linux.davincidsp.com 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/video/davinci/vpif_display.c | 17 +++++++++-------- drivers/media/video/davinci/vpif_display.h | 1 + 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/drivers/media/video/davinci/vpif_display.c b/drivers/media/video/davinci/vpif_display.c index a6e8ddd..5f1d736 100644 --- a/drivers/media/video/davinci/vpif_display.c +++ b/drivers/media/video/davinci/vpif_display.c @@ -1232,6 +1232,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; } @@ -1302,14 +1304,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; } @@ -1434,8 +1435,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); } /* @@ -1452,8 +1452,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 @@ -1721,6 +1720,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/video/davinci/vpif_display.h b/drivers/media/video/davinci/vpif_display.h index b602def..1e436ac 100644 --- a/drivers/media/video/davinci/vpif_display.h +++ b/drivers/media/video/davinci/vpif_display.h @@ -126,6 +126,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;