Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion components/drivers/i2c/Kconfig
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
config RT_USING_I2C
menuconfig RT_USING_I2C
bool "Using I2C device drivers"
default n

Expand Down Expand Up @@ -241,3 +241,7 @@ if RT_USING_I2C
endif
endif
endif

if RT_USING_DM && RT_USING_I2C
osource "$(SOC_DM_I2C_DIR)/Kconfig"
endif
2 changes: 2 additions & 0 deletions components/drivers/i2c/dev_i2c_bus.c
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ void i2c_bus_scan_clients(struct rt_i2c_bus_device *bus)
client->bus = bus;
client->client_addr = client_addr;

rt_dm_dev_set_name(&client->parent, "%s", client->name);

rt_i2c_device_register(client);

if (i2c_client_np != child_np)
Expand Down
5 changes: 5 additions & 0 deletions components/drivers/include/drivers/dev_i2c.h
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,11 @@ rt_err_t rt_i2c_driver_register(struct rt_i2c_driver *driver);
rt_err_t rt_i2c_device_register(struct rt_i2c_client *client);

#define RT_I2C_DRIVER_EXPORT(driver) RT_DRIVER_EXPORT(driver, i2c, BUILIN)

rt_inline const void *rt_i2c_client_id_data(struct rt_i2c_client *client)
{
return client->id ? client->id->data : (client->ofw_id ? client->ofw_id->data : RT_NULL);
}
#endif /* RT_USING_DM */

/**
Expand Down