zynqmp: pm: Return the buffered PLL mode through IOCTL PLL get mode API

When linux calls pm_ioctl_get_pll_frac_mode() it doesn't expect the actual
mode to be read from hardware, but the value that it is intending to
program. Therefore, we return the buffered value to linux.

Signed-off-by: Mirela Simonovic <mirela.simonovic@aggios.com>
Acked-by: Will Wong <WILLW@xilinx.com>
Signed-off-by: Jolly Shah <jollys@xilinx.com>
This commit is contained in:
Jolly Shah 2019-01-02 12:49:21 -08:00
parent 8975f317e7
commit a5ae5a72fa
3 changed files with 15 additions and 30 deletions

View File

@ -3153,37 +3153,22 @@ enum pm_ret_status pm_clock_set_pll_mode(enum clock_id clock_id,
}
/**
* pm_ioctl_get_pll_mode() - Get PLL mode
* @pll PLL id
* @mode Mode fraction/integar
* pm_clock_get_pll_mode() - Get PLL mode
* @clock_id PLL clock id
* @mode Location to store the mode (fractional/integer)
*
* This function returns current PLL mode.
* This function returns buffered PLL mode.
*
* @return Returns status, either success or error+reason
* @return Success if mode is stored or error if an argument is invalid
*/
enum pm_ret_status pm_api_clk_get_pll_mode(unsigned int pll,
unsigned int *mode)
enum pm_ret_status pm_clock_get_pll_mode(enum clock_id clock_id,
unsigned int *mode)
{
enum pm_ret_status ret = PM_RET_SUCCESS;
unsigned int val, reg;
struct pm_pll *pll = pm_clock_get_pll(clock_id);
if (!pm_clock_valid(pll))
if (!pll || !mode)
return PM_RET_ERROR_ARGS;
*mode = pll->mode;
if (pm_clock_type(pll) != CLK_TYPE_OUTPUT)
return PM_RET_ERROR_NOTSUPPORTED;
if (!ISPLL(pll))
return PM_RET_ERROR_NOTSUPPORTED;
reg = clocks[pll].control_reg + PLL_FRAC_OFFSET;
ret = pm_mmio_read(reg, &val);
val = val & PLL_FRAC_MODE_MASK;
if (val == 0)
*mode = PLL_INT_MODE;
else
*mode = PLL_FRAC_MODE;
return ret;
return PM_RET_SUCCESS;
}

View File

@ -310,7 +310,7 @@ enum pm_ret_status pm_api_clock_getparent(unsigned int clock_id,
unsigned int *parent_idx);
enum pm_ret_status pm_clock_set_pll_mode(enum clock_id clock_id,
unsigned int mode);
enum pm_ret_status pm_api_clk_get_pll_mode(unsigned int pll,
unsigned int *mode);
enum pm_ret_status pm_clock_get_pll_mode(enum clock_id clock_id,
unsigned int *mode);
#endif /* PM_API_CLOCK_H */

View File

@ -348,7 +348,7 @@ static enum pm_ret_status pm_ioctl_set_pll_frac_mode
/**
* pm_ioctl_get_pll_frac_mode() - Ioctl function for
* getting pll mode
* @pll PLL id
* @pll PLL clock id
* @mode Mode fraction/integar
*
* This function return current PLL mode
@ -358,7 +358,7 @@ static enum pm_ret_status pm_ioctl_set_pll_frac_mode
static enum pm_ret_status pm_ioctl_get_pll_frac_mode
(unsigned int pll, unsigned int *mode)
{
return pm_api_clk_get_pll_mode(pll, mode);
return pm_clock_get_pll_mode(pll, mode);
}
/**