@@ -681,6 +681,9 @@ static const struct gc2145_reg default_regs[] = {
681681
682682struct gc2145_config {
683683 struct i2c_dt_spec i2c ;
684+ #if DT_INST_NODE_HAS_PROP (0 , pwdn_gpios )
685+ struct gpio_dt_spec pwdn_gpio ;
686+ #endif
684687#if DT_INST_NODE_HAS_PROP (0 , reset_gpios )
685688 struct gpio_dt_spec reset_gpio ;
686689#endif
@@ -1126,10 +1129,18 @@ static int gc2145_init(const struct device *dev)
11261129{
11271130 struct video_format fmt ;
11281131 int ret ;
1129-
1130- #if DT_INST_NODE_HAS_PROP (0 , reset_gpios )
11311132 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+ }
11321140
1141+ k_sleep (K_MSEC (10 ));
1142+ #endif
1143+ #if DT_INST_NODE_HAS_PROP (0 , reset_gpios )
11331144 ret = gpio_pin_configure_dt (& cfg -> reset_gpio , GPIO_OUTPUT_ACTIVE );
11341145 if (ret ) {
11351146 return ret ;
@@ -1166,6 +1177,9 @@ static int gc2145_init(const struct device *dev)
11661177/* Unique Instance */
11671178static const struct gc2145_config gc2145_cfg_0 = {
11681179 .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
11691183#if DT_INST_NODE_HAS_PROP (0 , reset_gpios )
11701184 .reset_gpio = GPIO_DT_SPEC_INST_GET (0 , reset_gpios ),
11711185#endif
@@ -1181,6 +1195,12 @@ static int gc2145_init_0(const struct device *dev)
11811195 return - ENODEV ;
11821196 }
11831197
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
11841204#if DT_INST_NODE_HAS_PROP (0 , reset_gpios )
11851205 if (!gpio_is_ready_dt (& cfg -> reset_gpio )) {
11861206 LOG_ERR ("%s: device %s is not ready" , dev -> name , cfg -> reset_gpio .port -> name );
0 commit comments