Lines Matching +full:freq +full:- +full:domain
33 u32 freq; member
52 struct nvkm_device *device = clk->base.subdev.device; in read_vco()
62 struct nvkm_device *device = clk->base.subdev.device; in read_pll()
77 sclk = device->crystal; in read_pll()
108 struct nvkm_device *device = clk->base.subdev.device; in read_div()
115 return device->crystal; in read_div()
135 struct nvkm_device *device = clk->base.subdev.device; in read_mem()
147 struct nvkm_device *device = clk->base.subdev.device; in read_clk()
192 struct nvkm_subdev *subdev = &clk->base.subdev; in gk104_clk_read()
193 struct nvkm_device *device = subdev->device; in gk104_clk_read()
197 return device->crystal; in gk104_clk_read()
218 return -EINVAL; in gk104_clk_read()
223 calc_div(struct gk104_clk *clk, int idx, u32 ref, u32 freq, u32 *ddiv) in calc_div() argument
225 u32 div = min((ref * 2) / freq, (u32)65); in calc_div()
229 *ddiv = div - 2; in calc_div()
234 calc_src(struct gk104_clk *clk, int idx, u32 freq, u32 *dsrc, u32 *ddiv) in calc_src() argument
240 switch (freq) { in calc_src()
244 if (freq == 108000) in calc_src()
246 return freq; in calc_src()
249 return freq; in calc_src()
258 sclk = calc_div(clk, idx, sclk, freq, ddiv); in calc_src()
263 calc_pll(struct gk104_clk *clk, int idx, u32 freq, u32 *coef) in calc_pll() argument
265 struct nvkm_subdev *subdev = &clk->base.subdev; in calc_pll()
266 struct nvkm_bios *bios = subdev->device->bios; in calc_pll()
278 ret = gt215_pll_calc(subdev, &limits, freq, &N, NULL, &M, &P); in calc_pll()
290 struct gk104_clk_info *info = &clk->eng[idx]; in calc_clk()
291 u32 freq = cstate->domain[dom]; in calc_clk() local
295 /* invalid clock domain */ in calc_clk()
296 if (!freq) in calc_clk()
300 clk0 = calc_src(clk, idx, freq, &src0, &div0); in calc_clk()
301 clk0 = calc_div(clk, idx, clk0, freq, &div1D); in calc_clk()
304 if (clk0 != freq && (0x0000ff87 & (1 << idx))) { in calc_clk()
306 clk1 = calc_pll(clk, idx, freq, &info->coef); in calc_clk()
308 clk1 = cstate->domain[nv_clk_src_hubk06]; in calc_clk()
309 clk1 = calc_div(clk, idx, clk1, freq, &div1P); in calc_clk()
312 /* select the method which gets closest to target freq */ in calc_clk()
313 if (abs((int)freq - clk0) <= abs((int)freq - clk1)) { in calc_clk()
314 info->dsrc = src0; in calc_clk()
316 info->ddiv |= 0x80000000; in calc_clk()
317 info->ddiv |= div0; in calc_clk()
320 info->mdiv |= 0x80000000; in calc_clk()
321 info->mdiv |= div1D; in calc_clk()
323 info->ssel = 0; in calc_clk()
324 info->freq = clk0; in calc_clk()
327 info->mdiv |= 0x80000000; in calc_clk()
328 info->mdiv |= div1P << 8; in calc_clk()
330 info->ssel = (1 << idx); in calc_clk()
331 info->dsrc = 0x40000100; in calc_clk()
332 info->freq = clk1; in calc_clk()
359 struct gk104_clk_info *info = &clk->eng[idx]; in gk104_clk_prog_0()
360 struct nvkm_device *device = clk->base.subdev.device; in gk104_clk_prog_0()
361 if (!info->ssel) { in gk104_clk_prog_0()
362 nvkm_mask(device, 0x1371d0 + (idx * 0x04), 0x8000003f, info->ddiv); in gk104_clk_prog_0()
363 nvkm_wr32(device, 0x137160 + (idx * 0x04), info->dsrc); in gk104_clk_prog_0()
370 struct nvkm_device *device = clk->base.subdev.device; in gk104_clk_prog_1_0()
381 struct nvkm_device *device = clk->base.subdev.device; in gk104_clk_prog_1_1()
388 struct gk104_clk_info *info = &clk->eng[idx]; in gk104_clk_prog_2()
389 struct nvkm_device *device = clk->base.subdev.device; in gk104_clk_prog_2()
393 if (info->coef) { in gk104_clk_prog_2()
394 nvkm_wr32(device, addr + 0x04, info->coef); in gk104_clk_prog_2()
413 struct gk104_clk_info *info = &clk->eng[idx]; in gk104_clk_prog_3()
414 struct nvkm_device *device = clk->base.subdev.device; in gk104_clk_prog_3()
415 if (info->ssel) in gk104_clk_prog_3()
416 nvkm_mask(device, 0x137250 + (idx * 0x04), 0x00003f00, info->mdiv); in gk104_clk_prog_3()
418 nvkm_mask(device, 0x137250 + (idx * 0x04), 0x0000003f, info->mdiv); in gk104_clk_prog_3()
424 struct gk104_clk_info *info = &clk->eng[idx]; in gk104_clk_prog_4_0()
425 struct nvkm_device *device = clk->base.subdev.device; in gk104_clk_prog_4_0()
426 if (info->ssel) { in gk104_clk_prog_4_0()
427 nvkm_mask(device, 0x137100, (1 << idx), info->ssel); in gk104_clk_prog_4_0()
430 if (tmp == info->ssel) in gk104_clk_prog_4_0()
439 struct gk104_clk_info *info = &clk->eng[idx]; in gk104_clk_prog_4_1()
440 struct nvkm_device *device = clk->base.subdev.device; in gk104_clk_prog_4_1()
441 if (info->ssel) { in gk104_clk_prog_4_1()
466 for (j = 0; j < ARRAY_SIZE(clk->eng); j++) { in gk104_clk_prog()
469 if (!clk->eng[j].freq) in gk104_clk_prog()
482 memset(clk->eng, 0x00, sizeof(clk->eng)); in gk104_clk_tidy()
513 return -ENOMEM; in gk104_clk_new()
514 *pclk = &clk->base; in gk104_clk_new()
516 return nvkm_clk_ctor(&gk104_clk, device, type, inst, true, &clk->base); in gk104_clk_new()