2021-09-30 12:43:42

by Prabhakar Mahadev Lad

[permalink] [raw]
Subject: [RFC PATCH 2/4] pinctrl: pinconf-generic: Add support for "output-impedance" to be extracted from DT files

Add "output-impedance" property to generic options used for DT parsing
files. This enables drivers, which use generic pin configurations, to
get the value passed to this property.

Signed-off-by: Lad Prabhakar <[email protected]>
---
drivers/pinctrl/pinconf-generic.c | 2 ++
include/linux/pinctrl/pinconf-generic.h | 3 +++
2 files changed, 5 insertions(+)

diff --git a/drivers/pinctrl/pinconf-generic.c b/drivers/pinctrl/pinconf-generic.c
index 22e8d4c4040e..3bff4e4340b9 100644
--- a/drivers/pinctrl/pinconf-generic.c
+++ b/drivers/pinctrl/pinconf-generic.c
@@ -46,6 +46,7 @@ static const struct pin_config_item conf_items[] = {
PCONFDUMP(PIN_CONFIG_MODE_LOW_POWER, "pin low power", "mode", true),
PCONFDUMP(PIN_CONFIG_OUTPUT_ENABLE, "output enabled", NULL, false),
PCONFDUMP(PIN_CONFIG_OUTPUT, "pin output", "level", true),
+ PCONFDUMP(PIN_CONFIG_OUTPUT_IMPEDANCE, "output impedance", "ohm", true),
PCONFDUMP(PIN_CONFIG_POWER_SOURCE, "pin power source", "selector", true),
PCONFDUMP(PIN_CONFIG_SLEEP_HARDWARE_STATE, "sleep hardware state", NULL, false),
PCONFDUMP(PIN_CONFIG_SLEW_RATE, "slew rate", NULL, true),
@@ -179,6 +180,7 @@ static const struct pinconf_generic_params dt_params[] = {
{ "output-disable", PIN_CONFIG_OUTPUT_ENABLE, 0 },
{ "output-enable", PIN_CONFIG_OUTPUT_ENABLE, 1 },
{ "output-high", PIN_CONFIG_OUTPUT, 1, },
+ { "output-impedance", PIN_CONFIG_OUTPUT_IMPEDANCE, 0 },
{ "output-low", PIN_CONFIG_OUTPUT, 0, },
{ "power-source", PIN_CONFIG_POWER_SOURCE, 0 },
{ "sleep-hardware-state", PIN_CONFIG_SLEEP_HARDWARE_STATE, 0 },
diff --git a/include/linux/pinctrl/pinconf-generic.h b/include/linux/pinctrl/pinconf-generic.h
index eee0e3948537..e6293ebd4052 100644
--- a/include/linux/pinctrl/pinconf-generic.h
+++ b/include/linux/pinctrl/pinconf-generic.h
@@ -91,6 +91,8 @@ struct pinctrl_map;
* configuration (eg. the currently selected mux function) drive values on
* the line. Use argument 1 to enable output mode, argument 0 to disable
* it.
+ * @PIN_CONFIG_OUTPUT_IMPEDANCE: this will configure the pins output impedance with
+ * the value passed as argument. The argument is in ohm.
* @PIN_CONFIG_PERSIST_STATE: retain pin state across sleep or controller reset
* @PIN_CONFIG_POWER_SOURCE: if the pin can select between different power
* supplies, the argument to this parameter (on a custom format) tells
@@ -129,6 +131,7 @@ enum pin_config_param {
PIN_CONFIG_MODE_PWM,
PIN_CONFIG_OUTPUT,
PIN_CONFIG_OUTPUT_ENABLE,
+ PIN_CONFIG_OUTPUT_IMPEDANCE,
PIN_CONFIG_PERSIST_STATE,
PIN_CONFIG_POWER_SOURCE,
PIN_CONFIG_SKEW_DELAY,
--
2.17.1


2021-10-07 20:49:02

by Geert Uytterhoeven

[permalink] [raw]
Subject: Re: [RFC PATCH 2/4] pinctrl: pinconf-generic: Add support for "output-impedance" to be extracted from DT files

Hi Prabhakar,

On Thu, Sep 30, 2021 at 2:17 PM Lad Prabhakar
<[email protected]> wrote:
> Add "output-impedance" property to generic options used for DT parsing
> files. This enables drivers, which use generic pin configurations, to
> get the value passed to this property.
>
> Signed-off-by: Lad Prabhakar <[email protected]>

Thanks for your patch!

> --- a/drivers/pinctrl/pinconf-generic.c
> +++ b/drivers/pinctrl/pinconf-generic.c
> @@ -46,6 +46,7 @@ static const struct pin_config_item conf_items[] = {
> PCONFDUMP(PIN_CONFIG_MODE_LOW_POWER, "pin low power", "mode", true),
> PCONFDUMP(PIN_CONFIG_OUTPUT_ENABLE, "output enabled", NULL, false),
> PCONFDUMP(PIN_CONFIG_OUTPUT, "pin output", "level", true),
> + PCONFDUMP(PIN_CONFIG_OUTPUT_IMPEDANCE, "output impedance", "ohm", true),
> PCONFDUMP(PIN_CONFIG_POWER_SOURCE, "pin power source", "selector", true),
> PCONFDUMP(PIN_CONFIG_SLEEP_HARDWARE_STATE, "sleep hardware state", NULL, false),
> PCONFDUMP(PIN_CONFIG_SLEW_RATE, "slew rate", NULL, true),
> @@ -179,6 +180,7 @@ static const struct pinconf_generic_params dt_params[] = {
> { "output-disable", PIN_CONFIG_OUTPUT_ENABLE, 0 },
> { "output-enable", PIN_CONFIG_OUTPUT_ENABLE, 1 },
> { "output-high", PIN_CONFIG_OUTPUT, 1, },
> + { "output-impedance", PIN_CONFIG_OUTPUT_IMPEDANCE, 0 },

"output-impedance-ohms", as per DT standardized property units.

> { "output-low", PIN_CONFIG_OUTPUT, 0, },
> { "power-source", PIN_CONFIG_POWER_SOURCE, 0 },
> { "sleep-hardware-state", PIN_CONFIG_SLEEP_HARDWARE_STATE, 0 },

With the above fixed:
Reviewed-by: Geert Uytterhoeven <[email protected]>

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

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

2021-10-27 09:43:47

by Lad, Prabhakar

[permalink] [raw]
Subject: Re: [RFC PATCH 2/4] pinctrl: pinconf-generic: Add support for "output-impedance" to be extracted from DT files

Hi Geert,

Thank you for the review.

On Thu, Oct 7, 2021 at 6:02 PM Geert Uytterhoeven <[email protected]> wrote:
>
> Hi Prabhakar,
>
> On Thu, Sep 30, 2021 at 2:17 PM Lad Prabhakar
> <[email protected]> wrote:
> > Add "output-impedance" property to generic options used for DT parsing
> > files. This enables drivers, which use generic pin configurations, to
> > get the value passed to this property.
> >
> > Signed-off-by: Lad Prabhakar <[email protected]>
>
> Thanks for your patch!
>
> > --- a/drivers/pinctrl/pinconf-generic.c
> > +++ b/drivers/pinctrl/pinconf-generic.c
> > @@ -46,6 +46,7 @@ static const struct pin_config_item conf_items[] = {
> > PCONFDUMP(PIN_CONFIG_MODE_LOW_POWER, "pin low power", "mode", true),
> > PCONFDUMP(PIN_CONFIG_OUTPUT_ENABLE, "output enabled", NULL, false),
> > PCONFDUMP(PIN_CONFIG_OUTPUT, "pin output", "level", true),
> > + PCONFDUMP(PIN_CONFIG_OUTPUT_IMPEDANCE, "output impedance", "ohm", true),
> > PCONFDUMP(PIN_CONFIG_POWER_SOURCE, "pin power source", "selector", true),
> > PCONFDUMP(PIN_CONFIG_SLEEP_HARDWARE_STATE, "sleep hardware state", NULL, false),
> > PCONFDUMP(PIN_CONFIG_SLEW_RATE, "slew rate", NULL, true),
> > @@ -179,6 +180,7 @@ static const struct pinconf_generic_params dt_params[] = {
> > { "output-disable", PIN_CONFIG_OUTPUT_ENABLE, 0 },
> > { "output-enable", PIN_CONFIG_OUTPUT_ENABLE, 1 },
> > { "output-high", PIN_CONFIG_OUTPUT, 1, },
> > + { "output-impedance", PIN_CONFIG_OUTPUT_IMPEDANCE, 0 },
>
> "output-impedance-ohms", as per DT standardized property units.
>
Sure will replace that with output-impedance-ohms and to chime in Ill
re-name the macro to PIN_CONFIG_OUTPUT_IMPEDANCE_OHMS

Cheers,
Prabhakar

> > { "output-low", PIN_CONFIG_OUTPUT, 0, },
> > { "power-source", PIN_CONFIG_POWER_SOURCE, 0 },
> > { "sleep-hardware-state", PIN_CONFIG_SLEEP_HARDWARE_STATE, 0 },
>
> With the above fixed:
> Reviewed-by: Geert Uytterhoeven <[email protected]>
>
> Gr{oetje,eeting}s,
>
> Geert
>
> --
> Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]
>
> 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