Lines Matching refs:fs
82 unsigned long output, struct stm_fs *fs);
322 static int clk_fs660c32_vco_get_rate(unsigned long input, struct stm_fs *fs, in clk_fs660c32_vco_get_rate() argument
325 unsigned long nd = fs->ndiv + 16; /* ndiv value */ in clk_fs660c32_vco_get_rate()
350 unsigned long output, struct stm_fs *fs) in clk_fs660c32_vco_get_params() argument
373 fs->ndiv = n - 16; /* Converting formula value to reg value */ in clk_fs660c32_vco_get_params()
533 static void quadfs_fsynth_program_enable(struct st_clk_quadfs_fsynth *fs) in quadfs_fsynth_program_enable() argument
539 CLKGEN_WRITE(fs, en[fs->chan], 1); in quadfs_fsynth_program_enable()
540 CLKGEN_WRITE(fs, en[fs->chan], 0); in quadfs_fsynth_program_enable()
543 static void quadfs_fsynth_program_rate(struct st_clk_quadfs_fsynth *fs) in quadfs_fsynth_program_rate() argument
552 CLKGEN_WRITE(fs, en[fs->chan], 0); in quadfs_fsynth_program_rate()
554 CLKGEN_WRITE(fs, mdiv[fs->chan], fs->md); in quadfs_fsynth_program_rate()
555 CLKGEN_WRITE(fs, pe[fs->chan], fs->pe); in quadfs_fsynth_program_rate()
556 CLKGEN_WRITE(fs, sdiv[fs->chan], fs->sdiv); in quadfs_fsynth_program_rate()
558 if (fs->lock) in quadfs_fsynth_program_rate()
559 spin_lock_irqsave(fs->lock, flags); in quadfs_fsynth_program_rate()
561 if (fs->data->nsdiv_present) in quadfs_fsynth_program_rate()
562 CLKGEN_WRITE(fs, nsdiv[fs->chan], fs->nsdiv); in quadfs_fsynth_program_rate()
564 if (fs->lock) in quadfs_fsynth_program_rate()
565 spin_unlock_irqrestore(fs->lock, flags); in quadfs_fsynth_program_rate()
570 struct st_clk_quadfs_fsynth *fs = to_quadfs_fsynth(hw); in quadfs_fsynth_enable() local
575 quadfs_fsynth_program_rate(fs); in quadfs_fsynth_enable()
577 if (fs->lock) in quadfs_fsynth_enable()
578 spin_lock_irqsave(fs->lock, flags); in quadfs_fsynth_enable()
580 CLKGEN_WRITE(fs, nsb[fs->chan], !fs->data->standby_polarity); in quadfs_fsynth_enable()
582 if (fs->data->nrst_present) in quadfs_fsynth_enable()
583 CLKGEN_WRITE(fs, nrst[fs->chan], 0); in quadfs_fsynth_enable()
585 if (fs->lock) in quadfs_fsynth_enable()
586 spin_unlock_irqrestore(fs->lock, flags); in quadfs_fsynth_enable()
588 quadfs_fsynth_program_enable(fs); in quadfs_fsynth_enable()
595 struct st_clk_quadfs_fsynth *fs = to_quadfs_fsynth(hw); in quadfs_fsynth_disable() local
600 if (fs->lock) in quadfs_fsynth_disable()
601 spin_lock_irqsave(fs->lock, flags); in quadfs_fsynth_disable()
603 CLKGEN_WRITE(fs, nsb[fs->chan], fs->data->standby_polarity); in quadfs_fsynth_disable()
605 if (fs->lock) in quadfs_fsynth_disable()
606 spin_unlock_irqrestore(fs->lock, flags); in quadfs_fsynth_disable()
611 struct st_clk_quadfs_fsynth *fs = to_quadfs_fsynth(hw); in quadfs_fsynth_is_enabled() local
612 u32 nsb = CLKGEN_READ(fs, nsb[fs->chan]); in quadfs_fsynth_is_enabled()
617 return fs->data->standby_polarity ? !nsb : !!nsb; in quadfs_fsynth_is_enabled()
623 const struct stm_fs *fs, unsigned long *rate) in clk_fs660c32_dig_get_rate() argument
625 unsigned long s = (1 << fs->sdiv); in clk_fs660c32_dig_get_rate()
637 ns = (fs->nsdiv == 1) ? 1 : 3; in clk_fs660c32_dig_get_rate()
639 res = (P20 * (32 + fs->mdiv) + 32 * fs->pe) * s * ns; in clk_fs660c32_dig_get_rate()
648 struct stm_fs *fs) in clk_fs660c32_get_pe() argument
673 fs->mdiv = m; in clk_fs660c32_get_pe()
674 fs->pe = (unsigned long)*p; in clk_fs660c32_get_pe()
675 fs->sdiv = si; in clk_fs660c32_get_pe()
676 fs->nsdiv = 1; in clk_fs660c32_get_pe()
683 unsigned long output, struct stm_fs *fs) in clk_fs660c32_dig_get_params() argument
699 input, output, &p1, fs); in clk_fs660c32_dig_get_params()
701 input, output, &p2, fs); in clk_fs660c32_dig_get_params()
710 input, output, &p, fs); in clk_fs660c32_dig_get_params()
719 fs_tmp.mdiv = fs->mdiv; in clk_fs660c32_dig_get_params()
720 fs_tmp.sdiv = fs->sdiv; in clk_fs660c32_dig_get_params()
721 fs_tmp.nsdiv = fs->nsdiv; in clk_fs660c32_dig_get_params()
723 if (fs->pe > 2) in clk_fs660c32_dig_get_params()
724 p2 = fs->pe - 2; in clk_fs660c32_dig_get_params()
728 for (; p2 < 32768ll && (p2 <= (fs->pe + 2)); p2++) { in clk_fs660c32_dig_get_params()
737 fs->pe = (unsigned long)p2; in clk_fs660c32_dig_get_params()
746 static int quadfs_fsynt_get_hw_value_for_recalc(struct st_clk_quadfs_fsynth *fs, in quadfs_fsynt_get_hw_value_for_recalc() argument
752 params->mdiv = CLKGEN_READ(fs, mdiv[fs->chan]); in quadfs_fsynt_get_hw_value_for_recalc()
753 params->pe = CLKGEN_READ(fs, pe[fs->chan]); in quadfs_fsynt_get_hw_value_for_recalc()
754 params->sdiv = CLKGEN_READ(fs, sdiv[fs->chan]); in quadfs_fsynt_get_hw_value_for_recalc()
756 if (fs->data->nsdiv_present) in quadfs_fsynt_get_hw_value_for_recalc()
757 params->nsdiv = CLKGEN_READ(fs, nsdiv[fs->chan]); in quadfs_fsynt_get_hw_value_for_recalc()
767 fs->md = params->mdiv; in quadfs_fsynt_get_hw_value_for_recalc()
768 fs->pe = params->pe; in quadfs_fsynt_get_hw_value_for_recalc()
769 fs->sdiv = params->sdiv; in quadfs_fsynt_get_hw_value_for_recalc()
770 fs->nsdiv = params->nsdiv; in quadfs_fsynt_get_hw_value_for_recalc()
778 struct st_clk_quadfs_fsynth *fs = to_quadfs_fsynth(hw); in quadfs_find_best_rate() local
784 clk_fs_get_rate = fs->data->get_rate; in quadfs_find_best_rate()
785 clk_fs_get_params = fs->data->get_params; in quadfs_find_best_rate()
796 struct st_clk_quadfs_fsynth *fs = to_quadfs_fsynth(hw); in quadfs_recalc_rate() local
802 clk_fs_get_rate = fs->data->get_rate; in quadfs_recalc_rate()
804 if (quadfs_fsynt_get_hw_value_for_recalc(fs, ¶ms)) in quadfs_recalc_rate()
833 static void quadfs_program_and_enable(struct st_clk_quadfs_fsynth *fs, in quadfs_program_and_enable() argument
836 fs->md = params->mdiv; in quadfs_program_and_enable()
837 fs->pe = params->pe; in quadfs_program_and_enable()
838 fs->sdiv = params->sdiv; in quadfs_program_and_enable()
839 fs->nsdiv = params->nsdiv; in quadfs_program_and_enable()
845 quadfs_fsynth_program_rate(fs); in quadfs_program_and_enable()
846 quadfs_fsynth_program_enable(fs); in quadfs_program_and_enable()
852 struct st_clk_quadfs_fsynth *fs = to_quadfs_fsynth(hw); in quadfs_set_rate() local
865 quadfs_program_and_enable(fs, ¶ms); in quadfs_set_rate()
886 struct st_clk_quadfs_fsynth *fs; in st_clk_register_quadfs_fsynth() local
896 fs = kzalloc(sizeof(*fs), GFP_KERNEL); in st_clk_register_quadfs_fsynth()
897 if (!fs) in st_clk_register_quadfs_fsynth()
906 fs->data = quadfs; in st_clk_register_quadfs_fsynth()
907 fs->regs_base = reg; in st_clk_register_quadfs_fsynth()
908 fs->chan = chan; in st_clk_register_quadfs_fsynth()
909 fs->lock = lock; in st_clk_register_quadfs_fsynth()
910 fs->hw.init = &init; in st_clk_register_quadfs_fsynth()
912 clk = clk_register(NULL, &fs->hw); in st_clk_register_quadfs_fsynth()
915 kfree(fs); in st_clk_register_quadfs_fsynth()