qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: should we have a Kconfig "device group" for I2C devices?


From: Paolo Bonzini
Subject: Re: should we have a Kconfig "device group" for I2C devices?
Date: Fri, 28 Jan 2022 15:30:11 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.4.0

On 1/28/22 15:17, Peter Maydell wrote:
Hi; I've been looking into what is the right way to handle in Kconfig
an i2c device which is intended for the user to specify on the command
line with a -device option.
(It's the lsm303dlhc magnetometer, currently in code review:
https://patchew.org/QEMU/20210921093227.18592-1-kevin.townsend@linaro.org/  )

Currently all our i2c devices are just pulled in by "select FOO" from
the Kconfig stanza for a board which has that kind of sensor hardwired
on-board. But for at least some of them it works fine to just specify
them on the commandline of any board that has an i2c controller that
allows pluggable devices. (For instance we do that kind of commandline
plugging in our test suite with tests/qtest/tmp105-test.c.)

What's the best way to structure this? For PCI we have the "device
group" PCI_DEVICES as documented in
https://qemu-project.gitlab.io/qemu/devel/kconfig.html#guidelines-for-writing-kconfig-files
and PCI devices say
     default y if PCI_DEVICES
     depends on PCI

For ISA devices we seem to make them say
     default y
     depends on ISA_BUS

I2C devices currently just say
     depends on I2C

Should we have an I2C_DEVICES, which boards where there's a sensible
user-pluggable i2c controller can specifically select ? Or should we
mark the i2c devices which are sensibly user-pluggable as
"default y" ? Or something else ?

Yes, I think it's a good idea to have I2C_DEVICES like we have PCI_DEVICES. This way we can skip them on x86 (where the SMBus controller is mostly a legacy device) but include them by default on AVR, embedded ARM, etc.

Paolo



reply via email to

[Prev in Thread] Current Thread [Next in Thread]