@@ -75,10 +75,7 @@ static int fdc2x1x_bus_access(const struct device *dev, uint8_t reg,
7575 const struct fdc2x1x_config * cfg = dev -> config ;
7676
7777 if (reg & FDC2X1X_READ ) {
78- return i2c_burst_read (cfg -> bus ,
79- cfg -> i2c_addr ,
80- FDC2X1X_TO_I2C_REG (reg ),
81- data , length );
78+ return i2c_burst_read_dt (& cfg -> i2c , FDC2X1X_TO_I2C_REG (reg ), data , length );
8279 } else {
8380 if (length != 2 ) {
8481 return - EINVAL ;
@@ -89,8 +86,7 @@ static int fdc2x1x_bus_access(const struct device *dev, uint8_t reg,
8986 buf [0 ] = FDC2X1X_TO_I2C_REG (reg );
9087 memcpy (buf + 1 , data , sizeof (uint16_t ));
9188
92- return i2c_write (cfg -> bus , buf ,
93- sizeof (buf ), cfg -> i2c_addr );
89+ return i2c_write_dt (& cfg -> i2c , buf , sizeof (buf ));
9490 }
9591}
9692
@@ -931,8 +927,8 @@ static int fdc2x1x_init(const struct device *dev)
931927 }
932928 }
933929
934- if (!device_is_ready (cfg -> bus )) {
935- LOG_ERR ("%s: fdc2x1x device not ready" , dev -> name );
930+ if (!device_is_ready (cfg -> i2c . bus )) {
931+ LOG_ERR ("I2C bus device not ready" );
936932 return - ENODEV ;
937933 }
938934
@@ -1007,8 +1003,7 @@ static int fdc2x1x_init(const struct device *dev)
10071003 }; \
10081004 \
10091005 static const struct fdc2x1x_config fdc2x1x_config_##n = { \
1010- .bus = DEVICE_DT_GET(DT_INST_BUS(n)), \
1011- .i2c_addr = DT_INST_REG_ADDR(n), \
1006+ .i2c = I2C_DT_SPEC_INST_GET(n), \
10121007 .fdc2x14 = DT_INST_PROP(n, fdc2x14), \
10131008 .autoscan_en = DT_INST_PROP(n, autoscan), \
10141009 .rr_sequence = DT_INST_PROP(n, rr_sequence), \
0 commit comments