Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 343884
b: refs/heads/master
c: f5984bb
h: refs/heads/master
v: v3
  • Loading branch information
Sakari Ailus authored and Mauro Carvalho Chehab committed Oct 29, 2012
1 parent 58ba8dc commit 1a29319
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 12 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 1e9240b35264fa0280abc4487b47b28eecf10b52
refs/heads/master: f5984bbdf402b586581bc292a5449f17ce4b8209
19 changes: 15 additions & 4 deletions trunk/drivers/media/i2c/smiapp-pll.c
Original file line number Diff line number Diff line change
Expand Up @@ -371,17 +371,28 @@ int smiapp_pll_calculate(struct device *dev, struct smiapp_pll_limits *limits,
int rval = -EINVAL;

if (pll->flags & SMIAPP_PLL_FLAG_OP_PIX_CLOCK_PER_LANE)
lane_op_clock_ratio = pll->lanes;
lane_op_clock_ratio = pll->csi2.lanes;
else
lane_op_clock_ratio = 1;
dev_dbg(dev, "lane_op_clock_ratio: %d\n", lane_op_clock_ratio);

dev_dbg(dev, "binning: %dx%d\n", pll->binning_horizontal,
pll->binning_vertical);

/* CSI transfers 2 bits per clock per lane; thus times 2 */
pll->pll_op_clk_freq_hz = pll->link_freq * 2
* (pll->lanes / lane_op_clock_ratio);
switch (pll->bus_type) {
case SMIAPP_PLL_BUS_TYPE_CSI2:
/* CSI transfers 2 bits per clock per lane; thus times 2 */
pll->pll_op_clk_freq_hz = pll->link_freq * 2
* (pll->csi2.lanes / lane_op_clock_ratio);
break;
case SMIAPP_PLL_BUS_TYPE_PARALLEL:
pll->pll_op_clk_freq_hz = pll->link_freq * pll->bits_per_pixel
/ DIV_ROUND_UP(pll->bits_per_pixel,
pll->parallel.bus_width);
break;
default:
return -EINVAL;
}

/* Figure out limits for pre-pll divider based on extclk */
dev_dbg(dev, "min / max pre_pll_clk_div: %d / %d\n",
Expand Down
26 changes: 20 additions & 6 deletions trunk/drivers/media/i2c/smiapp-pll.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,34 @@

#include <linux/device.h>

/* CSI-2 or CCP-2 */
#define SMIAPP_PLL_BUS_TYPE_CSI2 0x00
#define SMIAPP_PLL_BUS_TYPE_PARALLEL 0x01

/* op pix clock is for all lanes in total normally */
#define SMIAPP_PLL_FLAG_OP_PIX_CLOCK_PER_LANE (1 << 0)
#define SMIAPP_PLL_FLAG_NO_OP_CLOCKS (1 << 1)

struct smiapp_pll {
uint8_t lanes;
/* input values */
uint8_t bus_type;
union {
struct {
uint8_t lanes;
} csi2;
struct {
uint8_t bus_width;
} parallel;
};
uint8_t flags;
uint8_t binning_horizontal;
uint8_t binning_vertical;
uint8_t scale_m;
uint8_t scale_n;
uint8_t bits_per_pixel;
uint16_t flags;
uint32_t link_freq;

/* output values */
uint16_t pre_pll_clk_div;
uint16_t pll_multiplier;
uint16_t op_sys_clk_div;
Expand Down Expand Up @@ -91,10 +109,6 @@ struct smiapp_pll_limits {
uint32_t min_line_length_pck;
};

/* op pix clock is for all lanes in total normally */
#define SMIAPP_PLL_FLAG_OP_PIX_CLOCK_PER_LANE (1 << 0)
#define SMIAPP_PLL_FLAG_NO_OP_CLOCKS (1 << 1)

struct device;

int smiapp_pll_calculate(struct device *dev, struct smiapp_pll_limits *limits,
Expand Down
3 changes: 2 additions & 1 deletion trunk/drivers/media/i2c/smiapp/smiapp-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -2625,7 +2625,8 @@ static int smiapp_registered(struct v4l2_subdev *subdev)
goto out_nvm_release;

/* prepare PLL configuration input values */
pll->lanes = sensor->platform_data->lanes;
pll->bus_type = SMIAPP_PLL_BUS_TYPE_CSI2;
pll->csi2.lanes = sensor->platform_data->lanes;
pll->ext_clk_freq_hz = sensor->platform_data->ext_clk;
/* Profile 0 sensors have no separate OP clock branch. */
if (sensor->minfo.smiapp_profile == SMIAPP_PROFILE_0)
Expand Down

0 comments on commit 1a29319

Please sign in to comment.