On Mon, Jul 15, 2024, at 05:24, Nathan Chancellor wrote: > On Mon, Jun 17, 2024 at 05:26:02PM +0200, Marek Behún wrote: >> Add support for true board poweroff (MCU can disable all unnecessary >> voltage regulators) and wakeup at a specified time, implemented via a >> RTC driver so that the rtcwake utility can be used to configure it. >> >> Signed-off-by: Marek Behún <kabel@xxxxxxxxxx> >> Acked-by: Alexandre Belloni <alexandre.belloni@xxxxxxxxxxx> >> Reviewed-by: Andy Shevchenko <andy@xxxxxxxxxx> > ... >> diff --git a/drivers/platform/cznic/Kconfig b/drivers/platform/cznic/Kconfig >> index d95e7c83c7ae..c1e719235517 100644 >> --- a/drivers/platform/cznic/Kconfig >> +++ b/drivers/platform/cznic/Kconfig >> @@ -18,10 +18,14 @@ config TURRIS_OMNIA_MCU >> depends on I2C >> select GPIOLIB >> select GPIOLIB_IRQCHIP >> + select RTC_CLASS >> help >> Say Y here to add support for the features implemented by the >> microcontroller on the CZ.NIC's Turris Omnia SOHO router. >> The features include: >> + - board poweroff into true low power mode (with voltage regulators >> + disabled) and the ability to configure wake up from this mode (via >> + rtcwake) >> - GPIO pins >> - to get front button press events (the front button can be >> configured either to generate press events to the CPU or to change > > I am seeing the following Kconfig warning from ARCH=s390 allmodconfig: > > WARNING: unmet direct dependencies detected for RTC_CLASS > Depends on [n]: !S390 [=y] > Selected by [m]: > - TURRIS_OMNIA_MCU [=m] && CZNIC_PLATFORMS [=y] && (MACH_ARMADA_38X > || COMPILE_TEST [=y]) && I2C [=m] && OF [=y] && WATCHDOG [=y] > > because of: > > menuconfig RTC_CLASS > bool "Real Time Clock" > default n > depends on !S390 > > which appears to have ultimately come from commit 9556fb73edfc ("[S390] > Kconfig: unwanted menus for s390."). No other driver appears to > unconditionally select this (I only see it selected within > arch/*/Kconfig), so it does not look like this has come up before. > Should s390 be excluded from the COMPILE_TEST dependency? There is really no reason for a driver to select another subsystem, it not just causes problems like this one but also leads to circular dependencies and surprises when someone turns on a random driver and then turns it off again, leaving the the other subsystems accidentally enabled. I've applied the fixup below now, leaving GPIOLIB_IRQCHIP as the only selected symbol since this is not user-visible. Marek, you could consider changing the driver so it doesn't actually require all those subsystems at build time but instead just leaves out the functionality. Some subsystems actually have a stub implementation that makes it work by just dropping the dependency, but I did not try that here. Arnd 8<------------ commit ed46f1f7731d2cd77d623c0f895df9e23c0bffb6 Author: Arnd Bergmann <arnd@xxxxxxxx> Date: Mon Jul 15 08:02:30 2024 +0200 platform: cznic: turris-omnia-mcu: fix Kconfig dependencies The newly added driver causes a Kconfig warning: WARNING: unmet direct dependencies detected for RTC_CLASS Depends on [n]: !S390 [=y] Selected by [m]: - TURRIS_OMNIA_MCU [=m] && CZNIC_PLATFORMS [=y] && (MACH_ARMADA_38X || COMPILE_TEST [=y]) && I2C [=m] && OF [=y] && WATCHDOG [=y] The problem here is that it selects entire subsystems, which normal device drivers should not do. Changes all of these to 'depends on' instead. Fixes: dfa556e45ae9e ("platform: cznic: turris-omnia-mcu: Add support for MCU connected GPIOs") Fixes: 90e700fd12b61 ("platform: cznic: turris-omnia-mcu: Add support for poweroff and wakeup") Fixes: ab89fb5fb92c7 ("platform: cznic: turris-omnia-mcu: Add support for MCU watchdog") Fixes: 41bb142a40289 ("platform: cznic: turris-omnia-mcu: Add support for MCU provided TRNG") Reported-by: Nathan Chancellor <nathan@xxxxxxxxxx> Signed-off-by: Arnd Bergmann <arnd@xxxxxxxx> diff --git a/drivers/platform/cznic/Kconfig b/drivers/platform/cznic/Kconfig index 2a5235cf6844..cb0d4d686d8a 100644 --- a/drivers/platform/cznic/Kconfig +++ b/drivers/platform/cznic/Kconfig @@ -18,11 +18,11 @@ config TURRIS_OMNIA_MCU depends on I2C depends on OF depends on WATCHDOG - select GPIOLIB + depends on GPIOLIB + depends on HW_RANDOM + depends on RTC_CLASS + depends on WATCHDOG_CORE select GPIOLIB_IRQCHIP - select HW_RANDOM - select RTC_CLASS - select WATCHDOG_CORE help Say Y here to add support for the features implemented by the microcontroller on the CZ.NIC's Turris Omnia SOHO router.