All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v6 0/2] gpio: Update and simplify the uclass API
@ 2021-03-21  4:29 Simon Glass
  2021-03-21  4:29 ` [PATCH v6 1/2] gpio: i2c-gpio: Drop use of dm_gpio_set_dir() Simon Glass
  2021-03-21  4:29 ` [PATCH v6 2/2] gpio: Drop dm_gpio_set_dir() Simon Glass
  0 siblings, 2 replies; 4+ messages in thread
From: Simon Glass @ 2021-03-21  4:29 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 v6:
- Use dm_gpio_clrset_flags() so that direction can be changed
- Simplify the code since masking is not needed

Changes in v5:
- Drop patches previously applied

Simon Glass (2):
  gpio: i2c-gpio: Drop use of dm_gpio_set_dir()
  gpio: Drop dm_gpio_set_dir()

 drivers/gpio/gpio-uclass.c | 11 -----------
 drivers/i2c/i2c-gpio.c     | 19 +++++++++----------
 include/asm-generic/gpio.h | 11 -----------
 3 files changed, 9 insertions(+), 32 deletions(-)

-- 
2.31.0.rc2.261.g7f71774620-goog

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

end of thread, other threads:[~2021-03-22 10:32 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-21  4:29 [PATCH v6 0/2] gpio: Update and simplify the uclass API Simon Glass
2021-03-21  4:29 ` [PATCH v6 1/2] gpio: i2c-gpio: Drop use of dm_gpio_set_dir() Simon Glass
2021-03-22 10:32   ` Harm Berntsen
2021-03-21  4:29 ` [PATCH v6 2/2] gpio: Drop dm_gpio_set_dir() Simon Glass

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.