/* * Copyright 2013 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"auxch.h" #include"bus.h" #include"pad.h"
/* * We init our i2c busses as early as possible, since they may be * needed by the vbios init scripts on some cards
*/
list_for_each_entry(pad, &i2c->pad, head)
nvkm_i2c_pad_init(pad);
list_for_each_entry(bus, &i2c->bus, head)
nvkm_i2c_bus_init(bus);
/* internal outputs handled by native i2c busses (above) */ if (!dcbE.location) continue;
/* we need an i2c bus to talk to the external encoder */
bus = nvkm_i2c_bus_find(i2c, dcbE.i2c_index); if (!bus) {
nvkm_debug(&i2c->subdev, "dcb %02x no bus\n", i); continue;
}
/* ... and a driver for it */ while (drv->pad_new) { if (drv->bios == dcbE.extdev) break;
drv++;
}
if (!drv->pad_new) {
nvkm_debug(&i2c->subdev, "dcb %02x drv %02x unknown\n",
i, dcbE.extdev); continue;
}
/* find/create an instance of the driver */
pad = nvkm_i2c_pad_find(i2c, NVKM_I2C_PAD_EXT(dcbE.extdev)); if (!pad) { constint id = NVKM_I2C_PAD_EXT(dcbE.extdev);
ret = drv->pad_new(bus, id, drv->addr, &pad); if (ret) {
nvkm_error(&i2c->subdev, "dcb %02x pad, %d\n",
i, ret);
nvkm_i2c_pad_del(&pad); continue;
}
}
/* create any i2c bus / aux channel required by the output */ if (pad->func->aux_new_6 && dcbE.type == DCB_OUTPUT_DP) { constint id = NVKM_I2C_AUX_EXT(dcbE.extdev); struct nvkm_i2c_aux *aux = NULL;
ret = pad->func->aux_new_6(pad, id, 0, &aux); if (ret) {
nvkm_error(&i2c->subdev, "dcb %02x aux, %d\n",
i, ret);
nvkm_i2c_aux_del(&aux);
}
} else if (pad->func->bus_new_4) { constint id = NVKM_I2C_BUS_EXT(dcbE.extdev); struct nvkm_i2c_bus *bus = NULL;
ret = pad->func->bus_new_4(pad, id, 0, &bus); if (ret) {
nvkm_error(&i2c->subdev, "dcb %02x bus, %d\n",
i, ret);
nvkm_i2c_bus_del(&bus);
}
}
}
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.