From: Michael Krufky Date: Tue, 22 Apr 2008 17:46:05 +0000 (-0300) Subject: V4L/DVB (7380): tuner-simple: warn if tuner can't be probed during attach X-Git-Tag: accepted/tizen/common/20141203.182822~23396^2~295 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=e827931e37295329be0bc0e6c0283bfa4807b8f9;p=platform%2Fkernel%2Flinux-arm64.git V4L/DVB (7380): tuner-simple: warn if tuner can't be probed during attach Signed-off-by: Michael Krufky Signed-off-by: Mauro Carvalho Chehab --- diff --git a/drivers/media/video/tuner-simple.c b/drivers/media/video/tuner-simple.c index b95ed1f..07007d6 100644 --- a/drivers/media/video/tuner-simple.c +++ b/drivers/media/video/tuner-simple.c @@ -987,6 +987,28 @@ struct dvb_frontend *simple_tuner_attach(struct dvb_frontend *fe, return NULL; } + /* If i2c_adap is set, check that the tuner is at the correct address. + * Otherwise, if i2c_adap is NULL, the tuner will be programmed directly + * by the digital demod via calc_regs. + */ + if (i2c_adap != NULL) { + u8 b[1]; + struct i2c_msg msg = { + .addr = i2c_addr, .flags = I2C_M_RD, + .buf = b, .len = 1, + }; + + if (fe->ops.i2c_gate_ctrl) + fe->ops.i2c_gate_ctrl(fe, 1); + + if (1 != i2c_transfer(i2c_adap, &msg, 1)) + tuner_warn("unable to probe %s, proceeding anyway.", + tuners[type].name); + + if (fe->ops.i2c_gate_ctrl) + fe->ops.i2c_gate_ctrl(fe, 0); + } + mutex_lock(&tuner_simple_list_mutex); instance = hybrid_tuner_request_state(struct tuner_simple_priv, priv,