From patchwork Mon Apr 8 15:05:37 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Guennadi Liakhovetski X-Patchwork-Id: 2409011 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 9878B3FDC4 for ; Mon, 8 Apr 2013 15:06:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S964956Ab3DHPGI (ORCPT ); Mon, 8 Apr 2013 11:06:08 -0400 Received: from moutng.kundenserver.de ([212.227.126.187]:49783 "EHLO moutng.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S964852Ab3DHPGC (ORCPT ); Mon, 8 Apr 2013 11:06:02 -0400 Received: from axis700.grange (dslb-088-077-162-116.pools.arcor-ip.net [88.77.162.116]) by mrelayeu.kundenserver.de (node=mrbap0) with ESMTP (Nemesis) id 0LcVM6-1Uq3sW1g06-00jqD2; Mon, 08 Apr 2013 17:05:43 +0200 Received: from 6a.grange (6a.grange [192.168.1.11]) by axis700.grange (Postfix) with ESMTPS id D504340BB8; Mon, 8 Apr 2013 17:05:41 +0200 (CEST) Received: from lyakh by 6a.grange with local (Exim 4.72) (envelope-from ) id 1UPDdd-0004AO-FP; Mon, 08 Apr 2013 17:05:41 +0200 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 v8 6/7] imx074: support asynchronous probing Date: Mon, 8 Apr 2013 17:05:37 +0200 Message-Id: <1365433538-15975-7-git-send-email-g.liakhovetski@gmx.de> X-Mailer: git-send-email 1.7.2.5 In-Reply-To: <1365433538-15975-1-git-send-email-g.liakhovetski@gmx.de> References: <1365433538-15975-1-git-send-email-g.liakhovetski@gmx.de> X-Provags-ID: V02:K0:Y3vRe96/01vZ1aH3B9U2+4JvpKBZG1MMUahmo+H591M SeWZVVrXQy+U/MOFnMSXF1KyakfAavjj/1/27N+qFynyIq2nk3 kR5V4s2dLjvuLlOo+2Q7gBFNTl4PUCejHteXTfQdlSRwd2H5UP Vcm4sTSyH5mMAy/Ni2qPq8tVlTlHrQxEkfDP4Pxbeg2D7Mlf7/ JePrr23vG/PxBCCzBbus35zJyj5owg0q1cRkK7QK/YeHWGgyxO W2P9shhxOjh2ZkqP8c/utravCtH91wTv/0jOH+jRQaHGXvKzK/ ZIL7ugUFh5hAd+CfR1t9Ovjp7MKpDRNqFgdz0AGzdmbUaTRUoq xCc5ey39ry1UX/IbAPH8hQdmdT93UtknR/aZOF9F+9MtKpUl6a f67BGPXdp3YoA== 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 | 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 a6a5060..624d7c7 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(&client->dev, "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_register_subdev(&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_unregister_subdev(&priv->asdl); v4l2_clk_put(priv->clk); + if (ssdd->free_bus) ssdd->free_bus(ssdd);