firmware: xilinx: add register notifier in zynqmp firmware
authorAbhyuday Godhasara <abhyuday.godhasara@xilinx.com>
Tue, 26 Oct 2021 04:25:20 +0000 (21:25 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 17 Nov 2021 15:11:48 +0000 (16:11 +0100)
In zynqmp-firmware, register notifier is not supported, add support of
register notifier in zynqmp-firmware.

Acked-by: Michal Simek <michal.simek@xilinx.com>
Signed-off-by: Tejas Patel <tejas.patel@xilinx.com>
Signed-off-by: Abhyuday Godhasara <abhyuday.godhasara@xilinx.com>
Link: https://lore.kernel.org/r/20211026042525.26612-2-abhyuday.godhasara@xilinx.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/firmware/xilinx/zynqmp.c
include/linux/firmware/xlnx-zynqmp.h

index 3dd45a7420dc3152c3ab8972915f9bac9656fa94..30edcd2337868e5e27cb25b88bed163aac14351c 100644 (file)
@@ -1116,6 +1116,29 @@ int zynqmp_pm_aes_engine(const u64 address, u32 *out)
 }
 EXPORT_SYMBOL_GPL(zynqmp_pm_aes_engine);
 
+/**
+ * zynqmp_pm_register_notifier() - PM API for register a subsystem
+ *                                to be notified about specific
+ *                                event/error.
+ * @node:      Node ID to which the event is related.
+ * @event:     Event Mask of Error events for which wants to get notified.
+ * @wake:      Wake subsystem upon capturing the event if value 1
+ * @enable:    Enable the registration for value 1, disable for value 0
+ *
+ * This function is used to register/un-register for particular node-event
+ * combination in firmware.
+ *
+ * Return: Returns status, either success or error+reason
+ */
+
+int zynqmp_pm_register_notifier(const u32 node, const u32 event,
+                               const u32 wake, const u32 enable)
+{
+       return zynqmp_pm_invoke_fn(PM_REGISTER_NOTIFIER, node, event,
+                                  wake, enable, NULL);
+}
+EXPORT_SYMBOL_GPL(zynqmp_pm_register_notifier);
+
 /**
  * zynqmp_pm_system_shutdown - PM call to request a system shutdown or restart
  * @type:      Shutdown or restart? 0 for shutdown, 1 for restart
index 47fd4e52a4234783a6bb8dd14ca9a08e75300559..d30d39dc8cb49043471b911e92a6b808d90071f1 100644 (file)
@@ -2,7 +2,7 @@
 /*
  * Xilinx Zynq MPSoC Firmware layer
  *
- *  Copyright (C) 2014-2019 Xilinx
+ *  Copyright (C) 2014-2021 Xilinx
  *
  *  Michal Simek <michal.simek@xilinx.com>
  *  Davorin Mista <davorin.mista@aggios.com>
@@ -66,6 +66,7 @@
 
 enum pm_api_id {
        PM_GET_API_VERSION = 1,
+       PM_REGISTER_NOTIFIER = 5,
        PM_SYSTEM_SHUTDOWN = 12,
        PM_REQUEST_NODE = 13,
        PM_RELEASE_NODE = 14,
@@ -427,6 +428,8 @@ int zynqmp_pm_pinctrl_get_config(const u32 pin, const u32 param,
 int zynqmp_pm_pinctrl_set_config(const u32 pin, const u32 param,
                                 u32 value);
 int zynqmp_pm_load_pdi(const u32 src, const u64 address);
+int zynqmp_pm_register_notifier(const u32 node, const u32 event,
+                               const u32 wake, const u32 enable);
 #else
 static inline int zynqmp_pm_get_api_version(u32 *version)
 {
@@ -658,6 +661,12 @@ static inline int zynqmp_pm_load_pdi(const u32 src, const u64 address)
 {
        return -ENODEV;
 }
+
+static inline int zynqmp_pm_register_notifier(const u32 node, const u32 event,
+                                             const u32 wake, const u32 enable)
+{
+       return -ENODEV;
+}
 #endif
 
 #endif /* __FIRMWARE_ZYNQMP_H__ */