Add stubs for those i.MX SCU APIs to make those modules depending
on IMX_SCU can pass build when COMPILE_TEST is enabled.
Signed-off-by: Anson Huang <[email protected]>
---
new patch.
---
include/linux/firmware/imx/ipc.h | 11 +++++++++++
include/linux/firmware/imx/sci.h | 19 +++++++++++++++++++
2 files changed, 30 insertions(+)
diff --git a/include/linux/firmware/imx/ipc.h b/include/linux/firmware/imx/ipc.h
index 8910574..3fff0e2 100644
--- a/include/linux/firmware/imx/ipc.h
+++ b/include/linux/firmware/imx/ipc.h
@@ -34,6 +34,7 @@ struct imx_sc_rpc_msg {
uint8_t func;
};
+#ifdef CONFIG_IMX_SCU
/*
* This is an function to send an RPC message over an IPC channel.
* It is called by client-side SCFW API function shims.
@@ -55,4 +56,14 @@ int imx_scu_call_rpc(struct imx_sc_ipc *ipc, void *msg, bool have_resp);
* @return Returns an error code (0 = success, failed if < 0)
*/
int imx_scu_get_handle(struct imx_sc_ipc **ipc);
+#else
+static inline int imx_scu_call_rpc(struct imx_sc_ipc *ipc, void *msg, bool have_resp)
+{
+ return 0;
+}
+static inline int imx_scu_get_handle(struct imx_sc_ipc **ipc)
+{
+ return 0;
+}
+#endif
#endif /* _SC_IPC_H */
diff --git a/include/linux/firmware/imx/sci.h b/include/linux/firmware/imx/sci.h
index 17ba4e4..4688b60 100644
--- a/include/linux/firmware/imx/sci.h
+++ b/include/linux/firmware/imx/sci.h
@@ -16,8 +16,27 @@
#include <linux/firmware/imx/svc/misc.h>
#include <linux/firmware/imx/svc/pm.h>
+#ifdef CONFIG_IMX_SCU
int imx_scu_enable_general_irq_channel(struct device *dev);
int imx_scu_irq_register_notifier(struct notifier_block *nb);
int imx_scu_irq_unregister_notifier(struct notifier_block *nb);
int imx_scu_irq_group_enable(u8 group, u32 mask, u8 enable);
+#else
+static inline int imx_scu_enable_general_irq_channel(struct device *dev)
+{
+ return 0;
+}
+static inline int imx_scu_irq_register_notifier(struct notifier_block *nb)
+{
+ return 0;
+}
+static inline int imx_scu_irq_unregister_notifier(struct notifier_block *nb)
+{
+ return 0;
+}
+static inline int imx_scu_irq_group_enable(u8 group, u32 mask, u8 enable)
+{
+ return 0;
+}
+#endif
#endif /* _SC_SCI_H */
--
2.7.4
Add COMPILE_TEST support to i.MX SC RTC driver for better compile
testing coverage.
Signed-off-by: Anson Huang <[email protected]>
---
no change.
---
drivers/rtc/Kconfig | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/rtc/Kconfig b/drivers/rtc/Kconfig
index acaf6f98..a86768f 100644
--- a/drivers/rtc/Kconfig
+++ b/drivers/rtc/Kconfig
@@ -1772,7 +1772,7 @@ config RTC_DRV_SNVS
will be called "rtc-snvs".
config RTC_DRV_IMX_SC
- depends on IMX_SCU
+ depends on IMX_SCU || COMPILE_TEST
depends on HAVE_ARM_SMCCC
tristate "NXP i.MX System Controller RTC support"
help
--
2.7.4
Fix below build warning when COMPILE_TEST is enabled while IMX_SCU is not:
drivers/input/keyboard/imx_sc_key.c: In function ‘imx_sc_check_for_events’:
drivers/input/keyboard/imx_sc_key.c:87:27: warning: ‘msg.state’ is used
uninitialized in this function [-Wuninitialized]
state = (bool)(msg.state & 0xff);
^
AR drivers/input/keyboard/built-in.a
Signed-off-by: Anson Huang <[email protected]>
---
new patch.
---
drivers/input/keyboard/imx_sc_key.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/input/keyboard/imx_sc_key.c b/drivers/input/keyboard/imx_sc_key.c
index 9f809ae..26a12fb 100644
--- a/drivers/input/keyboard/imx_sc_key.c
+++ b/drivers/input/keyboard/imx_sc_key.c
@@ -72,6 +72,7 @@ static void imx_sc_check_for_events(struct work_struct *work)
hdr->func = IMX_SC_MISC_FUNC_GET_BUTTON_STATUS;
hdr->size = 1;
+ msg.state = 0;
error = imx_scu_call_rpc(priv->key_ipc_handle, &msg, true);
if (error) {
dev_err(&input->dev, "read imx sc key failed, error %d\n", error);
--
2.7.4
Add COMPILE_TEST support to i.MX SC thermal driver for better compile
testing coverage.
Signed-off-by: Anson Huang <[email protected]>
Reviewed-by: Amit Kucheria <[email protected]>
---
no change.
---
drivers/thermal/Kconfig | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/thermal/Kconfig b/drivers/thermal/Kconfig
index 91af271..55c7641 100644
--- a/drivers/thermal/Kconfig
+++ b/drivers/thermal/Kconfig
@@ -254,7 +254,7 @@ config IMX_THERMAL
config IMX_SC_THERMAL
tristate "Temperature sensor driver for NXP i.MX SoCs with System Controller"
- depends on IMX_SCU
+ depends on IMX_SCU || COMPILE_TEST
depends on OF
help
Support for Temperature Monitor (TEMPMON) found on NXP i.MX SoCs with
--
2.7.4
Add COMPILE_TEST support to i.MX SC watchdog driver for better compile
testing coverage.
Signed-off-by: Anson Huang <[email protected]>
---
no change.
---
drivers/watchdog/Kconfig | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/watchdog/Kconfig b/drivers/watchdog/Kconfig
index 9ea2b43..6388154 100644
--- a/drivers/watchdog/Kconfig
+++ b/drivers/watchdog/Kconfig
@@ -712,7 +712,7 @@ config IMX2_WDT
config IMX_SC_WDT
tristate "IMX SC Watchdog"
depends on HAVE_ARM_SMCCC
- depends on IMX_SCU
+ depends on IMX_SCU || COMPILE_TEST
select WATCHDOG_CORE
help
This is the driver for the system controller watchdog
--
2.7.4
Add COMPILE_TEST support to i.MX SC keyboard driver for better compile
testing coverage.
Signed-off-by: Anson Huang <[email protected]>
---
no change.
---
drivers/input/keyboard/Kconfig | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/input/keyboard/Kconfig b/drivers/input/keyboard/Kconfig
index 4706ff0..81e26f6 100644
--- a/drivers/input/keyboard/Kconfig
+++ b/drivers/input/keyboard/Kconfig
@@ -467,7 +467,7 @@ config KEYBOARD_IMX
config KEYBOARD_IMX_SC_KEY
tristate "IMX SCU Key Driver"
- depends on IMX_SCU
+ depends on IMX_SCU || COMPILE_TEST
help
This is the system controller key driver for NXP i.MX SoCs with
system controller inside.
--
2.7.4
Add COMPILE_TEST support to i.MX SCU drivers for better compile
testing coverage.
Signed-off-by: Anson Huang <[email protected]>
---
no change.
---
drivers/firmware/imx/Kconfig | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/firmware/imx/Kconfig b/drivers/firmware/imx/Kconfig
index 1d2e5b8..116707a 100644
--- a/drivers/firmware/imx/Kconfig
+++ b/drivers/firmware/imx/Kconfig
@@ -12,7 +12,7 @@ config IMX_DSP
config IMX_SCU
bool "IMX SCU Protocol driver"
- depends on IMX_MBOX
+ depends on IMX_MBOX || COMPILE_TEST
help
The System Controller Firmware (SCFW) is a low-level system function
which runs on a dedicated Cortex-M core to provide power, clock, and
@@ -24,6 +24,6 @@ config IMX_SCU
config IMX_SCU_PD
bool "IMX SCU Power Domain driver"
- depends on IMX_SCU
+ depends on IMX_SCU || COMPILE_TEST
help
The System Controller Firmware (SCFW) based power domain driver.
--
2.7.4
Hi, Guenter
> Subject: Re: [PATCH V2 1/7] firmware: imx: Add stubs for !CONFIG_IMX_SCU
> case
>
> On 3/6/20 5:25 PM, Anson Huang wrote:
> > Add stubs for those i.MX SCU APIs to make those modules depending on
> > IMX_SCU can pass build when COMPILE_TEST is enabled.
> >
> > Signed-off-by: Anson Huang <[email protected]>
> > ---
> > new patch.
> > ---
> > include/linux/firmware/imx/ipc.h | 11 +++++++++++
> > include/linux/firmware/imx/sci.h | 19 +++++++++++++++++++
> > 2 files changed, 30 insertions(+)
> >
> > diff --git a/include/linux/firmware/imx/ipc.h
> > b/include/linux/firmware/imx/ipc.h
> > index 8910574..3fff0e2 100644
> > --- a/include/linux/firmware/imx/ipc.h
> > +++ b/include/linux/firmware/imx/ipc.h
> > @@ -34,6 +34,7 @@ struct imx_sc_rpc_msg {
> > uint8_t func;
> > };
> >
> > +#ifdef CONFIG_IMX_SCU
> > /*
> > * This is an function to send an RPC message over an IPC channel.
> > * It is called by client-side SCFW API function shims.
> > @@ -55,4 +56,14 @@ int imx_scu_call_rpc(struct imx_sc_ipc *ipc, void
> *msg, bool have_resp);
> > * @return Returns an error code (0 = success, failed if < 0)
> > */
> > int imx_scu_get_handle(struct imx_sc_ipc **ipc);
> > +#else
> > +static inline int imx_scu_call_rpc(struct imx_sc_ipc *ipc, void *msg,
> > +bool have_resp) {
> > + return 0;
> > +}
> > +static inline int imx_scu_get_handle(struct imx_sc_ipc **ipc) {
> > + return 0;
> > +}
> > +#endif
> > #endif /* _SC_IPC_H */
> > diff --git a/include/linux/firmware/imx/sci.h
> > b/include/linux/firmware/imx/sci.h
> > index 17ba4e4..4688b60 100644
> > --- a/include/linux/firmware/imx/sci.h
> > +++ b/include/linux/firmware/imx/sci.h
> > @@ -16,8 +16,27 @@
> > #include <linux/firmware/imx/svc/misc.h> #include
> > <linux/firmware/imx/svc/pm.h>
> >
> > +#ifdef CONFIG_IMX_SCU
> > int imx_scu_enable_general_irq_channel(struct device *dev); int
> > imx_scu_irq_register_notifier(struct notifier_block *nb); int
> > imx_scu_irq_unregister_notifier(struct notifier_block *nb); int
> > imx_scu_irq_group_enable(u8 group, u32 mask, u8 enable);
> > +#else
> > +static inline int imx_scu_enable_general_irq_channel(struct device
> > +*dev) {
> > + return 0;
> > +}
> > +static inline int imx_scu_irq_register_notifier(struct notifier_block
> > +*nb) {
> > + return 0;
> > +}
> > +static inline int imx_scu_irq_unregister_notifier(struct
> > +notifier_block *nb) {
> > + return 0;
> > +}
> > +static inline int imx_scu_irq_group_enable(u8 group, u32 mask, u8
> > +enable) {
> > + return 0;
> > +}
>
> It would probably be more appropriate to return errors from the stub
> functions.
Agreed, improve them in V3 patch series.
Thanks,
Anson
On 3/6/20 5:25 PM, Anson Huang wrote:
> Add stubs for those i.MX SCU APIs to make those modules depending
> on IMX_SCU can pass build when COMPILE_TEST is enabled.
>
> Signed-off-by: Anson Huang <[email protected]>
> ---
> new patch.
> ---
> include/linux/firmware/imx/ipc.h | 11 +++++++++++
> include/linux/firmware/imx/sci.h | 19 +++++++++++++++++++
> 2 files changed, 30 insertions(+)
>
> diff --git a/include/linux/firmware/imx/ipc.h b/include/linux/firmware/imx/ipc.h
> index 8910574..3fff0e2 100644
> --- a/include/linux/firmware/imx/ipc.h
> +++ b/include/linux/firmware/imx/ipc.h
> @@ -34,6 +34,7 @@ struct imx_sc_rpc_msg {
> uint8_t func;
> };
>
> +#ifdef CONFIG_IMX_SCU
> /*
> * This is an function to send an RPC message over an IPC channel.
> * It is called by client-side SCFW API function shims.
> @@ -55,4 +56,14 @@ int imx_scu_call_rpc(struct imx_sc_ipc *ipc, void *msg, bool have_resp);
> * @return Returns an error code (0 = success, failed if < 0)
> */
> int imx_scu_get_handle(struct imx_sc_ipc **ipc);
> +#else
> +static inline int imx_scu_call_rpc(struct imx_sc_ipc *ipc, void *msg, bool have_resp)
> +{
> + return 0;
> +}
> +static inline int imx_scu_get_handle(struct imx_sc_ipc **ipc)
> +{
> + return 0;
> +}
> +#endif
> #endif /* _SC_IPC_H */
> diff --git a/include/linux/firmware/imx/sci.h b/include/linux/firmware/imx/sci.h
> index 17ba4e4..4688b60 100644
> --- a/include/linux/firmware/imx/sci.h
> +++ b/include/linux/firmware/imx/sci.h
> @@ -16,8 +16,27 @@
> #include <linux/firmware/imx/svc/misc.h>
> #include <linux/firmware/imx/svc/pm.h>
>
> +#ifdef CONFIG_IMX_SCU
> int imx_scu_enable_general_irq_channel(struct device *dev);
> int imx_scu_irq_register_notifier(struct notifier_block *nb);
> int imx_scu_irq_unregister_notifier(struct notifier_block *nb);
> int imx_scu_irq_group_enable(u8 group, u32 mask, u8 enable);
> +#else
> +static inline int imx_scu_enable_general_irq_channel(struct device *dev)
> +{
> + return 0;
> +}
> +static inline int imx_scu_irq_register_notifier(struct notifier_block *nb)
> +{
> + return 0;
> +}
> +static inline int imx_scu_irq_unregister_notifier(struct notifier_block *nb)
> +{
> + return 0;
> +}
> +static inline int imx_scu_irq_group_enable(u8 group, u32 mask, u8 enable)
> +{
> + return 0;
> +}
It would probably be more appropriate to return errors from the stub functions.
Guenter
> +#endif
> #endif /* _SC_SCI_H */
>
On Sat, Mar 07, 2020 at 09:25:53AM +0800, Anson Huang wrote:
> Add stubs for those i.MX SCU APIs to make those modules depending
> on IMX_SCU can pass build when COMPILE_TEST is enabled.
>
> Signed-off-by: Anson Huang <[email protected]>
Already had such a patch from Peng Fan.
Shawn
> ---
> new patch.
> ---
> include/linux/firmware/imx/ipc.h | 11 +++++++++++
> include/linux/firmware/imx/sci.h | 19 +++++++++++++++++++
> 2 files changed, 30 insertions(+)
>
> diff --git a/include/linux/firmware/imx/ipc.h b/include/linux/firmware/imx/ipc.h
> index 8910574..3fff0e2 100644
> --- a/include/linux/firmware/imx/ipc.h
> +++ b/include/linux/firmware/imx/ipc.h
> @@ -34,6 +34,7 @@ struct imx_sc_rpc_msg {
> uint8_t func;
> };
>
> +#ifdef CONFIG_IMX_SCU
> /*
> * This is an function to send an RPC message over an IPC channel.
> * It is called by client-side SCFW API function shims.
> @@ -55,4 +56,14 @@ int imx_scu_call_rpc(struct imx_sc_ipc *ipc, void *msg, bool have_resp);
> * @return Returns an error code (0 = success, failed if < 0)
> */
> int imx_scu_get_handle(struct imx_sc_ipc **ipc);
> +#else
> +static inline int imx_scu_call_rpc(struct imx_sc_ipc *ipc, void *msg, bool have_resp)
> +{
> + return 0;
> +}
> +static inline int imx_scu_get_handle(struct imx_sc_ipc **ipc)
> +{
> + return 0;
> +}
> +#endif
> #endif /* _SC_IPC_H */
> diff --git a/include/linux/firmware/imx/sci.h b/include/linux/firmware/imx/sci.h
> index 17ba4e4..4688b60 100644
> --- a/include/linux/firmware/imx/sci.h
> +++ b/include/linux/firmware/imx/sci.h
> @@ -16,8 +16,27 @@
> #include <linux/firmware/imx/svc/misc.h>
> #include <linux/firmware/imx/svc/pm.h>
>
> +#ifdef CONFIG_IMX_SCU
> int imx_scu_enable_general_irq_channel(struct device *dev);
> int imx_scu_irq_register_notifier(struct notifier_block *nb);
> int imx_scu_irq_unregister_notifier(struct notifier_block *nb);
> int imx_scu_irq_group_enable(u8 group, u32 mask, u8 enable);
> +#else
> +static inline int imx_scu_enable_general_irq_channel(struct device *dev)
> +{
> + return 0;
> +}
> +static inline int imx_scu_irq_register_notifier(struct notifier_block *nb)
> +{
> + return 0;
> +}
> +static inline int imx_scu_irq_unregister_notifier(struct notifier_block *nb)
> +{
> + return 0;
> +}
> +static inline int imx_scu_irq_group_enable(u8 group, u32 mask, u8 enable)
> +{
> + return 0;
> +}
> +#endif
> #endif /* _SC_SCI_H */
> --
> 2.7.4
>
On 3/15/20 5:28 PM, Shawn Guo wrote:
> On Sat, Mar 07, 2020 at 09:25:53AM +0800, Anson Huang wrote:
>> Add stubs for those i.MX SCU APIs to make those modules depending
>> on IMX_SCU can pass build when COMPILE_TEST is enabled.
>>
>> Signed-off-by: Anson Huang <[email protected]>
>
> Already had such a patch from Peng Fan.
>
Did you follow the discussion and the conclusion that the only patch
really needed is patch 2/7 ?
Guenter
On Sun, Mar 15, 2020 at 05:54:52PM -0700, Guenter Roeck wrote:
> On 3/15/20 5:28 PM, Shawn Guo wrote:
> > On Sat, Mar 07, 2020 at 09:25:53AM +0800, Anson Huang wrote:
> >> Add stubs for those i.MX SCU APIs to make those modules depending
> >> on IMX_SCU can pass build when COMPILE_TEST is enabled.
> >>
> >> Signed-off-by: Anson Huang <[email protected]>
> >
> > Already had such a patch from Peng Fan.
> >
>
> Did you follow the discussion and the conclusion that the only patch
> really needed is patch 2/7 ?
Thanks for the reminding. Just did.
Shawn