forked from jmpfbmx/kernel-4.4
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5f8c1a6
commit 6b28a98
Showing
53 changed files
with
9,279 additions
and
6,231 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -46,11 +46,7 @@ static unsigned long g_u4AF_MACRO = 1023; | |
static unsigned long g_u4TargetPosition; | ||
static unsigned long g_u4CurrPosition; | ||
|
||
extern void AF_TARGET(u16 target); | ||
static DEFINE_MUTEX(main_af_mutex); | ||
#ifdef CONFIG_MEIZU_BSP | ||
extern int camera_main_af_power(int on); | ||
#endif | ||
|
||
static int s4AF_ReadReg(u8 a_uAddr, u16 *a_pu2Result) | ||
{ | ||
int i4RetValue = 0; | ||
|
@@ -81,40 +77,6 @@ static int s4AF_ReadReg(u8 a_uAddr, u16 *a_pu2Result) | |
return 0; | ||
} | ||
|
||
/* Add by meizu BSP [email protected] */ | ||
#ifdef CONFIG_MEIZU_BSP | ||
static int s4AF_ReadReg_w(u8 a_uAddr, u16 *a_pu2Result) | ||
{ | ||
int i4RetValue = 0; | ||
u8 pBuff[2]; | ||
char puSendCmd[1]; | ||
|
||
puSendCmd[0] = a_uAddr; | ||
|
||
g_pstAF_I2Cclient->addr = AF_I2C_SLAVE_ADDR; | ||
|
||
g_pstAF_I2Cclient->addr = g_pstAF_I2Cclient->addr >> 1; | ||
|
||
i4RetValue = i2c_master_send(g_pstAF_I2Cclient, puSendCmd, 1); | ||
|
||
if (i4RetValue < 0) { | ||
LOG_INF("I2C read - send failed!!\n"); | ||
return -1; | ||
} | ||
|
||
i4RetValue = i2c_master_recv(g_pstAF_I2Cclient, pBuff, 2); | ||
|
||
if (i4RetValue < 0) { | ||
LOG_INF("I2C read - recv failed!!\n"); | ||
return -1; | ||
} | ||
*a_pu2Result = ((pBuff[0] & 0xFF) << 2) + ((pBuff[1] >> 6) & 0x3); | ||
|
||
return 0; | ||
} | ||
#endif | ||
/*Add end */ | ||
|
||
static int s4AF_WriteReg(u16 a_u2Addr, u16 a_u2Data) | ||
{ | ||
int i4RetValue = 0; | ||
|
@@ -156,55 +118,7 @@ static inline int getAFInfo(__user stAF_MotorInfo * pstMotorInfo) | |
|
||
return 0; | ||
} | ||
/* Add by meizu BSP [email protected] */ | ||
#ifdef CONFIG_MEIZU_BSP | ||
static int ak7371_enable(struct i2c_client *i2c_client, int on) | ||
{ | ||
g_pstAF_I2Cclient = i2c_client; | ||
if (on) { | ||
camera_main_af_power(1); | ||
usleep_range(10000, 11000); | ||
/* 00:active mode 10:Standby mode x1:Sleep mode */ | ||
s4AF_WriteReg(0x02, 0x00); /* from Standby mode to Active mode */ | ||
msleep(20); | ||
} else { | ||
s4AF_WriteReg(0x02, 0x20); /* from active mode to sleep mode */ | ||
camera_main_af_power(0); | ||
} | ||
|
||
return 0; | ||
} | ||
|
||
static int ak7371_pos_set(struct i2c_client *i2c_client, int position) | ||
{ | ||
int ret = 0; | ||
|
||
g_pstAF_I2Cclient = i2c_client; | ||
|
||
ret = s4AF_WriteReg(0x0, (u16)((position >> 2) & 0xff)); | ||
ret += s4AF_WriteReg(0x1, (u16)((position & 0x3) << 6)); | ||
|
||
if (ret < 0) { | ||
LOG_INF("%s: set reg failed.\n", __func__); | ||
return -EINVAL; | ||
} | ||
|
||
return 0; | ||
} | ||
|
||
static int ak7371_pos_get(struct i2c_client *i2c_client, int *position) | ||
{ | ||
u16 reg_pos = 0; | ||
int ret = 0; | ||
g_pstAF_I2Cclient = i2c_client; | ||
|
||
ret = s4AF_ReadReg_w(0x84, ®_pos); | ||
*position = reg_pos; | ||
|
||
return ret; | ||
} | ||
#endif | ||
/*Add end */ | ||
static inline int setVCMPos(unsigned long a_u4Position) | ||
{ | ||
int i4RetValue = 0; | ||
|
@@ -222,12 +136,10 @@ static inline int setVCMPos(unsigned long a_u4Position) | |
static inline int moveAF(unsigned long a_u4Position) | ||
{ | ||
int ret = 0; | ||
LOG_INF("move main af start\n"); | ||
mutex_lock(&main_af_mutex); | ||
|
||
if ((a_u4Position > g_u4AF_MACRO) || (a_u4Position < g_u4AF_INF)) { | ||
LOG_INF("out of range\n"); | ||
ret = -EINVAL; | ||
goto end; | ||
return -EINVAL; | ||
} | ||
|
||
if (*g_pAF_Opened == 1) { | ||
|
@@ -263,7 +175,7 @@ static inline int moveAF(unsigned long a_u4Position) | |
} | ||
|
||
if (g_u4CurrPosition == a_u4Position) | ||
goto end; | ||
return 0; | ||
|
||
spin_lock(g_pAF_SpinLock); | ||
g_u4TargetPosition = a_u4Position; | ||
|
@@ -280,9 +192,7 @@ static inline int moveAF(unsigned long a_u4Position) | |
} else { | ||
LOG_INF("set I2C failed when moving the motor\n"); | ||
} | ||
end: | ||
mutex_unlock(&main_af_mutex); | ||
LOG_INF("move main af end\n"); | ||
|
||
return 0; | ||
} | ||
|
||
|
@@ -388,21 +298,9 @@ int AK7371AF_PowerDown(void) | |
return 0; | ||
} | ||
|
||
/* Add by meizu BSP [email protected] */ | ||
#ifdef CONFIG_MEIZU_BSP | ||
struct vcm_factory_fops ak7371_main_fops = { | ||
.vcm_enable = ak7371_enable, | ||
.vcm_pos_set = ak7371_pos_set, | ||
.vcm_pos_get = ak7371_pos_get, | ||
}; | ||
#endif | ||
/*Add end */ | ||
|
||
int AK7371AF_SetI2Cclient(struct i2c_client *pstAF_I2Cclient, spinlock_t *pAF_SpinLock, int *pAF_Opened) | ||
void AK7371AF_SetI2Cclient(struct i2c_client *pstAF_I2Cclient, spinlock_t *pAF_SpinLock, int *pAF_Opened) | ||
{ | ||
g_pstAF_I2Cclient = pstAF_I2Cclient; | ||
g_pAF_SpinLock = pAF_SpinLock; | ||
g_pAF_Opened = pAF_Opened; | ||
|
||
return (s4AF_WriteReg(0x02, 0x00) == 0); | ||
} |
13 changes: 0 additions & 13 deletions
13
drivers/misc/mediatek/lens/main/common/bu63165af/OIS_func.c
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 0 additions & 13 deletions
13
drivers/misc/mediatek/lens/main/common/bu63165af/OIS_main.c
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 0 additions & 13 deletions
13
drivers/misc/mediatek/lens/main/common/bu63165af/OIS_user.c
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 0 additions & 13 deletions
13
drivers/misc/mediatek/lens/main/common/bu63165af/inc/OIS_coef.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 0 additions & 13 deletions
13
drivers/misc/mediatek/lens/main/common/bu63165af/inc/OIS_defi.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 0 additions & 13 deletions
13
drivers/misc/mediatek/lens/main/common/bu63165af/inc/OIS_func.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.