Skip to content

Commit da22a04

Browse files
bentheredonethatmathieupoirier
authored andcommitted
firmware: xilinx: Add shutdown/wakeup APIs
Add shutdown/wakeup a resource eemi operations to shutdown or bringup a resource. Note alignment of args matches convention of other fn's in this file. The reason being that the long fn name results in aligned args that otherwise go over 80 chars so shift right to avoid this Signed-off-by: Ben Levinsky <[email protected]> Signed-off-by: Tanmay Shah <[email protected]> Acked-by: Michal Simek <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Mathieu Poirier <[email protected]>
1 parent b2bd0a8 commit da22a04

File tree

2 files changed

+58
-0
lines changed

2 files changed

+58
-0
lines changed

drivers/firmware/xilinx/zynqmp.c

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1159,6 +1159,41 @@ int zynqmp_pm_release_node(const u32 node)
11591159
}
11601160
EXPORT_SYMBOL_GPL(zynqmp_pm_release_node);
11611161

1162+
/**
1163+
* zynqmp_pm_force_pwrdwn - PM call to request for another PU or subsystem to
1164+
* be powered down forcefully
1165+
* @node: Node ID of the targeted PU or subsystem
1166+
* @ack: Flag to specify whether acknowledge is requested
1167+
*
1168+
* Return: status, either success or error+reason
1169+
*/
1170+
int zynqmp_pm_force_pwrdwn(const u32 node,
1171+
const enum zynqmp_pm_request_ack ack)
1172+
{
1173+
return zynqmp_pm_invoke_fn(PM_FORCE_POWERDOWN, node, ack, 0, 0, NULL);
1174+
}
1175+
EXPORT_SYMBOL_GPL(zynqmp_pm_force_pwrdwn);
1176+
1177+
/**
1178+
* zynqmp_pm_request_wake - PM call to wake up selected master or subsystem
1179+
* @node: Node ID of the master or subsystem
1180+
* @set_addr: Specifies whether the address argument is relevant
1181+
* @address: Address from which to resume when woken up
1182+
* @ack: Flag to specify whether acknowledge requested
1183+
*
1184+
* Return: status, either success or error+reason
1185+
*/
1186+
int zynqmp_pm_request_wake(const u32 node,
1187+
const bool set_addr,
1188+
const u64 address,
1189+
const enum zynqmp_pm_request_ack ack)
1190+
{
1191+
/* set_addr flag is encoded into 1st bit of address */
1192+
return zynqmp_pm_invoke_fn(PM_REQUEST_WAKEUP, node, address | set_addr,
1193+
address >> 32, ack, NULL);
1194+
}
1195+
EXPORT_SYMBOL_GPL(zynqmp_pm_request_wake);
1196+
11621197
/**
11631198
* zynqmp_pm_set_requirement() - PM call to set requirement for PM slaves
11641199
* @node: Node ID of the slave

include/linux/firmware/xlnx-zynqmp.h

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212

1313
#ifndef __FIRMWARE_ZYNQMP_H__
1414
#define __FIRMWARE_ZYNQMP_H__
15+
#include <linux/types.h>
1516

1617
#include <linux/err.h>
1718

@@ -87,6 +88,8 @@ enum pm_api_cb_id {
8788
enum pm_api_id {
8889
PM_GET_API_VERSION = 1,
8990
PM_REGISTER_NOTIFIER = 5,
91+
PM_FORCE_POWERDOWN = 8,
92+
PM_REQUEST_WAKEUP = 10,
9093
PM_SYSTEM_SHUTDOWN = 12,
9194
PM_REQUEST_NODE = 13,
9295
PM_RELEASE_NODE = 14,
@@ -521,6 +524,12 @@ int zynqmp_pm_is_function_supported(const u32 api_id, const u32 id);
521524
int zynqmp_pm_set_feature_config(enum pm_feature_config_id id, u32 value);
522525
int zynqmp_pm_get_feature_config(enum pm_feature_config_id id, u32 *payload);
523526
int zynqmp_pm_register_sgi(u32 sgi_num, u32 reset);
527+
int zynqmp_pm_force_pwrdwn(const u32 target,
528+
const enum zynqmp_pm_request_ack ack);
529+
int zynqmp_pm_request_wake(const u32 node,
530+
const bool set_addr,
531+
const u64 address,
532+
const enum zynqmp_pm_request_ack ack);
524533
int zynqmp_pm_set_sd_config(u32 node, enum pm_sd_config_type config, u32 value);
525534
int zynqmp_pm_set_gem_config(u32 node, enum pm_gem_config_type config,
526535
u32 value);
@@ -795,6 +804,20 @@ static inline int zynqmp_pm_register_sgi(u32 sgi_num, u32 reset)
795804
return -ENODEV;
796805
}
797806

807+
static inline int zynqmp_pm_force_pwrdwn(const u32 target,
808+
const enum zynqmp_pm_request_ack ack)
809+
{
810+
return -ENODEV;
811+
}
812+
813+
static inline int zynqmp_pm_request_wake(const u32 node,
814+
const bool set_addr,
815+
const u64 address,
816+
const enum zynqmp_pm_request_ack ack)
817+
{
818+
return -ENODEV;
819+
}
820+
798821
static inline int zynqmp_pm_set_sd_config(u32 node,
799822
enum pm_sd_config_type config,
800823
u32 value)

0 commit comments

Comments
 (0)