/* * ioremap the device dependent PLL registers * * @this: point to the object where this function is called from
*/ staticint lsdc_pixel_pll_setup(struct lsdc_pixpll * constthis)
{ struct lsdc_pixpll_parms *pparms;
this->mmio = ioremap(this->reg_base, this->reg_size); if (!this->mmio) return -ENOMEM;
/* * Find a set of pll parameters from a static local table which avoid * computing the pll parameter eachtime a modeset is triggered. * * @this: point to the object where this function is called from * @clock: the desired output pixel clock, the unit is kHz * @pout: point to where the parameters to store if found * * Return 0 if success, return -1 if not found.
*/ staticint lsdc_pixpll_find(struct lsdc_pixpll * constthis, unsignedint clock, struct lsdc_pixpll_parms *pout)
{ unsignedint num = ARRAY_SIZE(pixpll_parms_table); conststruct clk_to_pixpll_parms_lookup_t *pt; unsignedint i;
for (i = 0; i < num; ++i) {
pt = &pixpll_parms_table[i];
/* * Find a set of pll parameters which have minimal difference with the * desired pixel clock frequency. It does that by computing all of the * possible combination. Compute the diff and find the combination with * minimal diff. * * clock_out = refclk / div_ref * loopc / div_out * * refclk is determined by the oscillator mounted on motherboard(100MHz * in almost all board) * * @this: point to the object from where this function is called * @clock: the desired output pixel clock, the unit is kHz * @pout: point to the out struct of lsdc_pixpll_parms * * Return 0 if a set of parameter is found, otherwise return the error * between clock_kHz we wanted and the most closest candidate with it.
*/ staticint lsdc_pixel_pll_compute(struct lsdc_pixpll * constthis, unsignedint clock, struct lsdc_pixpll_parms *pout)
{ struct lsdc_pixpll_parms *pparms = this->priv; unsignedint refclk = pparms->ref_clock; constunsignedint tolerance = 1000; unsignedint min = tolerance; unsignedint div_out, loopc, div_ref; unsignedint computed;
if (!lsdc_pixpll_find(this, clock, pout)) return 0;
/* * Update the PLL parameters to the PLL hardware * * @this: point to the object from which this function is called * @pin: point to the struct of lsdc_pixpll_parms passed in * * return 0 if successful.
*/ staticint lsdc_pixpll_update(struct lsdc_pixpll * constthis, struct lsdc_pixpll_parms const *pin)
{
__pixpll_ops_bypass(this);
/* * LS7A1000, LS7A2000 and ls2k2000's pixel pll setting register is same, * we take this as default, create a new instance if a different model is * introduced.
*/ staticconststruct lsdc_pixpll_funcs __pixpll_default_funcs = {
.setup = lsdc_pixel_pll_setup,
.compute = lsdc_pixel_pll_compute,
.update = lsdc_pixpll_update,
.get_rate = lsdc_pixpll_get_freq,
.print = lsdc_pixpll_print,
};
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.