Re: [RESEND PATCH nouveau 2/3] volt: allow non-bios voltage scaling

2014-12-01 Thread Martin Peres

On 29/11/2014 09:22, Alexandre Courbot wrote:

On Fri, Nov 28, 2014 at 8:12 PM, Vince Hsu  wrote:

Signed-off-by: Vince Hsu 

Make sure you always write a short summary for your patches, even if
the title sounds sufficient.


I agree. Something like "Move the vbios parsing out of init() and
call it conditionally if the platform has a vbios. Non-vbios platforms
can use the ctor() to init the data structures.".


At the very least this patch makes the code easier to read, so:

Acked-by: Alexandre Courbot 

Acked-by: Martin Peres 
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [RESEND PATCH nouveau 2/3] volt: allow non-bios voltage scaling

2014-12-01 Thread Martin Peres

On 29/11/2014 09:22, Alexandre Courbot wrote:

On Fri, Nov 28, 2014 at 8:12 PM, Vince Hsu vin...@nvidia.com wrote:

Signed-off-by: Vince Hsu vin...@nvidia.com

Make sure you always write a short summary for your patches, even if
the title sounds sufficient.


I agree. Something like Move the vbios parsing out of init() and
call it conditionally if the platform has a vbios. Non-vbios platforms
can use the ctor() to init the data structures..


At the very least this patch makes the code easier to read, so:

Acked-by: Alexandre Courbot acour...@nvidia.com

Acked-by: Martin Peres martin.pe...@free.fr
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [RESEND PATCH nouveau 2/3] volt: allow non-bios voltage scaling

2014-11-29 Thread Alexandre Courbot
On Fri, Nov 28, 2014 at 8:12 PM, Vince Hsu  wrote:
> Signed-off-by: Vince Hsu 

Make sure you always write a short summary for your patches, even if
the title sounds sufficient.

At the very least this patch makes the code easier to read, so:

Acked-by: Alexandre Courbot 
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [RESEND PATCH nouveau 2/3] volt: allow non-bios voltage scaling

2014-11-29 Thread Alexandre Courbot
On Fri, Nov 28, 2014 at 8:12 PM, Vince Hsu vin...@nvidia.com wrote:
 Signed-off-by: Vince Hsu vin...@nvidia.com

Make sure you always write a short summary for your patches, even if
the title sounds sufficient.

At the very least this patch makes the code easier to read, so:

Acked-by: Alexandre Courbot acour...@nvidia.com
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[RESEND PATCH nouveau 2/3] volt: allow non-bios voltage scaling

2014-11-28 Thread Vince Hsu
Signed-off-by: Vince Hsu 
---

Resend this patch with the fuse change and proper patch prefix
per Thierry's request.

 nvkm/subdev/volt/base.c | 67 -
 1 file changed, 38 insertions(+), 29 deletions(-)

diff --git a/nvkm/subdev/volt/base.c b/nvkm/subdev/volt/base.c
index 32794a999106..26ccd8df193f 100644
--- a/nvkm/subdev/volt/base.c
+++ b/nvkm/subdev/volt/base.c
@@ -101,6 +101,41 @@ nouveau_volt_set_id(struct nouveau_volt *volt, u8 id, int 
condition)
return ret;
 }
 
+static void nouveau_volt_parse_bios(struct nouveau_bios *bios,
+   struct nouveau_volt *volt)
+{
+   struct nvbios_volt_entry ivid;
+   struct nvbios_volt info;
+   u8  ver, hdr, cnt, len;
+   u16 data;
+   int i;
+
+   data = nvbios_volt_parse(bios, , , , , );
+   if (data && info.vidmask && info.base && info.step) {
+   for (i = 0; i < info.vidmask + 1; i++) {
+   if (info.base >= info.min &&
+   info.base <= info.max) {
+   volt->vid[volt->vid_nr].uv = info.base;
+   volt->vid[volt->vid_nr].vid = i;
+   volt->vid_nr++;
+   }
+   info.base += info.step;
+   }
+   volt->vid_mask = info.vidmask;
+   } else if (data && info.vidmask) {
+   for (i = 0; i < cnt; i++) {
+   data = nvbios_volt_entry_parse(bios, i, , ,
+ );
+   if (data) {
+   volt->vid[volt->vid_nr].uv = ivid.voltage;
+   volt->vid[volt->vid_nr].vid = ivid.vid;
+   volt->vid_nr++;
+   }
+   }
+   volt->vid_mask = info.vidmask;
+   }
+}
+
 int
 _nouveau_volt_init(struct nouveau_object *object)
 {
@@ -136,10 +171,6 @@ nouveau_volt_create_(struct nouveau_object *parent,
 {
struct nouveau_bios *bios = nouveau_bios(parent);
struct nouveau_volt *volt;
-   struct nvbios_volt_entry ivid;
-   struct nvbios_volt info;
-   u8  ver, hdr, cnt, len;
-   u16 data;
int ret, i;
 
ret = nouveau_subdev_create_(parent, engine, oclass, 0, "VOLT",
@@ -152,31 +183,9 @@ nouveau_volt_create_(struct nouveau_object *parent,
volt->set = nouveau_volt_set;
volt->set_id = nouveau_volt_set_id;
 
-   data = nvbios_volt_parse(bios, , , , , );
-   if (data && info.vidmask && info.base && info.step) {
-   for (i = 0; i < info.vidmask + 1; i++) {
-   if (info.base >= info.min &&
-   info.base <= info.max) {
-   volt->vid[volt->vid_nr].uv = info.base;
-   volt->vid[volt->vid_nr].vid = i;
-   volt->vid_nr++;
-   }
-   info.base += info.step;
-   }
-   volt->vid_mask = info.vidmask;
-   } else
-   if (data && info.vidmask) {
-   for (i = 0; i < cnt; i++) {
-   data = nvbios_volt_entry_parse(bios, i, , ,
- );
-   if (data) {
-   volt->vid[volt->vid_nr].uv = ivid.voltage;
-   volt->vid[volt->vid_nr].vid = ivid.vid;
-   volt->vid_nr++;
-   }
-   }
-   volt->vid_mask = info.vidmask;
-   }
+   /* Assuming the non-bios device should build the voltage table later */
+   if (bios)
+   nouveau_volt_parse_bios(bios, volt);
 
if (volt->vid_nr) {
for (i = 0; i < volt->vid_nr; i++) {
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[RESEND PATCH nouveau 2/3] volt: allow non-bios voltage scaling

2014-11-28 Thread Vince Hsu
Signed-off-by: Vince Hsu vin...@nvidia.com
---

Resend this patch with the fuse change and proper patch prefix
per Thierry's request.

 nvkm/subdev/volt/base.c | 67 -
 1 file changed, 38 insertions(+), 29 deletions(-)

diff --git a/nvkm/subdev/volt/base.c b/nvkm/subdev/volt/base.c
index 32794a999106..26ccd8df193f 100644
--- a/nvkm/subdev/volt/base.c
+++ b/nvkm/subdev/volt/base.c
@@ -101,6 +101,41 @@ nouveau_volt_set_id(struct nouveau_volt *volt, u8 id, int 
condition)
return ret;
 }
 
+static void nouveau_volt_parse_bios(struct nouveau_bios *bios,
+   struct nouveau_volt *volt)
+{
+   struct nvbios_volt_entry ivid;
+   struct nvbios_volt info;
+   u8  ver, hdr, cnt, len;
+   u16 data;
+   int i;
+
+   data = nvbios_volt_parse(bios, ver, hdr, cnt, len, info);
+   if (data  info.vidmask  info.base  info.step) {
+   for (i = 0; i  info.vidmask + 1; i++) {
+   if (info.base = info.min 
+   info.base = info.max) {
+   volt-vid[volt-vid_nr].uv = info.base;
+   volt-vid[volt-vid_nr].vid = i;
+   volt-vid_nr++;
+   }
+   info.base += info.step;
+   }
+   volt-vid_mask = info.vidmask;
+   } else if (data  info.vidmask) {
+   for (i = 0; i  cnt; i++) {
+   data = nvbios_volt_entry_parse(bios, i, ver, hdr,
+ ivid);
+   if (data) {
+   volt-vid[volt-vid_nr].uv = ivid.voltage;
+   volt-vid[volt-vid_nr].vid = ivid.vid;
+   volt-vid_nr++;
+   }
+   }
+   volt-vid_mask = info.vidmask;
+   }
+}
+
 int
 _nouveau_volt_init(struct nouveau_object *object)
 {
@@ -136,10 +171,6 @@ nouveau_volt_create_(struct nouveau_object *parent,
 {
struct nouveau_bios *bios = nouveau_bios(parent);
struct nouveau_volt *volt;
-   struct nvbios_volt_entry ivid;
-   struct nvbios_volt info;
-   u8  ver, hdr, cnt, len;
-   u16 data;
int ret, i;
 
ret = nouveau_subdev_create_(parent, engine, oclass, 0, VOLT,
@@ -152,31 +183,9 @@ nouveau_volt_create_(struct nouveau_object *parent,
volt-set = nouveau_volt_set;
volt-set_id = nouveau_volt_set_id;
 
-   data = nvbios_volt_parse(bios, ver, hdr, cnt, len, info);
-   if (data  info.vidmask  info.base  info.step) {
-   for (i = 0; i  info.vidmask + 1; i++) {
-   if (info.base = info.min 
-   info.base = info.max) {
-   volt-vid[volt-vid_nr].uv = info.base;
-   volt-vid[volt-vid_nr].vid = i;
-   volt-vid_nr++;
-   }
-   info.base += info.step;
-   }
-   volt-vid_mask = info.vidmask;
-   } else
-   if (data  info.vidmask) {
-   for (i = 0; i  cnt; i++) {
-   data = nvbios_volt_entry_parse(bios, i, ver, hdr,
- ivid);
-   if (data) {
-   volt-vid[volt-vid_nr].uv = ivid.voltage;
-   volt-vid[volt-vid_nr].vid = ivid.vid;
-   volt-vid_nr++;
-   }
-   }
-   volt-vid_mask = info.vidmask;
-   }
+   /* Assuming the non-bios device should build the voltage table later */
+   if (bios)
+   nouveau_volt_parse_bios(bios, volt);
 
if (volt-vid_nr) {
for (i = 0; i  volt-vid_nr; i++) {
-- 
1.9.1

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/