pinctrl: sh-pfc: Add helper to handle bias lookup table
authorNiklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
Sat, 12 Nov 2016 16:04:25 +0000 (17:04 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 19 Jan 2017 19:17:57 +0000 (20:17 +0100)
commit9229336861cbe0f0c81dbe884d5721b4d81c21b2
tree2f981f4428af98ecf4a49613fe236842064d8228
parent5e1595223a2c703b810c567b3071a6cc87af5890
pinctrl: sh-pfc: Add helper to handle bias lookup table

commit c314c9f15aa5f43f0e5c0e2602cc65798dbd1598 upstream.

On some SoC there are no simple mapping of pins to bias register bits
and a lookup table is needed. This logic is already implemented in some
SoC specific drivers that could benefit from a generic implementation.

Add helpers to deal with the lookup which later can be used by the SoC
specific drivers. The logic used to lookup are different from the one it
aims to replace, this is intentional. This new method reduces the memory
consumption at the cost of increased CPU usage and fix a bug where a
WARN() would incorrectly be triggered if the register offset is 0.

Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/pinctrl/sh-pfc/core.c
drivers/pinctrl/sh-pfc/core.h
drivers/pinctrl/sh-pfc/sh_pfc.h