linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] gpio: gpio-74x164: add support for CDx4HC4094
@ 2022-07-21  9:34 Marcus Folkesson
  2022-07-21  9:34 ` [PATCH 2/2] dt-bindings: gpio: fairchild,74hc595: add strobe-gpios property Marcus Folkesson
                   ` (2 more replies)
  0 siblings, 3 replies; 19+ messages in thread
From: Marcus Folkesson @ 2022-07-21  9:34 UTC (permalink / raw)
  To: Linus Walleij, Bartosz Golaszewski, Rob Herring,
	Krzysztof Kozlowski, Maxime Ripard
  Cc: linux-gpio, devicetree, linux-kernel, Marcus Folkesson

74hc4094 and 75hc4094 works similar to 74x164 but has an additional
storage latch associated with each stage for strobing data from the
serial input to parallell buffer tri-state output.

Add support for an optional strobe pin.

Signed-off-by: Marcus Folkesson <marcus.folkesson@gmail.com>
---
 drivers/gpio/gpio-74x164.c | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

diff --git a/drivers/gpio/gpio-74x164.c b/drivers/gpio/gpio-74x164.c
index e00c33310517..4a1c4de358e4 100644
--- a/drivers/gpio/gpio-74x164.c
+++ b/drivers/gpio/gpio-74x164.c
@@ -21,6 +21,7 @@ struct gen_74x164_chip {
 	struct gpio_chip	gpio_chip;
 	struct mutex		lock;
 	struct gpio_desc	*gpiod_oe;
+	struct gpio_desc	*gpiod_strobe;
 	u32			registers;
 	/*
 	 * Since the registers are chained, every byte sent will make
@@ -66,6 +67,10 @@ static void gen_74x164_set_value(struct gpio_chip *gc,
 		chip->buffer[bank] &= ~(1 << pin);
 
 	__gen_74x164_write_config(chip);
+
+	/*  Latch data to output pins*/
+	gpiod_set_value_cansleep(chip->gpiod_strobe, 1);
+	gpiod_set_value_cansleep(chip->gpiod_strobe, 0);
 	mutex_unlock(&chip->lock);
 }
 
@@ -87,6 +92,10 @@ static void gen_74x164_set_multiple(struct gpio_chip *gc, unsigned long *mask,
 		chip->buffer[bank] |= bitmask;
 	}
 	__gen_74x164_write_config(chip);
+
+	/*  Latch data to output pins*/
+	gpiod_set_value_cansleep(chip->gpiod_strobe, 1);
+	gpiod_set_value_cansleep(chip->gpiod_strobe, 0);
 	mutex_unlock(&chip->lock);
 }
 
@@ -129,6 +138,12 @@ static int gen_74x164_probe(struct spi_device *spi)
 
 	gpiod_set_value_cansleep(chip->gpiod_oe, 1);
 
+	chip->gpiod_strobe = devm_gpiod_get_optional(&spi->dev, "strobe",
+			GPIOD_OUT_LOW);
+	if (IS_ERR(chip->gpiod_strobe))
+		return PTR_ERR(chip->gpiod_strobe);
+
+
 	spi_set_drvdata(spi, chip);
 
 	chip->gpio_chip.label = spi->modalias;
@@ -153,6 +168,10 @@ static int gen_74x164_probe(struct spi_device *spi)
 		goto exit_destroy;
 	}
 
+	/*  Latch data to output pins*/
+	gpiod_set_value_cansleep(chip->gpiod_strobe, 1);
+	gpiod_set_value_cansleep(chip->gpiod_strobe, 0);
+
 	ret = gpiochip_add_data(&chip->gpio_chip, chip);
 	if (!ret)
 		return 0;
@@ -182,6 +201,8 @@ MODULE_DEVICE_TABLE(spi, gen_74x164_spi_ids);
 static const struct of_device_id gen_74x164_dt_ids[] = {
 	{ .compatible = "fairchild,74hc595" },
 	{ .compatible = "nxp,74lvc594" },
+	{ .compatible = "ti,cd54hc4094" },
+	{ .compatible = "ti,cd74hc4094" },
 	{},
 };
 MODULE_DEVICE_TABLE(of, gen_74x164_dt_ids);
-- 
2.36.1


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

end of thread, other threads:[~2022-07-26  9:04 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-21  9:34 [PATCH 1/2] gpio: gpio-74x164: add support for CDx4HC4094 Marcus Folkesson
2022-07-21  9:34 ` [PATCH 2/2] dt-bindings: gpio: fairchild,74hc595: add strobe-gpios property Marcus Folkesson
2022-07-21 10:03   ` Krzysztof Kozlowski
2022-07-26  7:48   ` Linus Walleij
2022-07-21 11:53 ` [PATCH 1/2] gpio: gpio-74x164: add support for CDx4HC4094 Alexander Dahl
2022-07-25  9:32 ` Andy Shevchenko
2022-07-25  9:34   ` Andy Shevchenko
2022-07-25 11:24   ` Marcus Folkesson
2022-07-25 13:54   ` Linus Walleij
2022-07-25 20:41     ` Andy Shevchenko
2022-07-25 20:48     ` Andy Shevchenko
2022-07-25 22:22       ` Linus Walleij
2022-07-26  6:54         ` Andy Shevchenko
2022-07-26  7:00           ` Andy Shevchenko
2022-07-26  7:02             ` Andy Shevchenko
2022-07-26  7:23           ` Linus Walleij
2022-07-26  7:30             ` Andy Shevchenko
2022-07-26  8:28               ` Linus Walleij
2022-07-26  9:03                 ` Andy Shevchenko

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).