soc/tegra: fuse: export tegra_sku_info
PATCH v3 1/3 soc/tegra: fuse: export tegra_sku_info
Some Tegra drivers might be compiled as kernel modules, and they need the fuse information for initialization. One example is the GK20A Nouveau driver. It needs the GPU speedo value to calculate frequency-voltage table. So export the tegra_sku_info.
Signed-off-by Vince Hsu <[email protected]>
Acked-by Thierry Reding <[email protected]>
---
v3: fix subject and typo, add reviewers' Acked-by
v2: add more description why we need this patch
drivers/soc/tegra/fuse/fuse-tegra.c | 1 + 1 file changed, 1 insertion(+)
drivers/soc/tegra/fuse/fuse-tegra.c +1 -0
@@ -31,6 +31,7 @@static u32 (*fuse_readl)(const unsigned int offset);static int fuse_size;struct tegra_sku_info tegra_sku_info; +EXPORT_SYMBOL (tegra_sku_info);static const char *tegra_revision_name[TEGRA_REVISION_MAX ] = { [TEGRA_REVISION_UNKNOWN ] ="unknown" ,
Signature · 1 line
1.9.1
PATCH v2 2/3 volt: allow non-bios voltage scaling
Signed-off-by Vince Hsu <[email protected]>
---
v2: add Alex's Acked-by
nvkm/subdev/volt/base.c | 67 ++++++++++++++++++++++++++++--------------------- 1 file changed, 38 insertions(+), 29 deletions(-)
nvkm/subdev/volt/base.c +38 -29
@@ -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++) {
Signature · 1 line
1.9.1
PATCH v2 3/3 volt: add support for GK20A
In reply to Vince HsuThe voltage value are calculated by the hardware characterized result.
Signed-off-by Vince Hsu <[email protected]>
Reviewed-by Alexandre Courbot <[email protected]>
---
v2: add Alex's Reviewed-by
drm/Kbuild | 1 + drm/core/subdev/volt/gk20a.c | 1 + nvkm/engine/device/nve0.c | 1 + nvkm/include/subdev/volt.h | 1 + nvkm/subdev/clock/gk20a.c | 15 ++++ nvkm/subdev/volt/gk20a.c | 202 +++++++++++++++++++++++++++++++++++++++++++ 6 files changed, 221 insertions(+) create mode 120000 drm/core/subdev/volt/gk20a.c create mode 100644 nvkm/subdev/volt/gk20a.c
drm/Kbuild +1 -0
@@ -225,6 +225,7 @@ nouveau-y += core/subdev/vm/nvc0.o nouveau-y += core/subdev/volt/base.o nouveau-y += core/subdev/volt/gpio.o nouveau-y += core/subdev/volt/nv40.o +nouveau-y += core/subdev/volt/gk20a.o nouveau-y += core/engine/falcon.o nouveau-y += core/engine/xtensa.o
drm/core/subdev/volt/gk20a.c new file +1 -0
@@ -0,0 +1 @@ +../../../../nvkm/subdev/volt/gk20a.c
nvkm/engine/device/nve0.c +1 -0
@@ -179,6 +179,7 @@ nve0_identify(struct nouveau_device *device) device->oclass[NVDEV_ENGINE_GR ] = gk20a_graph_oclass; device->oclass[NVDEV_ENGINE_COPY2 ] = &nve0_copy2_oclass; device->oclass[NVDEV_ENGINE_PERFMON ] = &nve0_perfmon_oclass; + device->oclass[NVDEV_SUBDEV_VOLT ] = &gk20a_volt_oclass;break ;case 0xf0 : device->cname ="GK110" ;
nvkm/include/subdev/volt.h +1 -0
@@ -52,6 +52,7 @@ int _nouveau_volt_init(struct nouveau_object *);#define _nouveau_volt_fini _nouveau_subdev_finiextern struct nouveau_oclass nv40_volt_oclass; +extern struct nouveau_oclass gk20a_volt_oclass;int nouveau_voltgpio_init (struct nouveau_volt *);int nouveau_voltgpio_get (struct nouveau_volt *);
nvkm/subdev/clock/gk20a.c +15 -0
@@ -470,76 +470,91 @@ gk20a_pstates[] = { { .base = { .domain[nv_clk_src_gpc] = 72000, + .voltage = 0, }, }, { .base = { .domain[nv_clk_src_gpc] = 108000, + .voltage = 1, }, }, { .base = { .domain[nv_clk_src_gpc] = 180000, + .voltage = 2, }, }, { .base = { .domain[nv_clk_src_gpc] = 252000, + .voltage = 3, }, }, { .base = { .domain[nv_clk_src_gpc] = 324000, + .voltage = 4, }, }, { .base = { .domain[nv_clk_src_gpc] = 396000, + .voltage = 5, }, }, { .base = { .domain[nv_clk_src_gpc] = 468000, + .voltage = 6, }, }, { .base = { .domain[nv_clk_src_gpc] = 540000, + .voltage = 7, }, }, { .base = { .domain[nv_clk_src_gpc] = 612000, + .voltage = 8, }, }, { .base = { .domain[nv_clk_src_gpc] = 648000, + .voltage = 9, }, }, { .base = { .domain[nv_clk_src_gpc] = 684000, + .voltage = 10, }, }, { .base = { .domain[nv_clk_src_gpc] = 708000, + .voltage = 11, }, }, { .base = { .domain[nv_clk_src_gpc] = 756000, + .voltage = 12, }, }, { .base = { .domain[nv_clk_src_gpc] = 804000, + .voltage = 13, }, }, { .base = { .domain[nv_clk_src_gpc] = 852000, + .voltage = 14, }, }, };
nvkm/subdev/volt/gk20a.c new file +202 -0
202 lines not on this page · raw message
Signature · 1 line
1.9.1