Orange Pi5 kernel

Deprecated Linux kernel 5.10.110 for OrangePi 5/5B/5+ boards

3 Commits   0 Branches   0 Tags
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   1) // SPDX-License-Identifier: GPL-2.0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   2) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   3)  * Xilinx Zynq MPSoC Firmware layer for debugfs APIs
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   4)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   5)  *  Copyright (C) 2014-2018 Xilinx, Inc.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   6)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   7)  *  Michal Simek <michal.simek@xilinx.com>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   8)  *  Davorin Mista <davorin.mista@aggios.com>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   9)  *  Jolly Shah <jollys@xilinx.com>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  10)  *  Rajan Vaja <rajanv@xilinx.com>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  11)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  12) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  13) #include <linux/compiler.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  14) #include <linux/module.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  15) #include <linux/slab.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  16) #include <linux/debugfs.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  17) #include <linux/uaccess.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  18) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  19) #include <linux/firmware/xlnx-zynqmp.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  20) #include "zynqmp-debug.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  21) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  22) #define PM_API_NAME_LEN			50
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  23) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  24) struct pm_api_info {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  25) 	u32 api_id;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  26) 	char api_name[PM_API_NAME_LEN];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  27) 	char api_name_len;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  28) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  29) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  30) static char debugfs_buf[PAGE_SIZE];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  31) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  32) #define PM_API(id)		 {id, #id, strlen(#id)}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  33) static struct pm_api_info pm_api_list[] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  34) 	PM_API(PM_GET_API_VERSION),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  35) 	PM_API(PM_QUERY_DATA),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  36) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  37) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  38) static struct dentry *firmware_debugfs_root;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  39) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  40) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  41)  * zynqmp_pm_argument_value() - Extract argument value from a PM-API request
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  42)  * @arg:	Entered PM-API argument in string format
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  43)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  44)  * Return: Argument value in unsigned integer format on success
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  45)  *	   0 otherwise
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  46)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  47) static u64 zynqmp_pm_argument_value(char *arg)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  48) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  49) 	u64 value;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  50) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  51) 	if (!arg)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  52) 		return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  53) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  54) 	if (!kstrtou64(arg, 0, &value))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  55) 		return value;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  56) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  57) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  58) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  59) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  60) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  61)  * get_pm_api_id() - Extract API-ID from a PM-API request
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  62)  * @pm_api_req:		Entered PM-API argument in string format
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  63)  * @pm_id:		API-ID
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  64)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  65)  * Return: 0 on success else error code
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  66)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  67) static int get_pm_api_id(char *pm_api_req, u32 *pm_id)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  68) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  69) 	int i;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  70) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  71) 	for (i = 0; i < ARRAY_SIZE(pm_api_list) ; i++) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  72) 		if (!strncasecmp(pm_api_req, pm_api_list[i].api_name,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  73) 				 pm_api_list[i].api_name_len)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  74) 			*pm_id = pm_api_list[i].api_id;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  75) 			break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  76) 		}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  77) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  78) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  79) 	/* If no name was entered look for PM-API ID instead */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  80) 	if (i == ARRAY_SIZE(pm_api_list) && kstrtouint(pm_api_req, 10, pm_id))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  81) 		return -EINVAL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  82) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  83) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  84) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  85) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  86) static int process_api_request(u32 pm_id, u64 *pm_api_arg, u32 *pm_api_ret)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  87) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  88) 	u32 pm_api_version;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  89) 	int ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  90) 	struct zynqmp_pm_query_data qdata = {0};
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  91) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  92) 	switch (pm_id) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  93) 	case PM_GET_API_VERSION:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  94) 		ret = zynqmp_pm_get_api_version(&pm_api_version);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  95) 		sprintf(debugfs_buf, "PM-API Version = %d.%d\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  96) 			pm_api_version >> 16, pm_api_version & 0xffff);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  97) 		break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  98) 	case PM_QUERY_DATA:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  99) 		qdata.qid = pm_api_arg[0];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) 		qdata.arg1 = pm_api_arg[1];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) 		qdata.arg2 = pm_api_arg[2];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) 		qdata.arg3 = pm_api_arg[3];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) 		ret = zynqmp_pm_query_data(qdata, pm_api_ret);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) 		if (ret)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) 			break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) 		switch (qdata.qid) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) 		case PM_QID_CLOCK_GET_NAME:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) 			sprintf(debugfs_buf, "Clock name = %s\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) 				(char *)pm_api_ret);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) 			break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) 		case PM_QID_CLOCK_GET_FIXEDFACTOR_PARAMS:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) 			sprintf(debugfs_buf, "Multiplier = %d, Divider = %d\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) 				pm_api_ret[1], pm_api_ret[2]);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) 			break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) 		default:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) 			sprintf(debugfs_buf,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) 				"data[0] = 0x%08x\ndata[1] = 0x%08x\n data[2] = 0x%08x\ndata[3] = 0x%08x\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) 				pm_api_ret[0], pm_api_ret[1],
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) 				pm_api_ret[2], pm_api_ret[3]);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) 		}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) 		break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124) 	default:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) 		sprintf(debugfs_buf, "Unsupported PM-API request\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) 		ret = -EINVAL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) 	return ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133)  * zynqmp_pm_debugfs_api_write() - debugfs write function
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134)  * @file:	User file
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135)  * @ptr:	User entered PM-API string
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136)  * @len:	Length of the userspace buffer
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137)  * @off:	Offset within the file
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139)  * Used for triggering pm api functions by writing
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140)  * echo <pm_api_id>	> /sys/kernel/debug/zynqmp_pm/power or
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141)  * echo <pm_api_name>	> /sys/kernel/debug/zynqmp_pm/power
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143)  * Return: Number of bytes copied if PM-API request succeeds,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144)  *	   the corresponding error code otherwise
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146) static ssize_t zynqmp_pm_debugfs_api_write(struct file *file,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147) 					   const char __user *ptr, size_t len,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148) 					   loff_t *off)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150) 	char *kern_buff, *tmp_buff;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151) 	char *pm_api_req;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152) 	u32 pm_id = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153) 	u64 pm_api_arg[4] = {0, 0, 0, 0};
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154) 	/* Return values from PM APIs calls */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155) 	u32 pm_api_ret[4] = {0, 0, 0, 0};
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157) 	int ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158) 	int i = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160) 	strcpy(debugfs_buf, "");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162) 	if (*off != 0 || len <= 1 || len > PAGE_SIZE - 1)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163) 		return -EINVAL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165) 	kern_buff = memdup_user_nul(ptr, len);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166) 	if (IS_ERR(kern_buff))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167) 		return PTR_ERR(kern_buff);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168) 	tmp_buff = kern_buff;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 170) 	/* Read the API name from a user request */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 171) 	pm_api_req = strsep(&kern_buff, " ");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 172) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 173) 	ret = get_pm_api_id(pm_api_req, &pm_id);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 174) 	if (ret < 0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 175) 		goto err;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 176) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 177) 	/* Read node_id and arguments from the PM-API request */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 178) 	pm_api_req = strsep(&kern_buff, " ");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 179) 	while ((i < ARRAY_SIZE(pm_api_arg)) && pm_api_req) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 180) 		pm_api_arg[i++] = zynqmp_pm_argument_value(pm_api_req);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 181) 		pm_api_req = strsep(&kern_buff, " ");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 182) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 183) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 184) 	ret = process_api_request(pm_id, pm_api_arg, pm_api_ret);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 185) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 186) err:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 187) 	kfree(tmp_buff);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 188) 	if (ret)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 189) 		return ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 190) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 191) 	return len;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 192) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 193) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 194) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 195)  * zynqmp_pm_debugfs_api_read() - debugfs read function
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 196)  * @file:	User file
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 197)  * @ptr:	Requested pm_api_version string
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 198)  * @len:	Length of the userspace buffer
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 199)  * @off:	Offset within the file
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 200)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 201)  * Return: Length of the version string on success
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 202)  *	   else error code
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 203)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 204) static ssize_t zynqmp_pm_debugfs_api_read(struct file *file, char __user *ptr,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 205) 					  size_t len, loff_t *off)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 206) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 207) 	return simple_read_from_buffer(ptr, len, off, debugfs_buf,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 208) 				       strlen(debugfs_buf));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 209) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 210) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 211) /* Setup debugfs fops */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 212) static const struct file_operations fops_zynqmp_pm_dbgfs = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 213) 	.owner = THIS_MODULE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 214) 	.write = zynqmp_pm_debugfs_api_write,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 215) 	.read = zynqmp_pm_debugfs_api_read,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 216) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 217) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 218) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 219)  * zynqmp_pm_api_debugfs_init - Initialize debugfs interface
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 220)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 221)  * Return:	None
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 222)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 223) void zynqmp_pm_api_debugfs_init(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 224) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 225) 	/* Initialize debugfs interface */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 226) 	firmware_debugfs_root = debugfs_create_dir("zynqmp-firmware", NULL);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 227) 	debugfs_create_file("pm", 0660, firmware_debugfs_root, NULL,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 228) 			    &fops_zynqmp_pm_dbgfs);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 229) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 230) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 231) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 232)  * zynqmp_pm_api_debugfs_exit - Remove debugfs interface
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 233)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 234)  * Return:	None
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 235)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 236) void zynqmp_pm_api_debugfs_exit(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 237) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 238) 	debugfs_remove_recursive(firmware_debugfs_root);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 239) }