summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSakari Ailus <sakari.ailus@linux.intel.com>2019-09-23 10:18:38 -0300
committerMauro Carvalho Chehab <mchehab+samsung@kernel.org>2019-10-24 18:53:09 -0300
commit23fc92fad8ff6829b3139c55d83b659020812016 (patch)
tree0db691947286fd9771c995d435c07541af2c638b
parentd5e550cf9f292ac889d9a686c4cb5fa040eeab7b (diff)
downloadlinux-23fc92fad8ff6829b3139c55d83b659020812016.tar.bz2
media: smiapp: Don't poll for NVM ready on devices that don't need it
Only some devices require polling for NVM ready. Do the polling only on devices that need it. Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
-rw-r--r--drivers/media/i2c/smiapp/smiapp-core.c28
1 files changed, 17 insertions, 11 deletions
diff --git a/drivers/media/i2c/smiapp/smiapp-core.c b/drivers/media/i2c/smiapp/smiapp-core.c
index 5a136068f4d6..5a04ae2544aa 100644
--- a/drivers/media/i2c/smiapp/smiapp-core.c
+++ b/drivers/media/i2c/smiapp/smiapp-core.c
@@ -986,21 +986,27 @@ static int smiapp_read_nvm_page(struct smiapp_sensor *sensor, u32 p, u8 *nvm)
if (rval)
return rval;
- for (i = 1000; i > 0; i--) {
- u32 s;
+ if (sensor->limits[SMIAPP_LIMIT_DATA_TRANSFER_IF_CAPABILITY] &
+ SMIAPP_DATA_TRANSFER_IF_CAPABILITY_POLL) {
+ for (i = 1000; i > 0; i--) {
+ u32 s;
- rval = smiapp_read(
- sensor,
- SMIAPP_REG_U8_DATA_TRANSFER_IF_1_STATUS, &s);
+ rval = smiapp_read(
+ sensor,
+ SMIAPP_REG_U8_DATA_TRANSFER_IF_1_STATUS,
+ &s);
- if (rval)
- return rval;
+ if (rval)
+ return rval;
- if (s & SMIAPP_DATA_TRANSFER_IF_1_STATUS_RD_READY)
- break;
+ if (s & SMIAPP_DATA_TRANSFER_IF_1_STATUS_RD_READY)
+ break;
+
+ }
+
+ if (!i)
+ return -ETIMEDOUT;
}
- if (!i)
- return -ETIMEDOUT;
for (i = 0; i < SMIAPP_NVM_PAGE_SIZE; i++) {
u32 v;