msm: camera: shut down master clock for eeprom in power down
TXCO counter is not increment due to improper shutdown of the master clock.
Therefore, in this patch we ensure to shutdown the master clock properly.
Change-Id: I0366211a0faabee64d3126f0e93e47ba1aa7af4f
CRs-Fixed: 594203
Signed-off-by: Aditya Jonnalagadda <ajonnala@codeaurora.org>
diff --git a/drivers/media/platform/msm/camera_v2/sensor/io/msm_camera_dt_util.c b/drivers/media/platform/msm/camera_v2/sensor/io/msm_camera_dt_util.c
index 1fb113d..cc301ae 100644
--- a/drivers/media/platform/msm/camera_v2/sensor/io/msm_camera_dt_util.c
+++ b/drivers/media/platform/msm/camera_v2/sensor/io/msm_camera_dt_util.c
@@ -356,7 +356,8 @@
struct msm_sensor_power_setting *ps;
struct msm_sensor_power_setting *power_setting;
- uint16_t *power_setting_size;
+ uint16_t *power_setting_size, size = 0;
+ bool need_reverse = 0;
if (!power_info)
return -EINVAL;
@@ -508,6 +509,39 @@
i, ps[i].delay);
}
kfree(array);
+
+ size = *power_setting_size;
+
+ if (NULL != ps && 0 != size)
+ need_reverse = 1;
+
+ power_info->power_down_setting =
+ kzalloc(sizeof(*ps) * size, GFP_KERNEL);
+
+ if (!power_info->power_down_setting) {
+ pr_err("%s failed %d\n", __func__, __LINE__);
+ rc = -ENOMEM;
+ goto ERROR1;
+ }
+
+ memcpy(power_info->power_down_setting,
+ ps, sizeof(*ps) * size);
+
+ power_info->power_down_setting_size = size;
+
+ if (need_reverse) {
+ int c, end = size - 1;
+ struct msm_sensor_power_setting power_down_setting_t;
+ for (c = 0; c < size/2; c++) {
+ power_down_setting_t =
+ power_info->power_down_setting[c];
+ power_info->power_down_setting[c] =
+ power_info->power_down_setting[end];
+ power_info->power_down_setting[end] =
+ power_down_setting_t;
+ end--;
+ }
+ }
return rc;
ERROR2:
kfree(array);