Commit ec9712ce authored by Rajan Vaja's avatar Rajan Vaja
Browse files

zynqmp: pm: Add API to get number of clocks



Currently in Linux maximum number of clocks is hard-coded and
so it needs to allocate static memory. It can get actual clock
number after querying all clock names by special clock name
string. Add new query data parameter to get actual number of
clocks so Linux can get actual clock numbers in advance.
Signed-off-by: default avatarRajan Vaja <rajan.vaja@xilinx.com>
parent 6d4f6aea
...@@ -2306,6 +2306,21 @@ static unsigned int pm_clock_type(unsigned int clock_id) ...@@ -2306,6 +2306,21 @@ static unsigned int pm_clock_type(unsigned int clock_id)
CLK_TYPE_OUTPUT : CLK_TYPE_EXTERNAL; CLK_TYPE_OUTPUT : CLK_TYPE_EXTERNAL;
} }
/**
* pm_api_clock_get_num_clocks() - PM call to request number of clocks
* @nclocks Number of clocks
*
* This function is used by master to get number of clocks.
*
* @return Returns success.
*/
enum pm_ret_status pm_api_clock_get_num_clocks(unsigned int *nclocks)
{
*nclocks = CLK_MAX;
return PM_RET_SUCCESS;
}
/** /**
* pm_api_clock_get_name() - PM call to request a clock's name * pm_api_clock_get_name() - PM call to request a clock's name
* @clock_id Clock ID * @clock_id Clock ID
......
...@@ -276,6 +276,7 @@ enum { ...@@ -276,6 +276,7 @@ enum {
enum pm_ret_status pm_api_clock_get_name(unsigned int clock_id, char *name); enum pm_ret_status pm_api_clock_get_name(unsigned int clock_id, char *name);
enum pm_ret_status pm_api_clock_get_num_clocks(unsigned int *nclocks);
enum pm_ret_status pm_api_clock_get_topology(unsigned int clock_id, enum pm_ret_status pm_api_clock_get_topology(unsigned int clock_id,
unsigned int index, unsigned int index,
uint32_t *topology); uint32_t *topology);
......
...@@ -712,6 +712,19 @@ enum pm_ret_status pm_ioctl(enum pm_node_id nid, ...@@ -712,6 +712,19 @@ enum pm_ret_status pm_ioctl(enum pm_node_id nid,
return pm_api_ioctl(nid, ioctl_id, arg1, arg2, value); return pm_api_ioctl(nid, ioctl_id, arg1, arg2, value);
} }
/**
* pm_clock_get_num_clocks - PM call to request number of clocks
* @nclockss: Number of clocks
*
* This function is used by master to get number of clocks.
*
* Return: Returns status, either success or error+reason.
*/
static enum pm_ret_status pm_clock_get_num_clocks(uint32_t *nclocks)
{
return pm_api_clock_get_num_clocks(nclocks);
}
/** /**
* pm_clock_get_name() - PM call to request a clock's name * pm_clock_get_name() - PM call to request a clock's name
* @clock_id Clock ID * @clock_id Clock ID
...@@ -1118,6 +1131,10 @@ enum pm_ret_status pm_query_data(enum pm_query_id qid, ...@@ -1118,6 +1131,10 @@ enum pm_ret_status pm_query_data(enum pm_query_id qid,
(uint16_t *)&data[1]); (uint16_t *)&data[1]);
data[0] = (unsigned int)ret; data[0] = (unsigned int)ret;
break; break;
case PM_QID_CLOCK_GET_NUM_CLOCKS:
ret = pm_clock_get_num_clocks(&data[1]);
data[0] = (unsigned int)ret;
break;
default: default:
ret = PM_RET_ERROR_ARGS; ret = PM_RET_ERROR_ARGS;
WARN("Unimplemented query service call: 0x%x\n", qid); WARN("Unimplemented query service call: 0x%x\n", qid);
......
...@@ -23,6 +23,7 @@ enum pm_query_id { ...@@ -23,6 +23,7 @@ enum pm_query_id {
PM_QID_PINCTRL_GET_FUNCTION_NAME, PM_QID_PINCTRL_GET_FUNCTION_NAME,
PM_QID_PINCTRL_GET_FUNCTION_GROUPS, PM_QID_PINCTRL_GET_FUNCTION_GROUPS,
PM_QID_PINCTRL_GET_PIN_GROUPS, PM_QID_PINCTRL_GET_PIN_GROUPS,
PM_QID_CLOCK_GET_NUM_CLOCKS,
}; };
/********************************************************** /**********************************************************
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment