From 1c76aa6b9100340e2b016d2f8fff7cf781c4d17b Mon Sep 17 00:00:00 2001 From: Wooyeon Kim Date: Fri, 25 Jan 2019 16:20:38 +0900 Subject: [PATCH] [COMMON] fimc-is2: fix some wrong print of DW9839 actual position - if ADC_MSB register is read wrong, wrong actual position is caculated PR JIRA ID: CPR-624 Change-Id: Ib9c0e94729cc08f005df1297a8a0b9f414c4faee Signed-off-by: Wooyeon Kim --- .../module_framework/actuator/fimc-is-actuator-dw9839.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/media/platform/exynos/fimc-is2/sensor/module_framework/actuator/fimc-is-actuator-dw9839.c b/drivers/media/platform/exynos/fimc-is2/sensor/module_framework/actuator/fimc-is-actuator-dw9839.c index d07f7063c779..f3afbb6eb8b5 100644 --- a/drivers/media/platform/exynos/fimc-is2/sensor/module_framework/actuator/fimc-is-actuator-dw9839.c +++ b/drivers/media/platform/exynos/fimc-is2/sensor/module_framework/actuator/fimc-is-actuator-dw9839.c @@ -540,7 +540,8 @@ int sensor_dw9839_actuator_get_actual_position(struct v4l2_subdev *subdev, u32 * if (ret < 0) goto p_err; - adc_pos = (pos_msb << 8) | pos_lsb; + /* pos_msb uses [1:0] bit */ + adc_pos = ((pos_msb & 0x3) << 8) | pos_lsb; /* convert adc_pos to 10bit position * ncal <= adc_pos <= pcal ------> 0 <= 10bit_pos <= 1023 @@ -551,8 +552,8 @@ int sensor_dw9839_actuator_get_actual_position(struct v4l2_subdev *subdev, u32 * if (*info > 1023) *info = 1023; - dbg_actuator("%s: pcal(%d), ncal(%d), adc_pos(%d) --> target_pos(%d) actual pos(%d)\n", - __func__, actuator_info->pcal, actuator_info->ncal, adc_pos, + dbg_actuator("%s: cal(p:%d, n:%d), adc_pos(msb:%d, lsb:%d, sum:%d) -> target_pos(%d) actual pos(%d)\n", + __func__, actuator_info->pcal, actuator_info->ncal, pos_msb & 0x3, pos_lsb, adc_pos, actuator->position, *info); #ifdef DEBUG_ACTUATOR_TIME -- 2.20.1