Revert "media: video: tegra: sh532u: remove focuser init_pos"
Qinggang Zhou [Tue, 23 Aug 2011 02:51:03 +0000 (19:51 -0700)]
This reverts commit 713b0fe85ab640016918062fed8b62486f88f92e.
The reverted commit removed reading pre-calibrated INF and MAC,
which caused the AF moves focuser to an invalid INF.

The original change is at
http://git-master/r/47657

bug 866141

Original-Change-Id: Ib4c25ea241b6ea06a3abe80cff9c7d9554314948
Reviewed-on: http://git-master/r/48606
Reviewed-by: Qinggang Zhou <qzhou@nvidia.com>
Tested-by: Qinggang Zhou <qzhou@nvidia.com>
Reviewed-by: Gary Zhang <garyz@nvidia.com>
Reviewed-by: Daniel Willemsen <dwillemsen@nvidia.com>

Rebase-Id: Rfebe91eb22e55868463a033f6bd3c945b57decd9

drivers/media/video/tegra/sh532u.c

index 543beed..914f735 100644 (file)
@@ -302,6 +302,19 @@ get_rom_info_error:
        info->config.pos_low = POS_LOW;
 }
 
+static void init_hvca_pos(struct sh532u_sensor *info)
+{
+       struct i2c_client *client = info->i2c_client;
+       short sBottomLimit, sTopLimit;
+
+       get_rom_info(info);
+       sBottomLimit = (((int)info->config.limit_low * 5) >> 3) & 0xFFC0;
+       lens_move_pulse(client, sBottomLimit);
+       sTopLimit = (((int)info->config.limit_high * 5) >> 3) & 0xFFC0;
+       lens_move_pulse(client, sTopLimit);
+       lens_move_pulse(client, info->config.pos_high);
+}
+
 static unsigned int a2buf[] = {
        0x0018019c,
        0x0018019d,
@@ -465,6 +478,9 @@ static void init_driver(struct sh532u_sensor *info)
                        }
                }
        }
+       msleep(300);
+
+       init_hvca_pos(info);
 }