Lines Matching refs:fs

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