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>
This commit is contained in:
parent
9353b6e98a
commit
41c618dbf7
3 changed files with 12 additions and 11 deletions
|
@ -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));
|
||||
|
|
|
@ -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.
|
||||
*/
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue