]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
[media] exynos4-is: Fix driver name reported in vidioc_querycap
authorSylwester Nawrocki <s.nawrocki@samsung.com>
Tue, 23 Apr 2013 14:36:04 +0000 (11:36 -0300)
committerMauro Carvalho Chehab <mchehab@redhat.com>
Thu, 25 Apr 2013 12:38:04 +0000 (09:38 -0300)
Originally struct v4l2_capability driver and card name was filled
with name of the platform device. After switching to the device tree
the device names have changed and now are 4 different driver names
reported, depending on the video device opened. So instead of e.g.
"exynos4-fimc" there is now one of: 11800000.fimc, 11810000.fimc,
11820000.fimc, 11830000.fimc.
Fix this by using dev->driver_name, rather than platform device name.
A common vidioc_querycap function is created for both M2M and capture
video node.
This fixes any breakage at user space should any application/library
rely on the driver's name.

Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
drivers/media/platform/exynos4-is/fimc-capture.c
drivers/media/platform/exynos4-is/fimc-core.c
drivers/media/platform/exynos4-is/fimc-core.h
drivers/media/platform/exynos4-is/fimc-m2m.c

index 558c528d9ce1519606104d482f2b4c89eaea1898..528f41369364df47584d696e6c586df2e56e7be4 100644 (file)
@@ -742,16 +742,13 @@ static void fimc_capture_try_selection(struct fimc_ctx *ctx,
 /*
  * The video node ioctl operations
  */
-static int fimc_vidioc_querycap_capture(struct file *file, void *priv,
+static int fimc_cap_querycap(struct file *file, void *priv,
                                        struct v4l2_capability *cap)
 {
        struct fimc_dev *fimc = video_drvdata(file);
 
-       strncpy(cap->driver, fimc->pdev->name, sizeof(cap->driver) - 1);
-       strncpy(cap->card, fimc->pdev->name, sizeof(cap->card) - 1);
-       cap->bus_info[0] = 0;
-       cap->capabilities = V4L2_CAP_STREAMING | V4L2_CAP_VIDEO_CAPTURE_MPLANE;
-
+       __fimc_vidioc_querycap(&fimc->pdev->dev, cap, V4L2_CAP_STREAMING |
+                                       V4L2_CAP_VIDEO_CAPTURE_MPLANE);
        return 0;
 }
 
@@ -1375,7 +1372,7 @@ static int fimc_cap_s_selection(struct file *file, void *fh,
 }
 
 static const struct v4l2_ioctl_ops fimc_capture_ioctl_ops = {
-       .vidioc_querycap                = fimc_vidioc_querycap_capture,
+       .vidioc_querycap                = fimc_cap_querycap,
 
        .vidioc_enum_fmt_vid_cap_mplane = fimc_cap_enum_fmt_mplane,
        .vidioc_try_fmt_vid_cap_mplane  = fimc_cap_try_fmt_mplane,
index a8eaad0fc612b77a4dbb2752f41c2761387e45ce..379a5e9d52a706921883c6a7c6078c2a2586fe1a 100644 (file)
@@ -213,6 +213,17 @@ struct fimc_fmt *fimc_get_format(unsigned int index)
        return &fimc_formats[index];
 }
 
+void __fimc_vidioc_querycap(struct device *dev, struct v4l2_capability *cap,
+                                               unsigned int caps)
+{
+       strlcpy(cap->driver, dev->driver->name, sizeof(cap->driver));
+       strlcpy(cap->card, dev->driver->name, sizeof(cap->card));
+       snprintf(cap->bus_info, sizeof(cap->bus_info),
+                               "platform:%s", dev_name(dev));
+       cap->device_caps = caps;
+       cap->capabilities = cap->device_caps | V4L2_CAP_DEVICE_CAPS;
+}
+
 int fimc_check_scaler_ratio(struct fimc_ctx *ctx, int sw, int sh,
                            int dw, int dh, int rotation)
 {
@@ -1283,7 +1294,7 @@ static struct platform_driver fimc_driver = {
        .id_table       = fimc_driver_ids,
        .driver = {
                .of_match_table = fimc_of_match,
-               .name           = FIMC_MODULE_NAME,
+               .name           = FIMC_DRIVER_NAME,
                .owner          = THIS_MODULE,
                .pm             = &fimc_pm_ops,
        }
index 953b074d542f1859fc367532e58e4349bda701a6..539a3f71c16a9d8b0aeaeae6621937817a96386f 100644 (file)
@@ -35,7 +35,7 @@
 /* Time to wait for next frame VSYNC interrupt while stopping operation. */
 #define FIMC_SHUTDOWN_TIMEOUT  ((100*HZ)/1000)
 #define MAX_FIMC_CLOCKS                2
-#define FIMC_MODULE_NAME       "s5p-fimc"
+#define FIMC_DRIVER_NAME       "exynos4-fimc"
 #define FIMC_MAX_DEVS          4
 #define FIMC_MAX_OUT_BUFS      4
 #define SCALER_MAX_HRATIO      64
@@ -620,6 +620,8 @@ static inline struct fimc_frame *ctx_get_frame(struct fimc_ctx *ctx,
 /* fimc-core.c */
 int fimc_vidioc_enum_fmt_mplane(struct file *file, void *priv,
                                struct v4l2_fmtdesc *f);
+void __fimc_vidioc_querycap(struct device *dev, struct v4l2_capability *cap,
+                                               unsigned int caps);
 int fimc_ctrls_create(struct fimc_ctx *ctx);
 void fimc_ctrls_delete(struct fimc_ctx *ctx);
 void fimc_ctrls_activate(struct fimc_ctx *ctx, bool active);
index 8449c0705e6011db6dfd51c61fba1ae1f4c76315..275a9f8d9fdbb59494d993237e347cec44a7d62f 100644 (file)
@@ -249,22 +249,20 @@ static struct vb2_ops fimc_qops = {
  * V4L2 ioctl handlers
  */
 static int fimc_m2m_querycap(struct file *file, void *fh,
-                            struct v4l2_capability *cap)
+                                    struct v4l2_capability *cap)
 {
-       struct fimc_ctx *ctx = fh_to_ctx(fh);
-       struct fimc_dev *fimc = ctx->fimc_dev;
+       struct fimc_dev *fimc = video_drvdata(file);
+       unsigned int caps;
 
-       strncpy(cap->driver, fimc->pdev->name, sizeof(cap->driver) - 1);
-       strncpy(cap->card, fimc->pdev->name, sizeof(cap->card) - 1);
-       cap->bus_info[0] = 0;
        /*
         * This is only a mem-to-mem video device. The capture and output
         * device capability flags are left only for backward compatibility
         * and are scheduled for removal.
         */
-       cap->capabilities = V4L2_CAP_STREAMING | V4L2_CAP_VIDEO_M2M_MPLANE |
+       caps = V4L2_CAP_STREAMING | V4L2_CAP_VIDEO_M2M_MPLANE |
                V4L2_CAP_VIDEO_CAPTURE_MPLANE | V4L2_CAP_VIDEO_OUTPUT_MPLANE;
 
+       __fimc_vidioc_querycap(&fimc->pdev->dev, cap, caps);
        return 0;
 }