Commit 3560f6dc authored by 吴智聪(John Wu)'s avatar 吴智聪(John Wu)

clean up code and fix some typo in vpfe and tvp7000 code

parent a5555708
This diff is collapsed.
......@@ -521,7 +521,7 @@ static int tvp7000_detect_client(struct i2c_adapter *adapter,
static inline int tvp7000_read_reg(u8 reg);
static inline int tvp7000_write_reg(u8 reg, u8 value);
static int tvp7000_setup_video_stardard(const struct tvp7000_video_std *std);
static int tvp7000_setup_video_standard(const struct tvp7000_video_std *std);
static int tvp7000_device_init(struct vpfe_capture_params *params);
static int tvp7000_device_cmd(u32 cmd, void *arg);
......@@ -576,7 +576,8 @@ static int tvp7000_detect_client(struct i2c_adapter *adapter,
FN_IN;
if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_WORD_DATA |
I2C_FUNC_SMBUS_WRITE_BYTE)) {
I2C_FUNC_SMBUS_WRITE_BYTE))
{
DPRINTK("Functionality check failed for %s\n",
client_name);
return err;
......@@ -584,7 +585,8 @@ static int tvp7000_detect_client(struct i2c_adapter *adapter,
tvp7000_client = kmalloc(sizeof(struct i2c_client),
GFP_KERNEL);
if (tvp7000_client == NULL) {
if (tvp7000_client == NULL)
{
err = -ENOMEM;
DPRINTK("Couldn't allocate memory for %s\n",
client_name);
......@@ -599,7 +601,8 @@ static int tvp7000_detect_client(struct i2c_adapter *adapter,
strlcpy(tvp7000_client->name, client_name, I2C_NAME_SIZE);
err = i2c_attach_client(tvp7000_client);
if (err) {
if (err)
{
DPRINTK("Couldn't attach %s\n", client_name);
kfree(tvp7000_client);
return err;
......@@ -622,7 +625,8 @@ static int tvp7000_detach_client(struct i2c_client *client)
FN_IN;
err = i2c_detach_client(client);
if (err) {
if (err)
{
DPRINTK("Client deregistration failed, \
client not detached.\n");
return err;
......@@ -651,8 +655,7 @@ static void tvp7000_device_power_on(bool on)
udelay(5);
}
static int tvp7000_setup_video_stardard(
const struct tvp7000_video_std *std)
static int tvp7000_setup_video_standard(const struct tvp7000_video_std *std)
{
int err = 0;
int val;
......@@ -660,17 +663,13 @@ static int tvp7000_setup_video_stardard(
if (std == NULL)
return -EINVAL;
err |= tvp7000_write_reg(TVP7000_PLL_DIVIDE_MSB,
std->plldiv_msb);
err |= tvp7000_write_reg(TVP7000_PLL_DIVIDE_LSB,
std->plldiv_lsb);
err |= tvp7000_write_reg(TVP7000_PLL_CTRL,
std->pll_ctrl);
err |= tvp7000_write_reg(TVP7000_PLL_DIVIDE_MSB, std->plldiv_msb);
err |= tvp7000_write_reg(TVP7000_PLL_DIVIDE_LSB, std->plldiv_lsb);
err |= tvp7000_write_reg(TVP7000_PLL_CTRL, std->pll_ctrl);
val = tvp7000_read_reg(TVP7000_PHASE_SELECT);
val &= ~0x01;
err |= tvp7000_write_reg(TVP7000_PHASE_SELECT,
(std->phase_select_bit0 & 0x01) | val);
err |= tvp7000_write_reg(TVP7000_PHASE_SELECT, (std->phase_select_bit0 & 0x01) | val);
return err;
}
......@@ -678,7 +677,7 @@ static int tvp7000_setup_video_stardard(
static int tvp7000_selmux(void)
{
if(tvp7000_write_reg(TVP7000_INPUT_MUX_1, 0)) // set channel 1
if (tvp7000_write_reg(TVP7000_INPUT_MUX_1, 0)) // set channel 1
return -1;
return 0;
}
......@@ -687,7 +686,7 @@ static int input_signal_exist(void)
{
int val;
val = tvp7000_read_reg(TVP7000_SYNC_DETECT_STATUS);
if((val & 0x80) && (val & 0x10))
if ((val & 0x80) && (val & 0x10))
{
return 0;
}
......@@ -698,7 +697,8 @@ static int tvp7000_device_cmd(u32 cmd, void *arg)
{
int ret = 0;
switch (cmd) {
switch (cmd)
{
case 0:
case VIDIOC_INT_RESET:
tvp7000_device_init(NULL);
......@@ -716,7 +716,7 @@ static int tvp7000_device_cmd(u32 cmd, void *arg)
int input = *(int *)arg;
if (input == VPFE_AMUX_COMPONENT)
{
if(tvp7000_device_init(NULL))
if (tvp7000_device_init(NULL))
ret = -EBUSY;
}
else
......@@ -730,7 +730,7 @@ static int tvp7000_device_cmd(u32 cmd, void *arg)
if (params->amuxmode == VPFE_AMUX_COMPONENT)
{
ret = tvp7000_setup_video_stardard(STD(VIDEO480P60HZ));
ret = tvp7000_setup_video_standard(STD(VIDEO480P60HZ));
}
else
ret = -1;
......@@ -753,7 +753,7 @@ static int tvp7000_device_init(struct vpfe_capture_params *params)
/* initialize TVP7000 as its default values */
tvp7000_write_inittab(tvp7000_init_default, NUM_OF_REGS(tvp7000_init_default));
tvp7000_write_inittab(tvp7000_init_component, NUM_OF_REGS(tvp7000_init_component));
if(tvp7000_selmux())
if (tvp7000_selmux())
return -1;
return 0;
}
......@@ -804,14 +804,16 @@ static __init int tvp7000_init(void)
break;
}
}
if (err) {
if (err)
{
DPRINTK("I2C driver %s add failed\n",
tvp7000_driver.driver.name);
return err;
}
err = vpfe_capture_device_register(&tvp7000_capture_device);
if (err) {
if (err)
{
DPRINTK("VPFE Capture Device %s register failed\n",
tvp7000_capture_device.name);
return err;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment