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: Rajan Vaja <rajan.vaja@xilinx.com>
This commit is contained in:
parent
6d4f6aea2c
commit
ec9712cee1
|
@ -2306,6 +2306,21 @@ static unsigned int pm_clock_type(unsigned int clock_id)
|
|||
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
|
||||
* @clock_id Clock ID
|
||||
|
|
|
@ -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_num_clocks(unsigned int *nclocks);
|
||||
enum pm_ret_status pm_api_clock_get_topology(unsigned int clock_id,
|
||||
unsigned int index,
|
||||
uint32_t *topology);
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
/**
|
||||
* 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
|
||||
* @clock_id Clock ID
|
||||
|
@ -1118,6 +1131,10 @@ enum pm_ret_status pm_query_data(enum pm_query_id qid,
|
|||
(uint16_t *)&data[1]);
|
||||
data[0] = (unsigned int)ret;
|
||||
break;
|
||||
case PM_QID_CLOCK_GET_NUM_CLOCKS:
|
||||
ret = pm_clock_get_num_clocks(&data[1]);
|
||||
data[0] = (unsigned int)ret;
|
||||
break;
|
||||
default:
|
||||
ret = PM_RET_ERROR_ARGS;
|
||||
WARN("Unimplemented query service call: 0x%x\n", qid);
|
||||
|
|
|
@ -23,6 +23,7 @@ enum pm_query_id {
|
|||
PM_QID_PINCTRL_GET_FUNCTION_NAME,
|
||||
PM_QID_PINCTRL_GET_FUNCTION_GROUPS,
|
||||
PM_QID_PINCTRL_GET_PIN_GROUPS,
|
||||
PM_QID_CLOCK_GET_NUM_CLOCKS,
|
||||
};
|
||||
|
||||
/**********************************************************
|
||||
|
|
Loading…
Reference in New Issue