modem: simcom-sim7080: use 'gpio_dt_spec' instead of 'modem_pin'
Move away from 'modem_pin' abstraction as it has not obvious value compared
to generic 'gpio_dt_spec'.
Signed-off-by: Marcin Niestroj <m.niestroj@emb.dev>
diff --git a/drivers/modem/simcom-sim7080.c b/drivers/modem/simcom-sim7080.c
index 700eb79..b95d096 100644
--- a/drivers/modem/simcom-sim7080.c
+++ b/drivers/modem/simcom-sim7080.c
@@ -30,6 +30,9 @@
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 @@
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 @@
#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));