diff --git a/drivers/modem/simcom-sim7080.c b/drivers/modem/simcom-sim7080.c index 700eb7972af..b95d0962398 100644 --- a/drivers/modem/simcom-sim7080.c +++ b/drivers/modem/simcom-sim7080.c @@ -30,6 +30,9 @@ static K_KERNEL_STACK_DEFINE(modem_rx_stack, CONFIG_MODEM_SIMCOM_SIM7080_RX_STAC static K_KERNEL_STACK_DEFINE(modem_workq_stack, CONFIG_MODEM_SIMCOM_SIM7080_RX_WORKQ_STACK_SIZE); NET_BUF_POOL_DEFINE(mdm_recv_pool, MDM_RECV_MAX_BUF, MDM_RECV_BUF_SIZE, 0, NULL); +/* pin settings */ +static const struct gpio_dt_spec power_gpio = GPIO_DT_SPEC_INST_GET(0, mdm_power_gpios); + static void socket_close(struct modem_socket *sock); const struct socket_dns_offload offload_dns_ops; @@ -1225,9 +1228,9 @@ error: static void modem_pwrkey(void) { /* Power pin should be high for 1.5 seconds. */ - modem_pin_write(&mctx, 0, 1); + gpio_pin_set_dt(&power_gpio, 1); k_sleep(K_MSEC(1500)); - modem_pin_write(&mctx, 0, 0); + gpio_pin_set_dt(&power_gpio, 0); k_sleep(K_SECONDS(5)); } @@ -2371,8 +2374,12 @@ static int modem_init(const struct device *dev) #endif /* #if defined(CONFIG_MODEM_SIM_NUMBERS) */ mctx.data_rssi = &mdata.mdm_rssi; - mctx.pins = modem_pins; - mctx.pins_len = ARRAY_SIZE(modem_pins); + ret = gpio_pin_configure_dt(&power_gpio, GPIO_OUTPUT_LOW); + if (ret < 0) { + LOG_ERR("Failed to configure %s pin", "power"); + goto error; + } + mctx.driver_data = &mdata; memset(&gnss_data, 0, sizeof(gnss_data)); diff --git a/drivers/modem/simcom-sim7080.h b/drivers/modem/simcom-sim7080.h index 5eb4feffd6b..8695ad9c7d7 100644 --- a/drivers/modem/simcom-sim7080.h +++ b/drivers/modem/simcom-sim7080.h @@ -167,13 +167,6 @@ struct sim7080_data { struct k_sem sem_ftp; }; -/* - * Pin definitions - */ -static struct modem_pin modem_pins[] = { MODEM_PIN( - DT_INST_GPIO_LABEL(0, mdm_power_gpios), DT_INST_GPIO_PIN(0, mdm_power_gpios), - DT_INST_GPIO_FLAGS(0, mdm_power_gpios) | GPIO_OUTPUT_LOW) }; - /* * Socket read callback data. */ diff --git a/tests/drivers/build_all/modem/modem_simcom_sim7080.conf b/tests/drivers/build_all/modem/modem_simcom_sim7080.conf index b57f7105180..dc4645a2455 100644 --- a/tests/drivers/build_all/modem/modem_simcom_sim7080.conf +++ b/tests/drivers/build_all/modem/modem_simcom_sim7080.conf @@ -1,6 +1,7 @@ CONFIG_TEST=y CONFIG_TEST_RANDOM_GENERATOR=y CONFIG_SERIAL=y +CONFIG_GPIO=y CONFIG_NETWORKING=y CONFIG_NET_SOCKETS=y CONFIG_MODEM=y