diff --git a/drivers/platform/x86/intel_cht_int33fe.c b/drivers/platform/x86/intel_cht_int33fe.c index 7787c6ed9671..108ed001acf8 100644 --- a/drivers/platform/x86/intel_cht_int33fe.c +++ b/drivers/platform/x86/intel_cht_int33fe.c @@ -30,6 +30,8 @@ struct cht_int33fe_data { struct i2c_client *max17047; struct i2c_client *fusb302; struct i2c_client *pi3usb30532; + struct fwnode_handle *port_node; + struct fwnode_handle *fusb302_node; /* Contain a list-head must be per device */ struct device_connection connections[5]; }; @@ -85,6 +87,12 @@ static const struct property_entry fusb302_props[] = { { } }; +static const struct property_entry usb_connector_props[] = { + PROPERTY_ENTRY_STRING("name", "connector"), + PROPERTY_ENTRY_STRING("data-role", "dual"), + { } +}; + static int cht_int33fe_probe(struct i2c_client *client) { struct device *dev = &client->dev; @@ -150,6 +158,19 @@ static int cht_int33fe_probe(struct i2c_client *client) if (!data) return -ENOMEM; + /* Node for the FUSB302 controller */ + data->fusb302_node = fwnode_create_software_node(fusb302_props, NULL); + if (IS_ERR(data->fusb302_node)) + return PTR_ERR(data->fusb302_node); + + /* Node for the connector (FUSB302 is the parent) */ + data->port_node = fwnode_create_software_node(usb_connector_props, + data->fusb302_node); + if (IS_ERR(data->port_node)) { + fwnode_remove_software_node(data->fusb302_node); + return PTR_ERR(data->port_node); + } + /* Work around BIOS bug, see comment on cht_int33fe_find_max17047 */ max17047 = cht_int33fe_find_max17047(); if (max17047) { @@ -189,7 +210,7 @@ static int cht_int33fe_probe(struct i2c_client *client) memset(&board_info, 0, sizeof(board_info)); strlcpy(board_info.type, "typec_fusb302", I2C_NAME_SIZE); board_info.dev_name = "fusb302"; - board_info.properties = fusb302_props; + board_info.fwnode = data->fusb302_node; board_info.irq = fusb302_irq; data->fusb302 = i2c_acpi_new_device(dev, 2, &board_info); @@ -216,6 +237,8 @@ static int cht_int33fe_probe(struct i2c_client *client) i2c_unregister_device(data->max17047); device_connections_remove(data->connections); + fwnode_remove_software_node(data->port_node); + fwnode_remove_software_node(data->fusb302_node); return -EPROBE_DEFER; /* Wait for the i2c-adapter to load */ } @@ -230,6 +253,8 @@ static int cht_int33fe_remove(struct i2c_client *i2c) i2c_unregister_device(data->max17047); device_connections_remove(data->connections); + fwnode_remove_software_node(data->port_node); + fwnode_remove_software_node(data->fusb302_node); return 0; }