34 static int nr_vidtag =
sizeof(vidtag) /
sizeof(vidtag[0]);
45 for (i = 0; i < nr_vidtag; i++) {
49 vid |= gpio->
get(gpio, 0, vidtag[i], 0xff) <<
i;
67 for (i = 0; i < nr_vidtag; i++) {
71 gpio->
set(gpio, 0, vidtag[i], 0xff, !!(vid & (1 << i)));
83 for (i = 0; i < volt->
nr_level; i++) {
84 if (volt->
level[i].voltage == voltage)
97 for (i = 0; i < volt->
nr_level; i++) {
98 if (volt->
level[i].vid == vid)
99 return volt->
level[
i].voltage;
116 int i, headerlen, recordlen,
entries, vidmask, vidshift;
118 if (bios->
type == NVBIOS_BIT) {
132 NV_DEBUG(drm,
"BMP version too old for voltage\n");
140 NV_DEBUG(drm,
"voltage table pointer invalid\n");
184 NV_WARN(drm,
"voltage table 0x%02x unknown\n", volt[0]);
196 NV_DEBUG(drm,
"vid bit %d unknown\n", i);
200 if (gpio && gpio->
find(gpio, 0, vidtag[i], 0xff, &func)) {
201 NV_DEBUG(drm,
"vid bit %d has no gpio tag\n", i);
218 entry = volt + headerlen;
219 for (i = 0; i <
entries; i++, entry += recordlen) {
220 voltage->
level[
i].voltage = entry[0] * 10000;
221 voltage->
level[
i].vid = entry[1] >> vidshift;
234 for (vid = 0; vid <= voltage->
vid_mask; vid++) {
235 voltage->
level[
vid].voltage = volt_uv;