提交 98add8e8 编写于 作者: S Sakari Ailus 提交者: Mauro Carvalho Chehab

[media] smiapp: Use 8-bit reads only before identifying the sensor

Some sensors only allow 8-bit access, so use safe 8-bit access before the
sensor has been identified.
Signed-off-by: NSakari Ailus <sakari.ailus@maxwell.research.nokia.com>
Signed-off-by: NMauro Carvalho Chehab <mchehab@redhat.com>
上级 ceb9e30e
...@@ -2197,51 +2197,56 @@ static int smiapp_identify_module(struct v4l2_subdev *subdev) ...@@ -2197,51 +2197,56 @@ static int smiapp_identify_module(struct v4l2_subdev *subdev)
minfo->name = SMIAPP_NAME; minfo->name = SMIAPP_NAME;
/* Module info */ /* Module info */
rval = smiapp_read(sensor, SMIAPP_REG_U8_MANUFACTURER_ID, rval = smiapp_read_8only(sensor, SMIAPP_REG_U8_MANUFACTURER_ID,
&minfo->manufacturer_id); &minfo->manufacturer_id);
if (!rval) if (!rval)
rval = smiapp_read(sensor, SMIAPP_REG_U16_MODEL_ID, rval = smiapp_read_8only(sensor, SMIAPP_REG_U16_MODEL_ID,
&minfo->model_id); &minfo->model_id);
if (!rval) if (!rval)
rval = smiapp_read(sensor, SMIAPP_REG_U8_REVISION_NUMBER_MAJOR, rval = smiapp_read_8only(sensor,
&minfo->revision_number_major); SMIAPP_REG_U8_REVISION_NUMBER_MAJOR,
&minfo->revision_number_major);
if (!rval) if (!rval)
rval = smiapp_read(sensor, SMIAPP_REG_U8_REVISION_NUMBER_MINOR, rval = smiapp_read_8only(sensor,
&minfo->revision_number_minor); SMIAPP_REG_U8_REVISION_NUMBER_MINOR,
&minfo->revision_number_minor);
if (!rval) if (!rval)
rval = smiapp_read(sensor, SMIAPP_REG_U8_MODULE_DATE_YEAR, rval = smiapp_read_8only(sensor,
&minfo->module_year); SMIAPP_REG_U8_MODULE_DATE_YEAR,
&minfo->module_year);
if (!rval) if (!rval)
rval = smiapp_read(sensor, SMIAPP_REG_U8_MODULE_DATE_MONTH, rval = smiapp_read_8only(sensor,
&minfo->module_month); SMIAPP_REG_U8_MODULE_DATE_MONTH,
&minfo->module_month);
if (!rval) if (!rval)
rval = smiapp_read(sensor, SMIAPP_REG_U8_MODULE_DATE_DAY, rval = smiapp_read_8only(sensor, SMIAPP_REG_U8_MODULE_DATE_DAY,
&minfo->module_day); &minfo->module_day);
/* Sensor info */ /* Sensor info */
if (!rval) if (!rval)
rval = smiapp_read(sensor, rval = smiapp_read_8only(sensor,
SMIAPP_REG_U8_SENSOR_MANUFACTURER_ID, SMIAPP_REG_U8_SENSOR_MANUFACTURER_ID,
&minfo->sensor_manufacturer_id); &minfo->sensor_manufacturer_id);
if (!rval) if (!rval)
rval = smiapp_read(sensor, SMIAPP_REG_U16_SENSOR_MODEL_ID, rval = smiapp_read_8only(sensor,
&minfo->sensor_model_id); SMIAPP_REG_U16_SENSOR_MODEL_ID,
&minfo->sensor_model_id);
if (!rval) if (!rval)
rval = smiapp_read(sensor, rval = smiapp_read_8only(sensor,
SMIAPP_REG_U8_SENSOR_REVISION_NUMBER, SMIAPP_REG_U8_SENSOR_REVISION_NUMBER,
&minfo->sensor_revision_number); &minfo->sensor_revision_number);
if (!rval) if (!rval)
rval = smiapp_read(sensor, rval = smiapp_read_8only(sensor,
SMIAPP_REG_U8_SENSOR_FIRMWARE_VERSION, SMIAPP_REG_U8_SENSOR_FIRMWARE_VERSION,
&minfo->sensor_firmware_version); &minfo->sensor_firmware_version);
/* SMIA */ /* SMIA */
if (!rval) if (!rval)
rval = smiapp_read(sensor, SMIAPP_REG_U8_SMIA_VERSION, rval = smiapp_read_8only(sensor, SMIAPP_REG_U8_SMIA_VERSION,
&minfo->smia_version); &minfo->smia_version);
if (!rval) if (!rval)
rval = smiapp_read(sensor, SMIAPP_REG_U8_SMIAPP_VERSION, rval = smiapp_read_8only(sensor, SMIAPP_REG_U8_SMIAPP_VERSION,
&minfo->smiapp_version); &minfo->smiapp_version);
if (rval) { if (rval) {
dev_err(&client->dev, "sensor detection failed\n"); dev_err(&client->dev, "sensor detection failed\n");
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册