File tree Expand file tree Collapse file tree 3 files changed +22
-1
lines changed
Expand file tree Collapse file tree 3 files changed +22
-1
lines changed Original file line number Diff line number Diff line change 1- config RT_USING_I2C
1+ menuconfig RT_USING_I2C
22 bool "Using I2C device drivers"
33 default n
44
@@ -241,3 +241,7 @@ if RT_USING_I2C
241241 endif
242242 endif
243243endif
244+
245+ if RT_USING_DM && RT_USING_I2C
246+ osource "$(SOC_DM_I2C_DIR)/Kconfig"
247+ endif
Original file line number Diff line number Diff line change @@ -61,6 +61,8 @@ void i2c_bus_scan_clients(struct rt_i2c_bus_device *bus)
6161 client -> bus = bus ;
6262 client -> client_addr = client_addr ;
6363
64+ rt_dm_dev_set_name (& client -> parent , "%s" , client -> name );
65+
6466 rt_i2c_device_register (client );
6567
6668 if (i2c_client_np != child_np )
Original file line number Diff line number Diff line change @@ -286,6 +286,21 @@ rt_err_t rt_i2c_driver_register(struct rt_i2c_driver *driver);
286286rt_err_t rt_i2c_device_register (struct rt_i2c_client * client );
287287
288288#define RT_I2C_DRIVER_EXPORT (driver ) RT_DRIVER_EXPORT(driver, i2c, BUILIN)
289+
290+ /**
291+ * @brief Get ID match data from I2C client
292+ *
293+ * This function retrieves the driver-specific data associated with the matched
294+ * device ID or OFW node ID for the I2C client.
295+ *
296+ * @param client the I2C client device
297+ *
298+ * @return const void* pointer to the ID match data, or RT_NULL if no match data exists
299+ */
300+ rt_inline const void * rt_i2c_client_id_data (struct rt_i2c_client * client )
301+ {
302+ return client -> id ? client -> id -> data : (client -> ofw_id ? client -> ofw_id -> data : RT_NULL );
303+ }
289304#endif /* RT_USING_DM */
290305
291306/**
You can’t perform that action at this time.
0 commit comments