From patchwork Fri Mar 15 21:27:52 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Guennadi Liakhovetski X-Patchwork-Id: 2280871 Return-Path: X-Original-To: patchwork-linux-sh@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id 3A051DFE86 for ; Fri, 15 Mar 2013 21:28:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932599Ab3COV2I (ORCPT ); Fri, 15 Mar 2013 17:28:08 -0400 Received: from moutng.kundenserver.de ([212.227.126.187]:55473 "EHLO moutng.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932531Ab3COV2G (ORCPT ); Fri, 15 Mar 2013 17:28:06 -0400 Received: from axis700.grange (dslb-188-109-038-234.pools.arcor-ip.net [188.109.38.234]) by mrelayeu.kundenserver.de (node=mrbap0) with ESMTP (Nemesis) id 0LiWxY-1UszKJ1peO-00cf15; Fri, 15 Mar 2013 22:28:03 +0100 Received: from 6a.grange (6a.grange [192.168.1.11]) by axis700.grange (Postfix) with ESMTPS id 1634E40BB8; Fri, 15 Mar 2013 22:28:00 +0100 (CET) Received: from lyakh by 6a.grange with local (Exim 4.72) (envelope-from ) id 1UGcAS-0005EY-IS; Fri, 15 Mar 2013 22:28:00 +0100 From: Guennadi Liakhovetski To: linux-media@vger.kernel.org Cc: Laurent Pinchart , Hans Verkuil , Sylwester Nawrocki , Sylwester Nawrocki , linux-sh@vger.kernel.org, Magnus Damm , Sakari Ailus , Prabhakar Lad , Guennadi Liakhovetski Subject: [PATCH v6 6/7] imx074: support asynchronous probing Date: Fri, 15 Mar 2013 22:27:52 +0100 Message-Id: <1363382873-20077-7-git-send-email-g.liakhovetski@gmx.de> X-Mailer: git-send-email 1.7.2.5 In-Reply-To: <1363382873-20077-1-git-send-email-g.liakhovetski@gmx.de> References: <1363382873-20077-1-git-send-email-g.liakhovetski@gmx.de> X-Provags-ID: V02:K0:Tw7kL2pcfN84C+U0ge/Q++qC+4D9jrmsi82RxQljNGi YixJWA9NN93I1UK5adkG4BLQHTFv3ybpZthZS3xastagEtNm3S KDWjUcU7L/RfiTMsrZu25JSIbcXKtZfyw2gJDtZ5iN4I7hmVGM XCW/noNzascpFqJ4GCVCtQNxkaUzC/VuiV+1+m7ppzzKirAg8O M3O4gPbpC8LMvxvJxg9p8XmJN+GtABHgygMymVE5RRYebqntLA 9zfOq+YVXUnb07I0lbCTFtTOVtWWu2XlFkwcZFnHmH0tVtUUDB FPXMoS9sEMDVsI0gHASBOa7QI7DZjcqIEbPoNiAInUzjTXRW8D NYDu7+CHo5Hnr3fOHb+XrGWdFzvKWqM2iT/29DFH5bK/ngp6py Fri+ZyvefDoUw== Sender: linux-sh-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-sh@vger.kernel.org Both synchronous and asynchronous imx074 subdevice probing is supported by this patch. Signed-off-by: Guennadi Liakhovetski --- v6: update to new v4l2-async API, use soc_camera_power_init() drivers/media/i2c/soc_camera/imx074.c | 24 +++++++++++++++++++++--- 1 files changed, 21 insertions(+), 3 deletions(-) diff --git a/drivers/media/i2c/soc_camera/imx074.c b/drivers/media/i2c/soc_camera/imx074.c index cee5345..74a5c3a 100644 --- a/drivers/media/i2c/soc_camera/imx074.c +++ b/drivers/media/i2c/soc_camera/imx074.c @@ -18,6 +18,7 @@ #include #include +#include #include #include #include @@ -79,6 +80,7 @@ struct imx074 { struct v4l2_subdev subdev; const struct imx074_datafmt *fmt; struct v4l2_clk *clk; + struct v4l2_async_subdev_list asdl; }; static const struct imx074_datafmt imx074_colour_fmts[] = { @@ -455,14 +457,28 @@ static int imx074_probe(struct i2c_client *client, priv->fmt = &imx074_colour_fmts[0]; + priv->asdl.subdev = &priv->subdev; + priv->asdl.dev = &client->dev; + priv->clk = v4l2_clk_get(&priv->subdev, "mclk"); - if (IS_ERR(priv->clk)) - return PTR_ERR(priv->clk); + if (IS_ERR(priv->clk)) { + dev_info(&client->dev, "Error %ld getting clock\n", PTR_ERR(priv->clk)); + return -EPROBE_DEFER; + } + + ret = soc_camera_power_init(&client->dev, ssdd); + if (ret < 0) + goto epwrinit; ret = imx074_video_probe(client); if (ret < 0) - v4l2_clk_put(priv->clk); + goto eprobe; + return v4l2_async_subdev_register(&priv->asdl); + +epwrinit: +eprobe: + v4l2_clk_put(priv->clk); return ret; } @@ -471,7 +487,9 @@ static int imx074_remove(struct i2c_client *client) struct soc_camera_subdev_desc *ssdd = soc_camera_i2c_to_desc(client); struct imx074 *priv = to_imx074(client); + v4l2_async_subdev_unregister(&priv->asdl); v4l2_clk_put(priv->clk); + if (ssdd->free_bus) ssdd->free_bus(ssdd);