@@ -681,6 +681,9 @@ static const struct gc2145_reg default_regs[] = {
681
681
682
682
struct gc2145_config {
683
683
struct i2c_dt_spec i2c ;
684
+ #if DT_INST_NODE_HAS_PROP (0 , pwdn_gpios )
685
+ struct gpio_dt_spec pwdn_gpio ;
686
+ #endif
684
687
#if DT_INST_NODE_HAS_PROP (0 , reset_gpios )
685
688
struct gpio_dt_spec reset_gpio ;
686
689
#endif
@@ -1126,10 +1129,18 @@ static int gc2145_init(const struct device *dev)
1126
1129
{
1127
1130
struct video_format fmt ;
1128
1131
int ret ;
1129
-
1130
- #if DT_INST_NODE_HAS_PROP (0 , reset_gpios )
1131
1132
const struct gc2145_config * cfg = dev -> config ;
1133
+ (void ) cfg ;
1134
+
1135
+ #if DT_INST_NODE_HAS_PROP (0 , pwdn_gpios )
1136
+ ret = gpio_pin_configure_dt (& cfg -> pwdn_gpio , GPIO_OUTPUT_INACTIVE );
1137
+ if (ret ) {
1138
+ return ret ;
1139
+ }
1132
1140
1141
+ k_sleep (K_MSEC (10 ));
1142
+ #endif
1143
+ #if DT_INST_NODE_HAS_PROP (0 , reset_gpios )
1133
1144
ret = gpio_pin_configure_dt (& cfg -> reset_gpio , GPIO_OUTPUT_ACTIVE );
1134
1145
if (ret ) {
1135
1146
return ret ;
@@ -1166,6 +1177,9 @@ static int gc2145_init(const struct device *dev)
1166
1177
/* Unique Instance */
1167
1178
static const struct gc2145_config gc2145_cfg_0 = {
1168
1179
.i2c = I2C_DT_SPEC_INST_GET (0 ),
1180
+ #if DT_INST_NODE_HAS_PROP (0 , pwdn_gpios )
1181
+ .pwdn_gpio = GPIO_DT_SPEC_INST_GET (0 , pwdn_gpios ),
1182
+ #endif
1169
1183
#if DT_INST_NODE_HAS_PROP (0 , reset_gpios )
1170
1184
.reset_gpio = GPIO_DT_SPEC_INST_GET (0 , reset_gpios ),
1171
1185
#endif
@@ -1181,6 +1195,12 @@ static int gc2145_init_0(const struct device *dev)
1181
1195
return - ENODEV ;
1182
1196
}
1183
1197
1198
+ #if DT_INST_NODE_HAS_PROP (0 , pwdn_gpios )
1199
+ if (!gpio_is_ready_dt (& cfg -> pwdn_gpio )) {
1200
+ LOG_ERR ("%s: device %s is not ready" , dev -> name , cfg -> pwdn_gpio .port -> name );
1201
+ return - ENODEV ;
1202
+ }
1203
+ #endif
1184
1204
#if DT_INST_NODE_HAS_PROP (0 , reset_gpios )
1185
1205
if (!gpio_is_ready_dt (& cfg -> reset_gpio )) {
1186
1206
LOG_ERR ("%s: device %s is not ready" , dev -> name , cfg -> reset_gpio .port -> name );
0 commit comments