diff options
author | Troy Kisky <troy.kisky@boundarydevices.com> | 2014-03-04 19:24:08 -0700 |
---|---|---|
committer | Max Krummenacher <max.krummenacher@toradex.com> | 2015-09-01 16:17:48 +0200 |
commit | 8ca483fed8f51363f1a692629faaf87303f11511 (patch) | |
tree | 0b5cbe730809c6caa387f3441d9a42ce4b9d2551 | |
parent | b239e8a51de0a05ea98df545a498b8b5f1434a47 (diff) |
mxc_v4l2_capture: add mxc_camera_common_lock/unlock, fix device name
(cherry picked from commit c9419af618e4e7944b56f65dce29f2f409681997)
Conflicts:
drivers/media/platform/mxc/capture/mxc_v4l2_capture.c
-rw-r--r-- | drivers/media/platform/mxc/capture/mxc_v4l2_capture.c | 18 | ||||
-rw-r--r-- | drivers/media/platform/mxc/capture/mxc_v4l2_capture.h | 3 |
2 files changed, 20 insertions, 1 deletions
diff --git a/drivers/media/platform/mxc/capture/mxc_v4l2_capture.c b/drivers/media/platform/mxc/capture/mxc_v4l2_capture.c index 5f0669dcb2e9..dfc63b79b971 100644 --- a/drivers/media/platform/mxc/capture/mxc_v4l2_capture.c +++ b/drivers/media/platform/mxc/capture/mxc_v4l2_capture.c @@ -34,6 +34,7 @@ #include <linux/fb.h> #include <linux/dma-mapping.h> #include <linux/delay.h> +#include <linux/mutex.h> #include <linux/mxcfb.h> #include <linux/of_device.h> #include <media/v4l2-chip-ident.h> @@ -2661,6 +2662,7 @@ static int init_camera_struct(cam_data *cam, struct platform_device *pdev) int ipu_id, csi_id, mclk_source; int ret = 0; struct v4l2_device *v4l2_dev; + static int camera_id; pr_debug("In MVC: init_camera_struct\n"); @@ -2781,7 +2783,7 @@ static int init_camera_struct(cam_data *cam, struct platform_device *pdev) cam->self = kmalloc(sizeof(struct v4l2_int_device), GFP_KERNEL); cam->self->module = THIS_MODULE; - sprintf(cam->self->name, "mxc_v4l2_cap%d", cam->csi); + sprintf(cam->self->name, "mxc_v4l2_cap%d", camera_id++); cam->self->type = v4l2_int_type_master; cam->self->u.master = &mxc_v4l2_master; @@ -3136,6 +3138,20 @@ static void mxc_v4l2_master_detach(struct v4l2_int_device *slave) vidioc_int_dev_exit(slave); } +DEFINE_MUTEX(camera_common_mutex); + +void mxc_camera_common_lock(void) +{ + mutex_lock(&camera_common_mutex); +} +EXPORT_SYMBOL(mxc_camera_common_lock); + +void mxc_camera_common_unlock(void) +{ + mutex_unlock(&camera_common_mutex); +} +EXPORT_SYMBOL(mxc_camera_common_unlock); + /*! * Entry point for the V4L2 * diff --git a/drivers/media/platform/mxc/capture/mxc_v4l2_capture.h b/drivers/media/platform/mxc/capture/mxc_v4l2_capture.h index 612e4cbce5f7..9283102e8511 100644 --- a/drivers/media/platform/mxc/capture/mxc_v4l2_capture.h +++ b/drivers/media/platform/mxc/capture/mxc_v4l2_capture.h @@ -263,4 +263,7 @@ struct sensor_data { }; void set_mclk_rate(uint32_t *p_mclk_freq, uint32_t csi); +void mxc_camera_common_lock(void); +void mxc_camera_common_unlock(void); + #endif /* __MXC_V4L2_CAPTURE_H__ */ |