Lines Matching +full:src +full:- +full:coef

38 	u32 coef;  member
51 struct nvkm_device *device = clk->base.subdev.device; in read_vco()
54 return nvkm_clk_read(&clk->base, nv_clk_src_sppll0); in read_vco()
55 return nvkm_clk_read(&clk->base, nv_clk_src_sppll1); in read_vco()
61 struct nvkm_device *device = clk->base.subdev.device; in read_pll()
63 u32 coef = nvkm_rd32(device, pll + 0x04); in read_pll() local
64 u32 P = (coef & 0x003f0000) >> 16; in read_pll()
65 u32 N = (coef & 0x0000ff00) >> 8; in read_pll()
66 u32 M = (coef & 0x000000ff) >> 0; in read_pll()
75 sclk = device->crystal; in read_pll()
79 sclk = nvkm_clk_read(&clk->base, nv_clk_src_mpllsrc); in read_pll()
82 sclk = nvkm_clk_read(&clk->base, nv_clk_src_mpllsrcref); in read_pll()
100 struct nvkm_device *device = clk->base.subdev.device; in read_div()
107 return device->crystal; in read_div()
135 struct nvkm_device *device = clk->base.subdev.device; in read_clk()
158 gf100_clk_read(struct nvkm_clk *base, enum nv_clk_src src) in gf100_clk_read() argument
161 struct nvkm_subdev *subdev = &clk->base.subdev; in gf100_clk_read()
162 struct nvkm_device *device = subdev->device; in gf100_clk_read()
164 switch (src) { in gf100_clk_read()
166 return device->crystal; in gf100_clk_read()
184 return nvkm_clk_read(&clk->base, nv_clk_src_mpll); in gf100_clk_read()
185 return nvkm_clk_read(&clk->base, nv_clk_src_mdiv); in gf100_clk_read()
204 nvkm_error(subdev, "invalid clock source %d\n", src); in gf100_clk_read()
205 return -EINVAL; in gf100_clk_read()
216 *ddiv = div - 2; in calc_div()
250 calc_pll(struct gf100_clk *clk, int idx, u32 freq, u32 *coef) in calc_pll() argument
252 struct nvkm_subdev *subdev = &clk->base.subdev; in calc_pll()
253 struct nvkm_bios *bios = subdev->device->bios; in calc_pll()
269 *coef = (P << 16) | (N << 8) | M; in calc_pll()
276 struct gf100_clk_info *info = &clk->eng[idx]; in calc_clk()
277 u32 freq = cstate->domain[dom]; in calc_clk()
292 clk1 = calc_pll(clk, idx, freq, &info->coef); in calc_clk()
294 clk1 = cstate->domain[nv_clk_src_hubk06]; in calc_clk()
299 if (abs((int)freq - clk0) <= abs((int)freq - clk1)) { in calc_clk()
300 info->dsrc = src0; in calc_clk()
302 info->ddiv |= 0x80000000; in calc_clk()
303 info->ddiv |= div0 << 8; in calc_clk()
304 info->ddiv |= div0; in calc_clk()
307 info->mdiv |= 0x80000000; in calc_clk()
308 info->mdiv |= div1D; in calc_clk()
310 info->ssel = info->coef = 0; in calc_clk()
311 info->freq = clk0; in calc_clk()
314 info->mdiv |= 0x80000000; in calc_clk()
315 info->mdiv |= div1P << 8; in calc_clk()
317 info->ssel = (1 << idx); in calc_clk()
318 info->freq = clk1; in calc_clk()
346 struct gf100_clk_info *info = &clk->eng[idx]; in gf100_clk_prog_0()
347 struct nvkm_device *device = clk->base.subdev.device; in gf100_clk_prog_0()
348 if (idx < 7 && !info->ssel) { in gf100_clk_prog_0()
349 nvkm_mask(device, 0x1371d0 + (idx * 0x04), 0x80003f3f, info->ddiv); in gf100_clk_prog_0()
350 nvkm_wr32(device, 0x137160 + (idx * 0x04), info->dsrc); in gf100_clk_prog_0()
357 struct nvkm_device *device = clk->base.subdev.device; in gf100_clk_prog_1()
368 struct gf100_clk_info *info = &clk->eng[idx]; in gf100_clk_prog_2()
369 struct nvkm_device *device = clk->base.subdev.device; in gf100_clk_prog_2()
374 if (info->coef) { in gf100_clk_prog_2()
375 nvkm_wr32(device, addr + 0x04, info->coef); in gf100_clk_prog_2()
395 struct gf100_clk_info *info = &clk->eng[idx]; in gf100_clk_prog_3()
396 struct nvkm_device *device = clk->base.subdev.device; in gf100_clk_prog_3()
397 if (info->ssel) { in gf100_clk_prog_3()
398 nvkm_mask(device, 0x137100, (1 << idx), info->ssel); in gf100_clk_prog_3()
401 if (tmp == info->ssel) in gf100_clk_prog_3()
410 struct gf100_clk_info *info = &clk->eng[idx]; in gf100_clk_prog_4()
411 struct nvkm_device *device = clk->base.subdev.device; in gf100_clk_prog_4()
412 nvkm_mask(device, 0x137250 + (idx * 0x04), 0x00003f3f, info->mdiv); in gf100_clk_prog_4()
431 for (j = 0; j < ARRAY_SIZE(clk->eng); j++) { in gf100_clk_prog()
432 if (!clk->eng[j].freq) in gf100_clk_prog()
445 memset(clk->eng, 0x00, sizeof(clk->eng)); in gf100_clk_tidy()
477 return -ENOMEM; in gf100_clk_new()
478 *pclk = &clk->base; in gf100_clk_new()
480 return nvkm_clk_ctor(&gf100_clk, device, type, inst, false, &clk->base); in gf100_clk_new()