[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v5 2/7] hw/misc/led: Allow connecting from GPIO output
From: |
Richard Henderson |
Subject: |
Re: [PATCH v5 2/7] hw/misc/led: Allow connecting from GPIO output |
Date: |
Fri, 11 Sep 2020 15:44:22 -0700 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 |
On 9/10/20 1:54 PM, Philippe Mathieu-Daudé wrote:
> Some devices expose GPIO lines.
>
> Add a GPIO qdev input to our LED device, so we can
> connect a GPIO output using qdev_connect_gpio_out().
>
> When used with GPIOs, the intensity can only be either
> minium or maximum. This depends of the polarity of the
> GPIO (which can be inverted).
> Declare the GpioPolarity type to model the polarity.
>
> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
> ---
> include/hw/misc/led.h | 8 ++++++++
> include/hw/qdev-core.h | 8 ++++++++
> hw/misc/led.c | 17 ++++++++++++++++-
> 3 files changed, 32 insertions(+), 1 deletion(-)
>
> diff --git a/include/hw/misc/led.h b/include/hw/misc/led.h
> index f5afaa34bfb..71c9b8c59bf 100644
> --- a/include/hw/misc/led.h
> +++ b/include/hw/misc/led.h
> @@ -38,10 +38,16 @@ typedef struct LEDState {
> /* Public */
>
> uint8_t intensity_percent;
> + qemu_irq irq;
>
> /* Properties */
> char *description;
> char *color;
> + /*
> + * When used with GPIO, the intensity at reset is related
> + * to the GPIO polarity.
> + */
> + bool inverted_polarity;
Why are you not using the GpioPolarity enum that you added?
r~
- [PATCH v5 0/7] hw/misc: Add LED device, Philippe Mathieu-Daudé, 2020/09/10
- [PATCH v5 1/7] hw/misc/led: Add a LED device, Philippe Mathieu-Daudé, 2020/09/10
- [PATCH v5 3/7] hw/misc/led: Emit a trace event when LED intensity has changed, Philippe Mathieu-Daudé, 2020/09/10
- [PATCH v5 2/7] hw/misc/led: Allow connecting from GPIO output, Philippe Mathieu-Daudé, 2020/09/10
- Re: [PATCH v5 2/7] hw/misc/led: Allow connecting from GPIO output,
Richard Henderson <=
- Re: [PATCH v5 2/7] hw/misc/led: Allow connecting from GPIO output, Philippe Mathieu-Daudé, 2020/09/12
- Re: [PATCH v5 2/7] hw/misc/led: Allow connecting from GPIO output, Philippe Mathieu-Daudé, 2020/09/12
- Re: [PATCH v5 2/7] hw/misc/led: Allow connecting from GPIO output, Markus Armbruster, 2020/09/14
- Re: [PATCH v5 2/7] hw/misc/led: Allow connecting from GPIO output, Philippe Mathieu-Daudé, 2020/09/14
- Re: [PATCH v5 2/7] hw/misc/led: Allow connecting from GPIO output, Eduardo Habkost, 2020/09/14
- Re: [PATCH v5 2/7] hw/misc/led: Allow connecting from GPIO output, Philippe Mathieu-Daudé, 2020/09/14
- Re: [PATCH v5 2/7] hw/misc/led: Allow connecting from GPIO output, Philippe Mathieu-Daudé, 2020/09/14
[PATCH v5 4/7] hw/arm/aspeed: Add the 3 front LEDs drived by the PCA9552 #1, Philippe Mathieu-Daudé, 2020/09/10
[PATCH v5 6/7] hw/misc/mps2-scc: Use the LED device, Philippe Mathieu-Daudé, 2020/09/10