linux-gpio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Konrad Dybcio <konrad.dybcio@linaro.org>
To: linux-arm-msm@vger.kernel.org, andersson@kernel.org,
	agross@kernel.org, krzysztof.kozlowski@linaro.org
Cc: marijn.suijten@somainline.org,
	Konrad Dybcio <konrad.dybcio@linaro.org>,
	Linus Walleij <linus.walleij@linaro.org>,
	Rob Herring <robh+dt@kernel.org>,
	Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>,
	linux-gpio@vger.kernel.org, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: [RFC PATCH 1/2] dt-bindings: pincfg-node: Introduce an overridable way to set bias on pins
Date: Mon, 30 Jan 2023 17:54:34 +0100	[thread overview]
Message-ID: <20230130165435.2347569-1-konrad.dybcio@linaro.org> (raw)

We came to a point where we sometimes we support a few dozen boards
with a given SoC. Sometimes, we have to take into consideration
configurations which deviate rather significatly from the reference
or most common designs. In the context of pinctrl, this often comes
down to wildly different pin configurations. While pins, function and
drive-strength are easily overridable, the (mostly) boolean properties
associated with setting bias, aren't. This wouldn't be much of a
problem if they didn't differ between boards so often, preventing us
from having a "nice" baseline setup without inevitably having to go
with an ugly /delete-property/. Introduce bias-type, a bias-type-
specific property and clone the pinconf-generic type enum into
dt-bindings to allow for setting the bias in an easily overridable
manner such as:

// SoC DT
i2c0_pin: i2c0-pin-state {
	pins = "gpio10";
	function = "gpio";
	bias-type = <BIAS_PULL_UP>;
};

// Deviant board DT
&i2c0_pin {
	bias-type = <BIAS_HIGH_IMPEDANCE>;
};

Signed-off-by: Konrad Dybcio <konrad.dybcio@linaro.org>
---
 .../bindings/pinctrl/pincfg-node.yaml         |  4 ++
 include/dt-bindings/pinctrl/pinconf-generic.h | 40 +++++++++++++++++++
 2 files changed, 44 insertions(+)
 create mode 100644 include/dt-bindings/pinctrl/pinconf-generic.h

diff --git a/Documentation/devicetree/bindings/pinctrl/pincfg-node.yaml b/Documentation/devicetree/bindings/pinctrl/pincfg-node.yaml
index be81ed22a036..d4ea563d283e 100644
--- a/Documentation/devicetree/bindings/pinctrl/pincfg-node.yaml
+++ b/Documentation/devicetree/bindings/pinctrl/pincfg-node.yaml
@@ -51,6 +51,10 @@ properties:
     description: use pin-default pull state. Takes as optional argument on
       hardware supporting it the pull strength in Ohm.
 
+  bias-type:
+    $ref: /schemas/types.yaml#/definitions/uint32
+    description: Use the specified bias type.
+
   drive-push-pull:
     oneOf:
       - type: boolean
diff --git a/include/dt-bindings/pinctrl/pinconf-generic.h b/include/dt-bindings/pinctrl/pinconf-generic.h
new file mode 100644
index 000000000000..7d9c7d8f9105
--- /dev/null
+++ b/include/dt-bindings/pinctrl/pinconf-generic.h
@@ -0,0 +1,40 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+/*
+ * Copyright (C) 2011 ST-Ericsson SA
+ * Written on behalf of Linaro for ST-Ericsson
+ *
+ * Author: Linus Walleij <linus.walleij@linaro.org>
+ */
+
+#ifndef _DT_BINDINGS_PINCTRL_PINCONF_GENERIC_H
+#define _DT_BINDINGS_PINCTRL_PINCONF_GENERIC_H
+
+#define BIAS_BUS_HOLD			0
+#define BIAS_DISABLE			1
+#define BIAS_HIGH_IMPEDANCE		2
+#define BIAS_PULL_DOWN			3
+#define BIAS_PULL_PIN_DEFAULT		4
+#define BIAS_PULL_UP			5
+#define DRIVE_OPEN_DRAIN		6
+#define DRIVE_OPEN_SOURCE		7
+#define DRIVE_PUSH_PULL			8
+#define DRIVE_STRENGTH			9
+#define DRIVE_STRENGTH_UA		10
+#define INPUT_DEBOUNCE			11
+#define INPUT_ENABLE			12
+#define INPUT_SCHMITT			13
+#define INPUT_SCHMITT_ENABLE		14
+#define MODE_LOW_POWER			15
+#define MODE_PWM			16
+#define OUTPUT				17
+#define OUTPUT_ENABLE			18
+#define OUTPUT_IMPEDANCE_OHMS		19
+#define PERSIST_STATE			20
+#define POWER_SOURCE			21
+#define SKEW_DELAY			22
+#define SLEEP_HARDWARE_STATE		23
+#define SLEW_RATE			24
+#define PIN_CONFIG_END			0x7F
+#define PIN_CONFIG_MAX			0xFF
+
+#endif
-- 
2.39.1


             reply	other threads:[~2023-01-30 16:54 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-30 16:54 Konrad Dybcio [this message]
2023-01-30 16:54 ` [RFC PATCH 2/2] pinctrl: pinconf-generic: Add an overridable way to set bias property Konrad Dybcio
2023-01-30 23:10 ` [RFC PATCH 1/2] dt-bindings: pincfg-node: Introduce an overridable way to set bias on pins Linus Walleij
2023-01-30 23:50   ` Konrad Dybcio
2023-01-31 13:21     ` Linus Walleij
2023-02-01  1:57       ` Rob Herring

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230130165435.2347569-1-konrad.dybcio@linaro.org \
    --to=konrad.dybcio@linaro.org \
    --cc=agross@kernel.org \
    --cc=andersson@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=krzysztof.kozlowski+dt@linaro.org \
    --cc=krzysztof.kozlowski@linaro.org \
    --cc=linus.walleij@linaro.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=marijn.suijten@somainline.org \
    --cc=robh+dt@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).