+A better alternative would be to turn OF calls into fwnode calls and
+ ctx->connector = connector;
+ }
if (ctx->info->id == ID_IT66121) {
ret = regmap_write_bits(ctx->regmap, IT66121_CLK_BANK_REG,
@@ -1632,16 +1651,13 @@ static const char * const it66121_supplies[] = {
"vcn33", "vcn18", "vrf12"
};
-static int it66121_probe(struct i2c_client *client)
+int it66121_create_bridge(struct i2c_client *client, bool of_support,
+ bool hpd_support, bool audio_support,
+ struct drm_bridge **bridge)
{
+ struct device *dev = &client->dev;
int ret;
struct it66121_ctx *ctx;
- struct device *dev = &client->dev;
-
- if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C)) {
- dev_err(dev, "I2C check functionality failed.\n");
- return -ENXIO;
- }
ctx = devm_kzalloc(dev, sizeof(*ctx), GFP_KERNEL);
if (!ctx)
@@ -1649,24 +1665,19 @@ static int it66121_probe(struct i2c_client *client)
ctx->dev = dev;
ctx->client = client;
- ctx->info = i2c_get_match_data(client);
-
- ret = it66121_of_read_bus_width(dev, &ctx->bus_width);
- if (ret)
- return ret;
-
- ret = it66121_of_get_next_bridge(dev, &ctx->next_bridge);
- if (ret)
- return ret;
-
- i2c_set_clientdata(client, ctx);
mutex_init(&ctx->lock);
- ret = devm_regulator_bulk_get_enable(dev, ARRAY_SIZE(it66121_supplies),
- it66121_supplies);
- if (ret) {
- dev_err(dev, "Failed to enable power supplies\n");
- return ret;
+ if (of_support) {
+ ret = it66121_of_read_bus_width(dev, &ctx->bus_width);
+ if (ret)
+ return ret;
+
+ ret = it66121_of_get_next_bridge(dev, &ctx->next_bridge);
+ if (ret)
+ return ret;
+ } else {
+ ctx->bus_width = 24;
+ ctx->next_bridge = NULL;
}
to populate the fwnode properties. See
drivers/platform/x86/intel/chtwc_int33fe.c for example.