staticstruct tps68470_clkout_freqs { unsignedlong freq; unsignedint xtaldiv; unsignedint plldiv; unsignedint postdiv; unsignedint buckdiv; unsignedint boostdiv;
} clk_freqs[] = { /* * The PLL is used to multiply the crystal oscillator * frequency range of 3 MHz to 27 MHz by a programmable * factor of F = (M/N)*(1/P) such that the output * available at the HCLK_A or HCLK_B pins are in the range * of 4 MHz to 64 MHz in increments of 0.1 MHz. * * hclk_# = osc_in * (((plldiv*2)+320) / (xtaldiv+30)) * (1 / 2^postdiv) * * PLL_REF_CLK should be as close as possible to 100kHz * PLL_REF_CLK = input clk / XTALDIV[7:0] + 30) * * PLL_VCO_CLK = (PLL_REF_CLK * (plldiv*2 + 320)) * * BOOST should be as close as possible to 2Mhz * BOOST = PLL_VCO_CLK / (BOOSTDIV[4:0] + 16) * * * BUCK should be as close as possible to 5.2Mhz * BUCK = PLL_VCO_CLK / (BUCKDIV[3:0] + 5) * * osc_in xtaldiv plldiv postdiv hclk_# * 20Mhz 170 32 1 19.2Mhz * 20Mhz 170 40 1 20Mhz * 20Mhz 170 80 1 24Mhz
*/
{ 19200000, 170, 32, 1, 2, 3 },
{ 20000000, 170, 40, 1, 3, 4 },
{ 24000000, 170, 80, 1, 4, 8 },
};
/* * This returns the index of the clk_freqs[] cfg with the closest rate for * use in tps68470_clk_round_rate(). tps68470_clk_set_rate() checks that * the rate of the returned cfg is an exact match.
*/ staticunsignedint tps68470_clk_cfg_lookup(unsignedlong rate)
{ long diff, best_diff = LONG_MAX; unsignedint i, best_idx = 0;
for (i = 0; i < ARRAY_SIZE(clk_freqs); i++) {
diff = clk_freqs[i].freq - rate; if (diff == 0) return i;
/* Set initial rate */
tps68470_clk_set_rate(&tps68470_clkdata->clkout_hw, clk_freqs[0].freq, 0);
ret = devm_clk_hw_register(&pdev->dev, &tps68470_clkdata->clkout_hw); if (ret) return ret;
ret = devm_clk_hw_register_clkdev(&pdev->dev, &tps68470_clkdata->clkout_hw,
TPS68470_CLK_NAME, NULL); if (ret) return ret;
if (pdata) { for (i = 0; i < pdata->n_consumers; i++) {
consumer = &pdata->consumers[i];
ret = devm_clk_hw_register_clkdev(&pdev->dev,
&tps68470_clkdata->clkout_hw,
consumer->consumer_con_id,
consumer->consumer_dev_name);
}
}
/* * The ACPI tps68470 probe-ordering depends on the clk/gpio/regulator drivers * registering before the drivers for the camera-sensors which use them bind. * subsys_initcall() ensures this when the drivers are builtin.
*/ staticint __init tps68470_clk_init(void)
{ return platform_driver_register(&tps68470_clk_driver);
}
subsys_initcall(tps68470_clk_init);
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.