linux-media.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
To: linux-media@vger.kernel.org
Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>,
	Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Subject: [PATCH 22/24] V4L2: soc-camera: use the pad-operation wrapper
Date: Thu, 18 Apr 2013 23:35:43 +0200	[thread overview]
Message-ID: <1366320945-21591-23-git-send-email-g.liakhovetski@gmx.de> (raw)
In-Reply-To: <1366320945-21591-1-git-send-email-g.liakhovetski@gmx.de>

This patch adds support for the pad-operation wrapper to soc-camera, which
allows pure pad-level subdevice drivers, e.g. mt9p031 to be used with
soc-camera.

Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
---
 drivers/media/platform/soc_camera/soc_camera.c |   19 +++++++++++++++++--
 1 files changed, 17 insertions(+), 2 deletions(-)

diff --git a/drivers/media/platform/soc_camera/soc_camera.c b/drivers/media/platform/soc_camera/soc_camera.c
index 3113287..dfd1741 100644
--- a/drivers/media/platform/soc_camera/soc_camera.c
+++ b/drivers/media/platform/soc_camera/soc_camera.c
@@ -36,6 +36,7 @@
 #include <media/v4l2-common.h>
 #include <media/v4l2-ioctl.h>
 #include <media/v4l2-dev.h>
+#include <media/v4l2-pad-wrap.h>
 #include <media/videobuf-core.h>
 #include <media/videobuf2-core.h>
 
@@ -62,7 +63,9 @@ struct soc_camera_async_client {
 	struct v4l2_async_subdev *sensor;
 	struct v4l2_async_notifier notifier;
 	struct platform_device *pdev;
-	struct list_head list;		/* needed for clean up */
+	/* needed for clean up */
+	struct list_head list;
+	struct v4l2_subdev *subdev;
 };
 
 static int soc_camera_video_start(struct soc_camera_device *icd);
@@ -1301,10 +1304,14 @@ static int soc_camera_probe_finish(struct soc_camera_device *icd)
 	if (ret < 0)
 		return ret;
 
+	ret = v4l2_subdev_pad_wrap(sd);
+	if (ret < 0 && ret != -ENOSYS)
+		return ret;
+
 	ret = soc_camera_add_device(icd);
 	if (ret < 0) {
 		dev_err(icd->pdev, "Couldn't activate the camera: %d\n", ret);
-		return ret;
+		goto eadddev;
 	}
 
 	/* At this point client .probe() should have run already */
@@ -1329,6 +1336,8 @@ static int soc_camera_probe_finish(struct soc_camera_device *icd)
 
 	return 0;
 
+eadddev:
+	v4l2_subdev_pad_unwrap(sd);
 evidstart:
 	soc_camera_free_user_formats(icd);
 eusrfmt:
@@ -1693,6 +1702,8 @@ static int soc_camera_remove(struct soc_camera_device *icd)
 {
 	struct soc_camera_desc *sdesc = to_soc_camera_desc(icd);
 	struct video_device *vdev = icd->vdev;
+	struct v4l2_subdev *sd = icd->sasc ? icd->sasc->subdev :
+		soc_camera_to_subdev(icd);
 
 	v4l2_ctrl_handler_free(&icd->ctrl_handler);
 	if (vdev) {
@@ -1700,6 +1711,9 @@ static int soc_camera_remove(struct soc_camera_device *icd)
 		icd->vdev = NULL;
 	}
 
+	/* Before cleaning up the sensor subdevice */
+	v4l2_subdev_pad_unwrap(sd);
+
 	if (sdesc->host_desc.board_info) {
 		soc_camera_i2c_free(icd);
 	} else {
@@ -1867,6 +1881,7 @@ void soc_camera_host_unregister(struct soc_camera_host *ici)
 			/* as long as we hold the device, sasc won't be freed */
 			get_device(icd->pdev);
 			list_add(&icd->sasc->list, &notifiers);
+			icd->sasc->subdev = soc_camera_to_subdev(icd);
 		}
 	mutex_unlock(&list_lock);
 
-- 
1.7.2.5


  parent reply	other threads:[~2013-04-18 21:35 UTC|newest]

Thread overview: 49+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-18 21:35 [PATCH 00/24] V4L2: subdevice pad-level API wrapper Guennadi Liakhovetski
2013-04-18 21:35 ` [PATCH 01/24] V4L2: (cosmetic) remove redundant use of unlikely() Guennadi Liakhovetski
2013-04-18 21:35 ` [PATCH 02/24] imx074: fix error handling for failed async subdevice registration Guennadi Liakhovetski
2013-04-18 21:35 ` [PATCH 03/24] mt9t031: fix NULL dereference during probe() Guennadi Liakhovetski
2013-04-18 21:35 ` [PATCH 04/24] V4L2: fix Oops on rmmod path Guennadi Liakhovetski
2013-04-18 21:35 ` [PATCH 05/24] V4L2: allow dummy file-handle initialisation by v4l2_fh_init() Guennadi Liakhovetski
2013-04-19  7:22   ` Hans Verkuil
2013-04-22 12:07     ` Laurent Pinchart
2013-04-18 21:35 ` [PATCH 06/24] V4L2: add a common V4L2 subdevice platform data type Guennadi Liakhovetski
2013-04-19  7:33   ` Hans Verkuil
2013-04-19  7:48     ` Guennadi Liakhovetski
2013-04-19  8:26       ` Hans Verkuil
2013-10-17 18:24         ` Guennadi Liakhovetski
2013-11-04 11:24           ` Hans Verkuil
2013-11-06  0:13             ` Laurent Pinchart
2013-04-18 21:35 ` [PATCH 07/24] soc-camera: switch to using the new struct v4l2_subdev_platform_data Guennadi Liakhovetski
2013-04-18 21:35 ` [PATCH 08/24] ARM: update all soc-camera users to new platform data layout Guennadi Liakhovetski
2013-04-18 21:35 ` [PATCH 09/24] SH: " Guennadi Liakhovetski
2013-04-18 21:35 ` [PATCH 10/24] soc-camera: update soc-camera-platform & its users to a " Guennadi Liakhovetski
2013-04-18 21:35 ` [PATCH 11/24] soc-camera: completely remove struct soc_camera_link Guennadi Liakhovetski
2013-04-18 21:35 ` [PATCH 12/24] V4L2: soc-camera: retrieve subdevice platform data from struct v4l2_subdev Guennadi Liakhovetski
2013-04-18 21:35 ` [PATCH 13/24] ARM: pcm037: convert custom GPIO-based power function to a regulator Guennadi Liakhovetski
2013-04-18 21:35 ` [PATCH 14/24] mx3-camera: clean up the use of platform data, add driver owner Guennadi Liakhovetski
2013-04-18 21:35 ` [PATCH 15/24] mx3-camera: support asynchronous subdevice registration Guennadi Liakhovetski
2013-04-18 21:35 ` [PATCH 16/24] V4L2: mt9p031: add support for V4L2 clock and asynchronous probing Guennadi Liakhovetski
2013-04-18 21:35 ` [PATCH 17/24] V4L2: mt9p031: add support for .g_mbus_config() video operation Guennadi Liakhovetski
2013-04-18 21:35 ` [PATCH 18/24] V4L2: mt9p031: power down the sensor if no supported device has been detected Guennadi Liakhovetski
2013-04-22 12:19   ` Laurent Pinchart
2013-04-22 12:33     ` Guennadi Liakhovetski
2013-04-18 21:35 ` [PATCH 19/24] V4L2: add struct v4l2_subdev_try_buf Guennadi Liakhovetski
2013-04-18 21:35 ` [PATCH 20/24] V4L2: add a subdev pointer to struct v4l2_subdev_fh Guennadi Liakhovetski
2013-04-18 21:35 ` [PATCH 21/24] V4L2: add a subdevice-driver pad-operation wrapper Guennadi Liakhovetski
2013-04-19  8:20   ` Hans Verkuil
2013-04-19  8:52     ` Guennadi Liakhovetski
2013-04-19  9:40       ` Hans Verkuil
2013-04-18 21:35 ` Guennadi Liakhovetski [this message]
2013-04-18 21:35 ` [PATCH 23/24] V4L2: mt9p031: add struct v4l2_subdev_platform_data to platform data Guennadi Liakhovetski
2013-04-18 21:47   ` Guennadi Liakhovetski
2013-04-22 12:31     ` Laurent Pinchart
2013-04-22 12:39       ` Guennadi Liakhovetski
2013-04-22 12:46         ` Laurent Pinchart
2013-04-26  8:30         ` Sascha Hauer
2013-04-26  8:43           ` Guennadi Liakhovetski
2013-04-26  9:15             ` Sascha Hauer
2013-04-29  9:55               ` Laurent Pinchart
2013-04-22 12:45   ` Laurent Pinchart
2013-04-18 21:35 ` [PATCH 24/24] ARM: pcm037: support mt9p031 / mt9p006 camera sensors Guennadi Liakhovetski
2013-04-18 21:45   ` Guennadi Liakhovetski
2013-04-19 10:29 ` [PATCH 00/24] V4L2: subdevice pad-level API wrapper Hans Verkuil

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1366320945-21591-23-git-send-email-g.liakhovetski@gmx.de \
    --to=g.liakhovetski@gmx.de \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=linux-media@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).