Lines Matching refs:fs
77 unsigned long output, struct stm_fs *fs);
265 static int clk_fs660c32_vco_get_rate(unsigned long input, struct stm_fs *fs, in clk_fs660c32_vco_get_rate() argument
268 unsigned long nd = fs->ndiv + 16; /* ndiv value */ in clk_fs660c32_vco_get_rate()
293 unsigned long output, struct stm_fs *fs) in clk_fs660c32_vco_get_params() argument
316 fs->ndiv = n - 16; /* Converting formula value to reg value */ in clk_fs660c32_vco_get_params()
476 static void quadfs_fsynth_program_enable(struct st_clk_quadfs_fsynth *fs) in quadfs_fsynth_program_enable() argument
482 CLKGEN_WRITE(fs, en[fs->chan], 1); in quadfs_fsynth_program_enable()
483 CLKGEN_WRITE(fs, en[fs->chan], 0); in quadfs_fsynth_program_enable()
486 static void quadfs_fsynth_program_rate(struct st_clk_quadfs_fsynth *fs) in quadfs_fsynth_program_rate() argument
495 CLKGEN_WRITE(fs, en[fs->chan], 0); in quadfs_fsynth_program_rate()
497 CLKGEN_WRITE(fs, mdiv[fs->chan], fs->md); in quadfs_fsynth_program_rate()
498 CLKGEN_WRITE(fs, pe[fs->chan], fs->pe); in quadfs_fsynth_program_rate()
499 CLKGEN_WRITE(fs, sdiv[fs->chan], fs->sdiv); in quadfs_fsynth_program_rate()
501 if (fs->lock) in quadfs_fsynth_program_rate()
502 spin_lock_irqsave(fs->lock, flags); in quadfs_fsynth_program_rate()
504 if (fs->data->nsdiv_present) in quadfs_fsynth_program_rate()
505 CLKGEN_WRITE(fs, nsdiv[fs->chan], fs->nsdiv); in quadfs_fsynth_program_rate()
507 if (fs->lock) in quadfs_fsynth_program_rate()
508 spin_unlock_irqrestore(fs->lock, flags); in quadfs_fsynth_program_rate()
513 struct st_clk_quadfs_fsynth *fs = to_quadfs_fsynth(hw); in quadfs_fsynth_enable() local
518 quadfs_fsynth_program_rate(fs); in quadfs_fsynth_enable()
520 if (fs->lock) in quadfs_fsynth_enable()
521 spin_lock_irqsave(fs->lock, flags); in quadfs_fsynth_enable()
523 CLKGEN_WRITE(fs, nsb[fs->chan], !fs->data->standby_polarity); in quadfs_fsynth_enable()
525 if (fs->data->nrst_present) in quadfs_fsynth_enable()
526 CLKGEN_WRITE(fs, nrst[fs->chan], 0); in quadfs_fsynth_enable()
528 if (fs->lock) in quadfs_fsynth_enable()
529 spin_unlock_irqrestore(fs->lock, flags); in quadfs_fsynth_enable()
531 quadfs_fsynth_program_enable(fs); in quadfs_fsynth_enable()
538 struct st_clk_quadfs_fsynth *fs = to_quadfs_fsynth(hw); in quadfs_fsynth_disable() local
543 if (fs->lock) in quadfs_fsynth_disable()
544 spin_lock_irqsave(fs->lock, flags); in quadfs_fsynth_disable()
546 CLKGEN_WRITE(fs, nsb[fs->chan], fs->data->standby_polarity); in quadfs_fsynth_disable()
548 if (fs->lock) in quadfs_fsynth_disable()
549 spin_unlock_irqrestore(fs->lock, flags); in quadfs_fsynth_disable()
554 struct st_clk_quadfs_fsynth *fs = to_quadfs_fsynth(hw); in quadfs_fsynth_is_enabled() local
555 u32 nsb = CLKGEN_READ(fs, nsb[fs->chan]); in quadfs_fsynth_is_enabled()
560 return fs->data->standby_polarity ? !nsb : !!nsb; in quadfs_fsynth_is_enabled()
566 const struct stm_fs *fs, unsigned long *rate) in clk_fs660c32_dig_get_rate() argument
568 unsigned long s = (1 << fs->sdiv); in clk_fs660c32_dig_get_rate()
580 ns = (fs->nsdiv == 1) ? 1 : 3; in clk_fs660c32_dig_get_rate()
582 res = (P20 * (32 + fs->mdiv) + 32 * fs->pe) * s * ns; in clk_fs660c32_dig_get_rate()
591 struct stm_fs *fs) in clk_fs660c32_get_pe() argument
616 fs->mdiv = m; in clk_fs660c32_get_pe()
617 fs->pe = (unsigned long)*p; in clk_fs660c32_get_pe()
618 fs->sdiv = si; in clk_fs660c32_get_pe()
619 fs->nsdiv = 1; in clk_fs660c32_get_pe()
626 unsigned long output, struct stm_fs *fs) in clk_fs660c32_dig_get_params() argument
642 input, output, &p1, fs); in clk_fs660c32_dig_get_params()
644 input, output, &p2, fs); in clk_fs660c32_dig_get_params()
653 input, output, &p, fs); in clk_fs660c32_dig_get_params()
662 fs_tmp.mdiv = fs->mdiv; in clk_fs660c32_dig_get_params()
663 fs_tmp.sdiv = fs->sdiv; in clk_fs660c32_dig_get_params()
664 fs_tmp.nsdiv = fs->nsdiv; in clk_fs660c32_dig_get_params()
666 if (fs->pe > 2) in clk_fs660c32_dig_get_params()
667 p2 = fs->pe - 2; in clk_fs660c32_dig_get_params()
671 for (; p2 < 32768ll && (p2 <= (fs->pe + 2)); p2++) { in clk_fs660c32_dig_get_params()
680 fs->pe = (unsigned long)p2; in clk_fs660c32_dig_get_params()
689 static int quadfs_fsynt_get_hw_value_for_recalc(struct st_clk_quadfs_fsynth *fs, in quadfs_fsynt_get_hw_value_for_recalc() argument
695 params->mdiv = CLKGEN_READ(fs, mdiv[fs->chan]); in quadfs_fsynt_get_hw_value_for_recalc()
696 params->pe = CLKGEN_READ(fs, pe[fs->chan]); in quadfs_fsynt_get_hw_value_for_recalc()
697 params->sdiv = CLKGEN_READ(fs, sdiv[fs->chan]); in quadfs_fsynt_get_hw_value_for_recalc()
699 if (fs->data->nsdiv_present) in quadfs_fsynt_get_hw_value_for_recalc()
700 params->nsdiv = CLKGEN_READ(fs, nsdiv[fs->chan]); in quadfs_fsynt_get_hw_value_for_recalc()
710 fs->md = params->mdiv; in quadfs_fsynt_get_hw_value_for_recalc()
711 fs->pe = params->pe; in quadfs_fsynt_get_hw_value_for_recalc()
712 fs->sdiv = params->sdiv; in quadfs_fsynt_get_hw_value_for_recalc()
713 fs->nsdiv = params->nsdiv; in quadfs_fsynt_get_hw_value_for_recalc()
721 struct st_clk_quadfs_fsynth *fs = to_quadfs_fsynth(hw); in quadfs_find_best_rate() local
727 clk_fs_get_rate = fs->data->get_rate; in quadfs_find_best_rate()
728 clk_fs_get_params = fs->data->get_params; in quadfs_find_best_rate()
739 struct st_clk_quadfs_fsynth *fs = to_quadfs_fsynth(hw); in quadfs_recalc_rate() local
745 clk_fs_get_rate = fs->data->get_rate; in quadfs_recalc_rate()
747 if (quadfs_fsynt_get_hw_value_for_recalc(fs, ¶ms)) in quadfs_recalc_rate()
776 static void quadfs_program_and_enable(struct st_clk_quadfs_fsynth *fs, in quadfs_program_and_enable() argument
779 fs->md = params->mdiv; in quadfs_program_and_enable()
780 fs->pe = params->pe; in quadfs_program_and_enable()
781 fs->sdiv = params->sdiv; in quadfs_program_and_enable()
782 fs->nsdiv = params->nsdiv; in quadfs_program_and_enable()
788 quadfs_fsynth_program_rate(fs); in quadfs_program_and_enable()
789 quadfs_fsynth_program_enable(fs); in quadfs_program_and_enable()
795 struct st_clk_quadfs_fsynth *fs = to_quadfs_fsynth(hw); in quadfs_set_rate() local
809 quadfs_program_and_enable(fs, ¶ms); in quadfs_set_rate()
830 struct st_clk_quadfs_fsynth *fs; in st_clk_register_quadfs_fsynth() local
840 fs = kzalloc(sizeof(*fs), GFP_KERNEL); in st_clk_register_quadfs_fsynth()
841 if (!fs) in st_clk_register_quadfs_fsynth()
850 fs->data = quadfs; in st_clk_register_quadfs_fsynth()
851 fs->regs_base = reg; in st_clk_register_quadfs_fsynth()
852 fs->chan = chan; in st_clk_register_quadfs_fsynth()
853 fs->lock = lock; in st_clk_register_quadfs_fsynth()
854 fs->hw.init = &init; in st_clk_register_quadfs_fsynth()
856 clk = clk_register(NULL, &fs->hw); in st_clk_register_quadfs_fsynth()
859 kfree(fs); in st_clk_register_quadfs_fsynth()