[Nouveau] [Bug] Apple Gmux

2014-07-26 Thread Evan Foss
Hello,

Sorry I know this might be the wrong group to ask this in but I have
been having a lot of trouble switching off the nvidia chip in my
Macbook Pro 9,1. I have tried numerous things but there is a lot of
flawed documentation out there on this. I have a pile of info (dmesg,
kernel configs and etc) that I would like to submit as a bug reports
but no clear place to send it.

Who maintains the gmux kernel module? I can't find the proper mailing list.

I use nouveau right now but I need to switch off the nvidia chip
because of the heat/power it runs when I am not really needing it.

PS: Good work on the driver.
___
Nouveau mailing list
Nouveau@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/nouveau


[Nouveau] apple gmux

2014-07-26 Thread Evan Foss
Hello,

Sorry I know this might be the wrong group to ask this in but I have
been having a lot of trouble switching off the nvidia chip in my
Macbook Pro 9,1. I have tried numerous things but there is a lot of
flawed documentation out there on this. I have a pile of info (dmesg,
kernel configs and etc) that I would like to submit as a bug reports
but no clear place to send it.

Who maintains the gmux kernel module? I can't find the proper mailing list.

I use nouveau right now but I need to switch off the nvidia chip
because of the heat/power it runs when I am not really needing it.

PS: Good work on the driver.

-Evan Foss

-- 
http://forge.abcd.harvard.edu/gf/project/epl_engineering/wiki/
___
Nouveau mailing list
Nouveau@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/nouveau


[Nouveau] [PATCH] drm: platform: update moved Tegra header

2014-07-26 Thread Alexandre Courbot
From: Alexandre Courbot 

Header for tegra_powergate functions has moved to soc/tegra/pmc.h.

Signed-off-by: Alexandre Courbot 
---
 drm/nouveau_platform.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drm/nouveau_platform.c b/drm/nouveau_platform.c
index 72ab051..0ffeb50 100644
--- a/drm/nouveau_platform.c
+++ b/drm/nouveau_platform.c
@@ -27,7 +27,7 @@
 #include 
 #include 
 #include 
-#include 
+#include 
 
 #include "nouveau_drm.h"
 #include "nouveau_platform.h"
-- 
2.0.2

___
Nouveau mailing list
Nouveau@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/nouveau


[Nouveau] [PATCH v2 0/3] drm/gk20a: support for reclocking

2014-07-26 Thread Alexandre Courbot
Second version of the gk20a clock patches. I have tried to keep the therm and
volt devices mandatory in the clock driver, but unfortunately they are too tied
to bios to allow this, at least for the moment. Consequently this version is
mostly a port of the first version to Ben's tree.

Ben, please let me know what I have done wrong in terms of integration to your
tree, as the main purpose of writing patches against it instead of the kernel
is to make your life easier. :)

Alexandre Courbot (3):
  clk: make therm and volt devices optional
  clk: support for non-BIOS pstates
  gk20a: reclocking support

 drm/Kbuild  |   1 +
 drm/core/os.h   |   1 +
 drm/core/subdev/clock/gk20a.c   |   1 +
 drm/core/subdev/fb/ramgk20a.h   |   1 +
 drm/core/subdev/instmem/gk20a.c |   1 +
 lib/core/os.h   |  10 +
 nvkm/engine/device/nve0.c   |   1 +
 nvkm/include/subdev/clock.h |   9 +-
 nvkm/subdev/clock/Makefile.am   |   1 +
 nvkm/subdev/clock/base.c|  52 ++--
 nvkm/subdev/clock/gk20a.c   | 665 
 nvkm/subdev/clock/nv04.c|   4 +-
 nvkm/subdev/clock/nv40.c|   4 +-
 nvkm/subdev/clock/nv50.c|   2 +-
 nvkm/subdev/clock/nva3.c|   4 +-
 nvkm/subdev/clock/nvaa.c|   4 +-
 nvkm/subdev/clock/nvc0.c|   4 +-
 nvkm/subdev/clock/nve0.c|   4 +-
 18 files changed, 735 insertions(+), 34 deletions(-)
 create mode 12 drm/core/subdev/clock/gk20a.c
 create mode 12 drm/core/subdev/fb/ramgk20a.h
 create mode 12 drm/core/subdev/instmem/gk20a.c
 create mode 100644 nvkm/subdev/clock/gk20a.c

-- 
2.0.2

___
Nouveau mailing list
Nouveau@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/nouveau


[Nouveau] [PATCH v2 3/3] gk20a: reclocking support

2014-07-26 Thread Alexandre Courbot
From: Alexandre Courbot 

Add support for reclocking on GK20A, using a statically-defined pstates
table. The algorithms for calculating the coefficients and setting the
clocks are directly taken from the ChromeOS kernel.

Signed-off-by: Alexandre Courbot 
---
 drm/Kbuild  |   1 +
 drm/core/os.h   |   1 +
 drm/core/subdev/clock/gk20a.c   |   1 +
 drm/core/subdev/fb/ramgk20a.h   |   1 +
 drm/core/subdev/instmem/gk20a.c |   1 +
 lib/core/os.h   |  10 +
 nvkm/engine/device/nve0.c   |   1 +
 nvkm/include/subdev/clock.h |   1 +
 nvkm/subdev/clock/Makefile.am   |   1 +
 nvkm/subdev/clock/gk20a.c   | 665 
 10 files changed, 683 insertions(+)
 create mode 12 drm/core/subdev/clock/gk20a.c
 create mode 12 drm/core/subdev/fb/ramgk20a.h
 create mode 12 drm/core/subdev/instmem/gk20a.c
 create mode 100644 nvkm/subdev/clock/gk20a.c

diff --git a/drm/Kbuild b/drm/Kbuild
index bff9ed6..fcd915c 100644
--- a/drm/Kbuild
+++ b/drm/Kbuild
@@ -65,6 +65,7 @@ nouveau-y += core/subdev/clock/nva3.o
 nouveau-y += core/subdev/clock/nvaa.o
 nouveau-y += core/subdev/clock/nvc0.o
 nouveau-y += core/subdev/clock/nve0.o
+nouveau-y += core/subdev/clock/gk20a.o
 nouveau-y += core/subdev/clock/pllnv04.o
 nouveau-y += core/subdev/clock/pllnva3.o
 nouveau-y += core/subdev/devinit/base.o
diff --git a/drm/core/os.h b/drm/core/os.h
index e50decf..ccfa21d 100644
--- a/drm/core/os.h
+++ b/drm/core/os.h
@@ -22,6 +22,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 
diff --git a/drm/core/subdev/clock/gk20a.c b/drm/core/subdev/clock/gk20a.c
new file mode 12
index 000..87255ee
--- /dev/null
+++ b/drm/core/subdev/clock/gk20a.c
@@ -0,0 +1 @@
+../../../../nvkm/subdev/clock/gk20a.c
\ No newline at end of file
diff --git a/drm/core/subdev/fb/ramgk20a.h b/drm/core/subdev/fb/ramgk20a.h
new file mode 12
index 000..e55351b
--- /dev/null
+++ b/drm/core/subdev/fb/ramgk20a.h
@@ -0,0 +1 @@
+../../../../nvkm/subdev/fb/ramgk20a.h
\ No newline at end of file
diff --git a/drm/core/subdev/instmem/gk20a.c b/drm/core/subdev/instmem/gk20a.c
new file mode 12
index 000..17c79aa
--- /dev/null
+++ b/drm/core/subdev/instmem/gk20a.c
@@ -0,0 +1 @@
+../../../../nvkm/subdev/instmem/gk20a.c
\ No newline at end of file
diff --git a/lib/core/os.h b/lib/core/os.h
index c35b690..5f4f04f 100644
--- a/lib/core/os.h
+++ b/lib/core/os.h
@@ -1098,4 +1098,14 @@ struct notifier_block {
 #undef __BIG_ENDIAN
 #endif
 
+struct nouveau_platform_gpu {
+   void *clk;
+};
+
+struct nouveau_platform_device {
+   struct nouveau_platform_gpu *gpu;
+};
+
+#define nv_device_to_platform(x) NULL
+
 #endif
diff --git a/nvkm/engine/device/nve0.c b/nvkm/engine/device/nve0.c
index bc0dca9..6c243ae 100644
--- a/nvkm/engine/device/nve0.c
+++ b/nvkm/engine/device/nve0.c
@@ -158,6 +158,7 @@ nve0_identify(struct nouveau_device *device)
break;
case 0xea:
device->cname = "GK20A";
+   device->oclass[NVDEV_SUBDEV_CLOCK  ] = &gk20a_clock_oclass;
device->oclass[NVDEV_SUBDEV_MC ] =  gk20a_mc_oclass;
device->oclass[NVDEV_SUBDEV_BUS] =  nvc0_bus_oclass;
device->oclass[NVDEV_SUBDEV_TIMER  ] = &gk20a_timer_oclass;
diff --git a/nvkm/include/subdev/clock.h b/nvkm/include/subdev/clock.h
index a758147..0d30fa0 100644
--- a/nvkm/include/subdev/clock.h
+++ b/nvkm/include/subdev/clock.h
@@ -147,6 +147,7 @@ extern struct nouveau_oclass *nvaa_clock_oclass;
 extern struct nouveau_oclass nva3_clock_oclass;
 extern struct nouveau_oclass nvc0_clock_oclass;
 extern struct nouveau_oclass nve0_clock_oclass;
+extern struct nouveau_oclass gk20a_clock_oclass;
 
 int nv04_clock_pll_set(struct nouveau_clock *, u32 type, u32 freq);
 int nv04_clock_pll_calc(struct nouveau_clock *, struct nvbios_pll *,
diff --git a/nvkm/subdev/clock/Makefile.am b/nvkm/subdev/clock/Makefile.am
index fdc866d..4d2a1ef 100644
--- a/nvkm/subdev/clock/Makefile.am
+++ b/nvkm/subdev/clock/Makefile.am
@@ -9,6 +9,7 @@ libclock_la_SOURCES = base.c \
  nvaa.c \
  nvc0.c \
  nve0.c \
+ gk20a.c \
  pllnv04.c \
  pllnva3.c
 
diff --git a/nvkm/subdev/clock/gk20a.c b/nvkm/subdev/clock/gk20a.c
new file mode 100644
index 000..425a8d5
--- /dev/null
+++ b/nvkm/subdev/clock/gk20a.c
@@ -0,0 +1,665 @@
+/*
+ * Copyright (c) 2014, NVIDIA CORPORATION. All rights reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the follow

[Nouveau] [PATCH v2 2/3] clk: support for non-BIOS pstates

2014-07-26 Thread Alexandre Courbot
From: Alexandre Courbot 

Make nouveau_clock_create() take new two optional arguments: an array
of pstates and its size. When these are specified,
nouveau_clock_create() will use the provided pstates instead of
probing them using the BIOS.

This is useful for platforms which do not provide a BIOS, like Tegra.

Signed-off-by: Alexandre Courbot 
---
 nvkm/include/subdev/clock.h |  8 +---
 nvkm/subdev/clock/base.c| 16 
 nvkm/subdev/clock/nv04.c|  4 ++--
 nvkm/subdev/clock/nv40.c|  4 ++--
 nvkm/subdev/clock/nv50.c|  2 +-
 nvkm/subdev/clock/nva3.c|  4 ++--
 nvkm/subdev/clock/nvaa.c|  4 ++--
 nvkm/subdev/clock/nvc0.c|  4 ++--
 nvkm/subdev/clock/nve0.c|  4 ++--
 9 files changed, 30 insertions(+), 20 deletions(-)

diff --git a/nvkm/include/subdev/clock.h b/nvkm/include/subdev/clock.h
index 9f37c09..a758147 100644
--- a/nvkm/include/subdev/clock.h
+++ b/nvkm/include/subdev/clock.h
@@ -115,8 +115,9 @@ struct nouveau_clocks {
int mdiv;
 };
 
-#define nouveau_clock_create(p,e,o,i,r,d)  
\
-   nouveau_clock_create_((p), (e), (o), (i), (r), sizeof(**d), (void **)d)
+#define nouveau_clock_create(p,e,o,i,r,s,n,d)  
\
+   nouveau_clock_create_((p), (e), (o), (i), (r), (s), (n), sizeof(**d),  \
+ (void **)d)
 #define nouveau_clock_destroy(p) ({
\
struct nouveau_clock *clk = (p);   \
_nouveau_clock_dtor(nv_object(clk));   \
@@ -132,7 +133,8 @@ struct nouveau_clocks {
 
 int  nouveau_clock_create_(struct nouveau_object *, struct nouveau_object *,
   struct nouveau_oclass *,
-  struct nouveau_clocks *, bool, int, void **);
+  struct nouveau_clocks *, struct nouveau_pstate *,
+  int, bool, int, void **);
 void _nouveau_clock_dtor(struct nouveau_object *);
 int  _nouveau_clock_init(struct nouveau_object *);
 int  _nouveau_clock_fini(struct nouveau_object *, bool);
diff --git a/nvkm/subdev/clock/base.c b/nvkm/subdev/clock/base.c
index 508639d..d3f70d8 100644
--- a/nvkm/subdev/clock/base.c
+++ b/nvkm/subdev/clock/base.c
@@ -534,6 +534,7 @@ nouveau_clock_create_(struct nouveau_object *parent,
  struct nouveau_object *engine,
  struct nouveau_oclass *oclass,
  struct nouveau_clocks *clocks,
+ struct nouveau_pstate *pstates, int nb_pstates,
  bool allow_reclock,
  int length, void **object)
 {
@@ -557,10 +558,17 @@ nouveau_clock_create_(struct nouveau_object *parent,
init_waitqueue_head(&clk->wait);
atomic_set(&clk->waiting, 0);
 
-   idx = 0;
-   do {
-   ret = nouveau_pstate_new(clk, idx++);
-   } while (ret == 0);
+   /* If no pstates are provided, try and fetch them from the BIOS */
+   if (!pstates) {
+   idx = 0;
+   do {
+   ret = nouveau_pstate_new(clk, idx++);
+   } while (ret == 0);
+   } else {
+   for (idx = 0; idx < nb_pstates; idx++)
+   list_add_tail(&pstates[idx].head, &clk->states);
+   clk->state_nr = nb_pstates;
+   }
 
clk->allow_reclock = allow_reclock;
 
diff --git a/nvkm/subdev/clock/nv04.c b/nvkm/subdev/clock/nv04.c
index eb2d442..4c48232 100644
--- a/nvkm/subdev/clock/nv04.c
+++ b/nvkm/subdev/clock/nv04.c
@@ -82,8 +82,8 @@ nv04_clock_ctor(struct nouveau_object *parent, struct 
nouveau_object *engine,
struct nv04_clock_priv *priv;
int ret;
 
-   ret = nouveau_clock_create(parent, engine, oclass, nv04_domain, false,
-  &priv);
+   ret = nouveau_clock_create(parent, engine, oclass, nv04_domain, NULL, 0,
+  false, &priv);
*pobject = nv_object(priv);
if (ret)
return ret;
diff --git a/nvkm/subdev/clock/nv40.c b/nvkm/subdev/clock/nv40.c
index 8a9e168..08368fe 100644
--- a/nvkm/subdev/clock/nv40.c
+++ b/nvkm/subdev/clock/nv40.c
@@ -213,8 +213,8 @@ nv40_clock_ctor(struct nouveau_object *parent, struct 
nouveau_object *engine,
struct nv40_clock_priv *priv;
int ret;
 
-   ret = nouveau_clock_create(parent, engine, oclass, nv40_domain, true,
-  &priv);
+   ret = nouveau_clock_create(parent, engine, oclass, nv40_domain, NULL, 0,
+  true, &priv);
*pobject = nv_object(priv);
if (ret)
return ret;
diff --git a/nvkm/subdev/clock/nv50.c b/nvkm/subdev/clock/nv50.c
index 8c13277..5070ebc 100644
--- a/nvkm/subdev/clock/nv50.c
+++ b/nvkm/subdev/clock/nv50.c
@@ -507,7 +507,7 @@ nv50_clock_ctor(struct nouveau_object *parent, struct 
nouvea

[Nouveau] [PATCH v2 1/3] clk: make therm and volt devices optional

2014-07-26 Thread Alexandre Courbot
From: Alexandre Courbot 

Allow the clock subsystem to operate even if voltage and thermal devices
are not set for the device (for people with watercooling! ;))

Signed-off-by: Alexandre Courbot 
---
 nvkm/subdev/clock/base.c | 36 ++--
 1 file changed, 22 insertions(+), 14 deletions(-)

diff --git a/nvkm/subdev/clock/base.c b/nvkm/subdev/clock/base.c
index 3ad848b..508639d 100644
--- a/nvkm/subdev/clock/base.c
+++ b/nvkm/subdev/clock/base.c
@@ -90,16 +90,20 @@ nouveau_cstate_prog(struct nouveau_clock *clk,
cstate = &pstate->base;
}
 
-   ret = nouveau_therm_cstate(ptherm, pstate->fanspeed, +1);
-   if (ret && ret != -ENODEV) {
-   nv_error(clk, "failed to raise fan speed: %d\n", ret);
-   return ret;
+   if (ptherm) {
+   ret = nouveau_therm_cstate(ptherm, pstate->fanspeed, +1);
+   if (ret && ret != -ENODEV) {
+   nv_error(clk, "failed to raise fan speed: %d\n", ret);
+   return ret;
+   }
}
 
-   ret = volt->set_id(volt, cstate->voltage, +1);
-   if (ret && ret != -ENODEV) {
-   nv_error(clk, "failed to raise voltage: %d\n", ret);
-   return ret;
+   if (volt) {
+   ret = volt->set_id(volt, cstate->voltage, +1);
+   if (ret && ret != -ENODEV) {
+   nv_error(clk, "failed to raise voltage: %d\n", ret);
+   return ret;
+   }
}
 
ret = clk->calc(clk, cstate);
@@ -108,13 +112,17 @@ nouveau_cstate_prog(struct nouveau_clock *clk,
clk->tidy(clk);
}
 
-   ret = volt->set_id(volt, cstate->voltage, -1);
-   if (ret && ret != -ENODEV)
-   nv_error(clk, "failed to lower voltage: %d\n", ret);
+   if (volt) {
+   ret = volt->set_id(volt, cstate->voltage, -1);
+   if (ret && ret != -ENODEV)
+   nv_error(clk, "failed to lower voltage: %d\n", ret);
+   }
 
-   ret = nouveau_therm_cstate(ptherm, pstate->fanspeed, -1);
-   if (ret && ret != -ENODEV)
-   nv_error(clk, "failed to lower fan speed: %d\n", ret);
+   if (ptherm) {
+   ret = nouveau_therm_cstate(ptherm, pstate->fanspeed, -1);
+   if (ret && ret != -ENODEV)
+   nv_error(clk, "failed to lower fan speed: %d\n", ret);
+   }
 
return 0;
 }
-- 
2.0.2

___
Nouveau mailing list
Nouveau@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/nouveau