Skip to contentSkip to conversation

iio: base: Adding flags to regmap_i2c

PATCH In review Crt Mori 2 participants 4 messages Aug 11, 2015 – Aug 15, 2015

Subsystems (3)
lore
Share & tools
lore

Crt Mori

author
#0 lore raw

PATCH 1/1 iio: base: Adding flags to regmap_i2c

Providing access to i2c flags within regmap i2c functions.

---
 drivers/base/regmap/regmap-i2c.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/base/regmap/regmap-i2c.c +4 -4
index fa6bf52..33e5229 100644
@@ -46,12 +46,12 @@ static int regmap_i2c_gather_write(void *context,
 		return -ENOTSUPP;
 
 	xfer[0].addr = i2c->addr;
-	xfer[0].flags = 0;
+	xfer[0].flags = i2c->flags;
 	xfer[0].len = reg_size;
 	xfer[0].buf = (void *)reg;
 
 	xfer[1].addr = i2c->addr;
-	xfer[1].flags = I2C_M_NOSTART;
+	xfer[1].flags = i2c->flags | I2C_M_NOSTART;
 	xfer[1].len = val_size;
 	xfer[1].buf = (void *)val;
 
@@ -74,12 +74,12 @@ static int regmap_i2c_read(void *context,
 	int ret;
 
 	xfer[0].addr = i2c->addr;
-	xfer[0].flags = 0;
+	xfer[0].flags = i2c->flags;
 	xfer[0].len = reg_size;
 	xfer[0].buf = (void *)reg;
 
 	xfer[1].addr = i2c->addr;
-	xfer[1].flags = I2C_M_RD;
+	xfer[1].flags = i2c->flags | I2C_M_RD;
 	xfer[1].len = val_size;
 	xfer[1].buf = val;
 
Signature · 1 line
2.1.4
maintainer
#1 lore raw
Quoted 1 line · Crt Mori

Providing access to i2c flags within regmap i2c functions.

The patch may be fine, but I'd like to see a more detailed description. Why would one want to do this? What exactly is the use case?

Presumably either 10 bit addressing or PEC? Or are we dealing with a new flag working it's way through?

Quoted 41 lines
---
 drivers/base/regmap/regmap-i2c.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/base/regmap/regmap-i2c.c +4 -4
index fa6bf52..33e5229 100644
@@ -46,12 +46,12 @@ static int regmap_i2c_gather_write(void *context,
 		return -ENOTSUPP;
 
 	xfer[0].addr = i2c->addr;
-	xfer[0].flags = 0;
+	xfer[0].flags = i2c->flags;
 	xfer[0].len = reg_size;
 	xfer[0].buf = (void *)reg;
 
 	xfer[1].addr = i2c->addr;
-	xfer[1].flags = I2C_M_NOSTART;
+	xfer[1].flags = i2c->flags | I2C_M_NOSTART;
 	xfer[1].len = val_size;
 	xfer[1].buf = (void *)val;
 
@@ -74,12 +74,12 @@ static int regmap_i2c_read(void *context,
 	int ret;
 
 	xfer[0].addr = i2c->addr;
-	xfer[0].flags = 0;
+	xfer[0].flags = i2c->flags;
 	xfer[0].len = reg_size;
 	xfer[0].buf = (void *)reg;
 
 	xfer[1].addr = i2c->addr;
-	xfer[1].flags = I2C_M_RD;
+	xfer[1].flags = i2c->flags | I2C_M_RD;
 	xfer[1].len = val_size;
 	xfer[1].buf = val;
 
author
#2 lore raw
Quoted 7 lines · Jonathan Cameron
Quoted 1 line · Crt Mori

Providing access to i2c flags within regmap i2c functions.

The patch may be fine, but I'd like to see a more detailed description. Why would one want to do this? What exactly is the use case?

Presumably either 10 bit addressing or PEC? Or are we dealing with a new flag working it's way through?

Most notably in our case PEC, otherwise yes a 10-bit addressing was also on my mind.

Quoted 42 lines
Quoted 41 lines
---
 drivers/base/regmap/regmap-i2c.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/base/regmap/regmap-i2c.c +4 -4
index fa6bf52..33e5229 100644
@@ -46,12 +46,12 @@ static int regmap_i2c_gather_write(void *context,
              return -ENOTSUPP;
 
      xfer[0].addr = i2c->addr;
-     xfer[0].flags = 0;
+     xfer[0].flags = i2c->flags;
      xfer[0].len = reg_size;
      xfer[0].buf = (void *)reg;
 
      xfer[1].addr = i2c->addr;
-     xfer[1].flags = I2C_M_NOSTART;
+     xfer[1].flags = i2c->flags | I2C_M_NOSTART;
      xfer[1].len = val_size;
      xfer[1].buf = (void *)val;
 
@@ -74,12 +74,12 @@ static int regmap_i2c_read(void *context,
      int ret;
 
      xfer[0].addr = i2c->addr;
-     xfer[0].flags = 0;
+     xfer[0].flags = i2c->flags;
      xfer[0].len = reg_size;
      xfer[0].buf = (void *)reg;
 
      xfer[1].addr = i2c->addr;
-     xfer[1].flags = I2C_M_RD;
+     xfer[1].flags = i2c->flags | I2C_M_RD;
      xfer[1].len = val_size;
      xfer[1].buf = val;
 
maintainer
#3 lore raw
Quoted 10 lines · Crt Mori
Quoted 7 lines · Jonathan Cameron
Quoted 1 line · Crt Mori

Providing access to i2c flags within regmap i2c functions.

The patch may be fine, but I'd like to see a more detailed description. Why would one want to do this? What exactly is the use case?

Presumably either 10 bit addressing or PEC? Or are we dealing with a new flag working it's way through?

Most notably in our case PEC, otherwise yes a 10-bit addressing was also on my mind.

Makes sense to me. Thanks for the clarification.

Quoted 42 lines
Quoted 42 lines
Quoted 41 lines
---
 drivers/base/regmap/regmap-i2c.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/base/regmap/regmap-i2c.c +4 -4
index fa6bf52..33e5229 100644
@@ -46,12 +46,12 @@ static int regmap_i2c_gather_write(void *context,
              return -ENOTSUPP;
 
      xfer[0].addr = i2c->addr;
-     xfer[0].flags = 0;
+     xfer[0].flags = i2c->flags;
      xfer[0].len = reg_size;
      xfer[0].buf = (void *)reg;
 
      xfer[1].addr = i2c->addr;
-     xfer[1].flags = I2C_M_NOSTART;
+     xfer[1].flags = i2c->flags | I2C_M_NOSTART;
      xfer[1].len = val_size;
      xfer[1].buf = (void *)val;
 
@@ -74,12 +74,12 @@ static int regmap_i2c_read(void *context,
      int ret;
 
      xfer[0].addr = i2c->addr;
-     xfer[0].flags = 0;
+     xfer[0].flags = i2c->flags;
      xfer[0].len = reg_size;
      xfer[0].buf = (void *)reg;
 
      xfer[1].addr = i2c->addr;
-     xfer[1].flags = I2C_M_RD;
+     xfer[1].flags = i2c->flags | I2C_M_RD;
      xfer[1].len = val_size;
      xfer[1].buf = val;