linux-gpio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Mauri Sandberg <sandberg@mailfence.com>
To: sandberg@mailfence.com
Cc: andy.shevchenko@gmail.com, bgolaszewski@baylibre.com,
	geert+renesas@glider.be, linus.walleij@linaro.org,
	linux-gpio@vger.kernel.org, drew@beagleboard.org
Subject: [RFC v2 0/2] gpio: add generic gpio input multiplexer
Date: Mon, 29 Mar 2021 16:57:27 +0300	[thread overview]
Message-ID: <20210329135729.10523-1-sandberg@mailfence.com> (raw)
In-Reply-To: <20210325122832.119147-1-sandberg@mailfence.com>

v2:
 - removed .owner from platform_driver as per test bot's instruction
 - added MODULE_AUTHOR, MODULE_DESCRIPTION, MODULE_LICENSE
 - added gpio_mux_input_get_direction as it's recommended for all chips
 - removed because this is input only chip:
     gpio_mux_input_set_value
 - removed because they are not needed for input/output only chips:
     gpio_mux_input_direction_input
     gpio_mux_input_direction_output
 - fixed typo in an error message
 - added info message about successful registration
 - removed can_sleep flag as this does not sleep while getting GPIO value
   like I2C or SPI do
 - added a little bit more text in the binding documenation
 - Updated description in Kconfig

rangediff v1...v2
1:  addd7422268e ! 1:  37eef51e67be dt-bindings: gpio-mux-input: add documentation
    @@ Documentation/devicetree/bindings/gpio/gpio-mux-input.yaml (new)
     +$id: http://devicetree.org/schemas/gpio/gpio-mux-input.yaml#
     +$schema: http://devicetree.org/meta-schemas/core.yaml#
     +
    -+title: GPIO input multiplexer
    ++title: Generic GPIO input multiplexer
     +
     +maintainers:
     +  - Mauri Sandberg <sandberg@mailfence.com>
    @@ Documentation/devicetree/bindings/gpio/gpio-mux-input.yaml (new)
     +description: |
     +  A generic GPIO based input multiplexer
     +
    -+  This driver uses mux-controller to drive the multiplexer.
    ++  This driver uses a mux-controller to drive the multiplexer and has a single
    ++  output pin for reading the inputs to the mux.
     +
    -+  For consumer use see gpio.txt.
    ++  For GPIO consumer documentation see gpio.txt.
     +
     +properties:
     +  compatible:
    @@ Documentation/devicetree/bindings/gpio/gpio-mux-input.yaml (new)
     +
     +  pin-gpios:
     +    description: |
    -+      The GPIO pin used the output from the multiplexer
    ++      The GPIO pin used as the output from the multiplexer
     +
     +required:
     +  - compatible
    @@ Documentation/devicetree/bindings/gpio/gpio-mux-input.yaml (new)
     +        #gpio-cells = <2>;
     +
     +        // GPIOs used by this node, mux output pin
    -+        pin-gpios = <&gpio 12 GPIO_ACTIVE_HIGH>;	/* 1y */
    ++        pin-gpios = <&gpio 12 GPIO_ACTIVE_HIGH>;
     +    };
     +
     +...
2:  067ac01b2ce6 ! 2:  01e497d16a25 gpio: gpio-mux-input: add generic gpio input multiplexer
    @@ Metadata
      ## Commit message ##
         gpio: gpio-mux-input: add generic gpio input multiplexer
     
    -    Suppport for a general GPIO multiplexer. To drive the multiplexer a
    +    Adds support for a generic GPIO multiplexer. To drive the multiplexer a
         mux-controller is needed. The output pin of the multiplexer is a GPIO
         pin.
     
    +    Reported-by: kernel test robot <lkp@intel.com>
         Signed-off-by: Mauri Sandberg <sandberg@mailfence.com>
     
      ## drivers/gpio/Kconfig ##
    @@ drivers/gpio/Kconfig: config GPIO_SIM
     +
     +config GPIO_MUX_INPUT
     +	tristate "General GPIO input multiplexer"
    ++	depends on OF_GPIO
     +	select MULTIPLEXER
     +	select MUX_GPIO
    -+	depends on OF_GPIO
     +	help
    -+	  Say yes here to enable support for generic GPIO input multiplexer. This
    -+	  needs a multiplexer controller to drive the select pins.
    ++	  Say yes here to enable support for generic GPIO input multiplexer.
    ++
    ++  	  This driver uses a mux-controller to drive the multiplexer and has a
    ++  	  single output pin for reading the inputs to the mux.
     +
      endif
     
    @@ drivers/gpio/gpio-mux-input.c (new)
     +	return container_of(gc, struct gpio_mux_input, gpio_chip);
     +}
     +
    -+static int gpio_mux_input_direction_input(struct gpio_chip *gc,
    -+				       unsigned int offset)
    -+{
    -+	return 0;
    -+}
    -+
    -+static int gpio_mux_input_direction_output(struct gpio_chip *gc,
    -+					unsigned int offset, int val)
    ++static int gpio_mux_input_get_direction(struct gpio_chip *gc,
    ++					unsigned int offset)
     +{
    -+	return -EINVAL;
    ++	return GPIO_LINE_DIRECTION_IN;
     +}
     +
     +static int gpio_mux_input_get_value(struct gpio_chip *gc, unsigned int offset)
    @@ drivers/gpio/gpio-mux-input.c (new)
     +	return ret;
     +}
     +
    -+static void gpio_mux_input_set_value(struct gpio_chip *gc,
    -+				  unsigned int offset, int val)
    -+{
    -+	/* not supported */
    -+}
    -+
     +static int gpio_mux_input_probe(struct platform_device *pdev)
     +{
     +	struct device_node *np = pdev->dev.of_node;
    @@ drivers/gpio/gpio-mux-input.c (new)
     +	pin = gpiod_get(&pdev->dev, "pin",  GPIOD_IN);
     +	if (IS_ERR(pin)) {
     +		err = (int) PTR_ERR(pin);
    -+		dev_err(&pdev->dev, "unable to claim pin GPIOs: %d\n", err);
    ++		dev_err(&pdev->dev, "unable to claim pin GPIO: %d\n", err);
     +		goto err_free_mc;
     +	}
     +
    @@ drivers/gpio/gpio-mux-input.c (new)
     +	mux->parent = &pdev->dev;
     +
     +	gc = &mux->gpio_chip;
    -+	gc->direction_input  = gpio_mux_input_direction_input;
    -+	gc->direction_output = gpio_mux_input_direction_output;
     +	gc->get = gpio_mux_input_get_value;
    -+	gc->set = gpio_mux_input_set_value;
    -+	gc->can_sleep = 1;
    ++	gc->get_direction = gpio_mux_input_get_direction;
     +
     +	gc->base = -1;
     +	gc->ngpio = mux_control_states(mc);
    @@ drivers/gpio/gpio-mux-input.c (new)
     +	}
     +
     +	platform_set_drvdata(pdev, mux);
    ++
    ++	dev_info(&pdev->dev, "registered %u input GPIOs\n", gc->ngpio);
    ++
     +	return 0;
     +
     +err_free_pin:
    @@ drivers/gpio/gpio-mux-input.c (new)
     +static struct platform_driver gpio_mux_input_driver = {
     +	.driver	= {
     +		.name		= "gpio-mux-input",
    -+		.owner		= THIS_MODULE,
     +		.of_match_table = gpio_mux_input_id,
     +	},
     +	.probe	= gpio_mux_input_probe,
     +};
     +module_platform_driver(gpio_mux_input_driver);
    ++
    ++MODULE_AUTHOR("Mauri Sandberg <sandberg@mailfence.com>");
    ++MODULE_DESCRIPTION("Generic GPIO input multiplexer");
    ++MODULE_LICENSE("GPL");


Mauri Sandberg (2):
  dt-bindings: gpio-mux-input: add documentation
  gpio: gpio-mux-input: add generic gpio input multiplexer

 .../bindings/gpio/gpio-mux-input.yaml         |  56 ++++++++
 drivers/gpio/Kconfig                          |  13 ++
 drivers/gpio/Makefile                         |   1 +
 drivers/gpio/gpio-mux-input.c                 | 134 ++++++++++++++++++
 4 files changed, 204 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/gpio/gpio-mux-input.yaml
 create mode 100644 drivers/gpio/gpio-mux-input.c


base-commit: 9d940ab7264574be59ce3a953dc33de9250429eb
-- 
2.25.1


  parent reply	other threads:[~2021-03-29 14:01 UTC|newest]

Thread overview: 60+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-25 12:28 [RFC gpio/for-next 0/2] gpio: add generic gpio input multiplexer Mauri Sandberg
2021-03-25 12:28 ` [RFC gpio/for-next 1/2] dt-bindings: gpio-mux-input: add documentation Mauri Sandberg
2021-03-25 12:28 ` [RFC gpio/for-next 2/2] gpio: gpio-mux-input: add generic gpio input multiplexer Mauri Sandberg
2021-03-26  6:59   ` Drew Fustini
2021-03-26 10:32     ` Mauri Sandberg
2021-03-26 10:49       ` Andy Shevchenko
2021-03-29 13:57 ` Mauri Sandberg [this message]
2021-03-29 13:57   ` [RFC v2 1/2] dt-bindings: gpio-mux-input: add documentation Mauri Sandberg
2021-03-29 13:57   ` [RFC v2 2/2] gpio: gpio-mux-input: add generic gpio input multiplexer Mauri Sandberg
2021-05-17 16:58 ` [PATCH v3 0/2] gpio: " Mauri Sandberg
2021-05-17 16:58   ` [PATCH v3 1/2] dt-bindings: gpio-mux-input: add documentation Mauri Sandberg
2021-05-17 16:58   ` [PATCH v3 2/2] gpio: gpio-mux-input: add generic gpio input multiplexer Mauri Sandberg
2021-05-17 22:13   ` [PATCH v3 0/2] gpio: " Drew Fustini
2021-05-28  0:23     ` Linus Walleij
2021-05-28  0:27       ` Drew Fustini
2021-05-24 21:25   ` Drew Fustini
2021-05-24 16:29 ` RESEND PATCH v3 Mauri Sandberg
2021-05-24 16:29   ` [PATCH v3 1/2] dt-bindings: gpio-mux-input: add documentation Mauri Sandberg
2021-05-24 16:29   ` [PATCH v3 2/2] gpio: gpio-mux-input: add generic gpio input multiplexer Mauri Sandberg
2021-05-24 21:29   ` RESEND PATCH v3 Drew Fustini
2021-05-30 16:13 ` [PATCH v4 0/2] gpio: add generic gpio input multiplexer Mauri Sandberg
2021-05-30 16:13   ` [PATCH v4 1/2] dt-bindings: gpio-mux-input: add documentation Mauri Sandberg
2021-06-01 10:10     ` Linus Walleij
2021-06-01 10:44     ` Linus Walleij
2021-06-02  9:31       ` Mauri Sandberg
2021-06-02 10:35         ` Linus Walleij
2021-06-02 11:21           ` Mauri Sandberg
2021-06-04  7:51             ` Linus Walleij
2021-06-01 13:32     ` Rob Herring
2021-06-02 11:36       ` Mauri Sandberg
2021-05-30 16:13   ` [PATCH v4 2/2] gpio: gpio-mux-input: add generic gpio input multiplexer Mauri Sandberg
2021-05-30 18:09     ` Andy Shevchenko
2021-05-30 19:02       ` Mauri Sandberg
2021-05-30 19:38         ` Andy Shevchenko
2021-05-31 10:19           ` Mauri Sandberg
2021-06-01 10:38     ` Linus Walleij
2021-06-21 17:20 ` [PATCH v5 0/2] gpio: add generic gpio cascade Mauri Sandberg
2021-06-21 17:20   ` [PATCH v5 1/2] dt-bindings: gpio-cascade: add documentation Mauri Sandberg
2021-06-24 18:30     ` Rob Herring
2021-06-21 17:20   ` [PATCH v5 2/2] gpio: gpio-cascade: add generic GPIO cascade Mauri Sandberg
2021-06-21 17:43     ` Andy Shevchenko
2021-06-21 18:31       ` Enrico Weigelt, metux IT consult
2021-10-15 12:56       ` Mauri Sandberg
2021-10-15 17:20         ` Andy Shevchenko
2021-10-19 12:57 ` [PATCH v6 0/2] " Mauri Sandberg
2021-10-19 12:57   ` [PATCH v6 1/2] dt-bindings: gpio-cascade: add documentation Mauri Sandberg
2021-10-19 12:57   ` [PATCH v6 2/2] gpio: gpio-cascade: add generic GPIO cascade Mauri Sandberg
2021-10-19 13:12     ` Andy Shevchenko
2021-10-19 20:08 ` [PATCH v7 0/2] " Mauri Sandberg
2021-10-19 20:08   ` [PATCH v7 1/2] dt-bindings: gpio-cascade: add documentation Mauri Sandberg
2021-10-24 22:18     ` Linus Walleij
2021-10-19 20:08   ` [PATCH v7 2/2] gpio: gpio-cascade: add generic GPIO cascade Mauri Sandberg
2021-10-24 22:17     ` Linus Walleij
2021-10-25  9:29     ` Andy Shevchenko
2021-10-26 19:15 ` [PATCH v8 0/2] " Mauri Sandberg
2021-10-26 19:15   ` [PATCH v8 1/2] dt-bindings: gpio-cascade: add documentation Mauri Sandberg
2021-10-26 19:15   ` [PATCH v8 2/2] gpio: gpio-cascade: add generic GPIO cascade Mauri Sandberg
2022-02-05 21:59 ` [RESEND v8 0/2] " Mauri Sandberg
2022-02-05 21:59   ` [RESEND v8 1/2] dt-bindings: gpio-cascade: add documentation Mauri Sandberg
2022-02-05 21:59   ` [RESEND v8 2/2] gpio: gpio-cascade: add generic GPIO cascade Mauri Sandberg

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=20210329135729.10523-1-sandberg@mailfence.com \
    --to=sandberg@mailfence.com \
    --cc=andy.shevchenko@gmail.com \
    --cc=bgolaszewski@baylibre.com \
    --cc=drew@beagleboard.org \
    --cc=geert+renesas@glider.be \
    --cc=linus.walleij@linaro.org \
    --cc=linux-gpio@vger.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).