Skip to contentSkip to conversation

counter:ti-eqep: remove floor

PATCH Applied David Lechner 3 participants 4 messages Dec 14, 2020 – Dec 29, 2020

Subsystems (3)
lore
Share & tools
lore

David Lechner

author reviewer
#0 lore raw

PATCH 1/1 counter:ti-eqep: remove floor

The hardware doesn't support this. QPOSINIT is an initialization value that is triggered by other things. When the counter overflows, it always wraps around to zero.

Fixes f213729f6796 "counter: new TI eQEP driver"
---
 drivers/counter/ti-eqep.c | 35 -----------------------------------
 1 file changed, 35 deletions(-)
drivers/counter/ti-eqep.c +0 -35
index a60aee1a1a29..65df9ef5b5bc 100644
@@ -235,36 +235,6 @@ static ssize_t ti_eqep_position_ceiling_write(struct counter_device *counter,
 	return len;
 }
 
-static ssize_t ti_eqep_position_floor_read(struct counter_device *counter,
-					   struct counter_count *count,
-					   void *ext_priv, char *buf)
-{
-	struct ti_eqep_cnt *priv = counter->priv;
-	u32 qposinit;
-
-	regmap_read(priv->regmap32, QPOSINIT, &qposinit);
-
-	return sprintf(buf, "%u\n", qposinit);
-}
-
-static ssize_t ti_eqep_position_floor_write(struct counter_device *counter,
-					    struct counter_count *count,
-					    void *ext_priv, const char *buf,
-					    size_t len)
-{
-	struct ti_eqep_cnt *priv = counter->priv;
-	int err;
-	u32 res;
-
-	err = kstrtouint(buf, 0, &res);
-	if (err < 0)
-		return err;
-
-	regmap_write(priv->regmap32, QPOSINIT, res);
-
-	return len;
-}
-
 static ssize_t ti_eqep_position_enable_read(struct counter_device *counter,
 					    struct counter_count *count,
 					    void *ext_priv, char *buf)
@@ -301,11 +271,6 @@ static struct counter_count_ext ti_eqep_position_ext[] = {
 		.read	= ti_eqep_position_ceiling_read,
 		.write	= ti_eqep_position_ceiling_write,
 	},
-	{
-		.name	= "floor",
-		.read	= ti_eqep_position_floor_read,
-		.write	= ti_eqep_position_floor_write,
-	},
 	{
 		.name	= "enable",
 		.read	= ti_eqep_position_enable_read,
Signature · 1 line
2.25.1
Acked-by on v1 1/1
#1 lore raw
Quoted 6 lines · David Lechner

The hardware doesn't support this. QPOSINIT is an initialization value that is triggered by other things. When the counter overflows, it always wraps around to zero.

Fixes f213729f6796 "counter: new TI eQEP driver"

Is the QPOSINIT preprocessor define needed at all anymore, or should it also be removed?

Quoted 60 lines
---
 drivers/counter/ti-eqep.c | 35 -----------------------------------
 1 file changed, 35 deletions(-)
drivers/counter/ti-eqep.c +0 -35
index a60aee1a1a29..65df9ef5b5bc 100644
@@ -235,36 +235,6 @@ static ssize_t ti_eqep_position_ceiling_write(struct counter_device *counter,
 	return len;
 }
 
-static ssize_t ti_eqep_position_floor_read(struct counter_device *counter,
-					   struct counter_count *count,
-					   void *ext_priv, char *buf)
-{
-	struct ti_eqep_cnt *priv = counter->priv;
-	u32 qposinit;
-
-	regmap_read(priv->regmap32, QPOSINIT, &qposinit);
-
-	return sprintf(buf, "%u\n", qposinit);
-}
-
-static ssize_t ti_eqep_position_floor_write(struct counter_device *counter,
-					    struct counter_count *count,
-					    void *ext_priv, const char *buf,
-					    size_t len)
-{
-	struct ti_eqep_cnt *priv = counter->priv;
-	int err;
-	u32 res;
-
-	err = kstrtouint(buf, 0, &res);
-	if (err < 0)
-		return err;
-
-	regmap_write(priv->regmap32, QPOSINIT, res);
-
-	return len;
-}
-
 static ssize_t ti_eqep_position_enable_read(struct counter_device *counter,
 					    struct counter_count *count,
 					    void *ext_priv, char *buf)
@@ -301,11 +271,6 @@ static struct counter_count_ext ti_eqep_position_ext[] = {
 		.read	= ti_eqep_position_ceiling_read,
 		.write	= ti_eqep_position_ceiling_write,
 	},
-	{
-		.name	= "floor",
-		.read	= ti_eqep_position_floor_read,
-		.write	= ti_eqep_position_floor_write,
-	},
 	{
 		.name	= "enable",
 		.read	= ti_eqep_position_enable_read,
Signature · 1 line
2.25.1
author reviewer
#2 lore raw
Quoted 10 lines · William Breathitt Gray
Quoted 6 lines · David Lechner

The hardware doesn't support this. QPOSINIT is an initialization value that is triggered by other things. When the counter overflows, it always wraps around to zero.

Fixes f213729f6796 "counter: new TI eQEP driver"

Is the QPOSINIT preprocessor define needed at all anymore, or should it also be removed?

There are already many more defines for registers that are not used, so I didn't remove it.

Quoted 63 lines
Quoted 60 lines
---
  drivers/counter/ti-eqep.c | 35 -----------------------------------
  1 file changed, 35 deletions(-)
drivers/counter/ti-eqep.c +0 -35
index a60aee1a1a29..65df9ef5b5bc 100644
@@ -235,36 +235,6 @@ static ssize_t ti_eqep_position_ceiling_write(struct counter_device *counter,
  	return len;
  }
 
-static ssize_t ti_eqep_position_floor_read(struct counter_device *counter,
-					   struct counter_count *count,
-					   void *ext_priv, char *buf)
-{
-	struct ti_eqep_cnt *priv = counter->priv;
-	u32 qposinit;
-
-	regmap_read(priv->regmap32, QPOSINIT, &qposinit);
-
-	return sprintf(buf, "%u\n", qposinit);
-}
-
-static ssize_t ti_eqep_position_floor_write(struct counter_device *counter,
-					    struct counter_count *count,
-					    void *ext_priv, const char *buf,
-					    size_t len)
-{
-	struct ti_eqep_cnt *priv = counter->priv;
-	int err;
-	u32 res;
-
-	err = kstrtouint(buf, 0, &res);
-	if (err < 0)
-		return err;
-
-	regmap_write(priv->regmap32, QPOSINIT, res);
-
-	return len;
-}
-
  static ssize_t ti_eqep_position_enable_read(struct counter_device *counter,
  					    struct counter_count *count,
  					    void *ext_priv, char *buf)
@@ -301,11 +271,6 @@ static struct counter_count_ext ti_eqep_position_ext[] = {
  		.read	= ti_eqep_position_ceiling_read,
  		.write	= ti_eqep_position_ceiling_write,
  	},
-	{
-		.name	= "floor",
-		.read	= ti_eqep_position_floor_read,
-		.write	= ti_eqep_position_floor_write,
-	},
  	{
  		.name	= "enable",
  		.read	= ti_eqep_position_enable_read,
Signature · 1 line
2.25.1
maintainer Applied
#3 lore raw
Quoted 6 lines · On Mon, 14 Dec 2020 08:05:44 -0600 David Lechner <[email protected]> wrote:
Quoted 5 lines · William Breathitt Gray
Quoted 4 lines · David Lechner

The hardware doesn't support this. QPOSINIT is an initialization value that is triggered by other things. When the counter overflows, it always wraps around to zero.

Quoted 8 lines
Quoted 5 lines
Quoted 2 lines
Fixes f213729f6796 "counter: new TI eQEP driver"

Is the QPOSINIT preprocessor define needed at all anymore, or should it also be removed?

There are already many more defines for registers that are not used, so I didn't remove it.

Applied to the fixes-togreg branch of iio.git and marked for stable.

Thanks,

Jonathan

Quoted 65 lines
Quoted 64 lines
Quoted 60 lines
---
  drivers/counter/ti-eqep.c | 35 -----------------------------------
  1 file changed, 35 deletions(-)
drivers/counter/ti-eqep.c +0 -35
index a60aee1a1a29..65df9ef5b5bc 100644
@@ -235,36 +235,6 @@ static ssize_t ti_eqep_position_ceiling_write(struct counter_device *counter,
  	return len;
  }
 
-static ssize_t ti_eqep_position_floor_read(struct counter_device *counter,
-					   struct counter_count *count,
-					   void *ext_priv, char *buf)
-{
-	struct ti_eqep_cnt *priv = counter->priv;
-	u32 qposinit;
-
-	regmap_read(priv->regmap32, QPOSINIT, &qposinit);
-
-	return sprintf(buf, "%u\n", qposinit);
-}
-
-static ssize_t ti_eqep_position_floor_write(struct counter_device *counter,
-					    struct counter_count *count,
-					    void *ext_priv, const char *buf,
-					    size_t len)
-{
-	struct ti_eqep_cnt *priv = counter->priv;
-	int err;
-	u32 res;
-
-	err = kstrtouint(buf, 0, &res);
-	if (err < 0)
-		return err;
-
-	regmap_write(priv->regmap32, QPOSINIT, res);
-
-	return len;
-}
-
  static ssize_t ti_eqep_position_enable_read(struct counter_device *counter,
  					    struct counter_count *count,
  					    void *ext_priv, char *buf)
@@ -301,11 +271,6 @@ static struct counter_count_ext ti_eqep_position_ext[] = {
  		.read	= ti_eqep_position_ceiling_read,
  		.write	= ti_eqep_position_ceiling_write,
  	},
-	{
-		.name	= "floor",
-		.read	= ti_eqep_position_floor_read,
-		.write	= ti_eqep_position_floor_write,
-	},
  	{
  		.name	= "enable",
  		.read	= ti_eqep_position_enable_read,
Signature · 1 line
2.25.1