[PATCH v2 0/3] Add a simple latching_switch

Jian Zhang posted 3 patches 1 week, 1 day ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20220920184619.3370115-1-zhangjian.3032@bytedance.com
Maintainers: Peter Maydell <peter.maydell@linaro.org>, "Cédric Le Goater" <clg@kaod.org>, Andrew Jeffery <andrew@aj.id.au>, Joel Stanley <joel@jms.id.au>
MAINTAINERS                       |   2 +
hw/arm/Kconfig                    |   1 +
hw/arm/aspeed.c                   |  20 +++
hw/gpio/aspeed_gpio.c             |  17 +++
hw/misc/Kconfig                   |   3 +
hw/misc/latching_switch.c         | 212 ++++++++++++++++++++++++++++++
hw/misc/meson.build               |   1 +
include/hw/misc/latching_switch.h |  56 ++++++++
8 files changed, 312 insertions(+)
create mode 100644 hw/misc/latching_switch.c
create mode 100644 include/hw/misc/latching_switch.h
[PATCH v2 0/3] Add a simple latching_switch
Posted by Jian Zhang 1 week, 1 day ago
This patchset adds a simple latching_switch, which is a switch that
can be turned on/off by a trigger.

The latching switch is a switch that can be turned on and off.
When the input new state and match the trigger edge, the switch
state will be toggled.

This device privide 2 properties `state(bool)` and `trigger-edge(string)`,
and 2 gpios `input` and `output`.

The `state` property is the initial state of the switch, and the `trigger-edge`
property is the edge that will trigger the switch state to be toggled,
the value can be `rising`, `falling` or `both`.

V2:
- Rename `host-power` to `latching-switch`
- Add `trigger-edge` property
- Add `state` property
- Using anonymous gpio
- Rename power button to input, and power good to output
- Reorder the patchset
- Rebase to latest master

Jian Zhang (3):
  hw/misc/latching_switch: Add a simple latching_switch device
  hw/gpio/aspeed_gpio: Add gpios in/out init
  hw/arm/aspeed: g220a: Add a latching switch device

 MAINTAINERS                       |   2 +
 hw/arm/Kconfig                    |   1 +
 hw/arm/aspeed.c                   |  20 +++
 hw/gpio/aspeed_gpio.c             |  17 +++
 hw/misc/Kconfig                   |   3 +
 hw/misc/latching_switch.c         | 212 ++++++++++++++++++++++++++++++
 hw/misc/meson.build               |   1 +
 include/hw/misc/latching_switch.h |  56 ++++++++
 8 files changed, 312 insertions(+)
 create mode 100644 hw/misc/latching_switch.c
 create mode 100644 include/hw/misc/latching_switch.h

--
2.25.1