mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-01-07 13:53:24 +00:00
platform: cznic: turris-omnia-mcu: Make GPIO code optional
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: ed46f1f773
("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-5-kabel@kernel.org
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
This commit is contained in:
parent
74a22fced5
commit
af340b7aa2
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user