mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Ahmad Fatoum <a.fatoum@pengutronix.de>
To: barebox@lists.infradead.org
Subject: [PATCH v2 0/9] gpio: add proper gpiod API
Date: Thu, 22 Jun 2023 09:23:20 +0200	[thread overview]
Message-ID: <20230622072329.1339317-1-a.fatoum@pengutronix.de> (raw)

The gpiod_ (GPIO descriptor) API used with Linux differs from barebox'
normal GPIO API:

 - gpiod handles are opaque pointers and not an integer, which users
   have an expectation of stability for

 - gpiod API uses logic levels by default with separate raw API for
   physical level instead of physical level by default and separate
   API taking active level into account.

The barebox gpiod_ API mimics the latter point, but still uses integers
requiring ugly and arguably error prone conversions when porting kernel
code.

This series fixes that by adding proper struct gpio_desc API like in
Linux and then builds upon that to port the kernel gpio-mux driver.

v1 -> v2:
  - drop unrelated help command patch
  - drop gpio-mux patch for separate sending out
  - rebase onto next
  - fix and add stubs for !CONFIG_GPIOLIB
  - rename internal gpioinfo_ functions to gpiodesc_

v1 was here:
https://lore.barebox.org/barebox/20230621092700.GE18491@pengutronix.de/T/#t

Ahmad Fatoum (9):
  driver: include dev_print and family from <driver.h>
  include: linux/printk: define new dev_errp_probe
  gpio: have gpiod_ functions return and accept pointers
  gpio: gpiolib: rename struct gpio_info to gpio_desc
  gpiolib: export proper gpio descriptor API
  bitmap: implement bitmap_{to,from}_arr{32,64}
  gpiolib: factor out finding gpio property
  gpiolib: add support for requesting and setting gpiod arrays
  gpiolib: rename gpioinfo_ to gpiodesc_

 drivers/gpio/gpio-pca953x.c              |   9 +-
 drivers/gpio/gpiolib.c                   | 528 +++++++++++++++++------
 drivers/mci/mci_spi.c                    |  13 +-
 drivers/mtd/nand/atmel/nand-controller.c |  40 +-
 drivers/mtd/nand/nand_base.c             |   6 +-
 drivers/net/designware_eqos.c            |  26 +-
 drivers/net/ksz8873.c                    |  13 +-
 drivers/net/ksz9477.c                    |  13 +-
 drivers/net/realtek-dsa/realtek-mdio.c   |  10 +-
 drivers/net/realtek-dsa/realtek-smi.c    |  18 +-
 drivers/net/realtek-dsa/realtek.h        |   6 +-
 drivers/net/sja1105.c                    |  25 +-
 drivers/nvmem/starfive-otp.c             |  12 +-
 drivers/pci/pcie-dw-rockchip.c           |  14 +-
 drivers/power/reset/gpio-poweroff.c      |  14 +-
 drivers/power/reset/gpio-restart.c       |  23 +-
 drivers/regulator/fixed.c                |  27 +-
 drivers/sound/gpio-beeper.c              |  14 +-
 drivers/usb/misc/onboard_usb_hub.c       |  11 +-
 drivers/video/mipi_dbi.c                 |   8 +-
 drivers/video/panel-ilitek-ili9341.c     |  17 +-
 drivers/video/panel-mipi-dbi.c           |  17 +-
 drivers/watchdog/gpio_wdt.c              |  22 +-
 include/driver.h                         |   1 +
 include/gpiod.h                          |  79 +---
 include/linux/bitmap.h                   | 101 +++++
 include/linux/gpio/consumer.h            | 224 ++++++++++
 include/linux/mtd/rawnand.h              |   4 +-
 include/linux/printk.h                   |   3 +
 include/video/mipi_dbi.h                 |   7 +-
 lib/bitmap.c                             | 103 +++++
 31 files changed, 1019 insertions(+), 389 deletions(-)
 create mode 100644 include/linux/gpio/consumer.h

-- 
2.39.2




             reply	other threads:[~2023-06-22  7:25 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-22  7:23 Ahmad Fatoum [this message]
2023-06-22  7:23 ` [PATCH v2 1/9] driver: include dev_print and family from <driver.h> Ahmad Fatoum
2023-06-22  7:23 ` [PATCH v2 2/9] include: linux/printk: define new dev_errp_probe Ahmad Fatoum
2023-06-22  7:23 ` [PATCH v2 3/9] gpio: have gpiod_ functions return and accept pointers Ahmad Fatoum
2023-06-22  7:23 ` [PATCH v2 4/9] gpio: gpiolib: rename struct gpio_info to gpio_desc Ahmad Fatoum
2023-06-22  7:23 ` [PATCH v2 5/9] gpiolib: export proper gpio descriptor API Ahmad Fatoum
2023-06-22  7:23 ` [PATCH v2 6/9] bitmap: implement bitmap_{to,from}_arr{32,64} Ahmad Fatoum
2023-06-22  7:23 ` [PATCH v2 7/9] gpiolib: factor out finding gpio property Ahmad Fatoum
2023-06-22  7:23 ` [PATCH v2 8/9] gpiolib: add support for requesting and setting gpiod arrays Ahmad Fatoum
2023-06-22  7:23 ` [PATCH v2 9/9] gpiolib: rename gpioinfo_ to gpiodesc_ Ahmad Fatoum
2023-06-23  9:34 ` [PATCH v2 0/9] gpio: add proper gpiod API Sascha Hauer

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=20230622072329.1339317-1-a.fatoum@pengutronix.de \
    --to=a.fatoum@pengutronix.de \
    --cc=barebox@lists.infradead.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