pinctrl: stm32: Allow compile as module for stm32mp257

Add ability to build pinctrl for stm32mp257 as a kernel module.
Add kernel-doc to the exported symbols.

Signed-off-by: Stephane Danieau <stephane.danieau@foss.st.com>
Signed-off-by: Antonio Borneo <antonio.borneo@foss.st.com>
Link: https://lore.kernel.org/20250610143042.295376-5-antonio.borneo@foss.st.com
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
This commit is contained in:
Stephane Danieau 2025-06-10 16:30:41 +02:00 committed by Linus Walleij
parent d6c8fceb33
commit dba0aff2b8
5 changed files with 31 additions and 9 deletions

View File

@ -311,7 +311,6 @@ config ARCH_STM32
bool "STMicroelectronics STM32 SoC Family" bool "STMicroelectronics STM32 SoC Family"
select GPIOLIB select GPIOLIB
select PINCTRL select PINCTRL
select PINCTRL_STM32MP257
select ARM_SMC_MBOX select ARM_SMC_MBOX
select ARM_SCMI_PROTOCOL select ARM_SCMI_PROTOCOL
select REGULATOR select REGULATOR

View File

@ -2,7 +2,7 @@
if ARCH_STM32 || COMPILE_TEST if ARCH_STM32 || COMPILE_TEST
config PINCTRL_STM32 config PINCTRL_STM32
bool tristate
depends on OF depends on OF
select PINMUX select PINMUX
select GENERIC_PINCONF select GENERIC_PINCONF
@ -53,8 +53,8 @@ config PINCTRL_STM32MP157
select PINCTRL_STM32 select PINCTRL_STM32
config PINCTRL_STM32MP257 config PINCTRL_STM32MP257
bool "STMicroelectronics STM32MP257 pin control" if COMPILE_TEST && !MACH_STM32MP25 tristate "STMicroelectronics STM32MP257 pin control"
depends on OF && HAS_IOMEM depends on OF && HAS_IOMEM
default MACH_STM32MP25 default MACH_STM32MP25 || (ARCH_STM32 && ARM64)
select PINCTRL_STM32 select PINCTRL_STM32
endif endif

View File

@ -8,6 +8,7 @@
*/ */
#include <linux/bitfield.h> #include <linux/bitfield.h>
#include <linux/clk.h> #include <linux/clk.h>
#include <linux/export.h>
#include <linux/gpio/driver.h> #include <linux/gpio/driver.h>
#include <linux/hwspinlock.h> #include <linux/hwspinlock.h>
#include <linux/io.h> #include <linux/io.h>
@ -1785,6 +1786,7 @@ int stm32_pctl_probe(struct platform_device *pdev)
clk_bulk_disable_unprepare(banks, pctl->clks); clk_bulk_disable_unprepare(banks, pctl->clks);
return ret; return ret;
} }
EXPORT_SYMBOL(stm32_pctl_probe);
static int __maybe_unused stm32_pinctrl_restore_gpio_regs( static int __maybe_unused stm32_pinctrl_restore_gpio_regs(
struct stm32_pinctrl *pctl, u32 pin) struct stm32_pinctrl *pctl, u32 pin)
@ -1857,6 +1859,7 @@ int __maybe_unused stm32_pinctrl_suspend(struct device *dev)
return 0; return 0;
} }
EXPORT_SYMBOL(stm32_pinctrl_suspend);
int __maybe_unused stm32_pinctrl_resume(struct device *dev) int __maybe_unused stm32_pinctrl_resume(struct device *dev)
{ {
@ -1873,3 +1876,8 @@ int __maybe_unused stm32_pinctrl_resume(struct device *dev)
return 0; return 0;
} }
EXPORT_SYMBOL(stm32_pinctrl_resume);
MODULE_AUTHOR("Alexandre Torgue <alexandre.torgue@foss.st.com>");
MODULE_DESCRIPTION("STM32 core pinctrl driver");
MODULE_LICENSE("GPL");

View File

@ -66,8 +66,22 @@ struct stm32_pinctrl_match_data {
bool rif_control; bool rif_control;
}; };
/**
* stm32_pctl_probe() - Common probe for stm32 pinctrl drivers.
* @pdev: Pinctrl platform device.
*/
int stm32_pctl_probe(struct platform_device *pdev); int stm32_pctl_probe(struct platform_device *pdev);
/**
* stm32_pinctrl_suspend() - Common suspend for stm32 pinctrl drivers.
* @dev: Pinctrl device.
*/
int stm32_pinctrl_suspend(struct device *dev); int stm32_pinctrl_suspend(struct device *dev);
/**
* stm32_pinctrl_resume() - Common resume for stm32 pinctrl drivers.
* @dev: Pinctrl device.
*/
int stm32_pinctrl_resume(struct device *dev); int stm32_pinctrl_resume(struct device *dev);
#endif /* __PINCTRL_STM32_H */ #endif /* __PINCTRL_STM32_H */

View File

@ -4,6 +4,7 @@
* Author: Alexandre Torgue <alexandre.torgue@foss.st.com> for STMicroelectronics. * Author: Alexandre Torgue <alexandre.torgue@foss.st.com> for STMicroelectronics.
*/ */
#include <linux/init.h> #include <linux/init.h>
#include <linux/module.h>
#include <linux/of.h> #include <linux/of.h>
#include <linux/platform_device.h> #include <linux/platform_device.h>
@ -2564,6 +2565,7 @@ static const struct of_device_id stm32mp257_pctrl_match[] = {
}, },
{ } { }
}; };
MODULE_DEVICE_TABLE(of, stm32mp257_pctrl_match);
static const struct dev_pm_ops stm32_pinctrl_dev_pm_ops = { static const struct dev_pm_ops stm32_pinctrl_dev_pm_ops = {
SET_LATE_SYSTEM_SLEEP_PM_OPS(stm32_pinctrl_suspend, stm32_pinctrl_resume) SET_LATE_SYSTEM_SLEEP_PM_OPS(stm32_pinctrl_suspend, stm32_pinctrl_resume)
@ -2577,9 +2579,8 @@ static struct platform_driver stm32mp257_pinctrl_driver = {
.pm = &stm32_pinctrl_dev_pm_ops, .pm = &stm32_pinctrl_dev_pm_ops,
}, },
}; };
module_platform_driver(stm32mp257_pinctrl_driver);
static int __init stm32mp257_pinctrl_init(void) MODULE_AUTHOR("Alexandre Torgue <alexandre.torgue@foss.st.com>");
{ MODULE_DESCRIPTION("STM32MP257 pinctrl driver");
return platform_driver_register(&stm32mp257_pinctrl_driver); MODULE_LICENSE("GPL");
}
arch_initcall(stm32mp257_pinctrl_init);