From patchwork Wed Dec 26 17:49:10 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Guennadi Liakhovetski X-Patchwork-Id: 1911371 Return-Path: X-Original-To: patchwork-linux-media@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id 960AA400EC for ; Wed, 26 Dec 2012 17:49:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753561Ab2LZRtY (ORCPT ); Wed, 26 Dec 2012 12:49:24 -0500 Received: from moutng.kundenserver.de ([212.227.126.171]:51095 "EHLO moutng.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752439Ab2LZRtS (ORCPT ); Wed, 26 Dec 2012 12:49:18 -0500 Received: from axis700.grange (dslb-178-001-136-130.pools.arcor-ip.net [178.1.136.130]) by mrelayeu.kundenserver.de (node=mrbap0) with ESMTP (Nemesis) id 0Lr4CZ-1T9cXB0YOx-00eS05; Wed, 26 Dec 2012 18:49:14 +0100 Received: from 6a.grange (6a.grange [192.168.1.11]) by axis700.grange (Postfix) with ESMTPS id 800DA40BDC; Wed, 26 Dec 2012 18:49:12 +0100 (CET) Received: from lyakh by 6a.grange with local (Exim 4.72) (envelope-from ) id 1Tnv6O-0001ed-1q; Wed, 26 Dec 2012 18:49:12 +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 Subject: [PATCH 5/6] imx074: support asynchronous probing Date: Wed, 26 Dec 2012 18:49:10 +0100 Message-Id: <1356544151-6313-6-git-send-email-g.liakhovetski@gmx.de> X-Mailer: git-send-email 1.7.2.5 In-Reply-To: <1356544151-6313-1-git-send-email-g.liakhovetski@gmx.de> References: <1356544151-6313-1-git-send-email-g.liakhovetski@gmx.de> X-Provags-ID: V02:K0:uOsGjyYxLZYJgbwNj5k5O0lUjmEYP3EBhymPZqAoLAO Obv2r/FNxJrLMEvM05F9zHfLN37tZdHhPJnXkrk0SXuDx6+13x wBGMxQvHm8F5JYwX2zBl+iDicALWIMsO4bTvzmPJZ7CtIp11fD hfG8ek3KKFUUDNW2YjkzgilMLGbIBH7JGxaVXkocHK29me6C6W 8S5Ydh4J3lB2QtUngGWaxAYkSe19M61gLvur6ymBw6tB7Sg/Qo 1G+X7S3mmD+8jWnhKbiRsakGVpNeXZTDWVlmCwRzgsPRE72BsP C29UQd2/JauXIXbzHvwJaP6fVIt29JgE0xvsS/9P+p0bNfQxPv iMpce36tVGvftntn0Se2/xoETwc8K1X7ZhSekdtwbUuvqmoKQ+ pXsoAP6UWv7yw== Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org Both synchronous and asynchronous imx074 subdevice probing is supported by this patch. Signed-off-by: Guennadi Liakhovetski --- drivers/media/i2c/soc_camera/imx074.c | 23 ++++++++++++++++++++--- 1 files changed, 20 insertions(+), 3 deletions(-) diff --git a/drivers/media/i2c/soc_camera/imx074.c b/drivers/media/i2c/soc_camera/imx074.c index cee5345..a097dd1 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,27 @@ static int imx074_probe(struct i2c_client *client, priv->fmt = &imx074_colour_fmts[0]; + priv->asdl.subdev = &priv->subdev; + priv->asdl.dev = &client->dev; + + ret = v4l2_async_subdev_bind(&priv->asdl); + if (ret < 0) + return ret; + 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 = imx074_video_probe(client); if (ret < 0) - v4l2_clk_put(priv->clk); + goto eprobe; + + return v4l2_async_subdev_bound(&priv->asdl); +eprobe: + v4l2_clk_put(priv->clk); return ret; } @@ -471,7 +486,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_unbind(&priv->asdl); v4l2_clk_put(priv->clk); + if (ssdd->free_bus) ssdd->free_bus(ssdd);