summaryrefslogtreecommitdiff
path: root/include/media/camera.h
diff options
context:
space:
mode:
authorCharlie Huang <chahuang@nvidia.com>2014-07-11 16:19:32 -0700
committerMatthew Pedro <mapedro@nvidia.com>2014-08-20 09:10:37 -0700
commitea448c5d3a6e66559a5c41335c7575218856fe43 (patch)
treee973661bf56425522d1df42bc5b0eaefc741627a /include/media/camera.h
parentff75bfb37ffa80305a080f8ea727f452a5001667 (diff)
media: platform: tegra: support 64 bit user code
Since the user space code may works in either 32 or 64 bit mode, attentions should be taken while passing pointers from user space to the kernel. In this case, the p_value of struct nvc_param and power_on/power_off of struct virtual_device received from the user space should be handled properly. The solution is to create a set of 32 bit version of structures nvc_param and virtual_device along with some dedicated 32 bit mode ioctl commands, then in the ioctl functions, the 32 bit user mode access will be handled separately. bug 1518359 Change-Id: I4cbbeeaef446ab962aaa1f92251ce1fd9d5723aa Signed-off-by: Charlie Huang <chahuang@nvidia.com> Reviewed-on: http://git-master/r/437390 (cherry picked from commit 3fdbc210fc9f33d0f89af079a89bdb1f41e73ecb) Reviewed-on: http://git-master/r/482230 Reviewed-by: Automatic_Commit_Validation_User GVS: Gerrit_Virtual_Submit Reviewed-by: Thomas Cherry <tcherry@nvidia.com>
Diffstat (limited to 'include/media/camera.h')
-rw-r--r--include/media/camera.h76
1 files changed, 56 insertions, 20 deletions
diff --git a/include/media/camera.h b/include/media/camera.h
index a0381f371cc0..568378476fd6 100644
--- a/include/media/camera.h
+++ b/include/media/camera.h
@@ -73,6 +73,23 @@
#define PCLLK_IOCTL_DT_GET _IOWR('o', 160, struct nvc_param)
#define PCLLK_IOCTL_MSG _IOWR('o', 170, struct nvc_param)
+#ifdef CONFIG_COMPAT
+/* IOCTL commands that pass 32 bit pointers from user space.
+ CAUTION: the nr number of these commands MUST be the same value as the
+ nr number of the related normal commands. */
+#define PCLLK_IOCTL_32_CHIP_REG _IOW('o', 100, struct virtual_device_32)
+#define PCLLK_IOCTL_32_SEQ_WR _IOWR('o', 112, struct nvc_param_32)
+#define PCLLK_IOCTL_32_SEQ_RD _IOWR('o', 113, struct nvc_param_32)
+#define PCLLK_IOCTL_32_UPDATE _IOW('o', 116, struct nvc_param_32)
+#define PCLLK_IOCTL_32_LAYOUT_WR _IOW('o', 120, struct nvc_param_32)
+#define PCLLK_IOCTL_32_LAYOUT_RD _IOWR('o', 121, struct nvc_param_32)
+#define PCLLK_IOCTL_32_PARAM_WR _IOWR('o', 140, struct nvc_param_32)
+#define PCLLK_IOCTL_32_PARAM_RD _IOWR('o', 141, struct nvc_param_32)
+#define PCLLK_IOCTL_32_DRV_ADD _IOW('o', 150, struct nvc_param_32)
+#define PCLLK_IOCTL_32_DT_GET _IOWR('o', 160, struct nvc_param_32)
+#define PCLLK_IOCTL_32_MSG _IOWR('o', 170, struct nvc_param_32)
+#endif
+
#define CAMERA_MAX_EDP_ENTRIES 16
#define CAMERA_MAX_NAME_LENGTH 32
#define CAMDEV_INVALID 0xffffffff
@@ -115,29 +132,29 @@ enum {
};
struct camera_device_info {
- u8 name[CAMERA_MAX_NAME_LENGTH];
- u32 type;
- u8 bus;
- u8 addr;
+ __u8 name[CAMERA_MAX_NAME_LENGTH];
+ __u32 type;
+ __u8 bus;
+ __u8 addr;
};
struct camera_reg {
- u32 addr;
- u32 val;
+ __u32 addr;
+ __u32 val;
};
struct regmap_cfg {
int addr_bits;
int val_bits;
- u32 cache_type;
+ __u32 cache_type;
};
struct gpio_cfg {
int gpio;
- u8 own;
- u8 active_high;
- u8 flag;
- u8 reserved;
+ __u8 own;
+ __u8 active_high;
+ __u8 flag;
+ __u8 reserved;
};
struct edp_cfg {
@@ -149,8 +166,8 @@ struct edp_cfg {
#define VIRTUAL_DEV_MAX_GPIOS 8
#define VIRTUAL_REGNAME_SIZE (VIRTUAL_DEV_MAX_REGULATORS * \
CAMERA_MAX_NAME_LENGTH)
-
-struct virtual_device {
+#ifdef CONFIG_COMPAT
+struct virtual_device_32 {
__u32 power_on;
__u32 power_off;
struct regmap_cfg regmap_cfg;
@@ -163,21 +180,36 @@ struct virtual_device {
__u8 name[32];
__u8 reg_names[VIRTUAL_REGNAME_SIZE];
};
+#endif
+
+struct virtual_device {
+ void *power_on;
+ void *power_off;
+ struct regmap_cfg regmap_cfg;
+ __u32 bus_type;
+ __u32 gpio_num;
+ __u32 reg_num;
+ __u32 pwr_on_size;
+ __u32 pwr_off_size;
+ __u32 clk_num;
+ __u8 name[32];
+ __u8 reg_names[VIRTUAL_REGNAME_SIZE];
+};
enum {
UPDATE_PINMUX,
UPDATE_GPIO,
UPDATE_POWER,
UPDATE_CLOCK,
- UPDATE_EDP,
UPDATE_MAX_NUM,
};
struct cam_update {
- u32 type;
- u32 index;
- u32 size;
- u32 arg;
+ __u32 type;
+ __u32 index;
+ __u32 size;
+ __u32 arg;
+ __u32 args[28];
};
enum {
@@ -208,8 +240,8 @@ struct cam_device_layout {
};
struct camera_property_info {
- u8 name[CAMERA_MAX_NAME_LENGTH];
- u32 type;
+ __u8 name[CAMERA_MAX_NAME_LENGTH];
+ __u32 type;
};
#ifdef __KERNEL__
@@ -354,6 +386,10 @@ struct camera_platform_info {
};
/* common functions */
+int camera_get_params(
+ struct camera_info *, unsigned long, int, struct nvc_param *, void **);
+int camera_copy_user_params(unsigned long, struct nvc_param *);
+
int virtual_device_add(struct device *, unsigned long);
int camera_regulator_get(struct device *, struct nvc_regulator *, char *);