diff options
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/media/video/tegra/ar0832_main.c | 23 |
1 files changed, 19 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, |