[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 02/17] ARM: Virt: Use gpio_key for power button
From: |
Peter Maydell |
Subject: |
[Qemu-devel] [PULL 02/17] ARM: Virt: Use gpio_key for power button |
Date: |
Wed, 30 Mar 2016 15:57:34 +0100 |
From: Shannon Zhao <address@hidden>
There is a problem for power button that it will not work if an early
system_powerdown request happens before guest gpio driver loads.
Fix this problem by using gpio_key.
Signed-off-by: Shannon Zhao <address@hidden>
Message-id: address@hidden
Reviewed-by: Peter Maydell <address@hidden>
Signed-off-by: Peter Maydell <address@hidden>
---
hw/arm/virt.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/hw/arm/virt.c b/hw/arm/virt.c
index a5e787d..56d35c7 100644
--- a/hw/arm/virt.c
+++ b/hw/arm/virt.c
@@ -582,11 +582,11 @@ static void create_rtc(const VirtBoardInfo *vbi, qemu_irq
*pic)
g_free(nodename);
}
-static DeviceState *pl061_dev;
+static DeviceState *gpio_key_dev;
static void virt_powerdown_req(Notifier *n, void *opaque)
{
/* use gpio Pin 3 for power button event */
- qemu_set_irq(qdev_get_gpio_in(pl061_dev, 3), 1);
+ qemu_set_irq(qdev_get_gpio_in(gpio_key_dev, 0), 1);
}
static Notifier virt_system_powerdown_notifier = {
@@ -596,6 +596,7 @@ static Notifier virt_system_powerdown_notifier = {
static void create_gpio(const VirtBoardInfo *vbi, qemu_irq *pic)
{
char *nodename;
+ DeviceState *pl061_dev;
hwaddr base = vbi->memmap[VIRT_GPIO].base;
hwaddr size = vbi->memmap[VIRT_GPIO].size;
int irq = vbi->irqmap[VIRT_GPIO];
@@ -618,6 +619,8 @@ static void create_gpio(const VirtBoardInfo *vbi, qemu_irq
*pic)
qemu_fdt_setprop_string(vbi->fdt, nodename, "clock-names", "apb_pclk");
qemu_fdt_setprop_cell(vbi->fdt, nodename, "phandle", phandle);
+ gpio_key_dev = sysbus_create_simple("gpio-key", -1,
+ qdev_get_gpio_in(pl061_dev, 3));
qemu_fdt_add_subnode(vbi->fdt, "/gpio-keys");
qemu_fdt_setprop_string(vbi->fdt, "/gpio-keys", "compatible", "gpio-keys");
qemu_fdt_setprop_cell(vbi->fdt, "/gpio-keys", "#size-cells", 0);
--
1.9.1
- [Qemu-devel] [PULL 04/17] block: m25p80: RESET_ENABLE and RESET_MEMORY commands, (continued)
- [Qemu-devel] [PULL 04/17] block: m25p80: RESET_ENABLE and RESET_MEMORY commands, Peter Maydell, 2016/03/30
- [Qemu-devel] [PULL 09/17] block: m25p80: Dummy cycles for N25Q256/512, Peter Maydell, 2016/03/30
- [Qemu-devel] [PULL 06/17] block: m25p80: Extend address mode, Peter Maydell, 2016/03/30
- [Qemu-devel] [PULL 08/17] block: m25p80: Add configuration registers, Peter Maydell, 2016/03/30
- [Qemu-devel] [PULL 07/17] block: m25p80: 4byte address mode, Peter Maydell, 2016/03/30
- [Qemu-devel] [PULL 05/17] block: m25p80: Widen flags variable, Peter Maydell, 2016/03/30
- [Qemu-devel] [PULL 16/17] kvm: add kvm_device_supported() helper function, Peter Maydell, 2016/03/30
- [Qemu-devel] [PULL 10/17] block: m25p80: Fast read and 4bytes commands, Peter Maydell, 2016/03/30
- [Qemu-devel] [PULL 15/17] arm: enhance kvm_arm_create_scratch_host_vcpu, Peter Maydell, 2016/03/30
- [Qemu-devel] [PULL 01/17] hw/gpio: Add the emulation of gpio_key, Peter Maydell, 2016/03/30
- [Qemu-devel] [PULL 02/17] ARM: Virt: Use gpio_key for power button,
Peter Maydell <=
- [Qemu-devel] [PULL 03/17] block: m25p80: Removed unused variable, Peter Maydell, 2016/03/30
- Re: [Qemu-devel] [PULL 00/17] target-arm queue, Peter Maydell, 2016/03/30