diff options
author | Naren Bhat <nbhat@nvidia.com> | 2012-08-20 12:39:16 -0700 |
---|---|---|
committer | Simone Willett <swillett@nvidia.com> | 2012-08-21 19:50:23 -0700 |
commit | a83be233254b0f8c85aa4c8d0aa33fd3071ec962 (patch) | |
tree | 40382c219f2026a3357e4b91d82aa7ade3ca5362 | |
parent | be0628b0eec72d488503b155d45429c660f37ec9 (diff) |
media: video: tegra: ar0832: Add slew rate support
Add slew rate support for AR0832 focuser.
bug 1028733
Change-Id: I4fd0245fad7f7c820fc30a7c4bfc970d52903da6
Signed-off-by: Naren Bhat <nbhat@nvidia.com>
Reviewed-on: http://git-master/r/124695
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Jon Mayo <jmayo@nvidia.com>
Reviewed-by: Frank Chen <frankc@nvidia.com>
Reviewed-by: Dan Willemsen <dwillemsen@nvidia.com>
-rw-r--r-- | drivers/media/video/tegra/ar0832_main.c | 23 | ||||
-rw-r--r-- | include/media/nvc_focus.h | 8 |
2 files changed, 27 insertions, 4 deletions
diff --git a/drivers/media/video/tegra/ar0832_main.c b/drivers/media/video/tegra/ar0832_main.c index ea8dfddf10d0..b1f43da22ec8 100644 --- a/drivers/media/video/tegra/ar0832_main.c +++ b/drivers/media/video/tegra/ar0832_main.c @@ -23,10 +23,12 @@ #include <linux/regulator/consumer.h> #include <media/ar0832_main.h> + #define POS_ACTUAL_LOW 0 #define POS_ACTUAL_HIGH 255 #define SETTLE_TIME 100 -#define SLEW_RATE_DEFAULT 1 +#define AR0832_SLEW_RATE_DISABLED 0 +#define AR0832_SLEW_RATE_SLOWEST 7 struct ar0832_sensor_info { @@ -1930,13 +1932,26 @@ static int ar0832_focuser_set_config(struct ar0832_dev *dev) struct i2c_client *i2c_client = dev->i2c_client; struct ar0832_reg reg_vcm_ctrl, reg_vcm_step_time; int ret = 0; - u8 vcm_slew = 1; + u8 vcm_slew; + u16 vcm_control_data; + u16 vcm_step_time = 1024; + + /* slew_rate of disabled (0) or default value (1) will disable */ + /* the slew rate in this case. Any value of 2 onwards will enable */ + /* the slew rate to a different degree */ + if (dev->focuser_info->config.slew_rate == SLEW_RATE_DISABLED || + dev->focuser_info->config.slew_rate == SLEW_RATE_DEFAULT) + vcm_slew = AR0832_SLEW_RATE_DISABLED; + else + vcm_slew = dev->focuser_info->config.slew_rate - 1; + + if (vcm_slew > AR0832_SLEW_RATE_SLOWEST) + vcm_slew = AR0832_SLEW_RATE_SLOWEST; /* bit15(0x80) means that VCM driver enable bit. */ /* bit3(0x08) means that keep VCM(AF position) */ /* while sensor is in soft standby mode during mode transitions. */ - u16 vcm_control_data = (0x80 << 8 | (0x08 | (vcm_slew & 0x07))); - u16 vcm_step_time = 1024; + vcm_control_data = (0x80 << 8 | (0x08 | (vcm_slew & 0x07))); ar0832_get_focuser_vcm_control_regs(®_vcm_ctrl, vcm_control_data); ret = ar0832_write_reg16(dev->i2c_client, reg_vcm_ctrl.addr, diff --git a/include/media/nvc_focus.h b/include/media/nvc_focus.h index e37d897d8323..2c60db318da2 100644 --- a/include/media/nvc_focus.h +++ b/include/media/nvc_focus.h @@ -35,6 +35,14 @@ #define AF_POS_INVALID_VALUE INT_MAX +/* These are the slew rate values coming down from the configuration */ +/* Disabled is the same as fastest. Default is the default */ +/* slew rate configuration in the focuser */ +#define SLEW_RATE_DISABLED 0 +#define SLEW_RATE_DEFAULT 1 +#define SLEW_RATE_SLOWEST 9 + + enum nvc_focus_sts { NVC_FOCUS_STS_UNKNOWN = 1, NVC_FOCUS_STS_NO_DEVICE, |