qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Philippe Mathieu-Daudé" <philmd@redhat.com>
To: Peter Maydell <peter.maydell@linaro.org>,
	qemu-arm@nongnu.org, qemu-devel@nongnu.org
Cc: Alistair Francis <alistair@alistair23.me>
Subject: Re: [PATCH 06/17] hw/misc/max111x: provide QOM properties for setting initial values
Date: Mon, 29 Jun 2020 11:01:20 +0200	[thread overview]
Message-ID: <ff3227d3-2648-3a4b-824a-74f8c41bdd78@redhat.com> (raw)
In-Reply-To: <20200628142429.17111-7-peter.maydell@linaro.org>

On 6/28/20 4:24 PM, Peter Maydell wrote:
> Add some QOM properties to the max111x ADC device to allow the
> initial values to be configured. Currently this is done by
> board code calling max111x_set_input() after it creates the
> device, which doesn't work on system reset.
> 
> This requires us to implement a reset method for this device,
> so while we're doing that make sure we reset the other parts
> of the device state.
> 
> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
> ---
>  hw/misc/max111x.c | 57 ++++++++++++++++++++++++++++++++++++++---------
>  1 file changed, 47 insertions(+), 10 deletions(-)
> 
> diff --git a/hw/misc/max111x.c b/hw/misc/max111x.c
> index 2b87bdee5b7..d0e5534e4f5 100644
> --- a/hw/misc/max111x.c
> +++ b/hw/misc/max111x.c
> @@ -15,11 +15,15 @@
>  #include "hw/ssi/ssi.h"
>  #include "migration/vmstate.h"
>  #include "qemu/module.h"
> +#include "hw/qdev-properties.h"
>  
>  typedef struct {
>      SSISlave parent_obj;
>  
>      qemu_irq interrupt;
> +    /* Values of inputs at system reset (settable by QOM property) */
> +    uint8_t reset_input[8];
> +
>      uint8_t tb1, rb2, rb3;
>      int cycle;
>  

An eventual improvement is to make 'inputs' a class property:

  MAX111xClass {
      SSISlaveClass parent_obj;

      unsigned input_count;
  }

"eventual" because from a QOM point it is cleaner, but we'd have
to add more boiler-plate casts, so code less clear.

Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>



  reply	other threads:[~2020-06-29  9:03 UTC|newest]

Thread overview: 50+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-28 14:24 [PATCH 00/17] spitz: fix hacks, fix CID 1421913, various cleanups Peter Maydell
2020-06-28 14:24 ` [PATCH 01/17] hw/arm/spitz: Detabify Peter Maydell
2020-06-29  8:49   ` Philippe Mathieu-Daudé
2020-06-29 19:30   ` Alistair Francis
2020-06-28 14:24 ` [PATCH 02/17] hw/arm/spitz: Create SpitzMachineClass abstract base class Peter Maydell
2020-06-29  8:55   ` Philippe Mathieu-Daudé
2020-06-29 14:03     ` Peter Maydell
2020-06-28 14:24 ` [PATCH 03/17] hw/arm/spitz: Keep pointers to MPU and SSI devices in SpitzMachineState Peter Maydell
2020-06-29 19:36   ` Alistair Francis
2020-06-28 14:24 ` [PATCH 04/17] hw/arm/spitz: Keep pointers to scp0, scp1 " Peter Maydell
2020-06-29 19:38   ` Alistair Francis
2020-06-28 14:24 ` [PATCH 05/17] hw/arm/spitz: Implement inbound GPIO lines for bit5 and power signals Peter Maydell
2020-06-30 20:45   ` Alistair Francis
2020-06-28 14:24 ` [PATCH 06/17] hw/misc/max111x: provide QOM properties for setting initial values Peter Maydell
2020-06-29  9:01   ` Philippe Mathieu-Daudé [this message]
2020-06-30 20:51   ` Alistair Francis
2020-06-28 14:24 ` [PATCH 07/17] hw/misc/max111x: Don't use vmstate_register() Peter Maydell
2020-06-29  9:01   ` Philippe Mathieu-Daudé
2020-06-30 20:52   ` Alistair Francis
2020-06-28 14:24 ` [PATCH 08/17] ssi: Add ssi_realize_and_unref() Peter Maydell
2020-06-29  9:02   ` Philippe Mathieu-Daudé
2020-06-30 20:55   ` Alistair Francis
2020-06-28 14:24 ` [PATCH 09/17] hw/arm/spitz: Use max111x properties to set initial values Peter Maydell
2020-06-29  9:09   ` Philippe Mathieu-Daudé
2020-06-29 14:05     ` Peter Maydell
2020-06-28 14:24 ` [PATCH 10/17] hw/misc/max111x: Use GPIO lines rather than max111x_set_input() Peter Maydell
2020-07-01  0:37   ` Alistair Francis
2020-06-28 14:24 ` [PATCH 11/17] hw/misc/max111x: Create header file for documentation, TYPE_ macros Peter Maydell
2020-06-29  8:29   ` Philippe Mathieu-Daudé
2020-06-29 12:07     ` Peter Maydell
2020-06-29 14:57       ` Philippe Mathieu-Daudé
2020-06-28 14:24 ` [PATCH 12/17] hw/arm/spitz: Encapsulate misc GPIO handling in a device Peter Maydell
2020-06-29  9:12   ` Philippe Mathieu-Daudé
2020-07-02 17:39   ` Alistair Francis
2020-06-28 14:24 ` [PATCH 13/17] hw/gpio/zaurus.c: Use LOG_GUEST_ERROR for bad guest register accesses Peter Maydell
2020-06-29  9:13   ` Philippe Mathieu-Daudé
2020-07-01  0:38   ` Alistair Francis
2020-06-28 14:24 ` [PATCH 14/17] hw/arm/spitz: " Peter Maydell
2020-06-29  9:14   ` Philippe Mathieu-Daudé
2020-07-01  0:52   ` Alistair Francis
2020-06-28 14:24 ` [PATCH 15/17] hw/arm/pxa2xx_pic: " Peter Maydell
2020-06-29  9:14   ` Philippe Mathieu-Daudé
2020-07-01  0:52   ` Alistair Francis
2020-06-28 14:24 ` [PATCH 16/17] hw/arm/spitz: Provide usual QOM macros for corgi-ssp and spitz-lcdtg Peter Maydell
2020-06-29  9:17   ` Philippe Mathieu-Daudé
2020-07-02 17:51   ` Alistair Francis
2020-06-28 14:24 ` [PATCH 17/17] Replace uses of FROM_SSI_SLAVE() macro with QOM casts Peter Maydell
2020-06-29  9:18   ` Philippe Mathieu-Daudé
2020-07-02 18:23   ` Alistair Francis
2020-06-28 14:43 ` [PATCH 00/17] spitz: fix hacks, fix CID 1421913, various cleanups no-reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ff3227d3-2648-3a4b-824a-74f8c41bdd78@redhat.com \
    --to=philmd@redhat.com \
    --cc=alistair@alistair23.me \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-arm@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).