aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/smiapp
diff options
context:
space:
mode:
authorSakari Ailus <sakari.ailus@maxwell.research.nokia.com>2012-04-22 08:30:19 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2012-05-20 11:46:02 -0400
commit98add8e80764f49219de354a867f4cf8ade94ba8 (patch)
treed66026b7e26b3f194976743b567d62f6e8780a03 /drivers/media/video/smiapp
parentceb9e30e9f4a892997a61f1f5a30bc5b561c9e67 (diff)
[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: Sakari Ailus <sakari.ailus@maxwell.research.nokia.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video/smiapp')
-rw-r--r--drivers/media/video/smiapp/smiapp-core.c63
1 files changed, 34 insertions, 29 deletions
diff --git a/drivers/media/video/smiapp/smiapp-core.c b/drivers/media/video/smiapp/smiapp-core.c
index de5c94762916..3bf086f836fb 100644
--- a/drivers/media/video/smiapp/smiapp-core.c
+++ b/drivers/media/video/smiapp/smiapp-core.c
@@ -2197,51 +2197,56 @@ static int smiapp_identify_module(struct v4l2_subdev *subdev)
2197 minfo->name = SMIAPP_NAME; 2197 minfo->name = SMIAPP_NAME;
2198 2198
2199 /* Module info */ 2199 /* Module info */
2200 rval = smiapp_read(sensor, SMIAPP_REG_U8_MANUFACTURER_ID, 2200 rval = smiapp_read_8only(sensor, SMIAPP_REG_U8_MANUFACTURER_ID,
2201 &minfo->manufacturer_id); 2201 &minfo->manufacturer_id);
2202 if (!rval) 2202 if (!rval)
2203 rval = smiapp_read(sensor, SMIAPP_REG_U16_MODEL_ID, 2203 rval = smiapp_read_8only(sensor, SMIAPP_REG_U16_MODEL_ID,
2204 &minfo->model_id); 2204 &minfo->model_id);
2205 if (!rval) 2205 if (!rval)
2206 rval = smiapp_read(sensor, SMIAPP_REG_U8_REVISION_NUMBER_MAJOR, 2206 rval = smiapp_read_8only(sensor,
2207 &minfo->revision_number_major); 2207 SMIAPP_REG_U8_REVISION_NUMBER_MAJOR,
2208 &minfo->revision_number_major);
2208 if (!rval) 2209 if (!rval)
2209 rval = smiapp_read(sensor, SMIAPP_REG_U8_REVISION_NUMBER_MINOR, 2210 rval = smiapp_read_8only(sensor,
2210 &minfo->revision_number_minor); 2211 SMIAPP_REG_U8_REVISION_NUMBER_MINOR,
2212 &minfo->revision_number_minor);
2211 if (!rval) 2213 if (!rval)
2212 rval = smiapp_read(sensor, SMIAPP_REG_U8_MODULE_DATE_YEAR, 2214 rval = smiapp_read_8only(sensor,
2213 &minfo->module_year); 2215 SMIAPP_REG_U8_MODULE_DATE_YEAR,
2216 &minfo->module_year);
2214 if (!rval) 2217 if (!rval)
2215 rval = smiapp_read(sensor, SMIAPP_REG_U8_MODULE_DATE_MONTH, 2218 rval = smiapp_read_8only(sensor,
2216 &minfo->module_month); 2219 SMIAPP_REG_U8_MODULE_DATE_MONTH,
2220 &minfo->module_month);
2217 if (!rval) 2221 if (!rval)
2218 rval = smiapp_read(sensor, SMIAPP_REG_U8_MODULE_DATE_DAY, 2222 rval = smiapp_read_8only(sensor, SMIAPP_REG_U8_MODULE_DATE_DAY,
2219 &minfo->module_day); 2223 &minfo->module_day);
2220 2224
2221 /* Sensor info */ 2225 /* Sensor info */
2222 if (!rval) 2226 if (!rval)
2223 rval = smiapp_read(sensor, 2227 rval = smiapp_read_8only(sensor,
2224 SMIAPP_REG_U8_SENSOR_MANUFACTURER_ID, 2228 SMIAPP_REG_U8_SENSOR_MANUFACTURER_ID,
2225 &minfo->sensor_manufacturer_id); 2229 &minfo->sensor_manufacturer_id);
2226 if (!rval) 2230 if (!rval)
2227 rval = smiapp_read(sensor, SMIAPP_REG_U16_SENSOR_MODEL_ID, 2231 rval = smiapp_read_8only(sensor,
2228 &minfo->sensor_model_id); 2232 SMIAPP_REG_U16_SENSOR_MODEL_ID,
2233 &minfo->sensor_model_id);
2229 if (!rval) 2234 if (!rval)
2230 rval = smiapp_read(sensor, 2235 rval = smiapp_read_8only(sensor,
2231 SMIAPP_REG_U8_SENSOR_REVISION_NUMBER, 2236 SMIAPP_REG_U8_SENSOR_REVISION_NUMBER,
2232 &minfo->sensor_revision_number); 2237 &minfo->sensor_revision_number);
2233 if (!rval) 2238 if (!rval)
2234 rval = smiapp_read(sensor, 2239 rval = smiapp_read_8only(sensor,
2235 SMIAPP_REG_U8_SENSOR_FIRMWARE_VERSION, 2240 SMIAPP_REG_U8_SENSOR_FIRMWARE_VERSION,
2236 &minfo->sensor_firmware_version); 2241 &minfo->sensor_firmware_version);
2237 2242
2238 /* SMIA */ 2243 /* SMIA */
2239 if (!rval) 2244 if (!rval)
2240 rval = smiapp_read(sensor, SMIAPP_REG_U8_SMIA_VERSION, 2245 rval = smiapp_read_8only(sensor, SMIAPP_REG_U8_SMIA_VERSION,
2241 &minfo->smia_version); 2246 &minfo->smia_version);
2242 if (!rval) 2247 if (!rval)
2243 rval = smiapp_read(sensor, SMIAPP_REG_U8_SMIAPP_VERSION, 2248 rval = smiapp_read_8only(sensor, SMIAPP_REG_U8_SMIAPP_VERSION,
2244 &minfo->smiapp_version); 2249 &minfo->smiapp_version);
2245 2250
2246 if (rval) { 2251 if (rval) {
2247 dev_err(&client->dev, "sensor detection failed\n"); 2252 dev_err(&client->dev, "sensor detection failed\n");