[PATCH 5/7] smiapp: Don't poll for NVM ready on devices that don't need it

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Only some devices require polling for NVM ready. Do the polling only on
devices that need it.

Signed-off-by: Sakari Ailus <sakari.ailus@xxxxxxxxxxxxxxx>
---
 drivers/media/i2c/smiapp/smiapp-core.c | 28 ++++++++++++++++----------
 1 file changed, 17 insertions(+), 11 deletions(-)

diff --git a/drivers/media/i2c/smiapp/smiapp-core.c b/drivers/media/i2c/smiapp/smiapp-core.c
index 5a136068f4d60..5a04ae2544aa0 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;
-- 
2.20.1




[Index of Archives]     [Device Tree Compilter]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux PCI Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Yosemite Backpacking]


  Powered by Linux