summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--drivers/media/platform/tegra/as364x.c35
-rw-r--r--drivers/media/platform/tegra/cam_dev/of_camera.c17
-rw-r--r--drivers/media/platform/tegra/cam_dev/virtual.c89
-rw-r--r--drivers/media/platform/tegra/camera.c100
-rw-r--r--drivers/media/platform/tegra/dw9718.c34
-rw-r--r--include/media/camera.h76
-rw-r--r--include/media/nvc.h13
7 files changed, 240 insertions, 124 deletions
diff --git a/drivers/media/platform/tegra/as364x.c b/drivers/media/platform/tegra/as364x.c
index eba3238ad899..0eb4ed250780 100644
--- a/drivers/media/platform/tegra/as364x.c
+++ b/drivers/media/platform/tegra/as364x.c
@@ -32,6 +32,7 @@
#include <linux/sysedp.h>
#include <linux/regmap.h>
#include <media/nvc.h>
+#include <media/camera.h>
#include <media/as364x.h>
/* #define DEBUG_I2C_TRAFFIC */
@@ -975,9 +976,15 @@ static int as364x_user_get_param(struct as364x_info *info, long arg)
int err = 0;
u8 reg;
+#ifdef CONFIG_COMPAT
+ memset(&params, 0, sizeof(params));
+ if (copy_from_user(&params, (const void __user *)arg,
+ sizeof(struct nvc_param_32))) {
+#else
if (copy_from_user(&params,
(const void __user *)arg,
sizeof(struct nvc_param))) {
+#endif
dev_err(info->dev,
"%s %d copy_from_user err\n", __func__, __LINE__);
return -EINVAL;
@@ -1071,7 +1078,7 @@ static int as364x_user_get_param(struct as364x_info *info, long arg)
err = -EINVAL;
}
- if (!err && copy_to_user((void __user *)params.p_value,
+ if (!err && copy_to_user(MAKE_USER_PTR(params.p_value),
data_ptr, data_size)) {
dev_err(info->dev, "%s copy_to_user err line %d\n",
__func__, __LINE__);
@@ -1089,7 +1096,7 @@ static int as364x_get_levels(struct as364x_info *info,
struct nvc_torch_timer_capabilities_v1 *p_tm;
u8 op_mode;
- if (copy_from_user(plevels, (const void __user *)params->p_value,
+ if (copy_from_user(plevels, MAKE_CONSTUSER_PTR(params->p_value),
sizeof(*plevels))) {
dev_err(info->dev, "%s %d copy_from_user err\n",
__func__, __LINE__);
@@ -1148,8 +1155,14 @@ static int as364x_user_set_param(struct as364x_info *info, long arg)
int err = 0;
u8 val;
+#ifdef CONFIG_COMPAT
+ memset(&params, 0, sizeof(params));
+ if (copy_from_user(&params, (const void __user *)arg,
+ sizeof(struct nvc_param_32))) {
+#else
if (copy_from_user(
&params, (const void __user *)arg, sizeof(struct nvc_param))) {
+#endif
dev_err(info->dev,
"%s %d copy_from_user err\n", __func__, __LINE__);
return -EINVAL;
@@ -1172,7 +1185,7 @@ static int as364x_user_set_param(struct as364x_info *info, long arg)
led_levels.levels[0], led_levels.levels[1]);
break;
case NVC_PARAM_FLASH_PIN_STATE:
- if (copy_from_user(&val, (const void __user *)params.p_value,
+ if (copy_from_user(&val, MAKE_CONSTUSER_PTR(params.p_value),
sizeof(val))) {
dev_err(info->dev, "%s %d copy_from_user err\n",
__func__, __LINE__);
@@ -1200,14 +1213,20 @@ static long as364x_ioctl(struct file *file,
int pwr;
int err = 0;
- switch (_IOC_NR(cmd)) {
- case _IOC_NR(NVC_IOCTL_PARAM_WR):
+ switch (cmd) {
+ case NVC_IOCTL_PARAM_WR:
+#ifdef CONFIG_COMPAT
+ case NVC_IOCTL_32_PARAM_WR:
+#endif
err = as364x_user_set_param(info, arg);
break;
- case _IOC_NR(NVC_IOCTL_PARAM_RD):
+ case NVC_IOCTL_PARAM_RD:
+#ifdef CONFIG_COMPAT
+ case NVC_IOCTL_32_PARAM_RD:
+#endif
err = as364x_user_get_param(info, arg);
break;
- case _IOC_NR(NVC_IOCTL_PWR_WR):
+ case NVC_IOCTL_PWR_WR:
/* This is a Guaranteed Level of Service (GLOS) call */
pwr = (int)arg * 2;
dev_dbg(info->dev, "%s PWR_WR: %d\n", __func__, pwr);
@@ -1219,7 +1238,7 @@ static long as364x_ioctl(struct file *file,
if (info->pdata->cfg & NVC_CFG_NOERR)
err = 0;
break;
- case _IOC_NR(NVC_IOCTL_PWR_RD):
+ case NVC_IOCTL_PWR_RD:
pwr = info->pwr_state / 2;
dev_dbg(info->dev, "%s PWR_RD: %d\n", __func__, pwr);
if (copy_to_user((void __user *)arg, (const void *)&pwr,
diff --git a/drivers/media/platform/tegra/cam_dev/of_camera.c b/drivers/media/platform/tegra/cam_dev/of_camera.c
index 807c20f7d92c..460ca1a844e8 100644
--- a/drivers/media/platform/tegra/cam_dev/of_camera.c
+++ b/drivers/media/platform/tegra/cam_dev/of_camera.c
@@ -203,17 +203,17 @@ int of_camera_get_property(struct camera_info *cam, unsigned long arg)
int len, i, err = 0;
dev_dbg(cam->dev, "%s %lx", __func__, arg);
- if (copy_from_user(&param, (const void __user *)arg, sizeof(param))) {
- dev_err(cam->dev, "%s copy_from_user err line %d\n",
- __func__, __LINE__);
- return -EFAULT;
+ err = camera_get_params(cam, arg, 0, &param, NULL);
+ if (err) {
+ dev_err(cam->dev, "%s ERROR line %d\n", __func__, __LINE__);
+ return err;
}
if ((param.param & CAMERA_DT_TYPE_MASK) == CAMERA_DT_QUERY) {
param.sizeofvalue = cam_desc->pdata->max_blob_size;
param.variant = cam_desc->pdata->prof_num;
param.param = cam_desc->pdata->mod_num;
- if (copy_to_user((void __user *)arg, &param, sizeof(param))) {
+ if (camera_copy_user_params(arg, &param)) {
dev_err(cam->dev, "%s copy_to_user err line %d\n",
__func__, __LINE__);
return -EFAULT;
@@ -228,8 +228,9 @@ int of_camera_get_property(struct camera_info *cam, unsigned long arg)
return -EBADF;
}
- dev_dbg(cam->dev, "%s params: %x, %x, %x, %d\n", __func__,
- param.param, param.variant, param.p_value, param.sizeofvalue);
+ dev_dbg(cam->dev, "%s params: %x, %x, %p, %d\n",
+ __func__, param.param, param.variant,
+ MAKE_CONSTUSER_PTR(param.p_value), param.sizeofvalue);
/* use bit mask to determine if it's a profile or a module query */
switch (param.param & CAMERA_DT_HANDLE_MASK) {
case CAMERA_DT_HANDLE_PROFILE:
@@ -408,7 +409,7 @@ int of_camera_get_property(struct camera_info *cam, unsigned long arg)
}
get_property_end:
- if (copy_to_user((void __user *)arg, &param, sizeof(param))) {
+ if (camera_copy_user_params(arg, &param)) {
dev_err(cam->dev, "%s copy_to_user err line %d\n",
__func__, __LINE__);
err = -EFAULT;
diff --git a/drivers/media/platform/tegra/cam_dev/virtual.c b/drivers/media/platform/tegra/cam_dev/virtual.c
index ae5a0e3a3c9a..ce20eae86b9f 100644
--- a/drivers/media/platform/tegra/cam_dev/virtual.c
+++ b/drivers/media/platform/tegra/cam_dev/virtual.c
@@ -50,49 +50,10 @@ static int virtual_update(
mutex_lock(&cdev->mutex);
for (idx = 0; idx < num; idx++) {
switch (upd[idx].type) {
- case UPDATE_EDP:
- {
- struct edp_cfg ec;
- struct camera_edp_cfg *pec = &cdev->edpc;
-
- dev_dbg(cdev->dev, "%s UPDATE_EDP config\n", __func__);
- if (pec->edp_client) {
- dev_err(cdev->dev, "edp client already set!\n");
- err = -EEXIST;
- break;
- }
- if (upd[idx].size != sizeof(ec)) {
- dev_err(cdev->dev, "Invalid edp cfg size!\n");
- err = -EINVAL;
- break;
- }
- memset(&ec, 0, sizeof(ec));
- if (copy_from_user(&ec,
- ((const void __user *)
- (unsigned long)upd[idx].arg),
- sizeof(ec))) {
- dev_err(cdev->dev,
- "%s copy_from_user err line %d\n",
- __func__, __LINE__);
- err = -EFAULT;
- break;
- }
- if (ec.num > CAMERA_MAX_EDP_ENTRIES) {
- dev_err(cdev->dev, "too many estate entries!\n");
- err = -E2BIG;
- break;
- }
-
- memcpy(pec->estates, ec.estates,
- ec.num * sizeof(pec->estates[0]));
- pec->num = ec.num;
- camera_edp_register(cdev);
- break;
- }
case UPDATE_CLOCK:
{
struct clk *ck;
- u8 buf[CAMERA_MAX_NAME_LENGTH];
+ char *clk_name;
if (!cdev->num_clk) {
dev_err(cdev->dev, "NO clock needed.\n");
@@ -107,30 +68,19 @@ static int virtual_update(
break;
}
- memset(buf, 0, sizeof(buf));
- if (copy_from_user(buf,
- ((const void __user *)
- (unsigned long)upd[idx].arg),
- sizeof(buf) - 1 < upd[idx].size ?
- sizeof(buf) - 1 : upd[idx].size)) {
- dev_err(cdev->dev,
- "%s copy_from_user err line %d\n",
- __func__, __LINE__);
- err = -EFAULT;
- break;
- }
-
+ clk_name = (void *)upd[idx].args;
dev_dbg(cdev->dev, "%s UPDATE_CLOCK %d of %d, %s\n",
- __func__, upd[idx].index, cdev->num_clk, buf);
- ck = devm_clk_get(cdev->dev, buf);
+ __func__, upd[idx].index,
+ cdev->num_clk, clk_name);
+ ck = devm_clk_get(cdev->dev, clk_name);
if (IS_ERR(ck)) {
dev_err(cdev->dev, "%s: get clock %s FAILED.\n",
- __func__, buf);
+ __func__, clk_name);
return PTR_ERR(ck);
}
cdev->clks[upd[idx].index] = ck;
dev_dbg(cdev->dev, "UPDATE_CLOCK: %d %s\n",
- upd[idx].index, buf);
+ upd[idx].index, clk_name);
break;
}
case UPDATE_PINMUX:
@@ -460,15 +410,36 @@ int virtual_device_add(struct device *dev, unsigned long arg)
int buf_len;
int err = 0;
- dev_info(dev, "%s\n", __func__);
-
+#ifdef CONFIG_COMPAT
+ struct virtual_device_32 dvi32;
+ if (copy_from_user(
+ &dvi32, (const void __user *)arg, sizeof(dvi32))) {
+ dev_err(dev, "%s copy_from_user err line %d\n",
+ __func__, __LINE__);
+ return -EFAULT;
+ }
+ dev_info.power_on = (void *)((unsigned long)dvi32.power_on);
+ dev_info.power_off = (void *)((unsigned long)dvi32.power_off);
+ dev_info.regmap_cfg = dvi32.regmap_cfg;
+ dev_info.bus_type = dvi32.bus_type;
+ dev_info.gpio_num = dvi32.gpio_num;
+ dev_info.reg_num = dvi32.reg_num;
+ dev_info.pwr_on_size = dvi32.pwr_on_size;
+ dev_info.pwr_off_size = dvi32.pwr_off_size;
+ dev_info.clk_num = dvi32.clk_num;
+ memcpy(dev_info.name, dvi32.name, sizeof(dvi32.name));
+ memcpy(dev_info.reg_names, dvi32.reg_names,
+ sizeof(dvi32.reg_names));
+#else
if (copy_from_user(
&dev_info, (const void __user *)arg, sizeof(dev_info))) {
dev_err(dev, "%s copy_from_user err line %d\n",
__func__, __LINE__);
return -EFAULT;
}
+#endif
+ dev_info(dev, "%s\n", __func__);
err = virtual_device_sanity_check(dev, &dev_info, &buf_len);
if (err)
return err;
diff --git a/drivers/media/platform/tegra/camera.c b/drivers/media/platform/tegra/camera.c
index 41bf7b478b61..2542f4210de6 100644
--- a/drivers/media/platform/tegra/camera.c
+++ b/drivers/media/platform/tegra/camera.c
@@ -112,18 +112,47 @@ static void camera_ref_lock(void)
} while (true);
}
-static int camera_get_params(
+#ifdef CONFIG_COMPAT
+int camera_copy_user_params(unsigned long arg, struct nvc_param *prm)
+{
+ struct nvc_param_32 p32;
+
+ memcpy(&p32, prm, sizeof(p32));
+ p32.p_value = (u32)prm->p_value;
+
+ return copy_to_user(
+ (void __user *)arg, (const void *)&p32, sizeof(p32));
+}
+#else
+int camera_copy_user_params(unsigned long arg, struct nvc_param *prm)
+{
+ return copy_to_user(
+ MAKE_USER_PTR(arg), (const void *)prm, sizeof(*prm));
+}
+#endif
+
+int camera_get_params(
struct camera_info *cam, unsigned long arg, int u_size,
struct nvc_param *prm, void **data)
{
void *buf;
unsigned size;
+#ifdef CONFIG_COMPAT
+ memset(prm, 0, sizeof(*prm));
+ if (copy_from_user(
+ prm, (const void __user *)arg, sizeof(struct nvc_param_32))) {
+ dev_err(cam->dev, "%s copy_from_user err line %d\n",
+ __func__, __LINE__);
+ return -EFAULT;
+ }
+#else
if (copy_from_user(prm, (const void __user *)arg, sizeof(*prm))) {
dev_err(cam->dev, "%s copy_from_user err line %d\n",
__func__, __LINE__);
return -EFAULT;
}
+#endif
if (!data)
return 0;
@@ -256,8 +285,7 @@ seq_wr_table:
}
seq_wr_upd:
- if (copy_to_user((void __user *)arg,
- (const void *)&params, sizeof(params))) {
+ if (camera_copy_user_params(arg, &params)) {
dev_err(cam->dev, "%s copy_to_user err line %d\n",
__func__, __LINE__);
err = -EFAULT;
@@ -650,7 +678,7 @@ static int camera_layout_get(struct camera_info *cam, unsigned long arg)
param.sizeofvalue = len;
param.variant = cam_desc.size_layout;
- if (copy_to_user((void __user *)arg, &param, sizeof(param))) {
+ if (camera_copy_user_params(arg, &param)) {
dev_err(cam->dev, "%s copy_to_user err line %d\n",
__func__, __LINE__);
err = -EFAULT;
@@ -801,56 +829,88 @@ static long camera_ioctl(struct file *file,
}
/* command distributor */
- switch (_IOC_NR(cmd)) {
- case _IOC_NR(PCLLK_IOCTL_CHIP_REG):
+ switch (cmd) {
+ case PCLLK_IOCTL_CHIP_REG:
err = virtual_device_add(cam_desc.dev, arg);
break;
- case _IOC_NR(PCLLK_IOCTL_DEV_REG):
+ case PCLLK_IOCTL_DEV_REG:
err = camera_new_device(cam, arg);
break;
- case _IOC_NR(PCLLK_IOCTL_DEV_DEL):
+ case PCLLK_IOCTL_DEV_DEL:
mutex_lock(cam_desc.d_mutex);
list_del(&cam->cdev->list);
mutex_unlock(cam_desc.d_mutex);
camera_remove_device(cam->cdev, true);
break;
- case _IOC_NR(PCLLK_IOCTL_DEV_FREE):
+ case PCLLK_IOCTL_DEV_FREE:
err = camera_free_device(cam, arg);
break;
- case _IOC_NR(PCLLK_IOCTL_SEQ_WR):
+ case PCLLK_IOCTL_SEQ_WR:
err = camera_seq_wr(cam, arg);
break;
- case _IOC_NR(PCLLK_IOCTL_SEQ_RD):
+ case PCLLK_IOCTL_SEQ_RD:
err = camera_seq_rd(cam, arg);
break;
- case _IOC_NR(PCLLK_IOCTL_PARAM_RD):
+ case PCLLK_IOCTL_PARAM_RD:
/* err = camera_param_rd(cam, arg); */
break;
- case _IOC_NR(PCLLK_IOCTL_PWR_WR):
+ case PCLLK_IOCTL_PWR_WR:
/* This is a Guaranteed Level of Service (GLOS) call */
err = camera_dev_pwr_set(cam, arg);
break;
- case _IOC_NR(PCLLK_IOCTL_PWR_RD):
+ case PCLLK_IOCTL_PWR_RD:
err = camera_dev_pwr_get(cam, arg);
break;
- case _IOC_NR(PCLLK_IOCTL_UPDATE):
+ case PCLLK_IOCTL_UPDATE:
+ err = camera_update(cam, arg);
+ break;
+ case PCLLK_IOCTL_LAYOUT_WR:
+ err = camera_layout_update(cam, arg);
+ break;
+ case PCLLK_IOCTL_LAYOUT_RD:
+ err = camera_layout_get(cam, arg);
+ break;
+ case PCLLK_IOCTL_DRV_ADD:
+ err = camera_add_drivers(cam, arg);
+ break;
+ case PCLLK_IOCTL_DT_GET:
+ err = of_camera_get_property(cam, arg);
+ break;
+ case PCLLK_IOCTL_MSG:
+ err = camera_msg(cam, arg);
+ break;
+#ifdef CONFIG_COMPAT
+ case PCLLK_IOCTL_32_CHIP_REG:
+ err = virtual_device_add(cam_desc.dev, arg);
+ break;
+ case PCLLK_IOCTL_32_SEQ_WR:
+ err = camera_seq_wr(cam, arg);
+ break;
+ case PCLLK_IOCTL_32_SEQ_RD:
+ err = camera_seq_rd(cam, arg);
+ break;
+ case PCLLK_IOCTL_32_PARAM_RD:
+ /* err = camera_param_rd(cam, arg); */
+ break;
+ case PCLLK_IOCTL_32_UPDATE:
err = camera_update(cam, arg);
break;
- case _IOC_NR(PCLLK_IOCTL_LAYOUT_WR):
+ case PCLLK_IOCTL_32_LAYOUT_WR:
err = camera_layout_update(cam, arg);
break;
- case _IOC_NR(PCLLK_IOCTL_LAYOUT_RD):
+ case PCLLK_IOCTL_32_LAYOUT_RD:
err = camera_layout_get(cam, arg);
break;
- case _IOC_NR(PCLLK_IOCTL_DRV_ADD):
+ case PCLLK_IOCTL_32_DRV_ADD:
err = camera_add_drivers(cam, arg);
break;
- case _IOC_NR(PCLLK_IOCTL_DT_GET):
+ case PCLLK_IOCTL_32_DT_GET:
err = of_camera_get_property(cam, arg);
break;
- case _IOC_NR(PCLLK_IOCTL_MSG):
+ case PCLLK_IOCTL_32_MSG:
err = camera_msg(cam, arg);
break;
+#endif
default:
dev_err(cam->dev, "%s unsupported ioctl: %x\n",
__func__, cmd);
diff --git a/drivers/media/platform/tegra/dw9718.c b/drivers/media/platform/tegra/dw9718.c
index a9a1ab6b56c5..1bf511ef214f 100644
--- a/drivers/media/platform/tegra/dw9718.c
+++ b/drivers/media/platform/tegra/dw9718.c
@@ -433,7 +433,7 @@ static int dw9718_set_focuser_capabilities(struct dw9718_info *info,
{
dev_dbg(&info->i2c_client->dev, "%s\n", __func__);
if (copy_from_user(&info->nv_config,
- (const void __user *)params->p_value,
+ MAKE_CONSTUSER_PTR(params->p_value),
sizeof(struct nv_focuser_config))) {
dev_err(&info->i2c_client->dev,
"%s Error: copy_from_user bytes %d\n",
@@ -462,9 +462,15 @@ static int dw9718_param_rd(struct dw9718_info *info, unsigned long arg)
u32 data_size = 0;
dev_dbg(&info->i2c_client->dev, "%s %lx\n", __func__, arg);
+#ifdef CONFIG_COMPAT
+ memset(&params, 0, sizeof(params));
+ if (copy_from_user(&params, (const void __user *)arg,
+ sizeof(struct nvc_param_32))) {
+#else
if (copy_from_user(&params,
(const void __user *)arg,
sizeof(struct nvc_param))) {
+#endif
dev_err(&info->i2c_client->dev, "%s %d copy_from_user err\n",
__func__, __LINE__);
return -EFAULT;
@@ -525,7 +531,7 @@ static int dw9718_param_rd(struct dw9718_info *info, unsigned long arg)
__func__, params.sizeofvalue, data_size, params.param);
return -EINVAL;
}
- if (copy_to_user((void __user *)params.p_value, data_ptr, data_size)) {
+ if (copy_to_user(MAKE_USER_PTR(params.p_value), data_ptr, data_size)) {
dev_err(&info->i2c_client->dev, "%s copy_to_user err line %d\n",
__func__, __LINE__);
return -EFAULT;
@@ -570,15 +576,21 @@ static int dw9718_param_wr(struct dw9718_info *info, unsigned long arg)
u8 u8val;
s32 s32val;
int err = 0;
+#ifdef CONFIG_COMPAT
+ memset(&params, 0, sizeof(params));
+ if (copy_from_user(&params, (const void __user *)arg,
+ sizeof(struct nvc_param_32))) {
+#else
if (copy_from_user(&params, (const void __user *)arg,
sizeof(struct nvc_param))) {
+#endif
dev_err(&info->i2c_client->dev,
"%s copy_from_user err line %d\n",
__func__, __LINE__);
return -EFAULT;
}
if (copy_from_user(&s32val,
- (const void __user *)params.p_value, sizeof(s32val))) {
+ MAKE_CONSTUSER_PTR(params.p_value), sizeof(s32val))) {
dev_err(&info->i2c_client->dev, "%s %d copy_from_user err\n",
__func__, __LINE__);
return -EFAULT;
@@ -681,22 +693,28 @@ static long dw9718_ioctl(struct file *file,
struct dw9718_info *info = file->private_data;
int pwr;
int err = 0;
- switch (_IOC_NR(cmd)) {
- case _IOC_NR(NVC_IOCTL_PARAM_WR):
+ switch (cmd) {
+ case NVC_IOCTL_PARAM_WR:
+#ifdef CONFIG_COMPAT
+ case NVC_IOCTL_32_PARAM_WR:
+#endif
dw9718_pm_dev_wr(info, NVC_PWR_ON);
err = dw9718_param_wr(info, arg);
return err;
- case _IOC_NR(NVC_IOCTL_PARAM_RD):
+ case NVC_IOCTL_PARAM_RD:
+#ifdef CONFIG_COMPAT
+ case NVC_IOCTL_32_PARAM_RD:
+#endif
err = dw9718_param_rd(info, arg);
return err;
- case _IOC_NR(NVC_IOCTL_PWR_WR):
+ case NVC_IOCTL_PWR_WR:
/* This is a Guaranteed Level of Service (GLOS) call */
pwr = (int)arg * 2;
dev_dbg(&info->i2c_client->dev, "%s PWR_WR: %d\n",
__func__, pwr);
err = dw9718_pm_dev_wr(info, pwr);
return err;
- case _IOC_NR(NVC_IOCTL_PWR_RD):
+ case NVC_IOCTL_PWR_RD:
if (info->s_mode == NVC_SYNC_SLAVE)
pwr = info->s_info->pwr_dev;
else
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 *);
diff --git a/include/media/nvc.h b/include/media/nvc.h
index d5c5fbce30a4..bcbe7afcd9e1 100644
--- a/include/media/nvc.h
+++ b/include/media/nvc.h
@@ -27,13 +27,22 @@
#define NVC_INT2FLOAT_DIVISOR_1M 1000000
#define NVC_INT2FLOAT_DIVISOR 1000
-struct nvc_param {
+struct nvc_param_32 {
__u32 param;
__u32 sizeofvalue;
__u32 variant;
+ __u32 variant2;
__u32 p_value;
} __packed;
+struct nvc_param {
+ __u32 param;
+ __u32 sizeofvalue;
+ __u32 variant;
+ __u32 variant2;
+ void *p_value;
+} __packed;
+
enum nvc_params {
NVC_PARAM_EXPOSURE = 0,
NVC_PARAM_GAIN,
@@ -171,7 +180,9 @@ enum nvc_params_isp {
#define NVC_IOCTL_PWR_WR _IOW('o', 102, int)
#define NVC_IOCTL_PWR_RD _IOW('o', 103, int)
#define NVC_IOCTL_PARAM_WR _IOW('o', 104, struct nvc_param)
+#define NVC_IOCTL_32_PARAM_WR _IOW('o', 104, struct nvc_param_32)
#define NVC_IOCTL_PARAM_RD _IOWR('o', 105, struct nvc_param)
+#define NVC_IOCTL_32_PARAM_RD _IOWR('o', 105, struct nvc_param_32)
#define NVC_IOCTL_PARAM_ISP_RD _IOWR('o', 200, struct nvc_param_isp)
#define NVC_IOCTL_PARAM_ISP_WR _IOWR('o', 201, struct nvc_param_isp)
#define NVC_IOCTL_FUSE_ID _IOWR('o', 202, struct nvc_fuseid)