CCS PLL fixes and improvements
Subsystems (2)
Sakari Ailus
maintainerv3 cover CCS PLL fixes and improvements
Hi all,
Here are a few fixes and improvements to the CCS PLL calculator.
v2 is <[email protected]>.
v1 is <[email protected]>.
since v2:
- Reword commit messages based on review comments.
- Move the even PLL multiplier flag next to other non-CCS PLL flags.
- Small code readability improvements.
since v1:
- Added patches for the following:
- Drop the now-unused LINK_DECOUPLED flag.
- Print missing flags.
- Print PLL calculator flags before running the calculator (earlier version posted separately already).
- Document the CCS PLL flags tersely but still in a way that is useful.
- Rebased other patches to clean up things first.
Sakari Ailus (11):
media: ccs-pll: Start OP pre-PLL multiplier search from correct value
media: ccs-pll: Start VT pre-PLL multiplier search from correct value
media: ccs-pll: Check for too high VT PLL multiplier in dual PLL case
media: ccs-pll: Correct the upper limit of maximum op_pre_pll_clk_div
media: ccs-pll: Print a debug message on too high VT PLL OP clock
media: ccs-pll: Drop LINK_DECOUPLED flag
media: ccs-pll: Print missing PLL flags
media: ccs-pll: Add a flag for even PLL multipliers
media: ccs-pll: Better validate VT PLL branch
media: ccs-pll: Print PLL calculator flags in the beginning
media: ccs-pll: Document the CCS PLL flags
drivers/media/i2c/ccs-pll.c | 49 +++++++++++++++++++++++++------ drivers/media/i2c/ccs-pll.h | 29 +++++++++++++++--- drivers/media/i2c/ccs/ccs-core.c | 1 - drivers/media/i2c/ccs/ccs-quirk.c | 3 +- 4 files changed, 66 insertions(+), 16 deletions(-)
Signature · 1 line
2.39.5
Sakari Ailus
maintainerPATCH v3 1/11 media: ccs-pll: Start OP pre-PLL multiplier search from correct value
The ccs_pll_calculate() function does a search over possible PLL configurations to find the "best" one. If the sensor does not support odd pre-PLL divisors and the minimum value (with constraints) isn't 1, other odd values could be errorneously searched (and selected) for the pre-PLL divisor. Fix this.
--- drivers/media/i2c/ccs-pll.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/media/i2c/ccs-pll.c +2 -0
@@ -815,6 +815,8 @@ int ccs_pll_calculate(struct device *dev, const struct ccs_pll_limits *lim,one_or_more (DIV_ROUND_UP (op_lim_fr->max_pll_op_clk_freq_hz, pll->ext_clk_freq_hz)))); +if (!(pll->flags &CCS_PLL_FLAG_EXT_IP_PLL_DIVIDER )) + min_op_pre_pll_clk_div =clk_div_even (min_op_pre_pll_clk_div);dev_dbg (dev,"pll_op check: min / max op_pre_pll_clk_div: %u / %u\n" , min_op_pre_pll_clk_div, max_op_pre_pll_clk_div);
Signature · 1 line
2.39.5
Sakari Ailus
maintainerPATCH v3 2/11 media: ccs-pll: Start VT pre-PLL multiplier search from correct value
In reply to Sakari AilusThe ccs_pll_calculate_vt_tree() function does a search over possible VT PLL configurations to find the "best" one. If the sensor does not support odd pre-PLL divisors and the minimum value (with constraints) isn't 1, other odd values could be errorneously searched (and selected) for the pre-PLL divisor. Fix this.
--- drivers/media/i2c/ccs-pll.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/media/i2c/ccs-pll.c +2 -0
@@ -397,6 +397,8 @@ static int ccs_pll_calculate_vt_tree(struct device *dev, min_pre_pll_clk_div =max_t (u16, min_pre_pll_clk_div, pll->ext_clk_freq_hz / lim_fr->max_pll_ip_clk_freq_hz); +if (!(pll->flags &CCS_PLL_FLAG_EXT_IP_PLL_DIVIDER )) + min_pre_pll_clk_div =clk_div_even (min_pre_pll_clk_div);dev_dbg (dev,"vt min/max_pre_pll_clk_div: %u,%u\n" , min_pre_pll_clk_div, max_pre_pll_clk_div);
Signature · 1 line
2.39.5
Sakari Ailus
maintainerPATCH v3 3/11 media: ccs-pll: Check for too high VT PLL multiplier in dual PLL case
In reply to Sakari AilusThe check for VT PLL upper limit in dual PLL case was missing. Add it now.
--- drivers/media/i2c/ccs-pll.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/media/i2c/ccs-pll.c +5 -0
@@ -312,6 +312,11 @@ __ccs_pll_calculate_vt_tree(struct device *dev,dev_dbg (dev,"more_mul2: %u\n" , more_mul); pll_fr->pll_multiplier = mul * more_mul; +if (pll_fr->pll_multiplier > lim_fr->max_pll_multiplier) { +dev_dbg (dev,"pll multiplier %u too high\n" , + pll_fr->pll_multiplier); +return -EINVAL ; + }if (pll_fr->pll_multiplier * pll_fr->pll_ip_clk_freq_hz > lim_fr->max_pll_op_clk_freq_hz)
Signature · 1 line
2.39.5
Sakari Ailus
maintainerPATCH v3 4/11 media: ccs-pll: Correct the upper limit of maximum op_pre_pll_clk_div
In reply to Sakari AilusThe PLL calculator does a search of the PLL configuration space for all valid OP pre-PLL clock dividers. The maximum did not take into account the CCS PLL flag CCS_PLL_FLAG_EXT_IP_PLL_DIVIDER in which case also odd PLL dividers (other than 1) are valid. Do that now.
--- drivers/media/i2c/ccs-pll.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/i2c/ccs-pll.c +1 -1
@@ -799,7 +799,7 @@ int ccs_pll_calculate(struct device *dev, const struct ccs_pll_limits *lim, op_lim_fr->min_pre_pll_clk_div, op_lim_fr->max_pre_pll_clk_div); max_op_pre_pll_clk_div =min_t (u16, op_lim_fr->max_pre_pll_clk_div, -clk_div_even (pll->ext_clk_freq_hz / +DIV_ROUND_UP (pll->ext_clk_freq_hz, op_lim_fr->min_pll_ip_clk_freq_hz)); min_op_pre_pll_clk_div = max_t(u16, op_lim_fr->min_pre_pll_clk_div,
Signature · 1 line
2.39.5
Sakari Ailus
maintainerPATCH v3 5/11 media: ccs-pll: Print a debug message on too high VT PLL OP clock
In reply to Sakari AilusIn general the CCS PLL calculator prints debugging information on the process to ease debugging. This case was not annotated, do that now.
Remove an extra multiplication while at it.
--- drivers/media/i2c/ccs-pll.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)
drivers/media/i2c/ccs-pll.c +5 -4
@@ -318,12 +318,13 @@ __ccs_pll_calculate_vt_tree(struct device *dev,return -EINVAL ; } -if (pll_fr->pll_multiplier * pll_fr->pll_ip_clk_freq_hz > - lim_fr->max_pll_op_clk_freq_hz) -return -EINVAL ; - pll_fr->pll_op_clk_freq_hz = pll_fr->pll_ip_clk_freq_hz * pll_fr->pll_multiplier; +if (pll_fr->pll_op_clk_freq_hz > lim_fr->max_pll_op_clk_freq_hz) { +dev_dbg (dev,"too high OP clock %u\n" , + pll_fr->pll_op_clk_freq_hz); +return -EINVAL ; + } vt_div = div * more_mul;
Signature · 1 line
2.39.5
Sakari Ailus
maintainerPATCH v3 6/11 media: ccs-pll: Drop LINK_DECOUPLED flag
In reply to Sakari AilusThe LINK_DECOUPLED flag isn't used by the PLL calculator other than printing it. The number of OP/VT lanes are already printed in any case. Thus drop the flag as it has no function.
--- drivers/media/i2c/ccs-pll.c | 3 +-- drivers/media/i2c/ccs-pll.h | 1 - drivers/media/i2c/ccs/ccs-core.c | 1 - drivers/media/i2c/ccs/ccs-quirk.c | 3 +-- 4 files changed, 2 insertions(+), 6 deletions(-)
drivers/media/i2c/ccs-pll.c +1 -2
@@ -124,9 +124,8 @@ static void print_pll(struct device *dev, const struct ccs_pll *pll)dev_dbg (dev,"pixel rate on CSI-2 bus:\t%u\n" , pll->pixel_rate_csi); - dev_dbg(dev, "flags%s%s%s%s%s%s%s%s%s\n", + dev_dbg(dev, "flags%s%s%s%s%s%s%s%s\n", pll->flags & PLL_FL(LANE_SPEED_MODEL) ? " lane-speed" : "", - pll->flags & PLL_FL(LINK_DECOUPLED) ? " link-decoupled" : "", pll->flags & PLL_FL(EXT_IP_PLL_DIVIDER) ? " ext-ip-pll-divider" : "", pll->flags & PLL_FL(FLEXIBLE_OP_PIX_CLK_DIV) ?
drivers/media/i2c/ccs-pll.h +0 -1
@@ -24,7 +24,6 @@#define CCS_PLL_FLAG_NO_OP_CLOCKS BIT(1)/* CCS PLL flags */ #define CCS_PLL_FLAG_LANE_SPEED_MODEL BIT(2) -#define CCS_PLL_FLAG_LINK_DECOUPLED BIT(3)#define CCS_PLL_FLAG_EXT_IP_PLL_DIVIDER BIT(4)#define CCS_PLL_FLAG_FLEXIBLE_OP_PIX_CLK_DIV BIT(5)#define CCS_PLL_FLAG_FIFO_DERATING BIT(6)
drivers/media/i2c/ccs/ccs-core.c +0 -1
@@ -3451,7 +3451,6 @@ static int ccs_probe(struct i2c_client *client)CCS_LIM (sensor,NUM_OF_VT_LANES ) +1 ; sensor->pll.op_lanes =CCS_LIM (sensor,NUM_OF_OP_LANES ) +1 ; - sensor->pll.flags |=CCS_PLL_FLAG_LINK_DECOUPLED ; }else { sensor->pll.vt_lanes = sensor->pll.csi2.lanes; sensor->pll.op_lanes = sensor->pll.csi2.lanes;
drivers/media/i2c/ccs/ccs-quirk.c +1 -2
@@ -190,8 +190,7 @@ static int jt8ev1_post_streamoff(struct ccs_sensor *sensor)static int jt8ev1_init (struct ccs_sensor *sensor) { - sensor->pll.flags |=CCS_PLL_FLAG_LANE_SPEED_MODEL | -CCS_PLL_FLAG_LINK_DECOUPLED ; + sensor->pll.flags |=CCS_PLL_FLAG_LANE_SPEED_MODEL ; sensor->pll.vt_lanes =1 ; sensor->pll.op_lanes = sensor->pll.csi2.lanes;
Signature · 1 line
2.39.5
Sakari Ailus
maintainerPATCH v3 7/11 media: ccs-pll: Print missing PLL flags
In reply to Sakari AilusPrinting the OP_PIX_CLOCK_PER_LANE and NO_OP_CLOCKS CCS PLL flags is missing, add them now.
--- drivers/media/i2c/ccs-pll.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/media/i2c/ccs-pll.c +3 -1
@@ -124,7 +124,9 @@ static void print_pll(struct device *dev, const struct ccs_pll *pll)dev_dbg (dev,"pixel rate on CSI-2 bus:\t%u\n" , pll->pixel_rate_csi); - dev_dbg(dev, "flags%s%s%s%s%s%s%s%s\n", + dev_dbg(dev, "flags%s%s%s%s%s%s%s%s%s%s\n", + pll->flags & PLL_FL(OP_PIX_CLOCK_PER_LANE) ? " op-pix-clock-per-lane" : "", + pll->flags & PLL_FL(NO_OP_CLOCKS) ? " no-op-clocks" : "", pll->flags & PLL_FL(LANE_SPEED_MODEL) ? " lane-speed" : "", pll->flags & PLL_FL(EXT_IP_PLL_DIVIDER) ? " ext-ip-pll-divider" : "",
Signature · 1 line
2.39.5
Sakari Ailus
maintainerPATCH v3 8/11 media: ccs-pll: Add a flag for even PLL multipliers
In reply to Sakari AilusSome devices (not entirely CCS compliant) only support even PLL multipliers. Add support for this through a PLL flag.
--- drivers/media/i2c/ccs-pll.c | 11 ++++++++++- drivers/media/i2c/ccs-pll.h | 1 + 2 files changed, 11 insertions(+), 1 deletion(-)
drivers/media/i2c/ccs-pll.c +10 -1
@@ -124,9 +124,10 @@ static void print_pll(struct device *dev, const struct ccs_pll *pll)dev_dbg (dev,"pixel rate on CSI-2 bus:\t%u\n" , pll->pixel_rate_csi); - dev_dbg(dev, "flags%s%s%s%s%s%s%s%s%s%s\n", + dev_dbg(dev, "flags%s%s%s%s%s%s%s%s%s%s%s\n", pll->flags & PLL_FL(OP_PIX_CLOCK_PER_LANE) ? " op-pix-clock-per-lane" : "", pll->flags & PLL_FL(NO_OP_CLOCKS) ? " no-op-clocks" : "", + pll->flags & PLL_FL(EVEN_PLL_MULTIPLIER) ? " even-pll-multiplier" : "", pll->flags & PLL_FL(LANE_SPEED_MODEL) ? " lane-speed" : "", pll->flags & PLL_FL(EXT_IP_PLL_DIVIDER) ? " ext-ip-pll-divider" : "",
@@ -312,6 +313,10 @@ __ccs_pll_calculate_vt_tree(struct device *dev, more_mul *=DIV_ROUND_UP (lim_fr->min_pll_multiplier, mul * more_mul);dev_dbg (dev,"more_mul2: %u\n" , more_mul); +if (pll->flags &CCS_PLL_FLAG_EVEN_PLL_MULTIPLIER && + (mul &1 ) && (more_mul &1 )) + more_mul <<=1 ; + pll_fr->pll_multiplier = mul * more_mul;if (pll_fr->pll_multiplier > lim_fr->max_pll_multiplier) { dev_dbg(dev, "pll multiplier %u too high\n",
@@ -668,6 +673,10 @@ ccs_pll_calculate_op(struct device *dev, const struct ccs_pll_limits *lim,if (!is_one_or_even (i)) i <<=1 ; +if (pll->flags &CCS_PLL_FLAG_EVEN_PLL_MULTIPLIER && + mul &1 && i &1 ) + i <<=1 ; +dev_dbg (dev,"final more_mul: %u\n" , i);if (i > more_mul_max) {dev_dbg (dev,"final more_mul is bad, max %u\n" , more_mul_max);
drivers/media/i2c/ccs-pll.h +1 -0
@@ -22,6 +22,7 @@/* op pix clock is for all lanes in total normally */ #define CCS_PLL_FLAG_OP_PIX_CLOCK_PER_LANE BIT(0)#define CCS_PLL_FLAG_NO_OP_CLOCKS BIT(1) +#define CCS_PLL_FLAG_EVEN_PLL_MULTIPLIER BIT(3)/* CCS PLL flags */ #define CCS_PLL_FLAG_LANE_SPEED_MODEL BIT(2)#define CCS_PLL_FLAG_EXT_IP_PLL_DIVIDER BIT(4)
Signature · 1 line
2.39.5
Re: [PATCH v3 08/11] media: ccs-pll: Add a flag for even PLL multipliers
Hi Sakari,
Thank you for the patch.
Quoted 52 lines · Sakari Ailus
Some devices (not entirely CCS compliant) only support even PLL multipliers. Add support for this through a PLL flag.
Signed-off-by Sakari Ailus <[email protected]>--- drivers/media/i2c/ccs-pll.c | 11 ++++++++++- drivers/media/i2c/ccs-pll.h | 1 + 2 files changed, 11 insertions(+), 1 deletion(-)drivers/media/i2c/ccs-pll.c +10
-1@@ -124,9 +124,10 @@ static void print_pll(struct device *dev, const struct ccs_pll *pll)dev_dbg (dev,"pixel rate on CSI-2 bus:\t%u\n" , pll->pixel_rate_csi); - dev_dbg(dev, "flags%s%s%s%s%s%s%s%s%s%s\n", + dev_dbg(dev, "flags%s%s%s%s%s%s%s%s%s%s%s\n", pll->flags & PLL_FL(OP_PIX_CLOCK_PER_LANE) ? " op-pix-clock-per-lane" : "", pll->flags & PLL_FL(NO_OP_CLOCKS) ? " no-op-clocks" : "", + pll->flags & PLL_FL(EVEN_PLL_MULTIPLIER) ? " even-pll-multiplier" : "", pll->flags & PLL_FL(LANE_SPEED_MODEL) ? " lane-speed" : "", pll->flags & PLL_FL(EXT_IP_PLL_DIVIDER) ? " ext-ip-pll-divider" : "",@@ -312,6 +313,10 @@ __ccs_pll_calculate_vt_tree(struct device *dev, more_mul *=DIV_ROUND_UP (lim_fr->min_pll_multiplier, mul * more_mul);dev_dbg (dev,"more_mul2: %u\n" , more_mul); +if (pll->flags &CCS_PLL_FLAG_EVEN_PLL_MULTIPLIER && + (mul &1 ) && (more_mul &1 )) + more_mul <<=1 ; + pll_fr->pll_multiplier = mul * more_mul;if (pll_fr->pll_multiplier > lim_fr->max_pll_multiplier) { dev_dbg(dev, "pll multiplier %u too high\n",@@ -668,6 +673,10 @@ ccs_pll_calculate_op(struct device *dev, const struct ccs_pll_limits *lim,if (!is_one_or_even (i)) i <<=1 ; +if (pll->flags &CCS_PLL_FLAG_EVEN_PLL_MULTIPLIER && + mul &1 && i &1 ) + i <<=1 ; +dev_dbg (dev,"final more_mul: %u\n" , i);if (i > more_mul_max) {dev_dbg (dev,"final more_mul is bad, max %u\n" , more_mul_max);drivers/media/i2c/ccs-pll.h +0
-0
drivers/media/i2c/ccs-pll.h line 27
Quoted 6 lines
drivers/media/i2c/ccs-pll.h +1
-0@@ -22,6 +22,7 @@/* op pix clock is for all lanes in total normally */ #define CCS_PLL_FLAG_OP_PIX_CLOCK_PER_LANE BIT(0)#define CCS_PLL_FLAG_NO_OP_CLOCKS BIT(1) +#define CCS_PLL_FLAG_EVEN_PLL_MULTIPLIER BIT(3)/* CCS PLL flags */ #define CCS_PLL_FLAG_LANE_SPEED_MODEL BIT(2)
I would probably have reordered the bits, but I don't mind much.
Quoted 1 line
drivers/media/i2c/ccs-pll.h +0
-0#define CCS_PLL_FLAG_EXT_IP_PLL_DIVIDER BIT(4)
Signature · 3 lines
Regards, Laurent Pinchart
Sakari Ailus
maintainerPATCH v3 9/11 media: ccs-pll: Better validate VT PLL branch
In reply to Sakari AilusCheck that the VT PLL dividers are actually found, don't trust they always are even though they should be.
--- drivers/media/i2c/ccs-pll.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-)
drivers/media/i2c/ccs-pll.c +9 -3
@@ -449,7 +449,7 @@ static int ccs_pll_calculate_vt_tree(struct device *dev,return -EINVAL ; } -static void +static int ccs_pll_calculate_vt(struct device *dev, const struct ccs_pll_limits *lim, const struct ccs_pll_branch_limits_bk *op_lim_bk, struct ccs_pll *pll, struct ccs_pll_branch_fr *pll_fr,
@@ -572,6 +572,8 @@ ccs_pll_calculate_vt(struct device *dev, const struct ccs_pll_limits *lim,if (best_pix_div <SHRT_MAX >>1 )break ; } +if (best_pix_div ==SHRT_MAX >>1 ) +return -EINVAL ; pll->vt_bk.sys_clk_div =DIV_ROUND_UP (vt_div, best_pix_div); pll->vt_bk.pix_clk_div = best_pix_div;
@@ -584,6 +586,8 @@ ccs_pll_calculate_vt(struct device *dev, const struct ccs_pll_limits *lim, out_calc_pixel_rate: pll->pixel_rate_pixel_array = pll->vt_bk.pix_clk_freq_hz * pll->vt_lanes; + +return 0 ; }/*
@@ -863,8 +867,10 @@ int ccs_pll_calculate(struct device *dev, const struct ccs_pll_limits *lim,if (pll->flags &CCS_PLL_FLAG_DUAL_PLL )break ; -ccs_pll_calculate_vt (dev, lim, op_lim_bk, pll, op_pll_fr, - op_pll_bk, cphy, phy_const); + rval =ccs_pll_calculate_vt (dev, lim, op_lim_bk, pll, op_pll_fr, + op_pll_bk, cphy, phy_const); +if (rval) +continue ; rval =check_bk_bounds (dev, lim, pll,PLL_VT );if (rval)
Signature · 1 line
2.39.5
Sakari Ailus
maintainerPATCH v3 10/11 media: ccs-pll: Print PLL calculator flags in the beginning
In reply to Sakari AilusPrint the PLL calculator flags right away when the PLL calculator is called. Previously this was done only in a successful case and that didn't really help solving a problem when one happened.
--- drivers/media/i2c/ccs-pll.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/media/i2c/ccs-pll.c +6 -1
@@ -123,8 +123,11 @@ static void print_pll(struct device *dev, const struct ccs_pll *pll) pll->pixel_rate_pixel_array);dev_dbg (dev,"pixel rate on CSI-2 bus:\t%u\n" , pll->pixel_rate_csi); +} - dev_dbg(dev, "flags%s%s%s%s%s%s%s%s%s%s%s\n", +static void print_pll_flags (struct device *dev,struct ccs_pll *pll) +{ + dev_dbg(dev, "PLL flags%s%s%s%s%s%s%s%s%s%s%s\n", pll->flags & PLL_FL(OP_PIX_CLOCK_PER_LANE) ? " op-pix-clock-per-lane" : "", pll->flags & PLL_FL(NO_OP_CLOCKS) ? " no-op-clocks" : "", pll->flags & PLL_FL(EVEN_PLL_MULTIPLIER) ? " even-pll-multiplier" : "",
@@ -738,6 +741,8 @@ int ccs_pll_calculate(struct device *dev, const struct ccs_pll_limits *lim,u32 i;int rval = -EINVAL ; +print_pll_flags (dev, pll); +if (!(pll->flags &CCS_PLL_FLAG_LANE_SPEED_MODEL )) { pll->op_lanes =1 ; pll->vt_lanes =1 ;
Signature · 1 line
2.39.5
Sakari Ailus
maintainerPATCH v3 11/11 media: ccs-pll: Document the CCS PLL flags
In reply to Sakari AilusDocument the CCS PLL flags with short comments. The CCS spec has more information on them while the added documentation helps finding the relevant information in the CCS spec.
--- drivers/media/i2c/ccs-pll.c | 2 +- drivers/media/i2c/ccs-pll.h | 27 ++++++++++++++++++++++++--- 2 files changed, 25 insertions(+), 4 deletions(-)
drivers/media/i2c/ccs-pll.c +1 -1
@@ -129,8 +129,8 @@ static void print_pll_flags(struct device *dev, struct ccs_pll *pll) { dev_dbg(dev, "PLL flags%s%s%s%s%s%s%s%s%s%s%s\n", pll->flags & PLL_FL(OP_PIX_CLOCK_PER_LANE) ? " op-pix-clock-per-lane" : "", - pll->flags & PLL_FL(NO_OP_CLOCKS) ? " no-op-clocks" : "", pll->flags & PLL_FL(EVEN_PLL_MULTIPLIER) ? " even-pll-multiplier" : "", + pll->flags & PLL_FL(NO_OP_CLOCKS) ? " no-op-clocks" : "", pll->flags & PLL_FL(LANE_SPEED_MODEL) ? " lane-speed" : "", pll->flags & PLL_FL(EXT_IP_PLL_DIVIDER) ? " ext-ip-pll-divider" : "",
drivers/media/i2c/ccs-pll.h +24 -3
@@ -18,19 +18,40 @@#define CCS_PLL_BUS_TYPE_CSI2_DPHY 0x00#define CCS_PLL_BUS_TYPE_CSI2_CPHY 0x01 -/* Old SMIA and implementation specific flags */ -/* op pix clock is for all lanes in total normally */ +/* Old SMIA and implementation specific flags. */ +/* OP PIX clock is for all lanes in total normally. */ #define CCS_PLL_FLAG_OP_PIX_CLOCK_PER_LANE BIT(0) -#define CCS_PLL_FLAG_NO_OP_CLOCKS BIT(1) +/* If set, the PLL multipliers are required to be even. */ #define CCS_PLL_FLAG_EVEN_PLL_MULTIPLIER BIT(3) +/* CCS PLL flags */ + +/* The sensor doesn't have OP clocks at all. */ +#define CCS_PLL_FLAG_NO_OP_CLOCKS BIT(1) +/* System speed model if this flag is unset. */ #define CCS_PLL_FLAG_LANE_SPEED_MODEL BIT(2) +/* If set, the pre-PLL divider may have odd values, too. */ #define CCS_PLL_FLAG_EXT_IP_PLL_DIVIDER BIT(4) +/* +* If set, the OP PIX clock doesn't have to exactly match with data rate, it may +* be higher. See "OP Domain Formulas" in MIPI CCS 1.1 spec. +*/ #define CCS_PLL_FLAG_FLEXIBLE_OP_PIX_CLK_DIV BIT(5) +/* If set, the VT domain may run faster than the OP domain. */ #define CCS_PLL_FLAG_FIFO_DERATING BIT(6) +/* If set, the VT domain may run slower than the OP domain. */ #define CCS_PLL_FLAG_FIFO_OVERRATING BIT(7) +/* If set, the PLL tree has two PLLs instead of one. */ #define CCS_PLL_FLAG_DUAL_PLL BIT(8) +/* +* If set, the OP SYS clock is a dual data rate clock, transferring two bits per +* cycle instead of one. +*/ #define CCS_PLL_FLAG_OP_SYS_DDR BIT(9) +/* +* If set, the OP PIX clock is a dual data rate clock, transferring two bits per +* cycle instead of one. +*/ #define CCS_PLL_FLAG_OP_PIX_DDR BIT(10)/**
Signature · 1 line
2.39.5
Re: [PATCH v3 11/11] media: ccs-pll: Document the CCS PLL flags
Hi Sakari,
Thank you for the patch.
Quoted 57 lines · Sakari Ailus
Document the CCS PLL flags with short comments. The CCS spec has more information on them while the added documentation helps finding the relevant information in the CCS spec.
Signed-off-by Sakari Ailus <[email protected]>--- drivers/media/i2c/ccs-pll.c | 2 +- drivers/media/i2c/ccs-pll.h | 27 ++++++++++++++++++++++++--- 2 files changed, 25 insertions(+), 4 deletions(-)drivers/media/i2c/ccs-pll.c +1
-1@@ -129,8 +129,8 @@ static void print_pll_flags(struct device *dev, struct ccs_pll *pll) { dev_dbg(dev, "PLL flags%s%s%s%s%s%s%s%s%s%s%s\n", pll->flags & PLL_FL(OP_PIX_CLOCK_PER_LANE) ? " op-pix-clock-per-lane" : "", - pll->flags & PLL_FL(NO_OP_CLOCKS) ? " no-op-clocks" : "", pll->flags & PLL_FL(EVEN_PLL_MULTIPLIER) ? " even-pll-multiplier" : "", + pll->flags & PLL_FL(NO_OP_CLOCKS) ? " no-op-clocks" : "", pll->flags & PLL_FL(LANE_SPEED_MODEL) ? " lane-speed" : "", pll->flags & PLL_FL(EXT_IP_PLL_DIVIDER) ? " ext-ip-pll-divider" : "",drivers/media/i2c/ccs-pll.h +15
-3@@ -18,19 +18,40 @@#define CCS_PLL_BUS_TYPE_CSI2_DPHY 0x00#define CCS_PLL_BUS_TYPE_CSI2_CPHY 0x01 -/* Old SMIA and implementation specific flags */ -/* op pix clock is for all lanes in total normally */ +/* Old SMIA and implementation specific flags. */ +/* OP PIX clock is for all lanes in total normally. */ #define CCS_PLL_FLAG_OP_PIX_CLOCK_PER_LANE BIT(0) -#define CCS_PLL_FLAG_NO_OP_CLOCKS BIT(1) +/* If set, the PLL multipliers are required to be even. */ #define CCS_PLL_FLAG_EVEN_PLL_MULTIPLIER BIT(3) +/* CCS PLL flags */ + +/* The sensor doesn't have OP clocks at all. */ +#define CCS_PLL_FLAG_NO_OP_CLOCKS BIT(1) +/* System speed model if this flag is unset. */ #define CCS_PLL_FLAG_LANE_SPEED_MODEL BIT(2) +/* If set, the pre-PLL divider may have odd values, too. */ #define CCS_PLL_FLAG_EXT_IP_PLL_DIVIDER BIT(4) +/* +* If set, the OP PIX clock doesn't have to exactly match with data rate, it may +* be higher. See "OP Domain Formulas" in MIPI CCS 1.1 spec. +*/ #define CCS_PLL_FLAG_FLEXIBLE_OP_PIX_CLK_DIV BIT(5) +/* If set, the VT domain may run faster than the OP domain. */ #define CCS_PLL_FLAG_FIFO_DERATING BIT(6) +/* If set, the VT domain may run slower than the OP domain. */
drivers/media/i2c/ccs-pll.h line 52
Quoted 10 lines
drivers/media/i2c/ccs-pll.h +7
-0#define CCS_PLL_FLAG_FIFO_OVERRATING BIT(7) +/* If set, the PLL tree has two PLLs instead of one. */ #define CCS_PLL_FLAG_DUAL_PLL BIT(8) +/* +* If set, the OP SYS clock is a dual data rate clock, transferring two bits per +* cycle instead of one. +*/ #define CCS_PLL_FLAG_OP_SYS_DDR BIT(9) +/* +* If set, the OP PIX clock is a dual data rate clock, transferring two bits per
Same comment as for v2.
Quoted 5 lines
drivers/media/i2c/ccs-pll.h +2
-0+* cycle instead of one. +*/ #define CCS_PLL_FLAG_OP_PIX_DDR BIT(10)/**
Signature · 3 lines
Regards, Laurent Pinchart
Sakari Ailus
maintainerRe: [PATCH v3 11/11] media: ccs-pll: Document the CCS PLL flags
Quoted 66 lines · Laurent Pinchart
Hi Sakari,
Thank you for the patch.
Quoted 61 lines · Sakari Ailus
Document the CCS PLL flags with short comments. The CCS spec has more information on them while the added documentation helps finding the relevant information in the CCS spec.
Signed-off-by Sakari Ailus <[email protected]>--- drivers/media/i2c/ccs-pll.c | 2 +- drivers/media/i2c/ccs-pll.h | 27 ++++++++++++++++++++++++--- 2 files changed, 25 insertions(+), 4 deletions(-)drivers/media/i2c/ccs-pll.c +1
-1@@ -129,8 +129,8 @@ static void print_pll_flags(struct device *dev, struct ccs_pll *pll) { dev_dbg(dev, "PLL flags%s%s%s%s%s%s%s%s%s%s%s\n", pll->flags & PLL_FL(OP_PIX_CLOCK_PER_LANE) ? " op-pix-clock-per-lane" : "", - pll->flags & PLL_FL(NO_OP_CLOCKS) ? " no-op-clocks" : "", pll->flags & PLL_FL(EVEN_PLL_MULTIPLIER) ? " even-pll-multiplier" : "", + pll->flags & PLL_FL(NO_OP_CLOCKS) ? " no-op-clocks" : "", pll->flags & PLL_FL(LANE_SPEED_MODEL) ? " lane-speed" : "", pll->flags & PLL_FL(EXT_IP_PLL_DIVIDER) ? " ext-ip-pll-divider" : "",drivers/media/i2c/ccs-pll.h +17
-3@@ -18,19 +18,40 @@#define CCS_PLL_BUS_TYPE_CSI2_DPHY 0x00#define CCS_PLL_BUS_TYPE_CSI2_CPHY 0x01 -/* Old SMIA and implementation specific flags */ -/* op pix clock is for all lanes in total normally */ +/* Old SMIA and implementation specific flags. */ +/* OP PIX clock is for all lanes in total normally. */ #define CCS_PLL_FLAG_OP_PIX_CLOCK_PER_LANE BIT(0) -#define CCS_PLL_FLAG_NO_OP_CLOCKS BIT(1) +/* If set, the PLL multipliers are required to be even. */ #define CCS_PLL_FLAG_EVEN_PLL_MULTIPLIER BIT(3) +/* CCS PLL flags */ + +/* The sensor doesn't have OP clocks at all. */ +#define CCS_PLL_FLAG_NO_OP_CLOCKS BIT(1) +/* System speed model if this flag is unset. */ #define CCS_PLL_FLAG_LANE_SPEED_MODEL BIT(2) +/* If set, the pre-PLL divider may have odd values, too. */ #define CCS_PLL_FLAG_EXT_IP_PLL_DIVIDER BIT(4) +/* +* If set, the OP PIX clock doesn't have to exactly match with data rate, it may +* be higher. See "OP Domain Formulas" in MIPI CCS 1.1 spec. +*/ #define CCS_PLL_FLAG_FLEXIBLE_OP_PIX_CLK_DIV BIT(5) +/* If set, the VT domain may run faster than the OP domain. */ #define CCS_PLL_FLAG_FIFO_DERATING BIT(6) +/* If set, the VT domain may run slower than the OP domain. */ #define CCS_PLL_FLAG_FIFO_OVERRATING BIT(7) +/* If set, the PLL tree has two PLLs instead of one. */ #define CCS_PLL_FLAG_DUAL_PLL BIT(8) +/*
Quoted 8 lines
drivers/media/i2c/ccs-pll.h line 52
Quoted 6 lines
drivers/media/i2c/ccs-pll.h +5
-0+* If set, the OP SYS clock is a dual data rate clock, transferring two bits per +* cycle instead of one. +*/ #define CCS_PLL_FLAG_OP_SYS_DDR BIT(9) +/* +* If set, the OP PIX clock is a dual data rate clock, transferring two bits per Same comment as for v2.
Oh, this one I forgot. I'll post v4 in a moment.
Quoted 11 lines
Quoted 6 lines
drivers/media/i2c/ccs-pll.h +2
-0+* cycle instead of one. +*/ #define CCS_PLL_FLAG_OP_PIX_DDR BIT(10)/** Signature · 3 lines
Regards, Laurent Pinchart
Signature · 1 line
Sakari Ailus
Sakari Ailus
maintainerPATCH v4 11/11 media: ccs-pll: Document the CCS PLL flags
In reply to Laurent PinchartDocument the CCS PLL flags with short comments. The CCS spec has more information on them while the added documentation helps finding the relevant information in the CCS spec.
---
since v3:
- Refer to pixels in CCS_PLL_FLAG_OP_PIX_DDR comment.
drivers/media/i2c/ccs-pll.c | 2 +- drivers/media/i2c/ccs-pll.h | 27 ++++++++++++++++++++++++--- 2 files changed, 25 insertions(+), 4 deletions(-)
drivers/media/i2c/ccs-pll.c +1 -1
@@ -129,8 +129,8 @@ static void print_pll_flags(struct device *dev, struct ccs_pll *pll) { dev_dbg(dev, "PLL flags%s%s%s%s%s%s%s%s%s%s%s\n", pll->flags & PLL_FL(OP_PIX_CLOCK_PER_LANE) ? " op-pix-clock-per-lane" : "", - pll->flags & PLL_FL(NO_OP_CLOCKS) ? " no-op-clocks" : "", pll->flags & PLL_FL(EVEN_PLL_MULTIPLIER) ? " even-pll-multiplier" : "", + pll->flags & PLL_FL(NO_OP_CLOCKS) ? " no-op-clocks" : "", pll->flags & PLL_FL(LANE_SPEED_MODEL) ? " lane-speed" : "", pll->flags & PLL_FL(EXT_IP_PLL_DIVIDER) ? " ext-ip-pll-divider" : "",
drivers/media/i2c/ccs-pll.h +24 -3
@@ -18,19 +18,40 @@#define CCS_PLL_BUS_TYPE_CSI2_DPHY 0x00#define CCS_PLL_BUS_TYPE_CSI2_CPHY 0x01 -/* Old SMIA and implementation specific flags */ -/* op pix clock is for all lanes in total normally */ +/* Old SMIA and implementation specific flags. */ +/* OP PIX clock is for all lanes in total normally. */ #define CCS_PLL_FLAG_OP_PIX_CLOCK_PER_LANE BIT(0) -#define CCS_PLL_FLAG_NO_OP_CLOCKS BIT(1) +/* If set, the PLL multipliers are required to be even. */ #define CCS_PLL_FLAG_EVEN_PLL_MULTIPLIER BIT(3) +/* CCS PLL flags */ + +/* The sensor doesn't have OP clocks at all. */ +#define CCS_PLL_FLAG_NO_OP_CLOCKS BIT(1) +/* System speed model if this flag is unset. */ #define CCS_PLL_FLAG_LANE_SPEED_MODEL BIT(2) +/* If set, the pre-PLL divider may have odd values, too. */ #define CCS_PLL_FLAG_EXT_IP_PLL_DIVIDER BIT(4) +/* +* If set, the OP PIX clock doesn't have to exactly match with data rate, it may +* be higher. See "OP Domain Formulas" in MIPI CCS 1.1 spec. +*/ #define CCS_PLL_FLAG_FLEXIBLE_OP_PIX_CLK_DIV BIT(5) +/* If set, the VT domain may run faster than the OP domain. */ #define CCS_PLL_FLAG_FIFO_DERATING BIT(6) +/* If set, the VT domain may run slower than the OP domain. */ #define CCS_PLL_FLAG_FIFO_OVERRATING BIT(7) +/* If set, the PLL tree has two PLLs instead of one. */ #define CCS_PLL_FLAG_DUAL_PLL BIT(8) +/* +* If set, the OP SYS clock is a dual data rate clock, transferring two bits per +* cycle instead of one. +*/ #define CCS_PLL_FLAG_OP_SYS_DDR BIT(9) +/* +* If set, the OP PIX clock is a dual data rate clock, transferring two pixels +* per cycle instead of one. +*/ #define CCS_PLL_FLAG_OP_PIX_DDR BIT(10)/**
Signature · 1 line
2.39.5
Re: [PATCH v4 11/11] media: ccs-pll: Document the CCS PLL flags
Quoted 9 lines · Sakari Ailus
Document the CCS PLL flags with short comments. The CCS spec has more information on them while the added documentation helps finding the relevant information in the CCS spec.
Signed-off-by Sakari Ailus <[email protected]>---
since v3:- Refer to pixels in
CCS_PLL_FLAG_OP_PIX_DDRcomment.
Quoted 66 lines
drivers/media/i2c/ccs-pll.c | 2 +- drivers/media/i2c/ccs-pll.h | 27 ++++++++++++++++++++++++--- 2 files changed, 25 insertions(+), 4 deletions(-)drivers/media/i2c/ccs-pll.c +1
-1@@ -129,8 +129,8 @@ static void print_pll_flags(struct device *dev, struct ccs_pll *pll) { dev_dbg(dev, "PLL flags%s%s%s%s%s%s%s%s%s%s%s\n", pll->flags & PLL_FL(OP_PIX_CLOCK_PER_LANE) ? " op-pix-clock-per-lane" : "", - pll->flags & PLL_FL(NO_OP_CLOCKS) ? " no-op-clocks" : "", pll->flags & PLL_FL(EVEN_PLL_MULTIPLIER) ? " even-pll-multiplier" : "", + pll->flags & PLL_FL(NO_OP_CLOCKS) ? " no-op-clocks" : "", pll->flags & PLL_FL(LANE_SPEED_MODEL) ? " lane-speed" : "", pll->flags & PLL_FL(EXT_IP_PLL_DIVIDER) ? " ext-ip-pll-divider" : "",drivers/media/i2c/ccs-pll.h +24
-3@@ -18,19 +18,40 @@#define CCS_PLL_BUS_TYPE_CSI2_DPHY 0x00#define CCS_PLL_BUS_TYPE_CSI2_CPHY 0x01 -/* Old SMIA and implementation specific flags */ -/* op pix clock is for all lanes in total normally */ +/* Old SMIA and implementation specific flags. */ +/* OP PIX clock is for all lanes in total normally. */ #define CCS_PLL_FLAG_OP_PIX_CLOCK_PER_LANE BIT(0) -#define CCS_PLL_FLAG_NO_OP_CLOCKS BIT(1) +/* If set, the PLL multipliers are required to be even. */ #define CCS_PLL_FLAG_EVEN_PLL_MULTIPLIER BIT(3) +/* CCS PLL flags */ + +/* The sensor doesn't have OP clocks at all. */ +#define CCS_PLL_FLAG_NO_OP_CLOCKS BIT(1) +/* System speed model if this flag is unset. */ #define CCS_PLL_FLAG_LANE_SPEED_MODEL BIT(2) +/* If set, the pre-PLL divider may have odd values, too. */ #define CCS_PLL_FLAG_EXT_IP_PLL_DIVIDER BIT(4) +/* +* If set, the OP PIX clock doesn't have to exactly match with data rate, it may +* be higher. See "OP Domain Formulas" in MIPI CCS 1.1 spec. +*/ #define CCS_PLL_FLAG_FLEXIBLE_OP_PIX_CLK_DIV BIT(5) +/* If set, the VT domain may run faster than the OP domain. */ #define CCS_PLL_FLAG_FIFO_DERATING BIT(6) +/* If set, the VT domain may run slower than the OP domain. */ #define CCS_PLL_FLAG_FIFO_OVERRATING BIT(7) +/* If set, the PLL tree has two PLLs instead of one. */ #define CCS_PLL_FLAG_DUAL_PLL BIT(8) +/* +* If set, the OP SYS clock is a dual data rate clock, transferring two bits per +* cycle instead of one. +*/ #define CCS_PLL_FLAG_OP_SYS_DDR BIT(9) +/* +* If set, the OP PIX clock is a dual data rate clock, transferring two pixels +* per cycle instead of one. +*/ #define CCS_PLL_FLAG_OP_PIX_DDR BIT(10)/**
Signature · 3 lines
Regards, Laurent Pinchart