summaryrefslogtreecommitdiff
path: root/drivers/media/i2c
diff options
context:
space:
mode:
authorSuprith Malligere Shankaregowda <supgow@codeaurora.org>2018-03-14 22:28:24 +0530
committerGerrit - the friendly Code Review server <code-review@localhost>2018-03-19 21:37:22 -0700
commit6a45766c6df20bcac811bb33a9ffe816e38cbef9 (patch)
tree04683c488186ba53600d17f9fc84dfb15c07b763 /drivers/media/i2c
parentd99718532dba3d82158739ba43a21c728356500e (diff)
adv7481: Add early error returns
In boards without adv7481 chip present, there is a huge boot time impact due to long time taken by probe failure because of I2C communication failures. Add early returns in case of error, to minimize the impact. Change-Id: I74643ec8e35e16ba93b795cccd8c709c8e530889 Signed-off-by: Suprith Malligere Shankaregowda <supgow@codeaurora.org>
Diffstat (limited to 'drivers/media/i2c')
-rw-r--r--drivers/media/i2c/adv7481.c31
1 files changed, 22 insertions, 9 deletions
diff --git a/drivers/media/i2c/adv7481.c b/drivers/media/i2c/adv7481.c
index aa9dcc67c66c..ce321e9883d3 100644
--- a/drivers/media/i2c/adv7481.c
+++ b/drivers/media/i2c/adv7481.c
@@ -741,18 +741,12 @@ static int adv7481_dev_init(struct adv7481_state *state)
mutex_lock(&state->mutex);
- /* Soft reset */
- ret = adv7481_wr_byte(&state->i2c_client, state->i2c_io_addr,
- IO_REG_MAIN_RST_ADDR, IO_REG_MAIN_RST_VALUE);
- /* Delay required following I2C reset and I2C transactions */
- udelay(I2C_SW_RST_DELAY);
-
chip_rev_id = adv7481_rd_word(&state->i2c_client, state->i2c_io_addr,
IO_REG_CHIP_REV_ID_1_ADDR);
pr_debug("%s: ADV7481 chip rev id: 0x%x", __func__, chip_rev_id);
/* Disable CEC wake up in power-down mode */
- ret |= adv7481_cec_wakeup(state, 0);
+ ret = adv7481_cec_wakeup(state, 0);
/* Setting Vid_Std to 720x480p60 */
ret |= adv7481_wr_byte(&state->i2c_client, state->i2c_io_addr,
IO_REG_CP_VID_STD_ADDR, 0x4A);
@@ -2316,7 +2310,12 @@ static int adv7481_init_v4l2_controls(struct adv7481_state *state)
{
int ret = 0;
- v4l2_ctrl_handler_init(&state->ctrl_hdl, 4);
+ ret = v4l2_ctrl_handler_init(&state->ctrl_hdl, 4);
+ if (ret) {
+ pr_err("%s: v4l2_ctrl_handler_init failed, ret: %d\n",
+ __func__, ret);
+ return ret;
+ }
v4l2_ctrl_new_std(&state->ctrl_hdl, &adv7481_ctrl_ops,
V4L2_CID_BRIGHTNESS, -128, 127, 1, 0);
@@ -2333,7 +2332,10 @@ static int adv7481_init_v4l2_controls(struct adv7481_state *state)
v4l2_ctrl_handler_free(&state->ctrl_hdl);
} else {
- v4l2_ctrl_handler_setup(&state->ctrl_hdl);
+ ret = v4l2_ctrl_handler_setup(&state->ctrl_hdl);
+ if (ret)
+ pr_err("%s: v4l2_ctrl_handler_init failed, ret: %d\n",
+ __func__, ret);
}
pr_err("%s: Exit with ret: %d\n", __func__, ret);
@@ -2573,11 +2575,22 @@ static int adv7481_probe(struct platform_device *pdev)
goto err_media_entity;
}
+ /* Soft reset */
+ ret = adv7481_wr_byte(&state->i2c_client, state->i2c_io_addr,
+ IO_REG_MAIN_RST_ADDR, IO_REG_MAIN_RST_VALUE);
+ if (ret) {
+ pr_err("%s: Failed Soft reset %d\n", __func__, ret);
+ goto err_media_entity;
+ }
+ /* Delay required following I2C reset and I2C transactions */
+ udelay(I2C_SW_RST_DELAY);
+
/* Register V4l2 Control Functions */
ret = adv7481_init_v4l2_controls(state);
if (ret) {
pr_err("%s: V4L2 Controls Initialisation Failed %d\n",
__func__, ret);
+ goto err_media_entity;
}
/* Initial ADV7481 State Settings */