diff options
author | Vijayakumar Subbu <vsubbu@nvidia.com> | 2016-07-28 01:29:15 -0400 |
---|---|---|
committer | mobile promotions <svcmobile_promotions@nvidia.com> | 2016-09-29 16:17:46 -0400 |
commit | b17d9708c9e9930778de43de1edf1385acb13ebd (patch) | |
tree | fc485e96cc19575d463c61c8b80a09dd89745f3f /drivers/gpu/nvgpu/boardobj/boardobj.c | |
parent | 27b47b1969d7d9cdd3de9fd6f0131ad357f4b0fa (diff) |
gpu: nvgpu: Add dGPU clocks support
JIRA DNVGPU-45
Change-Id: I237ce81e31b036c05c82d46eea8694ffe1c2e3df
Signed-off-by: Mahantesh Kumbar <mkumbar@nvidia.com>
Signed-off-by: Vijayakumar Subbu <vsubbu@nvidia.com>
Reviewed-on: http://git-master/r/1205849
(cherry picked from commit 9a4006f76b75a8ad525e7aa5ad1f609aaae49126)
Reviewed-on: http://git-master/r/1227256
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Diffstat (limited to 'drivers/gpu/nvgpu/boardobj/boardobj.c')
-rw-r--r-- | drivers/gpu/nvgpu/boardobj/boardobj.c | 80 |
1 files changed, 80 insertions, 0 deletions
diff --git a/drivers/gpu/nvgpu/boardobj/boardobj.c b/drivers/gpu/nvgpu/boardobj/boardobj.c new file mode 100644 index 00000000..86b639cc --- /dev/null +++ b/drivers/gpu/nvgpu/boardobj/boardobj.c | |||
@@ -0,0 +1,80 @@ | |||
1 | /* | ||
2 | * Copyright (c) 2016, NVIDIA CORPORATION. All rights reserved. | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or modify it | ||
5 | * under the terms and conditions of the GNU General Public License, | ||
6 | * version 2, as published by the Free Software Foundation. | ||
7 | * | ||
8 | * This program is distributed in the hope it will be useful, but WITHOUT | ||
9 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
10 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
11 | * more details. | ||
12 | */ | ||
13 | |||
14 | #include "gk20a/gk20a.h" | ||
15 | #include <linux/firmware.h> | ||
16 | #include <linux/module.h> | ||
17 | #include <linux/uaccess.h> | ||
18 | #include "boardobj.h" | ||
19 | #include "ctrl/ctrlboardobj.h" | ||
20 | #include "pmuif/gpmuifboardobj.h" | ||
21 | |||
22 | |||
23 | u32 boardobj_construct_super(struct gk20a *g, struct boardobj **ppboardobj, | ||
24 | u16 size, void *args) | ||
25 | { | ||
26 | struct boardobj *pboardobj = NULL; | ||
27 | struct boardobj *devtmp = (struct boardobj *)args; | ||
28 | |||
29 | gk20a_dbg_info(" "); | ||
30 | |||
31 | if (devtmp == NULL) | ||
32 | return -EINVAL; | ||
33 | |||
34 | if (*ppboardobj == NULL) { | ||
35 | *ppboardobj = kzalloc(size, GFP_KERNEL); | ||
36 | if (ppboardobj == NULL) | ||
37 | return -ENOMEM; | ||
38 | } | ||
39 | |||
40 | pboardobj = *ppboardobj; | ||
41 | pboardobj->type = devtmp->type; | ||
42 | pboardobj->idx = CTRL_BOARDOBJ_IDX_INVALID; | ||
43 | pboardobj->type_mask = BIT(pboardobj->type) | devtmp->type_mask; | ||
44 | |||
45 | pboardobj->implements = boardobj_implements_super; | ||
46 | pboardobj->destruct = boardobj_destruct_super; | ||
47 | pboardobj->pmudatainit = boardobj_pmudatainit_super; | ||
48 | |||
49 | return 0; | ||
50 | } | ||
51 | |||
52 | u32 boardobj_destruct_super(struct boardobj *pboardobj) | ||
53 | { | ||
54 | gk20a_dbg_info(""); | ||
55 | if (pboardobj == NULL) | ||
56 | return -EINVAL; | ||
57 | kfree(pboardobj); | ||
58 | return 0; | ||
59 | } | ||
60 | |||
61 | bool boardobj_implements_super(struct gk20a *g, struct boardobj *pboardobj, | ||
62 | u8 type) | ||
63 | { | ||
64 | gk20a_dbg_info(""); | ||
65 | |||
66 | return (0 != (pboardobj->type_mask & BIT(type))); | ||
67 | } | ||
68 | |||
69 | u32 boardobj_pmudatainit_super(struct gk20a *g, struct boardobj *pboardobj, | ||
70 | struct nv_pmu_boardobj *pmudata) | ||
71 | { | ||
72 | gk20a_dbg_info(""); | ||
73 | if (pboardobj == NULL) | ||
74 | return -EINVAL; | ||
75 | if (pmudata == NULL) | ||
76 | return -EINVAL; | ||
77 | pmudata->type = pboardobj->type; | ||
78 | gk20a_dbg_info(" Done"); | ||
79 | return 0; | ||
80 | } | ||