video: tegra: dtv: Add ioctl for buffer size query
Adam Jiang [Wed, 24 Apr 2013 06:56:27 +0000 (15:56 +0900)]
Userspace has to know the exact buffer size of DTV driver. Export it
with new ioctl() command.

Bug 1061456
Bug 1258577

Change-Id: I7676d0ab90775399245ffa0724bb34845151c680
(cherry picked from commit f88099b4f579e77e7b1defc404ff924caa70b79d)
(cherry picked from commit bedee58c6744784771e7bcbd55b7a0707f89a345)
Signed-off-by: Adam Jiang <chaoj@nvidia.com>
Reviewed-on: http://git-master/r/224685
Reviewed-on: http://git-master/r/244474
Reviewed-on: http://git-master/r/256190
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Bharat Nihalani <bnihalani@nvidia.com>

drivers/media/video/tegra/tegra_dtv.c
include/media/tegra_dtv.h

index 3a8567b..b87bbd7 100644 (file)
@@ -426,6 +426,13 @@ static long tegra_dtv_ioctl(struct file *file, unsigned int cmd,
                        ret = -EFAULT;
                break;
        }
+       case TEGRA_DTV_IOCTL_GET_BUFFER_SIZE:
+       {
+               if (copy_to_user((void __user *) arg, &s->buf_size,
+                                sizeof(s->buf_size)))
+                       ret = -EFAULT;
+               break;
+       }
        default:
                ret = -EINVAL;
        }
index cf34733..d97d58c 100644 (file)
@@ -43,6 +43,7 @@ struct tegra_dtv_hw_config {
                                           const struct tegra_dtv_hw_config *)
 #define TEGRA_DTV_IOCTL_GET_HW_CONFIG  _IOR(TEGRA_DTV_MAGIC, 3,                \
                                           struct tegra_dtv_hw_config *)
+#define TEGRA_DTV_IOCTL_GET_BUFFER_SIZE _IOR(TEGRA_DTV_MAGIC, 4, int *)
 
 /**
  * clock edge settings for clk_edge