提交 1efc3c4b 编写于 作者: K Karol Herbst 提交者: Ben Skeggs

drm/nouveau/iccsense: Parse max and crit power level

Signed-off-by: NKarol Herbst <karolherbst@gmail.com>
Signed-off-by: NBen Skeggs <bskeggs@redhat.com>
上级 e5f8eabc
...@@ -8,6 +8,9 @@ struct nvkm_iccsense { ...@@ -8,6 +8,9 @@ struct nvkm_iccsense {
bool data_valid; bool data_valid;
struct list_head sensors; struct list_head sensors;
struct list_head rails; struct list_head rails;
u32 power_w_max;
u32 power_w_crit;
}; };
int gf100_iccsense_new(struct nvkm_device *, int index, struct nvkm_iccsense **); int gf100_iccsense_new(struct nvkm_device *, int index, struct nvkm_iccsense **);
......
...@@ -26,6 +26,7 @@ ...@@ -26,6 +26,7 @@
#include <subdev/bios.h> #include <subdev/bios.h>
#include <subdev/bios/extdev.h> #include <subdev/bios/extdev.h>
#include <subdev/bios/iccsense.h> #include <subdev/bios/iccsense.h>
#include <subdev/bios/power_budget.h>
#include <subdev/i2c.h> #include <subdev/i2c.h>
static bool static bool
...@@ -216,10 +217,25 @@ nvkm_iccsense_oneinit(struct nvkm_subdev *subdev) ...@@ -216,10 +217,25 @@ nvkm_iccsense_oneinit(struct nvkm_subdev *subdev)
{ {
struct nvkm_iccsense *iccsense = nvkm_iccsense(subdev); struct nvkm_iccsense *iccsense = nvkm_iccsense(subdev);
struct nvkm_bios *bios = subdev->device->bios; struct nvkm_bios *bios = subdev->device->bios;
struct nvbios_power_budget budget;
struct nvbios_iccsense stbl; struct nvbios_iccsense stbl;
int i; int i, ret;
if (!bios || nvbios_iccsense_parse(bios, &stbl) || !stbl.nr_entry) if (!bios)
return 0;
ret = nvbios_power_budget_header(bios, &budget);
if (!ret && budget.cap_entry != 0xff) {
struct nvbios_power_budget_entry entry;
ret = nvbios_power_budget_entry(bios, &budget,
budget.cap_entry, &entry);
if (!ret) {
iccsense->power_w_max = entry.avg_w;
iccsense->power_w_crit = entry.max_w;
}
}
if (nvbios_iccsense_parse(bios, &stbl) || !stbl.nr_entry)
return 0; return 0;
iccsense->data_valid = true; iccsense->data_valid = true;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册