From: Greg Kroah-Hartman Date: Wed, 18 Jan 2017 07:03:44 +0000 (+0100) Subject: 4.9-stable patches X-Git-Tag: v4.9.5~5 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=d0521dc647e15f7066bc221e18b508264317642e;p=thirdparty%2Fkernel%2Fstable-queue.git 4.9-stable patches added patches: pinctrl-sh-pfc-add-helper-to-handle-bias-lookup-table.patch --- diff --git a/queue-4.9/pinctrl-sh-pfc-add-helper-to-handle-bias-lookup-table.patch b/queue-4.9/pinctrl-sh-pfc-add-helper-to-handle-bias-lookup-table.patch new file mode 100644 index 00000000000..0a44034097d --- /dev/null +++ b/queue-4.9/pinctrl-sh-pfc-add-helper-to-handle-bias-lookup-table.patch @@ -0,0 +1,84 @@ +From c314c9f15aa5f43f0e5c0e2602cc65798dbd1598 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Niklas=20S=C3=B6derlund?= + +Date: Sat, 12 Nov 2016 17:04:25 +0100 +Subject: pinctrl: sh-pfc: Add helper to handle bias lookup table +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Niklas Söderlund + +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 +Reviewed-by: Laurent Pinchart +Signed-off-by: Geert Uytterhoeven +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/pinctrl/sh-pfc/core.c | 15 +++++++++++++++ + drivers/pinctrl/sh-pfc/core.h | 4 ++++ + drivers/pinctrl/sh-pfc/sh_pfc.h | 6 ++++++ + 3 files changed, 25 insertions(+) + +--- a/drivers/pinctrl/sh-pfc/core.c ++++ b/drivers/pinctrl/sh-pfc/core.c +@@ -389,6 +389,21 @@ int sh_pfc_config_mux(struct sh_pfc *pfc + return 0; + } + ++const struct sh_pfc_bias_info * ++sh_pfc_pin_to_bias_info(const struct sh_pfc_bias_info *info, ++ unsigned int num, unsigned int pin) ++{ ++ unsigned int i; ++ ++ for (i = 0; i < num; i++) ++ if (info[i].pin == pin) ++ return &info[i]; ++ ++ WARN_ONCE(1, "Pin %u is not in bias info list\n", pin); ++ ++ return NULL; ++} ++ + static int sh_pfc_init_ranges(struct sh_pfc *pfc) + { + struct sh_pfc_pin_range *range; +--- a/drivers/pinctrl/sh-pfc/core.h ++++ b/drivers/pinctrl/sh-pfc/core.h +@@ -33,4 +33,8 @@ void sh_pfc_write_reg(struct sh_pfc *pfc + int sh_pfc_get_pin_index(struct sh_pfc *pfc, unsigned int pin); + int sh_pfc_config_mux(struct sh_pfc *pfc, unsigned mark, int pinmux_type); + ++const struct sh_pfc_bias_info * ++sh_pfc_pin_to_bias_info(const struct sh_pfc_bias_info *info, ++ unsigned int num, unsigned int pin); ++ + #endif /* __SH_PFC_CORE_H__ */ +--- a/drivers/pinctrl/sh-pfc/sh_pfc.h ++++ b/drivers/pinctrl/sh-pfc/sh_pfc.h +@@ -189,6 +189,12 @@ struct sh_pfc_window { + unsigned long size; + }; + ++struct sh_pfc_bias_info { ++ u16 pin; ++ u16 reg : 11; ++ u16 bit : 5; ++}; ++ + struct sh_pfc_pin_range; + + struct sh_pfc { diff --git a/queue-4.9/series b/queue-4.9/series index 03f5f9da616..c7615972ffe 100644 --- a/queue-4.9/series +++ b/queue-4.9/series @@ -2,6 +2,7 @@ input-xpad-use-correct-product-id-for-x360w-controllers.patch input-i8042-add-pegatron-touchpad-to-noloop-table.patch pinctrl-imx-fix-imx_pinctrl_desc-initialization.patch pinctrl-sh-pfc-r8a7795-use-lookup-function-for-bias-data.patch +pinctrl-sh-pfc-add-helper-to-handle-bias-lookup-table.patch regulator-tps65086-fix-25mv-ranges-for-buck-regulators.patch regulator-axp20x-fix-axp809-ldo_io-registration-error-on-cold-boot.patch drm-tegra-dpaux-fix-error-handling.patch