media: staging/imx: add media device to capture register
authorRui Miguel Silva <rui.silva@linaro.org>
Fri, 12 Apr 2019 16:44:00 +0000 (12:44 -0400)
committerMauro Carvalho Chehab <mchehab+samsung@kernel.org>
Wed, 8 May 2019 18:00:34 +0000 (14:00 -0400)
When register the capture media device it is assumed that the device
data is the media device. In the imx6 case is but in the imx7 is not
case. The device data is the csi structure.

Add the explicit argument of the media device that we want to
associate with the capture device.

Reported-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Rui Miguel Silva <rui.silva@linaro.org>
Acked-by: Steve Longerbeam <slongerbeam@gmail.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
[hverkuil-cisco@xs4all.nl: fix checkpatch alignment warning]
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
drivers/staging/media/imx/imx-ic-prpencvf.c
drivers/staging/media/imx/imx-media-capture.c
drivers/staging/media/imx/imx-media-csi.c
drivers/staging/media/imx/imx-media.h
drivers/staging/media/imx/imx7-media-csi.c

index 5c8e6ad8c025a370a6d0acd71468e9d6d5e2d17c..3ca1422f615431864ed6373b54585058ccc6d631 100644 (file)
@@ -1270,7 +1270,7 @@ static int prp_registered(struct v4l2_subdev *sd)
        if (ret)
                return ret;
 
-       ret = imx_media_capture_device_register(priv->vdev);
+       ret = imx_media_capture_device_register(priv->md, priv->vdev);
        if (ret)
                return ret;
 
index 9703c85b19c4378abe04ac2632de909c5006f330..7688238a3396a291a078062db52445df2620325c 100644 (file)
@@ -706,7 +706,8 @@ void imx_media_capture_device_error(struct imx_media_video_dev *vdev)
 }
 EXPORT_SYMBOL_GPL(imx_media_capture_device_error);
 
-int imx_media_capture_device_register(struct imx_media_video_dev *vdev)
+int imx_media_capture_device_register(struct imx_media_dev *md,
+                                     struct imx_media_video_dev *vdev)
 {
        struct capture_priv *priv = to_capture_priv(vdev);
        struct v4l2_subdev *sd = priv->src_sd;
@@ -715,8 +716,7 @@ int imx_media_capture_device_register(struct imx_media_video_dev *vdev)
        struct v4l2_subdev_format fmt_src;
        int ret;
 
-       /* get media device */
-       priv->md = dev_get_drvdata(sd->v4l2_dev->dev);
+       priv->md = md;
 
        vfd->v4l2_dev = sd->v4l2_dev;
 
index 41965d8b56c48b2a99ef50440f404749cde99331..c33d714ed953929fbda3316484bc085fb06b51c6 100644 (file)
@@ -1816,7 +1816,7 @@ static int csi_registered(struct v4l2_subdev *sd)
        if (ret)
                goto free_fim;
 
-       ret = imx_media_capture_device_register(priv->vdev);
+       ret = imx_media_capture_device_register(priv->md, priv->vdev);
        if (ret)
                goto free_fim;
 
index dd603a6b3a7027ec2a3f8d5c1d40512dfc6dbbc5..fc5d969ded7951d450a76e333c3c5e2c4dee25f4 100644 (file)
@@ -272,7 +272,8 @@ int imx_media_of_add_csi(struct imx_media_dev *imxmd,
 struct imx_media_video_dev *
 imx_media_capture_device_init(struct v4l2_subdev *src_sd, int pad);
 void imx_media_capture_device_remove(struct imx_media_video_dev *vdev);
-int imx_media_capture_device_register(struct imx_media_video_dev *vdev);
+int imx_media_capture_device_register(struct imx_media_dev *md,
+                                     struct imx_media_video_dev *vdev);
 void imx_media_capture_device_unregister(struct imx_media_video_dev *vdev);
 struct imx_media_buffer *
 imx_media_capture_device_next_buf(struct imx_media_video_dev *vdev);
index 18eb5d3ecf102ad5bca3f84379f1c290d2929a92..a708a0340eb18a0a0d5931870b946e13ba78181a 100644 (file)
@@ -1126,7 +1126,7 @@ static int imx7_csi_registered(struct v4l2_subdev *sd)
        if (ret < 0)
                return ret;
 
-       ret = imx_media_capture_device_register(csi->vdev);
+       ret = imx_media_capture_device_register(csi->imxmd, csi->vdev);
        if (ret < 0)
                return ret;