[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 26/40] lasips2: add named input gpio to port for downstream PS2 d
From: |
Mark Cave-Ayland |
Subject: |
[PATCH 26/40] lasips2: add named input gpio to port for downstream PS2 device IRQ |
Date: |
Wed, 29 Jun 2022 13:40:12 +0100 |
The named input gpio is to be connected to the IRQ output of the downstream
PS2 device and used to drive the port IRQ. Initialise the named input gpio
in lasips2_port_init() and add new lasips2_port_class_init() and
lasips2_port_realize() functions to connect the PS2 device output gpio to
the new named input gpio.
Note that the reference to lasips2_port_realize() is stored in
LASIPS2PortDeviceClass but not yet used.
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
---
hw/input/lasips2.c | 32 ++++++++++++++++++++++++++++++--
include/hw/input/lasips2.h | 2 ++
2 files changed, 32 insertions(+), 2 deletions(-)
diff --git a/hw/input/lasips2.c b/hw/input/lasips2.c
index 10494a2322..ec1661a8f1 100644
--- a/hw/input/lasips2.c
+++ b/hw/input/lasips2.c
@@ -322,11 +322,35 @@ static const TypeInfo lasips2_info = {
.class_init = lasips2_class_init,
};
+static void lasips2_port_set_irq(void *opaque, int n, int level)
+{
+ LASIPS2Port *s = LASIPS2_PORT(opaque);
+
+ qemu_set_irq(s->irq, level);
+}
+
+static void lasips2_port_realize(DeviceState *dev, Error **errp)
+{
+ LASIPS2Port *s = LASIPS2_PORT(dev);
+
+ qdev_connect_gpio_out(DEVICE(s->ps2dev), PS2_DEVICE_IRQ,
+ qdev_get_gpio_in_named(dev, "ps2-input-irq", 0));
+}
+
static void lasips2_port_init(Object *obj)
{
LASIPS2Port *s = LASIPS2_PORT(obj);
qdev_init_gpio_out(DEVICE(obj), &s->irq, 1);
+ qdev_init_gpio_in_named(DEVICE(obj), lasips2_port_set_irq,
+ "ps2-input-irq", 1);
+}
+
+static void lasips2_port_class_init(ObjectClass *klass, void *data)
+{
+ DeviceClass *dc = DEVICE_CLASS(klass);
+
+ dc->realize = lasips2_port_realize;
}
static const TypeInfo lasips2_port_info = {
@@ -360,8 +384,10 @@ static void lasips2_kbd_port_init(Object *obj)
static void lasips2_kbd_port_class_init(ObjectClass *klass, void *data)
{
DeviceClass *dc = DEVICE_CLASS(klass);
+ LASIPS2PortDeviceClass *lpdc = LASIPS2_PORT_CLASS(klass);
- dc->realize = lasips2_kbd_port_realize;
+ device_class_set_parent_realize(dc, lasips2_kbd_port_realize,
+ &lpdc->parent_realize);
}
static const TypeInfo lasips2_kbd_port_info = {
@@ -393,8 +419,10 @@ static void lasips2_mouse_port_init(Object *obj)
static void lasips2_mouse_port_class_init(ObjectClass *klass, void *data)
{
DeviceClass *dc = DEVICE_CLASS(klass);
+ LASIPS2PortDeviceClass *lpdc = LASIPS2_PORT_CLASS(klass);
- dc->realize = lasips2_mouse_port_realize;
+ device_class_set_parent_realize(dc, lasips2_mouse_port_realize,
+ &lpdc->parent_realize);
}
static const TypeInfo lasips2_mouse_port_info = {
diff --git a/include/hw/input/lasips2.h b/include/hw/input/lasips2.h
index 426aa1371f..35e0aa26eb 100644
--- a/include/hw/input/lasips2.h
+++ b/include/hw/input/lasips2.h
@@ -30,6 +30,8 @@ OBJECT_DECLARE_TYPE(LASIPS2Port, LASIPS2PortDeviceClass,
LASIPS2_PORT)
struct LASIPS2PortDeviceClass {
DeviceClass parent;
+
+ DeviceRealize parent_realize;
};
typedef struct LASIPS2State LASIPS2State;
--
2.30.2
- [PATCH 16/40] lasips2: QOMify LASIPS2Port, (continued)
- [PATCH 16/40] lasips2: QOMify LASIPS2Port, Mark Cave-Ayland, 2022/06/29
- [PATCH 17/40] lasips2: introduce new LASIPS2_KBD_PORT QOM type, Mark Cave-Ayland, 2022/06/29
- [PATCH 19/40] lasips2: move keyboard port initialisation to new lasips2_kbd_port_init() function, Mark Cave-Ayland, 2022/06/29
- [PATCH 18/40] lasips2: introduce new LASIPS2_MOUSE_PORT QOM type, Mark Cave-Ayland, 2022/06/29
- [PATCH 20/40] lasips2: move mouse port initialisation to new lasips2_mouse_port_init() function, Mark Cave-Ayland, 2022/06/29
- [PATCH 21/40] lasips2: introduce lasips2_kbd_port_class_init() and lasips2_kbd_port_realize(), Mark Cave-Ayland, 2022/06/29
- [PATCH 23/40] lasips2: rename LASIPS2Port irq field to birq, Mark Cave-Ayland, 2022/06/29
- [PATCH 22/40] lasips2: introduce lasips2_mouse_port_class_init() and lasips2_mouse_port_realize(), Mark Cave-Ayland, 2022/06/29
- [PATCH 25/40] lasips2: introduce LASIPS2PortDeviceClass for the LASIPS2_PORT device, Mark Cave-Ayland, 2022/06/29
- [PATCH 24/40] lasips2: introduce port IRQ and new lasips2_port_init() function, Mark Cave-Ayland, 2022/06/29
- [PATCH 26/40] lasips2: add named input gpio to port for downstream PS2 device IRQ,
Mark Cave-Ayland <=
- [PATCH 28/40] lasips2: switch to using port-based IRQs, Mark Cave-Ayland, 2022/06/29
- [PATCH 27/40] lasips2: add named input gpio to handle incoming port IRQs, Mark Cave-Ayland, 2022/06/29
- [PATCH 30/40] lasips2: standardise on lp name for LASIPS2Port variables, Mark Cave-Ayland, 2022/06/29
- [PATCH 29/40] lasips2: rename LASIPS2Port parent pointer to lasips2, Mark Cave-Ayland, 2022/06/29
- [PATCH 32/40] lasips2: don't use legacy ps2_kbd_init() function, Mark Cave-Ayland, 2022/06/29
- [PATCH 31/40] lasips2: switch register memory region to DEVICE_BIG_ENDIAN, Mark Cave-Ayland, 2022/06/29
- [PATCH 35/40] pckbd: introduce new vmstate_kbd_mmio VMStateDescription for the I8042_MMIO device, Mark Cave-Ayland, 2022/06/29
- [PATCH 33/40] lasips2: don't use legacy ps2_mouse_init() function, Mark Cave-Ayland, 2022/06/29
- [PATCH 34/40] lasips2: update VMStateDescription for LASIPS2 device, Mark Cave-Ayland, 2022/06/29
- [PATCH 36/40] pckbd: don't use legacy ps2_kbd_init() function, Mark Cave-Ayland, 2022/06/29