mbox series

[0/2] Kconfig: Add an I2C_DEVICES device group

Message ID 20220208155911.3408455-1-peter.maydell@linaro.org
Headers show
Series Kconfig: Add an I2C_DEVICES device group | expand

Message

Peter Maydell Feb. 8, 2022, 3:59 p.m. UTC
This patchset adds a new Kconfig "device group" for I2C devices which
a user might reasonably want to plug in to an arbitrary i2c bus via
the command line.  This follows the approach we use for PCI devices:
generally-usable i2c devices have
       default y if I2C_DEVICES
and board models with user-accessible i2c buses have
       imply I2C_DEVICES

This means that when building a board model that pulls in the device
group, the devices are all compiled in and available for use. 
(Previously they would happen to be present and usable only if some
other board that explicitly pulled that device in happened to also be
built into the same QEMU binary.)

I have been fairly conservative in marking devices as being in the
group and in marking board models as pulling in the group; feel free
to suggest changes.

In particular I've only added 'imply I2C_DEVICES' to arm boards. 
Grepping through Kconfig files I only found the PPC boards e500 and
ppc44x that enable some kind of i2c controller anyway.

The immediate motivation here is that the recently added lsm303dlhc
magnetometer isn't currently built unless the user manually adds it
to their config, because as it happens no boards have it as a
hard-wired device.

thanks
-- PMM

Peter Maydell (2):
  Kconfig: Add I2C_DEVICES device group
  Kconfig: Add 'imply I2C_DEVICES' on boards with available i2c bus

 docs/devel/kconfig.rst |  8 ++++++--
 hw/arm/Kconfig         | 10 ++++++++++
 hw/i2c/Kconfig         |  5 +++++
 hw/rtc/Kconfig         |  2 ++
 hw/sensor/Kconfig      |  5 +++++
 5 files changed, 28 insertions(+), 2 deletions(-)

Comments

Paolo Bonzini Feb. 8, 2022, 4:20 p.m. UTC | #1
On 2/8/22 16:59, Peter Maydell wrote:
> This patchset adds a new Kconfig "device group" for I2C devices which
> a user might reasonably want to plug in to an arbitrary i2c bus via
> the command line.  This follows the approach we use for PCI devices:
> generally-usable i2c devices have
>         default y if I2C_DEVICES
> and board models with user-accessible i2c buses have
>         imply I2C_DEVICES
> 
> This means that when building a board model that pulls in the device
> group, the devices are all compiled in and available for use.
> (Previously they would happen to be present and usable only if some
> other board that explicitly pulled that device in happened to also be
> built into the same QEMU binary.)
> 
> I have been fairly conservative in marking devices as being in the
> group and in marking board models as pulling in the group; feel free
> to suggest changes.
> 
> In particular I've only added 'imply I2C_DEVICES' to arm boards.
> Grepping through Kconfig files I only found the PPC boards e500 and
> ppc44x that enable some kind of i2c controller anyway.
> 
> The immediate motivation here is that the recently added lsm303dlhc
> magnetometer isn't currently built unless the user manually adds it
> to their config, because as it happens no boards have it as a
> hard-wired device.

Acked-by: Paolo Bonzini <pbonzini@redhat.com>

> thanks
> -- PMM
> 
> Peter Maydell (2):
>    Kconfig: Add I2C_DEVICES device group
>    Kconfig: Add 'imply I2C_DEVICES' on boards with available i2c bus
> 
>   docs/devel/kconfig.rst |  8 ++++++--
>   hw/arm/Kconfig         | 10 ++++++++++
>   hw/i2c/Kconfig         |  5 +++++
>   hw/rtc/Kconfig         |  2 ++
>   hw/sensor/Kconfig      |  5 +++++
>   5 files changed, 28 insertions(+), 2 deletions(-)
>
Philippe Mathieu-Daudé Feb. 10, 2022, 11:19 a.m. UTC | #2
On 8/2/22 16:59, Peter Maydell wrote:

> Peter Maydell (2):
>    Kconfig: Add I2C_DEVICES device group
>    Kconfig: Add 'imply I2C_DEVICES' on boards with available i2c bus
> 
>   docs/devel/kconfig.rst |  8 ++++++--
>   hw/arm/Kconfig         | 10 ++++++++++
>   hw/i2c/Kconfig         |  5 +++++
>   hw/rtc/Kconfig         |  2 ++
>   hw/sensor/Kconfig      |  5 +++++
>   5 files changed, 28 insertions(+), 2 deletions(-)

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