diff mbox series

[v2,1/2] counter: Add support for Quadrature x4 with swapped inputs

Message ID 20210526150601.3605866-1-jarkko.nikula@linux.intel.com (mailing list archive)
State Superseded, archived
Headers show
Series [v2,1/2] counter: Add support for Quadrature x4 with swapped inputs | expand

Commit Message

Jarkko Nikula May 26, 2021, 3:06 p.m. UTC
Some Quadrature Encoders can swap phase inputs A and B internally. This
new function will allow drivers to configure input swap mode.

This was implemented by Felipe Balbi while he was working at Intel.

Signed-off-by: Felipe Balbi (Intel) <balbi@kernel.org>
Signed-off-by: Jarkko Nikula <jarkko.nikula@linux.intel.com>
---
 Documentation/ABI/testing/sysfs-bus-counter | 4 ++++
 drivers/counter/counter.c                   | 3 ++-
 include/linux/counter.h                     | 3 ++-
 3 files changed, 8 insertions(+), 2 deletions(-)

Comments

William Breathitt Gray May 27, 2021, 1:10 a.m. UTC | #1
On Wed, May 26, 2021 at 06:06:00PM +0300, Jarkko Nikula wrote:
> Some Quadrature Encoders can swap phase inputs A and B internally. This
> new function will allow drivers to configure input swap mode.
> 
> This was implemented by Felipe Balbi while he was working at Intel.
> 
> Signed-off-by: Felipe Balbi (Intel) <balbi@kernel.org>
> Signed-off-by: Jarkko Nikula <jarkko.nikula@linux.intel.com>

There's no change in this patch from the last revision, right?

Acked-by: William Breathitt Gray <vilhelm.gray@gmail.com>

> ---
>  Documentation/ABI/testing/sysfs-bus-counter | 4 ++++
>  drivers/counter/counter.c                   | 3 ++-
>  include/linux/counter.h                     | 3 ++-
>  3 files changed, 8 insertions(+), 2 deletions(-)
> 
> diff --git a/Documentation/ABI/testing/sysfs-bus-counter b/Documentation/ABI/testing/sysfs-bus-counter
> index 566bd99fe0a5..8f1e3de88c77 100644
> --- a/Documentation/ABI/testing/sysfs-bus-counter
> +++ b/Documentation/ABI/testing/sysfs-bus-counter
> @@ -146,6 +146,10 @@ Description:
>  			updates	the respective count. Quadrature encoding
>  			determines the direction.
>  
> +		quadrature x4 swapped:
> +			Same as quadrature x4, however Phase A and Phase B
> +			signals are swapped.
> +
>  What:		/sys/bus/counter/devices/counterX/countY/name
>  KernelVersion:	5.2
>  Contact:	linux-iio@vger.kernel.org
> diff --git a/drivers/counter/counter.c b/drivers/counter/counter.c
> index 6a683d086008..11d357245b14 100644
> --- a/drivers/counter/counter.c
> +++ b/drivers/counter/counter.c
> @@ -752,7 +752,8 @@ static const char *const counter_count_function_str[] = {
>  	[COUNTER_COUNT_FUNCTION_QUADRATURE_X1_B] = "quadrature x1 b",
>  	[COUNTER_COUNT_FUNCTION_QUADRATURE_X2_A] = "quadrature x2 a",
>  	[COUNTER_COUNT_FUNCTION_QUADRATURE_X2_B] = "quadrature x2 b",
> -	[COUNTER_COUNT_FUNCTION_QUADRATURE_X4] = "quadrature x4"
> +	[COUNTER_COUNT_FUNCTION_QUADRATURE_X4] = "quadrature x4",
> +	[COUNTER_COUNT_FUNCTION_QUADRATURE_X4_SWAPPED] = "quadrature x4 swapped"
>  };
>  
>  static ssize_t counter_function_show(struct device *dev,
> diff --git a/include/linux/counter.h b/include/linux/counter.h
> index 9dbd5df4cd34..c3b4d263eb22 100644
> --- a/include/linux/counter.h
> +++ b/include/linux/counter.h
> @@ -170,7 +170,8 @@ enum counter_count_function {
>  	COUNTER_COUNT_FUNCTION_QUADRATURE_X1_B,
>  	COUNTER_COUNT_FUNCTION_QUADRATURE_X2_A,
>  	COUNTER_COUNT_FUNCTION_QUADRATURE_X2_B,
> -	COUNTER_COUNT_FUNCTION_QUADRATURE_X4
> +	COUNTER_COUNT_FUNCTION_QUADRATURE_X4,
> +	COUNTER_COUNT_FUNCTION_QUADRATURE_X4_SWAPPED,
>  };
>  
>  /**
> -- 
> 2.30.2
>
Jarkko Nikula May 27, 2021, 8:13 a.m. UTC | #2
Hi

On 5/27/21 4:10 AM, William Breathitt Gray wrote:
> On Wed, May 26, 2021 at 06:06:00PM +0300, Jarkko Nikula wrote:
>> Some Quadrature Encoders can swap phase inputs A and B internally. This
>> new function will allow drivers to configure input swap mode.
>>
>> This was implemented by Felipe Balbi while he was working at Intel.
>>
>> Signed-off-by: Felipe Balbi (Intel) <balbi@kernel.org>
>> Signed-off-by: Jarkko Nikula <jarkko.nikula@linux.intel.com>
> 
> There's no change in this patch from the last revision, right?
> 
> Acked-by: William Breathitt Gray <vilhelm.gray@gmail.com>
> 
Yes, no changes. Will add your ack to the next version.

Jarkko
diff mbox series

Patch

diff --git a/Documentation/ABI/testing/sysfs-bus-counter b/Documentation/ABI/testing/sysfs-bus-counter
index 566bd99fe0a5..8f1e3de88c77 100644
--- a/Documentation/ABI/testing/sysfs-bus-counter
+++ b/Documentation/ABI/testing/sysfs-bus-counter
@@ -146,6 +146,10 @@  Description:
 			updates	the respective count. Quadrature encoding
 			determines the direction.
 
+		quadrature x4 swapped:
+			Same as quadrature x4, however Phase A and Phase B
+			signals are swapped.
+
 What:		/sys/bus/counter/devices/counterX/countY/name
 KernelVersion:	5.2
 Contact:	linux-iio@vger.kernel.org
diff --git a/drivers/counter/counter.c b/drivers/counter/counter.c
index 6a683d086008..11d357245b14 100644
--- a/drivers/counter/counter.c
+++ b/drivers/counter/counter.c
@@ -752,7 +752,8 @@  static const char *const counter_count_function_str[] = {
 	[COUNTER_COUNT_FUNCTION_QUADRATURE_X1_B] = "quadrature x1 b",
 	[COUNTER_COUNT_FUNCTION_QUADRATURE_X2_A] = "quadrature x2 a",
 	[COUNTER_COUNT_FUNCTION_QUADRATURE_X2_B] = "quadrature x2 b",
-	[COUNTER_COUNT_FUNCTION_QUADRATURE_X4] = "quadrature x4"
+	[COUNTER_COUNT_FUNCTION_QUADRATURE_X4] = "quadrature x4",
+	[COUNTER_COUNT_FUNCTION_QUADRATURE_X4_SWAPPED] = "quadrature x4 swapped"
 };
 
 static ssize_t counter_function_show(struct device *dev,
diff --git a/include/linux/counter.h b/include/linux/counter.h
index 9dbd5df4cd34..c3b4d263eb22 100644
--- a/include/linux/counter.h
+++ b/include/linux/counter.h
@@ -170,7 +170,8 @@  enum counter_count_function {
 	COUNTER_COUNT_FUNCTION_QUADRATURE_X1_B,
 	COUNTER_COUNT_FUNCTION_QUADRATURE_X2_A,
 	COUNTER_COUNT_FUNCTION_QUADRATURE_X2_B,
-	COUNTER_COUNT_FUNCTION_QUADRATURE_X4
+	COUNTER_COUNT_FUNCTION_QUADRATURE_X4,
+	COUNTER_COUNT_FUNCTION_QUADRATURE_X4_SWAPPED,
 };
 
 /**