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