Lines Matching +full:src +full:- +full:coef
38 u32 coef; 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()
64 u32 coef = nvkm_rd32(device, pll + 0x04); in read_pll() local
65 u32 P = (coef & 0x003f0000) >> 16; in read_pll()
66 u32 N = (coef & 0x0000ff00) >> 8; in read_pll()
67 u32 M = (coef & 0x000000ff) >> 0; in read_pll()
77 sclk = device->crystal; in read_pll()
82 P = (coef & 0x10000000) ? 2 : 1; 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()
189 gk104_clk_read(struct nvkm_clk *base, enum nv_clk_src src) in gk104_clk_read() argument
192 struct nvkm_subdev *subdev = &clk->base.subdev; in gk104_clk_read()
193 struct nvkm_device *device = subdev->device; in gk104_clk_read()
195 switch (src) { in gk104_clk_read()
197 return device->crystal; in gk104_clk_read()
217 nvkm_error(subdev, "invalid clock source %d\n", src); in gk104_clk_read()
218 return -EINVAL; in gk104_clk_read()
229 *ddiv = div - 2; in calc_div()
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()
282 *coef = (P << 16) | (N << 8) | M; in calc_pll()
290 struct gk104_clk_info *info = &clk->eng[idx]; in calc_clk()
291 u32 freq = cstate->domain[dom]; 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()
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()