aboutsummaryrefslogtreecommitdiff
path: root/hw/twl92230.c
diff options
context:
space:
mode:
authorPaolo Bonzini <pbonzini@redhat.com>2012-01-20 12:10:34 +0100
committerAndrzej Zaborowski <balrogg@gmail.com>2012-02-17 07:42:22 +0100
commitdd4427a6194eb4efd38542737a053ca474039a76 (patch)
tree3bfd0c7c14544ddcfc50ec1b25ed8239c321f5e9 /hw/twl92230.c
parent6c263e26a5c162a8cd79e32bb82422697db5c57c (diff)
nseries: attach monitor powerdown request to menelaus
I noticed some unused code in the twl92230, probably from before qdev-ification. This patch makes the machine use the chip's pwrbtn signal. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Andrzej Zaborowski <andrew.zaborowski@intel.com>
Diffstat (limited to 'hw/twl92230.c')
-rw-r--r--hw/twl92230.c21
1 files changed, 9 insertions, 12 deletions
diff --git a/hw/twl92230.c b/hw/twl92230.c
index 873dc8f068..22da6f8001 100644
--- a/hw/twl92230.c
+++ b/hw/twl92230.c
@@ -61,9 +61,7 @@ typedef struct {
} rtc;
uint16_t rtc_next_vmstate;
qemu_irq out[4];
- qemu_irq *in;
uint8_t pwrbtn_state;
- qemu_irq pwrbtn;
} MenelausState;
static inline void menelaus_update(MenelausState *s)
@@ -186,14 +184,12 @@ static void menelaus_gpio_set(void *opaque, int line, int level)
{
MenelausState *s = (MenelausState *) opaque;
- /* No interrupt generated */
- s->inputs &= ~(1 << line);
- s->inputs |= level << line;
-}
-
-static void menelaus_pwrbtn_set(void *opaque, int line, int level)
-{
- MenelausState *s = (MenelausState *) opaque;
+ if (line < 3) {
+ /* No interrupt generated */
+ s->inputs &= ~(1 << line);
+ s->inputs |= level << line;
+ return;
+ }
if (!s->pwrbtn_state && level) {
s->status |= 1 << 11; /* PSHBTN */
@@ -849,8 +845,9 @@ static int twl92230_init(I2CSlave *i2c)
s->rtc.hz_tm = qemu_new_timer_ms(rt_clock, menelaus_rtc_hz, s);
/* Three output pins plus one interrupt pin. */
qdev_init_gpio_out(&i2c->qdev, s->out, 4);
- qdev_init_gpio_in(&i2c->qdev, menelaus_gpio_set, 3);
- s->pwrbtn = qemu_allocate_irqs(menelaus_pwrbtn_set, s, 1)[0];
+
+ /* Three input pins plus one power-button pin. */
+ qdev_init_gpio_in(&i2c->qdev, menelaus_gpio_set, 4);
menelaus_reset(&s->i2c);