diff options
author | Laurent Pinchart <laurent.pinchart@ideasonboard.com> | 2012-03-21 07:03:28 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2012-05-15 15:12:54 -0400 |
commit | 914f05c8118e17d65c4626ae3ed2edcf79f00031 (patch) | |
tree | b41353c64be1394015f7c976fbafb299b61c21e8 | |
parent | b0a461ff1b476067c24131ea0b2a40571592f761 (diff) |
[media] soc-camera: Support user-configurable line stride
Add a capabilities field to the soc_camera_host structure to flag hosts
that support user-configurable line strides. soc_camera_try_fmt() then
passes the user-provided bytesperline and sizeimage format fields to
such hosts, and expects the host to check (and fix if needed) the
values.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
[g.liakhovetski@gmx.de: fix a typo in mx2_camera.c]
Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
-rw-r--r-- | drivers/media/video/mx2_camera.c | 2 | ||||
-rw-r--r-- | drivers/media/video/soc_camera.c | 6 | ||||
-rw-r--r-- | include/media/soc_camera.h | 4 |
3 files changed, 10 insertions, 2 deletions
diff --git a/drivers/media/video/mx2_camera.c b/drivers/media/video/mx2_camera.c index b63168781cfe..ecd83faf9038 100644 --- a/drivers/media/video/mx2_camera.c +++ b/drivers/media/video/mx2_camera.c | |||
@@ -1787,6 +1787,8 @@ static int __devinit mx2_camera_probe(struct platform_device *pdev) | |||
1787 | pcdev->soc_host.priv = pcdev; | 1787 | pcdev->soc_host.priv = pcdev; |
1788 | pcdev->soc_host.v4l2_dev.dev = &pdev->dev; | 1788 | pcdev->soc_host.v4l2_dev.dev = &pdev->dev; |
1789 | pcdev->soc_host.nr = pdev->id; | 1789 | pcdev->soc_host.nr = pdev->id; |
1790 | if (cpu_is_mx25()) | ||
1791 | pcdev->soc_host.capabilities = SOCAM_HOST_CAP_STRIDE; | ||
1790 | 1792 | ||
1791 | pcdev->alloc_ctx = vb2_dma_contig_init_ctx(&pdev->dev); | 1793 | pcdev->alloc_ctx = vb2_dma_contig_init_ctx(&pdev->dev); |
1792 | if (IS_ERR(pcdev->alloc_ctx)) { | 1794 | if (IS_ERR(pcdev->alloc_ctx)) { |
diff --git a/drivers/media/video/soc_camera.c b/drivers/media/video/soc_camera.c index 5e3274e55756..cfac53544ba6 100644 --- a/drivers/media/video/soc_camera.c +++ b/drivers/media/video/soc_camera.c | |||
@@ -171,8 +171,10 @@ static int soc_camera_try_fmt(struct soc_camera_device *icd, | |||
171 | dev_dbg(icd->pdev, "TRY_FMT(%c%c%c%c, %ux%u)\n", | 171 | dev_dbg(icd->pdev, "TRY_FMT(%c%c%c%c, %ux%u)\n", |
172 | pixfmtstr(pix->pixelformat), pix->width, pix->height); | 172 | pixfmtstr(pix->pixelformat), pix->width, pix->height); |
173 | 173 | ||
174 | pix->bytesperline = 0; | 174 | if (!(ici->capabilities & SOCAM_HOST_CAP_STRIDE)) { |
175 | pix->sizeimage = 0; | 175 | pix->bytesperline = 0; |
176 | pix->sizeimage = 0; | ||
177 | } | ||
176 | 178 | ||
177 | ret = ici->ops->try_fmt(icd, f); | 179 | ret = ici->ops->try_fmt(icd, f); |
178 | if (ret < 0) | 180 | if (ret < 0) |
diff --git a/include/media/soc_camera.h b/include/media/soc_camera.h index a87062c393b5..d865dcf9879f 100644 --- a/include/media/soc_camera.h +++ b/include/media/soc_camera.h | |||
@@ -56,11 +56,15 @@ struct soc_camera_device { | |||
56 | }; | 56 | }; |
57 | }; | 57 | }; |
58 | 58 | ||
59 | /* Host supports programmable stride */ | ||
60 | #define SOCAM_HOST_CAP_STRIDE (1 << 0) | ||
61 | |||
59 | struct soc_camera_host { | 62 | struct soc_camera_host { |
60 | struct v4l2_device v4l2_dev; | 63 | struct v4l2_device v4l2_dev; |
61 | struct list_head list; | 64 | struct list_head list; |
62 | struct mutex host_lock; /* Protect during probing */ | 65 | struct mutex host_lock; /* Protect during probing */ |
63 | unsigned char nr; /* Host number */ | 66 | unsigned char nr; /* Host number */ |
67 | u32 capabilities; | ||
64 | void *priv; | 68 | void *priv; |
65 | const char *drv_name; | 69 | const char *drv_name; |
66 | struct soc_camera_host_ops *ops; | 70 | struct soc_camera_host_ops *ops; |