* [Patch] Add a way to list the available voltages
@ 2010-11-22 9:13 Martin Peres
0 siblings, 0 replies; only message in thread
From: Martin Peres @ 2010-11-22 9:13 UTC (permalink / raw)
To: nouveau
[-- Attachment #1: Type: text/plain, Size: 214 bytes --]
Hi,
This patch makes it easy for people to set their custom_voltage file.
Previously, they had to guess what was the available voltages.
This patch depends on my previous patch to add a custom perflvl.
Martin
[-- Attachment #2: 0001-Add-a-way-to-list-the-available-voltages-through-sys.patch --]
[-- Type: text/x-patch, Size: 2202 bytes --]
From e9c880e0882bb609a9ce4ec0bf28ef99ea78714a Mon Sep 17 00:00:00 2001
From: Martin Peres <mupuf-IIUFz0z94vfYtjvyW6yDsg@public.gmane.org>
Date: Mon, 22 Nov 2010 09:59:16 +0100
Subject: [PATCH] Add a way to list the available voltages through sysfs
Signed-off-by: Martin Peres <martin.peres-Iz16wY1oaNPLSKGbIzaifA@public.gmane.org>
---
drivers/gpu/drm/nouveau/nouveau_pm.c | 32 ++++++++++++++++++++++++++++++++
1 files changed, 32 insertions(+), 0 deletions(-)
diff --git a/drivers/gpu/drm/nouveau/nouveau_pm.c b/drivers/gpu/drm/nouveau/nouveau_pm.c
index 49d8a17..b0d0691 100644
--- a/drivers/gpu/drm/nouveau/nouveau_pm.c
+++ b/drivers/gpu/drm/nouveau/nouveau_pm.c
@@ -412,6 +412,33 @@ static DEVICE_ATTR(custom_voltage, S_IRUGO | S_IWUSR,
nouveau_pm_get_custom_voltage,
nouveau_pm_set_custom_voltage);
+static ssize_t
+nouveau_pm_get_voltages(struct device *d, struct device_attribute *a, char *buf)
+{
+ struct drm_device *dev = pci_get_drvdata(to_pci_dev(d));
+ struct drm_nouveau_private *dev_priv = dev->dev_private;
+ struct nouveau_pm_engine *pm = &dev_priv->engine.pm;
+ struct nouveau_pm_voltage *volt = &pm->voltage;
+ int cur_voltage = nouveau_voltage_gpio_get(dev);
+ char *ptr = buf;
+ int len = PAGE_SIZE;
+ int i;
+
+ for (i = 0; i < volt->nr_level; i++) {
+ int size = snprintf(ptr, len, "%c %d [*10mV]\n",
+ cur_voltage == volt->level[i].voltage ? '*' : ' ',
+ volt->level[i].voltage
+ );
+
+ ptr += size;
+ len -= size;
+ }
+
+ return strlen(buf);
+}
+
+static DEVICE_ATTR(voltages, S_IRUGO, nouveau_pm_get_voltages, NULL);
+
static int
nouveau_sysfs_init(struct drm_device *dev)
{
@@ -463,6 +490,10 @@ nouveau_sysfs_init(struct drm_device *dev)
if (ret)
return ret;
+ ret = device_create_file(d, &dev_attr_voltages);
+ if (ret)
+ return ret;
+
return 0;
}
@@ -488,6 +519,7 @@ nouveau_sysfs_fini(struct drm_device *dev)
device_remove_file(d, &dev_attr_custom_shader);
device_remove_file(d, &dev_attr_custom_unk05);
device_remove_file(d, &dev_attr_custom_voltage);
+ device_remove_file(d, &dev_attr_voltages);
}
#ifdef CONFIG_HWMON
--
1.7.3.2
[-- Attachment #3: Type: text/plain, Size: 181 bytes --]
_______________________________________________
Nouveau mailing list
Nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org
http://lists.freedesktop.org/mailman/listinfo/nouveau
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2010-11-22 9:13 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-11-22 9:13 [Patch] Add a way to list the available voltages Martin Peres
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.