staticint keywest_probe(struct i2c_client *client)
{
keywest_probed = true; /* If instantiated via i2c-powermac, we still need to set the client */ if (!keywest_ctx->client)
keywest_ctx->client = client;
i2c_set_clientdata(client, keywest_ctx); return 0;
}
/* * This is kind of a hack, best would be to turn powermac to fixed i2c * bus numbers and declare the sound device as part of platform * initialization
*/ staticint keywest_attach_adapter(struct i2c_adapter *adapter)
{ struct i2c_board_info info; struct i2c_client *client;
if (! keywest_ctx) return -EINVAL;
if (strncmp(adapter->name, "mac-io", 6)) return -EINVAL; /* ignored */
/* * We know the driver is already loaded, so the device should be * already bound. If not it means binding failed, and then there * is no point in keeping the device instantiated.
*/ if (!keywest_ctx->client->dev.driver) {
i2c_unregister_device(keywest_ctx->client);
keywest_ctx->client = NULL; return -ENODEV;
}
return 0;
}
staticvoid keywest_remove(struct i2c_client *client)
{ if (! keywest_ctx) return; if (client == keywest_ctx->client)
keywest_ctx->client = NULL;
}
staticconststruct i2c_device_id keywest_i2c_id[] = {
{ "MAC,tas3004" }, /* instantiated by i2c-powermac */
{ "keywest" }, /* instantiated by us if needed */
{ }
};
MODULE_DEVICE_TABLE(i2c, keywest_i2c_id);
/* There was already a device from i2c-powermac. Great, let's return */ if (keywest_probed) return 0;
/* We assume Macs have consecutive I2C bus numbers starting at 0 */ while (adap) { /* Scan for devices to be bound to */
err = keywest_attach_adapter(adap); if (!err) return 0;
i2c_put_adapter(adap);
adap = i2c_get_adapter(++i);
}
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.