linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Bauer <mail@david-bauer.net>
To: unlisted-recipients:; (no To-header on input)
Cc: David Bauer <mail@david-bauer.net>,
	Linus Walleij <linus.walleij@linaro.org>,
	Rob Herring <robh+dt@kernel.org>,
	Mark Rutland <mark.rutland@arm.com>,
	linux-gpio@vger.kernel.org, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: [PATCH] gpio: 74x164: add lines-initial-states property
Date: Wed, 15 Aug 2018 22:18:54 +0200	[thread overview]
Message-ID: <20180815201855.29738-1-mail@david-bauer.net> (raw)

This adds the ability to define the initial state of each output line on
device probe.

Signed-off-by: David Bauer <mail@david-bauer.net>
---
 Documentation/devicetree/bindings/gpio/gpio-74x164.txt | 5 +++++
 drivers/gpio/gpio-74x164.c                             | 3 +++
 2 files changed, 8 insertions(+)

diff --git a/Documentation/devicetree/bindings/gpio/gpio-74x164.txt b/Documentation/devicetree/bindings/gpio/gpio-74x164.txt
index 2a97553d8d76..580b18065ad3 100644
--- a/Documentation/devicetree/bindings/gpio/gpio-74x164.txt
+++ b/Documentation/devicetree/bindings/gpio/gpio-74x164.txt
@@ -14,6 +14,11 @@ Required properties:
 
 Optional properties:
 - enable-gpios: GPIO connected to the OE (Output Enable) pin.
+- lines-initial-states: Bitmask that specifies the initial state of
+  each line. When a bit is set to zero, the corresponding output line
+  is initialized LOW. When a bit is set to one, the corresponding
+  output line is initialized HIGH. In case this property is not
+  defined, all lines will be initialized as LOW.
 
 Example:
 
diff --git a/drivers/gpio/gpio-74x164.c b/drivers/gpio/gpio-74x164.c
index fb7b620763a2..275310a0a538 100644
--- a/drivers/gpio/gpio-74x164.c
+++ b/drivers/gpio/gpio-74x164.c
@@ -150,6 +150,9 @@ static int gen_74x164_probe(struct spi_device *spi)
 	chip->gpio_chip.parent = &spi->dev;
 	chip->gpio_chip.owner = THIS_MODULE;
 
+	of_property_read_u8_array(spi->dev.of_node, "lines-initial-states",
+				  chip->buffer, chip->registers);
+
 	mutex_init(&chip->lock);
 
 	ret = __gen_74x164_write_config(chip);
-- 
2.18.0


             reply	other threads:[~2018-08-15 20:25 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-15 20:18 David Bauer [this message]
2018-08-16  8:11 ` [PATCH] gpio: 74x164: add lines-initial-states property Linus Walleij
2018-08-19 23:55   ` David Bauer
2018-08-17 15:10 ` 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=20180815201855.29738-1-mail@david-bauer.net \
    --to=mail@david-bauer.net \
    --cc=devicetree@vger.kernel.org \
    --cc=linus.walleij@linaro.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --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).