xref: /linux/drivers/gpu/drm/nouveau/nvkm/subdev/volt/gm20b.c (revision fbc872c38c8fed31948c85683b5326ee5ab9fccc)
1 /*
2  * Copyright (c) 2016, NVIDIA CORPORATION. All rights reserved.
3  *
4  * Permission is hereby granted, free of charge, to any person obtaining a
5  * copy of this software and associated documentation files (the "Software"),
6  * to deal in the Software without restriction, including without limitation
7  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8  * and/or sell copies of the Software, and to permit persons to whom the
9  * Software is furnished to do so, subject to the following conditions:
10  *
11  * The above copyright notice and this permission notice shall be included in
12  * all copies or substantial portions of the Software.
13  *
14  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
17  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20  * DEALINGS IN THE SOFTWARE.
21  */
22 
23 #include "priv.h"
24 #include "gk20a.h"
25 
26 #include <core/tegra.h>
27 
28 const struct cvb_coef gm20b_cvb_coef[] = {
29 	/* KHz,             c0,      c1,   c2 */
30 	/*  76800 */ { 1786666,  -85625, 1632 },
31 	/* 153600 */ { 1846729,  -87525, 1632 },
32 	/* 230400 */ { 1910480,  -89425, 1632 },
33 	/* 307200 */ { 1977920,  -91325, 1632 },
34 	/* 384000 */ { 2049049,  -93215, 1632 },
35 	/* 460800 */ { 2122872,  -95095, 1632 },
36 	/* 537600 */ { 2201331,  -96985, 1632 },
37 	/* 614400 */ { 2283479,  -98885, 1632 },
38 	/* 691200 */ { 2369315, -100785, 1632 },
39 	/* 768000 */ { 2458841, -102685, 1632 },
40 	/* 844800 */ { 2550821, -104555, 1632 },
41 	/* 921600 */ { 2647676, -106455, 1632 },
42 };
43 
44 int
45 gm20b_volt_new(struct nvkm_device *device, int index, struct nvkm_volt **pvolt)
46 {
47 	struct gk20a_volt *volt;
48 
49 	volt = kzalloc(sizeof(*volt), GFP_KERNEL);
50 	if (!volt)
51 		return -ENOMEM;
52 	*pvolt = &volt->base;
53 
54 	return _gk20a_volt_ctor(device, index, gm20b_cvb_coef,
55 				ARRAY_SIZE(gm20b_cvb_coef), volt);
56 }
57