stable.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Patch "pinctrl: sh-pfc: Add helper to handle bias lookup table" has been added to the 4.9-stable tree
@ 2017-01-18  7:03 gregkh
  2017-01-18  8:24 ` Geert Uytterhoeven
  0 siblings, 1 reply; 3+ messages in thread
From: gregkh @ 2017-01-18  7:03 UTC (permalink / raw)
  To: niklas.soderlund+renesas, geert+renesas, gregkh, laurent.pinchart
  Cc: stable, stable-commits


This is a note to let you know that I've just added the patch titled

    pinctrl: sh-pfc: Add helper to handle bias lookup table

to the 4.9-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     pinctrl-sh-pfc-add-helper-to-handle-bias-lookup-table.patch
and it can be found in the queue-4.9 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@vger.kernel.org> know about it.


>From c314c9f15aa5f43f0e5c0e2602cc65798dbd1598 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Niklas=20S=C3=B6derlund?=
 <niklas.soderlund+renesas@ragnatech.se>
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 <niklas.soderlund+renesas@ragnatech.se>

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   |   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 {


Patches currently in stable-queue which might be from niklas.soderlund+renesas@ragnatech.se are

queue-4.9/pinctrl-sh-pfc-add-helper-to-handle-bias-lookup-table.patch
queue-4.9/pinctrl-sh-pfc-r8a7795-use-lookup-function-for-bias-data.patch

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Patch "pinctrl: sh-pfc: Add helper to handle bias lookup table" has been added to the 4.9-stable tree
  2017-01-18  7:03 Patch "pinctrl: sh-pfc: Add helper to handle bias lookup table" has been added to the 4.9-stable tree gregkh
@ 2017-01-18  8:24 ` Geert Uytterhoeven
  2017-01-18  9:02   ` Greg KH
  0 siblings, 1 reply; 3+ messages in thread
From: Geert Uytterhoeven @ 2017-01-18  8:24 UTC (permalink / raw)
  To: Greg KH
  Cc: Niklas Söderlund, Geert Uytterhoeven, Laurent Pinchart,
	stable, stable-commits

Hi Greg,

On Wed, Jan 18, 2017 at 8:03 AM,  <gregkh@linuxfoundation.org> wrote:
> This is a note to let you know that I've just added the patch titled
>
>     pinctrl: sh-pfc: Add helper to handle bias lookup table

Ah, you already found this was the missing dependency for "pinctrl: sh-pfc:
r8a7795: Use lookup function for bias data".
Sorry for not realizing that before.

BTW, if "/sys/kernel/debug/pinctrl/" falls under "user-visible" issues, you
may want to add commit 5d7400c4acbf7fe6 ("pinctrl: sh-pfc: Do not
unconditionally support PIN_CONFIG_BIAS_DISABLE"), too.

Thanks!

> to the 4.9-stable tree which can be found at:
>     http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary
>
> The filename of the patch is:
>      pinctrl-sh-pfc-add-helper-to-handle-bias-lookup-table.patch
> and it can be found in the queue-4.9 subdirectory.
>
> If you, or anyone else, feels it should not be added to the stable tree,
> please let <stable@vger.kernel.org> know about it.
>
>
> From c314c9f15aa5f43f0e5c0e2602cc65798dbd1598 Mon Sep 17 00:00:00 2001
> From: =?UTF-8?q?Niklas=20S=C3=B6derlund?=
>  <niklas.soderlund+renesas@ragnatech.se>
> 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 <niklas.soderlund+renesas@ragnatech.se>
>
> 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>

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Patch "pinctrl: sh-pfc: Add helper to handle bias lookup table" has been added to the 4.9-stable tree
  2017-01-18  8:24 ` Geert Uytterhoeven
@ 2017-01-18  9:02   ` Greg KH
  0 siblings, 0 replies; 3+ messages in thread
From: Greg KH @ 2017-01-18  9:02 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Niklas Söderlund, Geert Uytterhoeven, Laurent Pinchart,
	stable, stable-commits

On Wed, Jan 18, 2017 at 09:24:50AM +0100, Geert Uytterhoeven wrote:
> Hi Greg,
> 
> On Wed, Jan 18, 2017 at 8:03 AM,  <gregkh@linuxfoundation.org> wrote:
> > This is a note to let you know that I've just added the patch titled
> >
> >     pinctrl: sh-pfc: Add helper to handle bias lookup table
> 
> Ah, you already found this was the missing dependency for "pinctrl: sh-pfc:
> r8a7795: Use lookup function for bias data".
> Sorry for not realizing that before.
> 
> BTW, if "/sys/kernel/debug/pinctrl/" falls under "user-visible" issues, you
> may want to add commit 5d7400c4acbf7fe6 ("pinctrl: sh-pfc: Do not
> unconditionally support PIN_CONFIG_BIAS_DISABLE"), too.

Looks good, now queued up, thanks,

greg k-h

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-01-18  9:08 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-01-18  7:03 Patch "pinctrl: sh-pfc: Add helper to handle bias lookup table" has been added to the 4.9-stable tree gregkh
2017-01-18  8:24 ` Geert Uytterhoeven
2017-01-18  9:02   ` Greg KH

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).