summaryrefslogtreecommitdiffstats
path: root/drivers/platform/cznic/turris-omnia-mcu.h
diff options
context:
space:
mode:
authorMarek BehĂșn <kabel@kernel.org>2024-07-19 10:57:55 +0200
committerArnd Bergmann <arnd@arndb.de>2024-08-07 14:43:54 +0200
commit74a22fced5a012c57f56d1cf7ea926cc366a2a3a (patch)
tree008eeb0ba2bb34092627ee8571991d2f86395490 /drivers/platform/cznic/turris-omnia-mcu.h
parentplatform: cznic: turris-omnia-mcu: Make TRNG code optional (diff)
downloadlinux-74a22fced5a012c57f56d1cf7ea926cc366a2a3a.tar.xz
linux-74a22fced5a012c57f56d1cf7ea926cc366a2a3a.zip
platform: cznic: turris-omnia-mcu: Make poweroff and wakeup code optional
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> Link: https://lore.kernel.org/r/20240719085756.30598-4-kabel@kernel.org Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Diffstat (limited to 'drivers/platform/cznic/turris-omnia-mcu.h')
-rw-r--r--drivers/platform/cznic/turris-omnia-mcu.h13
1 files changed, 11 insertions, 2 deletions
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);