[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Ytk+H/w78QWov0nL@ada.ifak-system.com>
Date: Thu, 21 Jul 2022 13:53:03 +0200
From: Alexander Dahl <ada@...rsis.com>
To: Marcus Folkesson <marcus.folkesson@...il.com>
Cc: Linus Walleij <linus.walleij@...aro.org>,
Bartosz Golaszewski <brgl@...ev.pl>,
Rob Herring <robh+dt@...nel.org>,
Krzysztof Kozlowski <krzysztof.kozlowski+dt@...aro.org>,
Maxime Ripard <mripard@...nel.org>, linux-gpio@...r.kernel.org,
devicetree@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 1/2] gpio: gpio-74x164: add support for CDx4HC4094
Hello Marcus,
Am Thu, Jul 21, 2022 at 11:34:21AM +0200 schrieb Marcus Folkesson:
> 74hc4094 and 75hc4094 works similar to 74x164 but has an additional
^^
That 75 is probably a typo, isn't it?
Greets
Alex
> 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@...il.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
>
Powered by blists - more mailing lists