All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v4 00/16] gpio: Update and simplify the uclass API
@ 2021-02-05  4:21 Simon Glass
  2021-02-05  4:21 ` [PATCH v4 01/16] gpio: Disable functions not used with of-platdata Simon Glass
                   ` (15 more replies)
  0 siblings, 16 replies; 42+ messages in thread
From: Simon Glass @ 2021-02-05  4:21 UTC (permalink / raw)
  To: u-boot

At present the GPIO uclass mirrors what was in U-Boot before driver model.
It works well in most cases but is becoming cumbersome with things like
pull-up/down and drive strength. In those cases it is easier for the
driver to deal with all the flags at one, rather than piece by piece.

In fact the current API does not officially have a method for adjusting
anything other than the direction flags. While set_dir_flags() and
get_dir_flags() do in fact support changing other flags, this is not
documented.

Secondly, set_dir_flags actually ORs the current flags with the new ones
so it is not possible to clear flags. It seems better to use a clr/set
interface (bit clear followed by OR) to provide more flexibility.

Finally, direction_input() and direction_output() are really just the same
thing as set_dir_flags(), with a different name. We currently use the
latter if available, failing back to the former. But it makes sense to
deprecate the old methods.

This series makes the above changes. Existing drivers are mostly left
alone, since they should continue to operate as is. The sandbox driver is
updated to add the required new tests and the x86 driver is switched over
to the new API.

The STM32 driver should be checked to make sure the open source/open drain
features still work as intended.

Changes in v4:
- Update dm_gpio_set_dir_flags() to clear direction flags first

Changes in v3:
- Drop the word 'direction' in comments also
- Drop 'dir' in 'GPIO dir flags' comment
- Start at BIT(31) for sandbox-specific flags
- Add a comment to sandbox_gpio_set_flags() about clearing GPIOD_EXT_HIGH
- Incorporate GPIOD_FLAGS_OUTPUT() changes from Patrick Delaunay
- Use bit 30 for GPIOD_EXT_DRIVEN
- Split out the log-category change to a separate patch
- Use bits 28, 29 for the new flags
- Assert that count parameter is within range
- Redo digit logic to be easier to understand
- Update function comment to explain the meaning of the digits
- Fix 'compare' typo

Changes in v2:
- Use set_flags() instead of update_flags()
- Fix 'provide' typo while we are here
- Make operation of set_flags() deterministic
- Swap newf and flags in sb_gpio_set_flags()

Simon Glass (16):
  gpio: Disable functions not used with of-platdata
  dm: gpio: Rename set_dir_flags() method to update_flags()
  dm: gpio: Rename get_dir_flags() method to get_flags()
  gpio: Rename dm_gpio_get_dir_flags() to dm_gpio_get_flags()
  gpio: Drop dm_gpio_set_dir()
  gpio: sandbox: Rename GPIO dir_flags to flags
  gpio: sandbox: Use a separate flag for the value
  gpio: sandbox: Fully separate pin value from output value
  gpio: sandbox: Make sandbox_gpio_set_flags() set all flags
  dm: gpio: Add a way to update flags
  gpio: Replace direction_input() and direction_output()
  gpio: Use an 'ops' variable everywhere
  gpio: x86: Drop the deprecated methods in intel_gpio
  gpio: sandbox: Track whether a GPIO is driven
  gpio: Define the log category in the uclass
  gpio: Add a way to read 3-way strapping pins

 arch/sandbox/include/asm/gpio.h           |  17 +-
 arch/x86/include/asm/intel_pinctrl_defs.h |   5 +
 drivers/gpio/gpio-uclass.c                | 243 ++++++++++++++------
 drivers/gpio/intel_gpio.c                 |  72 +++---
 drivers/gpio/sandbox.c                    | 138 +++++++----
 drivers/gpio/stm32_gpio.c                 |  17 +-
 drivers/pinctrl/pinctrl-stmfx.c           |  19 +-
 include/asm-generic/gpio.h                | 139 +++++++++--
 test/dm/gpio.c                            | 268 +++++++++++++++++++---
 9 files changed, 690 insertions(+), 228 deletions(-)

-- 
2.30.0.478.g8a0d178c01-goog

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

end of thread, other threads:[~2021-03-04 18:15 UTC | newest]

Thread overview: 42+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-05  4:21 [PATCH v4 00/16] gpio: Update and simplify the uclass API Simon Glass
2021-02-05  4:21 ` [PATCH v4 01/16] gpio: Disable functions not used with of-platdata Simon Glass
2021-03-04 18:13   ` Tom Rini
2021-02-05  4:21 ` [PATCH v4 02/16] dm: gpio: Rename set_dir_flags() method to update_flags() Simon Glass
2021-03-04 18:14   ` Tom Rini
2021-02-05  4:21 ` [PATCH v4 03/16] dm: gpio: Rename get_dir_flags() method to get_flags() Simon Glass
2021-03-04 18:14   ` Tom Rini
2021-02-05  4:21 ` [PATCH v4 04/16] gpio: Rename dm_gpio_get_dir_flags() to dm_gpio_get_flags() Simon Glass
2021-03-04 18:14   ` Tom Rini
2021-02-05  4:21 ` [PATCH v4 05/16] gpio: Drop dm_gpio_set_dir() Simon Glass
2021-03-03 20:39   ` Tom Rini
2021-03-04 14:22     ` Simon Glass
2021-03-04 15:09       ` Tom Rini
2021-02-05  4:21 ` [PATCH v4 06/16] gpio: sandbox: Rename GPIO dir_flags to flags Simon Glass
2021-03-04 18:14   ` Tom Rini
2021-02-05  4:22 ` [PATCH v4 07/16] gpio: sandbox: Use a separate flag for the value Simon Glass
2021-03-04 18:14   ` Tom Rini
2021-02-05  4:22 ` [PATCH v4 08/16] gpio: sandbox: Fully separate pin value from output value Simon Glass
2021-03-04 18:14   ` Tom Rini
2021-02-05  4:22 ` [PATCH v4 09/16] gpio: sandbox: Make sandbox_gpio_set_flags() set all flags Simon Glass
2021-03-04 18:14   ` Tom Rini
2021-02-05  4:22 ` [PATCH v4 10/16] dm: gpio: Add a way to update flags Simon Glass
2021-02-08  9:00   ` Köry Maincent
2021-02-08 17:33   ` Patrick DELAUNAY
2021-02-09  4:28     ` Simon Glass
2021-02-10  8:38       ` Patrick DELAUNAY
2021-02-13  4:17         ` Simon Glass
2021-03-04 18:14   ` Tom Rini
2021-02-05  4:22 ` [PATCH v4 11/16] gpio: Replace direction_input() and direction_output() Simon Glass
2021-03-04 18:14   ` Tom Rini
2021-02-05  4:22 ` [PATCH v4 12/16] gpio: Use an 'ops' variable everywhere Simon Glass
2021-03-04 18:14   ` Tom Rini
2021-02-05  4:22 ` [PATCH v4 13/16] gpio: x86: Drop the deprecated methods in intel_gpio Simon Glass
2021-03-04 18:15   ` Tom Rini
2021-02-05  4:22 ` [PATCH v4 14/16] gpio: sandbox: Track whether a GPIO is driven Simon Glass
2021-03-04 18:15   ` Tom Rini
2021-02-05  4:22 ` [PATCH v4 15/16] gpio: Define the log category in the uclass Simon Glass
2021-03-04 18:15   ` Tom Rini
2021-02-05  4:22 ` [PATCH v4 16/16] gpio: Add a way to read 3-way strapping pins Simon Glass
2021-02-08 18:13   ` Patrick DELAUNAY
2021-02-08 23:41     ` Simon Glass
2021-03-04 18:15   ` Tom Rini

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.