From patchwork Wed Jan 9 13:41:26 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Lad, Prabhakar" X-Patchwork-Id: 1952781 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 7A59E3FC5A for ; Wed, 9 Jan 2013 13:46:10 +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 r09Dg8vI008388; Wed, 9 Jan 2013 07:42:08 -0600 Received: from DLEE74.ent.ti.com (dlee74.ent.ti.com [157.170.170.8]) by dlelxv30.itg.ti.com (8.13.8/8.13.8) with ESMTP id r09Dg8Sv013648; Wed, 9 Jan 2013 07:42:08 -0600 Received: from dlelxv24.itg.ti.com (172.17.1.199) by DLEE74.ent.ti.com (157.170.170.8) with Microsoft SMTP Server id 14.1.323.3; Wed, 9 Jan 2013 07:42:08 -0600 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 r09Dg8ku020116; Wed, 9 Jan 2013 07:42:08 -0600 Received: from linux.omap.com (localhost [127.0.0.1]) by linux.omap.com (Postfix) with ESMTP id 13E8F80627; Wed, 9 Jan 2013 07:42:08 -0600 (CST) 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 F104980626 for ; Wed, 9 Jan 2013 07:42:06 -0600 (CST) Received: from neches.ext.ti.com (neches.ext.ti.com [192.91.81.29]) by dflp52.itg.ti.com (8.13.7/8.13.8) with ESMTP id r09Dg6ue026157 for ; Wed, 9 Jan 2013 07:42:06 -0600 (CST) Received: from psmtp.com (na3sys009amx212.postini.com [74.125.149.52]) by neches.ext.ti.com (8.13.7/8.13.7) with SMTP id r09Dg5NQ003523 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Wed, 9 Jan 2013 07:42:06 -0600 Received: from mail-pa0-f48.google.com ([209.85.220.48]) (using TLSv1) by na3sys009amx212.postini.com ([74.125.148.10]) with SMTP; Wed, 09 Jan 2013 13:42:06 GMT Received: by mail-pa0-f48.google.com with SMTP id fa1so1055509pad.7 for ; Wed, 09 Jan 2013 05:42:05 -0800 (PST) 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=GMOKOcctsHVZSnftWtmsJUyTxx09Ys58o5HDZiJ7tWQ=; b=dC+j5pq7G65IaPWSJRS4U7GdqHwGysv4PONsM6QgzCkaFO1LfcAHDafQMHIzqdIdvQ hg4tgxM3WsUfSHZqEuAptiWS2zWuCK4ALLV2GdwqmZvq2hgWFENnKCnB/kVekEqnRoD8 kIP3OK0ixZUyhuNRVq631npjfuwVugMhcfsJrXekYUB/GGZmE9yfn3d1LlROF2r9adjT 3rVWjg/JVEQXpCfKI9DH0fcHNTbvNf0NOm0EgfbuwT3DptdUtErjaTOsxbKXjZfOCjjw MWSXZcQW7/zsDLPgrgvO0ve2dSQ6ZObSSa7TZJP1jNT5DfcaCeaMHFm5Ba0bGGtxPmOo qnrA== X-Received: by 10.68.209.170 with SMTP id mn10mr211111626pbc.11.1357738925134; Wed, 09 Jan 2013 05:42:05 -0800 (PST) Received: from localhost.localdomain ([122.166.13.141]) by mx.google.com with ESMTPS id k4sm42842184paz.26.2013.01.09.05.41.59 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 09 Jan 2013 05:42:04 -0800 (PST) From: "Lad, Prabhakar" To: LMML Subject: [PATCH RFC 2/3] tvp514x: support asynchronous probing Date: Wed, 9 Jan 2013 19:11:26 +0530 Message-ID: <1357738887-8701-3-git-send-email-prabhakar.lad@ti.com> X-Mailer: git-send-email 1.7.4.1 In-Reply-To: <1357738887-8701-1-git-send-email-prabhakar.lad@ti.com> References: <1357738887-8701-1-git-send-email-prabhakar.lad@ti.com> X-pstn-levels: (S:33.21237/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:no-policies X-pstn-settings: 2 (0.5000:0.0050) s cv GT3 gt2 gt1 r p m c X-pstn-addresses: from [82/3] CC: DLOS , Mauro Carvalho Chehab , LKML , Mauro Carvalho Chehab , Hans Verkuil , Sakari Ailus , Guennadi Liakhovetski , LAK 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 Both synchronous and asynchronous tvp514x 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/tvp514x.c | 20 ++++++++++++++------ 1 files changed, 14 insertions(+), 6 deletions(-) diff --git a/drivers/media/i2c/tvp514x.c b/drivers/media/i2c/tvp514x.c index aa94ebc..a4f0a70 100644 --- a/drivers/media/i2c/tvp514x.c +++ b/drivers/media/i2c/tvp514x.c @@ -34,6 +34,7 @@ #include #include +#include #include #include #include @@ -102,6 +103,7 @@ struct tvp514x_decoder { struct v4l2_ctrl_handler hdl; struct tvp514x_reg tvp514x_regs[ARRAY_SIZE(tvp514x_reg_list_default)]; const struct tvp514x_platform_data *pdata; + struct v4l2_async_subdev_list asdl; int ver; int streaming; @@ -941,22 +943,22 @@ tvp514x_probe(struct i2c_client *client, const struct i2c_device_id *id) { struct tvp514x_decoder *decoder; struct v4l2_subdev *sd; + int ret; /* Check if the adapter supports the needed features */ if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_BYTE_DATA)) return -EIO; - if (!client->dev.platform_data) { - v4l2_err(client, "No platform data!!\n"); - return -ENODEV; - } - decoder = devm_kzalloc(&client->dev, sizeof(*decoder), GFP_KERNEL); if (!decoder) return -ENOMEM; /* Initialize the tvp514x_decoder with default configuration */ *decoder = tvp514x_dev; + if (!client->dev.platform_data) { + v4l2_err(client, "No platform data!!\n"); + return -EPROBE_DEFER; + } /* Copy default register configuration */ memcpy(decoder->tvp514x_regs, tvp514x_reg_list_default, sizeof(tvp514x_reg_list_default)); @@ -980,6 +982,11 @@ tvp514x_probe(struct i2c_client *client, const struct i2c_device_id *id) /* Register with V4L2 layer as slave device */ sd = &decoder->sd; + decoder->asdl.subdev = &decoder->sd; + decoder->asdl.dev = &client->dev; + ret = v4l2_async_subdev_bind(&decoder->asdl); + if (ret < 0) + return ret; v4l2_i2c_subdev_init(sd, client, &tvp514x_ops); v4l2_ctrl_handler_init(&decoder->hdl, 5); @@ -1004,7 +1011,7 @@ tvp514x_probe(struct i2c_client *client, const struct i2c_device_id *id) v4l2_info(sd, "%s decoder driver registered !!\n", sd->name); - return 0; + return v4l2_async_subdev_bound(&decoder->asdl); } @@ -1020,6 +1027,7 @@ static int tvp514x_remove(struct i2c_client *client) struct v4l2_subdev *sd = i2c_get_clientdata(client); struct tvp514x_decoder *decoder = to_decoder(sd); + v4l2_async_subdev_unbind(&decoder->asdl); v4l2_device_unregister_subdev(sd); v4l2_ctrl_handler_free(&decoder->hdl); return 0;