Some Quadrature Encoders can swap phase inputs A and B internally. This new function will allow drivers to configure input swap mode. Signed-off-by: Felipe Balbi <felipe.balbi@xxxxxxxxxxxxxxx> --- drivers/counter/counter.c | 3 ++- include/linux/counter.h | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/counter/counter.c b/drivers/counter/counter.c index 106bc7180cd8..b818ae9e85f2 100644 --- a/drivers/counter/counter.c +++ b/drivers/counter/counter.c @@ -823,7 +823,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 a061cdcdef7c..860769250f89 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.23.0