Lines Matching full:fs
72 unsigned long output, struct stm_fs *fs);
260 static int clk_fs660c32_vco_get_rate(unsigned long input, struct stm_fs *fs, in clk_fs660c32_vco_get_rate() argument
263 unsigned long nd = fs->ndiv + 16; /* ndiv value */ in clk_fs660c32_vco_get_rate()
288 unsigned long output, struct stm_fs *fs) in clk_fs660c32_vco_get_params() argument
311 fs->ndiv = n - 16; /* Converting formula value to reg value */ in clk_fs660c32_vco_get_params()
471 static void quadfs_fsynth_program_enable(struct st_clk_quadfs_fsynth *fs) in quadfs_fsynth_program_enable() argument
477 CLKGEN_WRITE(fs, en[fs->chan], 1); in quadfs_fsynth_program_enable()
478 CLKGEN_WRITE(fs, en[fs->chan], 0); in quadfs_fsynth_program_enable()
481 static void quadfs_fsynth_program_rate(struct st_clk_quadfs_fsynth *fs) in quadfs_fsynth_program_rate() argument
490 CLKGEN_WRITE(fs, en[fs->chan], 0); in quadfs_fsynth_program_rate()
492 CLKGEN_WRITE(fs, mdiv[fs->chan], fs->md); in quadfs_fsynth_program_rate()
493 CLKGEN_WRITE(fs, pe[fs->chan], fs->pe); in quadfs_fsynth_program_rate()
494 CLKGEN_WRITE(fs, sdiv[fs->chan], fs->sdiv); in quadfs_fsynth_program_rate()
496 if (fs->lock) in quadfs_fsynth_program_rate()
497 spin_lock_irqsave(fs->lock, flags); in quadfs_fsynth_program_rate()
499 if (fs->data->nsdiv_present) in quadfs_fsynth_program_rate()
500 CLKGEN_WRITE(fs, nsdiv[fs->chan], fs->nsdiv); in quadfs_fsynth_program_rate()
502 if (fs->lock) in quadfs_fsynth_program_rate()
503 spin_unlock_irqrestore(fs->lock, flags); in quadfs_fsynth_program_rate()
508 struct st_clk_quadfs_fsynth *fs = to_quadfs_fsynth(hw); in quadfs_fsynth_enable() local
513 quadfs_fsynth_program_rate(fs); in quadfs_fsynth_enable()
515 if (fs->lock) in quadfs_fsynth_enable()
516 spin_lock_irqsave(fs->lock, flags); in quadfs_fsynth_enable()
518 CLKGEN_WRITE(fs, nsb[fs->chan], !fs->data->standby_polarity); in quadfs_fsynth_enable()
520 if (fs->data->nrst_present) in quadfs_fsynth_enable()
521 CLKGEN_WRITE(fs, nrst[fs->chan], 0); in quadfs_fsynth_enable()
523 if (fs->lock) in quadfs_fsynth_enable()
524 spin_unlock_irqrestore(fs->lock, flags); in quadfs_fsynth_enable()
526 quadfs_fsynth_program_enable(fs); in quadfs_fsynth_enable()
533 struct st_clk_quadfs_fsynth *fs = to_quadfs_fsynth(hw); in quadfs_fsynth_disable() local
538 if (fs->lock) in quadfs_fsynth_disable()
539 spin_lock_irqsave(fs->lock, flags); in quadfs_fsynth_disable()
541 CLKGEN_WRITE(fs, nsb[fs->chan], fs->data->standby_polarity); in quadfs_fsynth_disable()
543 if (fs->lock) in quadfs_fsynth_disable()
544 spin_unlock_irqrestore(fs->lock, flags); in quadfs_fsynth_disable()
549 struct st_clk_quadfs_fsynth *fs = to_quadfs_fsynth(hw); in quadfs_fsynth_is_enabled() local
550 u32 nsb = CLKGEN_READ(fs, nsb[fs->chan]); in quadfs_fsynth_is_enabled()
555 return fs->data->standby_polarity ? !nsb : !!nsb; in quadfs_fsynth_is_enabled()
561 const struct stm_fs *fs, unsigned long *rate) in clk_fs660c32_dig_get_rate() argument
563 unsigned long s = (1 << fs->sdiv); in clk_fs660c32_dig_get_rate()
575 ns = (fs->nsdiv == 1) ? 1 : 3; in clk_fs660c32_dig_get_rate()
577 res = (P20 * (32 + fs->mdiv) + 32 * fs->pe) * s * ns; in clk_fs660c32_dig_get_rate()
586 struct stm_fs *fs) in clk_fs660c32_get_pe() argument
611 fs->mdiv = m; in clk_fs660c32_get_pe()
612 fs->pe = (unsigned long)*p; in clk_fs660c32_get_pe()
613 fs->sdiv = si; in clk_fs660c32_get_pe()
614 fs->nsdiv = 1; in clk_fs660c32_get_pe()
621 unsigned long output, struct stm_fs *fs) in clk_fs660c32_dig_get_params() argument
637 input, output, &p1, fs); in clk_fs660c32_dig_get_params()
639 input, output, &p2, fs); in clk_fs660c32_dig_get_params()
648 input, output, &p, fs); in clk_fs660c32_dig_get_params()
657 fs_tmp.mdiv = fs->mdiv; in clk_fs660c32_dig_get_params()
658 fs_tmp.sdiv = fs->sdiv; in clk_fs660c32_dig_get_params()
659 fs_tmp.nsdiv = fs->nsdiv; in clk_fs660c32_dig_get_params()
661 if (fs->pe > 2) in clk_fs660c32_dig_get_params()
662 p2 = fs->pe - 2; in clk_fs660c32_dig_get_params()
666 for (; p2 < 32768ll && (p2 <= (fs->pe + 2)); p2++) { in clk_fs660c32_dig_get_params()
675 fs->pe = (unsigned long)p2; in clk_fs660c32_dig_get_params()
684 static int quadfs_fsynt_get_hw_value_for_recalc(struct st_clk_quadfs_fsynth *fs, in quadfs_fsynt_get_hw_value_for_recalc() argument
690 params->mdiv = CLKGEN_READ(fs, mdiv[fs->chan]); in quadfs_fsynt_get_hw_value_for_recalc()
691 params->pe = CLKGEN_READ(fs, pe[fs->chan]); in quadfs_fsynt_get_hw_value_for_recalc()
692 params->sdiv = CLKGEN_READ(fs, sdiv[fs->chan]); in quadfs_fsynt_get_hw_value_for_recalc()
694 if (fs->data->nsdiv_present) in quadfs_fsynt_get_hw_value_for_recalc()
695 params->nsdiv = CLKGEN_READ(fs, nsdiv[fs->chan]); in quadfs_fsynt_get_hw_value_for_recalc()
705 fs->md = params->mdiv; in quadfs_fsynt_get_hw_value_for_recalc()
706 fs->pe = params->pe; in quadfs_fsynt_get_hw_value_for_recalc()
707 fs->sdiv = params->sdiv; in quadfs_fsynt_get_hw_value_for_recalc()
708 fs->nsdiv = params->nsdiv; in quadfs_fsynt_get_hw_value_for_recalc()
716 struct st_clk_quadfs_fsynth *fs = to_quadfs_fsynth(hw); in quadfs_find_best_rate() local
722 clk_fs_get_rate = fs->data->get_rate; in quadfs_find_best_rate()
723 clk_fs_get_params = fs->data->get_params; in quadfs_find_best_rate()
734 struct st_clk_quadfs_fsynth *fs = to_quadfs_fsynth(hw); in quadfs_recalc_rate() local
740 clk_fs_get_rate = fs->data->get_rate; in quadfs_recalc_rate()
742 if (quadfs_fsynt_get_hw_value_for_recalc(fs, ¶ms)) in quadfs_recalc_rate()
771 static void quadfs_program_and_enable(struct st_clk_quadfs_fsynth *fs, in quadfs_program_and_enable() argument
774 fs->md = params->mdiv; in quadfs_program_and_enable()
775 fs->pe = params->pe; in quadfs_program_and_enable()
776 fs->sdiv = params->sdiv; in quadfs_program_and_enable()
777 fs->nsdiv = params->nsdiv; in quadfs_program_and_enable()
783 quadfs_fsynth_program_rate(fs); in quadfs_program_and_enable()
784 quadfs_fsynth_program_enable(fs); in quadfs_program_and_enable()
790 struct st_clk_quadfs_fsynth *fs = to_quadfs_fsynth(hw); in quadfs_set_rate() local
803 quadfs_program_and_enable(fs, ¶ms); in quadfs_set_rate()
824 struct st_clk_quadfs_fsynth *fs; in st_clk_register_quadfs_fsynth() local
834 fs = kzalloc(sizeof(*fs), GFP_KERNEL); in st_clk_register_quadfs_fsynth()
835 if (!fs) in st_clk_register_quadfs_fsynth()
844 fs->data = quadfs; in st_clk_register_quadfs_fsynth()
845 fs->regs_base = reg; in st_clk_register_quadfs_fsynth()
846 fs->chan = chan; in st_clk_register_quadfs_fsynth()
847 fs->lock = lock; in st_clk_register_quadfs_fsynth()
848 fs->hw.init = &init; in st_clk_register_quadfs_fsynth()
850 clk = clk_register(NULL, &fs->hw); in st_clk_register_quadfs_fsynth()
853 kfree(fs); in st_clk_register_quadfs_fsynth()