From: Karol Herbst <karolherbst-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
To: nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org
Subject: [PATCH 2/3] subdev/iccsense: Parse max and crit power level
Date: Mon, 24 Oct 2016 23:11:12 +0200 [thread overview]
Message-ID: <20161024211113.5876-3-karolherbst@gmail.com> (raw)
In-Reply-To: <20161024211113.5876-1-karolherbst-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Signed-off-by: Karol Herbst <karolherbst@gmail.com>
---
drm/nouveau/include/nvkm/subdev/iccsense.h | 3 +++
drm/nouveau/nvkm/subdev/iccsense/base.c | 13 ++++++++++++-
2 files changed, 15 insertions(+), 1 deletion(-)
diff --git a/drm/nouveau/include/nvkm/subdev/iccsense.h b/drm/nouveau/include/nvkm/subdev/iccsense.h
index 3c2ddd9..b7a9b04 100644
--- a/drm/nouveau/include/nvkm/subdev/iccsense.h
+++ b/drm/nouveau/include/nvkm/subdev/iccsense.h
@@ -8,6 +8,9 @@ struct nvkm_iccsense {
bool data_valid;
struct list_head sensors;
struct list_head rails;
+
+ u32 power_w_max;
+ u32 power_w_crit;
};
int gf100_iccsense_new(struct nvkm_device *, int index, struct nvkm_iccsense **);
diff --git a/drm/nouveau/nvkm/subdev/iccsense/base.c b/drm/nouveau/nvkm/subdev/iccsense/base.c
index 658355f..4e2b074 100644
--- a/drm/nouveau/nvkm/subdev/iccsense/base.c
+++ b/drm/nouveau/nvkm/subdev/iccsense/base.c
@@ -26,6 +26,7 @@
#include <subdev/bios.h>
#include <subdev/bios/extdev.h>
#include <subdev/bios/iccsense.h>
+#include <subdev/bios/power_budget.h>
#include <subdev/i2c.h>
static bool
@@ -216,10 +217,20 @@ nvkm_iccsense_oneinit(struct nvkm_subdev *subdev)
{
struct nvkm_iccsense *iccsense = nvkm_iccsense(subdev);
struct nvkm_bios *bios = subdev->device->bios;
+ struct nvbios_power_budget budget;
struct nvbios_iccsense stbl;
int i;
- if (!bios || nvbios_iccsense_parse(bios, &stbl) || !stbl.nr_entry)
+ if (!bios)
+ return 0;
+
+ if (!nvbios_power_budget_parse(bios, &budget) && budget.nr_entry &&
+ budget.cap_entry != 0xff) {
+ iccsense->power_w_max = budget.entries[budget.cap_entry].avg_w;
+ iccsense->power_w_crit = budget.entries[budget.cap_entry].max_w;
+ }
+
+ if (nvbios_iccsense_parse(bios, &stbl) || !stbl.nr_entry)
return 0;
iccsense->data_valid = true;
--
2.10.0
_______________________________________________
Nouveau mailing list
Nouveau@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/nouveau
next prev parent reply other threads:[~2016-10-24 21:11 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-10-24 21:11 RFC [PATCH 0/3] Expose power budget cap via hwmon Karol Herbst
[not found] ` <20161024211113.5876-1-karolherbst-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2016-10-24 21:11 ` [PATCH 1/3] nvbios/power_budget: Add basic power budget parsing Karol Herbst
[not found] ` <20161024211113.5876-2-karolherbst-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2016-10-25 5:25 ` Martin Peres
[not found] ` <992054de-6e21-0edb-ade2-ab135787d461-GANU6spQydw@public.gmane.org>
2016-10-25 6:04 ` Karol Herbst
2016-10-24 21:11 ` Karol Herbst [this message]
[not found] ` <20161024211113.5876-3-karolherbst-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2016-10-25 5:28 ` [PATCH 2/3] subdev/iccsense: Parse max and crit power level Martin Peres
[not found] ` <e62aa5a5-d856-4e6c-7fba-d56043ba498f-GANU6spQydw@public.gmane.org>
2016-10-25 6:06 ` Karol Herbst
2016-10-24 21:11 ` [PATCH 3/3] hwmon: expose power_max and power_crit Karol Herbst
[not found] ` <20161024211113.5876-4-karolherbst-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2016-10-25 5:33 ` Martin Peres
[not found] ` <a270c96c-d792-8dd1-eaea-b63fe3a61e3a-GANU6spQydw@public.gmane.org>
2016-10-25 6:22 ` Karol Herbst
2016-10-25 5:23 ` RFC [PATCH 0/3] Expose power budget cap via hwmon Martin Peres
-- strict thread matches above, loose matches on Subject: below --
2016-11-12 10:55 Karol Herbst
[not found] ` <20161112105532.5030-1-karolherbst-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2016-11-12 10:55 ` [PATCH 2/3] subdev/iccsense: Parse max and crit power level Karol Herbst
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20161024211113.5876-3-karolherbst@gmail.com \
--to=karolherbst-re5jqeeqqe8avxtiumwx3w@public.gmane.org \
--cc=nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.