Hi Sakari, Thanks for the patch. On Thursday 08 March 2012 15:57:29 Sakari Ailus wrote: > From: Sakari Ailus <sakari.ailus@xxxxxxxxxxxxxxxxxxxxxxxxxx> > > Calculate PLL configuration based on input data: sensor configuration, board > properties and sensor-specific limits. > > Signed-off-by: Sakari Ailus <sakari.ailus@xxxxxxxxxxxxxxxxxxxxxxxxxx> [snip] > diff --git a/drivers/media/video/smiapp-pll.c > b/drivers/media/video/smiapp-pll.c new file mode 100644 > index 0000000..c8ffdc9 > --- /dev/null > +++ b/drivers/media/video/smiapp-pll.c [snip] > + /* > + * Find pix_div such that a legal pix_div * sys_div results > + * into a value which is not smaller than div, the desired > + * divisor. > + */ > + for (vt_div = min_vt_div; vt_div <= max_vt_div; > + vt_div += 2 - (vt_div & 1)) { > + for (sys_div = min_sys_div; > + sys_div <= max_sys_div; > + sys_div += 2 - (sys_div & 1)) { > + int pix_div = DIV_ROUND_UP(vt_div, sys_div); > + > + if (pix_div < > + limits->min_vt_pix_clk_div > + || pix_div > + > limits->max_vt_pix_clk_div) { Maybe you should get some sleep, I've heard it helps memory ;-) > + dev_dbg(dev, > + "pix_div %d too small or too big (%d--%d)\n", > + pix_div, > + limits->min_vt_pix_clk_div, > + limits->max_vt_pix_clk_div); > + continue; > + } > + > + /* Check if this one is better. */ > + if (pix_div * sys_div > + <= ALIGN(min_vt_div, best_pix_div)) > + best_pix_div = pix_div; > + } > + if (best_pix_div < INT_MAX >> 1) > + break; > + } -- Regards, Laurent Pinchart -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html