All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/4] Make turris-omnia-mcu driver parts optional
@ 2024-07-19  8:57 Marek Behún
  2024-07-19  8:57 ` [PATCH 1/4] platform: cznic: turris-omnia-mcu: Make watchdog code optional Marek Behún
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Marek Behún @ 2024-07-19  8:57 UTC (permalink / raw)
  To: Arnd Bergmann, soc
  Cc: arm, Andy Shevchenko, Hans de Goede, Ilpo Järvinen,
	Marek Behún

Hi Arnd,

this series solves the Kconfig dependency issues of the turris-omnia-mcu
driver by making the GPIO, poweroff & wakeup, watchdog and TRNG parts of
the driver optional, under new Kconfig options. The dependencies to
subsystems are moved under these new options.

Marek

Marek Behún (4):
  platform: cznic: turris-omnia-mcu: Make watchdog code optional
  platform: cznic: turris-omnia-mcu: Make TRNG code optional
  platform: cznic: turris-omnia-mcu: Make poweroff and wakeup code
    optional
  platform: cznic: turris-omnia-mcu: Make GPIO code optional

 drivers/platform/cznic/Kconfig                | 80 +++++++++++++------
 drivers/platform/cznic/Makefile               |  8 +-
 .../platform/cznic/turris-omnia-mcu-base.c    |  4 +
 drivers/platform/cznic/turris-omnia-mcu.h     | 42 +++++++++-
 4 files changed, 103 insertions(+), 31 deletions(-)

-- 
2.44.2


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 1/4] platform: cznic: turris-omnia-mcu: Make watchdog code optional
  2024-07-19  8:57 [PATCH 0/4] Make turris-omnia-mcu driver parts optional Marek Behún
@ 2024-07-19  8:57 ` Marek Behún
  2024-07-19  8:57 ` [PATCH 2/4] platform: cznic: turris-omnia-mcu: Make TRNG " Marek Behún
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Marek Behún @ 2024-07-19  8:57 UTC (permalink / raw)
  To: Arnd Bergmann, soc
  Cc: arm, Andy Shevchenko, Hans de Goede, Ilpo Järvinen,
	Marek Behún

Make the watchdog part of the driver optional, under a boolean config
option. Move the dependency to WATCHDOG to this new option, and change
the WATCHDOG_CORE dependency to selection, as is done in most watchdog
drivers.

This makes the turris-omnia-mcu driver available for compilation even if
WATCHDOG is disabled.

Fixes: ed46f1f7731d ("platform: cznic: turris-omnia-mcu: fix Kconfig dependencies")
Signed-off-by: Marek Behún <kabel@kernel.org>
---
 drivers/platform/cznic/Kconfig            | 17 ++++++++++++++---
 drivers/platform/cznic/Makefile           |  2 +-
 drivers/platform/cznic/turris-omnia-mcu.h | 10 ++++++++++
 3 files changed, 25 insertions(+), 4 deletions(-)

diff --git a/drivers/platform/cznic/Kconfig b/drivers/platform/cznic/Kconfig
index cb0d4d686d8a..b56c343e21d6 100644
--- a/drivers/platform/cznic/Kconfig
+++ b/drivers/platform/cznic/Kconfig
@@ -17,11 +17,9 @@ config TURRIS_OMNIA_MCU
 	depends on MACH_ARMADA_38X || COMPILE_TEST
 	depends on I2C
 	depends on OF
-	depends on WATCHDOG
 	depends on GPIOLIB
 	depends on HW_RANDOM
 	depends on RTC_CLASS
-	depends on WATCHDOG_CORE
 	select GPIOLIB_IRQCHIP
 	help
 	  Say Y here to add support for the features implemented by the
@@ -31,7 +29,6 @@ config TURRIS_OMNIA_MCU
 	    disabled) and the ability to configure wake up from this mode (via
 	    rtcwake)
 	  - true random number generator (if available on the MCU)
-	  - MCU watchdog
 	  - 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
@@ -44,7 +41,21 @@ config TURRIS_OMNIA_MCU
 	      to be able to program SOC's OTP on board revisions 32+
 	    - to get input from the LED output pins of the WAN ethernet PHY, LAN
 	      switch and MiniPCIe ports
+	  Other features can be enabled by subsequent config options.
 	  To compile this driver as a module, choose M here; the module will be
 	  called turris-omnia-mcu.
 
+if TURRIS_OMNIA_MCU
+
+config TURRIS_OMNIA_MCU_WATCHDOG
+	bool "Turris Omnia MCU watchdog"
+	default y
+	depends on WATCHDOG
+	select WATCHDOG_CORE
+	help
+	  Say Y here to add support for watchdog provided by CZ.NIC's Turris
+	  Omnia MCU.
+
+endif # TURRIS_OMNIA_MCU
+
 endif # CZNIC_PLATFORMS
diff --git a/drivers/platform/cznic/Makefile b/drivers/platform/cznic/Makefile
index eae4c6b341ff..7599b4835056 100644
--- a/drivers/platform/cznic/Makefile
+++ b/drivers/platform/cznic/Makefile
@@ -5,4 +5,4 @@ turris-omnia-mcu-y		:= turris-omnia-mcu-base.o
 turris-omnia-mcu-y		+= turris-omnia-mcu-gpio.o
 turris-omnia-mcu-y		+= turris-omnia-mcu-sys-off-wakeup.o
 turris-omnia-mcu-y		+= turris-omnia-mcu-trng.o
-turris-omnia-mcu-y		+= turris-omnia-mcu-watchdog.o
+turris-omnia-mcu-$(CONFIG_TURRIS_OMNIA_MCU_WATCHDOG)		+= turris-omnia-mcu-watchdog.o
diff --git a/drivers/platform/cznic/turris-omnia-mcu.h b/drivers/platform/cznic/turris-omnia-mcu.h
index 2ca56ae13aa9..85bf9ab39356 100644
--- a/drivers/platform/cznic/turris-omnia-mcu.h
+++ b/drivers/platform/cznic/turris-omnia-mcu.h
@@ -47,8 +47,10 @@ struct omnia_mcu {
 	u32 rtc_alarm;
 	bool front_button_poweron;
 
+#ifdef CONFIG_TURRIS_OMNIA_MCU_WATCHDOG
 	/* MCU watchdog */
 	struct watchdog_device wdt;
+#endif
 
 	/* true random number generator */
 	struct hwrng trng;
@@ -189,6 +191,14 @@ extern const struct attribute_group omnia_mcu_poweroff_group;
 int omnia_mcu_register_gpiochip(struct omnia_mcu *mcu);
 int omnia_mcu_register_sys_off_and_wakeup(struct omnia_mcu *mcu);
 int omnia_mcu_register_trng(struct omnia_mcu *mcu);
+
+#ifdef CONFIG_TURRIS_OMNIA_MCU_WATCHDOG
 int omnia_mcu_register_watchdog(struct omnia_mcu *mcu);
+#else
+static inline int omnia_mcu_register_watchdog(struct omnia_mcu *mcu)
+{
+	return 0;
+}
+#endif
 
 #endif /* __TURRIS_OMNIA_MCU_H */
-- 
2.44.2


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 2/4] platform: cznic: turris-omnia-mcu: Make TRNG code optional
  2024-07-19  8:57 [PATCH 0/4] Make turris-omnia-mcu driver parts optional Marek Behún
  2024-07-19  8:57 ` [PATCH 1/4] platform: cznic: turris-omnia-mcu: Make watchdog code optional Marek Behún
@ 2024-07-19  8:57 ` Marek Behún
  2024-07-19  8:57 ` [PATCH 3/4] platform: cznic: turris-omnia-mcu: Make poweroff and wakeup " Marek Behún
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Marek Behún @ 2024-07-19  8:57 UTC (permalink / raw)
  To: Arnd Bergmann, soc
  Cc: arm, Andy Shevchenko, Hans de Goede, Ilpo Järvinen,
	Marek Behún

Make the TRNG part of the driver optional, under a boolean config
option.

This makes the driver turris-omnia-mcu available for compilation even if
HW_RANDOM is disabled.

Fixes: ed46f1f7731d ("platform: cznic: turris-omnia-mcu: fix Kconfig dependencies")
Signed-off-by: Marek Behún <kabel@kernel.org>
---
 drivers/platform/cznic/Kconfig            | 10 ++++++++--
 drivers/platform/cznic/Makefile           |  2 +-
 drivers/platform/cznic/turris-omnia-mcu.h | 10 ++++++++++
 3 files changed, 19 insertions(+), 3 deletions(-)

diff --git a/drivers/platform/cznic/Kconfig b/drivers/platform/cznic/Kconfig
index b56c343e21d6..98f17562646e 100644
--- a/drivers/platform/cznic/Kconfig
+++ b/drivers/platform/cznic/Kconfig
@@ -18,7 +18,6 @@ config TURRIS_OMNIA_MCU
 	depends on I2C
 	depends on OF
 	depends on GPIOLIB
-	depends on HW_RANDOM
 	depends on RTC_CLASS
 	select GPIOLIB_IRQCHIP
 	help
@@ -28,7 +27,6 @@ config TURRIS_OMNIA_MCU
 	  - board poweroff into true low power mode (with voltage regulators
 	    disabled) and the ability to configure wake up from this mode (via
 	    rtcwake)
-	  - true random number generator (if available on the MCU)
 	  - 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
@@ -56,6 +54,14 @@ config TURRIS_OMNIA_MCU_WATCHDOG
 	  Say Y here to add support for watchdog provided by CZ.NIC's Turris
 	  Omnia MCU.
 
+config TURRIS_OMNIA_MCU_TRNG
+	bool "Turris Omnia MCU true random number generator"
+	default y
+	depends on HW_RANDOM
+	help
+	  Say Y here to add support for the true random number generator
+	  provided by CZ.NIC's Turris Omnia MCU.
+
 endif # TURRIS_OMNIA_MCU
 
 endif # CZNIC_PLATFORMS
diff --git a/drivers/platform/cznic/Makefile b/drivers/platform/cznic/Makefile
index 7599b4835056..0c28fa859391 100644
--- a/drivers/platform/cznic/Makefile
+++ b/drivers/platform/cznic/Makefile
@@ -4,5 +4,5 @@ obj-$(CONFIG_TURRIS_OMNIA_MCU)	+= turris-omnia-mcu.o
 turris-omnia-mcu-y		:= turris-omnia-mcu-base.o
 turris-omnia-mcu-y		+= turris-omnia-mcu-gpio.o
 turris-omnia-mcu-y		+= turris-omnia-mcu-sys-off-wakeup.o
-turris-omnia-mcu-y		+= turris-omnia-mcu-trng.o
+turris-omnia-mcu-$(CONFIG_TURRIS_OMNIA_MCU_TRNG)		+= turris-omnia-mcu-trng.o
 turris-omnia-mcu-$(CONFIG_TURRIS_OMNIA_MCU_WATCHDOG)		+= turris-omnia-mcu-watchdog.o
diff --git a/drivers/platform/cznic/turris-omnia-mcu.h b/drivers/platform/cznic/turris-omnia-mcu.h
index 85bf9ab39356..d07a32cfe238 100644
--- a/drivers/platform/cznic/turris-omnia-mcu.h
+++ b/drivers/platform/cznic/turris-omnia-mcu.h
@@ -52,9 +52,11 @@ struct omnia_mcu {
 	struct watchdog_device wdt;
 #endif
 
+#ifdef CONFIG_TURRIS_OMNIA_MCU_TRNG
 	/* true random number generator */
 	struct hwrng trng;
 	struct completion trng_entropy_ready;
+#endif
 };
 
 int omnia_cmd_write_read(const struct i2c_client *client,
@@ -190,7 +192,15 @@ extern const struct attribute_group omnia_mcu_poweroff_group;
 
 int omnia_mcu_register_gpiochip(struct omnia_mcu *mcu);
 int omnia_mcu_register_sys_off_and_wakeup(struct omnia_mcu *mcu);
+
+#ifdef CONFIG_TURRIS_OMNIA_MCU_TRNG
 int omnia_mcu_register_trng(struct omnia_mcu *mcu);
+#else
+static inline int omnia_mcu_register_trng(struct omnia_mcu *mcu)
+{
+	return 0;
+}
+#endif
 
 #ifdef CONFIG_TURRIS_OMNIA_MCU_WATCHDOG
 int omnia_mcu_register_watchdog(struct omnia_mcu *mcu);
-- 
2.44.2


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 3/4] platform: cznic: turris-omnia-mcu: Make poweroff and wakeup code optional
  2024-07-19  8:57 [PATCH 0/4] Make turris-omnia-mcu driver parts optional Marek Behún
  2024-07-19  8:57 ` [PATCH 1/4] platform: cznic: turris-omnia-mcu: Make watchdog code optional Marek Behún
  2024-07-19  8:57 ` [PATCH 2/4] platform: cznic: turris-omnia-mcu: Make TRNG " Marek Behún
@ 2024-07-19  8:57 ` Marek Behún
  2024-07-19  8:57 ` [PATCH 4/4] platform: cznic: turris-omnia-mcu: Make GPIO " Marek Behún
  2024-08-06 20:08 ` [PATCH 0/4] Make turris-omnia-mcu driver parts optional patchwork-bot+linux-soc
  4 siblings, 0 replies; 6+ messages in thread
From: Marek Behún @ 2024-07-19  8:57 UTC (permalink / raw)
  To: Arnd Bergmann, soc
  Cc: arm, Andy Shevchenko, Hans de Goede, Ilpo Järvinen,
	Marek Behún

Make the system poweroff and RTC wakeup part of the driver optional,
under a boolean config option. Move the dependency to RTC_CLASS to this
new option.

This makes the turris-omnia-mcu driver available for compilation even if
RTC_CLASS is disabled.

Fixes: ed46f1f7731d ("platform: cznic: turris-omnia-mcu: fix Kconfig dependencies")
Signed-off-by: Marek Behún <kabel@kernel.org>
---
 drivers/platform/cznic/Kconfig                 | 13 +++++++++----
 drivers/platform/cznic/Makefile                |  2 +-
 drivers/platform/cznic/turris-omnia-mcu-base.c |  2 ++
 drivers/platform/cznic/turris-omnia-mcu.h      | 13 +++++++++++--
 4 files changed, 23 insertions(+), 7 deletions(-)

diff --git a/drivers/platform/cznic/Kconfig b/drivers/platform/cznic/Kconfig
index 98f17562646e..f02856226dd7 100644
--- a/drivers/platform/cznic/Kconfig
+++ b/drivers/platform/cznic/Kconfig
@@ -18,15 +18,11 @@ config TURRIS_OMNIA_MCU
 	depends on I2C
 	depends on OF
 	depends on GPIOLIB
-	depends on RTC_CLASS
 	select GPIOLIB_IRQCHIP
 	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
@@ -45,6 +41,15 @@ config TURRIS_OMNIA_MCU
 
 if TURRIS_OMNIA_MCU
 
+config TURRIS_OMNIA_MCU_SYSOFF_WAKEUP
+	bool "Turris Omnia MCU system off and RTC wakeup"
+	default y
+	depends on RTC_CLASS
+	help
+	  Say Y here to add support for CZ.NIC's Turris Omnia board poweroff
+	  into true low power mode (with voltage regulators disabled) and the
+	  ability to configure wake up from this mode (via rtcwake).
+
 config TURRIS_OMNIA_MCU_WATCHDOG
 	bool "Turris Omnia MCU watchdog"
 	default y
diff --git a/drivers/platform/cznic/Makefile b/drivers/platform/cznic/Makefile
index 0c28fa859391..380530ba74f7 100644
--- a/drivers/platform/cznic/Makefile
+++ b/drivers/platform/cznic/Makefile
@@ -3,6 +3,6 @@
 obj-$(CONFIG_TURRIS_OMNIA_MCU)	+= turris-omnia-mcu.o
 turris-omnia-mcu-y		:= turris-omnia-mcu-base.o
 turris-omnia-mcu-y		+= turris-omnia-mcu-gpio.o
-turris-omnia-mcu-y		+= turris-omnia-mcu-sys-off-wakeup.o
+turris-omnia-mcu-$(CONFIG_TURRIS_OMNIA_MCU_SYSOFF_WAKEUP)	+= turris-omnia-mcu-sys-off-wakeup.o
 turris-omnia-mcu-$(CONFIG_TURRIS_OMNIA_MCU_TRNG)		+= turris-omnia-mcu-trng.o
 turris-omnia-mcu-$(CONFIG_TURRIS_OMNIA_MCU_WATCHDOG)		+= turris-omnia-mcu-watchdog.o
diff --git a/drivers/platform/cznic/turris-omnia-mcu-base.c b/drivers/platform/cznic/turris-omnia-mcu-base.c
index c68a7a84a951..7b514e60273d 100644
--- a/drivers/platform/cznic/turris-omnia-mcu-base.c
+++ b/drivers/platform/cznic/turris-omnia-mcu-base.c
@@ -198,7 +198,9 @@ static const struct attribute_group omnia_mcu_base_group = {
 static const struct attribute_group *omnia_mcu_groups[] = {
 	&omnia_mcu_base_group,
 	&omnia_mcu_gpio_group,
+#ifdef CONFIG_TURRIS_OMNIA_MCU_SYSOFF_WAKEUP
 	&omnia_mcu_poweroff_group,
+#endif
 	NULL
 };
 
diff --git a/drivers/platform/cznic/turris-omnia-mcu.h b/drivers/platform/cznic/turris-omnia-mcu.h
index d07a32cfe238..75fa2111546f 100644
--- a/drivers/platform/cznic/turris-omnia-mcu.h
+++ b/drivers/platform/cznic/turris-omnia-mcu.h
@@ -42,10 +42,12 @@ struct omnia_mcu {
 	unsigned long last_status;
 	bool button_pressed_emul;
 
+#ifdef CONFIG_TURRIS_OMNIA_MCU_SYSOFF_WAKEUP
 	/* RTC device for configuring wake-up */
 	struct rtc_device *rtcdev;
 	u32 rtc_alarm;
 	bool front_button_poweron;
+#endif
 
 #ifdef CONFIG_TURRIS_OMNIA_MCU_WATCHDOG
 	/* MCU watchdog */
@@ -188,10 +190,17 @@ static inline int omnia_cmd_read_u8(const struct i2c_client *client, u8 cmd,
 
 extern const u8 omnia_int_to_gpio_idx[32];
 extern const struct attribute_group omnia_mcu_gpio_group;
-extern const struct attribute_group omnia_mcu_poweroff_group;
-
 int omnia_mcu_register_gpiochip(struct omnia_mcu *mcu);
+
+#ifdef CONFIG_TURRIS_OMNIA_MCU_SYSOFF_WAKEUP
+extern const struct attribute_group omnia_mcu_poweroff_group;
 int omnia_mcu_register_sys_off_and_wakeup(struct omnia_mcu *mcu);
+#else
+static inline int omnia_mcu_register_sys_off_and_wakeup(struct omnia_mcu *mcu)
+{
+	return 0;
+}
+#endif
 
 #ifdef CONFIG_TURRIS_OMNIA_MCU_TRNG
 int omnia_mcu_register_trng(struct omnia_mcu *mcu);
-- 
2.44.2


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 4/4] platform: cznic: turris-omnia-mcu: Make GPIO code optional
  2024-07-19  8:57 [PATCH 0/4] Make turris-omnia-mcu driver parts optional Marek Behún
                   ` (2 preceding siblings ...)
  2024-07-19  8:57 ` [PATCH 3/4] platform: cznic: turris-omnia-mcu: Make poweroff and wakeup " Marek Behún
@ 2024-07-19  8:57 ` Marek Behún
  2024-08-06 20:08 ` [PATCH 0/4] Make turris-omnia-mcu driver parts optional patchwork-bot+linux-soc
  4 siblings, 0 replies; 6+ messages in thread
From: Marek Behún @ 2024-07-19  8:57 UTC (permalink / raw)
  To: Arnd Bergmann, soc
  Cc: arm, Andy Shevchenko, Hans de Goede, Ilpo Järvinen,
	Marek Behún

Make the GPIO part of the driver optional, under a boolean config
option. Move the dependency to GPIOLIB and OF and the selection of
GPIOLIB_IRQCHIP to this new option.

This makes the turris-omnia-mcu driver available for compilation even if
GPIOLIB or OF are disabled.

Fixes: ed46f1f7731d ("platform: cznic: turris-omnia-mcu: fix Kconfig dependencies")
Signed-off-by: Marek Behún <kabel@kernel.org>
---
 drivers/platform/cznic/Kconfig                | 42 +++++++++++--------
 drivers/platform/cznic/Makefile               |  2 +-
 .../platform/cznic/turris-omnia-mcu-base.c    |  2 +
 drivers/platform/cznic/turris-omnia-mcu.h     |  9 ++++
 4 files changed, 37 insertions(+), 18 deletions(-)

diff --git a/drivers/platform/cznic/Kconfig b/drivers/platform/cznic/Kconfig
index f02856226dd7..a111eca8ff57 100644
--- a/drivers/platform/cznic/Kconfig
+++ b/drivers/platform/cznic/Kconfig
@@ -16,31 +16,38 @@ config TURRIS_OMNIA_MCU
 	tristate "Turris Omnia MCU driver"
 	depends on MACH_ARMADA_38X || COMPILE_TEST
 	depends on I2C
-	depends on OF
-	depends on GPIOLIB
-	select GPIOLIB_IRQCHIP
 	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:
-	  - 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
-	      front LEDs panel brightness)
-	    - to enable / disable USB port voltage regulators and to detect
-	      USB overcurrent
-	    - to detect MiniPCIe / mSATA card presence in MiniPCIe port 0
-	    - to configure resets of various peripherals on board revisions 32+
-	    - to enable / disable the VHV voltage regulator to the SOC in order
-	      to be able to program SOC's OTP on board revisions 32+
-	    - to get input from the LED output pins of the WAN ethernet PHY, LAN
-	      switch and MiniPCIe ports
-	  Other features can be enabled by subsequent config options.
+	  This option only enables the core part of the driver. Specific
+	  features can be enabled by subsequent config options.
 	  To compile this driver as a module, choose M here; the module will be
 	  called turris-omnia-mcu.
 
 if TURRIS_OMNIA_MCU
 
+config TURRIS_OMNIA_MCU_GPIO
+	bool "Turris Omnia MCU GPIOs"
+	default y
+	depends on GPIOLIB
+	depends on OF
+	select GPIOLIB_IRQCHIP
+	help
+	  Say Y here to add support for controlling MCU GPIO pins and receiving
+	  MCU interrupts on CZ.NIC's Turris Omnia.
+	  This enables you to
+	  - get front button press events (the front button can be configured
+	    either to generate press events to the CPU or to change front LEDs
+	    panel brightness),
+	  - enable / disable USB port voltage regulators and to detect USB
+	    overcurrent,
+	  - detect MiniPCIe / mSATA card presence in MiniPCIe port 0,
+	  - configure resets of various peripherals on board revisions 32+,
+	  - enable / disable the VHV voltage regulator to the SOC in order to be
+	    able to program SOC's OTP on board revisions 32+,
+	  - get input from the LED output pins of the WAN ethernet PHY, LAN
+	    switch and MiniPCIe ports.
+
 config TURRIS_OMNIA_MCU_SYSOFF_WAKEUP
 	bool "Turris Omnia MCU system off and RTC wakeup"
 	default y
@@ -62,6 +69,7 @@ config TURRIS_OMNIA_MCU_WATCHDOG
 config TURRIS_OMNIA_MCU_TRNG
 	bool "Turris Omnia MCU true random number generator"
 	default y
+	depends on TURRIS_OMNIA_MCU_GPIO
 	depends on HW_RANDOM
 	help
 	  Say Y here to add support for the true random number generator
diff --git a/drivers/platform/cznic/Makefile b/drivers/platform/cznic/Makefile
index 380530ba74f7..ce6d997f34d6 100644
--- a/drivers/platform/cznic/Makefile
+++ b/drivers/platform/cznic/Makefile
@@ -2,7 +2,7 @@
 
 obj-$(CONFIG_TURRIS_OMNIA_MCU)	+= turris-omnia-mcu.o
 turris-omnia-mcu-y		:= turris-omnia-mcu-base.o
-turris-omnia-mcu-y		+= turris-omnia-mcu-gpio.o
+turris-omnia-mcu-$(CONFIG_TURRIS_OMNIA_MCU_GPIO)		+= turris-omnia-mcu-gpio.o
 turris-omnia-mcu-$(CONFIG_TURRIS_OMNIA_MCU_SYSOFF_WAKEUP)	+= turris-omnia-mcu-sys-off-wakeup.o
 turris-omnia-mcu-$(CONFIG_TURRIS_OMNIA_MCU_TRNG)		+= turris-omnia-mcu-trng.o
 turris-omnia-mcu-$(CONFIG_TURRIS_OMNIA_MCU_WATCHDOG)		+= turris-omnia-mcu-watchdog.o
diff --git a/drivers/platform/cznic/turris-omnia-mcu-base.c b/drivers/platform/cznic/turris-omnia-mcu-base.c
index 7b514e60273d..58f9afae2867 100644
--- a/drivers/platform/cznic/turris-omnia-mcu-base.c
+++ b/drivers/platform/cznic/turris-omnia-mcu-base.c
@@ -197,7 +197,9 @@ static const struct attribute_group omnia_mcu_base_group = {
 
 static const struct attribute_group *omnia_mcu_groups[] = {
 	&omnia_mcu_base_group,
+#ifdef CONFIG_TURRIS_OMNIA_MCU_GPIO
 	&omnia_mcu_gpio_group,
+#endif
 #ifdef CONFIG_TURRIS_OMNIA_MCU_SYSOFF_WAKEUP
 	&omnia_mcu_poweroff_group,
 #endif
diff --git a/drivers/platform/cznic/turris-omnia-mcu.h b/drivers/platform/cznic/turris-omnia-mcu.h
index 75fa2111546f..fed0d357fea3 100644
--- a/drivers/platform/cznic/turris-omnia-mcu.h
+++ b/drivers/platform/cznic/turris-omnia-mcu.h
@@ -33,6 +33,7 @@ struct omnia_mcu {
 	u8 board_first_mac[ETH_ALEN];
 	u8 board_revision;
 
+#ifdef CONFIG_TURRIS_OMNIA_MCU_GPIO
 	/* GPIO chip */
 	struct gpio_chip gc;
 	struct mutex lock;
@@ -41,6 +42,7 @@ struct omnia_mcu {
 	struct delayed_work button_release_emul_work;
 	unsigned long last_status;
 	bool button_pressed_emul;
+#endif
 
 #ifdef CONFIG_TURRIS_OMNIA_MCU_SYSOFF_WAKEUP
 	/* RTC device for configuring wake-up */
@@ -188,9 +190,16 @@ static inline int omnia_cmd_read_u8(const struct i2c_client *client, u8 cmd,
 	return omnia_cmd_read(client, cmd, reply, sizeof(*reply));
 }
 
+#ifdef CONFIG_TURRIS_OMNIA_MCU_GPIO
 extern const u8 omnia_int_to_gpio_idx[32];
 extern const struct attribute_group omnia_mcu_gpio_group;
 int omnia_mcu_register_gpiochip(struct omnia_mcu *mcu);
+#else
+static inline int omnia_mcu_register_gpiochip(struct omnia_mcu *mcu)
+{
+	return 0;
+}
+#endif
 
 #ifdef CONFIG_TURRIS_OMNIA_MCU_SYSOFF_WAKEUP
 extern const struct attribute_group omnia_mcu_poweroff_group;
-- 
2.44.2


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH 0/4] Make turris-omnia-mcu driver parts optional
  2024-07-19  8:57 [PATCH 0/4] Make turris-omnia-mcu driver parts optional Marek Behún
                   ` (3 preceding siblings ...)
  2024-07-19  8:57 ` [PATCH 4/4] platform: cznic: turris-omnia-mcu: Make GPIO " Marek Behún
@ 2024-08-06 20:08 ` patchwork-bot+linux-soc
  4 siblings, 0 replies; 6+ messages in thread
From: patchwork-bot+linux-soc @ 2024-08-06 20:08 UTC (permalink / raw)
  To: =?utf-8?q?Marek_Beh=C3=BAn_=3Ckabel=40kernel=2Eorg=3E?=; +Cc: soc

Hello:

This series was applied to soc/soc.git (arm/fixes)
by Arnd Bergmann <arnd@arndb.de>:

On Fri, 19 Jul 2024 10:57:52 +0200 you wrote:
> Hi Arnd,
> 
> this series solves the Kconfig dependency issues of the turris-omnia-mcu
> driver by making the GPIO, poweroff & wakeup, watchdog and TRNG parts of
> the driver optional, under new Kconfig options. The dependencies to
> subsystems are moved under these new options.
> 
> [...]

Here is the summary with links:
  - [1/4] platform: cznic: turris-omnia-mcu: Make watchdog code optional
    https://git.kernel.org/soc/soc/c/eedc64f9100c
  - [2/4] platform: cznic: turris-omnia-mcu: Make TRNG code optional
    https://git.kernel.org/soc/soc/c/adc8f76f772b
  - [3/4] platform: cznic: turris-omnia-mcu: Make poweroff and wakeup code optional
    https://git.kernel.org/soc/soc/c/7a44f54b40c7
  - [4/4] platform: cznic: turris-omnia-mcu: Make GPIO code optional
    https://git.kernel.org/soc/soc/c/e1e95875512a

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2024-08-06 20:08 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-07-19  8:57 [PATCH 0/4] Make turris-omnia-mcu driver parts optional Marek Behún
2024-07-19  8:57 ` [PATCH 1/4] platform: cznic: turris-omnia-mcu: Make watchdog code optional Marek Behún
2024-07-19  8:57 ` [PATCH 2/4] platform: cznic: turris-omnia-mcu: Make TRNG " Marek Behún
2024-07-19  8:57 ` [PATCH 3/4] platform: cznic: turris-omnia-mcu: Make poweroff and wakeup " Marek Behún
2024-07-19  8:57 ` [PATCH 4/4] platform: cznic: turris-omnia-mcu: Make GPIO " Marek Behún
2024-08-06 20:08 ` [PATCH 0/4] Make turris-omnia-mcu driver parts optional patchwork-bot+linux-soc

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.