From patchwork Mon Apr 22 10:17:25 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Lad, Prabhakar" X-Patchwork-Id: 2471201 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 923E73FCA5 for ; Mon, 22 Apr 2013 10:23:02 +0000 (UTC) Received: from dflxv15.itg.ti.com ([128.247.5.124]) by bear.ext.ti.com (8.13.7/8.13.7) with ESMTP id r3MAJ39E021309; Mon, 22 Apr 2013 05:19:03 -0500 Received: from DFLE73.ent.ti.com (dfle73.ent.ti.com [128.247.5.110]) by dflxv15.itg.ti.com (8.14.3/8.13.8) with ESMTP id r3MAJ3fm014910; Mon, 22 Apr 2013 05:19:03 -0500 Received: from dlelxv24.itg.ti.com (172.17.1.199) by DFLE73.ent.ti.com (128.247.5.110) with Microsoft SMTP Server id 14.2.342.3; Mon, 22 Apr 2013 05:19:03 -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 r3MAJ3AG009763; Mon, 22 Apr 2013 05:19:03 -0500 Received: from linux.omap.com (localhost [127.0.0.1]) by linux.omap.com (Postfix) with ESMTP id 58FF480628; Mon, 22 Apr 2013 05:19:03 -0500 (CDT) X-Original-To: davinci-linux-open-source@linux.davincidsp.com Delivered-To: davinci-linux-open-source@linux.davincidsp.com Received: from dflp51.itg.ti.com (dflp51.itg.ti.com [128.247.22.94]) by linux.omap.com (Postfix) with ESMTP id CF6CC80626 for ; Mon, 22 Apr 2013 05:19:00 -0500 (CDT) Received: from medina.ext.ti.com (medina.ext.ti.com [192.91.81.31]) by dflp51.itg.ti.com (8.13.7/8.13.8) with ESMTP id r3MAJ0Vp005373 for ; Mon, 22 Apr 2013 05:19:00 -0500 (CDT) Received: from mail6.bemta7.messagelabs.com (mail6.bemta7.messagelabs.com [216.82.255.55]) by medina.ext.ti.com (8.13.7/8.13.7) with ESMTP id r3MAIxhO025599 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Mon, 22 Apr 2013 05:18:59 -0500 Received: from [216.82.253.67:60219] by server-15.bemta-7.messagelabs.com id FC/D8-24613-39E05715; Mon, 22 Apr 2013 10:18:59 +0000 X-Env-Sender: prabhakar.csengg@gmail.com X-Msg-Ref: server-3.tower-158.messagelabs.com!1366625938!3930775!1 X-Originating-IP: [209.85.210.44] X-SpamReason: No, hits=0.0 required=7.0 tests=ML_RADAR_SPEW_LINKS_14, spamassassin: X-StarScan-Received: X-StarScan-Version: 6.8.6.1; banners=-,-,- X-VirusChecked: Checked Received: (qmail 12206 invoked from network); 22 Apr 2013 10:18:58 -0000 Received: from mail-da0-f44.google.com (HELO mail-da0-f44.google.com) (209.85.210.44) by server-3.tower-158.messagelabs.com with RC4-SHA encrypted SMTP; 22 Apr 2013 10:18:58 -0000 Received: by mail-da0-f44.google.com with SMTP id z20so3039230dae.17 for ; Mon, 22 Apr 2013 03:18:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:from:to:cc:subject:date:message-id:x-mailer:in-reply-to :references; bh=fLP1WjlZvoqBQLowBdXQjDoPZmoSKa2TmEhJAoK2D74=; b=IwQlv69cMWGXqoxpNFKA/idQlNlvzF3srJeYGK0zESTF6GBgzZmN9SM2HgNHavK3iC izetoAW9cO/2flScHbRyw2N4oFRyDGE52YTVgcb1seKsdFBU1t1uxTB2ZgCNsxMGCDVr m5FVETBl9dSQe0pC+NCfIuJpeCB4pLEN4gJdYh0HcGxgt1LPpSDQakaKrqsKOARZT4oX c+mTvIboyDP3V2m57Jg2+1OSJSu+apSIMkiO6+UetfiJO3pipeVpn2ECz++PlMpvBwxk AnB3yS0lHJLqOc4J6+olnt9CsRQBveCqHGk3u1bqLqzpveN9x5rY+B43DIKuxiEFjfb8 weIA== X-Received: by 10.66.218.36 with SMTP id pd4mr15025147pac.143.1366625938138; Mon, 22 Apr 2013 03:18:58 -0700 (PDT) Received: from localhost.localdomain ([122.166.13.141]) by mx.google.com with ESMTPS id lo7sm26551295pab.19.2013.04.22.03.18.50 (version=TLSv1 cipher=RC4-SHA bits=128/128); Mon, 22 Apr 2013 03:18:57 -0700 (PDT) From: Prabhakar Lad To: LMML Subject: [PATCH RFC v2 1/4] media: i2c: adv7343: add support for asynchronous probing Date: Mon, 22 Apr 2013 15:47:25 +0530 Message-ID: <1366625848-743-2-git-send-email-prabhakar.csengg@gmail.com> X-Mailer: git-send-email 1.7.4.1 In-Reply-To: <1366625848-743-1-git-send-email-prabhakar.csengg@gmail.com> References: <1366625848-743-1-git-send-email-prabhakar.csengg@gmail.com> CC: DLOS , Mauro Carvalho Chehab , LKML , Sakari Ailus , Laurent Pinchart , Guennadi Liakhovetski 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: Lad, Prabhakar Both synchronous and asynchronous adv7343 subdevice probing is supported by this patch. Signed-off-by: Lad, Prabhakar Cc: Guennadi Liakhovetski Cc: Laurent Pinchart Cc: Hans Verkuil Cc: Sakari Ailus Cc: Mauro Carvalho Chehab --- drivers/media/i2c/adv7343.c | 17 +++++++++++++---- 1 files changed, 13 insertions(+), 4 deletions(-) diff --git a/drivers/media/i2c/adv7343.c b/drivers/media/i2c/adv7343.c index 9fc2b98..5b1417b 100644 --- a/drivers/media/i2c/adv7343.c +++ b/drivers/media/i2c/adv7343.c @@ -27,6 +27,7 @@ #include #include +#include #include #include #include @@ -44,6 +45,7 @@ struct adv7343_state { struct v4l2_subdev sd; struct v4l2_ctrl_handler hdl; const struct adv7343_platform_data *pdata; + struct v4l2_async_subdev_list asdl; u8 reg00; u8 reg01; u8 reg02; @@ -455,16 +457,22 @@ static int adv7343_probe(struct i2c_client *client, ADV7343_GAIN_DEF); state->sd.ctrl_handler = &state->hdl; if (state->hdl.error) { - int err = state->hdl.error; - - v4l2_ctrl_handler_free(&state->hdl); - return err; + err = state->hdl.error; + goto done; } v4l2_ctrl_handler_setup(&state->hdl); err = adv7343_initialize(&state->sd); if (err) + goto done; + + state->sd.dev = &client->dev; + err = v4l2_async_register_subdev(&state->sd); + +done: + if (err < 0) v4l2_ctrl_handler_free(&state->hdl); + return err; } @@ -473,6 +481,7 @@ static int adv7343_remove(struct i2c_client *client) struct v4l2_subdev *sd = i2c_get_clientdata(client); struct adv7343_state *state = to_state(sd); + v4l2_async_unregister_subdev(&state->sd); v4l2_device_unregister_subdev(sd); v4l2_ctrl_handler_free(&state->hdl);