/* * Copyright 2011 Red Hat Inc. * * 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 following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. * * Authors: Ben Skeggs
*/ #include"priv.h"
#include <core/option.h>
staticint
nvkm_gpio_drive(struct nvkm_gpio *gpio, int idx, int line, int dir, int out)
{ return gpio->func->drive(gpio, line, dir, out);
}
staticint
nvkm_gpio_sense(struct nvkm_gpio *gpio, int idx, int line)
{ return gpio->func->sense(gpio, line);
}
int
nvkm_gpio_set(struct nvkm_gpio *gpio, int idx, u8 tag, u8 line, int state)
{ struct dcb_gpio_func func; int ret;
ret = nvkm_gpio_find(gpio, idx, tag, line, &func); if (ret == 0) { int dir = !!(func.log[state] & 0x02); int out = !!(func.log[state] & 0x01);
ret = nvkm_gpio_drive(gpio, idx, func.line, dir, out);
}
return ret;
}
int
nvkm_gpio_get(struct nvkm_gpio *gpio, int idx, u8 tag, u8 line)
{ struct dcb_gpio_func func; int ret;
ret = nvkm_gpio_find(gpio, idx, tag, line, &func); if (ret == 0) {
ret = nvkm_gpio_sense(gpio, idx, func.line); if (ret >= 0)
ret = (ret == (func.log[1] & 1));
}
staticint
nvkm_gpio_init(struct nvkm_subdev *subdev)
{ struct nvkm_gpio *gpio = nvkm_gpio(subdev); struct dcb_gpio_func func; int ret; int i;
if (dmi_check_system(gpio_reset_ids))
nvkm_gpio_reset(gpio, DCB_GPIO_UNUSED);
if (nvkm_boolopt(subdev->device->cfgopt, "NvPowerChecks", true)) { for (i = 0; i < ARRAY_SIZE(power_checks); ++i) {
ret = nvkm_gpio_find(gpio, 0, power_checks[i],
DCB_GPIO_UNUSED, &func); if (ret) continue;
ret = nvkm_gpio_get(gpio, 0, func.func, func.line); if (!ret) continue;
nvkm_error(&gpio->subdev, "GPU is missing power, check its power " "cables. Boot with " "nouveau.config=NvPowerChecks=0 to " "disable.\n"); return -EINVAL;
}
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.