diff options
author | Naren Bhat <nbhat@nvidia.com> | 2012-05-16 18:49:21 -0700 |
---|---|---|
committer | Rohan Somvanshi <rsomvanshi@nvidia.com> | 2012-06-14 07:40:29 -0700 |
commit | 3d567f08f468a496b4d1997151abd04896d0be7b (patch) | |
tree | 7a5e37a986367531be79f3e87e34285f9a6f20ad /drivers/media/video | |
parent | 98953006c8ee5b30bc80774ca1b14d80273d3fb8 (diff) |
media: video: tegra: ar0832: Make focuser range, slew rate tunable
The range parameters & slew rate from the blocks-camera are being passed
down to ODM and then to kernel. Generic structure added for sharing
the data between ODM and kernel instead of specific structure.
Bug 954874
Change-Id: I84656e36a5a2721c007de78aa5c20f5dfeb00361
Signed-off-by: Naren Bhat <nbhat@nvidia.com>
Reviewed-on: http://git-master/r/102077
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Jon Mayo <jmayo@nvidia.com>
Diffstat (limited to 'drivers/media/video')
-rw-r--r-- | drivers/media/video/tegra/ar0832_main.c | 41 |
1 files changed, 33 insertions, 8 deletions
diff --git a/drivers/media/video/tegra/ar0832_main.c b/drivers/media/video/tegra/ar0832_main.c index f3b56bbf847e..8f75527415a7 100644 --- a/drivers/media/video/tegra/ar0832_main.c +++ b/drivers/media/video/tegra/ar0832_main.c @@ -23,9 +23,11 @@ #include <linux/regulator/consumer.h> #include <media/ar0832_main.h> -#define POS_LOW 0 -#define POS_HIGH 1000 -#define SETTLETIME_MS 100 +#define POS_ACTUAL_LOW 0 +#define POS_ACTUAL_HIGH 255 +#define SETTLE_TIME 100 +#define SLEW_RATE_DEFAULT 1 + struct ar0832_sensor_info { int mode; @@ -33,7 +35,7 @@ struct ar0832_sensor_info { }; struct ar0832_focuser_info { - struct ar0832_focuser_config config; + struct nv_focuser_config config; int focuser_init_flag; u16 last_position; }; @@ -2160,7 +2162,8 @@ static long ar0832_ioctl(struct file *file, "%s AR0832_FOCUSER_IOCTL_GET_CONFIG\n", __func__); if (copy_to_user((void __user *) arg, &dev->focuser_info->config, - sizeof(dev->focuser_info->config))) { + sizeof(struct nv_focuser_config))) + { dev_err(&i2c_client->dev, "%s: AR0832_FOCUSER_IOCTL_GET_CONFIG failed\n", __func__); @@ -2168,6 +2171,25 @@ static long ar0832_ioctl(struct file *file, } return 0; + case AR0832_FOCUSER_IOCTL_SET_CONFIG: + dev_info(&i2c_client->dev, + "%s AR0832_FOCUSER_IOCTL_SET_CONFIG\n", __func__); + if (copy_from_user(&dev->focuser_info->config, + (const void __user *)arg, + sizeof(struct nv_focuser_config))) + { + dev_err(&i2c_client->dev, + "%s: AR0832_FOCUSER_IOCTL_SET_CONFIG failed\n", __func__); + return -EFAULT; + } + dev_dbg(&i2c_client->dev, + "%s AR0832_FOCUSER_IOCTL_SET_CONFIG sucess " + "slew_rate %i, pos_working_high %i, pos_working_low %i\n", + __func__, dev->focuser_info->config.slew_rate, + dev->focuser_info->config.pos_working_low, + dev->focuser_info->config.pos_working_high); + return 0; + case AR0832_FOCUSER_IOCTL_SET_POSITION: dev_dbg(&i2c_client->dev, "%s AR0832_FOCUSER_IOCTL_SET_POSITION\n", __func__); @@ -2443,9 +2465,12 @@ static int ar0832_probe(struct i2c_client *client, dev->i2c_client = client; /* focuser */ - dev->focuser_info->config.settle_time = SETTLETIME_MS; - dev->focuser_info->config.pos_low = POS_LOW; - dev->focuser_info->config.pos_high = POS_HIGH; + dev->focuser_info->config.settle_time = SETTLE_TIME; + dev->focuser_info->config.slew_rate = SLEW_RATE_DEFAULT; + dev->focuser_info->config.pos_actual_low = POS_ACTUAL_LOW; + dev->focuser_info->config.pos_actual_high = POS_ACTUAL_HIGH; + dev->focuser_info->config.pos_working_low = POS_ACTUAL_LOW; + dev->focuser_info->config.pos_working_high = POS_ACTUAL_HIGH; snprintf(dev->dname, sizeof(dev->dname), "%s-%s", id->name, dev->pdata->id); |